Author: doogie
Date: Sun Aug 3 21:02:01 2008 New Revision: 682251 URL: http://svn.apache.org/viewvc?rev=682251&view=rev Log: Switch to FastList/FastMap/FastSet; they have more stable memory allocation than java.util variants. Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/email/NotificationServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/search/ContentDocument.java ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/CheckPermissionTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentAsText.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementEvents.java Sun Aug 3 21:02:01 2008 @@ -19,7 +19,6 @@ package org.ofbiz.content; import java.sql.Timestamp; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -29,6 +28,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javolution.util.FastMap; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.StringUtil; @@ -84,7 +85,7 @@ /* Set keySet = paramMap.keySet(); Iterator itKeySet = keySet.iterator(); - Map contentIdLookup = new HashMap(); + Map contentIdLookup = FastMap.newInstance(); while (itKeySet.hasNext()) { String idxAndContentId = (String)itKeySet.next(); int pos = idxAndContentId.indexOf("_"); @@ -112,7 +113,7 @@ String paramName = Integer.toString(counter) + "_" + pubContentId; String paramValue = (String)paramMap.get(paramName); //if (Debug.infoOn()) Debug.logInfo("in updateStaticValues, contentId:" + contentId + " pubContentId:" + pubContentId + " pubValue:" + pubValue + " paramName:" + paramName + " paramValue:" + paramValue, module); - Map serviceIn = new HashMap(); + Map serviceIn = FastMap.newInstance(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentIdTo", contentId); serviceIn.put("contentId", pubContentId); @@ -213,7 +214,7 @@ // Content can only be linked to one subsite under a top site (ends with "_MASTER") Set keySet = paramMap.keySet(); Iterator itKeySet = keySet.iterator(); - Map siteIdLookup = new HashMap(); + Map siteIdLookup = FastMap.newInstance(); while (itKeySet.hasNext()) { String param = (String)itKeySet.next(); int pos = param.indexOf("select_"); @@ -276,7 +277,7 @@ } } // create new link - Map serviceIn = new HashMap(); + Map serviceIn = FastMap.newInstance(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentId", targContentId); serviceIn.put("contentAssocTypeId", "PUBLISH_LINK"); @@ -295,7 +296,7 @@ return "error"; } - serviceIn = new HashMap(); + serviceIn = FastMap.newInstance(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentId", targContentId); serviceIn.put("contentAssocTypeId", "PUBLISH_LINK"); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java Sun Aug 3 21:02:01 2008 @@ -21,9 +21,6 @@ import java.nio.ByteBuffer; import java.sql.Timestamp; import java.util.Calendar; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -31,6 +28,10 @@ import javax.servlet.http.HttpSession; +import javolution.util.FastList; +import javolution.util.FastMap; +import javolution.util.FastSet; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; @@ -83,7 +84,7 @@ if (UtilValidate.isNotEmpty(assocTypesString)) { List lst = StringUtil.split(assocTypesString, "|"); if (assocTypes == null) { - assocTypes = new ArrayList(); + assocTypes = FastList.newInstance(); } assocTypes.addAll(lst); } @@ -180,7 +181,7 @@ // ContentPurposes can get passed in as a delimited string or a list. Combine. List contentPurposeList = (List)context.get("contentPurposeList"); if (contentPurposeList == null) - contentPurposeList = new ArrayList(); + contentPurposeList = FastList.newInstance(); String contentPurposeString = (String) context.get("contentPurposeString"); if (UtilValidate.isNotEmpty(contentPurposeString)) { List tmpPurposes = StringUtil.split(contentPurposeString, "|"); @@ -258,7 +259,7 @@ boolean dataResourceExists = true; if (Debug.infoOn()) Debug.logInfo("in persist... dataResourceTypeId(0):" + dataResourceTypeId, null); if (UtilValidate.isNotEmpty(dataResourceTypeId) ) { - Map dataResourceResult = new HashMap(); + Map dataResourceResult = FastMap.newInstance(); try { dataResourceResult = persistDataResourceAndDataMethod(dctx, context); } catch (GenericServiceException e) { @@ -298,12 +299,12 @@ return ServiceUtil.returnError(e.toString()); } } - //List targetOperations = new ArrayList(); + //List targetOperations = FastList.newInstance(); //context.put("targetOperations", targetOperations); context.putAll(content); if (contentExists) { //targetOperations.add("CONTENT_UPDATE"); - Map contentContext = new HashMap(); + Map contentContext = FastMap.newInstance(); ModelService contentModel = dispatcher.getDispatchContext().getModelService("updateContent"); contentContext.putAll(contentModel.makeValid(content, "IN")); contentContext.put("userLogin", userLogin); @@ -317,7 +318,7 @@ //Map thisResult = ContentServices.updateContentMethod(dctx, context); } else { //targetOperations.add("CONTENT_CREATE"); - Map contentContext = new HashMap(); + Map contentContext = FastMap.newInstance(); ModelService contentModel = dispatcher.getDispatchContext().getModelService("createContent"); contentContext.putAll(contentModel.makeValid(content, "IN")); contentContext.put("userLogin", userLogin); @@ -341,7 +342,7 @@ if (contentId != null && !contentExists) { try { if (contentPurposeList != null) { - HashSet contentPurposeSet = new HashSet(contentPurposeList); + Set contentPurposeSet = UtilMisc.makeSetWritable(contentPurposeList); Iterator iter = contentPurposeSet.iterator(); while (iter.hasNext()) { String contentPurposeTypeId = (String)iter.next(); @@ -359,7 +360,7 @@ } else if (UtilValidate.isNotEmpty(dataResourceTypeId) && UtilValidate.isNotEmpty(contentId)) { // If dataResource was not previously existing, then update the associated content with its id if (UtilValidate.isNotEmpty(dataResourceId) && !dataResourceExists) { - Map map = new HashMap(); + Map map = FastMap.newInstance(); map.put("userLogin", userLogin); map.put("dataResourceId", dataResourceId); map.put("contentId", contentId); @@ -380,7 +381,7 @@ if (UtilValidate.isNotEmpty(contentAssocTypeId) && contentAssoc.get("contentId") != null && contentAssoc.get("contentIdTo") != null) { if (Debug.infoOn()) Debug.logInfo("in persistContentAndAssoc, deactivateExisting:" + deactivateExisting, null); - Map contentAssocContext = new HashMap(); + Map contentAssocContext = FastMap.newInstance(); contentAssocContext.put("userLogin", userLogin); contentAssocContext.put("displayFailCond", bDisplayFailCond); contentAssocContext.put("skipPermissionCheck", context.get("skipPermissionCheck")); @@ -453,7 +454,7 @@ GenericDelegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue)context.get("userLogin"); //String userLoginPartyId = userLogin.getString("partyId"); - Map results = new HashMap(); + Map results = FastMap.newInstance(); // siteContentId will equal "ADMIN_MASTER", "AGINC_MASTER", etc. // Remember that this service is called in the "multi" mode, // with a new siteContentId each time. @@ -476,7 +477,7 @@ Iterator siteRoleIter = siteRoles.iterator(); while (siteRoleIter.hasNext()) { - Map serviceContext = new HashMap(); + Map serviceContext = FastMap.newInstance(); serviceContext.put("partyId", partyId); serviceContext.put("contentId", siteContentId); serviceContext.put("userLogin", userLogin); @@ -497,7 +498,7 @@ //return ServiceUtil.returnError(e.toString()); if (fromDate == null ) { try { - Map newContext = new HashMap(); + Map newContext = FastMap.newInstance(); newContext.put("contentId", serviceContext.get("contentId")); newContext.put("partyId", serviceContext.get("partyId")); newContext.put("roleTypeId", serviceContext.get("roleTypeId")); @@ -527,7 +528,7 @@ //Timestamp thruDate = UtilDateTime.nowTimestamp(); //serviceContext.put("thruDate", thruDate); //serviceContext.put("fromDate", fromDate); - Map newContext = new HashMap(); + Map newContext = FastMap.newInstance(); newContext.put("contentId", serviceContext.get("contentId")); newContext.put("partyId", serviceContext.get("partyId")); newContext.put("roleTypeId", serviceContext.get("roleTypeId")); @@ -553,7 +554,7 @@ //GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); //String contentId = (String)context.get("contentId"); - Map result = new HashMap(); + Map result = FastMap.newInstance(); try { //GenericValue content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); ModelService checkPermModel = dispatcher.getDispatchContext().getModelService("checkContentPermission"); @@ -586,8 +587,8 @@ public static Map persistDataResourceAndDataMethod(DispatchContext dctx, Map context) throws GenericServiceException, GenericEntityException, Exception { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); - Map newDrContext = new HashMap(); + Map result = FastMap.newInstance(); + Map newDrContext = FastMap.newInstance(); GenericValue dataResource = delegator.makeValue("DataResource"); dataResource.setPKFields(context); dataResource.setNonPKFields(context); @@ -643,7 +644,7 @@ dataResourceId = (String)thisResult.get("dataResourceId"); if (Debug.infoOn()) Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, null); dataResource = (GenericValue)thisResult.get("dataResource"); - Map fileContext = new HashMap(); + Map fileContext = FastMap.newInstance(); fileContext.put("userLogin", userLogin); if ( dataResourceTypeId.indexOf("_FILE") >=0) { boolean hasData = false; @@ -700,7 +701,7 @@ //Map thisResult = DataServices.updateDataResourceMethod(dctx, context); if (Debug.infoOn()) Debug.logInfo("====in persist... thisResult.permissionStatus(0):" + thisResult.get("permissionStatus"), null); //thisResult = DataServices.updateElectronicTextMethod(dctx, context); - Map fileContext = new HashMap(); + Map fileContext = FastMap.newInstance(); fileContext.put("userLogin", userLogin); String forceElectronicText = (String)context.get("forceElectronicText"); Debug.logInfo("====dataResourceType" + dataResourceTypeId , module); @@ -775,8 +776,8 @@ LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); - Map results = new HashMap(); - Map serviceContext = new HashMap(); + Map results = FastMap.newInstance(); + Map serviceContext = FastMap.newInstance(); // siteContentId will equal "ADMIN_MASTER", "AGINC_MASTER", etc. // Remember that this service is called in the "multi" mode, // with a new siteContentId each time. @@ -829,7 +830,7 @@ //Timestamp thruDate = UtilDateTime.nowTimestamp(); //serviceContext.put("thruDate", thruDate); //serviceContext.put("fromDate", fromDate); - Map newContext = new HashMap(); + Map newContext = FastMap.newInstance(); newContext.put("contentId", serviceContext.get("contentId")); newContext.put("partyId", serviceContext.get("partyId")); newContext.put("roleTypeId", serviceContext.get("roleTypeId")); @@ -847,12 +848,12 @@ public static Map updateOrRemove(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String entityName = (String)context.get("entityName"); String action = (String)context.get("action"); String pkFieldCount = (String)context.get("pkFieldCount"); - Map pkFields = new HashMap(); + Map pkFields = FastMap.newInstance(); int fieldCount = Integer.parseInt(pkFieldCount); for (int i=0; i<fieldCount; i++) { String fieldName = (String)context.get("fieldName" + i); @@ -893,7 +894,7 @@ public static Map resequence(DispatchContext dctx, Map context) throws GenericServiceException{ - HashMap result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String contentIdTo = (String)context.get("contentIdTo"); Integer seqInc = (Integer)context.get("seqInc"); @@ -901,11 +902,11 @@ seqInc = new Integer(100); int seqIncrement = seqInc.intValue(); List typeList = (List)context.get("typeList"); - if (typeList == null) typeList = new ArrayList(); + if (typeList == null) typeList = FastList.newInstance(); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); if (UtilValidate.isNotEmpty(contentAssocTypeId)) typeList.add(contentAssocTypeId); if (UtilValidate.isEmpty(typeList)) typeList = UtilMisc.toList("PUBLISH_LINK", "SUB_CONTENT"); - List condList = new ArrayList(); + List condList = FastList.newInstance(); Iterator iterType = typeList.iterator(); while (iterType.hasNext()) { String type = (String)iterType.next(); @@ -973,7 +974,7 @@ } public static Map changeLeafToNode(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String contentId = (String)context.get("contentId"); @@ -1041,7 +1042,7 @@ public static Map updateLeafCount(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); List typeList = (List)context.get("typeList"); if (typeList == null) @@ -1060,7 +1061,7 @@ /* public static Map updateLeafChange(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); List typeList = (List)context.get("typeList"); if (typeList == null) @@ -1083,7 +1084,7 @@ //subLeafCount = subLeafCount; } - List condList = new ArrayList(); + List condList = FastList.newInstance(); Iterator iterType = typeList.iterator(); while (iterType.hasNext()) { String type = (String)iterType.next(); @@ -1131,10 +1132,10 @@ public static Map updatePageType(DispatchContext dctx, Map context) throws GenericServiceException{ GenericDelegator delegator = dctx.getDelegator(); - Map results = new HashMap(); + Map results = FastMap.newInstance(); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = FastSet.newInstance(); context.put("visitedSet", visitedSet); } String pageMode = (String)context.get("pageMode"); @@ -1171,10 +1172,10 @@ public static Map resetToOutlineMode(DispatchContext dctx, Map context) throws GenericServiceException{ GenericDelegator delegator = dctx.getDelegator(); - Map results = new HashMap(); + Map results = FastMap.newInstance(); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = FastSet.newInstance(); context.put("visitedSet", visitedSet); } String contentId = (String)context.get("contentId"); @@ -1215,7 +1216,7 @@ } public static Map clearContentAssocViewCache(DispatchContext dctx, Map context) throws GenericServiceException{ - Map results = new HashMap(); + Map results = FastMap.newInstance(); UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom"); @@ -1233,7 +1234,7 @@ public static Map clearContentAssocDataResourceViewCache(DispatchContext dctx, Map context) throws GenericServiceException{ - Map results = new HashMap(); + Map results = FastMap.newInstance(); UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom"); if (utilCache != null) { @@ -1253,7 +1254,7 @@ String contentId = content.getString("contentId"); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = FastSet.newInstance(); context.put("visitedSet", visitedSet); } else { if (visitedSet.contains(contentId)) { @@ -1289,7 +1290,7 @@ String contentId = content.getString("contentId"); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = FastSet.newInstance(); context.put("visitedSet", visitedSet); } else { if (visitedSet.contains(contentId)) { @@ -1329,10 +1330,10 @@ } public static Map findSubNodes(DispatchContext dctx, Map context) throws GenericServiceException{ - Map results = new HashMap(); + Map results = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String contentIdTo = (String)context.get("contentId"); - List condList = new ArrayList(); + List condList = FastList.newInstance(); EntityExpr expr = EntityCondition.makeCondition("caContentIdTo", EntityOperator.EQUALS, contentIdTo); condList.add(expr); expr = EntityCondition.makeCondition("caContentAssocTypeId", EntityOperator.EQUALS, "SUB_CONTENT"); @@ -1367,7 +1368,7 @@ } public static Map initContentChildCounts(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericValue content = (GenericValue)context.get("content"); if (content == null) { @@ -1388,7 +1389,7 @@ } public static Map incrementContentChildStats(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String contentId = (String)context.get("contentId"); @@ -1414,7 +1415,7 @@ } public static Map decrementContentChildStats(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String contentId = (String)context.get("contentId"); @@ -1440,12 +1441,12 @@ } public static Map updateContentChildStats(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String contentId = (String)context.get("contentId"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); - List typeList = new ArrayList(); + List typeList = FastList.newInstance(); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { typeList.add(contentAssocTypeId); } else { @@ -1461,7 +1462,7 @@ } public static Map updateContentSubscription(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); @@ -1526,7 +1527,7 @@ if (hasExistingContentRole) { contentRole.store(); } else { - Map map = new HashMap(); + Map map = FastMap.newInstance(); map.put("partyId", partyId); map.put("roleTypeId", roleTypeId); map.put("userLogin", userLogin); @@ -1540,7 +1541,7 @@ } public static Map updateContentSubscriptionByProduct(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String productId = (String) context.get("productId"); @@ -1586,7 +1587,7 @@ } public static Map updateContentSubscriptionByOrder(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String orderId = (String) context.get("orderId"); @@ -1648,14 +1649,14 @@ String contentId = (String)context.get("contentId"); String serviceName = (String)context.get("serviceName"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); - List contentAssocTypeIdList = new ArrayList(); + List contentAssocTypeIdList = FastList.newInstance(); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { contentAssocTypeIdList = StringUtil.split(contentAssocTypeId, "|"); } if (contentAssocTypeIdList.size() == 0) { contentAssocTypeIdList.add("SUB_CONTENT"); } - Map ctx = new HashMap(); + Map ctx = FastMap.newInstance(); ctx.put("userLogin", userLogin); ctx.put("contentAssocTypeIdList", contentAssocTypeIdList); try { @@ -1676,7 +1677,7 @@ List contentAssocTypeIdList = (List)context.get("contentAssocTypeIdList" ); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = FastSet.newInstance(); context.put("visitedSet", visitedSet); } else { if (visitedSet.contains(contentId)) { @@ -1733,9 +1734,9 @@ return ServiceUtil.returnError(errorMsg); } String contentId = (String)result.get("contentId"); - List parentList = new ArrayList(); + List parentList = FastList.newInstance(); if (UtilValidate.isEmpty(masterRevisionContentId)) { - Map traversMap = new HashMap(); + Map traversMap = FastMap.newInstance(); traversMap.put("contentId", contentId); traversMap.put("direction", "To"); traversMap.put("contentAssocTypeId", "COMPDOC_PART"); @@ -1746,7 +1747,7 @@ } // Update ContentRevision and ContentRevisonItem - Map contentRevisionMap = new HashMap(); + Map contentRevisionMap = FastMap.newInstance(); contentRevisionMap.put("itemContentId", contentId); contentRevisionMap.put("newDataResourceId", result.get("dataResourceId")); contentRevisionMap.put("oldDataResourceId", oldDataResourceId); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java Sun Aug 3 21:02:01 2008 @@ -19,10 +19,8 @@ package org.ofbiz.content; import java.sql.Timestamp; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -31,6 +29,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.StringUtil; @@ -60,8 +61,8 @@ public class ContentManagementWorker { public static final String module = ContentManagementWorker.class.getName(); - public static Map cachedWebSitePublishPoints = new HashMap(); - public static Map cachedStaticValues = new HashMap(); + public static Map cachedWebSitePublishPoints = FastMap.newInstance(); + public static Map cachedStaticValues = FastMap.newInstance(); public static void mruAdd(HttpServletRequest request, GenericEntity pk, String suffix ) { HttpSession session = request.getSession(); @@ -79,7 +80,7 @@ Map lookupCaches = (Map)session.getAttribute("lookupCaches"); if(lookupCaches == null){ - lookupCaches = new HashMap(); + lookupCaches = FastMap.newInstance(); session.setAttribute("lookupCaches", lookupCaches); } String entityName = pk.getEntityName(); @@ -132,7 +133,7 @@ String sig = ""; Collection keyColl = pk.getPrimaryKey().getAllKeys(); - List keyList = new ArrayList(keyColl); + List keyList = UtilMisc.makeListWritable(keyColl); Collections.sort(keyList); Iterator it = keyList.iterator(); while (it.hasNext()) { @@ -162,7 +163,7 @@ HttpSession session = request.getSession(); Map currentEntityMap = (Map)session.getAttribute("currentEntityMap"); if(currentEntityMap == null){ - currentEntityMap = new HashMap(); + currentEntityMap = FastMap.newInstance(); session.setAttribute("currentEntityMap", currentEntityMap); } @@ -218,7 +219,7 @@ HttpSession session = request.getSession(); Map currentEntityMap = (Map)session.getAttribute("currentEntityMap"); if(currentEntityMap == null){ - currentEntityMap = new HashMap(); + currentEntityMap = FastMap.newInstance(); session.setAttribute("currentEntityMap", currentEntityMap); } Map paramMap = UtilHttp.getParameterMap(request); @@ -315,7 +316,7 @@ public static List getPermittedPublishPoints(GenericDelegator delegator, List allPublishPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { - List permittedPublishPointList = new ArrayList(); + List permittedPublishPointList = FastList.newInstance(); // Check that user has permission to admin sites Iterator it = allPublishPoints.iterator(); @@ -330,7 +331,7 @@ entityAction = "_ADMIN"; List passedPurposes = UtilMisc.toList("ARTICLE"); List roles = StringUtil.split(passedRoles, "|"); - List targetOperationList = new ArrayList(); + List targetOperationList = FastList.newInstance(); if (UtilValidate.isEmpty(permittedOperations)) { targetOperationList.add("CONTENT" + entityAction); } else { @@ -366,7 +367,7 @@ } catch(GenericEntityException e) { throw new GeneralException(e.getMessage()); } - List allPublishPoints = new ArrayList(); + List allPublishPoints = FastList.newInstance(); GenericValue webSitePublishPoint = null; GenericValue rootWebSitePublishPoint = null; GenericValue currentWebSitePublishPoint = null; @@ -385,7 +386,7 @@ public static Map getPublishPointMap(GenericDelegator delegator, String pubPtId ) throws GeneralException { List publishPointList = getAllPublishPoints( delegator, pubPtId ); - Map publishPointMap = new HashMap(); + Map publishPointMap = FastMap.newInstance(); Iterator it = publishPointList.iterator(); while (it.hasNext()) { GenericValue webSitePublishPoint = (GenericValue)it.next(); @@ -410,7 +411,7 @@ public static Map getPublishPointMap(GenericDelegator delegator, List publishPointList ) { - Map publishPointMap = new HashMap(); + Map publishPointMap = FastMap.newInstance(); Iterator it = publishPointList.iterator(); while (it.hasNext()) { GenericValue webSitePublishPoint = (GenericValue)it.next(); @@ -429,7 +430,7 @@ throw new GeneralException(e.getMessage()); } - List staticValueList = new ArrayList(); + List staticValueList = FastList.newInstance(); Iterator it = assocValueList.iterator(); int counter = 0; while(it.hasNext()) { @@ -437,7 +438,7 @@ String contentId = (String)content.get("contentId"); String contentName = (String)content.get("contentName"); String description = (String)content.get("description"); - Map map = new HashMap(); + Map map = FastMap.newInstance(); map.put("contentId", contentId); map.put("contentName", contentName); map.put("description", description); @@ -532,7 +533,7 @@ if (!ignoreCache) { Map subStaticValueMap = (GenericValue)cachedStaticValues.get(parentPlaceholderId); if (subStaticValueMap == null) { - subStaticValueMap = new HashMap(); + subStaticValueMap = FastMap.newInstance(); cachedStaticValues.put(parentPlaceholderId, subStaticValueMap); } //Map staticValueMap = (GenericValue)cachedStaticValues.get(web); @@ -560,8 +561,8 @@ List allPublishPointList = getAllPublishPoints( delegator, rootPubId ); //if (Debug.infoOn()) Debug.logInfo("in getPublishLinks, allPublishPointList:" + allPublishPointList, module); List publishPointList = getPermittedPublishPoints( delegator, allPublishPointList, userLogin, security , permittedAction, permittedOperations, passedRoles ); - Map publishPointMap = new HashMap(); - Map publishPointMapAll = new HashMap(); + Map publishPointMap = FastMap.newInstance(); + Map publishPointMapAll = FastMap.newInstance(); Iterator it = publishPointList.iterator(); while (it.hasNext()) { //GenericValue webSitePublishPoint = (GenericValue)it.next(); @@ -570,7 +571,7 @@ String [] arr = (String [])it.next(); String contentId = arr[0]; String description = arr[1]; - List subPointList = new ArrayList(); + List subPointList = FastList.newInstance(); Object nullObj = null; Object [] subArr = {contentId, subPointList, description, nullObj}; publishPointMap.put(contentId, subArr); @@ -598,7 +599,7 @@ } catch(GenericEntityException e) { throw new GeneralException(e.getMessage()); } - Map publishedLinkMap = new HashMap(); + Map publishedLinkMap = FastMap.newInstance(); Iterator it4 = assocValueList.iterator(); while (it4.hasNext()) { GenericValue contentAssoc = (GenericValue)it4.next(); @@ -624,7 +625,7 @@ } } - List publishedLinkList = new ArrayList(); + List publishedLinkList = FastList.newInstance(); Set keySet = publishPointMap.keySet(); Iterator it3 = keySet.iterator(); while (it3.hasNext()) { @@ -661,7 +662,7 @@ public static List getPermittedDepartmentPoints(GenericDelegator delegator, List allDepartmentPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { - List permittedDepartmentPointList = new ArrayList(); + List permittedDepartmentPointList = FastList.newInstance(); // Check that user has permission to admin sites Iterator it = allDepartmentPoints.iterator(); @@ -675,7 +676,7 @@ entityAction = "_ADMIN"; List passedPurposes = UtilMisc.toList("ARTICLE"); List roles = StringUtil.split(passedRoles, "|"); - List targetOperationList = new ArrayList(); + List targetOperationList = FastList.newInstance(); if (UtilValidate.isEmpty(permittedOperations)) { targetOperationList.add("CONTENT" + entityAction); } else { @@ -711,7 +712,7 @@ } catch(GenericEntityException e) { throw new GeneralException(e.getMessage()); } - List allDepartmentPoints = new ArrayList(); + List allDepartmentPoints = FastList.newInstance(); GenericValue departmentContent = null; GenericValue contentAssoc = null; Iterator it = relatedPubPts.iterator(); @@ -740,7 +741,7 @@ if (thisContent == null) throw new RuntimeException("No entity found for id=" + contentId); - List condList = new ArrayList(); + List condList = FastList.newInstance(); Iterator iterType = typeList.iterator(); while (iterType.hasNext()) { String type = (String)iterType.next(); @@ -778,7 +779,7 @@ if (thisContent == null) throw new RuntimeException("No entity found for id=" + contentId); - List condList = new ArrayList(); + List condList = FastList.newInstance(); Iterator iterType = typeList.iterator(); while (iterType.hasNext()) { String type = (String)iterType.next(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogRssServices.java Sun Aug 3 21:02:01 2008 @@ -20,13 +20,13 @@ package org.ofbiz.content.blog; import java.io.IOException; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import javolution.util.FastList; +import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; @@ -116,7 +116,7 @@ GenericValue v = (GenericValue) i.next(); String sub = null; try { - sub = ContentWorker.renderSubContentAsText(dispatcher, delegator, v.getString("contentId"), mapKey, new HashMap(), locale, mimeTypeId, true); + sub = ContentWorker.renderSubContentAsText(dispatcher, delegator, v.getString("contentId"), mapKey, FastMap.newInstance(), locale, mimeTypeId, true); } catch (GeneralException e) { Debug.logError(e, module); } catch (IOException e) { @@ -141,4 +141,4 @@ return entries; } -} \ No newline at end of file +} Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogServices.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/blog/BlogServices.java Sun Aug 3 21:02:01 2008 @@ -19,9 +19,10 @@ package org.ofbiz.content.blog; -import java.util.HashMap; import java.util.Map; +import javolution.util.FastMap; + import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericValue; @@ -45,7 +46,7 @@ public static Map persistBlogAll(DispatchContext dctx, Map context) throws GenericServiceException { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -191,7 +192,7 @@ String summaryData = (String)context.get("summaryData"); String summaryParentContentId = mainContentId; if (UtilValidate.isNotEmpty(summaryData) && UtilValidate.isNotEmpty(summaryParentContentId) ) { - Map subContentIn = new HashMap(); + Map subContentIn = FastMap.newInstance(); subContentIn.put("contentId", summaryParentContentId); subContentIn.put("mapKey", "SUMMARY"); Map thisResult = dispatcher.runSync("getSubContent", subContentIn); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java Sun Aug 3 21:02:01 2008 @@ -21,7 +21,6 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.ByteBuffer; -import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -32,6 +31,8 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javolution.util.FastMap; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; @@ -115,7 +116,7 @@ request.setAttribute(obj.toString(), val); } // Update ContentRevision and ContentRevisonItem - Map contentRevisionMap = new HashMap(); + Map contentRevisionMap = FastMap.newInstance(); contentRevisionMap.put("itemContentId", contentId); contentRevisionMap.put("contentId", contentId); contentRevisionMap.put("userLogin", userLogin); @@ -173,7 +174,7 @@ https = (String) servletContext.getAttribute("https"); } - Map mapIn = new HashMap(); + Map mapIn = FastMap.newInstance(); mapIn.put("contentId", contentId); mapIn.put("locale", locale); mapIn.put("rootDir", rootDir); @@ -247,7 +248,7 @@ https = (String) servletContext.getAttribute("https"); } - Map mapIn = new HashMap(); + Map mapIn = FastMap.newInstance(); mapIn.put("contentId", contentId); mapIn.put("locale", locale); mapIn.put("rootDir", rootDir); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java Sun Aug 3 21:02:01 2008 @@ -22,8 +22,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -31,6 +29,7 @@ import java.util.Set; import javolution.util.FastList; +import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; @@ -77,7 +76,7 @@ */ public static Map persistRootCompDoc(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale)context.get("locale"); @@ -121,7 +120,7 @@ //request.setAttribute("contentId", contentId); // Update ContentRevision and ContentRevisonItem - Map contentRevisionMap = new HashMap(); + Map contentRevisionMap = FastMap.newInstance(); contentRevisionMap.put("itemContentId", contentId); contentRevisionMap.put("contentId", contentId); contentRevisionMap.put("userLogin", userLogin); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java Sun Aug 3 21:02:01 2008 @@ -18,11 +18,12 @@ *******************************************************************************/ package org.ofbiz.content.content; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilMisc; @@ -108,7 +109,7 @@ displayPassCond = true; } Debug.logInfo("displayPassCond(0):" + displayPassCond, ""); - Map results = new HashMap(); + Map results = FastMap.newInstance(); String contentId = null; if (content != null) contentId = content.getString("contentId"); @@ -143,7 +144,7 @@ if (UtilValidate.isNotEmpty(contentPurposeString)) { List purposesFromString = StringUtil.split(contentPurposeString, "|"); if (passedPurposes == null) { - passedPurposes = new ArrayList(); + passedPurposes = FastList.newInstance(); } passedPurposes.addAll(purposesFromString); } @@ -160,7 +161,7 @@ if (UtilValidate.isNotEmpty(targetOperationString)) { List operationsFromString = StringUtil.split(targetOperationString, "|"); if (targetOperations == null) { - targetOperations = new ArrayList(); + targetOperations = FastList.newInstance(); } targetOperations.addAll(operationsFromString); } @@ -171,7 +172,7 @@ EntityPermissionChecker.StdRelatedRoleGetter roleGetter = new EntityPermissionChecker.StdRelatedRoleGetter("Content", "roleTypeId", "contentId", "partyId", "ownerContentId", "ContentRole"); //Debug.logInfo("targetOperations(b):" + targetOperations, ""); List passedRoles = (List) context.get("roleTypeList"); - if (passedRoles == null) passedRoles = new ArrayList(); + if (passedRoles == null) passedRoles = FastList.newInstance(); String roleTypeString = (String) context.get("roleTypeString"); if (UtilValidate.isNotEmpty(roleTypeString)) { List rolesFromString = StringUtil.split(roleTypeString, "|"); @@ -187,7 +188,7 @@ StringBuffer errBuf = new StringBuffer(); String permissionStatus = null; - List entityIds = new ArrayList(); + List entityIds = FastList.newInstance(); if (passed) { results.put("permissionStatus", "granted"); permissionStatus = "granted"; @@ -258,7 +259,7 @@ public static Map checkAssocPermission(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = FastMap.newInstance(); Security security = dctx.getSecurity(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -287,7 +288,7 @@ boolean isMatchTo = false; boolean isMatchFrom = false; - Map permResults = new HashMap(); + Map permResults = FastMap.newInstance(); String skipPermissionCheck = null; if (skipPermissionCheck == null @@ -296,7 +297,7 @@ // Use the purposes from the from entity for both cases. List relatedPurposes = EntityPermissionChecker.getRelatedPurposes(contentFrom, null); List relatedPurposesTo = EntityPermissionChecker.getRelatedPurposes(contentTo, relatedPurposes); - Map serviceInMap = new HashMap(); + Map serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", userLogin); serviceInMap.put("targetOperationList", UtilMisc.toList("CONTENT_LINK_TO")); serviceInMap.put("contentPurposeList", relatedPurposesTo); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Sun Aug 3 21:02:01 2008 @@ -22,14 +22,13 @@ import java.io.StringWriter; import java.io.Writer; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; +import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.Debug; @@ -93,12 +92,12 @@ return results; } - Map serviceInMap = new HashMap(); + Map serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperations); serviceInMap.put("entityOperation", context.get("entityOperation")); - List permittedList = new ArrayList(); + List permittedList = FastList.newInstance(); Iterator it = contentList.iterator(); Map permResults = null; while (it.hasNext()) { @@ -125,15 +124,15 @@ * This is a generic service for traversing a Content tree, typical of a blog response tree. It calls the ContentWorker.traverse method. */ public static Map findContentParents(DispatchContext dctx, Map context) { - HashMap results = new HashMap(); - List parentList = new ArrayList(); + Map results = FastMap.newInstance(); + List parentList = FastList.newInstance(); results.put("parentList", parentList); LocalDispatcher dispatcher = dctx.getDispatcher(); String contentId = (String)context.get("contentId"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); String direction = (String)context.get("direction"); if (UtilValidate.isEmpty(direction)) direction="To"; - Map traversMap = new HashMap(); + Map traversMap = FastMap.newInstance(); traversMap.put("contentId", contentId); traversMap.put("direction", direction); traversMap.put("contentAssocTypeId", contentAssocTypeId); @@ -169,7 +168,7 @@ */ public static Map traverseContent(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); - HashMap results = new HashMap(); + Map results = FastMap.newInstance(); String contentId = (String) context.get("contentId"); String direction = (String) context.get("direction"); @@ -203,7 +202,7 @@ thruDate = UtilDateTime.toTimestamp(thruDateStr); } - Map whenMap = new HashMap(); + Map whenMap = FastMap.newInstance(); whenMap.put("followWhen", context.get("followWhen")); whenMap.put("pickWhen", context.get("pickWhen")); whenMap.put("returnBeforePickWhen", context.get("returnBeforePickWhen")); @@ -214,8 +213,8 @@ startContentAssocTypeId = "PUBLISH"; } - Map nodeMap = new HashMap(); - List pickList = new ArrayList(); + Map nodeMap = FastMap.newInstance(); + List pickList = FastList.newInstance(); ContentWorker.traverse(delegator, content, fromDate, thruDate, whenMap, 0, nodeMap, startContentAssocTypeId, pickList, direction); results.put("nodeMap", nodeMap); @@ -256,7 +255,7 @@ context.put("contentPurposeList", contentPurposeList); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String contentId = (String) context.get("contentId"); @@ -352,7 +351,7 @@ GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = FastMap.newInstance(); // This section guesses how contentId should be used (From or To) if // only a contentIdFrom o contentIdTo is passed in @@ -383,7 +382,7 @@ /* String deactivateExisting = (String) context.get("deactivateExisting"); if (deactivateExisting != null && deactivateExisting.equalsIgnoreCase("true")) { - Map andMap = new HashMap(); + Map andMap = FastMap.newInstance(); andMap.put("contentIdTo", contentIdTo); andMap.put("contentAssocTypeId", context.get("contentAssocTypeId")); @@ -405,7 +404,7 @@ } */ - GenericValue contentAssoc = delegator.makeValue("ContentAssoc", new HashMap()); + GenericValue contentAssoc = delegator.makeValue("ContentAssoc", FastMap.newInstance()); contentAssoc.put("contentId", contentIdFrom); contentAssoc.put("contentIdTo", contentIdTo); contentAssoc.put("contentAssocTypeId", context.get("contentAssocTypeId")); @@ -456,7 +455,7 @@ contentAssoc.put("createdDate", createdDate); contentAssoc.put("lastModifiedDate", lastModifiedDate); - Map serviceInMap = new HashMap(); + Map serviceInMap = FastMap.newInstance(); String permissionStatus = null; serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); @@ -516,7 +515,7 @@ public static Map updateContentMethod(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = FastMap.newInstance(); context.put("entityOperation", "_UPDATE"); List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); @@ -595,7 +594,7 @@ public static Map updateContentAssocMethod(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = FastMap.newInstance(); context.put("entityOperation", "_UPDATE"); List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); @@ -651,7 +650,7 @@ contentAssoc.put("lastModifiedDate", lastModifiedDate); String permissionStatus = null; - Map serviceInMap = new HashMap(); + Map serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); serviceInMap.put("contentPurposeList", contentPurposeList); @@ -706,7 +705,7 @@ public static Map deactivateContentAssocMethod(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = FastMap.newInstance(); context.put("entityOperation", "_UPDATE"); List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); @@ -746,7 +745,7 @@ contentAssoc.put("thruDate", UtilDateTime.nowTimestamp()); String permissionStatus = null; - Map serviceInMap = new HashMap(); + Map serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); serviceInMap.put("contentPurposeList", contentPurposeList); @@ -790,7 +789,7 @@ Timestamp fromDate = (Timestamp) context.get("fromDate"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); String sequenceNum = null; - Map results = new HashMap(); + Map results = FastMap.newInstance(); try { GenericValue activeAssoc = null; @@ -803,7 +802,7 @@ sequenceNum = (String) activeAssoc.get("sequenceNum"); } - List exprList = new ArrayList(); + List exprList = FastList.newInstance(); exprList.add(EntityCondition.makeCondition("mapKey", EntityOperator.EQUALS, mapKey)); if (sequenceNum != null) { exprList.add(EntityCondition.makeCondition("sequenceNum", EntityOperator.EQUALS, sequenceNum)); @@ -846,7 +845,7 @@ * matching content. */ public static Map renderSubContentAsText(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -883,7 +882,7 @@ Writer outWriter = new StringWriter(); if (templateContext == null) { - templateContext = new HashMap(); + templateContext = FastMap.newInstance(); } try { @@ -907,7 +906,7 @@ * matching content. */ public static Map renderContentAsText(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = FastMap.newInstance(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); Writer out = (Writer) context.get("outWriter"); @@ -928,7 +927,7 @@ } if (templateContext == null) { - templateContext = new HashMap(); + templateContext = FastMap.newInstance(); } Writer outWriter = new StringWriter(); @@ -952,7 +951,7 @@ } public static Map linkContentToPubPt(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -966,7 +965,7 @@ if (Debug.infoOn()) Debug.logInfo("in publishContent, statusId:" + statusId, module); if (Debug.infoOn()) Debug.logInfo("in publishContent, userLogin:" + userLogin, module); - Map mapIn = new HashMap(); + Map mapIn = FastMap.newInstance(); mapIn.put("contentId", contentId); mapIn.put("contentIdTo", contentIdTo); mapIn.put("contentAssocTypeId", contentAssocTypeId); @@ -996,7 +995,7 @@ content.put("statusId", statusId); content.store(); - mapIn = new HashMap(); + mapIn = FastMap.newInstance(); mapIn.put("contentId", contentId); mapIn.put("contentIdTo", contentIdTo); mapIn.put("contentAssocTypeId", contentAssocTypeId); @@ -1032,7 +1031,7 @@ public static Map publishContent(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericValue content = (GenericValue)context.get("content"); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -1048,10 +1047,10 @@ public static Map getPrefixedMembers(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); Map mapIn = (Map)context.get("mapIn"); String prefix = (String)context.get("prefix"); - Map mapOut = new HashMap(); + Map mapOut = FastMap.newInstance(); result.put("mapOut", mapOut); if (mapIn != null) { Set entrySet = mapIn.entrySet(); @@ -1070,8 +1069,8 @@ } public static Map splitString(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); - List outputList = new ArrayList(); + Map result = FastMap.newInstance(); + List outputList = FastList.newInstance(); String delimiter = UtilFormatOut.checkEmpty((String)context.get("delimiter"), "|"); String inputString = (String)context.get("inputString"); if (UtilValidate.isNotEmpty(inputString)) { @@ -1082,7 +1081,7 @@ } public static Map joinString(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = FastMap.newInstance(); String outputString = null; String delimiter = UtilFormatOut.checkEmpty((String)context.get("delimiter"), "|"); List inputList = (List)context.get("inputList"); @@ -1095,8 +1094,8 @@ public static Map urlEncodeArgs(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); - Map mapFiltered = new HashMap(); + Map result = FastMap.newInstance(); + Map mapFiltered = FastMap.newInstance(); Map mapIn = (Map)context.get("mapIn"); if (mapIn != null) { Set entrySet = mapIn.entrySet(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java?rev=682251&r1=682250&r2=682251&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java Sun Aug 3 21:02:01 2008 @@ -19,13 +19,12 @@ package org.ofbiz.content.content; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; +import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.Debug; @@ -84,7 +83,7 @@ public static Map getAssocAndContentAndDataResourceMethod(GenericDelegator delegator, String contentId, String mapKey, String direction, Timestamp fromDate, Timestamp thruDate, String fromDateStr, String thruDateStr, List assocTypes, List contentTypes) { - List exprList = new ArrayList(); + List exprList = FastList.newInstance(); EntityExpr joinExpr = null; EntityExpr expr = null; String viewName = null; @@ -101,7 +100,7 @@ } exprList.add(joinExpr); if (assocTypes != null && assocTypes.size() > 0) { - List exprListOr = new ArrayList(); + List exprListOr = FastList.newInstance(); Iterator it = assocTypes.iterator(); while (it.hasNext()) { String assocType = (String)it.next(); @@ -113,7 +112,7 @@ exprList.add(assocExprList); } if (contentTypes != null && contentTypes.size() > 0) { - List exprListOr = new ArrayList(); + List exprListOr = FastList.newInstance(); Iterator it = contentTypes.iterator(); while (it.hasNext()) { String contentType = (String)it.next(); @@ -137,7 +136,7 @@ exprList.add(fromExpr); } if (thruDate != null) { - List thruList = new ArrayList(); + List thruList = FastList.newInstance(); //thruDate = UtilDateTime.getDayStart(thruDate, daysLater); EntityExpr thruExpr = EntityCondition.makeCondition("caThruDate", EntityOperator.LESS_THAN, thruDate); @@ -147,7 +146,7 @@ EntityConditionList thruExprList = EntityCondition.makeCondition(thruList, EntityOperator.OR); exprList.add(thruExprList); } else if (fromDate != null) { - List thruList = new ArrayList(); + List thruList = FastList.newInstance(); EntityExpr thruExpr = EntityCondition.makeCondition("caThruDate", EntityOperator.GREATER_THAN, fromDate); thruList.add(thruExpr); @@ -195,7 +194,7 @@ if (UtilValidate.isNotEmpty(assocTypesString)) { List lst = StringUtil.split(assocTypesString, "|"); if (assocTypes == null) { - assocTypes = new ArrayList(); + assocTypes = FastList.newInstance(); } assocTypes.addAll(lst); } @@ -204,7 +203,7 @@ if (UtilValidate.isNotEmpty(contentTypesString)) { List lst = StringUtil.split(contentTypesString, "|"); if (contentTypes == null) { - contentTypes = new ArrayList(); + contentTypes = FastList.newInstance(); } contentTypes.addAll(lst); } @@ -240,7 +239,7 @@ public static Map getAssocAndContentAndDataResourceCacheMethod(GenericDelegator delegator, String contentId, String mapKey, String direction, Timestamp fromDate, String fromDateStr, List assocTypes, List contentTypes, Boolean nullThruDatesOnly, String contentAssocPredicateId, String orderBy) throws GenericEntityException, MiniLangException { - //List exprList = new ArrayList(); + //List exprList = FastList.newInstance(); //EntityExpr joinExpr = null; //EntityExpr expr = null; String viewName = null; @@ -289,7 +288,7 @@ List contentAssocsDateFiltered = EntityUtil.orderBy(contentAssocsDateFiltered2, UtilMisc.toList("sequenceNum", "fromDate DESC")); String contentAssocTypeId = null; - List contentAssocsTypeFiltered = new ArrayList(); + List contentAssocsTypeFiltered = FastList.newInstance(); if (assocTypes != null && assocTypes.size() > 1) { Iterator it = contentAssocsDateFiltered.iterator(); while (it.hasNext()) { @@ -313,7 +312,7 @@ GenericValue contentAssocDataResourceView = null; GenericValue content = null; GenericValue dataResource = null; - List contentAssocDataResourceList = new ArrayList(); + List contentAssocDataResourceList = FastList.newInstance(); Locale locale = Locale.getDefault(); // TODO: this needs to be passed in Iterator it = contentAssocsTypeFiltered.iterator(); while (it.hasNext()) { @@ -329,7 +328,7 @@ contentAssocDataResourceView = delegator.makeValue(viewName); contentAssocDataResourceView.setAllFields(content, true, null, null); } - SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceView, new ArrayList(), locale); + SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceView, FastList.newInstance(), locale); //if (Debug.infoOn()) Debug.logInfo("contentAssoc:" + contentAssoc, module); //contentAssocDataResourceView.setAllFields(contentAssoc, false, null, null); String dataResourceId = content.getString("dataResourceId"); @@ -339,7 +338,7 @@ //if (Debug.infoOn()) Debug.logInfo("contentAssocDataResourceView:" + contentAssocDataResourceView, module); if (dataResource != null) { //contentAssocDataResourceView.setAllFields(dataResource, false, null, null); - SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceView, new ArrayList(), locale); + SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceView, FastList.newInstance(), locale); } //if (Debug.infoOn()) Debug.logInfo("contentAssocDataResourceView:" + contentAssocDataResourceView, module); contentAssocDataResourceList.add(contentAssocDataResourceView); @@ -350,7 +349,7 @@ orderByList = StringUtil.split(orderBy, "|"); contentAssocDataResourceList = EntityUtil.orderBy(contentAssocDataResourceList, orderByList); } - HashMap results = new HashMap(); + Map results = FastMap.newInstance(); results.put("entityList", contentAssocDataResourceList); if (contentAssocDataResourceList != null && contentAssocDataResourceList.size() > 0) { results.put("view", contentAssocDataResourceList.get(0)); @@ -361,7 +360,7 @@ /* public static Map getSubContentAndDataResource(GenericDelegator delegator, String contentId, String direction, Timestamp fromDate, String assocType, String contentType, String orderBy) throws GenericEntityException { - List exprList = new ArrayList(); + List exprList = FastList.newInstance(); EntityExpr joinExpr = null; EntityExpr expr = null; String viewName = null; @@ -393,7 +392,7 @@ orderByList = StringUtil.split(orderBy, "|"); contentAssocDataResourceList = EntityUtil.orderBy(contentAssocDataResourceList, orderByList); } - HashMap results = new HashMap(); + HashMap results = FastMap.newInstance(); results.put("entityList", contentAssocDataResourceList); return results; } |
Free forum by Nabble | Edit this page |