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

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/contact/ContactMechServices.java
 Mon Nov  3 06:54:16 2014
@@ -41,6 +41,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
@@ -157,7 +158,7 @@ public class ContactMechServices {
         GenericValue partyContactMech = null;
 
         try {
-            contactMech = delegator.findOne("ContactMech", 
UtilMisc.toMap("contactMechId", contactMechId), false);
+            contactMech = 
EntityQuery.use(delegator).from("ContactMech").where("contactMechId", 
contactMechId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
             contactMech = null;
@@ -417,7 +418,7 @@ public class ContactMechServices {
         GenericValue partyContactMech = null;
 
         try {
-            contactMech = delegator.findOne("ContactMech", 
UtilMisc.toMap("contactMechId", contactMechId), false);
+            contactMech = 
EntityQuery.use(delegator).from("ContactMech").where("contactMechId", 
contactMechId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), module);
             contactMech = null;
@@ -455,7 +456,7 @@ public class ContactMechServices {
             GenericValue addr = null;
 
             try {
-                addr = delegator.findOne("PostalAddress", 
UtilMisc.toMap("contactMechId", contactMechId), false);
+                addr = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
contactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e.toString(), module);
                 addr = null;
@@ -635,7 +636,7 @@ public class ContactMechServices {
         GenericValue partyContactMech = null;
 
         try {
-            contactMech = delegator.findOne("ContactMech", 
UtilMisc.toMap("contactMechId", contactMechId), false);
+            contactMech = 
EntityQuery.use(delegator).from("ContactMech").where("contactMechId", 
contactMechId).queryOne();
             // try to find a PartyContactMech with a valid date range
             List<GenericValue> partyContactMechs = 
EntityUtil.filterByDate(delegator.findByAnd("PartyContactMech", 
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId), 
UtilMisc.toList("fromDate"), false), true);
 
@@ -664,7 +665,7 @@ public class ContactMechServices {
             GenericValue telNum = null;
 
             try {
-                telNum = delegator.findOne("TelecomNumber", 
UtilMisc.toMap("contactMechId", contactMechId), false);
+                telNum = 
EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", 
contactMechId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e.toString(), module);
                 telNum = null;
@@ -930,7 +931,7 @@ public class ContactMechServices {
         GenericValue pcmp = null;
 
         try {
-            pcmp = delegator.findOne("PartyContactMechPurpose", 
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, 
"contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", fromDate), 
false);
+            pcmp = 
EntityQuery.use(delegator).from("PartyContactMechPurpose").where("partyId", 
partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", 
contactMechPurposeTypeId, "fromDate", fromDate).queryOne();
             if (pcmp == null) {
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
                         
"contactmechservices.could_not_delete_purpose_from_contact_mechanism_not_found",
 locale));

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

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/content/PartyContentWrapper.java
 Mon Nov  3 06:54:16 2014
@@ -25,6 +25,7 @@ import org.ofbiz.base.util.cache.UtilCac
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.entity.model.ModelUtil;
 import org.ofbiz.entity.model.ModelEntity;
@@ -187,7 +188,7 @@ public class PartyContentWrapper impleme
             ModelEntity partyPersonModel = 
delegator.getModelEntity("PartyAndPerson");
             if (partyPersonModel != null && 
partyPersonModel.isField(candidateFieldName)) {
                 if (party == null) {
-                    party = delegator.findOne("PartyAndPerson", 
UtilMisc.toMap("partyId", partyId), true);
+                    party = 
EntityQuery.use(delegator).from("PartyAndPerson").where("partyId", 
partyId).cache().queryOne();
                 }
                 if (party != null) {
                     String candidateValue = 
party.getString(candidateFieldName);
@@ -202,7 +203,7 @@ public class PartyContentWrapper impleme
             ModelEntity partyGroupModel = 
delegator.getModelEntity("PartyAndGroup");
             if (partyGroupModel != null && 
partyGroupModel.isField(candidateFieldName)) {
                 if (party == null) {
-                    party = delegator.findOne("PartyAndGroup", 
UtilMisc.toMap("partyId", partyId), true);
+                    party = 
EntityQuery.use(delegator).from("PartyAndGroup").where("partyId", 
partyId).cache().queryOne();
                 }
                 if (party != null) {
                     String candidateValue = 
party.getString(candidateFieldName);
@@ -217,7 +218,7 @@ public class PartyContentWrapper impleme
         // otherwise a content field
         GenericValue partyContent;
         if (contentId != null) {
-            partyContent = delegator.findOne("PartyContent", 
UtilMisc.toMap("partyId", partyId, "contentId", contentId), true);
+            partyContent = 
EntityQuery.use(delegator).from("PartyContent").where("partyId", partyId, 
"contentId", contentId).cache().queryOne();
         } else {
             partyContent = getFirstPartyContentByType(partyId, party, 
partyContentTypeId, delegator);
         }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyHelper.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyHelper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyHelper.java
 Mon Nov  3 06:54:16 2014
@@ -26,6 +26,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * PartyHelper
@@ -43,7 +44,7 @@ public class PartyHelper {
     public static String getPartyName(Delegator delegator, String partyId, 
boolean lastNameFirst) {
         GenericValue partyObject = null;
         try {
-            partyObject = delegator.findOne("PartyNameView", 
UtilMisc.toMap("partyId", partyId), false);
+            partyObject = 
EntityQuery.use(delegator).from("PartyNameView").where("partyId", 
partyId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error finding PartyNameView in getPartyName", 
module);
         }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyRelationshipServices.java
 Mon Nov  3 06:54:16 2014
@@ -33,6 +33,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
@@ -126,14 +127,14 @@ public class PartyRelationshipServices {
 
                 // Before creating the partyRelationShip, create the 
partyRoles if they don't exist
                 GenericValue partyToRole = null;
-                partyToRole = delegator.findOne("PartyRole", 
UtilMisc.toMap("partyId", partyIdTo, "roleTypeId", roleTypeIdTo), false);
+                partyToRole = 
EntityQuery.use(delegator).from("PartyRole").where("partyId", partyIdTo, 
"roleTypeId", roleTypeIdTo).queryOne();
                 if (partyToRole == null) {
                     partyToRole = delegator.makeValue("PartyRole", 
UtilMisc.toMap("partyId", partyIdTo, "roleTypeId", roleTypeIdTo));
                     partyToRole.create();
                 }
 
                 GenericValue partyFromRole= null;
-                partyFromRole = delegator.findOne("PartyRole", 
UtilMisc.toMap("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom), false);
+                partyFromRole = 
EntityQuery.use(delegator).from("PartyRole").where("partyId", partyIdFrom, 
"roleTypeId", roleTypeIdFrom).queryOne();
                 if (partyFromRole == null) {
                     partyFromRole = delegator.makeValue("PartyRole", 
UtilMisc.toMap("partyId", partyIdFrom, "roleTypeId", roleTypeIdFrom));
                     partyFromRole.create();

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

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyTypeHelper.java
 Mon Nov  3 06:54:16 2014
@@ -25,6 +25,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityTypeUtil;
 
 /**
@@ -45,10 +46,10 @@ public class PartyTypeHelper {
         GenericValue partyType = null;
         GenericValue checkedTypeOfParty = null;
         try {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", 
partyId), false);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", 
partyId).queryOne();
             if (UtilValidate.isNotEmpty(party)) {
                 partyType = party.getRelatedOne("PartyType", true);
-                checkedTypeOfParty = delegator.findOne("PartyType", 
UtilMisc.toMap("partyTypeId", checkedPartyType), true);
+                checkedTypeOfParty = 
EntityQuery.use(delegator).from("PartyType").where("partyTypeId", 
checkedPartyType).cache().queryOne();
             } else {
                 return false;
             }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyWorker.java?rev=1636282&r1=1636281&r2=1636282&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyWorker.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/src/org/ofbiz/party/party/PartyWorker.java
 Mon Nov  3 06:54:16 2014
@@ -43,6 +43,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityFunction;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.model.ModelEntity;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 
 /**
@@ -58,7 +59,7 @@ public class PartyWorker {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         Map<String, GenericValue> result = FastMap.newInstance();
         try {
-            GenericValue party = delegator.findOne("Party", 
UtilMisc.toMap("partyId", partyId), false);
+            GenericValue party = 
EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
 
             if (party != null)
                 result.put(partyAttr, party);
@@ -67,7 +68,7 @@ public class PartyWorker {
         }
 
         try {
-            GenericValue person = delegator.findOne("Person", 
UtilMisc.toMap("partyId", partyId), false);
+            GenericValue person = 
EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
 
             if (person != null)
                 result.put(personAttr, person);
@@ -76,7 +77,7 @@ public class PartyWorker {
         }
 
         try {
-            GenericValue partyGroup = delegator.findOne("PartyGroup", 
UtilMisc.toMap("partyId", partyId), false);
+            GenericValue partyGroup = 
EntityQuery.use(delegator).from("PartyGroup").where("partyId", 
partyId).queryOne();
 
             if (partyGroup != null)
                 result.put(partyGroupAttr, partyGroup);
@@ -260,7 +261,7 @@ public class PartyWorker {
             for (GenericValue partyAndAddr: validFound) {
                 String partyId = partyAndAddr.getString("partyId");
                 if (UtilValidate.isNotEmpty(partyId)) {
-                    GenericValue p = delegator.findOne("Person", 
UtilMisc.toMap("partyId", partyId), false);
+                    GenericValue p = 
EntityQuery.use(delegator).from("Person").where("partyId", partyId).queryOne();
                     if (p != null) {
                         String fName = p.getString("firstName");
                         String lName = p.getString("lastName");
@@ -493,7 +494,7 @@ public class PartyWorker {
 
         // 1) look if the idToFind given is a real partyId
         if (searchPartyFirst) {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", 
idToFind), true);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", 
idToFind).cache().queryOne();
         }
 
         if (searchAllId || (searchPartyFirst && UtilValidate.isEmpty(party))) {
@@ -506,7 +507,7 @@ public class PartyWorker {
         }
 
         if (! searchPartyFirst) {
-            party = delegator.findOne("Party", UtilMisc.toMap("partyId", 
idToFind), true);
+            party = EntityQuery.use(delegator).from("Party").where("partyId", 
idToFind).cache().queryOne();
         }
 
         if (UtilValidate.isNotEmpty(party)) {
@@ -549,7 +550,7 @@ public class PartyWorker {
                 GenericValue partyToAdd = party;
                 //retreive party GV if the actual genericValue came from 
viewEntity
                 if (! "Party".equals(party.getEntityName())) {
-                    partyToAdd = delegator.findOne("Party", 
UtilMisc.toMap("partyId", party.get("partyId")), true);
+                    partyToAdd = 
EntityQuery.use(delegator).from("Party").where("partyId", 
party.get("partyId")).cache().queryOne();
                 }
 
                 if (UtilValidate.isEmpty(parties)) {


Reply via email to