Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/imagemanagement/WatermarkImage.java
 Thu Oct 30 04:18:05 2014
@@ -48,6 +48,7 @@ import org.ofbiz.base.util.string.Flexib
 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;
@@ -280,7 +281,7 @@ public class WatermarkImage{
         
         GenericValue content = null;
         try {
-            content = delegator.findOne("Content", UtilMisc.toMap("contentId", 
contentId), false);
+            content = 
EntityQuery.use(delegator).from("Content").where("contentId", 
contentId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
 Thu Oct 30 04:18:05 2014
@@ -46,6 +46,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.model.DynamicViewEntity;
 import org.ofbiz.entity.model.ModelKeyMap;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityTypeUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -73,7 +74,7 @@ public class InventoryServices {
         Locale locale = (Locale) context.get("locale");
 
         try {
-            inventoryItem = delegator.findOne("InventoryItem", 
UtilMisc.toMap("inventoryItemId", inventoryItemId), false);
+            inventoryItem = 
EntityQuery.use(delegator).from("InventoryItem").where("inventoryItemId", 
inventoryItemId).queryOne();
         } catch (GenericEntityException e) {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
                     "ProductNotFindInventoryItemWithId", locale) + 
inventoryItemId);
@@ -875,7 +876,7 @@ public class InventoryServices {
         Map<String, String> contextInput = UtilMisc.toMap("productId", 
productId, "facilityId", facilityId, "statusId", statusId);
         GenericValue product = null;
         try {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", 
productId), false);
+            product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
         } catch (GenericEntityException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java 
(original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java 
Thu Oct 30 04:18:05 2014
@@ -41,6 +41,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.product.product.ProductWorker;
@@ -109,7 +110,7 @@ public class PriceServices {
         GenericValue productStore = null;
         try {
             // we have a productStoreId, if the corresponding 
ProductStore.primaryStoreGroupId is not empty, use that
-            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 getting product store info from the 
database while calculating price" + e.toString(), module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
@@ -277,7 +278,7 @@ public class PriceServices {
                             BigDecimal curDefaultPrice = 
curDefaultPriceValue.getBigDecimal("price");
                             if (minDefaultPrice == null || 
curDefaultPrice.compareTo(minDefaultPrice) < 0) {
                                 // check to see if the product is discontinued 
for sale before considering it the lowest price
-                                GenericValue curVariantProduct = 
delegator.findOne("Product", UtilMisc.toMap("productId", curVariantProductId), 
true);
+                                GenericValue curVariantProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
curVariantProductId).cache().queryOne();
                                 if (curVariantProduct != null) {
                                     Timestamp salesDiscontinuationDate = 
curVariantProduct.getTimestamp("salesDiscontinuationDate");
                                     if (salesDiscontinuationDate == null || 
salesDiscontinuationDate.after(nowTimestamp)) {
@@ -769,7 +770,7 @@ public class PriceServices {
 
             productPriceRules = FastList.newInstance();
             for (String productPriceRuleId: productPriceRuleIds) {
-                GenericValue productPriceRule = 
delegator.findOne("ProductPriceRule", UtilMisc.toMap("productPriceRuleId", 
productPriceRuleId), true);
+                GenericValue productPriceRule = 
EntityQuery.use(delegator).from("ProductPriceRule").where("productPriceRuleId", 
productPriceRuleId).cache().queryOne();
                 if (productPriceRule == null) continue;
                 productPriceRules.add(productPriceRule);
             }

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java
 Thu Oct 30 04:18:05 2014
@@ -43,6 +43,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.LocalDispatcher;
 
@@ -152,7 +153,7 @@ public class ProductContentWrapper imple
         String candidateFieldName = 
ModelUtil.dbNameToVarName(productContentTypeId);
         ModelEntity productModel = delegator.getModelEntity("Product");
         if (product == null) {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", 
productId), true);
+            product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).cache().queryOne();
         }
         if (UtilValidate.isEmpty(product)) {
             Debug.logWarning("No Product entity found for productId: " + 
productId, module);

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
 Thu Oct 30 04:18:05 2014
@@ -52,6 +52,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.security.Security;
@@ -230,11 +231,11 @@ public class ProductEvents {
         Timestamp fromDate = null;
 
         try {
-            if (delegator.findOne("Product", UtilMisc.toMap("productId", 
productId), false) == null) {
+            if (EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne() == null) {
                 Map<String, String> messageMap = UtilMisc.toMap("productId", 
productId);
                 
errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_with_id_not_found",
 messageMap, UtilHttp.getLocale(request)));
             }
-            if (delegator.findOne("Product", UtilMisc.toMap("productId", 
productIdTo), false) == null) {
+            if (EntityQuery.use(delegator).from("Product").where("productId", 
productIdTo).queryOne() == null) {
                 Map<String, String> messageMap = UtilMisc.toMap("productIdTo", 
productIdTo);
                 
errMsgList.add(UtilProperties.getMessage(resource,"productevents.product_To_with_id_not_found",
 messageMap, UtilHttp.getLocale(request)));
             }
@@ -433,7 +434,7 @@ public class ProductEvents {
                 if (variantProductId == null) {
                     // only single product to update
                     String productId = request.getParameter("productId");
-                    GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+                    GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
                     product.set("lastModifiedDate", nowTimestamp);
                     product.setString("lastModifiedByUserLogin", 
userLogin.getString("userLoginId"));
                     try {
@@ -472,7 +473,7 @@ public class ProductEvents {
                     int attribIdx = 0;
                     String productId = variantProductId;
                     do {
-                        GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+                        GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
                         try {
                             product.set("productHeight", 
parseBigDecimalForEntity(request.getParameter("productHeight" + attribIdx)));
                             product.set("productWidth", 
parseBigDecimalForEntity(request.getParameter("productWidth" + attribIdx)));
@@ -533,8 +534,8 @@ public class ProductEvents {
     private static void setOrCreateProdFeature(Delegator delegator, String 
productId, List<GenericValue> currentProductFeatureAndAppls,
                                           String uomId, String 
productFeatureTypeId, BigDecimal numberSpecified) throws GenericEntityException 
{
 
-        GenericValue productFeatureType = 
delegator.findOne("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", 
productFeatureTypeId), false);
-        GenericValue uom = delegator.findOne("Uom", UtilMisc.toMap("uomId", 
uomId), false);
+        GenericValue productFeatureType = 
EntityQuery.use(delegator).from("ProductFeatureType").where("productFeatureTypeId",
 productFeatureTypeId).queryOne();
+        GenericValue uom = 
EntityQuery.use(delegator).from("Uom").where("uomId", uomId).queryOne();
 
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
 
@@ -572,7 +573,7 @@ public class ProductEvents {
 
                 // if there is a productFeatureCategory with the same id as 
the productFeatureType, use that category.
                 // otherwise, use a default category from the configuration
-                if (delegator.findOne("ProductFeatureCategory", 
UtilMisc.toMap("productFeatureCategoryId", productFeatureTypeId), false) == 
null) {
+                if 
(EntityQuery.use(delegator).from("ProductFeatureCategory").where("productFeatureCategoryId",
 productFeatureTypeId).queryOne() == null) {
                     GenericValue productFeatureCategory = 
delegator.makeValue("ProductFeatureCategory");
                     productFeatureCategory.set("productFeatureCategoryId", 
productFeatureTypeId);
                     productFeatureCategory.set("description", 
productFeatureType.get("description"));
@@ -605,7 +606,7 @@ public class ProductEvents {
         try {
             boolean beganTransaction = TransactionUtil.begin();
             try {
-                GenericValue productFeatureType = 
delegator.findOne("ProductFeatureType", UtilMisc.toMap("productFeatureTypeId", 
productFeatureTypeId), false);
+                GenericValue productFeatureType = 
EntityQuery.use(delegator).from("ProductFeatureType").where("productFeatureTypeId",
 productFeatureTypeId).queryOne();
                 if (productFeatureType == null) {
                     String errMsg = "Error: the ProductFeature Type specified 
was not valid and one is require to add or update variant features.";
                     request.setAttribute("_ERROR_MESSAGE_", errMsg);
@@ -616,9 +617,9 @@ public class ProductEvents {
                 if (variantProductId != null) {
                     // multiple products, so use a numeric suffix to get them 
all
                     int attribIdx = 0;
-                    GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+                    GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
                     do {
-                        GenericValue variantProduct = 
delegator.findOne("Product", UtilMisc.toMap("productId", variantProductId), 
false);
+                        GenericValue variantProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
variantProductId).queryOne();
                         String description = 
request.getParameter("description" + attribIdx);
                         // blank means null, which means delete the feature 
application
                         if ((description != null) && 
(description.trim().length() < 1)) {
@@ -736,7 +737,7 @@ public class ProductEvents {
 
                 // if there is a productFeatureCategory with the same id as 
the productFeatureType, use that category.
                 // otherwise, create a category for the feature type
-                if (delegator.findOne("ProductFeatureCategory", 
UtilMisc.toMap("productFeatureCategoryId", productFeatureTypeId), false) == 
null) {
+                if 
(EntityQuery.use(delegator).from("ProductFeatureCategory").where("productFeatureCategoryId",
 productFeatureTypeId).queryOne() == null) {
                     GenericValue productFeatureCategory = 
delegator.makeValue("ProductFeatureCategory");
                     productFeatureCategory.set("productFeatureCategoryId", 
productFeatureTypeId);
                     productFeatureCategory.set("description", 
productFeatureType.get("description"));
@@ -768,7 +769,7 @@ public class ProductEvents {
         String productFeatureTypeId = 
request.getParameter("productFeatureTypeId");
 
         try {
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
             // get all the variants
             List<GenericValue> variantAssocs = 
product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", 
"PRODUCT_VARIANT"), null, false);
             variantAssocs = EntityUtil.filterByDate(variantAssocs);
@@ -1194,7 +1195,7 @@ public class ProductEvents {
             
             GenericValue userLogin = null;
             try {
-                userLogin = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", "system"), true);
+                userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
"system").cache().queryOne();
             } catch (GenericEntityException e) {
                 request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
                 return "error";

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductPromoContentWrapper.java
 Thu Oct 30 04:18:05 2014
@@ -47,6 +47,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.LocalDispatcher;
 
@@ -157,7 +158,7 @@ public class ProductPromoContentWrapper 
         ModelEntity productModel = delegator.getModelEntity("ProductPromo");
         if (productModel.isField(candidateFieldName)) {
             if (UtilValidate.isEmpty(productPromo)) {
-                productPromo = delegator.findOne("ProductPromo", 
UtilMisc.toMap("productPromoId", productPromoId), true);
+                productPromo = 
EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", 
productPromoId).cache().queryOne();
             }
             if (UtilValidate.isNotEmpty(productPromo)) {
                 String candidateValue = 
productPromo.getString(candidateFieldName);

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
 Thu Oct 30 04:18:05 2014
@@ -56,6 +56,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;
 import org.ofbiz.party.party.PartyHelper;
 import org.ofbiz.product.category.CategoryContentWrapper;
@@ -888,7 +889,7 @@ public class ProductSearch {
         public String prettyPrintConstraint(Delegator delegator, boolean 
detailed, Locale locale) {
             GenericValue prodCatalog = null;
             try {
-                prodCatalog = delegator.findOne("ProdCatalog", 
UtilMisc.toMap("prodCatalogId", prodCatalogId), true);
+                prodCatalog = 
EntityQuery.use(delegator).from("ProdCatalog").where("prodCatalogId", 
prodCatalogId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error finding ProdCatalog information for 
constraint pretty print", module);
             }
@@ -969,7 +970,7 @@ public class ProductSearch {
         public String prettyPrintConstraint(Delegator delegator, boolean 
detailed, Locale locale) {
             GenericValue productCategory = null;
             try {
-                productCategory = delegator.findOne("ProductCategory", 
UtilMisc.toMap("productCategoryId", productCategoryId), true);
+                productCategory = 
EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", 
productCategoryId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error finding ProductCategory information 
for constraint pretty print", module);
             }
@@ -1054,7 +1055,7 @@ public class ProductSearch {
             GenericValue productFeature = null;
             GenericValue productFeatureType = null;
             try {
-                productFeature = delegator.findOne("ProductFeature", 
UtilMisc.toMap("productFeatureId", productFeatureId), true);
+                productFeature = 
EntityQuery.use(delegator).from("ProductFeature").where("productFeatureId", 
productFeatureId).cache().queryOne();
                 productFeatureType = productFeature == null ? null : 
productFeature.getRelatedOne("ProductFeatureType", false);
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error finding ProductFeature and Type 
information for constraint pretty print", module);
@@ -1136,7 +1137,7 @@ public class ProductSearch {
         public String prettyPrintConstraint(Delegator delegator, boolean 
detailed, Locale locale) {
             GenericValue productFeatureCategory = null;
             try {
-                productFeatureCategory = 
delegator.findOne("ProductFeatureCategory", 
UtilMisc.toMap("productFeatureCategoryId", productFeatureCategoryId), true);
+                productFeatureCategory = 
EntityQuery.use(delegator).from("ProductFeatureCategory").where("productFeatureCategoryId",
 productFeatureCategoryId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error finding ProductFeatureCategory and 
Type information for constraint pretty print", module);
             }
@@ -1217,7 +1218,7 @@ public class ProductSearch {
         public String prettyPrintConstraint(Delegator delegator, boolean 
detailed, Locale locale) {
             GenericValue productFeatureGroup = null;
             try {
-                productFeatureGroup = delegator.findOne("ProductFeatureGroup", 
UtilMisc.toMap("productFeatureGroupId", productFeatureGroupId), true);
+                productFeatureGroup = 
EntityQuery.use(delegator).from("ProductFeatureGroup").where("productFeatureGroupId",
 productFeatureGroupId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error finding ProductFeatureGroup and Type 
information for constraint pretty print", module);
             }
@@ -1311,7 +1312,7 @@ public class ProductSearch {
                     if (infoOut.length() > 0) {
                         infoOut.append(", ");
                     }
-                    GenericValue productFeature = 
delegator.findOne("ProductFeature", UtilMisc.toMap("productFeatureId", 
featureId), true);
+                    GenericValue productFeature = 
EntityQuery.use(delegator).from("ProductFeature").where("productFeatureId", 
featureId).cache().queryOne();
                     GenericValue productFeatureType = productFeature == null ? 
null : productFeature.getRelatedOne("ProductFeatureType", true);
                     if (productFeatureType == null) {
                         infoOut.append(UtilProperties.getMessage(resource, 
"ProductFeature", locale)).append(": ");

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
 Thu Oct 30 04:18:05 2014
@@ -54,6 +54,7 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityJoinOperator;
 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.product.catalog.CatalogWorker;
@@ -123,7 +124,7 @@ public class ProductServices {
             }
             if (variantFound) {
                 try {
-                    products.add(delegator.findOne("Product", 
UtilMisc.toMap("productId", oneVariant.getString("productIdTo")), false));
+                    
products.add(EntityQuery.use(delegator).from("Product").where("productId", 
oneVariant.getString("productIdTo")).queryOne());
                 } catch (GenericEntityException e) {
                     Map<String, String> messageMap = 
UtilMisc.toMap("errProductFeatures", e.toString());
                     String errMsg = 
UtilProperties.getMessage(resourceError,"productservices.problem_reading_product_features_errors",
 messageMap, locale);
@@ -226,7 +227,7 @@ public class ProductServices {
             GenericValue productTo = null;
 
             try {
-                productTo = delegator.findOne("Product", 
UtilMisc.toMap("productId", productIdTo), true);
+                productTo = 
EntityQuery.use(delegator).from("Product").where("productId", 
productIdTo).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
                 Map<String, String> messageMap = UtilMisc.toMap("productIdTo", 
productIdTo, "errMessage", e.toString());
@@ -410,7 +411,7 @@ public class ProductServices {
         }
 
         try {
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), true);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).cache().queryOne();
             GenericValue mainProduct = product;
 
             if (product.get("isVariant") != null && 
product.getString("isVariant").equalsIgnoreCase("Y")) {
@@ -482,7 +483,7 @@ public class ProductServices {
         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) {
             Map<String, String> messageMap = UtilMisc.toMap("errMessage", 
e.getMessage());
             errMsg = UtilProperties.getMessage(resourceError, 
@@ -704,7 +705,7 @@ public class ProductServices {
 
         try {
             // read the product, duplicate it with the given id
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
             if (product == null) {
                 Map<String, String> messageMap = UtilMisc.toMap("productId", 
productId);
                 errMsg = UtilProperties.getMessage(resourceError, 
@@ -756,7 +757,7 @@ public class ProductServices {
             while (st.hasMoreTokens()) {
                 String productFeatureId = st.nextToken();
 
-                GenericValue productFeature = 
delegator.findOne("ProductFeature", UtilMisc.toMap("productFeatureId", 
productFeatureId), false);
+                GenericValue productFeature = 
EntityQuery.use(delegator).from("ProductFeature").where("productFeatureId", 
productFeatureId).queryOne();
 
                 GenericValue productFeatureAppl = 
delegator.makeValue("ProductFeatureAppl",
                 UtilMisc.toMap("productId", variantProductId, 
"productFeatureId", productFeatureId,
@@ -841,7 +842,7 @@ public class ProductServices {
                     continue;
                 }
                 // is a Product.productId?
-                GenericValue variantProduct = delegator.findOne("Product", 
UtilMisc.toMap("productId", variantProductId), false);
+                GenericValue variantProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
variantProductId).queryOne();
                 if (variantProduct != null) {
                     variantProductsById.put(variantProductId, variantProduct);
                 } else {
@@ -917,7 +918,7 @@ public class ProductServices {
 
             GenericValue inventoryItem = null;
             try {
-                inventoryItem = delegator.findOne("InventoryItem", 
UtilMisc.toMap("inventoryItemId", inventoryItemId), true);
+                inventoryItem = 
EntityQuery.use(delegator).from("InventoryItem").where("inventoryItemId", 
inventoryItemId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
@@ -927,7 +928,7 @@ public class ProductServices {
                 String productId = inventoryItem.getString("productId");
                 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.logError(e, module);
                     return ServiceUtil.returnError(e.getMessage());
@@ -1137,7 +1138,7 @@ public class ProductServices {
             if (UtilValidate.isNotEmpty(contentId)) {
                 GenericValue content = null;
                 try {
-                    content = delegator.findOne("Content", 
UtilMisc.toMap("contentId", contentId), false);
+                    content = 
EntityQuery.use(delegator).from("Content").where("contentId", 
contentId).queryOne();
                 } catch (GenericEntityException e) {
                     Debug.logError(e, module);
                     return ServiceUtil.returnError(e.getMessage());
@@ -1343,7 +1344,7 @@ public class ProductServices {
                 if (UtilValidate.isNotEmpty(contentId)) {
                     GenericValue content = null;
                     try {
-                        content = delegator.findOne("Content", 
UtilMisc.toMap("contentId", contentId), false);
+                        content = 
EntityQuery.use(delegator).from("Content").where("contentId", 
contentId).queryOne();
                     } catch (GenericEntityException e) {
                         Debug.logError(e, module);
                         return ServiceUtil.returnError(e.getMessage());

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
 Thu Oct 30 04:18:05 2014
@@ -44,6 +44,7 @@ import org.ofbiz.entity.model.DynamicVie
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelKeyMap;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.service.DispatchContext;
@@ -78,7 +79,7 @@ public class ProductUtilServices {
             int numSoFarOne = 0;
             while ((productOne = eliOne.next()) != null) {
                 String virtualProductId = 
ProductWorker.getVariantVirtualId(productOne);
-                GenericValue virtualProduct = delegator.findOne("Product", 
UtilMisc.toMap("productId", virtualProductId), false);
+                GenericValue virtualProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
virtualProductId).queryOne();
                 if (virtualProduct == null) {
                     continue;
                 }
@@ -345,7 +346,7 @@ public class ProductUtilServices {
         }
 
         try {
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
             Debug.logInfo("Processing virtual product with one variant with 
ID: " + productId + " and name: " + product.getString("internalName"), module);
 
             List<GenericValue> paList = 
EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc", 
UtilMisc.toMap("productId", productId, "productAssocTypeId", 
"PRODUCT_VARIANT"), null, false));
@@ -383,7 +384,7 @@ public class ProductUtilServices {
             String variantProductId = productAssoc.getString("productIdTo");
 
             // Product
-            GenericValue variantProduct = delegator.findOne("Product", 
UtilMisc.toMap("productId", variantProductId), false);
+            GenericValue variantProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
variantProductId).queryOne();
 
             Debug.logInfo("--variant has ID: " + variantProductId + " and 
name: " + variantProduct.getString("internalName"), module);
 
@@ -701,7 +702,7 @@ while (allCatIter.hasNext()) {
                 productFeatureGroupId = productFeatureGroupId.substring(0, 20);
             }
 
-            GenericValue productFeatureGroup = 
delegator.findOne("ProductFeatureGroup", 
UtilMisc.toMap("productFeatureGroupId", productFeatureGroupId), false);
+            GenericValue productFeatureGroup = 
EntityQuery.use(delegator).from("ProductFeatureGroup").where("productFeatureGroupId",
 productFeatureGroupId).queryOne();
             if (productFeatureGroup == null) {
                 // auto-create the group
                 String description = "Feature Group for type [" + 
productFeatureTypeId + "] features in category [" + productCategoryId + "]";

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
 Thu Oct 30 04:18:05 2014
@@ -43,6 +43,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.EntityTypeUtil;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.product.config.ProductConfigWrapper;
@@ -149,7 +150,7 @@ public class ProductWorker {
     }
 
     public static String getInstanceAggregatedId(Delegator delegator, String 
instanceProductId) throws GenericEntityException {
-        GenericValue instanceProduct = delegator.findOne("Product", 
UtilMisc.toMap("productId", instanceProductId), false);
+        GenericValue instanceProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
instanceProductId).queryOne();
 
         if (UtilValidate.isNotEmpty(instanceProduct) && 
EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", 
instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) {
             GenericValue productAssoc = 
EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelated("AssocProductAssoc",
 UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false)));
@@ -174,7 +175,7 @@ public class ProductWorker {
     }
 
     public static List<GenericValue> getAggregatedAssocs(Delegator delegator, 
String  aggregatedProductId) throws GenericEntityException {
-        GenericValue aggregatedProduct = delegator.findOne("Product", 
UtilMisc.toMap("productId", aggregatedProductId), false);
+        GenericValue aggregatedProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
aggregatedProductId).queryOne();
 
         if (UtilValidate.isNotEmpty(aggregatedProduct) && 
("AGGREGATED".equals(aggregatedProduct.getString("productTypeId")) || 
"AGGREGATED_SERVICE".equals(aggregatedProduct.getString("productTypeId")))) {
             List<GenericValue> productAssocs = 
EntityUtil.filterByDate(aggregatedProduct.getRelated("MainProductAssoc", 
UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false));
@@ -317,7 +318,7 @@ public class ProductWorker {
      */
     public static String getGwpAlternativeOptionName(LocalDispatcher 
dispatcher, Delegator delegator, String alternativeOptionProductId, Locale 
locale) {
         try {
-            GenericValue alternativeOptionProduct = 
delegator.findOne("Product", UtilMisc.toMap("productId", 
alternativeOptionProductId), true);
+            GenericValue alternativeOptionProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
alternativeOptionProductId).cache().queryOne();
             if (alternativeOptionProduct != null) {
                 if 
("Y".equals(alternativeOptionProduct.getString("isVariant"))) {
                     Set<GenericValue> distFeatures = 
getVariantDistinguishingFeatures(alternativeOptionProduct);
@@ -366,7 +367,7 @@ public class ProductWorker {
             return null;
         }
         try {
-            return getProductFeaturesByApplTypeId(delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false),
+            return 
getProductFeaturesByApplTypeId(EntityQuery.use(delegator).from("Product").where("productId",
 productId).queryOne(),
                     productFeatureApplTypeId);
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
@@ -402,7 +403,7 @@ public class ProductWorker {
     public static String getProductVirtualVariantMethod(Delegator delegator, 
String productId) {
         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.logError(e, module);
         }
@@ -596,7 +597,7 @@ public class ProductWorker {
     public static BigDecimal getAverageProductRating(Delegator delegator, 
String productId, String productStoreId) {
         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.logError(e, module);
         }
@@ -678,7 +679,7 @@ public class ProductWorker {
     public static List<GenericValue> getCurrentProductCategories(Delegator 
delegator, String productId) {
         GenericValue product = null;
         try {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", 
productId), false);
+            product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -758,7 +759,7 @@ public class ProductWorker {
 
     public static boolean isVirtual(Delegator delegator, String productI) {
         try {
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productI), true);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productI).cache().queryOne();
             if (product != null) {
                 return "Y".equals(product.getString("isVirtual"));
             }
@@ -771,7 +772,7 @@ public class ProductWorker {
 
     public static boolean isAmountRequired(Delegator delegator, String 
productI) {
         try {
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productI), true);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productI).cache().queryOne();
             if (product != null) {
                 return "Y".equals(product.getString("requireAmount"));
             }
@@ -784,7 +785,7 @@ public class ProductWorker {
 
     public static String getProductTypeId(Delegator delegator, String 
productId) {
         try {
-            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) {
                 return product.getString("productTypeId");
             }
@@ -863,7 +864,7 @@ public class ProductWorker {
 
         // 1) look if the idToFind given is a real productId
         if (searchProductFirst) {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", 
idToFind), true);
+            product = 
EntityQuery.use(delegator).from("Product").where("productId", 
idToFind).cache().queryOne();
         }
 
         if (searchAllId || (searchProductFirst && 
UtilValidate.isEmpty(product))) {
@@ -876,7 +877,7 @@ public class ProductWorker {
         }
 
         if (! searchProductFirst) {
-            product = delegator.findOne("Product", UtilMisc.toMap("productId", 
idToFind), true);
+            product = 
EntityQuery.use(delegator).from("Product").where("productId", 
idToFind).cache().queryOne();
         }
 
         if (UtilValidate.isNotEmpty(product)) {
@@ -919,7 +920,7 @@ public class ProductWorker {
                 GenericValue productToAdd = product;
                 //retreive product GV if the actual genericValue came from 
viewEntity
                 if (! "Product".equals(product.getEntityName())) {
-                    productToAdd = delegator.findOne("Product", 
UtilMisc.toMap("productId", product.get("productId")), true);
+                    productToAdd = 
EntityQuery.use(delegator).from("Product").where("productId", 
product.get("productId")).cache().queryOne();
                 }
 
                 if (UtilValidate.isEmpty(products)) {
@@ -1055,7 +1056,7 @@ nextProd:
              */
             if (!productFound) {
                 // copy product to be variant
-                GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId",  productId), false);
+                GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId",  
productId).queryOne();
                 product.put("isVariant", "Y");
                 product.put("isVirtual", "N");
                 product.put("productId", delegator.getNextSeqId("Product"));
@@ -1197,7 +1198,7 @@ nextProd:
 
     public static boolean isAggregateService(Delegator delegator, String 
aggregatedProductId) {
         try {
-            GenericValue aggregatedProduct = delegator.findOne("Product", 
UtilMisc.toMap("productId", aggregatedProductId), true);
+            GenericValue aggregatedProduct = 
EntityQuery.use(delegator).from("Product").where("productId", 
aggregatedProductId).cache().queryOne();
             if (UtilValidate.isNotEmpty(aggregatedProduct) && 
"AGGREGATED_SERVICE".equals(aggregatedProduct.getString("productTypeId"))) {
                 return true;
             }

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/product/VariantEvents.java
 Thu Oct 30 04:18:05 2014
@@ -32,6 +32,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 
 import java.util.Map;
 
@@ -84,7 +85,7 @@ public class VariantEvents {
 
             try {
                 // read the product, duplicate it with the given id
-                GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), false);
+                GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).queryOne();
                 if (product == null) {
                     Map<String, String> messageMap = 
UtilMisc.toMap("productId", productId);
                     errMsg = 
UtilProperties.getMessage(resource,"variantevents.product_not_found_with_ID", 
messageMap, UtilHttp.getLocale(request));
@@ -130,7 +131,7 @@ public class VariantEvents {
                         return "error";
                     }
 
-                    GenericValue productFeature = 
delegator.findOne("ProductFeature", UtilMisc.toMap("productFeatureId", 
productFeatureId), false);
+                    GenericValue productFeature = 
EntityQuery.use(delegator).from("ProductFeature").where("productFeatureId", 
productFeatureId).queryOne();
 
                     GenericValue productFeatureAppl = 
delegator.makeValue("ProductFeatureAppl",
                             UtilMisc.toMap("productId", variantProductId, 
"productFeatureId", productFeatureId,

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java 
(original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java 
Thu Oct 30 04:18:05 2014
@@ -43,6 +43,7 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
@@ -92,7 +93,7 @@ public class PromoServices {
                 }
                 GenericValue existingPromoCode = null;
                 try {
-                    existingPromoCode = delegator.findOne("ProductPromoCode", 
UtilMisc.toMap("productPromoCodeId", newPromoCodeId), true);
+                    existingPromoCode = 
EntityQuery.use(delegator).from("ProductPromoCode").where("productPromoCodeId", 
newPromoCodeId).cache().queryOne();
                 }
                 catch (GenericEntityException e) {
                     Debug.logWarning("Could not find ProductPromoCode for just 
generated ID: " + newPromoCodeId, module);

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java 
(original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java 
Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java 
(original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/test/IssuanceTest.java 
Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
 Thu Oct 30 04:18:05 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/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
 Thu Oct 30 04:18:05 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) {


Reply via email to