svn commit: r1635399 [4/9] - in /ofbiz/branches/json-integration-refactoring: ./ applications/content/data/ applications/manufacturing/src/org/ofbiz/manufacturing/bom/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/manu...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1635399 [4/9] - in /ofbiz/branches/json-integration-refactoring: ./ applications/content/data/ applications/manufacturing/src/org/ofbiz/manufacturing/bom/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/manu...

jacopoc
Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Thu Oct 30 06:10:58 2014
@@ -43,6 +43,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;
 import org.ofbiz.marketing.tracking.TrackingCodeEvents;
 import org.ofbiz.order.order.OrderReadHelper;
@@ -508,7 +509,7 @@ public class CheckOutEvents {
         ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
         GenericValue productStore = null;
         try {
-            productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId()), true);
+            productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", cart.getProductStoreId()).cache().queryOne();
             Debug.logInfo("checkShipmentNeeded: reqShipAddrForDigItems=" + productStore.getString("reqShipAddrForDigItems"), module);
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error getting ProductStore: " + e.toString(), module);
@@ -758,7 +759,7 @@ public class CheckOutEvents {
                 // no userLogin means we are an anonymous shopper; fake the UL for service calls
                 if (userLogin == null) {
                     try {
-                        userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "anonymous"), false);
+                        userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "anonymous").queryOne();
                     } catch (GenericEntityException e) {
                         Debug.logError(e, module);
                     }

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Oct 30 06:10:58 2014
@@ -47,6 +47,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityFunction;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityTypeUtil;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.finaccount.FinAccountHelper;
@@ -634,9 +635,9 @@ public class CheckOutHelper {
                 try {
                     // do something tricky here: run as the "system" user
                     // that can actually create and run a production run
-                    GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true);
+                    GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
                     GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
-                    GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+                    GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
                     if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) {
                         org.ofbiz.product.config.ProductConfigWrapper config = this.cart.findCartItem(counter).getConfigWrapper();
                         Map<String, Object> inputMap = new HashMap<String, Object>();
@@ -696,7 +697,7 @@ public class CheckOutHelper {
 
         GenericValue party = null;
         try {
-            party = this.delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsGettingPartyRecord", cart.getLocale()), module);
         }
@@ -1267,7 +1268,7 @@ public class CheckOutHelper {
                 userLogin.set("enabled", "N");
                 userLogin.store();
             } else {
-                userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), true);
+                userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
             }
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
@@ -1293,7 +1294,7 @@ public class CheckOutHelper {
         // you cannot accept multiple payment type when using an external gateway
         GenericValue orderHeader = null;
         try {
-            orderHeader = this.delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
+            orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Problems getting order header", module);
             errMsg = UtilProperties.getMessage(resource_error,"checkhelper.problems_getting_order_header", (cart != null ? cart.getLocale() : Locale.getDefault()));

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Thu Oct 30 06:10:58 2014
@@ -59,6 +59,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.EntityUtil;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.order.finaccount.FinAccountHelper;
@@ -1909,7 +1910,7 @@ public class ShoppingCart implements Ite
      * @throws GenericEntityException
      */
     public GenericValue getGiftCertSettingFromStore(Delegator delegator) throws GenericEntityException {
-        return delegator.findOne("ProductStoreFinActSetting", UtilMisc.toMap("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), true);
+        return EntityQuery.use(delegator).from("ProductStoreFinActSetting").where("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId).cache().queryOne();
     }
 
     /**
@@ -3431,7 +3432,7 @@ public class ShoppingCart implements Ite
             String productName = product.getString("productName");
             String description = product.getString("description");
             Map<String, Object> serviceContext = new HashMap<String, Object>();
-            GenericValue permUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", "system"), false);
+            GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne();
             String internalName = item.getProductId() + "_" + configId;
             serviceContext.put("internalName", internalName);
             serviceContext.put("productName", productName);
@@ -4842,7 +4843,7 @@ public class ShoppingCart implements Ite
                 GenericValue productStore = null;
                 String splitPayPrefPerShpGrp = null;
                 try {
-                    productStore = delegator.findOne("ProductStore", UtilMisc.toMap("productStoreId", cart.getProductStoreId()), false);
+                    productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", cart.getProductStoreId()).queryOne();
                 } catch (GenericEntityException e) {
                     Debug.logError(e.toString(), module);
                 }

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Thu Oct 30 06:10:58 2014
@@ -53,6 +53,7 @@ import org.ofbiz.entity.GenericPK;
 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.order.shoppingcart.product.ProductPromoWorker;
 import org.ofbiz.product.catalog.CatalogWorker;
@@ -622,7 +623,7 @@ public class ShoppingCartEvents {
         if(ProductWorker.isAlternativePacking(delegator, productId , parentProductId)){
             GenericValue parentProduct = null;
             try {
-                parentProduct = delegator.findOne("Product", UtilMisc.toMap("productId", parentProductId), false);
+                parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error getting parent product", module);
             }
@@ -721,7 +722,7 @@ public class ShoppingCartEvents {
         // check the preferred currency of the supplier, if set, use that for the cart, otherwise use system defaults.
         ShoppingCart cart = null;
         try {
-            GenericValue supplierParty = delegator.findOne("Party", UtilMisc.toMap("partyId", supplierPartyId), false);
+            GenericValue supplierParty = EntityQuery.use(delegator).from("Party").where("partyId", supplierPartyId).queryOne();
             if (UtilValidate.isNotEmpty(supplierParty.getString("preferredCurrencyUomId"))) {
                 cart = new WebShoppingCart(request, locale, supplierParty.getString("preferredCurrencyUomId"));
             } else {
@@ -742,7 +743,7 @@ public class ShoppingCartEvents {
         if (UtilValidate.isNotEmpty(orderId)) {
             GenericValue thisOrder = null;
             try {
-                thisOrder = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
+                thisOrder = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e.getMessage(), module);
             }
@@ -1305,7 +1306,7 @@ public class ShoppingCartEvents {
         }
 
         try {
-            termType = delegator.findOne("TermType", UtilMisc.toMap("termTypeId", termTypeId), false);
+            termType = EntityQuery.use(delegator).from("TermType").where("termTypeId", termTypeId).queryOne();
         } catch (GenericEntityException gee) {
             request.setAttribute("_ERROR_MESSAGE_", gee.getMessage());
             return "error";
@@ -1666,7 +1667,7 @@ public class ShoppingCartEvents {
             if (UtilValidate.isEmpty(partyId) && UtilValidate.isNotEmpty(userLoginId)) {
                 GenericValue thisUserLogin = null;
                 try {
-                    thisUserLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false);
+                    thisUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne();
                 } catch (GenericEntityException gee) {
                     //
                 }
@@ -1679,7 +1680,7 @@ public class ShoppingCartEvents {
             if (UtilValidate.isNotEmpty(partyId)) {
                 GenericValue thisParty = null;
                 try {
-                    thisParty = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+                    thisParty = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
                 } catch (GenericEntityException gee) {
                     //
                 }
@@ -1735,7 +1736,7 @@ public class ShoppingCartEvents {
             String productPromoId = (String)context.get(keyPrefix + i);
             if (UtilValidate.isNotEmpty(productPromoId)) {
                 try {
-                    GenericValue promo = delegator.findOne("ProductPromo", UtilMisc.toMap("productPromoId", productPromoId), false);
+                    GenericValue promo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", productPromoId).queryOne();
                     if (promo != null) {
                         manualPromotions.add(promo);
                     }
@@ -1897,7 +1898,7 @@ public class ShoppingCartEvents {
         if (UtilValidate.isNotEmpty(orderId)) {
             GenericValue thisOrder = null;
             try {
-                thisOrder = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
+                thisOrder = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e.getMessage(), module);
             }

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Thu Oct 30 06:10:58 2014
@@ -44,6 +44,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.EntityTypeUtil;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
@@ -192,7 +193,7 @@ public class ShoppingCartHelper {
         GenericValue product = null;
         if (productId != null) {
             try {
-                product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+                product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Unable to lookup product : " + productId, module);
             }
@@ -331,7 +332,7 @@ public class ShoppingCartHelper {
                     String aggregatedProdId = null;
                     if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", ProductWorker.getProductTypeId(delegator, productId), "parentTypeId", "AGGREGATED")) {
                         try {
-                            GenericValue instanceProduct = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+                            GenericValue instanceProduct = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
                             String configId = instanceProduct.getString("configId");
                             aggregatedProdId = ProductWorker.getInstanceAggregatedId(delegator, productId);
                             configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, configId, aggregatedProdId, cart.getProductStoreId(), catalogId, cart.getWebSiteId(), cart.getCurrency(), cart.getLocale(), cart.getAutoUserLogin());
@@ -434,7 +435,7 @@ public class ShoppingCartHelper {
                         originalProductId = productId;
                         productId = ProductWorker.getOriginalProductId(delegator, productId);
                         try {
-                            originalProduct = delegator.findOne("Product", UtilMisc.toMap("productId", originalProductId), false);
+                            originalProduct = EntityQuery.use(delegator).from("Product").where("productId", originalProductId).queryOne();
                         } catch (GenericEntityException e) {
                             Debug.logError(e, "Error getting parent product", module);
                         }
@@ -504,7 +505,7 @@ public class ShoppingCartHelper {
                 requirementId = (String) context.get("requirementId" + thisSuffix);
                 GenericValue requirement = null;
                 try {
-                    requirement = delegator.findOne("Requirement", UtilMisc.toMap("requirementId", requirementId), false);
+                    requirement = EntityQuery.use(delegator).from("Requirement").where("requirementId", requirementId).queryOne();
                 } catch (GenericEntityException gee) {
                 }
                 if (requirement == null) {

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Thu Oct 30 06:10:58 2014
@@ -52,6 +52,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.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
 import org.ofbiz.order.shoppingcart.product.ProductPromoWorker;
@@ -182,7 +183,7 @@ public class ShoppingCartItem implements
         GenericValue product = null;
 
         try {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+            product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.toString(), module);
         }
@@ -326,7 +327,7 @@ public class ShoppingCartItem implements
         {
             try
             {
-                parentProduct = delegator.findOne("Product", UtilMisc.toMap("productId", parentProductId), true);
+                parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e.toString(), module);
             }
@@ -515,7 +516,7 @@ public class ShoppingCartItem implements
         GenericValue product;
 
         try {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+            product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
 
             // first see if there is a purchase allow category and if this product is in it or not
             String purchaseProductCategoryId = CatalogWorker.getCatalogPurchaseAllowCategoryId(delegator, prodCatalogId);

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Thu Oct 30 06:10:58 2014
@@ -44,6 +44,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.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
@@ -178,7 +179,7 @@ public class ShoppingCartServices {
         // get the order header
         GenericValue orderHeader = null;
         try {
-            orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
+            orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());
@@ -362,7 +363,7 @@ public class ShoppingCartServices {
                 }
                 if ("ITEM_REJECTED".equals(item.getString("statusId")) || "ITEM_CANCELLED".equals(item.getString("statusId"))) continue;
                 try {
-                    product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+                    product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
                     if ("DIGITAL_GOOD".equals(product.getString("productTypeId"))) {
                         Map<String, Object> surveyResponseMap = FastMap.newInstance();
                         Map<String, Object> answers = FastMap.newInstance();
@@ -432,7 +433,7 @@ public class ShoppingCartServices {
                     String workEffortId = orh.getCurrentOrderItemWorkEffort(item);
                     if (workEffortId != null) {
                         try {
-                            workEffort = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false);
+                            workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne();
                         } catch (GenericEntityException e) {
                             Debug.logError(e, module);
                         }
@@ -450,7 +451,7 @@ public class ShoppingCartServices {
                     ProductConfigWrapper configWrapper = null;
                     String configId = null;
                     try {
-                        product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+                        product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
                         if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "AGGREGATED")) {
                             List<GenericValue>productAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF", "productIdTo", product.getString("productId")), null, false);
                             productAssocs = EntityUtil.filterByDate(productAssocs);
@@ -660,7 +661,7 @@ public class ShoppingCartServices {
         // get the quote header
         GenericValue quote = null;
         try {
-            quote = delegator.findOne("Quote", UtilMisc.toMap("quoteId", quoteId), false);
+            quote = EntityQuery.use(delegator).from("Quote").where("quoteId", quoteId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());
@@ -960,7 +961,7 @@ public class ShoppingCartServices {
         // get the shopping list header
         GenericValue shoppingList = null;
         try {
-            shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false);
+            shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Thu Oct 30 06:10:58 2014
@@ -50,6 +50,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.order.shoppingcart.CartItemModifyException;
 import org.ofbiz.order.shoppingcart.ShoppingCart;
@@ -105,7 +106,7 @@ public class ProductPromoWorker {
             String productStoreId = cart.getProductStoreId();
             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, "Error looking up store with id " + productStoreId, module);
             }
@@ -167,7 +168,7 @@ public class ProductPromoWorker {
         String productStoreId = cart.getProductStoreId();
         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, "Error looking up store with id " + productStoreId, module);
         }
@@ -205,7 +206,7 @@ public class ProductPromoWorker {
         String productStoreId = cart.getProductStoreId();
         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, "Error looking up store with id " + productStoreId, module);
         }
@@ -248,7 +249,7 @@ public class ProductPromoWorker {
         String agreementId = cart.getAgreementId();
         GenericValue agreement = null;
         try {
-            agreement = delegator.findOne("Agreement", UtilMisc.toMap("agreementId", agreementId), true);
+            agreement = EntityQuery.use(delegator).from("Agreement").where("agreementId", agreementId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error looking up agreement with id " + agreementId, module);
         }
@@ -336,7 +337,7 @@ public class ProductPromoWorker {
             Map<String, Long> usesPerPromo = new HashMap<String, Long>();
             int indexOfFirstOrderTotalPromo = -1;
             for (ProductPromoUseInfo promoUse: sortedPromoUses) {
-                GenericValue productPromo = delegator.findOne("ProductPromo", UtilMisc.toMap("productPromoId", promoUse.getProductPromoId()), true);
+                GenericValue productPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", promoUse.getProductPromoId()).cache().queryOne();
                 GenericValue newProductPromo = (GenericValue)productPromo.clone();
                 if (!usesPerPromo.containsKey(promoUse.getProductPromoId())) {
                     usesPerPromo.put(promoUse.getProductPromoId(), 0l);
@@ -596,7 +597,7 @@ public class ProductPromoWorker {
 
     public static String checkCanUsePromoCode(String productPromoCodeId, String partyId, Delegator delegator, ShoppingCart cart, Locale locale) {
         try {
-            GenericValue productPromoCode = delegator.findOne("ProductPromoCode", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), false);
+            GenericValue productPromoCode = EntityQuery.use(delegator).from("ProductPromoCode").where("productPromoCodeId", productPromoCodeId).queryOne();
             if (productPromoCode == null) {
                 return UtilProperties.getMessage(resource_error, "productpromoworker.promotion_code_not_valid", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), locale);
             }
@@ -625,7 +626,7 @@ public class ProductPromoWorker {
 
                 // check partyId
                 if (UtilValidate.isNotEmpty(partyId)) {
-                    if (delegator.findOne("ProductPromoCodeParty", UtilMisc.toMap("productPromoCodeId", productPromoCodeId, "partyId", partyId), false) != null) {
+                    if (EntityQuery.use(delegator).from("ProductPromoCodeParty").where("productPromoCodeId", productPromoCodeId, "partyId", partyId).queryOne() != null) {
                         // found party associated with the code, looks good...
                         return null;
                     }
@@ -709,7 +710,7 @@ public class ProductPromoWorker {
 
                 if (UtilValidate.isEmpty(messageContext.get("productId"))) messageContext.put("productId", "any");
                 if (UtilValidate.isEmpty(messageContext.get("partyId"))) messageContext.put("partyId", "any");
-                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) {
                     messageContext.put("productName", ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, null));
                 }
@@ -1249,7 +1250,7 @@ public class ProductPromoWorker {
         } else if ("PPIP_RECURRENCE".equals(inputParamEnumId)) {
             if (UtilValidate.isNotEmpty(condValue)) {
                 compareBase = Integer.valueOf(1);
-                GenericValue recurrenceInfo = delegator.findOne("RecurrenceInfo", UtilMisc.toMap("recurrenceInfoId", condValue), true);
+                GenericValue recurrenceInfo = EntityQuery.use(delegator).from("RecurrenceInfo").where("recurrenceInfoId", condValue).cache().queryOne();
                 if (recurrenceInfo != null) {
                     RecurrenceInfo recurrence = null;
                     try {
@@ -1470,7 +1471,7 @@ public class ProductPromoWorker {
                 GenericValue product = null;
                 if (UtilValidate.isNotEmpty(productId)) {
                     // Debug.logInfo("======== Got GWP productId [" + productId + "]", module);
-                    product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+                    product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
                     if (product == null) {
                         String errMsg = "GWP Product not found with ID [" + productId + "] for ProductPromoAction [" + productPromoAction.get("productPromoId") + ":" + productPromoAction.get("productPromoRuleId") + ":" + productPromoAction.get("productPromoActionSeqId") + "]";
                         Debug.logError(errMsg, module);
@@ -1557,7 +1558,7 @@ public class ProductPromoWorker {
                         }
                         optionProductIds.remove(alternateGwpProductId);
                         productId = alternateGwpProductId;
-                        product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+                        product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
                     } else {
                         Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderAnAlternateGwpProductIdWasInPlaceButWasEitherNotValidOrIsNoLongerInStockForId", UtilMisc.toMap("alternateGwpProductId",alternateGwpProductId), cart.getLocale()), module);
                     }
@@ -1569,7 +1570,7 @@ public class ProductPromoWorker {
                     Iterator<String> optionProductIdTempIter = optionProductIds.iterator();
                     productId = optionProductIdTempIter.next();
                     optionProductIdTempIter.remove();
-                    product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+                    product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
                 }
 
                 if (product == null) {
@@ -1942,7 +1943,7 @@ public class ProductPromoWorker {
         // get the promoText / promoName to set as a descr of the orderAdj
         GenericValue prodPromo;
         try {
-            prodPromo = delegator.findOne("ProductPromo", UtilMisc.toMap("productPromoId", prodPromoId), true);
+            prodPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", prodPromoId).cache().queryOne();
             if (UtilValidate.isNotEmpty(prodPromo.get("promoText"))) {
                 return (String) prodPromo.get("promoText");
             }
@@ -2070,7 +2071,7 @@ public class ProductPromoWorker {
     }
 
     protected static boolean isProductOld(String productId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
-        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) {
             Timestamp salesDiscontinuationDate = product.getTimestamp("salesDiscontinuationDate");
             if (salesDiscontinuationDate != null && salesDiscontinuationDate.before(nowTimestamp)) {

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Thu Oct 30 06:10:58 2014
@@ -39,6 +39,7 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
 import org.ofbiz.order.shoppingcart.ShoppingCart;
@@ -279,7 +280,7 @@ public class ShippingEvents {
         String serviceName = null;
         GenericValue customMethod = null;
         try {
-            customMethod = delegator.findOne("CustomMethod", UtilMisc.toMap("customMethodId", shipmentCustomMethodId), false);
+            customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", shipmentCustomMethodId).queryOne();
             if (UtilValidate.isNotEmpty(customMethod)) {
                 serviceName = customMethod.getString("customMethodName");
             }

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Thu Oct 30 06:10:58 2014
@@ -43,6 +43,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;
 import org.ofbiz.order.shoppingcart.CartItemModifyException;
 import org.ofbiz.order.shoppingcart.ItemNotFoundException;
@@ -214,7 +215,7 @@ public class ShoppingListEvents {
         GenericValue shoppingList = null;
         List<GenericValue> shoppingListItems = null;
         try {
-            shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false);
+            shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne();
             if (shoppingList == null) {
                 errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale());
                 throw new IllegalArgumentException(errMsg);
@@ -404,7 +405,7 @@ public class ShoppingListEvents {
                 autoSaveListId = getAutoSaveListId(delegator, dispatcher, null, userLogin, cart.getProductStoreId());
                 cart.setAutoSaveListId(autoSaveListId);
             }
-            GenericValue shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", autoSaveListId), false);
+            GenericValue shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", autoSaveListId).queryOne();
             Integer currentListSize = 0;
             if (UtilValidate.isNotEmpty(shoppingList)) {
                 List<GenericValue> shoppingListItems = shoppingList.getRelated("ShoppingListItem", null, null, false);
@@ -505,7 +506,7 @@ public class ShoppingListEvents {
         if (!okayToLoad && lastLoad != null) {
             GenericValue shoppingList = null;
             try {
-                shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", autoSaveListId), false);
+                shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", autoSaveListId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Thu Oct 30 06:10:58 2014
@@ -41,6 +41,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityTypeUtil;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
@@ -271,7 +272,7 @@ public class ShoppingListServices {
             beganTransaction = TransactionUtil.begin();
 
             GenericValue orderHeader = null;
-            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(resource_error,"OrderUnableToLocateOrder", UtilMisc.toMap("orderId",orderId), locale));
@@ -312,7 +313,7 @@ public class ShoppingListServices {
             }
 
             GenericValue shoppingList = null;
-            shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false);
+            shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne();
 
             if (shoppingList == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoShoppingListAvailable",locale));
@@ -335,7 +336,7 @@ public class ShoppingListServices {
                             orderItem.get("productId"), "quantity", orderItem.get("quantity"));
                     if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", ProductWorker.getProductTypeId(delegator, productId), "parentTypeId", "AGGREGATED")) {
                         try {
-                            GenericValue instanceProduct = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+                            GenericValue instanceProduct = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
                             String configId = instanceProduct.getString("configId");
                             ctx.put("configId", configId);
                             String aggregatedProductId = ProductWorker.getInstanceAggregatedId(delegator, productId);
@@ -539,7 +540,7 @@ public class ShoppingListServices {
         Delegator delegator = dispatcher.getDelegator();
         GenericValue shoppingList = null;
         try {
-            shoppingList = delegator.findOne("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), false);
+            shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java Thu Oct 30 06:10:58 2014
@@ -27,6 +27,7 @@ import javolution.util.FastMap;
 
 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 PurchaseOrderTest extends OFBizTestCase {
@@ -41,7 +42,7 @@ public class PurchaseOrderTest extends O
 
     @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/order/src/org/ofbiz/order/test/SalesOrderTest.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java Thu Oct 30 06:10:58 2014
@@ -27,6 +27,7 @@ import javolution.util.FastMap;
 
 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 SalesOrderTest extends OFBizTestCase {
@@ -39,7 +40,7 @@ public class SalesOrderTest 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
@@ -114,8 +115,16 @@ public class SalesOrderTest extends OFBi
         orderItem.set("unitPrice", new BigDecimal("38.4"));
         orderItem.set("unitListPrice", new BigDecimal("48.0"));
         orderItem.set("statusId", "ITEM_CREATED");
-
         orderItems.add(orderItem);
+        
+        orderItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", "00002", "orderItemTypeId", "PRODUCT_ORDER_ITEM", "prodCatalogId", "DemoCatalog", "productId", "GZ-1006-1", "quantity", BigDecimal.ONE, "selectedAmount", BigDecimal.ZERO));
+        orderItem.set("isPromo", "N");
+        orderItem.set("isModifiedPrice", "N");
+        orderItem.set("unitPrice", new BigDecimal("1.99"));
+        orderItem.set("unitListPrice", new BigDecimal("5.99"));
+        orderItem.set("statusId", "ITEM_CREATED");
+        orderItems.add(orderItem);
+        
         ctx.put("orderItems", orderItems);
 
         List<GenericValue> orderTerms = FastList.newInstance();

Modified: ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Thu Oct 30 06:10:58 2014
@@ -35,6 +35,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.order.shoppingcart.ShoppingCart;
 import org.ofbiz.order.shoppingcart.ShoppingCartEvents;
 import org.ofbiz.product.store.ProductStoreWorker;
@@ -102,7 +103,7 @@ public class ExpressCheckoutEvents {
         }
         if (paymentGatewayConfigId != null) {
             try {
-                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
+                payPalGatewayConfig = EntityQuery.use(delegator).from("PaymentGatewayPayPal").where("paymentGatewayConfigId", paymentGatewayConfigId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Thu Oct 30 06:10:58 2014
@@ -62,6 +62,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -87,7 +88,7 @@ public class CommunicationEventServices
 
         try {
             // find the communication event and make sure that it is actually an email
-            GenericValue communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), false);
+            GenericValue communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
             if (communicationEvent == null) {
                 String errMsg = UtilProperties.getMessage(resource,"commeventservices.communication_event_not_found_failure", locale);
                 return ServiceUtil.returnError(errMsg + " " + communicationEventId);
@@ -285,8 +286,8 @@ public class CommunicationEventServices
         EntityListIterator eli = null;
         try {
 
-            GenericValue communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), false);
-            GenericValue contactList = delegator.findOne("ContactList", UtilMisc.toMap("contactListId", contactListId), false);
+            GenericValue communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne();
+            GenericValue contactList = EntityQuery.use(delegator).from("ContactList").where("contactListId", contactListId).queryOne();
 
             Map<String, Object> sendMailParams = new HashMap<String, Object>();
             sendMailParams.put("sendFrom", communicationEvent.getRelatedOne("FromContactMech", false).getString("infoString"));
@@ -391,7 +392,7 @@ public class CommunicationEventServices
                         bodyParameters.put("content", communicationEvent.getString("content"));
                         NotificationServices.setBaseUrl(delegator, contactList.getString("verifyEmailWebSiteId"), bodyParameters);
 
-                        GenericValue webSite = delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", contactList.getString("verifyEmailWebSiteId")), false);
+                        GenericValue webSite = EntityQuery.use(delegator).from("WebSite").where("webSiteId", contactList.getString("verifyEmailWebSiteId")).queryOne();
                         if (UtilValidate.isNotEmpty(webSite)) {
                             GenericValue productStore = webSite.getRelatedOne("ProductStore", false);
                             if (UtilValidate.isNotEmpty(productStore)) {
@@ -445,7 +446,7 @@ public class CommunicationEventServices
                     } else {
                         // attach the parent communication event to the new event created when sending the mail
                         String thisCommEventId = (String) tmpResult.get("communicationEventId");
-                        GenericValue thisCommEvent = delegator.findOne("CommunicationEvent", false, "communicationEventId", thisCommEventId);
+                        GenericValue thisCommEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", thisCommEventId).queryOne();
                         if (thisCommEvent != null) {
                             thisCommEvent.set("contactListId", contactListId);
                             thisCommEvent.set("parentCommEventId", communicationEventId);
@@ -1338,7 +1339,7 @@ public class CommunicationEventServices
             Delegator delegator = (Delegator) request.getAttribute("delegator");
             GenericValue communicationEvent = null;
             try {
-                communicationEvent = delegator.findOne("CommunicationEvent", UtilMisc.toMap("communicationEventId", communicationEventId), true);
+                communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java Thu Oct 30 06:10:58 2014
@@ -41,6 +41,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;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
@@ -157,7 +158,7 @@ public class ContactMechServices {
         GenericValue partyContactMech = null;
 
         try {
-            contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+            contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
             contactMech = null;
@@ -417,7 +418,7 @@ public class ContactMechServices {
         GenericValue partyContactMech = null;
 
         try {
-            contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+            contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
             contactMech = null;
@@ -455,7 +456,7 @@ public class ContactMechServices {
             GenericValue addr = null;
 
             try {
-                addr = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", contactMechId), false);
+                addr = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", contactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e.toString(), module);
                 addr = null;
@@ -635,7 +636,7 @@ public class ContactMechServices {
         GenericValue partyContactMech = null;
 
         try {
-            contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+            contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
             // try to find a PartyContactMech with a valid date range
             List<GenericValue> partyContactMechs = EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId), UtilMisc.toList("fromDate"), false), true);
 
@@ -664,7 +665,7 @@ public class ContactMechServices {
             GenericValue telNum = null;
 
             try {
-                telNum = delegator.findOne("TelecomNumber", UtilMisc.toMap("contactMechId", contactMechId), false);
+                telNum = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e.toString(), module);
                 telNum = null;
@@ -930,7 +931,7 @@ public class ContactMechServices {
         GenericValue pcmp = null;
 
         try {
-            pcmp = delegator.findOne("PartyContactMechPurpose", UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", fromDate), false);
+            pcmp = EntityQuery.use(delegator).from("PartyContactMechPurpose").where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", fromDate).queryOne();
             if (pcmp == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
                         "contactmechservices.could_not_delete_purpose_from_contact_mechanism_not_found", locale));

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/contact/ContactMechWorker.java Thu Oct 30 06:10:58 2014
@@ -39,6 +39,7 @@ import org.ofbiz.entity.Delegator;
 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.entity.util.EntityUtilProperties;
 
@@ -359,7 +360,7 @@ public class ContactMechWorker {
             }
 
             try {
-                contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+                contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
             }
@@ -374,7 +375,7 @@ public class ContactMechWorker {
             target.put("contactMechTypeId", contactMechTypeId);
 
             try {
-                GenericValue contactMechType = delegator.findOne("ContactMechType", UtilMisc.toMap("contactMechTypeId", contactMechTypeId), false);
+                GenericValue contactMechType = EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", contactMechTypeId).queryOne();
 
                 if (contactMechType != null)
                     target.put("contactMechType", contactMechType);
@@ -571,7 +572,7 @@ public class ContactMechWorker {
             }
 
             try {
-                contactMech = delegator.findOne("ContactMech", UtilMisc.toMap("contactMechId", contactMechId), false);
+                contactMech = EntityQuery.use(delegator).from("ContactMech").where("contactMechId", contactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
             }
@@ -586,7 +587,7 @@ public class ContactMechWorker {
             target.put("contactMechTypeId", contactMechTypeId);
 
             try {
-                GenericValue contactMechType = delegator.findOne("ContactMechType", UtilMisc.toMap("contactMechTypeId", contactMechTypeId), false);
+                GenericValue contactMechType = EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", contactMechTypeId).queryOne();
 
                 if (contactMechType != null)
                     target.put("contactMechType", contactMechType);
@@ -890,7 +891,7 @@ public class ContactMechWorker {
     public static String getContactMechAttribute(Delegator delegator, String contactMechId, String attrName) {
         GenericValue attr = null;
         try {
-            attr = delegator.findOne("ContactMechAttribute", UtilMisc.toMap("contactMechId", contactMechId, "attrName", attrName), false);
+            attr = EntityQuery.use(delegator).from("ContactMechAttribute").where("contactMechId", contactMechId, "attrName", attrName).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -910,14 +911,14 @@ public class ContactMechWorker {
         // no postalCodeGeoId, see if there is a Geo record matching the countryGeoId and postalCode fields
         if (UtilValidate.isNotEmpty(postalAddress.getString("countryGeoId")) && UtilValidate.isNotEmpty(postalAddress.getString("postalCode"))) {
             // first try the shortcut with the geoId convention for "{countryGeoId}-{postalCode}"
-            GenericValue geo = delegator.findOne("Geo", UtilMisc.toMap("geoId", postalAddress.getString("countryGeoId") + "-" + postalAddress.getString("postalCode")), true);
+            GenericValue geo = EntityQuery.use(delegator).from("Geo").where("geoId", postalAddress.getString("countryGeoId") + "-" + postalAddress.getString("postalCode")).cache().queryOne();
             if (geo != null) {
                 // save the value to the database for quicker future reference
                 if (postalAddress.isMutable()) {
                     postalAddress.set("postalCodeGeoId", geo.getString("geoId"));
                     postalAddress.store();
                 } else {
-                    GenericValue mutablePostalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", postalAddress.getString("contactMechId")), false);
+                    GenericValue mutablePostalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", postalAddress.getString("contactMechId")).queryOne();
                     mutablePostalAddress.set("postalCodeGeoId", geo.getString("geoId"));
                     mutablePostalAddress.store();
                 }
@@ -935,7 +936,7 @@ public class ContactMechWorker {
                     postalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
                     postalAddress.store();
                 } else {
-                    GenericValue mutablePostalAddress = delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", postalAddress.getString("contactMechId")), false);
+                    GenericValue mutablePostalAddress = EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", postalAddress.getString("contactMechId")).queryOne();
                     mutablePostalAddress.set("postalCodeGeoId", geoAssocAndGeoTo.getString("geoId"));
                     mutablePostalAddress.store();
                 }

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java Thu Oct 30 06:10:58 2014
@@ -25,6 +25,7 @@ import org.ofbiz.base.util.cache.UtilCac
 import org.ofbiz.base.util.*;
 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;
@@ -187,7 +188,7 @@ public class PartyContentWrapper impleme
             ModelEntity partyPersonModel = delegator.getModelEntity("PartyAndPerson");
             if (partyPersonModel != null && partyPersonModel.isField(candidateFieldName)) {
                 if (party == null) {
-                    party = delegator.findOne("PartyAndPerson", UtilMisc.toMap("partyId", partyId), true);
+                    party = EntityQuery.use(delegator).from("PartyAndPerson").where("partyId", partyId).cache().queryOne();
                 }
                 if (party != null) {
                     String candidateValue = party.getString(candidateFieldName);
@@ -202,7 +203,7 @@ public class PartyContentWrapper impleme
             ModelEntity partyGroupModel = delegator.getModelEntity("PartyAndGroup");
             if (partyGroupModel != null && partyGroupModel.isField(candidateFieldName)) {
                 if (party == null) {
-                    party = delegator.findOne("PartyAndGroup", UtilMisc.toMap("partyId", partyId), true);
+                    party = EntityQuery.use(delegator).from("PartyAndGroup").where("partyId", partyId).cache().queryOne();
                 }
                 if (party != null) {
                     String candidateValue = party.getString(candidateFieldName);
@@ -217,7 +218,7 @@ public class PartyContentWrapper impleme
         // otherwise a content field
         GenericValue partyContent;
         if (contentId != null) {
-            partyContent = delegator.findOne("PartyContent", UtilMisc.toMap("partyId", partyId, "contentId", contentId), true);
+            partyContent = EntityQuery.use(delegator).from("PartyContent").where("partyId", partyId, "contentId", contentId).cache().queryOne();
         } else {
             partyContent = getFirstPartyContentByType(partyId, party, partyContentTypeId, delegator);
         }

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyHelper.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyHelper.java Thu Oct 30 06:10:58 2014
@@ -26,6 +26,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * PartyHelper
@@ -43,7 +44,7 @@ public class PartyHelper {
     public static String getPartyName(Delegator delegator, String partyId, boolean lastNameFirst) {
         GenericValue partyObject = null;
         try {
-            partyObject = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), false);
+            partyObject = EntityQuery.use(delegator).from("PartyNameView").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error finding PartyNameView in getPartyName", module);
         }

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java Thu Oct 30 06:10:58 2014
@@ -33,6 +33,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;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
@@ -126,14 +127,14 @@ public class PartyRelationshipServices {
 
                 // Before creating the partyRelationShip, create the partyRoles if they don't exist
                 GenericValue partyToRole = null;
-                partyToRole = delegator.findOne("PartyRole", UtilMisc.toMap("partyId", partyIdTo, "roleTypeId", roleTypeIdTo), false);
+                partyToRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyIdTo, "roleTypeId", roleTypeIdTo).queryOne();
                 if (partyToRole == null) {
                     partyToRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyIdTo, "roleTypeId", roleTypeIdTo));
                     partyToRole.create();
                 }
 
                 GenericValue partyFromRole= null;
-                partyFromRole = delegator.findOne("PartyRole", UtilMisc.toMap("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom), false);
+                partyFromRole = EntityQuery.use(delegator).from("PartyRole").where("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom).queryOne();
                 if (partyFromRole == null) {
                     partyFromRole = delegator.makeValue("PartyRole", UtilMisc.toMap("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom));
                     partyFromRole.create();

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyServices.java Thu Oct 30 06:10:58 2014
@@ -53,6 +53,7 @@ import org.ofbiz.entity.model.DynamicVie
 import org.ofbiz.entity.model.ModelKeyMap;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityTypeUtil;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
@@ -137,7 +138,7 @@ public class PartyServices {
         GenericValue party = null;
 
         try {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
         }
@@ -178,7 +179,7 @@ public class PartyServices {
         GenericValue person = null;
 
         try {
-            person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), false);
+            person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
         }
@@ -221,7 +222,7 @@ public class PartyServices {
         }
 
         try {
-            GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
 
             String oldStatusId = party.getString("statusId");
             if (!statusId.equals(oldStatusId)) {
@@ -232,7 +233,7 @@ public class PartyServices {
                 } else {
 
                 // check that status is defined as a valid change
-                GenericValue statusValidChange = delegator.findOne("StatusValidChange", UtilMisc.toMap("statusId", party.getString("statusId"), "statusIdTo", statusId), false);
+                GenericValue statusValidChange = EntityQuery.use(delegator).from("StatusValidChange").where("statusId", party.getString("statusId"), "statusIdTo", statusId).queryOne();
                 if (statusValidChange == null) {
                     String errorMsg = "Cannot change party status from " + party.getString("statusId") + " to " + statusId;
                     Debug.logWarning(errorMsg, module);
@@ -294,8 +295,8 @@ public class PartyServices {
         GenericValue party = null;
 
         try {
-            person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), false);
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -377,8 +378,8 @@ public class PartyServices {
 
         try {
             // check to see if party object exists, if so make sure it is PARTY_GROUP type party
-            GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
-            GenericValue partyGroupPartyType = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", "PARTY_GROUP"), true);
+            GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
+            GenericValue partyGroupPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", "PARTY_GROUP").cache().queryOne();
 
             if (partyGroupPartyType == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -397,7 +398,7 @@ public class PartyServices {
                 String partyTypeId = "PARTY_GROUP";
 
                 if (UtilValidate.isNotEmpty(context.get("partyTypeId"))) {
-                    GenericValue desiredPartyType = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", context.get("partyTypeId")), true);
+                    GenericValue desiredPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", context.get("partyTypeId")).cache().queryOne();
                     if (desiredPartyType != null && EntityTypeUtil.isType(desiredPartyType, partyGroupPartyType)) {
                         partyTypeId = desiredPartyType.getString("partyTypeId");
                     } else {
@@ -428,7 +429,7 @@ public class PartyServices {
                 partyStat.create();
             }
 
-            GenericValue partyGroup = delegator.findOne("PartyGroup", UtilMisc.toMap("partyId", partyId), false);
+            GenericValue partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne();
             if (partyGroup != null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
                         "partyservices.cannot_create_party_group_already_exists", locale));
@@ -472,8 +473,8 @@ public class PartyServices {
         GenericValue party = null;
 
         try {
-            partyGroup = delegator.findOne("PartyGroup", UtilMisc.toMap("partyId", partyId), false);
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne();
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -551,7 +552,7 @@ public class PartyServices {
         GenericValue party = null;
 
         try {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
         }
@@ -564,7 +565,7 @@ public class PartyServices {
         GenericValue affiliate = null;
 
         try {
-            affiliate = delegator.findOne("Affiliate", UtilMisc.toMap("partyId", partyId), false);
+            affiliate = EntityQuery.use(delegator).from("Affiliate").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
         }
@@ -611,7 +612,7 @@ public class PartyServices {
         GenericValue affiliate = null;
 
         try {
-            affiliate = delegator.findOne("Affiliate", UtilMisc.toMap("partyId", partyId), false);
+            affiliate = EntityQuery.use(delegator).from("Affiliate").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
@@ -657,7 +658,7 @@ public class PartyServices {
         //Make sure the note Id actually exists if one is passed to avoid a foreign key error below
         if (noteId != null) {
             try {
-                GenericValue value = delegator.findOne("NoteData", UtilMisc.toMap("noteId", noteId), false);
+                GenericValue value = EntityQuery.use(delegator).from("NoteData").where("noteId", noteId).queryOne();
                 if (value == null) {
                     Debug.logError("ERROR: Note id does not exist for : " + noteId + ", autogenerating." , module);
                     noteId = null;
@@ -925,7 +926,7 @@ public class PartyServices {
         GenericValue person = null;
 
         try {
-            person = delegator.findOne("Person", UtilMisc.toMap("partyId", partyId), true);
+            person = EntityQuery.use(delegator).from("Person").where("partyId", partyId).cache().queryOne();
         } catch (GenericEntityException e) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
                     "partyservices.cannot_get_party_entities_read",
@@ -972,8 +973,8 @@ public class PartyServices {
 
         try {
             // validate the existance of party and dataSource
-            GenericValue party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
-            GenericValue dataSource = delegator.findOne("DataSource", UtilMisc.toMap("dataSourceId", dataSourceId), false);
+            GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
+            GenericValue dataSource = EntityQuery.use(delegator).from("DataSource").where("dataSourceId", dataSourceId).queryOne();
             if (party == null || dataSource == null) {
                 List<String> errorList = UtilMisc.toList(UtilProperties.getMessage(resource,
                         "PartyCannotCreatePartyDataSource", locale));
@@ -1025,7 +1026,7 @@ public class PartyServices {
         try {
             roleTypeId = (String) context.get("roleTypeId");
             if (UtilValidate.isNotEmpty(roleTypeId)) {
-                GenericValue currentRole = delegator.findOne("RoleType", UtilMisc.toMap("roleTypeId", roleTypeId), true);
+                GenericValue currentRole = EntityQuery.use(delegator).from("RoleType").where("roleTypeId", roleTypeId).cache().queryOne();
                 result.put("currentRole", currentRole);
             }
         } catch (GenericEntityException e) {
@@ -1053,7 +1054,7 @@ public class PartyServices {
         try {
             partyTypeId = (String) context.get("partyTypeId");
             if (UtilValidate.isNotEmpty(partyTypeId)) {
-                GenericValue currentPartyType = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", partyTypeId), true);
+                GenericValue currentPartyType = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", partyTypeId).cache().queryOne();
                 result.put("currentPartyType", currentPartyType);
             }
         } catch (GenericEntityException e) {
@@ -1069,7 +1070,7 @@ public class PartyServices {
         try {
             stateProvinceGeoId = (String) context.get("stateProvinceGeoId");
             if (UtilValidate.isNotEmpty(stateProvinceGeoId)) {
-                GenericValue currentStateGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", stateProvinceGeoId), true);
+                GenericValue currentStateGeo = EntityQuery.use(delegator).from("Geo").where("geoId", stateProvinceGeoId).cache().queryOne();
                 result.put("currentStateGeo", currentStateGeo);
             }
         } catch (GenericEntityException e) {
@@ -1521,7 +1522,7 @@ public class PartyServices {
         // get the from/to party records
         GenericValue partyTo;
         try {
-            partyTo = delegator.findOne("Party", UtilMisc.toMap("partyId", partyIdTo), false);
+            partyTo = EntityQuery.use(delegator).from("Party").where("partyId", partyIdTo).queryOne();
         } catch (GenericEntityException e) {
             Debug.logInfo(e, module);
             return ServiceUtil.returnError(e.getMessage());
@@ -1537,7 +1538,7 @@ public class PartyServices {
 
         GenericValue party;
         try {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logInfo(e, module);
             return ServiceUtil.returnError(e.getMessage());
@@ -1929,12 +1930,12 @@ public class PartyServices {
                     }
 
                     if (UtilValidate.isNotEmpty(rec.get("contactMechTypeId")) &&
-                            delegator.findOne("ContactMechType", true, UtilMisc.toMap("contactMechTypeId", rec.get("contactMechTypeId"))) == null) {
+                            EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", rec.get("contactMechTypeId")).cache().queryOne() == null) {
                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + " contactMechTypeId code not found for: " + rec.get("contactMechTypeId"));
                     }
                     
                     if (UtilValidate.isNotEmpty(rec.get("contactMechPurposeTypeId")) &&
-                            delegator.findOne("ContactMechPurposeType", true, UtilMisc.toMap("contactMechPurposeTypeId", rec.get("contactMechPurposeTypeId"))) == null) {
+                            EntityQuery.use(delegator).from("ContactMechPurposeType").where("contactMechPurposeTypeId", rec.get("contactMechPurposeTypeId")).cache().queryOne() == null) {
                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + "contactMechPurposeTypeId code not found for: " + rec.get("contactMechPurposeTypeId"));
                     }
                     

Modified: ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java?rev=1635399&r1=1635398&r2=1635399&view=diff
==============================================================================
--- ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java (original)
+++ ofbiz/branches/json-integration-refactoring/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java Thu Oct 30 06:10:58 2014
@@ -25,6 +25,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.EntityTypeUtil;
 
 /**
@@ -45,10 +46,10 @@ public class PartyTypeHelper {
         GenericValue partyType = null;
         GenericValue checkedTypeOfParty = null;
         try {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", partyId), false);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
             if (UtilValidate.isNotEmpty(party)) {
                 partyType = party.getRelatedOne("PartyType", true);
-                checkedTypeOfParty = delegator.findOne("PartyType", UtilMisc.toMap("partyTypeId", checkedPartyType), true);
+                checkedTypeOfParty = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", checkedPartyType).cache().queryOne();
             } else {
                 return false;
             }