Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Mon Nov 3 06:54:16 2014 @@ -53,6 +53,7 @@ import org.ofbiz.common.uom.UomWorker; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.party.contact.ContactMechWorker; import org.ofbiz.product.product.ProductWorker; @@ -125,7 +126,7 @@ public class UspsServices { String shippingContactMechId = (String) context.get("shippingContactMechId"); if (UtilValidate.isNotEmpty(shippingContactMechId)) { try { - GenericValue shipToAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false); + GenericValue shipToAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne(); if (shipToAddress != null) { if (!domesticCountries.contains(shipToAddress.getString("countryGeoId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, @@ -292,7 +293,7 @@ public class UspsServices { String shippingContactMechId = (String) context.get("shippingContactMechId"); if (UtilValidate.isNotEmpty(shippingContactMechId)) { try { - GenericValue shipToAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false); + GenericValue shipToAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne(); if (domesticCountries.contains(shipToAddress.get("countryGeoId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUspsRateInternationCannotBeUsedForUsDestinations", locale)); @@ -1234,7 +1235,7 @@ public class UspsServices { } try { - GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); if (shipment == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "ProductShipmentNotFoundId", locale) + shipmentId); @@ -1782,7 +1783,7 @@ public class UspsServices { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { - GenericValue usps = delegator.findOne("ShipmentGatewayUsps", UtilMisc.toMap("shipmentGatewayConfigId", shipmentGatewayConfigId), false); + GenericValue usps = EntityQuery.use(delegator).from("ShipmentGatewayUsps").where("shipmentGatewayConfigId", shipmentGatewayConfigId).queryOne(); if (UtilValidate.isNotEmpty(usps)) { Object uspsField = usps.get(shipmentGatewayConfigParameterName); if (uspsField != null) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Mon Nov 3 06:54:16 2014 @@ -36,6 +36,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceContainer; @@ -402,7 +403,7 @@ public class VerifyPickSession implement if (UtilValidate.isNotEmpty(orderItemShipGroup.getString("vendorPartyId"))) { partyIdFrom = orderItemShipGroup.getString("vendorPartyId"); } else if (UtilValidate.isNotEmpty(orderItemShipGroup.getString("facilityId"))) { - GenericValue facility = delegator.findOne("Facility", UtilMisc.toMap("facilityId", orderItemShipGroup.getString("facilityId")), false); + GenericValue facility = EntityQuery.use(delegator).from("Facility").where("facilityId", orderItemShipGroup.getString("facilityId")).queryOne(); if (UtilValidate.isNotEmpty(facility.getString("ownerPartyId"))) { partyIdFrom = facility.getString("ownerPartyId"); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java Mon Nov 3 06:54:16 2014 @@ -38,6 +38,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceContainer; import org.ofbiz.service.ServiceUtil; @@ -363,7 +364,7 @@ public class WeightPackageSession implem if (ServiceUtil.isError(shipmentRouteSegmentResult)) { throw new GeneralException(ServiceUtil.getErrorMessage(shipmentRouteSegmentResult)); } - GenericValue shipRouteSeg = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId")), false); + GenericValue shipRouteSeg = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId")).queryOne(); actualCost = actualCost.add(shipRouteSeg.getBigDecimal("actualCost")); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/WEB-INF/controller.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/WEB-INF/controller.xml Mon Nov 3 06:54:16 2014 @@ -1457,7 +1457,8 @@ under the License. <request-map uri="getProductStoreGroupRollupHierarchy"> <security auth="false" https="true"/> <event type="java" path="org.ofbiz.product.store.ProductStoreEvents" invoke="getChildProductStoreGroupTree"/> - <response name="success" type="none"/> + <response name="success" type="request" value="json"/> + <response name="error" type="request" value="json"/> </request-map> <request-map uri="AddProductStoreToGroup"> <security auth="true" https="true"/> @@ -2900,17 +2901,6 @@ under the License. <response name="success" type="view" value="viewPreviewImage"/> <response name="error" type="view" value="viewPreviewImage"/> </request-map> - <request-map uri="multipleUploadImage"> - <security https="true" auth="true"/> - <event type="java" path="org.ofbiz.product.imagemanagement.ImageManagementServices" invoke="multipleUploadImage"/> - <response name="success" type="view" value="ImageUpload"/> - <response name="error" type="view" value="ImageUpload"/> - </request-map> - <request-map uri="progressUploadImage"> - <security https="true" auth="true"/> - <event type="java" path="org.ofbiz.virtualvillage.imagemanagement.ImageManagementServices" invoke="progressUploadImage"/> - <response name="success" type="view" value="main"/> - </request-map> <request-map uri="chooseFrameImage"> <security https="true" auth="true"/> <event type="java" path="org.ofbiz.product.imagemanagement.FrameImage" invoke="chooseFrameImage"/> @@ -3022,7 +3012,8 @@ under the License. <request-map uri="getChild"> <security auth="false" https="true"/> <event type="java" path="org.ofbiz.product.category.CategoryServices" invoke="getChildCategoryTree"/> - <response name="success" type="none"/> + <response name="success" type="request" value="json"/> + <response name="error" type="request" value="json"/> </request-map> <request-map uri="listMiniproduct"> <security auth="false" https="true"/> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/category/CategoryTree.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/category/CategoryTree.ftl?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/category/CategoryTree.ftl (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/category/CategoryTree.ftl Mon Nov 3 06:54:16 2014 @@ -62,20 +62,24 @@ var rawdata = [ $.cookie('jstree_select', "<#if productCategoryId??>${productCategoryId}<#elseif prodCatalogId??>${prodCatalogId}<#elseif showProductCategoryId??>${showProductCategoryId}</#if>"); </#if> jQuery("#tree").jstree({ - "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"], + "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"], "json_data" : { "data" : rawdata, - "ajax" : { "url" : "<@ofbizUrl>getChild</@ofbizUrl>", "type" : "POST", - "data" : function (n) { - return { - "isCategoryType" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , - "isCatalog" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , - "productCategoryId" : n.attr ? n.attr("id").replace("node_","") : 1 , - "additionParam" : "','category" , - "hrefString" : "EditCategory?productCategoryId=" , - "onclickFunction" : "callDocument" - }; - } + "ajax" : { "url" : "<@ofbizUrl>getChild</@ofbizUrl>", + "type" : "POST", + "data" : function (n) { + return { + "isCategoryType" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , + "isCatalog" : n.attr ? n.attr("isCatalog").replace("node_","") : 1 , + "productCategoryId" : n.attr ? n.attr("id").replace("node_","") : 1 , + "additionParam" : "','category" , + "hrefString" : "EditCategory?productCategoryId=" , + "onclickFunction" : "callDocument" + }; + }, + success : function(data) { + return data.treeData; + } } }, "types" : { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/webapp/catalog/store/ProductStoreGroupTree.ftl Mon Nov 3 06:54:16 2014 @@ -49,17 +49,21 @@ var rawdata = [ "plugins" : [ "themes", "json_data","ui" ,"cookies", "types"], "json_data" : { "data" : rawdata, - "ajax" : { "url" : "<@ofbizUrl>getProductStoreGroupRollupHierarchy</@ofbizUrl>", "type" : "POST", - "data" : function (n) { - return { - "parentGroupId" : n.attr ? n.attr("parentGroupId").replace("node_","") : 1, - "onclickFunction" : "callDocument" - }; - } + "ajax" : { "url" : "<@ofbizUrl>getProductStoreGroupRollupHierarchy</@ofbizUrl>", + "type" : "POST", + "data" : function (n) { + return { + "parentGroupId" : n.attr ? n.attr("parentGroupId").replace("node_","") : 1, + "onclickFunction" : "callDocument" + }; + }, + success : function (data) { + return data.storeGroupTree; + } } }, "types" : { - "valid_children" : [ "root" ] + "valid_children" : [ "root" ] } }); }); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java Mon Nov 3 06:54:16 2014 @@ -43,6 +43,7 @@ import org.ofbiz.base.crypto.HashCrypt; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtilProperties; import org.ofbiz.party.contact.ContactHelper; import org.ofbiz.product.product.ProductEvents; @@ -141,7 +142,7 @@ public class LoginEvents { GenericValue supposedUserLogin = null; try { - supposedUserLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + supposedUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); } catch (GenericEntityException gee) { Debug.logWarning(gee, "", module); } @@ -202,7 +203,7 @@ public class LoginEvents { String passwordToSend = null; try { - supposedUserLogin = delegator.findOne("UserLogin", false, "userLoginId", userLoginId); + supposedUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); if (supposedUserLogin == null) { // the Username was not found errMsg = UtilProperties.getMessage(resource, "loginevents.username_not_found_reenter", UtilHttp.getLocale(request)); @@ -291,7 +292,7 @@ public class LoginEvents { } else { GenericValue emailTemplateSetting = null; try { - emailTemplateSetting = delegator.findOne("EmailTemplateSetting", true, "emailTemplateSettingId", "EMAIL_PASSWORD"); + emailTemplateSetting = EntityQuery.use(delegator).from("EmailTemplateSetting").where("emailTemplateSettingId", "EMAIL_PASSWORD").cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Mon Nov 3 06:54:16 2014 @@ -29,6 +29,7 @@ import org.ofbiz.content.content.Content import org.ofbiz.content.content.ContentWorker; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.entity.model.ModelUtil; import org.ofbiz.entity.model.ModelEntity; @@ -183,7 +184,7 @@ public class WorkEffortContentWrapper im if (delegator != null) { GenericValue contentType = null; try { - contentType = delegator.findOne("WorkEffortContentType", UtilMisc.toMap("workEffortContentTypeId", contentTypeId), true); + contentType = EntityQuery.use(delegator).from("WorkEffortContentType").where("workEffortContentTypeId", contentTypeId).cache().queryOne(); } catch (GeneralException e) { Debug.logError(e, module); } @@ -285,7 +286,7 @@ public class WorkEffortContentWrapper im ModelEntity workEffortModel = delegator.getModelEntity("WorkEffort"); if (workEffortModel != null && workEffortModel.isField(candidateFieldName)) { if (workEffort == null) { - workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), true); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).cache().queryOne(); } if (workEffort != null) { String candidateValue = workEffort.getString(candidateFieldName); @@ -299,7 +300,7 @@ public class WorkEffortContentWrapper im // otherwise check content record GenericValue workEffortContent; if (contentId != null) { - workEffortContent = delegator.findOne("WorkEffortContent", UtilMisc.toMap("workEffortId", workEffortId, "contentId", contentId), true); + workEffortContent = EntityQuery.use(delegator).from("WorkEffortContent").where("workEffortId", workEffortId, "contentId", contentId).cache().queryOne(); } else { workEffortContent = getFirstWorkEffortContentByType(workEffortId, workEffort, workEffortContentTypeId, delegator); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java Mon Nov 3 06:54:16 2014 @@ -90,6 +90,7 @@ import org.ofbiz.entity.GenericEntityExc import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -388,7 +389,7 @@ public class ICalConverter { */ public static ResponseProperties getICalendar(String workEffortId, Map<String, Object> context) throws GenericEntityException { Delegator delegator = (Delegator) context.get("delegator"); - GenericValue publishProperties = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); + GenericValue publishProperties = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); if (!isCalendarPublished(publishProperties)) { Debug.logInfo("WorkEffort calendar is not published: " + workEffortId, module); return ICalWorker.createNotFoundResponse(null); @@ -711,7 +712,7 @@ public class ICalConverter { return ICalWorker.createForbiddenResponse(null); } Delegator delegator = (Delegator) context.get("delegator"); - GenericValue publishProperties = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); + GenericValue publishProperties = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); if (!isCalendarPublished(publishProperties)) { Debug.logInfo("WorkEffort calendar is not published: " + workEffortId, module); return ICalWorker.createNotFoundResponse(null); @@ -824,7 +825,7 @@ public class ICalConverter { PropertyList propertyList = component.getProperties(); String workEffortId = fromXProperty(propertyList, workEffortIdXPropName); Delegator delegator = (Delegator) context.get("delegator"); - GenericValue workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); + GenericValue workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); if (workEffort == null) { return ICalWorker.createNotFoundResponse(null); } @@ -843,7 +844,7 @@ public class ICalConverter { String workEffortId = workEffort.getString("workEffortId"); String workEffortUid = workEffort.getString("universalId"); String workEffortTypeId = workEffort.getString("workEffortTypeId"); - GenericValue typeValue = delegator.findOne("WorkEffortType", UtilMisc.toMap("workEffortTypeId", workEffortTypeId), true); + GenericValue typeValue = EntityQuery.use(delegator).from("WorkEffortType").where("workEffortTypeId", workEffortTypeId).cache().queryOne(); boolean isTask = false; boolean newComponent = true; ComponentList resultList = null; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java Mon Nov 3 06:54:16 2014 @@ -44,6 +44,7 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ServiceUtil; @@ -130,7 +131,7 @@ public class ICalWorker { protected static Date getLastModifiedDate(HttpServletRequest request) throws GenericEntityException { String workEffortId = (String) request.getAttribute("workEffortId"); Delegator delegator = (Delegator) request.getAttribute("delegator"); - GenericValue publishProperties = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); + GenericValue publishProperties = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData", false); if (iCalData != null) { return iCalData.getTimestamp("lastUpdatedStamp"); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java Mon Nov 3 06:54:16 2014 @@ -26,6 +26,7 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; @@ -43,7 +44,7 @@ public class WorkEffortPartyAssignmentSe GenericValue workEffort = null; try { - workEffort = delegator.findOne("WorkEffort", false, "workEffortId", wepa.get("workEffortId")); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", wepa.get("workEffortId")).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java Mon Nov 3 06:54:16 2014 @@ -54,6 +54,7 @@ import org.ofbiz.entity.transaction.Gene import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.entity.util.EntityFindOptions; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; @@ -578,8 +579,8 @@ public class WorkEffortSearch { GenericValue workEffort = null; GenericValue workEffortAssocType = null; try { - workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", this.workEffortId), true); - workEffortAssocType = delegator.findOne("WorkEffortAssocType", UtilMisc.toMap("workEffortAssocTypeId", this.workEffortAssocTypeId), true); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", this.workEffortId).cache().queryOne(); + workEffortAssocType = EntityQuery.use(delegator).from("WorkEffortAssocType").where("workEffortAssocTypeId", this.workEffortAssocTypeId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error looking up WorkEffortAssocConstraint pretty print info: " + e.toString(), module); } @@ -738,8 +739,8 @@ public class WorkEffortSearch { GenericValue partyNameView = null; GenericValue roleType = null; try { - partyNameView = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), true); - roleType = delegator.findOne("RoleType", UtilMisc.toMap("roleTypeId", roleTypeId), true); + partyNameView = EntityQuery.use(delegator).from("PartyNameView").where("partyId", partyId).cache().queryOne(); + roleType = EntityQuery.use(delegator).from("RoleType").where("roleTypeId", roleTypeId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Error finding PartyAssignmentConstraint information for constraint pretty print", module); } @@ -855,7 +856,7 @@ public class WorkEffortSearch { Iterator<String> productIdIter = this.productIdSet.iterator(); while (productIdIter.hasNext()) { String productId = productIdIter.next(); - GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (product == null) { infoOut.append("["); infoOut.append(productId); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Mon Nov 3 06:54:16 2014 @@ -52,6 +52,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; @@ -309,7 +310,7 @@ public class WorkEffortServices { GenericValue workEffort = null; try { - workEffort = delegator.findOne("WorkEffort", false, "workEffortId", workEffortId); + workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, module); } @@ -327,7 +328,7 @@ public class WorkEffortServices { if (UtilValidate.isNotEmpty(statusId)) { try { - currentStatus = delegator.findOne("StatusItem", UtilMisc.toMap("statusId", statusId), true); + currentStatus = EntityQuery.use(delegator).from("StatusItem").where("statusId", statusId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, module); } @@ -350,7 +351,7 @@ public class WorkEffortServices { if (workEffort.get("currentStatusId") != null) { try { - currentStatus = delegator.findOne("StatusItem", UtilMisc.toMap("statusId", workEffort.get("currentStatusId")), true); + currentStatus = EntityQuery.use(delegator).from("StatusItem").where("statusId", workEffort.get("currentStatusId")).cache().queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, module); } @@ -1050,7 +1051,7 @@ public class WorkEffortServices { GenericValue emailTemplateSetting = null; try { - emailTemplateSetting = delegator.findOne("EmailTemplateSetting", true, "emailTemplateSettingId", "WEFF_EVENT_REMINDER"); + emailTemplateSetting = EntityQuery.use(delegator).from("EmailTemplateSetting").where("emailTemplateSettingId", "WEFF_EVENT_REMINDER").cache().queryOne(); } catch (GenericEntityException e1) { Debug.logError(e1, module); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/build.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/build.xml?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/build.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/build.xml Mon Nov 3 06:54:16 2014 @@ -51,6 +51,7 @@ under the License. <file name="org/ofbiz/base/conversion/test/TestBooleanConverters.java"/> <file name="org/ofbiz/base/conversion/test/DateTimeTests.java"/> <file name="org/ofbiz/base/conversion/test/MiscTests.java"/> + <file name="org/ofbiz/base/conversion/test/TestJSONConverters.java"/> <file name="org/ofbiz/base/util/test/UtilIOTests.java"/> <file name="org/ofbiz/base/test/BaseUnitTests.java"/> <file name="org/ofbiz/base/util/collections/test/GenericMapTest.java"/> @@ -80,20 +81,6 @@ under the License. </patternset> </target> - <target name="gen-src"> - <ofbiz-javacc dir="org/ofbiz/base/json" file="JSON"/> - </target> - - <target name="classes" depends="prepare,gen-src"> - <javac17> - <sourcepath> - <dirset dir="build/gen-src"> - <include name="javacc"/> - </dirset> - </sourcepath> - </javac17> - </target> - <target name="jar" depends="classes"> <main-jar> <main-elements> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java Mon Nov 3 06:54:16 2014 @@ -19,14 +19,15 @@ package org.ofbiz.base.concurrent; import java.util.Collection; +import java.util.LinkedList; import java.util.List; import java.util.concurrent.DelayQueue; import java.util.concurrent.Delayed; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.Future; import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.SynchronousQueue; @@ -34,8 +35,6 @@ import java.util.concurrent.ThreadFactor import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import javolution.util.FastList; - import org.ofbiz.base.lang.SourceMonitored; import org.ofbiz.base.util.Debug; @@ -78,7 +77,7 @@ public final class ExecutionPool { } public static <F> List<F> getAllFutures(Collection<Future<F>> futureList) { - List<F> result = FastList.newInstance(); + List<F> result = new LinkedList<F>(); for (Future<F> future: futureList) { try { result.add(future.get()); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/config/JNDIConfigUtil.java Mon Nov 3 06:54:16 2014 @@ -18,7 +18,7 @@ *******************************************************************************/ package org.ofbiz.base.config; -import javolution.util.FastMap; +import java.util.concurrent.ConcurrentHashMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilXml; @@ -32,7 +32,7 @@ public class JNDIConfigUtil { public static final String module = JNDIConfigUtil.class.getName(); public static final String JNDI_CONFIG_XML_FILENAME = "jndiservers.xml"; - private static final FastMap<String, JndiServerInfo> jndiServerInfos = FastMap.newInstance(); + private static final ConcurrentHashMap<String, JndiServerInfo> jndiServerInfos = new ConcurrentHashMap<String, JndiServerInfo>(); private static Element getXmlRootElement() throws GenericConfigException { try { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/CollectionConverters.java Mon Nov 3 06:54:16 2014 @@ -20,13 +20,12 @@ package org.ofbiz.base.conversion; import java.lang.reflect.Array; import java.util.Arrays; +import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastList; -import javolution.util.FastSet; - import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilGenerics; @@ -62,7 +61,7 @@ public class CollectionConverters implem } public T convert(S obj) throws ConversionException { - List<Object> list = FastList.newInstance(); + List<Object> list = new LinkedList<Object>(); int len = Array.getLength(obj); for (int i = 0; i < len; i++) { list.add(Array.get(obj, i)); @@ -111,7 +110,7 @@ public class CollectionConverters implem } public List<Map<K, V>> convert(Map<K, V> obj) throws ConversionException { - List<Map<K, V>> tempList = FastList.newInstance(); + List<Map<K, V>> tempList = new LinkedList<Map<K, V>>(); tempList.add(obj); return tempList; } @@ -123,7 +122,7 @@ public class CollectionConverters implem } public Set<Map<K, V>> convert(Map<K, V> obj) throws ConversionException { - Set<Map<K, V>> tempSet = FastSet.newInstance(); + Set<Map<K, V>> tempSet = new HashSet<Map<K, V>>(); tempSet.add(obj); return tempSet; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/Converters.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/Converters.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/Converters.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/Converters.java Mon Nov 3 06:54:16 2014 @@ -19,11 +19,11 @@ package org.ofbiz.base.conversion; import java.lang.reflect.Modifier; +import java.util.HashSet; import java.util.Iterator; import java.util.ServiceLoader; - -import javolution.util.FastMap; -import javolution.util.FastSet; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.ofbiz.base.lang.SourceMonitored; import org.ofbiz.base.util.Debug; @@ -35,12 +35,11 @@ import org.ofbiz.base.util.UtilGenerics; public class Converters { protected static final String module = Converters.class.getName(); protected static final String DELIMITER = "->"; - protected static final FastMap<String, Converter<?, ?>> converterMap = FastMap.newInstance(); - protected static final FastSet<ConverterCreator> creators = FastSet.newInstance(); - protected static final FastSet<String> noConversions = FastSet.newInstance(); + protected static final ConcurrentHashMap<String, Converter<?, ?>> converterMap = new ConcurrentHashMap<String, Converter<?, ?>>(); + protected static final Set<ConverterCreator> creators = new HashSet<ConverterCreator>(); + protected static final Set<String> noConversions = new HashSet<String>(); static { - converterMap.setShared(true); registerCreator(new PassThruConverterCreator()); ClassLoader loader = Thread.currentThread().getContextClassLoader(); Iterator<ConverterLoader> converterLoaders = ServiceLoader.load(ConverterLoader.class, loader).iterator(); @@ -110,7 +109,11 @@ OUTER: continue OUTER; } } - if (noConversions.add(key)) { + boolean addedToSet = false; + synchronized (noConversions) { + addedToSet = noConversions.add(key); + } + if (addedToSet) { Debug.logWarning("*** No converter found, converting from " + sourceClass.getName() + " to " + targetClass.getName() + ". Please report this message to the developer community so " + @@ -163,7 +166,9 @@ OUTER: * @param creator The <code>ConverterCreater</code> instance to register */ public static <S, T> void registerCreator(ConverterCreator creator) { - creators.add(creator); + synchronized (creators) { + creators.add(creator); + } } /** Registers a <code>Converter</code> instance to be used by the Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToList.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToList.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToList.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToList.java Mon Nov 3 06:54:16 2014 @@ -18,17 +18,16 @@ *******************************************************************************/ package org.ofbiz.base.conversion; +import java.util.LinkedList; import java.util.List; -import javolution.util.FastList; - public class GenericSingletonToList<T> extends AbstractConverter<T, List<T>> { public GenericSingletonToList(Class<T> sourceClass) { super(sourceClass, List.class); } public List<T> convert(T obj) throws ConversionException { - List<T> tempList = FastList.newInstance(); + List<T> tempList = new LinkedList<T>(); tempList.add(obj); return tempList; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToSet.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToSet.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToSet.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToSet.java Mon Nov 3 06:54:16 2014 @@ -18,17 +18,16 @@ *******************************************************************************/ package org.ofbiz.base.conversion; +import java.util.HashSet; import java.util.Set; -import javolution.util.FastSet; - public class GenericSingletonToSet<T> extends AbstractConverter<T, Set<T>> { public GenericSingletonToSet(Class<T> sourceClass) { super(sourceClass, Set.class); } public Set<T> convert(T obj) throws ConversionException { - Set<T> tempSet = FastSet.newInstance(); + Set<T> tempSet = new HashSet<T>(); tempSet.add(obj); return tempSet; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/JSONConverters.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/JSONConverters.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/JSONConverters.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/JSONConverters.java Mon Nov 3 06:54:16 2014 @@ -18,124 +18,15 @@ *******************************************************************************/ package org.ofbiz.base.conversion; -import java.util.Collection; +import java.io.IOException; import java.util.List; import java.util.Map; -import java.util.Set; -import javolution.util.FastSet; - -import org.ofbiz.base.json.JSON; +import org.ofbiz.base.lang.JSON; import org.ofbiz.base.util.UtilGenerics; /** JSON Converter classes. */ public class JSONConverters implements ConverterLoader { - public static class ObjectToJSONResultCreator<R extends JSONResult> implements ConverterCreator, ConverterLoader { - public void loadConverters() { - Converters.registerCreator(this); - } - - public <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass) { - if (!JSONResult.class.isAssignableFrom(targetClass)) { - return null; - } - if (Collection.class.isAssignableFrom(sourceClass)) { - } else if (Map.class.isAssignableFrom(sourceClass)) { - } else if (Byte.class == sourceClass) { - } else if (Character.class == sourceClass) { - } else if (Double.class == sourceClass) { - } else if (Float.class == sourceClass) { - } else if (Integer.class == sourceClass) { - } else if (Long.class == sourceClass) { - } else if (Short.class == sourceClass) { - } else { - return null; - } - return UtilGenerics.cast(new ObjectToJSONWriterResult<S, JSONResult>(sourceClass, UtilGenerics.<Class<JSONResult>>cast(targetClass))); - } - } - - private static class ObjectToJSONWriterResult<S, T extends JSONResult> extends AbstractConverter<S, T> { - public ObjectToJSONWriterResult(Class<S> sourceClass, Class<T> targetClass) { - super(sourceClass, targetClass); - } - - public T convert(S obj) throws ConversionException { - try { - T result = UtilGenerics.<T>cast(getTargetClass().newInstance()); - result.getWriter().write(obj); - return result; - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new ConversionException(e); - } - } - } - - public static class JSONToByte extends AbstractConverter<JSON, Byte> { - public JSONToByte() { - super(JSON.class, Byte.class); - } - - public Byte convert(JSON obj) throws ConversionException { - try { - return obj.JSONLong().byteValue(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new ConversionException(e); - } - } - } - - public static class JSONToDouble extends AbstractConverter<JSON, Double> { - public JSONToDouble() { - super(JSON.class, Double.class); - } - - public Double convert(JSON obj) throws ConversionException { - try { - return obj.JSONFloat(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new ConversionException(e); - } - } - } - - public static class JSONToFloat extends AbstractConverter<JSON, Float> { - public JSONToFloat() { - super(JSON.class, Float.class); - } - - public Float convert(JSON obj) throws ConversionException { - try { - return obj.JSONFloat().floatValue(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new ConversionException(e); - } - } - } - - public static class JSONToInteger extends AbstractConverter<JSON, Integer> { - public JSONToInteger() { - super(JSON.class, Integer.class); - } - - public Integer convert(JSON obj) throws ConversionException { - try { - return obj.JSONLong().intValue(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new ConversionException(e); - } - } - } public static class JSONToList extends AbstractConverter<JSON, List<Object>> { public JSONToList() { @@ -144,26 +35,8 @@ public class JSONConverters implements C public List<Object> convert(JSON obj) throws ConversionException { try { - return obj.JSONArray(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new ConversionException(e); - } - } - } - - public static class JSONToLong extends AbstractConverter<JSON, Long> { - public JSONToLong() { - super(JSON.class, Long.class); - } - - public Long convert(JSON obj) throws ConversionException { - try { - return obj.JSONLong(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { + return UtilGenerics.<List<Object>>cast(obj.toObject(List.class)); + } catch (IOException e) { throw new ConversionException(e); } } @@ -176,44 +49,36 @@ public class JSONConverters implements C public Map<String, Object> convert(JSON obj) throws ConversionException { try { - return obj.JSONObject(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { + return UtilGenerics.<Map<String, Object>>cast(obj.toObject(Map.class)); + } catch (IOException e) { throw new ConversionException(e); } } } - public static class JSONToShort extends AbstractConverter<JSON, Short> { - public JSONToShort() { - super(JSON.class, Short.class); + public static class ListToJSON extends AbstractConverter<List<Object>, JSON> { + public ListToJSON() { + super(List.class, JSON.class); } - public Short convert(JSON obj) throws ConversionException { + public JSON convert(List<Object> obj) throws ConversionException { try { - return obj.JSONLong().shortValue(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { + return JSON.from(obj); + } catch (IOException e) { throw new ConversionException(e); } } } - public static class JSONToSet extends AbstractConverter<JSON, Set<Object>> { - public JSONToSet() { - super(JSON.class, Set.class); + public static class MapToJSON extends AbstractConverter<Map<String, Object>, JSON> { + public MapToJSON() { + super(Map.class, JSON.class); } - public Set<Object> convert(JSON obj) throws ConversionException { + public JSON convert(Map<String, Object> obj) throws ConversionException { try { - Set<Object> set = FastSet.newInstance(); - set.addAll(obj.JSONArray()); - return set; - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { + return JSON.from(obj); + } catch (IOException e) { throw new ConversionException(e); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/test/MiscTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/test/MiscTests.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/test/MiscTests.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/conversion/test/MiscTests.java Mon Nov 3 06:54:16 2014 @@ -21,23 +21,18 @@ package org.ofbiz.base.conversion.test; import java.math.BigDecimal; import java.net.URL; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; -import javolution.util.FastList; -import javolution.util.FastMap; - import org.ofbiz.base.conversion.Converter; import org.ofbiz.base.conversion.ConverterLoader; import org.ofbiz.base.conversion.Converters; -import org.ofbiz.base.conversion.JSONResult; import org.ofbiz.base.lang.SourceMonitored; import org.ofbiz.base.test.GenericTestCaseBase; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.base.util.collections.LRUMap; @SourceMonitored public class MiscTests extends GenericTestCaseBase { @@ -46,12 +41,6 @@ public class MiscTests extends GenericTe super(name); } - private static <S, T extends JSONResult.Indenting> void assertConversion(String label, String wanted, Class<T> targetClass, Object source, Class<S> sourceClass) throws Exception { - Converter<S, T> converter = Converters.getConverter(sourceClass, targetClass); - assertTrue(label + " can convert", converter.canConvert(sourceClass, targetClass)); - assertEquals(label, wanted, converter.convert(UtilGenerics.<S>cast(source)).getResult()); - } - public void testStaticHelperClass() throws Exception { assertStaticHelperClass(Converters.class); } @@ -66,22 +55,6 @@ public class MiscTests extends GenericTe Converters.loadContainedConverters(MiscTests.class); } - public void testExtendsImplements() throws Exception { - List<String> arraysList = Arrays.asList("a", "b", "c"); - assertConversion("", "[\n \"a\",\n \"b\",\n \"c\"\n]", JSONResult.Indenting.class, arraysList, arraysList.getClass()); - Exception caught = null; - try { - Converters.getConverter(MiscTests.class, String.class); - } catch (ClassNotFoundException e) { - caught = e; - } finally { - assertNotNull("ClassNotFoundException thrown for MiscTests.class", caught); - } - LRUMap<String, String> map = new LRUMap<String, String>(); - map.put("a", "1"); - assertConversion("", "{\n \"a\": \"1\"\n}", JSONResult.Indenting.class, map, LRUMap.class); - } - public static <S> void assertPassThru(Object wanted, Class<S> sourceClass) throws Exception { assertPassThru(wanted, sourceClass, sourceClass); } @@ -104,12 +77,12 @@ public class MiscTests extends GenericTe List<String> baseList = UtilMisc.toList("a", "1", "b", "2", "c", "3"); ArrayList<String> arrayList = new ArrayList<String>(); arrayList.addAll(baseList); - List<String> fastList = FastList.newInstance(); + List<String> fastList = new LinkedList<String>(); fastList.addAll(baseList); Map<String, String> baseMap = UtilMisc.toMap("a", "1", "b", "2", "c", "3"); HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.putAll(baseMap); - Map<String, String> fastMap = FastMap.newInstance(); + Map<String, String> fastMap = new HashMap<String, String>(); fastMap.putAll(baseMap); Object[] testObjects = new Object[] { string, Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/BshUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/BshUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/BshUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/BshUtil.java Mon Nov 3 06:54:16 2014 @@ -25,8 +25,7 @@ import java.io.StringReader; import java.net.MalformedURLException; import java.net.URL; import java.util.Map; - -import javolution.util.FastMap; +import java.util.concurrent.ConcurrentHashMap; import org.ofbiz.base.location.FlexibleLocation; import org.ofbiz.base.util.cache.UtilCache; @@ -45,7 +44,7 @@ public final class BshUtil { public static final String module = BshUtil.class.getName(); - protected static FastMap<ClassLoader, BshClassManager> masterClassManagers = FastMap.newInstance(); + protected static ConcurrentHashMap<ClassLoader, BshClassManager> masterClassManagers = new ConcurrentHashMap<ClassLoader, BshClassManager>(); private static final UtilCache<String, Interpreter.ParsedScript> parsedScripts = UtilCache.createUtilCache("script.BshLocationParsedCache", 0, 0, false); /** Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/FileUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/FileUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/FileUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/FileUtil.java Mon Nov 3 06:54:16 2014 @@ -32,12 +32,11 @@ import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.net.MalformedURLException; +import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Set; -import javolution.util.FastList; -import javolution.util.FastSet; - import org.apache.commons.io.FileUtils; import org.ofbiz.base.location.ComponentLocationResolver; @@ -245,8 +244,8 @@ public class FileUtil { basePath = System.getProperty("ofbiz.home"); } - Set<String> stringsToFindInPath = FastSet.newInstance(); - Set<String> stringsToFindInFile = FastSet.newInstance(); + Set<String> stringsToFindInPath = new HashSet<String>(); + Set<String> stringsToFindInFile = new HashSet<String>(); if (partialPath != null) { stringsToFindInPath.add(partialPath); @@ -255,7 +254,7 @@ public class FileUtil { stringsToFindInFile.add(stringToFind); } - List<File> fileList = FastList.newInstance(); + List<File> fileList = new LinkedList<File>(); FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter(fileExt, stringsToFindInPath, stringsToFindInFile), true); return fileList; @@ -266,22 +265,22 @@ public class FileUtil { basePath = System.getProperty("ofbiz.home"); } - Set<String> stringsToFindInPath = FastSet.newInstance(); - Set<String> stringsToFindInFile = FastSet.newInstance(); + Set<String> stringsToFindInPath = new HashSet<String>(); + Set<String> stringsToFindInFile = new HashSet<String>(); if (partialPath != null) stringsToFindInPath.add(partialPath); if (rootElementName != null) stringsToFindInFile.add("<" + rootElementName + " "); if (xsdOrDtdName != null) stringsToFindInFile.add(xsdOrDtdName); - List<File> fileList = FastList.newInstance(); + List<File> fileList = new LinkedList<File>(); FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter("xml", stringsToFindInPath, stringsToFindInFile), true); return fileList; } public static class SearchTextFilesFilter implements FilenameFilter { String fileExtension; - Set<String> stringsToFindInFile = FastSet.newInstance(); - Set<String> stringsToFindInPath = FastSet.newInstance(); + Set<String> stringsToFindInFile = new HashSet<String>(); + Set<String> stringsToFindInPath = new HashSet<String>(); public SearchTextFilesFilter(String fileExtension, Set<String> stringsToFindInPath, Set<String> stringsToFindInFile) { this.fileExtension = fileExtension; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Mon Nov 3 06:54:16 2014 @@ -26,12 +26,11 @@ import groovy.lang.Script; import java.io.IOException; import java.io.InputStream; import java.net.URL; +import java.util.HashMap; import java.util.Map; import javax.script.ScriptContext; -import javolution.util.FastMap; - import org.codehaus.groovy.control.CompilationFailedException; import org.codehaus.groovy.runtime.InvokerHelper; import org.ofbiz.base.location.FlexibleLocation; @@ -95,7 +94,7 @@ public class GroovyUtil { * @return A <code>Binding</code> instance */ public static Binding getBinding(Map<String, Object> context) { - Map<String, Object> vars = FastMap.newInstance(); + Map<String, Object> vars = new HashMap<String, Object>(); if (context != null) { vars.putAll(context); vars.put("context", context); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java Mon Nov 3 06:54:16 2014 @@ -24,13 +24,12 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Date; +import java.util.HashMap; import java.util.Map; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; -import javolution.util.FastMap; - /** * HttpRequestFileUpload - Receive a file upload through an HttpServletRequest * @@ -140,7 +139,7 @@ public class HttpRequestFileUpload { String boundary = new String(line, 0, boundaryLength); // -2 discards the newline character System.out.println("boundary=[" + boundary + "] length is " + boundaryLength); - fields = FastMap.newInstance(); + fields = new HashMap<String, String>(); while (requestLength > 0/* i != -1*/) { String newLine = ""; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java Mon Nov 3 06:54:16 2014 @@ -46,10 +46,9 @@ import java.security.cert.X509Certificat import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Collection; +import java.util.HashMap; import java.util.Map; -import javolution.util.FastMap; - import org.apache.commons.codec.binary.Base64; import org.ofbiz.base.component.ComponentConfig; import org.ofbiz.base.config.GenericConfigException; @@ -143,7 +142,7 @@ public class KeyStoreUtil { } public static Map<String, String> getX500Map(Principal x500) { - Map<String, String> x500Map = FastMap.newInstance(); + Map<String, String> x500Map = new HashMap<String, String>(); String name = x500.getName().replaceAll("\\\\,", "&com;"); String[] x500Opts = name.split("\\,"); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java Mon Nov 3 06:54:16 2014 @@ -25,12 +25,11 @@ import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.Enumeration; +import java.util.LinkedList; import java.util.List; import javax.net.ssl.X509TrustManager; -import javolution.util.FastList; - /** * MultiTrustManager */ @@ -46,7 +45,7 @@ public class MultiTrustManager implement } public MultiTrustManager() { - keystores = FastList.newInstance(); + keystores = new LinkedList<KeyStore>(); } public void add(KeyStore ks) { @@ -78,7 +77,7 @@ public class MultiTrustManager implement } public X509Certificate[] getAcceptedIssuers() { - List<X509Certificate> issuers = FastList.newInstance(); + List<X509Certificate> issuers = new LinkedList<X509Certificate>(); for (KeyStore store: keystores) { try { Enumeration<String> e = store.aliases(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/SSLUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/SSLUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/SSLUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/SSLUtil.java Mon Nov 3 06:54:16 2014 @@ -18,23 +18,21 @@ *******************************************************************************/ package org.ofbiz.base.util; -import org.ofbiz.base.config.GenericConfigException; -import org.ofbiz.base.component.ComponentConfig; - import java.io.IOException; import java.security.GeneralSecurityException; import java.security.KeyStore; -import java.security.SecureRandom; import java.security.Principal; -import java.security.cert.X509Certificate; +import java.security.SecureRandom; import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Map; +import javax.net.ssl.HostnameVerifier; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLServerSocketFactory; @@ -44,7 +42,8 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; -import javolution.util.FastList; +import org.ofbiz.base.component.ComponentConfig; +import org.ofbiz.base.config.GenericConfigException; /** * KeyStoreUtil - Utilities for setting up SSL connections with specific client certificates @@ -92,7 +91,7 @@ public class SSLUtil { } public static KeyManager[] getKeyManagers(String alias) throws IOException, GeneralSecurityException, GenericConfigException { - List<KeyManager> keyMgrs = FastList.newInstance(); + List<KeyManager> keyMgrs = new LinkedList<KeyManager>(); for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) { if (ksi.isCertStore()) { KeyStore ks = ksi.getKeyStore(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/StringUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/StringUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/StringUtil.java Mon Nov 3 06:54:16 2014 @@ -23,19 +23,16 @@ import java.net.URLDecoder; import java.net.URLEncoder; import java.util.Arrays; import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import java.util.regex.Pattern; -import javolution.context.ObjectFactory; -import javolution.lang.Reusable; -import javolution.util.FastList; -import javolution.util.FastMap; -import javolution.util.FastSet; - import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; import org.ofbiz.base.lang.Appender; @@ -56,6 +53,7 @@ public class StringUtil { public static final StringUtil INSTANCE = new StringUtil(); public static final String module = StringUtil.class.getName(); + // FIXME: Not thread safe protected static final Map<String, Pattern> substitutionPatternMap; /** OWASP ESAPI canonicalize strict flag; setting false so we only get warnings about double encoding, etc; can be set to true for exceptions and more security */ @@ -67,7 +65,7 @@ public class StringUtil { List<Codec> codecList = Arrays.asList(new HTMLEntityCodec(), new PercentCodec()); defaultWebEncoder = new DefaultEncoder(codecList); defaultWebValidator = new DefaultValidator(); - substitutionPatternMap = FastMap.newInstance(); + substitutionPatternMap = new HashMap<String, Pattern>(); substitutionPatternMap.put("&&", Pattern.compile("@and", Pattern.LITERAL)); substitutionPatternMap.put("||", Pattern.compile("@or", Pattern.LITERAL)); substitutionPatternMap.put("<=", Pattern.compile("@lteq", Pattern.LITERAL)); @@ -203,7 +201,7 @@ public class StringUtil { else st = new StringTokenizer(str); if (st != null && st.hasMoreTokens()) { - splitList = FastList.newInstance(); + splitList = new LinkedList<String>(); while (st.hasMoreTokens()) splitList.add(st.nextToken()); @@ -229,7 +227,7 @@ public class StringUtil { if (st != null && st.length > 0) { - splitList = FastList.newInstance(); + splitList = new LinkedList<String>(); for (int i=0; i < st.length; i++) splitList.add(st[i]); } @@ -243,7 +241,7 @@ public class StringUtil { public static List<String> quoteStrList(List<String> list) { List<String> tmpList = list; - list = FastList.newInstance(); + list = new LinkedList<String>(); for (String str: tmpList) { str = "'" + str + "'"; list.add(str); @@ -274,7 +272,7 @@ public class StringUtil { */ public static Map<String, String> strToMap(String str, String delim, boolean trim, String pairsSeparator) { if (str == null) return null; - Map<String, String> decodedMap = FastMap.newInstance(); + Map<String, String> decodedMap = new HashMap<String, String>(); List<String> elements = split(str, delim); pairsSeparator = pairsSeparator == null ? "=" : pairsSeparator; @@ -384,7 +382,7 @@ public class StringUtil { * @return new Map */ public static Map<String, String> toMap(String s) { - Map<String, String> newMap = FastMap.newInstance(); + Map<String, String> newMap = new HashMap<String, String>(); if (s.startsWith("{") && s.endsWith("}")) { s = s.substring(1, s.length() - 1); String[] entries = s.split("\\,\\s"); @@ -408,7 +406,7 @@ public class StringUtil { * @return new List */ public static List<String> toList(String s) { - List<String> newList = FastList.newInstance(); + List<String> newList = new LinkedList<String>(); if (s.startsWith("[") && s.endsWith("]")) { s = s.substring(1, s.length() - 1); String[] entries = s.split("\\,\\s"); @@ -429,7 +427,7 @@ public class StringUtil { * @return new List */ public static Set<String> toSet(String s) { - Set<String> newSet = FastSet.newInstance(); + Set<String> newSet = new HashSet<String>(); if (s.startsWith("[") && s.endsWith("]")) { s = s.substring(1, s.length() - 1); String[] entries = s.split("\\,\\s"); @@ -454,7 +452,7 @@ public class StringUtil { if (keys == null || values == null || keys.size() != values.size()) { throw new IllegalArgumentException("Keys and Values cannot be null and must be the same size"); } - Map<K, V> newMap = FastMap.newInstance(); + Map<K, V> newMap = new HashMap<K, V>(); for (int i = 0; i < keys.size(); i++) { newMap.put(keys.get(i), values.get(i)); } @@ -791,19 +789,12 @@ public class StringUtil { /** * A simple Map wrapper class that will do HTML encoding. To be used for passing a Map to something that will expand Strings with it as a context, etc. - * To reduce memory allocation impact this object is recyclable and minimal in that it only keeps a reference to the original Map. */ - public static class HtmlEncodingMapWrapper<K> implements Map<K, Object>, Reusable { - protected static final ObjectFactory<HtmlEncodingMapWrapper<?>> mapStackFactory = new ObjectFactory<HtmlEncodingMapWrapper<?>>() { - @Override - protected HtmlEncodingMapWrapper<?> create() { - return new HtmlEncodingMapWrapper<Object>(); - } - }; + public static class HtmlEncodingMapWrapper<K> implements Map<K, Object> { public static <K> HtmlEncodingMapWrapper<K> getHtmlEncodingMapWrapper(Map<K, Object> mapToWrap, SimpleEncoder encoder) { if (mapToWrap == null) return null; - HtmlEncodingMapWrapper<K> mapWrapper = (HtmlEncodingMapWrapper<K>) UtilGenerics.<K, Object>checkMap(mapStackFactory.object()); + HtmlEncodingMapWrapper<K> mapWrapper = new HtmlEncodingMapWrapper<K>(); mapWrapper.setup(mapToWrap, encoder); return mapWrapper; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilGenerics.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilGenerics.java?rev=1636282&r1=1636281&r2=1636282&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilGenerics.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/UtilGenerics.java Mon Nov 3 06:54:16 2014 @@ -19,13 +19,12 @@ package org.ofbiz.base.util; import java.util.Collection; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; -import javolution.util.FastMap; - public class UtilGenerics { public static final String module = UtilMisc.class.getName(); @@ -141,7 +140,7 @@ public class UtilGenerics { if (data.length % 2 == 1) { throw new IllegalArgumentException("You must pass an even sized array to the toMap method"); } - Map<K, V> map = FastMap.newInstance(); + Map<K, V> map = new LinkedHashMap<K, V>(); for (int i = 0; i < data.length;) { Object key = data[i]; if (key != null && !(keyType.isInstance(key))) throw new IllegalArgumentException("Key(" + i + ") is not a " + keyType.getName() + ", was(" + key.getClass().getName() + ")"); @@ -162,7 +161,7 @@ public class UtilGenerics { if (data.length % 2 == 1) { throw new IllegalArgumentException("You must pass an even sized array to the toMap method"); } - Map<K, Object> map = FastMap.newInstance(); + Map<K, Object> map = new LinkedHashMap<K, Object>(); for (int i = 0; i < data.length;) { Object key = data[i]; if (key != null && !(keyType.isInstance(key))) throw new IllegalArgumentException("Key(" + i + ") is not a " + keyType.getName() + ", was(" + key.getClass().getName() + ")"); |
Free forum by Nabble | Edit this page |