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=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceUtil.java Wed 
Dec 17 12:13:46 2014
@@ -45,7 +45,6 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 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;
@@ -399,12 +398,6 @@ public class ServiceUtil {
         EntityCondition finished = EntityCondition.makeCondition(finExp);
 
         EntityCondition doneCond = 
EntityCondition.makeCondition(UtilMisc.toList(cancelled, finished), 
EntityOperator.OR);
-        EntityCondition mainCond = 
EntityCondition.makeCondition(UtilMisc.toList(doneCond, pool));
-
-        // configure the find options
-        EntityFindOptions findOptions = new EntityFindOptions();
-        
findOptions.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
-        findOptions.setMaxRows(1000);
 
         // always suspend the current transaction; use the one internally
         Transaction parent = null;
@@ -426,7 +419,13 @@ public class ServiceUtil {
 
                     EntityListIterator foundJobs = null;
                     try {
-                        foundJobs = delegator.find("JobSandbox", mainCond, 
null, UtilMisc.toSet("jobId"), null, findOptions);
+                        foundJobs = EntityQuery.use(delegator)
+                                               .select("jobId")
+                                               .from("JobSandbox")
+                                               
.where(EntityCondition.makeCondition(UtilMisc.toList(doneCond, pool)))
+                                               .cursorScrollInsensitive()
+                                               .maxRows(1000)
+                                               .queryIterator();
                         curList = foundJobs.getPartialList(1, 1000);
                     } finally {
                         if (foundJobs != null) {
@@ -486,12 +485,12 @@ public class ServiceUtil {
                 // begin this transaction
                 beganTx3 = TransactionUtil.begin();
 
-                runTimeDataIt = delegator.find("RuntimeData", null, null, 
UtilMisc.toSet("runtimeDataId"), null, null);
+                runTimeDataIt = 
EntityQuery.use(delegator).select("runtimeDataId").from("RuntimeData").queryIterator();
                 try {
                     while ((runtimeData = runTimeDataIt.next()) != null) {
                         EntityCondition whereCondition = 
EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("runtimeDataId",
 EntityOperator.NOT_EQUAL, null),
                                 EntityCondition.makeCondition("runtimeDataId", 
EntityOperator.EQUALS, runtimeData.getString("runtimeDataId"))), 
EntityOperator.AND);
-                        jobsandBoxCount = 
delegator.findCountByCondition("JobSandbox", whereCondition, null, null);
+                        jobsandBoxCount = 
EntityQuery.use(delegator).from("JobSandbox").where(whereCondition).queryCount();
                         if 
(BigDecimal.ZERO.compareTo(BigDecimal.valueOf(jobsandBoxCount)) == 0) {
                             runtimeDataToDelete.add(runtimeData);
                         }
@@ -548,7 +547,7 @@ public class ServiceUtil {
 
         GenericValue job = null;
         try {
-            job = delegator.findOne("JobSandbox", fields, false);
+            job = EntityQuery.use(delegator).from("JobSandbox").where("jobId", 
jobId).queryOne();
             if (job != null) {
                 job.set("cancelDateTime", UtilDateTime.nowTimestamp());
                 job.set("statusId", "SERVICE_CANCELLED");
@@ -587,7 +586,7 @@ public class ServiceUtil {
 
         GenericValue job = null;
         try {
-            job = delegator.findOne("JobSandbox", fields, false);
+            job = EntityQuery.use(delegator).from("JobSandbox").where("jobId", 
jobId).queryOne();
             if (job != null) {
                 job.set("maxRetry", Long.valueOf(0));
                 job.store();
@@ -666,10 +665,9 @@ public class ServiceUtil {
         }
 
         String jobId = (String) context.get("jobId");
-        Map<String, ? extends Object> fields = UtilMisc.toMap("jobId", jobId);
         GenericValue job;
         try {
-            job = delegator.findOne("JobSandbox", fields, false);
+            job = EntityQuery.use(delegator).from("JobSandbox").where("jobId", 
jobId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/ExpressionUiHelper.java
 Wed Dec 17 12:13:46 2014
@@ -32,6 +32,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 com.ibm.icu.util.Calendar;
 
@@ -140,13 +141,17 @@ public class ExpressionUiHelper {
      * @return Set of candidate tempExprId Strings
      */
     public static Set<String> getCandidateIncludeIds(Delegator delegator, 
String tempExprId) throws GenericEntityException {
-        List<GenericValue> findList = 
delegator.findList("TemporalExpressionAssoc", 
EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, 
true);
+        List<GenericValue> findList = EntityQuery.use(delegator)
+                                                 
.from("TemporalExpressionAssoc")
+                                                 .where("fromTempExprId", 
tempExprId)
+                                                 .cache(true)
+                                                 .queryList();
         Set<String> excludedIds = new HashSet<String>();
         for (GenericValue value : findList) {
             excludedIds.add(value.getString("toTempExprId"));
         }
         excludedIds.add(tempExprId);
-        findList = delegator.findList("TemporalExpression", null, null, null, 
null, true);
+        findList = 
EntityQuery.use(delegator).from("TemporalExpression").cache(true).queryList();
         Set<String> candidateIds = new HashSet<String>();
         for (GenericValue value : findList) {
             candidateIds.add(value.getString("tempExprId"));

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=1646212&r1=1646211&r2=1646212&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
 Wed Dec 17 12:13:46 2014
@@ -94,7 +94,7 @@ public class TemporalExpressionWorker {
         } else if (DayOfWeekRange.equals(tempExprTypeId)) {
             return setExpressionId(exprValue, new 
TemporalExpressions.DayOfWeekRange(exprValue.getLong("integer1").intValue(), 
exprValue.getLong("integer2").intValue()));
         } else if (Difference.equals(tempExprTypeId)) {
-            List<GenericValue> childExpressions = 
delegator.findList("TemporalExpressionAssoc", 
EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, 
true);
+            List<GenericValue> childExpressions = 
EntityQuery.use(delegator).from("TemporalExpressionAssoc").where("fromTempExprId",
 tempExprId).cache(true).queryList();
             GenericValue inclAssoc = null;
             GenericValue exclAssoc = null;
             for (GenericValue childExpression : childExpressions) {
@@ -118,7 +118,7 @@ public class TemporalExpressionWorker {
         } else if (MonthRange.equals(tempExprTypeId)) {
             return setExpressionId(exprValue, new 
TemporalExpressions.MonthRange(exprValue.getLong("integer1").intValue(), 
exprValue.getLong("integer2").intValue()));
         } else if (Substitution.equals(tempExprTypeId)) {
-            List<GenericValue> childExpressions = 
delegator.findList("TemporalExpressionAssoc", 
EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, 
true);
+            List<GenericValue> childExpressions = 
EntityQuery.use(delegator).from("TemporalExpressionAssoc").where("fromTempExprId",
 tempExprId).cache(true).queryList();
             GenericValue inclAssoc = null;
             GenericValue exclAssoc = null;
             GenericValue substAssoc = null;
@@ -141,7 +141,7 @@ public class TemporalExpressionWorker {
     }
 
     protected static Set<TemporalExpression> getChildExpressions(Delegator 
delegator, String tempExprId) throws GenericEntityException {
-        List<GenericValue> valueList = 
delegator.findList("TemporalExpressionAssoc", 
EntityCondition.makeCondition("fromTempExprId", tempExprId), null, null, null, 
true);
+        List<GenericValue> valueList = 
EntityQuery.use(delegator).from("TemporalExpressionAssoc").where("fromTempExprId",
 tempExprId).cache(true).queryList();
         if (UtilValidate.isEmpty(valueList)) {
             throw new IllegalArgumentException("tempExprId argument invalid - 
no child expressions found");
         }

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Wed 
Dec 17 12:13:46 2014
@@ -45,6 +45,7 @@ import org.ofbiz.entity.serialize.Serial
 import org.ofbiz.entity.serialize.XmlSerializer;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceContainer;
@@ -191,7 +192,7 @@ public final class JobManager {
                 Debug.logWarning("Unable to poll JobSandbox for jobs; unable 
to begin transaction.", module);
                 return poll;
             }
-            jobsIterator = delegator.find("JobSandbox", mainCondition, null, 
null, UtilMisc.toList("runTime"), null);
+            jobsIterator = 
EntityQuery.use(delegator).from("JobSandbox").where(mainCondition).orderBy("runTime").queryIterator();
             GenericValue jobValue = jobsIterator.next();
             while (jobValue != null) {
                 // Claim ownership of this value. Using storeByCondition to 
avoid a race condition.
@@ -247,7 +248,7 @@ public final class JobManager {
                     Debug.logWarning("Unable to poll JobSandbox for jobs; 
unable to begin transaction.", module);
                     return Collections.emptyList();
                 }
-                jobsIterator = delegator.find("JobSandbox", mainCondition, 
null, null, UtilMisc.toList("jobId"), null);
+                jobsIterator = 
EntityQuery.use(delegator).from("JobSandbox").where(mainCondition).orderBy("jobId").queryIterator();
                 GenericValue jobValue = jobsIterator.next();
                 while (jobValue != null) {
                     poll.add(new PurgeJob(jobValue));
@@ -291,7 +292,7 @@ public final class JobManager {
         EntityCondition statusCondition = 
EntityCondition.makeCondition(statusExprList, EntityOperator.OR);
         EntityCondition mainCondition = 
EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("runByInstanceId",
 instanceId), statusCondition));
         try {
-            crashed = delegator.findList("JobSandbox", mainCondition, null, 
UtilMisc.toList("startDateTime"), null, false);
+            crashed = 
EntityQuery.use(delegator).from("JobSandbox").where(mainCondition).orderBy("startDateTime").queryList();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, "Unable to load crashed jobs", module);
         }

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java
 Wed Dec 17 12:13:46 2014
@@ -39,6 +39,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityFieldMap;
 import org.ofbiz.entity.serialize.SerializeException;
 import org.ofbiz.entity.serialize.XmlSerializer;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericRequester;
 import org.ofbiz.service.ServiceUtil;
@@ -321,8 +322,7 @@ public class PersistedServiceJob extends
         }
         long count = 0;
         try {
-            EntityFieldMap ecl = 
EntityCondition.makeConditionMap("parentJobId", pJobId, "statusId", 
"SERVICE_FAILED");
-            count = delegator.findCountByCondition("JobSandbox", ecl, null, 
null);
+            count = 
EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", pJobId, 
"statusId", "SERVICE_FAILED").queryCount();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Exception thrown while counting retries: ", 
module);
         }

Modified: 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
 (original)
+++ 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
 Wed Dec 17 12:13:46 2014
@@ -26,6 +26,7 @@ import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.service.testtools.OFBizTestCase;
 
@@ -50,7 +51,7 @@ public class ServiceEntityAutoTests exte
         testingPkPresentMap.put("testingName", "entity auto testing");
         Map<String, Object> results = 
dispatcher.runSync("testEntityAutoCreateTestingPkPresent", testingPkPresentMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        GenericValue testing = delegator.findOne("Testing", false, 
"testingId", "TESTING_1");
+        GenericValue testing = 
EntityQuery.use(delegator).from("Testing").where("testingId", 
"TESTING_1").queryOne();
         assertNotNull(testing);
 
         //test create with auto sequence
@@ -58,7 +59,7 @@ public class ServiceEntityAutoTests exte
         testingPkPresentMap.put("testingName", "entity auto testing without pk 
part in");
         results = dispatcher.runSync("testEntityAutoCreateTestingPkMissing", 
testingPkMissingMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        testing = delegator.findOne("Testing", false, "testingId", 
results.get("testingId"));
+        testing = 
EntityQuery.use(delegator).from("Testing").where("testingId", 
results.get("testingId")).queryOne();
         assertNotNull(testing);
 
         //test collision
@@ -73,14 +74,20 @@ public class ServiceEntityAutoTests exte
         Map<String, Object> testingItemPkPresentMap = 
UtilMisc.toMap("testingId", "TESTING_2", "testingSeqId", "00001");
         Map<String, Object> results = 
dispatcher.runSync("testEntityAutoCreateTestingItemPkPresent", 
testingItemPkPresentMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        GenericValue testingItem = delegator.findOne("TestingItem", false, 
"testingId", "TESTING_2", "testingSeqId", "00001");
+        GenericValue testingItem = EntityQuery.use(delegator)
+                                              .from("TestingItem")
+                                              .where("testingId", "TESTING_2", 
"testingSeqId", "00001")
+                                              .queryOne();
         assertNotNull(testingItem);
 
         //test create with auto sub-sequence
         Map<String, Object> testingItemPkMissingMap = 
UtilMisc.toMap("testingId", "TESTING_2");
         results = 
dispatcher.runSync("testEntityAutoCreateTestingItemPkMissing", 
testingItemPkMissingMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        testingItem = delegator.findOne("TestingItem", false, "testingId", 
"TESTING_2", "testingSeqId", results.get("testingSeqId"));
+        testingItem = EntityQuery.use(delegator)
+                                 .from("TestingItem")
+                                 .where("testingId", "TESTING_2", 
"testingSeqId", results.get("testingSeqId"))
+                                 .queryOne();
         assertNotNull(testingItem);
         assertEquals("00002", testingItem.get("testingSeqId"));
 
@@ -99,7 +106,10 @@ public class ServiceEntityAutoTests exte
                 "testingNodeId", "NODE_1", "fromDate", 
UtilDateTime.toTimestamp("01/01/2010 00:00:00"));
         Map<String, Object> results = 
dispatcher.runSync("testEntityAutoCreateTestingNodeMemberPkPresent", 
testingNodeMemberPkPresentMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        GenericValue testingNodeMember = 
delegator.findOne("TestingNodeMember", false, testingNodeMemberPkPresentMap);
+        GenericValue testingNodeMember = EntityQuery.use(delegator)
+                                                    .from("TestingNodeMember")
+                                                    
.where(testingNodeMemberPkPresentMap)
+                                                    .queryOne();
         assertNotNull(testingNodeMember);
         testingNodeMember.remove();
 
@@ -117,7 +127,7 @@ public class ServiceEntityAutoTests exte
         Map<String, Object> testingUpdateMap = UtilMisc.toMap("testingId", 
"TESTING_4", "testingName", "entity auto testing updated");
         Map<String, Object> results = 
dispatcher.runSync("testEntityAutoUpdateTesting", testingUpdateMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        GenericValue testing = delegator.findOne("Testing", false, 
"testingId", "TESTING_4");
+        GenericValue testing = 
EntityQuery.use(delegator).from("Testing").where("testingId", 
"TESTING_4").queryOne();
         assertEquals("entity auto testing updated", 
testing.getString("testingName"));
 
         //test update with bad pk
@@ -134,7 +144,7 @@ public class ServiceEntityAutoTests exte
         Map<String, Object> testingDeleteMap = UtilMisc.toMap("testingId", 
"TESTING_5");
         Map<String, Object> results = 
dispatcher.runSync("testEntityAutoRemoveTesting", testingDeleteMap);
         assertTrue(ServiceUtil.isSuccess(results));
-        GenericValue testing = delegator.findOne("Testing", false, 
"testingId", "TESTING_5");
+        GenericValue testing = 
EntityQuery.use(delegator).from("Testing").where("testingId", 
"TESTING_5").queryOne();
         assertNull(testing);
 
         //test create with bad pk

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java 
(original)
+++ 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java 
Wed Dec 17 12:13:46 2014
@@ -47,6 +47,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.security.Security;
 import org.ofbiz.security.SecurityConfigurationException;
@@ -258,14 +259,14 @@ public class ContextFilter implements Fi
 
                 //Use base delegator for fetching data from entity of 
entityGroup org.ofbiz.tenant 
                 Delegator baseDelegator = 
DelegatorFactory.getDelegator(delegator.getDelegatorBaseName());
-                GenericValue tenantDomainName = 
baseDelegator.findOne("TenantDomainName", UtilMisc.toMap("domainName", 
serverName), false);
+                GenericValue tenantDomainName = 
EntityQuery.use(baseDelegator).from("TenantDomainName").where("domainName", 
serverName).queryOne();
 
                 if (UtilValidate.isNotEmpty(tenantDomainName)) {
                     String tenantId = tenantDomainName.getString("tenantId");
 
                     // if the request path is a root mount then redirect to 
the initial path
                     if (UtilValidate.isNotEmpty(requestPath) && 
requestPath.equals(contextUri)) {
-                        GenericValue tenant = baseDelegator.findOne("Tenant", 
UtilMisc.toMap("tenantId", tenantId), false);
+                        GenericValue tenant = 
EntityQuery.use(baseDelegator).from("Tenant").where("tenantId", 
tenantId).queryOne();
                         String initialPath = tenant.getString("initialPath");
                         if (UtilValidate.isNotEmpty(initialPath) && 
!"/".equals(initialPath)) {
                             
((HttpServletResponse)response).sendRedirect(initialPath);

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=1646212&r1=1646211&r2=1646212&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 
Wed Dec 17 12:13:46 2014
@@ -1020,7 +1020,7 @@ public class LoginWorker {
 
         EntityConditionList<EntityCondition> condition = 
EntityCondition.makeCondition(conds);
         Debug.logInfo("Doing issuer lookup: " + condition.toString(), module);
-        long count = delegator.findCountByCondition("X509IssuerProvision", 
condition, null, null);
+        long count = 
EntityQuery.use(delegator).from("X509IssuerProvision").where(condition).queryCount();
         return count > 0;
     }
 
@@ -1180,7 +1180,7 @@ public class LoginWorker {
         if (reqToChangePwdInDays > 0) {
             List<GenericValue> passwordHistories = null;
             try {
-                passwordHistories = 
delegator.findByAnd("UserLoginPasswordHistory", UtilMisc.toMap("userLoginId", 
userName), null, false);
+                passwordHistories = 
EntityQuery.use(delegator).from("UserLoginPasswordHistory").where("userLoginId",
 userName).queryList();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Cannot get user's password history record: 
" + e.getMessage(), module);
             }

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java
 (original)
+++ 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ProtectViewWorker.java
 Wed Dec 17 12:13:46 2014
@@ -34,6 +34,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;
 
 /**
  * Common Workers
@@ -64,15 +65,21 @@ public class ProtectViewWorker {
         if (userLogin != null) {
             String userLoginId = userLogin.getString("userLoginId");
             try {
-                List<GenericValue> protectedViews = 
delegator.findByAnd("UserLoginAndProtectedView",
-                        UtilMisc.toMap("userLoginId", userLoginId, 
"viewNameId", viewNameId), null, true);
+                List<GenericValue> protectedViews = EntityQuery.use(delegator)
+                                                               
.from("UserLoginAndProtectedView")
+                                                               
.where("userLoginId", userLoginId, "viewNameId", viewNameId)
+                                                               .cache(true)
+                                                               .queryList();
                 // Any views to deal with ?
                 if (UtilValidate.isNotEmpty(protectedViews)) {
                     Long now = System.currentTimeMillis(); // we are not in a 
margin of some milliseconds
 
                     // Is this login/view couple already tarpitted ? (ie 
denied access to view for login for a period of time)
-                    List<GenericValue> tarpittedLoginViews = 
delegator.findByAnd("TarpittedLoginView",
-                            UtilMisc.toMap("userLoginId", userLoginId, 
"viewNameId", viewNameId), null, true);
+                    List<GenericValue> tarpittedLoginViews = 
EntityQuery.use(delegator)
+                                                                        
.from("TarpittedLoginView")
+                                                                        
.where("userLoginId", userLoginId, "viewNameId", viewNameId)
+                                                                        
.cache(true)
+                                                                        
.queryList();
                     String  viewNameUserLoginId = viewNameId + userLoginId;
                     if (UtilValidate.isNotEmpty(tarpittedLoginViews)) {
                         GenericValue tarpittedLoginView = 
tarpittedLoginViews.get(0);

Modified: 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java 
(original)
+++ 
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/website/WebSiteWorker.java 
Wed Dec 17 12:13:46 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;
 
 /**
  * WebSiteWorker - Worker class for web site related functionality
@@ -72,7 +73,7 @@ public class WebSiteWorker {
     public static GenericValue findWebSite(Delegator delegator, String 
webSiteId, boolean useCache) {
         GenericValue result = null;
         try {
-            result = delegator.findOne("WebSite", useCache, 
UtilMisc.toMap("webSiteId", webSiteId));
+            result = 
EntityQuery.use(delegator).from("WebSite").where("webSiteId", 
webSiteId).cache(useCache).queryOne();
         }
         catch (GenericEntityException e) {
             Debug.logError("Error looking up website with id " + webSiteId, 
module);

Modified: 
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java 
(original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/GenericWebEvent.java 
Wed Dec 17 12:13:46 2014
@@ -39,6 +39,7 @@ import org.ofbiz.entity.model.ModelEntit
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.model.ModelFieldType;
 import org.ofbiz.entity.model.ModelReader;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.security.Security;
 
 /**
@@ -206,7 +207,7 @@ public class GenericWebEvent {
             GenericValue tempEntity = null;
 
             try {
-                tempEntity = delegator.findOne(findByEntity.getEntityName(), 
findByEntity.getPrimaryKey(), false);
+                tempEntity = 
EntityQuery.use(delegator).from(findByEntity.getEntityName()).where(findByEntity.getPrimaryKey()).queryOne();
             } catch (GenericEntityException e) {
                 String errMsg = 
UtilProperties.getMessage(GenericWebEvent.err_resource, 
"genericWebEvent.create_failed_by_check", locale) + ": " + e.toString();
                 Debug.logWarning(e, errMsg, module);

Modified: 
ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java 
(original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java 
Wed Dec 17 12:13:46 2014
@@ -79,6 +79,7 @@ import org.ofbiz.entity.transaction.Tran
 import org.ofbiz.entity.util.EntityDataAssert;
 import org.ofbiz.entity.util.EntityDataLoader;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntitySaxReader;
 import org.ofbiz.entityext.EntityGroupUtil;
 import org.ofbiz.security.Security;
@@ -512,7 +513,7 @@ public class WebToolsServices {
                             if (UtilValidate.isNotEmpty(fromDate)) {
                                 
conds.add(EntityCondition.makeCondition("createdStamp", 
EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
                             }
-                            values = delegator.find(curEntityName, 
EntityCondition.makeCondition(conds), null, null, me.getPkFieldNames(), null);
+                            values = 
EntityQuery.use(delegator).from(curEntityName).where(conds).orderBy(me.getPkFieldNames()).queryIterator();
                         } catch (Exception entityEx) {
                             results.add("["+fileNumber +"] [xxx] Error when 
writing " + curEntityName + ": " + entityEx);
                             continue;

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java 
(original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java Wed 
Dec 17 12:13:46 2014
@@ -32,6 +32,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.security.Security;
 
@@ -67,17 +68,16 @@ public class PortalPageWorker {
                                 
EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, 
parentPortalPageId)),
                                 EntityOperator.OR)),
                         EntityOperator.AND);
-                portalPages = delegator.findList("PortalPage", cond, null, 
null, null, false);
+                portalPages = 
EntityQuery.use(delegator).from("PortalPage").where(cond).queryList();
                 List<GenericValue> userPortalPages = new 
ArrayList<GenericValue>();
                 if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // 
check if a user is logged in
                     String userLoginId = 
((GenericValue)context.get("userLogin")).getString("userLoginId");
                     // replace with private pages
                     for (GenericValue portalPage : portalPages) {
-                        cond = EntityCondition.makeCondition(UtilMisc.toList(
-                                
EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, 
userLoginId),
-                                
EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, 
portalPage.getString("portalPageId"))),
-                                EntityOperator.AND);
-                        List <GenericValue> privatePortalPages = 
delegator.findList("PortalPage", cond, null, null, null, false);
+                        List<GenericValue> privatePortalPages = 
EntityQuery.use(delegator)
+                                                                           
.from("PortalPage")
+                                                                           
.where("ownerUserLoginId", userLoginId, "originalPortalPageId", 
portalPage.getString("portalPageId"))
+                                                                           
.queryList();
                         if (UtilValidate.isNotEmpty(privatePortalPages)) {
                             userPortalPages.add(privatePortalPages.get(0));
                         } else {
@@ -85,12 +85,10 @@ public class PortalPageWorker {
                         }
                     }
                     // add any other created private pages
-                    cond = EntityCondition.makeCondition(UtilMisc.toList(
-                            EntityCondition.makeCondition("ownerUserLoginId", 
EntityOperator.EQUALS, userLoginId),
-                            
EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, 
null),
-                            
EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, 
parentPortalPageId)),
-                            EntityOperator.AND);
-                    userPortalPages.addAll(delegator.findList("PortalPage", 
cond, null, null, null, false));
+                    userPortalPages.addAll(EntityQuery.use(delegator)
+                                                      .from("PortalPage")
+                                                      
.where("ownerUserLoginId", userLoginId, "originalPortalPageId", null, 
"parentPortalPageId", parentPortalPageId)
+                                                      .queryList());
                 }
                 portalPages = EntityUtil.orderBy(userPortalPages, 
UtilMisc.toList("sequenceNum"));
             } catch (GenericEntityException e) {
@@ -123,7 +121,7 @@ public class PortalPageWorker {
                         EntityCondition.makeCondition("ownerUserLoginId", 
EntityOperator.EQUALS, userLoginId)),
                         EntityOperator.OR)),
                     EntityOperator.AND);
-                List <GenericValue> portalPages = 
delegator.findList("PortalPage", cond, null, null, null, false);
+                List <GenericValue> portalPages = 
EntityQuery.use(delegator).from("PortalPage").where(cond).queryList();
                 if (UtilValidate.isNotEmpty(portalPages)) {
                     portalPage = EntityUtil.getFirst(portalPages);
                 }
@@ -133,7 +131,7 @@ public class PortalPageWorker {
                         EntityCondition.makeCondition("originalPortalPageId", 
EntityOperator.EQUALS, portalPageId),
                         EntityCondition.makeCondition("ownerUserLoginId", 
EntityOperator.EQUALS, userLoginId)),
                         EntityOperator.AND);
-                List <GenericValue> privateDerivedPortalPages = 
delegator.findList("PortalPage", cond, null, null, null, false);
+                List <GenericValue> privateDerivedPortalPages = 
EntityQuery.use(delegator).from("PortalPage").where(cond).queryList();
                 if (UtilValidate.isNotEmpty(privateDerivedPortalPages)) {
                     portalPage = 
EntityUtil.getFirst(privateDerivedPortalPages);
                 }
@@ -160,8 +158,7 @@ public class PortalPageWorker {
                 Boolean hasPortalAdminPermission = 
security.hasPermission("PORTALPAGE_ADMIN", userLogin);
                 try {
                     Delegator delegator = WidgetWorker.getDelegator(context);
-                    GenericValue portalPage = delegator.findOne("PortalPage", 
UtilMisc.toMap("portalPageId", portalPageId),false);
-
+                    GenericValue portalPage = 
EntityQuery.use(delegator).from("PortalPage").where("portalPageId", 
portalPageId).queryOne();
                     if (UtilValidate.isNotEmpty(portalPage)) {
                         String ownerUserLoginId = (String) 
portalPage.get("ownerUserLoginId");
                         // Users with PORTALPAGE_ADMIN permission can 
configure every Portal Page

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java 
(original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java 
Wed Dec 17 12:13:46 2014
@@ -60,6 +60,7 @@ import org.ofbiz.entity.finder.EntityFin
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.model.ModelReader;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -1614,8 +1615,7 @@ public class ModelFormField {
                 Locale locale = UtilMisc.ensureLocale(context.get("locale"));
 
                 List<GenericValue> values = null;
-                values = delegator.findList(this.entityName, findCondition, 
null, this.orderByList, null, this.cache);
-
+                values = 
EntityQuery.use(delegator).from(this.entityName).where(findCondition).orderBy(this.orderByList).cache(this.cache).queryList();
                 // filter-by-date if requested
                 if ("true".equals(this.filterByDate)) {
                     values = EntityUtil.filterByDate(values, true);
@@ -2228,7 +2228,7 @@ public class ModelFormField {
             Delegator delegator = WidgetWorker.getDelegator(context);
             String fieldValue = getModelFormField().getEntry(context);
             try {
-                value = delegator.findOne(this.entityName, this.cache, 
fieldKey, fieldValue);
+                value = 
EntityQuery.use(delegator).from(this.entityName).where(fieldKey, 
fieldValue).cache(this.cache).queryOne();
             } catch (GenericEntityException e) {
                 String errMsg = "Error getting value from the database for 
display of field [" + getModelFormField().getName()
                         + "] on form [" + 
getModelFormField().modelForm.getName() + "]: " + e.toString();

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java 
(original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java 
Wed Dec 17 12:13:46 2014
@@ -1671,8 +1671,10 @@ public abstract class ModelScreenWidget
                     portalPage = 
PortalPageWorker.getPortalPage(expandedPortalPageId, context);
                 } else {
                     try {
-                        portalPage = 
EntityQuery.use(delegator).from("PortalPage").where("portalPageId", 
expandedPortalPageId)
-                                .cache().queryOne();
+                        portalPage = EntityQuery.use(delegator)
+                                                .from("PortalPage")
+                                                .where("portalPageId", 
expandedPortalPageId)
+                                                .cache().queryOne();
                     } catch (GenericEntityException e) {
                         throw new RuntimeException(e);
                     }
@@ -1695,9 +1697,13 @@ public abstract class ModelScreenWidget
                 List<GenericValue> portletAttributes = null;
                 GenericValue portalPage = getPortalPageValue(context);
                 String actualPortalPageId = 
portalPage.getString("portalPageId");
-                portalPageColumns = delegator.findByAnd("PortalPageColumn", 
UtilMisc.toMap("portalPageId", actualPortalPageId),
-                        UtilMisc.toList("columnSeqId"), true);
-
+                portalPageColumns = EntityQuery.use(delegator)
+                                               .from("PortalPageColumn")
+                                               .where("portalPageId", 
actualPortalPageId)
+                                               .orderBy("columnSeqId")
+                                               .cache(true)
+                                               .queryList();
+                
                 // Renders the portalPage header
                 screenStringRenderer.renderPortalPageBegin(writer, context, 
this);
                 
@@ -1714,8 +1720,11 @@ public abstract class ModelScreenWidget
                     screenStringRenderer.renderPortalPageColumnBegin(writer, 
context, this, columnValue);
 
                     // Get the Portlets located in the current column
-                    portalPagePortlets = 
delegator.findByAnd("PortalPagePortletView", UtilMisc.toMap("portalPageId", 
portalPage.getString("portalPageId"), "columnSeqId", columnSeqId), 
UtilMisc.toList("sequenceNum"), false);
-                    
+                    portalPagePortlets = EntityQuery.use(delegator)
+                                                    
.from("PortalPagePortletView")
+                                                    .where("portalPageId", 
portalPage.getString("portalPageId"), "columnSeqId", columnSeqId)
+                                                    .orderBy("sequenceNum")
+                                                    .queryList();
                     // First Portlet in a Column has no previous Portlet
                     String prevPortletId = "";
                     String prevPortletSeqId = "";
@@ -1748,9 +1757,11 @@ public abstract class ModelScreenWidget
                         context.put("nextColumnSeqId", nextColumnSeqId);
                        
                         // Get portlet's attributes
-                        portletAttributes = 
delegator.findList("PortletAttribute",
-                            
EntityCondition.makeCondition(UtilMisc.toMap("portalPageId", 
portletValue.get("portalPageId"), "portalPortletId", 
portletValue.get("portalPortletId"), "portletSeqId", 
portletValue.get("portletSeqId"))),
-                            null, null, null, false);
+                        portletAttributes = EntityQuery.use(delegator)
+                                                       
.from("PortletAttribute")
+                                                       .where("portalPageId", 
portletValue.get("portalPageId"), "portalPortletId", 
portletValue.get("portalPortletId"), "portletSeqId", 
portletValue.get("portletSeqId"))
+                                                       .queryList();
+                        
                         ListIterator <GenericValue>attributesIterator = 
portletAttributes.listIterator();
                         while (attributesIterator.hasNext()) {
                             GenericValue attribute = attributesIterator.next();

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=1646212&r1=1646211&r2=1646212&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java 
(original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Wed 
Dec 17 12:13:46 2014
@@ -49,6 +49,7 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.widget.ModelWidget;
 import org.ofbiz.widget.ModelWidgetAction;
@@ -519,7 +520,7 @@ public class ModelTree extends ModelWidg
                 }
                 try {
                     if (id != null && modelEntity.getPksSize() == 1) {
-                        GenericValue entity = delegator.findOne(entName, 
UtilMisc.toMap(pkName, id), false);
+                        GenericValue entity = 
EntityQuery.use(delegator).from(entName).where(pkName, id).queryOne();
                         if (modelEntity.isField("childBranchCount")) {
                             entity.put("childBranchCount", nodeCount);
                             entity.store();


Reply via email to