Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
 Thu Oct 30 04:18:05 2014
@@ -55,6 +55,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.party.contact.ContactMechWorker;
@@ -122,11 +123,11 @@ public class UpsServices {
         String shipmentConfirmResponseString = null;
 
         try {
-            GenericValue shipment = delegator.findOne("Shipment", 
UtilMisc.toMap("shipmentId", shipmentId), false);
+            GenericValue shipment = 
EntityQuery.use(delegator).from("Shipment").where("shipmentId", 
shipmentId).queryOne();
             if (shipment == null) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"ProductShipmentNotFoundId", locale) + " " + shipmentId);
             }
-            GenericValue shipmentRouteSegment = 
delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false);
+            GenericValue shipmentRouteSegment = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne();
             if (shipmentRouteSegment == null) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"ProductShipmentRouteSegmentNotFound", 
                         UtilMisc.toMap("shipmentId", shipmentId, 
"shipmentRouteSegmentId", shipmentRouteSegmentId), locale));
@@ -846,8 +847,8 @@ public class UpsServices {
         String shipmentAcceptResponseString = null;
 
         try {
-            //GenericValue shipment = delegator.findOne("Shipment", 
UtilMisc.toMap("shipmentId", shipmentId), false);
-            GenericValue shipmentRouteSegment = 
delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false);
+            //GenericValue shipment = 
EntityQuery.use(delegator).from("Shipment").where("shipmentId", 
shipmentId).queryOne();
+            GenericValue shipmentRouteSegment = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne();
 
             if 
(!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"FacilityShipmentUpsNotRouteSegmentCarrier", 
UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", 
shipmentId), locale));
@@ -1283,8 +1284,8 @@ public class UpsServices {
         String voidShipmentResponseString = null;
 
         try {
-            //GenericValue shipment = delegator.findOne("Shipment", 
UtilMisc.toMap("shipmentId", shipmentId), false);
-            GenericValue shipmentRouteSegment = 
delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false);
+            //GenericValue shipment = 
EntityQuery.use(delegator).from("Shipment").where("shipmentId", 
shipmentId).queryOne();
+            GenericValue shipmentRouteSegment = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne();
 
             if 
(!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"FacilityShipmentUpsNotRouteSegmentCarrier", 
UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", 
shipmentId), locale));
@@ -1488,8 +1489,8 @@ public class UpsServices {
         String trackResponseString = null;
 
         try {
-            //GenericValue shipment = delegator.findOne("Shipment", 
UtilMisc.toMap("shipmentId", shipmentId), false);
-            GenericValue shipmentRouteSegment = 
delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false);
+            //GenericValue shipment = 
EntityQuery.use(delegator).from("Shipment").where("shipmentId", 
shipmentId).queryOne();
+            GenericValue shipmentRouteSegment = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne();
 
             if 
