Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java Thu Oct 30 06:10:58 2014 @@ -39,6 +39,7 @@ import org.ofbiz.common.geo.GeoWorker; 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.config.ProductConfigWrapper; @@ -61,7 +62,7 @@ public class ProductStoreWorker { } GenericValue productStore = null; try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), true); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting ProductStore entity", module); } @@ -115,7 +116,7 @@ public class ProductStoreWorker { public static String determineSingleFacilityForStore(Delegator delegator, String productStoreId) { GenericValue productStore = null; try { - productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", productStoreId), false); + productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -166,7 +167,7 @@ public class ProductStoreWorker { public static GenericValue getProductStorePaymentSetting(Delegator delegator, String productStoreId, String paymentMethodTypeId, String paymentServiceTypeEnumId, boolean anyServiceType) { GenericValue storePayment = null; try { - storePayment = delegator.findOne("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStoreId, "paymentMethodTypeId", paymentMethodTypeId, "paymentServiceTypeEnumId", paymentServiceTypeEnumId), true); + storePayment = EntityQuery.use(delegator).from("ProductStorePaymentSetting").where("productStoreId", productStoreId, "paymentMethodTypeId", paymentMethodTypeId, "paymentServiceTypeEnumId", paymentServiceTypeEnumId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up store payment settings", module); } @@ -487,7 +488,7 @@ public class ProductStoreWorker { // if the item is a variant, get its virtual productId try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if ((product != null) && ("Y".equals(product.get("isVariant")))) { if (parentProductId != null) { virtualProductId = parentProductId;
Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Thu Oct 30 06:10:58 2014 @@ -38,6 +38,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.DispatchContext; import org.ofbiz.service.GenericServiceException; @@ -138,7 +139,7 @@ public class SubscriptionServices { try { if (lastSubscription != null && !alwaysCreateNewRecord) { Map<String, Object> updateSubscriptionMap = dctx.getModelService("updateSubscription").makeValid(newSubscription, ModelService.IN_PARAM); - updateSubscriptionMap.put("userLogin", delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false)); + updateSubscriptionMap.put("userLogin", EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne()); Map<String, Object> updateSubscriptionResult = dispatcher.runSync("updateSubscription", updateSubscriptionMap); result.put("subscriptionId", updateSubscriptionMap.get("subscriptionId")); @@ -163,7 +164,7 @@ public class SubscriptionServices { } } Map<String, Object> createSubscriptionMap = dctx.getModelService("createSubscription").makeValid(newSubscription, ModelService.IN_PARAM); - createSubscriptionMap.put("userLogin", delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false)); + createSubscriptionMap.put("userLogin", EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne()); Map<String, Object> createSubscriptionResult = dispatcher.runSync("createSubscription", createSubscriptionMap); if (ServiceUtil.isError(createSubscriptionResult)) { @@ -263,7 +264,7 @@ public class SubscriptionServices { "OrderErrorCannotGetOrderRoleEntity", UtilMisc.toMap("itemMsgInfo", orderId), locale)); } - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, "OrderErrorNoValidOrderHeaderFoundForOrderId", @@ -331,7 +332,7 @@ public class SubscriptionServices { int field = Calendar.MONTH; String subscriptionResourceId = subscription.getString("subscriptionResourceId"); GenericValue subscriptionResource = null; - subscriptionResource = delegator.findOne("SubscriptionResource", UtilMisc.toMap("subscriptionResourceId", subscriptionResourceId), false); + subscriptionResource = EntityQuery.use(delegator).from("SubscriptionResource").where("subscriptionResourceId", subscriptionResourceId).queryOne(); subscriptionId = subscription.getString("subscriptionId"); gracePeriodOnExpiry = subscription.getString("gracePeriodOnExpiry"); gracePeriodOnExpiryUomId = subscription.getString("gracePeriodOnExpiryUomId"); Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java Thu Oct 30 06:10:58 2014 @@ -36,6 +36,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.product.product.ProductWorker; import org.ofbiz.service.DispatchContext; @@ -65,7 +66,7 @@ public class SupplierProductServices { BigDecimal quantity =(BigDecimal) context.get("quantity"); String canDropShip = (String) context.get("canDropShip"); try { - product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true); + product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); if (product == null) { results = ServiceUtil.returnSuccess(); results.put("supplierProducts",null); @@ -76,7 +77,7 @@ public class SupplierProductServices { // if there were no related SupplierProduct entities and the item is a variant, then get the SupplierProducts of the virtual parent product if (supplierProducts.size() == 0 && product.getString("isVariant") != null && product.getString("isVariant").equals("Y")) { String virtualProductId = ProductWorker.getVariantVirtualId(product); - GenericValue virtualProduct = delegator.findOne("Product", UtilMisc.toMap("productId", virtualProductId), true); + GenericValue virtualProduct = EntityQuery.use(delegator).from("Product").where("productId", virtualProductId).cache().queryOne(); if (virtualProduct != null) { supplierProducts = virtualProduct.getRelated("SupplierProduct", null, null, true); } Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java Thu Oct 30 06:10:58 2014 @@ -27,6 +27,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.testtools.OFBizTestCase; public class InventoryItemTransferTest extends OFBizTestCase { @@ -41,7 +42,7 @@ public class InventoryItemTransferTest e @Override protected void setUp() throws Exception { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } @Override Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/StockMovesTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/StockMovesTest.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/StockMovesTest.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/product/test/StockMovesTest.java Thu Oct 30 06:10:58 2014 @@ -29,6 +29,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.testtools.OFBizTestCase; /** @@ -44,7 +45,7 @@ public class StockMovesTest extends OFBi @Override protected void setUp() throws Exception { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } @Override Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Thu Oct 30 06:10:58 2014 @@ -39,6 +39,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.product.product.ProductWorker; import org.ofbiz.service.GenericServiceException; @@ -737,7 +738,7 @@ public class PackingSession implements j 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"); } @@ -752,7 +753,7 @@ public class PackingSession implements j } } } else if (this.facilityId != null) { - GenericValue facility = delegator.findOne("Facility", UtilMisc.toMap("facilityId", this.facilityId), false); + GenericValue facility = EntityQuery.use(delegator).from("Facility").where("facilityId", this.facilityId).queryOne(); if (UtilValidate.isNotEmpty(facility.getString("ownerPartyId"))) { partyIdFrom = facility.getString("ownerPartyId"); } Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java Thu Oct 30 06:10:58 2014 @@ -31,6 +31,7 @@ import org.ofbiz.base.util.UtilValidate; 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; @@ -51,7 +52,7 @@ public class ShipmentEvents { GenericValue shipmentPackageRouteSeg = null; try { - shipmentPackageRouteSeg = delegator.findOne("ShipmentPackageRouteSeg", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentPackageSeqId", shipmentPackageSeqId), false); + shipmentPackageRouteSeg = EntityQuery.use(delegator).from("ShipmentPackageRouteSeg").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentPackageSeqId", shipmentPackageSeqId).queryOne(); } catch (GenericEntityException e) { String errorMsg = "Error looking up ShipmentPackageRouteSeg: " + e.toString(); Debug.logError(e, errorMsg, module); Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Thu Oct 30 06:10:58 2014 @@ -43,6 +43,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityListIterator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.party.party.PartyWorker; import org.ofbiz.service.DispatchContext; @@ -73,7 +74,7 @@ public class ShipmentServices { GenericValue productStoreShipMeth = null; try { - productStoreShipMeth = delegator.findOne("ProductStoreShipmentMeth", UtilMisc.toMap("productStoreShipMethId", productStoreShipMethId), false); + productStoreShipMeth = EntityQuery.use(delegator).from("ProductStoreShipmentMeth").where("productStoreShipMethId", productStoreShipMethId).queryOne(); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductStoreShipmentMethodCannotRetrieve", @@ -147,7 +148,7 @@ public class ShipmentServices { GenericValue estimate = null; try { - estimate = delegator.findOne("ShipmentCostEstimate", UtilMisc.toMap("shipmentCostEstimateId", shipmentCostEstimateId), false); + estimate = EntityQuery.use(delegator).from("ShipmentCostEstimate").where("shipmentCostEstimateId", shipmentCostEstimateId).queryOne(); estimate.remove(); } catch (GenericEntityException e) { Debug.logError(e, module); @@ -292,7 +293,7 @@ public class ShipmentServices { GenericValue shipAddress = null; if (shippingContactMechId != null) { try { - shipAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false); + shipAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -617,7 +618,7 @@ public class ShipmentServices { GenericValue shipment = null; if (shipmentId != null) { try { - shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -741,7 +742,7 @@ public class ShipmentServices { // only need to do this for the first package GenericValue rtSeg = null; try { - rtSeg = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", "00001"), false); + rtSeg = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", "00001").queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); @@ -913,7 +914,7 @@ public class ShipmentServices { if (shipmentReceipts.size() == 0) return ServiceUtil.returnSuccess(); // If there are shipment receipts, the shipment must have been shipped, so set the shipment status to PURCH_SHIP_SHIPPED if it's only PURCH_SHIP_CREATED - GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); if ((! UtilValidate.isEmpty(shipment)) && "PURCH_SHIP_CREATED".equals(shipment.getString("statusId"))) { Map<String, Object> updateShipmentMap = dispatcher.runSync("updateShipment", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED", "userLogin", userLogin)); if (ServiceUtil.isError(updateShipmentMap)) { @@ -972,7 +973,7 @@ public class ShipmentServices { Map<String, Object> results = ServiceUtil.returnSuccess(); try { - GenericValue shipmentRouteSeg = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + GenericValue shipmentRouteSeg = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (shipmentRouteSeg == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductShipmentRouteSegmentNotFound", @@ -1068,14 +1069,14 @@ public class ShipmentServices { GenericValue shipmentPackage = null; try { - shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); if (UtilValidate.isEmpty(shipment)) { String errorMessage = UtilProperties.getMessage(resource, "ProductShipmentNotFoundId", locale); Debug.logError(errorMessage, module); return ServiceUtil.returnError(errorMessage); } - shipmentPackage = delegator.findOne("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId), false); + shipmentPackage = EntityQuery.use(delegator).from("ShipmentPackage").where("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId).queryOne(); if (UtilValidate.isEmpty(shipmentPackage)) { String errorMessage = UtilProperties.getMessage(resource, "ProductShipmentPackageNotFound", context, locale); Debug.logError(errorMessage, module); @@ -1140,14 +1141,14 @@ public class ShipmentServices { GenericValue shipment = null ; GenericValue orderHeader = null; try { - shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); - orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", shipment.getString("primaryOrderId")), false); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); + orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", shipment.getString("primaryOrderId")).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting info from database", module); } GenericValue productStoreEmail = null; try { - productStoreEmail = delegator.findOne("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"), "emailType", "PRDS_ODR_SHIP_COMPLT"), false); + productStoreEmail = EntityQuery.use(delegator).from("ProductStoreEmailSetting").where("productStoreId", orderHeader.get("productStoreId"), "emailType", "PRDS_ODR_SHIP_COMPLT").queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting the ProductStoreEmailSetting for productStoreId =" + orderHeader.get("productStoreId") + " and emailType = PRDS_ODR_SHIP_COMPLT", module); } @@ -1217,7 +1218,7 @@ public class ShipmentServices { public static Map<String, Object> getShipmentGatewayConfigFromShipment(Delegator delegator, String shipmentId, Locale locale) { Map<String, Object> shipmentGatewayConfig = ServiceUtil.returnSuccess(); 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(resource, "ProductShipmentNotFoundId", locale) + shipmentId); Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java Thu Oct 30 06:10:58 2014 @@ -25,6 +25,7 @@ import java.util.List; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.shipment.packing.PackingSession; import org.ofbiz.service.testtools.OFBizTestCase; @@ -41,7 +42,7 @@ public class IssuanceTest extends OFBizT @Override protected void setUp() throws Exception { - userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false); + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } @Override @@ -61,7 +62,7 @@ public class IssuanceTest extends OFBizT BigDecimal.valueOf(1000L), false); String shipmentId = packSession.complete(false); - GenericValue orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), true); + GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).cache().queryOne(); // Test the OrderShipment is correct List<GenericValue> orderShipments = orderHeader.getRelated("OrderShipment", null, null, false); Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Thu Oct 30 06:10:58 2014 @@ -45,6 +45,7 @@ import org.ofbiz.content.content.Content 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.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -198,7 +199,7 @@ public class DhlServices { GenericValue shipToAddress = null; if (shippingContactMechId != null) { try { - shipToAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false); + shipToAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne(); if (shipToAddress == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUnableFoundShipToAddresss", locale)); @@ -522,12 +523,12 @@ public class DhlServices { String shipmentConfirmResponseString = null; 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); } - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (shipmentRouteSegment == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "ProductShipmentRouteSegmentNotFound", @@ -956,7 +957,7 @@ public class DhlServices { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { - GenericValue dhl = delegator.findOne("ShipmentGatewayDhl", UtilMisc.toMap("shipmentGatewayConfigId", shipmentGatewayConfigId), false); + GenericValue dhl = EntityQuery.use(delegator).from("ShipmentGatewayDhl").where("shipmentGatewayConfigId", shipmentGatewayConfigId).queryOne(); if (UtilValidate.isNotEmpty(dhl)) { Object dhlField = dhl.get(shipmentGatewayConfigParameterName); if (dhlField != null) { Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java Thu Oct 30 06:10:58 2014 @@ -45,6 +45,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.entity.util.EntityUtilProperties; import org.ofbiz.party.party.PartyHelper; @@ -182,7 +183,7 @@ public class FedexServices { String emailAddress = null; try { // Make sure the company exists - GenericValue companyParty = delegator.findOne("Party", UtilMisc.toMap("partyId", companyPartyId), true); + GenericValue companyParty = EntityQuery.use(delegator).from("Party").where("partyId", companyPartyId).cache().queryOne(); if (companyParty == null) { String errorMessage = "Party with partyId " + companyPartyId + " does not exist"; Debug.logError(errorMessage, module); @@ -237,12 +238,12 @@ public class FedexServices { "FacilityShipmentFedexCompanyPartyHasNotPostalAddress", UtilMisc.toMap("companyPartyId", companyPartyId), locale)); } - GenericValue countryGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", postalAddress.getString("countryGeoId")), true); + GenericValue countryGeo = EntityQuery.use(delegator).from("Geo").where("geoId", postalAddress.getString("countryGeoId")).cache().queryOne(); String countryCode = countryGeo.getString("geoCode"); String stateOrProvinceCode = null; // Only add the StateOrProvinceCode element if the address is in USA or Canada if (countryCode.equals("CA") || countryCode.equals("US")) { - GenericValue stateProvinceGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", postalAddress.getString("stateProvinceGeoId")), true); + GenericValue stateProvinceGeo = EntityQuery.use(delegator).from("Geo").where("geoId", postalAddress.getString("stateProvinceGeoId")).cache().queryOne(); stateOrProvinceCode = stateProvinceGeo.getString("geoCode"); } @@ -470,12 +471,12 @@ public class FedexServices { Map<String, Object> shipRequestContext = FastMap.newInstance(); // Get the shipment and the shipmentRouteSegment - GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); + GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); if (UtilValidate.isEmpty(shipment)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "ProductShipmentNotFoundId", locale) + shipmentId); } - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (UtilValidate.isEmpty(shipmentRouteSegment)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "ProductShipmentRouteSegmentNotFound", @@ -499,7 +500,7 @@ public class FedexServices { // Translate shipmentMethodTypeId to Fedex service code and carrier code String shipmentMethodTypeId = shipmentRouteSegment.getString("shipmentMethodTypeId"); - GenericValue carrierShipmentMethod = delegator.findOne("CarrierShipmentMethod", UtilMisc.toMap("shipmentMethodTypeId", shipmentMethodTypeId, "partyId", "FEDEX", "roleTypeId", "CARRIER"), false); + GenericValue carrierShipmentMethod = EntityQuery.use(delegator).from("CarrierShipmentMethod").where("shipmentMethodTypeId", shipmentMethodTypeId, "partyId", "FEDEX", "roleTypeId", "CARRIER").queryOne(); if (UtilValidate.isEmpty(carrierShipmentMethod)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentFedexRouteSegmentCarrierShipmentMethodNotFound", @@ -558,7 +559,7 @@ public class FedexServices { UtilMisc.toMap("contactMechId", originPostalAddress.getString("contactMechId"), "shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - GenericValue stateProvinceGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", originPostalAddress.getString("stateProvinceGeoId")), true); + GenericValue stateProvinceGeo = EntityQuery.use(delegator).from("Geo").where("geoId", originPostalAddress.getString("stateProvinceGeoId")).cache().queryOne(); originAddressStateOrProvinceCode = stateProvinceGeo.getString("geoCode"); } @@ -633,7 +634,7 @@ public class FedexServices { UtilMisc.toMap("contactMechId", destinationPostalAddress.getString("contactMechId"), "shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - GenericValue stateProvinceGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", destinationPostalAddress.getString("stateProvinceGeoId")), true); + GenericValue stateProvinceGeo = EntityQuery.use(delegator).from("Geo").where("geoId", destinationPostalAddress.getString("stateProvinceGeoId")).cache().queryOne(); destinationAddressStateOrProvinceCode = stateProvinceGeo.getString("geoCode"); } @@ -659,7 +660,7 @@ public class FedexServices { "FacilityShipmentFedexPartyToRequired", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - GenericValue partyTo = delegator.findOne("Party", UtilMisc.toMap("partyId", destinationPartyId), false); + GenericValue partyTo = EntityQuery.use(delegator).from("Party").where("partyId", destinationPartyId).queryOne(); String destinationContactKey = "PERSON".equals(partyTo.getString("partyTypeId")) ? "DestinationContactPersonName" : "DestinationContactCompanyName"; String destinationContactName = PartyHelper.getPartyName(partyTo, false); if (UtilValidate.isEmpty(destinationContactName)) { @@ -795,7 +796,7 @@ public class FedexServices { } // Make sure that the packaging type is valid for FedEx - GenericValue carrierShipmentBoxType = delegator.findOne("CarrierShipmentBoxType", UtilMisc.toMap("partyId", "FEDEX", "shipmentBoxTypeId", packaging), false); + GenericValue carrierShipmentBoxType = EntityQuery.use(delegator).from("CarrierShipmentBoxType").where("partyId", "FEDEX", "shipmentBoxTypeId", packaging).queryOne(); if (UtilValidate.isEmpty(carrierShipmentBoxType)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentFedexPackingTypeInvalid", @@ -1063,7 +1064,7 @@ public class FedexServices { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { - GenericValue fedex = delegator.findOne("ShipmentGatewayFedex", UtilMisc.toMap("shipmentGatewayConfigId", shipmentGatewayConfigId), false); + GenericValue fedex = EntityQuery.use(delegator).from("ShipmentGatewayFedex").where("shipmentGatewayConfigId", shipmentGatewayConfigId).queryOne(); if (UtilValidate.isNotEmpty(fedex)) { Object fedexField = fedex.get(shipmentGatewayConfigParameterName); if (fedexField != null) { Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Thu Oct 30 06:10:58 2014 @@ -55,6 +55,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.entity.util.EntityUtilProperties; import org.ofbiz.party.contact.ContactMechWorker; @@ -122,11 +123,11 @@ public class UpsServices { String shipmentConfirmResponseString = null; 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); } - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (shipmentRouteSegment == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "ProductShipmentRouteSegmentNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); @@ -846,8 +847,8 @@ public class UpsServices { String shipmentAcceptResponseString = null; try { - //GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + //GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUpsNotRouteSegmentCarrier", UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", shipmentId), locale)); @@ -1283,8 +1284,8 @@ public class UpsServices { String voidShipmentResponseString = null; try { - //GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + //GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUpsNotRouteSegmentCarrier", UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", shipmentId), locale)); @@ -1488,8 +1489,8 @@ public class UpsServices { String trackResponseString = null; try { - //GenericValue shipment = delegator.findOne("Shipment", UtilMisc.toMap("shipmentId", shipmentId), false); - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + //GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUpsNotRouteSegmentCarrier", UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", shipmentId), locale)); @@ -1716,7 +1717,7 @@ public class UpsServices { GenericValue shipToAddress = null; if (shippingContactMechId != null) { try { - shipToAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMechId), false); + shipToAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -1729,7 +1730,7 @@ public class UpsServices { GenericValue shipFromAddress = null; if (shippingOriginContactMechId != null) { try { - shipFromAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", shippingOriginContactMechId), false); + shipFromAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", shippingOriginContactMechId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUnableFoundShipToAddresssForDropShipping", locale)); @@ -2060,7 +2061,7 @@ public class UpsServices { GenericValue facilityContactMech = ContactMechWorker.getFacilityContactMechByPurpose(delegator, productStore.getString("inventoryFacilityId"), UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION")); if (facilityContactMech != null) { try { - shipFromAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", facilityContactMech.getString("contactMechId")), false); + shipFromAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", facilityContactMech.getString("contactMechId")).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -2411,11 +2412,11 @@ public class UpsServices { String shipmentConfirmResponseString = null; 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); } - GenericValue shipmentRouteSegment = delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false); + GenericValue shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne(); if (shipmentRouteSegment == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "ProductShipmentRouteSegmentNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); @@ -3184,7 +3185,7 @@ public class UpsServices { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { - GenericValue ups = delegator.findOne("ShipmentGatewayUps", UtilMisc.toMap("shipmentGatewayConfigId", shipmentGatewayConfigId), false); + GenericValue ups = EntityQuery.use(delegator).from("ShipmentGatewayUps").where("shipmentGatewayConfigId", shipmentGatewayConfigId).queryOne(); if (UtilValidate.isNotEmpty(ups)) { Object upsField = ups.get(shipmentGatewayConfigParameterName); if (upsField != null) { Modified: ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java Thu Oct 30 06:10:58 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/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/branches/json-integration-refactoring/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Thu Oct 30 06:10:58 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/json-integration-refactoring/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Thu Oct 30 06:10:58 2014 @@ -65,6 +65,7 @@ import freemarker.template.SimpleScalar; import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; +import freemarker.template.TemplateHashModel; import freemarker.template.TemplateModel; import freemarker.template.TemplateModelException; import freemarker.template.Version; @@ -91,7 +92,13 @@ public class FreeMarkerWorker { Configuration newConfig = new Configuration(version); newConfig.setObjectWrapper(wrapper); - newConfig.setSharedVariable("Static", wrapper.getStaticModels()); + TemplateHashModel staticModels = wrapper.getStaticModels(); + newConfig.setSharedVariable("Static", staticModels); + try { + newConfig.setSharedVariable("EntityQuery", staticModels.get("org.ofbiz.entity.util.EntityQuery")); + } catch (TemplateModelException e) { + Debug.logError(e, module); + } newConfig.setLocalizedLookup(false); newConfig.setSharedVariable("StringUtil", new BeanModel(StringUtil.INSTANCE, wrapper)); newConfig.setTemplateLoader(new FlexibleTemplateLoader()); Modified: ofbiz/branches/json-integration-refactoring/framework/common/data/GeoData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/common/data/GeoData.xml?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/common/data/GeoData.xml (original) +++ ofbiz/branches/json-integration-refactoring/framework/common/data/GeoData.xml Thu Oct 30 06:10:58 2014 @@ -354,7 +354,7 @@ under the License. <CountryAddressFormat geoId="CHN" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> <CountryAddressFormat geoId="COL" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> <CountryAddressFormat geoId="MEX" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> - <CountryAddressFormat geoId="NLD" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> + <CountryAddressFormat geoId="NLD" geoAssocTypeId="REGIONS" requireStateProvinceId="N" requirePostalCode="Y" postalCodeRegex="^[1-9][\d]{3}\s?(?!(sa|sd|ss|SA|SD|SS))([a-eghj-opr-tv-xzA-EGHJ-OPR-TV-XZ]{2})?$ " hasPostalCodeExt="N" requirePostalCodeExt="N" addressFormat=""/> <CountryAddressFormat geoId="POL" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> <CountryAddressFormat geoId="IND" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> <CountryAddressFormat geoId="ITA" geoAssocTypeId="REGIONS" requireStateProvinceId="" requirePostalCode="" postalCodeRegex="" hasPostalCodeExt="" requirePostalCodeExt="" addressFormat=""/> Modified: ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonEvents.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonEvents.java Thu Oct 30 06:10:58 2014 @@ -56,6 +56,7 @@ import org.ofbiz.base.util.cache.UtilCac import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.security.Security; /** @@ -92,7 +93,7 @@ public class CommonEvents { GenericValue visit = null; try { - visit = delegator.findOne("Visit", false, "visitId", visitId); + visit = EntityQuery.use(delegator).from("Visit").where("visitId", visitId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot Visit Object", module); } @@ -126,7 +127,7 @@ public class CommonEvents { GenericValue visit = null; try { - visit = delegator.findOne("Visit", false, "visitId", visitId); + visit = EntityQuery.use(delegator).from("Visit").where("visitId", visitId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot Visit Object", module); } Modified: ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonWorkers.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonWorkers.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu Oct 30 06:10:58 2014 @@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityTypeUtil; import org.ofbiz.entity.util.EntityUtilProperties; @@ -49,7 +50,7 @@ public class CommonWorkers { GenericValue defaultGeo = null; if (UtilValidate.isNotEmpty(defaultCountry)) { try { - defaultGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", defaultCountry), true); + defaultGeo = EntityQuery.use(delegator).from("Geo").where("geoId", defaultCountry).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot lookup Geo", module); } Modified: ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/UrlServletHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/UrlServletHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/UrlServletHelper.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/UrlServletHelper.java Thu Oct 30 06:10:58 2014 @@ -38,6 +38,7 @@ import org.ofbiz.entity.DelegatorFactory import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.webapp.control.ContextFilter; import org.ofbiz.webapp.website.WebSiteWorker; @@ -154,7 +155,7 @@ public class UrlServletHelper extends Co // check path alias GenericValue pathAlias = null; try { - pathAlias = delegator.findOne("WebSitePathAlias", UtilMisc.toMap("webSiteId", webSiteId, "pathAlias", pathInfo), true); + pathAlias = EntityQuery.use(delegator).from("WebSitePathAlias").where("webSiteId", webSiteId, "pathAlias", pathInfo).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, module); } Modified: ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/geo/GeoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/geo/GeoWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff ============================================================================== --- ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/geo/GeoWorker.java (original) +++ ofbiz/branches/json-integration-refactoring/framework/common/src/org/ofbiz/common/geo/GeoWorker.java Thu Oct 30 06:10:58 2014 @@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilValidate; 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; /** @@ -42,7 +43,7 @@ public class GeoWorker { public static List<GenericValue> expandGeoGroup(String geoId, Delegator delegator) { GenericValue geo = null; try { - geo = delegator.findOne("Geo", UtilMisc.toMap("geoId", geoId), true); + geo = EntityQuery.use(delegator).from("Geo").where("geoId", geoId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to look up Geo from geoId : " + geoId, module); } @@ -93,7 +94,7 @@ public class GeoWorker { for (Map.Entry<String, String> geoIdByTypeEntry: geoIdByTypeMapOrig.entrySet()) { List<GenericValue> geoAssocList = delegator.findByAnd("GeoAssoc", UtilMisc.toMap("geoIdTo", geoIdByTypeEntry.getValue(), "geoAssocTypeId", "REGIONS"), null, true); for (GenericValue geoAssoc: geoAssocList) { - GenericValue newGeo = delegator.findOne("Geo", true, "geoId", geoAssoc.getString("geoId")); + GenericValue newGeo = EntityQuery.use(delegator).from("Geo").where("geoId", geoAssoc.get("geoId")).cache().queryOne(); geoIdByTypeMapTemp.put(newGeo.getString("geoTypeId"), newGeo.getString("geoId")); } } @@ -108,7 +109,7 @@ public class GeoWorker { public static boolean containsGeo(List<GenericValue> geoList, String geoId, Delegator delegator) { GenericValue geo = null; try { - geo = delegator.findOne("Geo", UtilMisc.toMap("geoId", geoId), true); + geo = EntityQuery.use(delegator).from("Geo").where("geoId", geoId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to look up Geo from geoId : " + geoId, module); }