(!"UPS".equals(shipmentRouteSegment.getString("carrierPartyId"))) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"FacilityShipmentUpsNotRouteSegmentCarrier", 
UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", 
shipmentId), locale));
@@ -1716,7 +1717,7 @@ public class UpsServices {
         GenericValue shipToAddress = null;
         if (shippingContactMechId != null) {
             try {
-                shipToAddress = delegator.findOne("PostalAddress", 
UtilMisc.toMap("contactMechId", shippingContactMechId), false);
+                shipToAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
shippingContactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }
@@ -1729,7 +1730,7 @@ public class UpsServices {
         GenericValue shipFromAddress = null;
         if (shippingOriginContactMechId != null) {
             try {
-                shipFromAddress = delegator.findOne("PostalAddress", 
UtilMisc.toMap("contactMechId", shippingOriginContactMechId), false);
+                shipFromAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
shippingOriginContactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"FacilityShipmentUnableFoundShipToAddresssForDropShipping", locale));
@@ -2060,7 +2061,7 @@ public class UpsServices {
                 GenericValue facilityContactMech = 
ContactMechWorker.getFacilityContactMechByPurpose(delegator, 
productStore.getString("inventoryFacilityId"), 
UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION"));
                 if (facilityContactMech != null) {
                     try {
-                        shipFromAddress = delegator.findOne("PostalAddress", 
UtilMisc.toMap("contactMechId", 
facilityContactMech.getString("contactMechId")), false);
+                        shipFromAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
facilityContactMech.getString("contactMechId")).queryOne();
                     } catch (GenericEntityException e) {
                         Debug.logError(e, module);
                     }
@@ -2411,11 +2412,11 @@ public class UpsServices {
         String shipmentConfirmResponseString = null;
 
         try {
-            GenericValue shipment = delegator.findOne("Shipment", 
UtilMisc.toMap("shipmentId", shipmentId), false);
+            GenericValue shipment = 
EntityQuery.use(delegator).from("Shipment").where("shipmentId", 
shipmentId).queryOne();
             if (shipment == null) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"ProductShipmentNotFoundId", locale) + " " + shipmentId);
             }
-            GenericValue shipmentRouteSegment = 
delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), false);
+            GenericValue shipmentRouteSegment = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId).queryOne();
             if (shipmentRouteSegment == null) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
"ProductShipmentRouteSegmentNotFound", 
                         UtilMisc.toMap("shipmentId", shipmentId, 
"shipmentRouteSegmentId", shipmentRouteSegmentId), locale));
@@ -3184,7 +3185,7 @@ public class UpsServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) {
             try {
-                GenericValue ups = delegator.findOne("ShipmentGatewayUps", 
UtilMisc.toMap("shipmentGatewayConfigId", shipmentGatewayConfigId), false);
+                GenericValue ups = 
EntityQuery.use(delegator).from("ShipmentGatewayUps").where("shipmentGatewayConfigId",
 shipmentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(ups)) {
                     Object upsField = 
ups.get(shipmentGatewayConfigParameterName);
                     if (upsField != null) {

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
 Thu Oct 30 04:18:05 2014
@@ -53,6 +53,7 @@ import org.ofbiz.common.uom.UomWorker;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.party.contact.ContactMechWorker;
 import org.ofbiz.product.product.ProductWorker;
@@ -125,7 +126,7 @@ public class UspsServices {
         String shippingContactMechId = (String) 
context.get("shippingContactMechId");
         if (UtilValidate.isNotEmpty(shippingContactMechId)) {
             try {
-                GenericValue shipToAddress = 
delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", 
shippingContactMechId), false);
+                GenericValue shipToAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
shippingContactMechId).queryOne();
                 if (shipToAddress != null) {
                     if 
(!domesticCountries.contains(shipToAddress.getString("countryGeoId"))) {
                         return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -292,7 +293,7 @@ public class UspsServices {
         String shippingContactMechId = (String) 
context.get("shippingContactMechId");
         if (UtilValidate.isNotEmpty(shippingContactMechId)) {
             try {
-                GenericValue shipToAddress = 
delegator.findOne("PostalAddress", UtilMisc.toMap("contactMechId", 
shippingContactMechId), false);
+                GenericValue shipToAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
shippingContactMechId).queryOne();
                 if 
(domesticCountries.contains(shipToAddress.get("countryGeoId"))) {
                     return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                             
"FacilityShipmentUspsRateInternationCannotBeUsedForUsDestinations", locale));
@@ -1234,7 +1235,7 @@ public class UspsServices {
         }
 
         try {
-            GenericValue shipment = delegator.findOne("Shipment", 
UtilMisc.toMap("shipmentId", shipmentId), false);
+            GenericValue shipment = 
EntityQuery.use(delegator).from("Shipment").where("shipmentId", 
shipmentId).queryOne();
             if (shipment == null) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                         "ProductShipmentNotFoundId", locale) + shipmentId);
@@ -1782,7 +1783,7 @@ public class UspsServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) {
             try {
-                GenericValue usps = delegator.findOne("ShipmentGatewayUsps", 
UtilMisc.toMap("shipmentGatewayConfigId", shipmentGatewayConfigId), false);
+                GenericValue usps = 
EntityQuery.use(delegator).from("ShipmentGatewayUsps").where("shipmentGatewayConfigId",
 shipmentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(usps)) {
                     Object uspsField = 
usps.get(shipmentGatewayConfigParameterName);
                     if (uspsField != null) {

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
 Thu Oct 30 04:18:05 2014
@@ -36,6 +36,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceContainer;
@@ -402,7 +403,7 @@ public class VerifyPickSession implement
         if 
(UtilValidate.isNotEmpty(orderItemShipGroup.getString("vendorPartyId"))) {
             partyIdFrom = orderItemShipGroup.getString("vendorPartyId");
         } else if 
(UtilValidate.isNotEmpty(orderItemShipGroup.getString("facilityId"))) {
-            GenericValue facility = delegator.findOne("Facility", 
UtilMisc.toMap("facilityId", orderItemShipGroup.getString("facilityId")), 
false);
+            GenericValue facility = 
EntityQuery.use(delegator).from("Facility").where("facilityId", 
orderItemShipGroup.getString("facilityId")).queryOne();
             if (UtilValidate.isNotEmpty(facility.getString("ownerPartyId"))) {
                 partyIdFrom = facility.getString("ownerPartyId");
             }

Modified: 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
 (original)
+++ 
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
 Thu Oct 30 04:18:05 2014
@@ -38,6 +38,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceContainer;
 import org.ofbiz.service.ServiceUtil;
@@ -363,7 +364,7 @@ public class WeightPackageSession implem
                 if (ServiceUtil.isError(shipmentRouteSegmentResult)) {
                     throw new 
GeneralException(ServiceUtil.getErrorMessage(shipmentRouteSegmentResult));
                 }
-                GenericValue shipRouteSeg = 
delegator.findOne("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", 
shipmentId, "shipmentRouteSegmentId", 
shipmentRouteSegment.getString("shipmentRouteSegmentId")), false);
+                GenericValue shipRouteSeg = 
EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", 
shipmentId, "shipmentRouteSegmentId", 
shipmentRouteSegment.getString("shipmentRouteSegmentId")).queryOne();
                 actualCost = 
actualCost.add(shipRouteSeg.getBigDecimal("actualCost"));
             }
         }

Modified: 
ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
 (original)
+++ 
ofbiz/trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
 Thu Oct 30 04:18:05 2014
@@ -43,6 +43,7 @@ import org.ofbiz.base.crypto.HashCrypt;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.party.contact.ContactHelper;
 import org.ofbiz.product.product.ProductEvents;
@@ -141,7 +142,7 @@ public class LoginEvents {
         GenericValue supposedUserLogin = null;
 
         try {
-            supposedUserLogin = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+            supposedUserLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
         } catch (GenericEntityException gee) {
             Debug.logWarning(gee, "", module);
         }
@@ -202,7 +203,7 @@ public class LoginEvents {
         String passwordToSend = null;
 
         try {
-            supposedUserLogin = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+            supposedUserLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
             if (supposedUserLogin == null) {
                 // the Username was not found
                 errMsg = UtilProperties.getMessage(resource, 
"loginevents.username_not_found_reenter", UtilHttp.getLocale(request));
@@ -291,7 +292,7 @@ public class LoginEvents {
         } else {
             GenericValue emailTemplateSetting = null;
             try {
-                emailTemplateSetting = 
delegator.findOne("EmailTemplateSetting", true, "emailTemplateSettingId", 
"EMAIL_PASSWORD");
+                emailTemplateSetting = 
EntityQuery.use(delegator).from("EmailTemplateSetting").where("emailTemplateSettingId",
 "EMAIL_PASSWORD").cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java
 Thu Oct 30 04:18:05 2014
@@ -29,6 +29,7 @@ import org.ofbiz.content.content.Content
 import org.ofbiz.content.content.ContentWorker;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.entity.model.ModelUtil;
 import org.ofbiz.entity.model.ModelEntity;
@@ -183,7 +184,7 @@ public class WorkEffortContentWrapper im
         if (delegator != null) {
             GenericValue contentType = null;
             try {
-                contentType = delegator.findOne("WorkEffortContentType", 
UtilMisc.toMap("workEffortContentTypeId", contentTypeId), true);
+                contentType = 
EntityQuery.use(delegator).from("WorkEffortContentType").where("workEffortContentTypeId",
 contentTypeId).cache().queryOne();
             } catch (GeneralException e) {
                 Debug.logError(e, module);
             }
@@ -285,7 +286,7 @@ public class WorkEffortContentWrapper im
         ModelEntity workEffortModel = delegator.getModelEntity("WorkEffort");
         if (workEffortModel != null && 
workEffortModel.isField(candidateFieldName)) {
             if (workEffort == null) {
-                workEffort = delegator.findOne("WorkEffort", 
UtilMisc.toMap("workEffortId", workEffortId), true);
+                workEffort = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
workEffortId).cache().queryOne();
             }
             if (workEffort != null) {
                 String candidateValue = 
workEffort.getString(candidateFieldName);
@@ -299,7 +300,7 @@ public class WorkEffortContentWrapper im
         // otherwise check content record
         GenericValue workEffortContent;
         if (contentId != null) {
-            workEffortContent = delegator.findOne("WorkEffortContent", 
UtilMisc.toMap("workEffortId", workEffortId, "contentId", contentId), true);
+            workEffortContent = 
EntityQuery.use(delegator).from("WorkEffortContent").where("workEffortId", 
workEffortId, "contentId", contentId).cache().queryOne();
         } else {
             workEffortContent = getFirstWorkEffortContentByType(workEffortId, 
workEffort, workEffortContentTypeId, delegator);
         }

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java
 Thu Oct 30 04:18:05 2014
@@ -90,6 +90,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
@@ -388,7 +389,7 @@ public class ICalConverter {
      */
     public static ResponseProperties getICalendar(String workEffortId, 
Map<String, Object> context) throws GenericEntityException {
         Delegator delegator = (Delegator) context.get("delegator");
-        GenericValue publishProperties = delegator.findOne("WorkEffort", 
UtilMisc.toMap("workEffortId", workEffortId), false);
+        GenericValue publishProperties = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
workEffortId).queryOne();
         if (!isCalendarPublished(publishProperties)) {
             Debug.logInfo("WorkEffort calendar is not published: " + 
workEffortId, module);
             return ICalWorker.createNotFoundResponse(null);
@@ -711,7 +712,7 @@ public class ICalConverter {
             return ICalWorker.createForbiddenResponse(null);
         }
         Delegator delegator = (Delegator) context.get("delegator");
-        GenericValue publishProperties = delegator.findOne("WorkEffort", 
UtilMisc.toMap("workEffortId", workEffortId), false);
+        GenericValue publishProperties = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
workEffortId).queryOne();
         if (!isCalendarPublished(publishProperties)) {
             Debug.logInfo("WorkEffort calendar is not published: " + 
workEffortId, module);
             return ICalWorker.createNotFoundResponse(null);
@@ -824,7 +825,7 @@ public class ICalConverter {
         PropertyList propertyList = component.getProperties();
         String workEffortId = fromXProperty(propertyList, 
workEffortIdXPropName);
         Delegator delegator = (Delegator) context.get("delegator");
-        GenericValue workEffort = delegator.findOne("WorkEffort", 
UtilMisc.toMap("workEffortId", workEffortId), false);
+        GenericValue workEffort = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
workEffortId).queryOne();
         if (workEffort == null) {
             return ICalWorker.createNotFoundResponse(null);
         }
@@ -843,7 +844,7 @@ public class ICalConverter {
         String workEffortId = workEffort.getString("workEffortId");
         String workEffortUid = workEffort.getString("universalId");
         String workEffortTypeId = workEffort.getString("workEffortTypeId");
-        GenericValue typeValue = delegator.findOne("WorkEffortType", 
UtilMisc.toMap("workEffortTypeId", workEffortTypeId), true);
+        GenericValue typeValue = 
EntityQuery.use(delegator).from("WorkEffortType").where("workEffortTypeId", 
workEffortTypeId).cache().queryOne();
         boolean isTask = false;
         boolean newComponent = true;
         ComponentList resultList = null;

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java
 Thu Oct 30 04:18:05 2014
@@ -44,6 +44,7 @@ import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceUtil;
@@ -130,7 +131,7 @@ public class ICalWorker {
     protected static Date getLastModifiedDate(HttpServletRequest request) 
throws GenericEntityException {
         String workEffortId = (String) request.getAttribute("workEffortId");
         Delegator delegator = (Delegator) request.getAttribute("delegator");
-        GenericValue publishProperties = delegator.findOne("WorkEffort", 
UtilMisc.toMap("workEffortId", workEffortId), false);
+        GenericValue publishProperties = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
workEffortId).queryOne();
         GenericValue iCalData = 
publishProperties.getRelatedOne("WorkEffortIcalData", false);
         if (iCalData != null) {
             return iCalData.getTimestamp("lastUpdatedStamp");

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortPartyAssignmentServices.java
 Thu Oct 30 04:18:05 2014
@@ -26,6 +26,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ModelService;
@@ -43,7 +44,7 @@ public class WorkEffortPartyAssignmentSe
         GenericValue workEffort = null;
 
         try {
-            workEffort = delegator.findOne("WorkEffort", false, 
"workEffortId", wepa.get("workEffortId"));
+            workEffort = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
wepa.get("workEffortId")).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
         }

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortSearch.java
 Thu Oct 30 04:18:05 2014
@@ -54,6 +54,7 @@ import org.ofbiz.entity.transaction.Gene
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 
 
@@ -578,8 +579,8 @@ public class WorkEffortSearch {
             GenericValue workEffort = null;
             GenericValue workEffortAssocType = null;
             try {
-                workEffort = delegator.findOne("WorkEffort", 
UtilMisc.toMap("workEffortId", this.workEffortId), true);
-                workEffortAssocType = delegator.findOne("WorkEffortAssocType", 
UtilMisc.toMap("workEffortAssocTypeId", this.workEffortAssocTypeId), true);
+                workEffort = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
this.workEffortId).cache().queryOne();
+                workEffortAssocType = 
EntityQuery.use(delegator).from("WorkEffortAssocType").where("workEffortAssocTypeId",
 this.workEffortAssocTypeId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error looking up WorkEffortAssocConstraint 
pretty print info: " + e.toString(), module);
             }
@@ -738,8 +739,8 @@ public class WorkEffortSearch {
             GenericValue partyNameView = null;
             GenericValue roleType = null;
             try {
-                partyNameView = delegator.findOne("PartyNameView", 
UtilMisc.toMap("partyId", partyId), true);
-                roleType = delegator.findOne("RoleType", 
UtilMisc.toMap("roleTypeId", roleTypeId), true);
+                partyNameView = 
EntityQuery.use(delegator).from("PartyNameView").where("partyId", 
partyId).cache().queryOne();
+                roleType = 
EntityQuery.use(delegator).from("RoleType").where("roleTypeId", 
roleTypeId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error finding PartyAssignmentConstraint 
information for constraint pretty print", module);
             }
@@ -855,7 +856,7 @@ public class WorkEffortSearch {
                 Iterator<String> productIdIter = this.productIdSet.iterator();
                 while (productIdIter.hasNext()) {
                     String productId = productIdIter.next();
-                    GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), true);
+                    GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).cache().queryOne();
                     if (product == null) {
                         infoOut.append("[");
                         infoOut.append(productId);

Modified: 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
 (original)
+++ 
ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
 Thu Oct 30 04:18:05 2014
@@ -52,6 +52,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
@@ -309,7 +310,7 @@ public class WorkEffortServices {
         GenericValue workEffort = null;
 
         try {
-            workEffort = delegator.findOne("WorkEffort", false, 
"workEffortId", workEffortId);
+            workEffort = 
EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", 
workEffortId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
         }
@@ -327,7 +328,7 @@ public class WorkEffortServices {
 
             if (UtilValidate.isNotEmpty(statusId)) {
                 try {
-                    currentStatus = delegator.findOne("StatusItem", 
UtilMisc.toMap("statusId", statusId), true);
+                    currentStatus = 
EntityQuery.use(delegator).from("StatusItem").where("statusId", 
statusId).cache().queryOne();
                 } catch (GenericEntityException e) {
                     Debug.logWarning(e, module);
                 }
@@ -350,7 +351,7 @@ public class WorkEffortServices {
 
             if (workEffort.get("currentStatusId") != null) {
                 try {
-                    currentStatus = delegator.findOne("StatusItem", 
UtilMisc.toMap("statusId", workEffort.get("currentStatusId")), true);
+                    currentStatus = 
EntityQuery.use(delegator).from("StatusItem").where("statusId", 
workEffort.get("currentStatusId")).cache().queryOne();
                 } catch (GenericEntityException e) {
                     Debug.logWarning(e, module);
                 }
@@ -1050,7 +1051,7 @@ public class WorkEffortServices {
 
             GenericValue emailTemplateSetting = null;
             try {
-                emailTemplateSetting = 
delegator.findOne("EmailTemplateSetting", true, "emailTemplateSettingId", 
"WEFF_EVENT_REMINDER");
+                emailTemplateSetting = 
EntityQuery.use(delegator).from("EmailTemplateSetting").where("emailTemplateSettingId",
 "WEFF_EVENT_REMINDER").cache().queryOne();
             } catch (GenericEntityException e1) {
                 Debug.logError(e1, module);
             }

Modified: 
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
 (original)
+++ 
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
 Thu Oct 30 04:18:05 2014
@@ -65,6 +65,7 @@ import freemarker.template.SimpleScalar;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
 import freemarker.template.TemplateExceptionHandler;
+import freemarker.template.TemplateHashModel;
 import freemarker.template.TemplateModel;
 import freemarker.template.TemplateModelException;
 import freemarker.template.Version;
@@ -91,7 +92,13 @@ public class FreeMarkerWorker {
         Configuration newConfig = new Configuration(version);
 
         newConfig.setObjectWrapper(wrapper);
-        newConfig.setSharedVariable("Static", wrapper.getStaticModels());
+        TemplateHashModel staticModels = wrapper.getStaticModels();
+        newConfig.setSharedVariable("Static", staticModels);
+        try {
+            newConfig.setSharedVariable("EntityQuery", 
staticModels.get("org.ofbiz.entity.util.EntityQuery"));
+        } catch (TemplateModelException e) {
+            Debug.logError(e, module);
+        }
         newConfig.setLocalizedLookup(false);
         newConfig.setSharedVariable("StringUtil", new 
BeanModel(StringUtil.INSTANCE, wrapper));
         newConfig.setTemplateLoader(new FlexibleTemplateLoader());

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java 
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java Thu Oct 
30 04:18:05 2014
@@ -59,6 +59,7 @@ import org.ofbiz.base.util.cache.UtilCac
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.security.Security;
 
 /**
@@ -95,7 +96,7 @@ public class CommonEvents {
 
         GenericValue visit = null;
         try {
-            visit = delegator.findOne("Visit", false, "visitId", visitId);
+            visit = EntityQuery.use(delegator).from("Visit").where("visitId", 
visitId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot Visit Object", module);
         }
@@ -129,7 +130,7 @@ public class CommonEvents {
 
         GenericValue visit = null;
         try {
-            visit = delegator.findOne("Visit", false, "visitId", visitId);
+            visit = EntityQuery.use(delegator).from("Visit").where("visitId", 
visitId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot Visit Object", module);
         }

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java 
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonWorkers.java Thu 
Oct 30 04:18:05 2014
@@ -33,6 +33,7 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityTypeUtil;
 import org.ofbiz.entity.util.EntityUtilProperties;
 
@@ -49,7 +50,7 @@ public class CommonWorkers {
         GenericValue defaultGeo = null;
         if (UtilValidate.isNotEmpty(defaultCountry)) {
             try {
-                defaultGeo = delegator.findOne("Geo", UtilMisc.toMap("geoId", 
defaultCountry), true);
+                defaultGeo = 
EntityQuery.use(delegator).from("Geo").where("geoId", 
defaultCountry).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Cannot lookup Geo", module);
             }

Modified: 
ofbiz/trunk/framework/common/src/org/ofbiz/common/UrlServletHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/UrlServletHelper.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/UrlServletHelper.java 
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/UrlServletHelper.java Thu 
Oct 30 04:18:05 2014
@@ -38,6 +38,7 @@ import org.ofbiz.entity.DelegatorFactory
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.webapp.control.ContextFilter;
 import org.ofbiz.webapp.website.WebSiteWorker;
@@ -154,7 +155,7 @@ public class UrlServletHelper extends Co
         // check path alias
         GenericValue pathAlias = null;
         try {
-            pathAlias = delegator.findOne("WebSitePathAlias", 
UtilMisc.toMap("webSiteId", webSiteId, "pathAlias", pathInfo), true);
+            pathAlias = 
EntityQuery.use(delegator).from("WebSitePathAlias").where("webSiteId", 
webSiteId, "pathAlias", pathInfo).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java 
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/geo/GeoWorker.java Thu 
Oct 30 04:18:05 2014
@@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 
 /**
@@ -42,7 +43,7 @@ public class GeoWorker {
     public static List<GenericValue> expandGeoGroup(String geoId, Delegator 
delegator) {
         GenericValue geo = null;
         try {
-            geo = delegator.findOne("Geo", UtilMisc.toMap("geoId", geoId), 
true);
+            geo = EntityQuery.use(delegator).from("Geo").where("geoId", 
geoId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Unable to look up Geo from geoId : " + geoId, 
module);
         }
@@ -93,7 +94,7 @@ public class GeoWorker {
         for (Map.Entry<String, String> geoIdByTypeEntry: 
geoIdByTypeMapOrig.entrySet()) {
             List<GenericValue> geoAssocList = delegator.findByAnd("GeoAssoc", 
UtilMisc.toMap("geoIdTo", geoIdByTypeEntry.getValue(), "geoAssocTypeId", 
"REGIONS"), null, true);
             for (GenericValue geoAssoc: geoAssocList) {
-                GenericValue newGeo = delegator.findOne("Geo", true, "geoId", 
geoAssoc.getString("geoId"));
+                GenericValue newGeo = 
EntityQuery.use(delegator).from("Geo").where("geoId", 
geoAssoc.get("geoId")).cache().queryOne();
                 geoIdByTypeMapTemp.put(newGeo.getString("geoTypeId"), 
newGeo.getString("geoId"));
             }
         }
@@ -108,7 +109,7 @@ public class GeoWorker {
     public static boolean containsGeo(List<GenericValue> geoList, String 
geoId, Delegator delegator) {
         GenericValue geo = null;
         try {
-            geo = delegator.findOne("Geo", UtilMisc.toMap("geoId", geoId), 
true);
+            geo = EntityQuery.use(delegator).from("Geo").where("geoId", 
geoId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Unable to look up Geo from geoId : " + geoId, 
module);
         }

Modified: 
ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java 
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java 
Thu Oct 30 04:18:05 2014
@@ -50,6 +50,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.security.Security;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.LocalDispatcher;
@@ -493,7 +494,7 @@ public class LoginServices {
             GenericValue party = null;
 
             try {
-                party = delegator.findOne("Party", false, "partyId", partyId);
+                party = 
EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, "", module);
             }
@@ -609,7 +610,7 @@ public class LoginServices {
         GenericValue userLoginToUpdate = null;
 
         try {
-            userLoginToUpdate = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+            userLoginToUpdate = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
         } catch (GenericEntityException e) {
             Map<String, String> messageMap = UtilMisc.toMap("errorMessage", 
e.getMessage());
             errMsg = 
UtilProperties.getMessage(resource,"loginservices.could_not_change_password_read_failure",
 messageMap, locale);
@@ -724,7 +725,7 @@ public class LoginServices {
         if (UtilValidate.isNotEmpty(partyId)) {
             //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, "", module);
             //}
@@ -746,7 +747,7 @@ public class LoginServices {
 
         // check to see if there's a matching login and use it if it's for the 
same party
         try {
-            newUserLogin = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+            newUserLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, "", module);
             Map<String, String> messageMap = UtilMisc.toMap("errorMessage", 
e.getMessage());
@@ -834,7 +835,7 @@ public class LoginServices {
         GenericValue userLoginToUpdate = null;
 
         try {
-            userLoginToUpdate = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+            userLoginToUpdate = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
         } catch (GenericEntityException e) {
             Map<String, String> messageMap = UtilMisc.toMap("errorMessage", 
e.getMessage());
             errMsg = 
UtilProperties.getMessage(resource,"loginservices.could_not_change_password_read_failure",
 messageMap, locale);

Modified: 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java
 (original)
+++ 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityCryptoTestSuite.java
 Thu Oct 30 04:18:05 2014
@@ -26,6 +26,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityConditionSubSelect;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.testtools.EntityTestCase;
+import org.ofbiz.entity.util.EntityQuery;
 
 public class EntityCryptoTestSuite extends EntityTestCase {
     public EntityCryptoTestSuite(String name) {
@@ -40,11 +41,11 @@ public class EntityCryptoTestSuite exten
 
         // Ensure that null values are passed thru unencrypted.
         delegator.create("TestingCrypto", UtilMisc.toMap("testingCryptoId", 
"1", "testingCryptoTypeId", "BASIC"));
-        GenericValue entity = delegator.findOne("TestingCrypto", 
UtilMisc.toMap("testingCryptoId", "1"), false);
+        GenericValue entity = 
EntityQuery.use(delegator).from("TestingCrypto").where("testingCryptoId", 
"1").queryOne();
         assertNull(entity.getString("unencryptedValue"));
         assertNull(entity.getString("encryptedValue"));
         assertNull(entity.getString("saltedEncryptedValue"));
-        GenericValue view = delegator.findOne("TestingCryptoRawView", 
UtilMisc.toMap("testingCryptoId", "1"), false);
+        GenericValue view = 
EntityQuery.use(delegator).from("TestingCryptoRawView").where("testingCryptoId",
 "1").queryOne();
         assertNull(view.getString("unencryptedValue"));
         assertNull(view.getString("encryptedValue"));
         assertNull(view.getString("saltedEncryptedValue"));

Modified: 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java 
(original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityCrypto.java 
Thu Oct 30 04:18:05 2014
@@ -161,7 +161,7 @@ public final class EntityCrypto {
 
         GenericValue keyValue = null;
         try {
-            keyValue = delegator.findOne("EntityKeyStore", false, "keyName", 
hashedKeyName);
+            keyValue = 
EntityQuery.use(delegator).from("EntityKeyStore").where("keyName", 
hashedKeyName).queryOne();
         } catch (GenericEntityException e) {
             throw new EntityCryptoException(e);
         }

Modified: 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java
 (original)
+++ 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtilProperties.java
 Thu Oct 30 04:18:05 2014
@@ -55,7 +55,7 @@ public class EntityUtilProperties implem
         
         // find system property
         try {
-            GenericValue systemProperty = delegator.findOne("SystemProperty", 
UtilMisc.toMap("systemResourceId", resource, "systemPropertyId", name), true);
+            GenericValue systemProperty = 
EntityQuery.use(delegator).from("SystemProperty").where("systemResourceId", 
resource, "systemPropertyId", name).cache().queryOne();
             if (systemProperty != null) {
                 String systemPropertyValue = 
systemProperty.getString("systemPropertyValue");
                 if (UtilValidate.isNotEmpty(systemPropertyValue)) {

Modified: 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java
 (original)
+++ 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/cache/EntityCacheServices.java
 Thu Oct 30 04:18:05 2014
@@ -29,6 +29,7 @@ import org.ofbiz.entity.GenericPK;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.util.DistributedCacheClear;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entityext.EntityServiceFactory;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -57,7 +58,7 @@ public class EntityCacheServices impleme
     public GenericValue getAuthUserLogin() {
         GenericValue userLogin = null;
         try {
-            userLogin = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", userLoginId), true);
+            userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error finding the userLogin for distributed 
cache clear", module);
         }

Modified: 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java
 (original)
+++ 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/permission/EntityPermissionChecker.java
 Thu Oct 30 04:18:05 2014
@@ -47,6 +47,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.ServiceUtil;
@@ -276,7 +277,7 @@ public class EntityPermissionChecker {
             int privilegeEnumSeq = -1;
 
             if (UtilValidate.isNotEmpty(privilegeEnumId)) {
-                GenericValue privEnum = delegator.findOne("Enumeration", 
UtilMisc.toMap("enumId", privilegeEnumId), true);
+                GenericValue privEnum = 
EntityQuery.use(delegator).from("Enumeration").where("enumId", 
privilegeEnumId).cache().queryOne();
                 if (privEnum != null) {
                     String sequenceId = privEnum.getString("sequenceId");
                     try {
@@ -296,7 +297,7 @@ public class EntityPermissionChecker {
                 String targetPrivilegeEnumId = 
entity.getString("privilegeEnumId");
                 if (UtilValidate.isNotEmpty(targetPrivilegeEnumId)) {
                     int targetPrivilegeEnumSeq = -1;
-                    GenericValue privEnum = delegator.findOne("Enumeration", 
UtilMisc.toMap("enumId", privilegeEnumId), true);
+                    GenericValue privEnum = 
EntityQuery.use(delegator).from("Enumeration").where("enumId", 
privilegeEnumId).cache().queryOne();
                     if (privEnum != null) {
                         String sequenceId = privEnum.getString("sequenceId");
                         try {
@@ -1001,7 +1002,7 @@ public class EntityPermissionChecker {
                 privilegeEnumId = 
currentValue.getString(this.privilegeFieldName);
             }
             if (UtilValidate.isNotEmpty(privilegeEnumId)) {
-                GenericValue privEnum = delegator.findOne("Enumeration", 
UtilMisc.toMap("enumId", privilegeEnumId), true);
+                GenericValue privEnum = 
EntityQuery.use(delegator).from("Enumeration").where("enumId", 
privilegeEnumId).cache().queryOne();
                 if (privEnum != null) {
                     String sequenceId = privEnum.getString("sequenceId");
                     try {
@@ -1293,7 +1294,7 @@ public class EntityPermissionChecker {
             if (entity.get("createdByUserLogin") != null) {
                 String userLoginIdCB = 
(String)entity.get("createdByUserLogin");
                 try {
-                    GenericValue userLogin = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", userLoginIdCB), true);
+                    GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginIdCB).cache().queryOne();
                     if (userLogin != null) {
                         String partyIdCB = userLogin.getString("partyId");
                         if (partyIdCB != null) {
@@ -1358,7 +1359,7 @@ public class EntityPermissionChecker {
         int privilegeEnumSeq = -1;
 
         if (UtilValidate.isNotEmpty(privilegeEnumId)) {
-            GenericValue privEnum = delegator.findOne("Enumeration", 
UtilMisc.toMap("enumId", privilegeEnumId), true);
+            GenericValue privEnum = 
EntityQuery.use(delegator).from("Enumeration").where("enumId", 
privilegeEnumId).cache().queryOne();
             if (privEnum != null) {
                 String sequenceId = privEnum.getString("sequenceId");
                 try {

Modified: 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
 (original)
+++ 
ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
 Thu Oct 30 04:18:05 2014
@@ -49,6 +49,7 @@ import org.ofbiz.entity.serialize.XmlSer
 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.entityext.EntityGroupUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GeneralServiceException;
@@ -163,7 +164,7 @@ public class EntitySyncContext {
         }
 
         try {
-            this.entitySync = delegator.findOne("EntitySync", false, 
"entitySyncId", this.entitySyncId);
+            this.entitySync = 
EntityQuery.use(delegator).from("EntitySync").where("entitySyncId", 
this.entitySyncId).queryOne();
             if (this.entitySync == null) {
                 throw new SyncAbortException("Not running EntitySync [" + 
entitySyncId + "], no record found with that ID.");
             }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Thu 
Oct 30 04:18:05 2014
@@ -49,6 +49,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.security.Security;
 import org.ofbiz.service.config.ServiceConfigUtil;
 
@@ -624,7 +625,7 @@ public class ServiceUtil {
         Delegator delegator = dctx.getDelegator();
         if (UtilValidate.isNotEmpty(runAsUser)) {
             try {
-                GenericValue runAs = delegator.findOne("UserLogin", true, 
"userLoginId", runAsUser);
+                GenericValue runAs = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
runAsUser).cache().queryOne();
                 if (runAs != null) {
                     userLogin = runAs;
                 }

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
 Thu Oct 30 04:18:05 2014
@@ -29,6 +29,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;
 
 /** TemporalExpression persistence worker. */
 public class TemporalExpressionWorker {
@@ -61,7 +62,7 @@ public class TemporalExpressionWorker {
         if (UtilValidate.isEmpty(tempExprId)) {
             throw new IllegalArgumentException("tempExprId argument cannot be 
empty");
         }
-        GenericValue exprValue = delegator.findOne("TemporalExpression", 
UtilMisc.toMap("tempExprId", tempExprId), true);
+        GenericValue exprValue = 
EntityQuery.use(delegator).from("TemporalExpression").where("tempExprId", 
tempExprId).cache().queryOne();
         if (UtilValidate.isEmpty(exprValue)) {
             throw new IllegalArgumentException("tempExprId argument invalid - 
expression not found");
         }

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java 
(original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java 
Thu Oct 30 04:18:05 2014
@@ -50,6 +50,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceContainer;
@@ -108,7 +109,7 @@ public class JavaMailContainer implement
         // load the userLogin object
         String runAsUser = ContainerConfig.getPropertyValue(cfg, 
"run-as-user", "system");
         try {
-            this.userLogin = delegator.findOne("UserLogin", false, 
"userLoginId", runAsUser);
+            this.userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
runAsUser).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Unable to load run-as-user UserLogin; cannot 
start container", module);
             return false;

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java
 Thu Oct 30 04:18:05 2014
@@ -29,6 +29,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 org.ofbiz.service.ModelService;
 import org.ofbiz.service.job.JobManager;
 
@@ -120,7 +121,7 @@ public class ServiceSemaphore {
         GenericValue semaphore;
 
         try {
-            semaphore = delegator.findOne("ServiceSemaphore", false, 
"serviceName", model.name);
+            semaphore = 
EntityQuery.use(delegator).from("ServiceSemaphore").where("serviceName", 
model.name).queryOne();
         } catch (GenericEntityException e) {
             throw new SemaphoreFailException(e);
         }

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java
 Thu Oct 30 04:18:05 2014
@@ -31,6 +31,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericResultWaiter;
 import org.ofbiz.service.GenericServiceException;
@@ -75,7 +76,7 @@ public class ServiceEngineTestServices {
         Locale locale = (Locale) context.get("locale");
         try {
             // grab entity SVCLRT_A by changing, then wait, then find and 
change SVCLRT_B
-            GenericValue testingTypeA = delegator.findOne("TestingType", 
false, "testingTypeId", "SVCLRT_A");
+            GenericValue testingTypeA = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLRT_A").queryOne();
             testingTypeA.set("description", "New description for SVCLRT_A");
             testingTypeA.store();
 
@@ -84,12 +85,12 @@ public class ServiceEngineTestServices {
             Thread.sleep(100);
 
             Debug.logInfo("In testServiceDeadLockRetryThreadA done with wait, 
updating SVCLRT_B", module);
-            GenericValue testingTypeB = delegator.findOne("TestingType", 
false, "testingTypeId", "SVCLRT_B");
+            GenericValue testingTypeB = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLRT_B").queryOne();
             testingTypeB.set("description", "New description for SVCLRT_B");
             testingTypeB.store();
 
             Debug.logInfo("In testServiceDeadLockRetryThreadA done with 
updating SVCLRT_B, updating SVCLRT_AONLY", module);
-            GenericValue testingTypeAOnly = delegator.findOne("TestingType", 
false, "testingTypeId", "SVCLRT_AONLY");
+            GenericValue testingTypeAOnly = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLRT_AONLY").queryOne();
             testingTypeAOnly.set("description", "New description for 
SVCLRT_AONLY; this is only changed by thread A so if it doesn't match something 
happened to thread A!");
             testingTypeAOnly.store();
         } catch (GenericEntityException e) {
@@ -107,7 +108,7 @@ public class ServiceEngineTestServices {
         Locale locale = (Locale) context.get("locale");
         try {
             // grab entity SVCLRT_B by changing, then wait, then change 
SVCLRT_A
-            GenericValue testingTypeB = delegator.findOne("TestingType", 
false, "testingTypeId", "SVCLRT_B");
+            GenericValue testingTypeB = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLRT_B").queryOne();
             testingTypeB.set("description", "New description for SVCLRT_B");
             testingTypeB.store();
 
@@ -116,12 +117,12 @@ public class ServiceEngineTestServices {
             Thread.sleep(100);
 
             Debug.logInfo("In testServiceDeadLockRetryThreadB done with wait, 
updating SVCLRT_A", module);
-            GenericValue testingTypeA = delegator.findOne("TestingType", 
false, "testingTypeId", "SVCLRT_A");
+            GenericValue testingTypeA = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLRT_A").queryOne();
             testingTypeA.set("description", "New description for SVCLRT_A");
             testingTypeA.store();
 
             Debug.logInfo("In testServiceDeadLockRetryThreadA done with 
updating SVCLRT_A, updating SVCLRT_BONLY", module);
-            GenericValue testingTypeAOnly = delegator.findOne("TestingType", 
false, "testingTypeId", "SVCLRT_BONLY");
+            GenericValue testingTypeAOnly = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLRT_BONLY").queryOne();
             testingTypeAOnly.set("description", "New description for 
SVCLRT_BONLY; this is only changed by thread B so if it doesn't match something 
happened to thread B!");
             testingTypeAOnly.store();
         } catch (GenericEntityException e) {
@@ -169,7 +170,7 @@ public class ServiceEngineTestServices {
         Locale locale = (Locale) context.get("locale");
         try {
             // grab entity SVCLWTRT by changing, then wait a LONG time, ie 
more than the wait timeout
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVCLWTRT");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLWTRT").queryOne();
             testingType.set("description", "New description for SVCLWTRT from 
the GRABBER service, this should be replaced by Waiter service in the service 
engine auto-retry");
             testingType.store();
 
@@ -198,7 +199,7 @@ public class ServiceEngineTestServices {
             Debug.logInfo("In testServiceLockWaitTimeoutRetryWaiter about to 
update SVCLWTRT, wait starts here", module);
 
             // TRY grab entity SVCLWTRT by looking up and changing, should get 
a lock wait timeout exception because of the Grabber thread
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVCLWTRT");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLWTRT").queryOne();
             testingType.set("description", "New description for SVCLWTRT from 
Waiter service, this is the value that should be there.");
             testingType.store();
 
@@ -238,7 +239,7 @@ public class ServiceEngineTestServices {
         Locale locale = (Locale) context.get("locale");
         try {
             // grab entity SVCLWTRTCR by changing, then wait a LONG time, ie 
more than the wait timeout
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVCLWTRTCR");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLWTRTCR").queryOne();
             testingType.set("description", "New description for SVCLWTRTCR 
from Lock Wait Timeout Lock GRABBER, this should be replaced by the one in the 
Waiter service.");
             testingType.store();
 
@@ -267,7 +268,7 @@ public class ServiceEngineTestServices {
             Debug.logInfo("In testServiceLockWaitTimeoutRetryCantRecoverWaiter 
updating SVCLWTRTCR", module);
 
             // TRY grab entity SVCLWTRTCR by looking up and changing, should 
get a lock wait timeout exception because of the Grabber thread
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVCLWTRTCR");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVCLWTRTCR").queryOne();
             testingType.set("description", "New description for SVCLWTRTCR 
from Lock Wait Timeout Lock Waiter, this is the value that should be there.");
             testingType.store();
 
@@ -303,7 +304,7 @@ public class ServiceEngineTestServices {
         Locale locale = (Locale) context.get("locale");
         try {
             // change the SVC_SRBO value first to test that the rollback 
really does revert/reset
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVC_SRBO");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVC_SRBO").queryOne();
             testingType.set("description", "New description for SVC_SRBO; this 
should be reset on the rollback, if this is in the db then the test failed");
             testingType.store();
 
@@ -346,7 +347,7 @@ public class ServiceEngineTestServices {
         Delegator delegator = dctx.getDelegator();
         Locale locale = (Locale) context.get("locale");
         try {
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVC_SECAGC");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVC_SECAGC").queryOne();
             testingType.set("description", "New description for SVC_SECAGC, 
what it should be after the global-commit test");
             testingType.store();
         } catch (GenericEntityException e) {
@@ -365,7 +366,7 @@ public class ServiceEngineTestServices {
         Delegator delegator = dctx.getDelegator();
         Locale locale = (Locale) context.get("locale");
         try {
-            GenericValue testingType = delegator.findOne("TestingType", false, 
"testingTypeId", "SVC_SECAGR");
+            GenericValue testingType = 
EntityQuery.use(delegator).from("TestingType").where("testingTypeId", 
"SVC_SECAGR").queryOne();
             testingType.set("description", "New description for SVC_SECAGR, 
what it should be after the global-rollback test");
             testingType.store();
         } catch (GenericEntityException e) {

Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java 
(original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/OfbizUrlBuilder.java Thu 
Oct 30 04:18:05 2014
@@ -29,6 +29,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.webapp.control.ConfigXMLReader;
 import org.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig;
 import org.ofbiz.webapp.control.ConfigXMLReader.RequestMap;
@@ -85,7 +86,7 @@ public final class OfbizUrlBuilder {
             Assert.notNull("delegator", delegator);
             String webSiteId = WebAppUtil.getWebSiteId(webAppInfo);
             if (webSiteId != null) {
-                GenericValue webSiteValue = delegator.findOne("WebSite", 
UtilMisc.toMap("webSiteId", webSiteId), true);
+                GenericValue webSiteValue = 
EntityQuery.use(delegator).from("WebSite").where("webSiteId", 
webSiteId).cache().queryOne();
                 if (webSiteValue != null) {
                     webSiteProps = WebSiteProperties.from(webSiteValue);
                 }

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java
 (original)
+++ 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.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.serialize.XmlSerializer;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * HttpSessionListener that gathers and tracks various information and 
statistics
@@ -77,7 +78,7 @@ public class ControlEventListener implem
             GenericValue visit = (GenericValue) session.getAttribute("visit");
             if (visit != null) {
                 Delegator delegator = visit.getDelegator();
-                visit = delegator.findOne("Visit", UtilMisc.toMap("visitId", 
visit.get("visitId")), false);
+                visit = 
EntityQuery.use(delegator).from("Visit").where("visitId", 
visit.get("visitId")).queryOne();
                 if (visit != null) {
                     visit.set("thruDate", new 
Timestamp(session.getLastAccessedTime()));
                     visit.store();

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java 
(original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java 
Thu Oct 30 04:18:05 2014
@@ -66,6 +66,7 @@ import org.ofbiz.entity.model.ModelEntit
 import org.ofbiz.entity.serialize.XmlSerializer;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.security.SecurityConfigurationException;
@@ -185,7 +186,7 @@ public class LoginWorker {
             try {
                 beganTransaction = TransactionUtil.begin();
 
-                GenericValue userLogin = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+                GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
                 if (userLogin == null) {
                     Debug.logError("Could not find UserLogin record for 
setLoggedOut with userLoginId [" + userLoginId + "]", module);
                 } else {
@@ -757,7 +758,7 @@ public class LoginWorker {
         if (autoUserLoginId != null) {
             Debug.logInfo("Running autoLogin check.", module);
             try {
-                GenericValue autoUserLogin = delegator.findOne("UserLogin", 
false, "userLoginId", autoUserLoginId);
+                GenericValue autoUserLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
autoUserLoginId).queryOne();
                 GenericValue person = null;
                 GenericValue group = null;
                 if (autoUserLogin != null) {
@@ -765,8 +766,8 @@ public class LoginWorker {
 
                     ModelEntity modelUserLogin = 
autoUserLogin.getModelEntity();
                     if (modelUserLogin.isField("partyId")) {
-                        person = delegator.findOne("Person", false, "partyId", 
autoUserLogin.getString("partyId"));
-                        group = delegator.findOne("PartyGroup", false, 
"partyId", autoUserLogin.getString("partyId"));
+                        person = 
EntityQuery.use(delegator).from("Person").where("partyId", 
autoUserLogin.getString("partyId")).queryOne();
+                        group = 
EntityQuery.use(delegator).from("PartyGroup").where("partyId", 
autoUserLogin.getString("partyId")).queryOne();
                     }
                 }
                 if (person != null) {
@@ -827,7 +828,7 @@ public class LoginWorker {
     public static String loginUserWithUserLoginId(HttpServletRequest request, 
HttpServletResponse response, String userLoginId) {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         try {
-            GenericValue userLogin = delegator.findOne("UserLogin", false, 
"userLoginId", userLoginId);
+            GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
             if (userLogin != null) {
                 String enabled = userLogin.getString("enabled");
                 if (enabled == null || "Y".equals(enabled)) {
@@ -941,7 +942,7 @@ public class LoginWorker {
                                 //Debug.logInfo("Looking up userLogin from CN: 
" + userLoginId, module);
 
                                 // CN should match the userLoginId
-                                GenericValue userLogin = 
delegator.findOne("UserLogin", false, "userLoginId", userLoginId);
+                                GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
                                 if (userLogin != null) {
                                     String enabled = 
userLogin.getString("enabled");
                                     if (enabled == null || 
"Y".equals(enabled)) {

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java 
(original)
+++ 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java 
Thu Oct 30 04:18:05 2014
@@ -51,6 +51,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.webapp.OfbizUrlBuilder;
 import org.ofbiz.webapp.event.EventFactory;
 import org.ofbiz.webapp.event.EventHandler;
@@ -271,7 +272,7 @@ public class RequestHandler {
                     String webSiteId = WebSiteWorker.getWebSiteId(request);
                     if (webSiteId != null) {
                         try {
-                            GenericValue webSite = 
delegator.findOne("WebSite", UtilMisc.toMap("webSiteId", webSiteId), true);
+                            GenericValue webSite = 
EntityQuery.use(delegator).from("WebSite").where("webSiteId", 
webSiteId).cache().queryOne();
                             if (webSite != null) enableHttps = 
webSite.getBoolean("enableHttps");
                         } catch (GenericEntityException e) {
                             Debug.logWarning(e, "Problems with WebSite entity; 
using global defaults", module);

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java 
(original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java 
Thu Oct 30 04:18:05 2014
@@ -36,6 +36,7 @@ import org.ofbiz.entity.DelegatorFactory
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 
 import com.ibm.icu.util.Calendar;
 
@@ -474,7 +475,7 @@ public class ServerHitBin {
             // check for type data before running.
             GenericValue serverHitType = null;
 
-            serverHitType = delegator.findOne("ServerHitType", 
UtilMisc.toMap("hitTypeId", ServerHitBin.typeIds[this.type]), true);
+            serverHitType = 
EntityQuery.use(delegator).from("ServerHitType").where("hitTypeId", 
ServerHitBin.typeIds[this.type]).cache().queryOne();
             if (serverHitType == null) {
                 // datamodel data not loaded; not storing hit.
                 Debug.logWarning("The datamodel data has not been loaded; 
cannot find hitTypeId '" + ServerHitBin.typeIds[this.type] + " not storing 
ServerHit.", module);
@@ -488,7 +489,7 @@ public class ServerHitBin {
                 return;
             }
             String visitId = visit.getString("visitId");
-            visit = delegator.findOne("Visit", UtilMisc.toMap("visitId", 
visitId), false);
+            visit = EntityQuery.use(delegator).from("Visit").where("visitId", 
visitId).queryOne();
             if (visit == null) {
                 // GenericValue stored in client session does not exist in 
database.
                 Debug.logInfo("The Visit GenericValue stored in the client 
session does not exist in the database, not storing server hit.", module);

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java 
(original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java 
Thu Oct 30 04:18:05 2014
@@ -35,6 +35,7 @@ import org.ofbiz.entity.DelegatorFactory
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * Handles saving and maintaining visit information
@@ -164,7 +165,7 @@ public class VisitHandler {
                                 
                                 // sometimes these values get stale, so check 
it before we use it
                                 try {
-                                    GenericValue checkVisitor = 
delegator.findOne("Visitor", false, "visitorId", visitorId);
+                                    GenericValue checkVisitor = 
EntityQuery.use(delegator).from("Visitor").where("visitorId", 
visitorId).queryOne();
                                     if (checkVisitor == null) {
                                         GenericValue newVisitor = 
delegator.create("Visitor", "visitorId", visitorId);
                                         session.setAttribute("visitor", 
newVisitor);
@@ -247,7 +248,7 @@ public class VisitHandler {
                                 }
                             } else {
                                 try {
-                                    visitor = delegator.findOne("Visitor", 
false, "visitorId", cookieVisitorId);
+                                    visitor = 
EntityQuery.use(delegator).from("Visitor").where("visitorId", 
cookieVisitorId).queryOne();
                                     if (visitor == null) {
                                         // looks like we have an ID that 
doesn't exist in our database, so we'll create a new one
                                         visitor = 
delegator.makeValue("Visitor");

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java
 (original)
+++ 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteProperties.java
 Thu Oct 30 04:18:05 2014
@@ -28,6 +28,7 @@ import org.ofbiz.base.util.UtilPropertie
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * Web site properties.
@@ -67,7 +68,7 @@ public final class WebSiteProperties {
             if (delegator != null) {
                 String webSiteId = WebSiteWorker.getWebSiteId(request);
                 if (webSiteId != null) {
-                    GenericValue webSiteValue = delegator.findOne("WebSite", 
UtilMisc.toMap("webSiteId", webSiteId), true);
+                    GenericValue webSiteValue = 
EntityQuery.use(delegator).from("WebSite").where("webSiteId", 
webSiteId).cache().queryOne();
                     if (webSiteValue != null) {
                         if (webSiteValue.get("httpPort") != null) {
                             httpPort = webSiteValue.getString("httpPort");

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java?rev=1635383&r1=1635382&r2=1635383&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java
 (original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java
 Thu Oct 30 04:18:05 2014
@@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.widget.menu.MenuStringRenderer;
 import org.ofbiz.widget.menu.ModelMenuItem;
 import org.xml.sax.SAXException;
@@ -67,7 +68,7 @@ public class HtmlMenuWrapperImage extend
             for (ModelMenuItem menuItem : modelMenu.getMenuItemList()) {
                String contentId = menuItem.getAssociatedContentId(dummyMap);
                //if (Debug.infoOn()) Debug.logInfo("in init, contentId:" + 
contentId, module);
-               GenericValue webSitePublishPoint = 
delegator.findOne("WebSitePublishPoint", UtilMisc.toMap("contentId", 
contentId), true);
+               GenericValue webSitePublishPoint = 
EntityQuery.use(delegator).from("WebSitePublishPoint").where("contentId", 
contentId).cache().queryOne();
                String menuItemName = menuItem.getName();
                //if (Debug.infoOn()) Debug.logInfo("in init, menuItemName:" + 
menuItemName, module);
                //if (Debug.infoOn()) Debug.logInfo("in init, 
webSitePublishPoint:" + webSitePublishPoint, module);


Reply via email to