svn commit: r1646916 [2/5] - in /ofbiz/trunk/applications: accounting/webapp/accounting/WEB-INF/actions/admin/ accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/ accounting/webapp/accounting/WEB-INF/actions/fixedasset/ accounting/webapp/acco...

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

svn commit: r1646916 [2/5] - in /ofbiz/trunk/applications: accounting/webapp/accounting/WEB-INF/actions/admin/ accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/ accounting/webapp/accounting/WEB-INF/actions/fixedasset/ accounting/webapp/acco...

ashish-18
Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy Sat Dec 20 04:31:20 2014
@@ -31,8 +31,8 @@ import org.ofbiz.entity.util.*;
 //TODO:
 
 // get products and categories under the root category
-productMemberList = delegator.findByAnd("ProductCategoryMember", [productCategoryId : rootProductCategoryId], ["sequenceNum"], false);
-categoryRollupList = delegator.findByAnd("ProductCategoryRollup", [parentProductCategoryId : rootProductCategoryId], ["sequenceNum"], false);
+productMemberList = from("ProductCategoryMember").where("productCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList();
+categoryRollupList = from("ProductCategoryRollup").where("parentProductCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList();
 
 // for use in the queries
 productIdSet = FastSet.newInstance();
@@ -55,8 +55,6 @@ categoryRollupList.each { categoryRollup
     productCategoryIdSet.add(categoryRollup.productCategoryId);
 }
 
-productFieldsToSelect = UtilMisc.toSet("productId", "quantityTotal", "amountTotal");
-
 //NOTE: tax, etc also have productId on them, so restrict by type INV_PROD_ITEM, INV_FPROD_ITEM, INV_DPROD_ITEM, others?
 baseProductAndExprs = FastList.newInstance();
 baseProductAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"));
@@ -65,8 +63,6 @@ baseProductAndExprs.add(EntityCondition.
 if (organizationPartyId) baseProductAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId));
 if (currencyUomId) baseProductAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId));
 
-categoryFieldsToSelect = UtilMisc.toSet("productCategoryId", "quantityTotal", "amountTotal");
-
 baseCategoryAndExprs = FastList.newInstance();
 baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"));
 baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"]));
@@ -104,8 +100,6 @@ for (int currentDay = 0; currentDay <= d
     currentDayCal.add(Calendar.DAY_OF_MONTH, 1);
     nextDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis());
 
-    findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
-
     // do the product find
     productAndExprs = FastList.newInstance();
     productAndExprs.addAll(baseProductAndExprs);
@@ -113,7 +107,7 @@ for (int currentDay = 0; currentDay <= d
     productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
     productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
 
-    productResultListIterator = delegator.find("InvoiceItemProductSummary", EntityCondition.makeCondition(productAndExprs, EntityOperator.AND), null, productFieldsToSelect, null, findOpts);
+    productResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
     productResultMap = FastMap.newInstance();
     while ((productResult = productResultListIterator.next())) {
         productResultMap[productResult.productId] = productResult;
@@ -130,7 +124,7 @@ for (int currentDay = 0; currentDay <= d
     categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
     categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
 
-    categoryResultListIterator = delegator.find("InvoiceItemCategorySummary", EntityCondition.makeCondition(categoryAndExprs, EntityOperator.AND), null, categoryFieldsToSelect, null, findOpts);
+    categoryResultListIterator = select("productCategoryId", "quantityTotal", "amountTotal").from(InvoiceItemCategorySummary).where(categoryAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
     categoryResultMap = FastMap.newInstance();
     while ((categoryResult = categoryResultListIterator.next())) {
         categoryResultMap[categoryResult.productCategoryId] = categoryResult;
@@ -147,7 +141,7 @@ for (int currentDay = 0; currentDay <= d
     productNullAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, null));
     productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
     productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
-    productNullResultListIterator = delegator.find("InvoiceItemProductSummary", EntityCondition.makeCondition(productNullAndExprs, EntityOperator.AND), null, productFieldsToSelect, null, findOpts);
+    productNullResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productNullAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
     // should just be 1 result
     productNullResult = productNullResultListIterator.next();
     productNullResultListIterator.close();

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Sat Dec 20 04:31:20 2014
@@ -61,24 +61,19 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, glFiscalTypeId));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
 if (postedTransactionTotals) {
     Map postedTransactionTotalsMap = [:]
     postedTransactionTotals.each { postedTransactionTotal ->
         Map accountMap = (Map)postedTransactionTotalsMap.get(postedTransactionTotal.glAccountId);
         if (!accountMap) {
-            GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", postedTransactionTotal.glAccountId), true);
+            GenericValue glAccount = from("GlAccount").where("glAccountId", postedTransactionTotal.glAccountId).cache(true).queryOne();
             if (glAccount) {
                 boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
                 // Get the opening balances at the end of the last closed time period
                 if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
                     if (lastClosedTimePeriod) {
-                        List timePeriodAndExprs = FastList.newInstance();
-                        timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
-                        timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, postedTransactionTotal.glAccountId));
-                        timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-                        lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+                        lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", organizationPartyId, "glAccountId", postedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst();
                         if (lastTimePeriodHistory) {
                             accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
                         }
@@ -102,7 +97,7 @@ if (postedTransactionTotals) {
             mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
             mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
             mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
-            transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+            transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
             transactionTotals.each { transactionTotal ->
                 UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
             }
@@ -120,8 +115,7 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List postedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
 if (postedDebitTransactionTotals) {
     postedDebitTransactionTotal = postedDebitTransactionTotals.first();
     if (postedDebitTransactionTotal && postedDebitTransactionTotal.amount) {
@@ -136,8 +130,7 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "C"));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List postedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
 if (postedCreditTransactionTotals) {
     postedCreditTransactionTotal = postedCreditTransactionTotals.first();
     if (postedCreditTransactionTotal && postedCreditTransactionTotal.amount) {
@@ -159,23 +152,19 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
 andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List unpostedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
 if (unpostedTransactionTotals) {
     Map unpostedTransactionTotalsMap = [:]
     unpostedTransactionTotals.each { unpostedTransactionTotal ->
         Map accountMap = (Map)unpostedTransactionTotalsMap.get(unpostedTransactionTotal.glAccountId);
         if (!accountMap) {
-            GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", unpostedTransactionTotal.glAccountId), true);
+            GenericValue glAccount = from("GlAccount").where("glAccountId", unpostedTransactionTotal.glAccountId).cache(true).queryOne();
             if (glAccount) {
                 boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
                 // Get the opening balances at the end of the last closed time period
                 if (UtilAccounting.isAssetAccount(glAccount) || UtilAccounting.isLiabilityAccount(glAccount) || UtilAccounting.isEquityAccount(glAccount)) {
                     if (lastClosedTimePeriod) {
-                        List timePeriodAndExprs = FastList.newInstance();
-                        timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
-                        timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, unpostedTransactionTotal.glAccountId));
-                        timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-                        lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+                        lastTimePeriodHistory = from("GlAccountAndHistory").where("organizationPartyId", organizationPartyId, "glAccountId", unpostedTransactionTotal.glAccountId, "customTimePeriodId", lastClosedTimePeriod.customTimePeriodId).queryFirst();
                         if (lastTimePeriodHistory) {
                             accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
                         }
@@ -199,7 +188,7 @@ if (unpostedTransactionTotals) {
             mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
             mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
             mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
-            transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+            transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
             transactionTotals.each { transactionTotal ->
                 UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
             }
@@ -217,8 +206,7 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List unpostedDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
 if (unpostedDebitTransactionTotals) {
     unpostedDebitTransactionTotal = unpostedDebitTransactionTotals.first();
     if (unpostedDebitTransactionTotal && unpostedDebitTransactionTotal.amount) {
@@ -234,7 +222,7 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
 andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List unpostedCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List unpostedCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
 if (unpostedCreditTransactionTotals) {
     unpostedCreditTransactionTotal = unpostedCreditTransactionTotals.first();
     if (unpostedCreditTransactionTotal && unpostedCreditTransactionTotal.amount) {
@@ -255,13 +243,13 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
 andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List allTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andExprs).orderBy("glAccountId").queryList();
 if (allTransactionTotals) {
     Map allTransactionTotalsMap = [:]
     allTransactionTotals.each { allTransactionTotal ->
         Map accountMap = (Map)allTransactionTotalsMap.get(allTransactionTotal.glAccountId);
         if (!accountMap) {
-            GenericValue glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", allTransactionTotal.glAccountId), true);
+            GenericValue glAccount = from("GlAccount").where("glAccountId", allTransactionTotal.glAccountId).cache(true).queryOne();
             if (glAccount) {
                 boolean isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
                 // Get the opening balances at the end of the last closed time period
@@ -271,7 +259,7 @@ if (allTransactionTotals) {
                         timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountId", EntityOperator.EQUALS, allTransactionTotal.glAccountId));
                         timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-                        lastTimePeriodHistory = EntityUtil.getFirst(delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false));
+                        lastTimePeriodHistory = from("GlAccountAndHistory").where(timePeriodAndExprs).queryFirst();
                         if (lastTimePeriodHistory) {
                             accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "openingD", lastTimePeriodHistory.getBigDecimal("postedDebits"), "openingC", lastTimePeriodHistory.getBigDecimal("postedCredits"), "D", BigDecimal.ZERO, "C", BigDecimal.ZERO);
                         }
@@ -295,7 +283,7 @@ if (allTransactionTotals) {
             mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
             mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, lastClosedDate));
             mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, fromDate));
-            transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(mainAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+            transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(mainAndExprs).orderBy("glAccountId").queryList();
             transactionTotals.each { transactionTotal ->
                 UtilMisc.addToBigDecimalInMap(accountMap, "opening" + transactionTotal.debitCreditFlag, transactionTotal.amount);
             }
@@ -312,8 +300,7 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("debitCreditFlag", EntityOperator.EQUALS, "D"));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
-andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allDebitTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List allDebitTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
 if (allDebitTransactionTotals) {
     allDebitTransactionTotal = allDebitTransactionTotals.first();
     if (allDebitTransactionTotal && allDebitTransactionTotal.amount) {
@@ -328,7 +315,7 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
 andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List allCreditTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("amount"), null, null, false);
+List allCreditTransactionTotals = select("amount").from("AcctgTransEntrySums").where(andExprs).queryList();
 if (allCreditTransactionTotals) {
     allCreditTransactionTotal = allCreditTransactionTotals.first();
     if (allCreditTransactionTotal && allCreditTransactionTotal.amount) {

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy Sat Dec 20 04:31:20 2014
@@ -29,12 +29,12 @@ parties.each { party ->
 context.partyNameList = partyNameList;
 
 if (parameters.customTimePeriodId) {
-    customTimePeriod = delegator.findOne('CustomTimePeriod', [customTimePeriodId:parameters.customTimePeriodId], true)
+    customTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.customTimePeriodId).cache(true).queryOne();
     exprList = [];
     exprList.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds))
     exprList.add(EntityCondition.makeCondition('fromDate', EntityOperator.LESS_THAN, customTimePeriod.getDate('thruDate').toTimestamp()))
     exprList.add(EntityCondition.makeCondition(EntityCondition.makeCondition('thruDate', EntityOperator.GREATER_THAN_EQUAL_TO, customTimePeriod.getDate('fromDate').toTimestamp()), EntityOperator.OR, EntityCondition.makeCondition('thruDate', EntityOperator.EQUALS, null)))
-    List organizationGlAccounts = delegator.findList('GlAccountOrganizationAndClass', EntityCondition.makeCondition(exprList, EntityOperator.AND), null, ['accountCode'], null, false)
+    List organizationGlAccounts = from("GlAccountOrganizationAndClass").where(exprList).orderBy("accountCode").queryList();
 
     accountBalances = []
     postedDebitsTotal = 0

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/AuthorizeTransaction.groovy Sat Dec 20 04:31:20 2014
@@ -26,7 +26,7 @@ orderPaymentPreferenceId = context.order
 if ((!orderId) || (!orderPaymentPreferenceId)) return;
 
 if (orderId) {
-   orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+   orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
    context.orderHeader = orderHeader;
 }
 
@@ -37,7 +37,7 @@ if (orderHeader) {
 }
 
 if (orderPaymentPreferenceId) {
-   orderPaymentPreference = delegator.findOne("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId], false);
+   orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
    context.orderPaymentPreference = orderPaymentPreference;
 }
 

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/CaptureTransaction.groovy Sat Dec 20 04:31:20 2014
@@ -29,12 +29,12 @@ orderPaymentPreferenceId = context.order
 if ((!orderId) || (!orderPaymentPreferenceId)) return;
 
 if (orderId) {
-   orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+   orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
    context.orderHeader = orderHeader;
 }
 
 if (orderPaymentPreferenceId) {
-   orderPaymentPreference = delegator.findOne("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId], false);
+   orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
    context.orderPaymentPreference = orderPaymentPreference;
 }
 

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/transaction/ViewGatewayResponse.groovy Sat Dec 20 04:31:20 2014
@@ -42,7 +42,7 @@ if (!orderPaymentPreferenceId) {
   context.orderPaymentPreferenceId = orderPaymentPreference.orderPaymentPreferenceId;
 } else {
     // second purpose: grab the latest gateway response of the orderpaymentpreferenceId
-    orderPaymentPreference = delegator.findOne("OrderPaymentPreference", [orderPaymentPreferenceId : orderPaymentPreferenceId], false);
+    orderPaymentPreference = from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne();
     gatewayResponses = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, ["transactionDate DESC"], false);
     EntityUtil.filterByCondition(gatewayResponses, EntityCondition.makeCondition("transCodeEnumId", EntityOperator.EQUALS, "PGT_AUTHORIZE"));
     

Modified: ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionReport.groovy Sat Dec 20 04:31:20 2014
@@ -41,7 +41,7 @@ if ("Y".equals(parameters.isSearch)) {
         invoiceItemAndAssocProductCond.add(EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, Timestamp.valueOf(thruDate)));
     }
     invoiceItemAndAssocProductList = [];
-    invoiceItemAndAssocProductList = delegator.findList("InvoiceItemAndAssocProduct", EntityCondition.makeCondition(invoiceItemAndAssocProductCond, EntityOperator.AND), null, null, null, false);
+    invoiceItemAndAssocProductList = from("InvoiceItemAndAssocProduct").where(invoiceItemAndAssocProductCond).queryList();
 
     //filtering invoiceItemAndAssocProductList for each productId with updating quantity, commission amount and number of order which generated sales invoices.
     totalQuantity = BigDecimal.ZERO;

Modified: ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/ap/WEB-INF/actions/invoices/CommissionRun.groovy Sat Dec 20 04:31:20 2014
@@ -35,7 +35,7 @@ if (fromDate) {
     if (context.salesRepPartyList) {
         invoiceCond.add(EntityCondition.makeCondition("invoiceRolePartyId", EntityOperator.IN, context.salesRepPartyList));
     }
-    invoiceList = delegator.findList("InvoiceAndRole", EntityCondition.makeCondition(invoiceCond, EntityOperator.AND), null, null, null, false);
+    invoiceList = from("InvoiceAndRole").where(invoiceCond).queryList();
 
     List invoices = [];
     if (invoiceList) {

Modified: ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/ar/WEB-INF/actions/BatchPayments.groovy Sat Dec 20 04:31:20 2014
@@ -43,15 +43,15 @@ if ("Y".equals(parameters.noConditionFin
         paymentCond.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyIdFrom));
     }
     if (finAccountId) {
-        finAccountTransList = delegator.findList("FinAccountTrans", EntityCondition.makeCondition([finAccountId : finAccountId]), null, null, null, false);
+        finAccountTransList = from("FinAccountTrans").where("finAccountId", finAccountId).queryList();
         if (finAccountTransList) {
             finAccountTransIds = EntityUtil.getFieldListFromEntityList(finAccountTransList, "finAccountTransId", true);
             paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.IN, finAccountTransIds));
-            payments = delegator.findList("PaymentAndTypePartyNameView", EntityCondition.makeCondition(paymentCond, EntityOperator.AND), null, null, null, false);
+            payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList();
         }
     } else {
         paymentCond.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null));
-        payments = delegator.findList("PaymentAndTypePartyNameView", EntityCondition.makeCondition(paymentCond, EntityOperator.AND), null, null, null, false);
+        payments = from("PaymentAndTypePartyNameView").where(paymentCond).queryList();
     }
     paymentListWithCreditCard = [];
     paymentListWithoutCreditCard = [];
@@ -59,10 +59,10 @@ if ("Y".equals(parameters.noConditionFin
         payments.each { payment ->
             isReceipt = UtilAccounting.isReceipt(payment);
             if (isReceipt) {
-                paymentGroupMembers = EntityUtil.filterByDate(delegator.findList("PaymentGroupMember", EntityCondition.makeCondition([paymentId : payment.paymentId]), null, null, null, false));
+                paymentGroupMembers = from("PaymentGroupMember").where("paymentId", payment.paymentId).filterByDate().queryList();
                 if (!paymentGroupMembers) {
                     if (cardType && payment.paymentMethodId) {
-                        creditCard = delegator.findOne("CreditCard", [paymentMethodId : payment.paymentMethodId], false);
+                        creditCard = from("CreditCard").where("paymentMethodId", payment.paymentMethodId).queryOne();
                         if (creditCard.cardType == cardType) {
                             paymentListWithCreditCard.add(payment);
                         }

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy Sat Dec 20 04:31:20 2014
@@ -35,7 +35,7 @@ Debug.logInfo("in cmseditaddprep, conten
 
 contentAssoc = null;
 if (contentAssocPK.isPrimaryKey()) {
-    contentAssoc = delegator.findOne("ContentAssoc", contentAssocPK, false);
+    contentAssoc = from("ContentAssoc").where(contentAssocPK).queryOne();
 }
 
 if (contentAssoc) {
@@ -50,7 +50,7 @@ dataResourceId = "";
 textData = "";
 content = null;
 if (contentId) {
-    content = delegator.findOne("Content", [contentId : contentId], true);
+    content = from("Content").where("contentId", contentId).cache(true).queryOne();
     if (content) {
         contentAssocDataResourceViewFrom.setAllFields(content, false, null, null);
     }
@@ -68,7 +68,7 @@ if (!dataResourceId) {
     }
 }
 if (dataResourceId) {
-    dataResource = delegator.findOne("DataResource", [dataResourceId : dataResourceId], true);
+    dataResource = from("DataResource").where("dataResourceId", dataResourceId).cache(true).queryOne();
     SimpleMapProcessor.runSimpleMapProcessor("component://content/script/org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault());
     templateRoot = [:];
     FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response);

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy Sat Dec 20 04:31:20 2014
@@ -24,13 +24,13 @@ paramMap = UtilHttp.getParameterMap(requ
 contentId = context.contentId;
 dataResourceId = context.dataResourceId;
 
-productFeatureList = delegator.findList("ProductFeature", null, null, null, null, true);
+productFeatureList = from("ProductFeature").cache(true).queryList();
 featureList = [] as ArrayList;
 if (dataResourceId) {
     productFeatureList.each { productFeature ->
         productFeatureId = productFeature.productFeatureId;
         description = productFeature.description;
-        productFeatureDataResource = delegator.findOne("ProductFeatureDataResource", [productFeatureId : productFeatureId, dataResourceId : dataResourceId], true);
+        productFeatureDataResource = from("ProductFeatureDataResource").where("productFeatureId", productFeatureId, "dataResourceId", dataResourceId).cache(true).queryOne();
         if (productFeatureDataResource) {
             feature = [];
             feature.productFeatureId = productFeatureId;

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy Sat Dec 20 04:31:20 2014
@@ -38,7 +38,7 @@ if (forumId) {
     contentIdToExpr = EntityCondition.makeCondition("caContentId", EntityOperator.EQUALS, forumId);
     exprList.add(contentIdToExpr);
     expr = EntityCondition.makeCondition(exprList, EntityOperator.AND);
-    entityList = delegator.findList("ContentAssocViewFrom", expr, null, ['-caFromDate'], null, false);
+    entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList();
 
     Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),"");
     Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,"");

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy Sat Dec 20 04:31:20 2014
@@ -23,15 +23,14 @@ import org.ofbiz.content.ContentManageme
 
 paramMap = UtilHttp.getParameterMap(request);
 forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context);
-blogRoles = delegator.findList("RoleType", EntityCondition.makeCondition([parentTypeId : 'BLOG']), null, null, null, true);
+blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList();
 
 if (forumId) {
     siteRoleMap = [:];
     for (int i=0; i < blogRoles.size(); i++) {
         roleType = blogRoles.get(i);
         roleTypeId = roleType.roleTypeId;
-        contentRoleList = delegator.findList("ContentRole", EntityCondition.makeCondition([contentId : forumId, roleTypeId : roleTypeId]), null, null, null, false);
-        filteredRoleList = EntityUtil.filterByDate(contentRoleList);
+        filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList();
         cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId);
 
         filteredRoleList.each { contentRole ->

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/ContentSearchOptions.groovy Sat Dec 20 04:31:20 2014
@@ -53,8 +53,8 @@ context.put("thruDateStr", toStr);
 
 searchConstraintStrings = ContentSearchSession.searchGetConstraintStrings(false, session, delegator);
 searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request);
-contentAssocTypes=delegator.findList("ContentAssocType", null, null, null, null, false);
-roleTypes=delegator.findList("RoleType", null, null, null, null, false);
+contentAssocTypes = from("ContentAssocType").queryList();
+roleTypes = from("RoleType").queryList();
 
 context.put("searchOperator", searchOperator);
 context.put("searchConstraintStrings", searchConstraintStrings);

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/GetContentLookupList.groovy Sat Dec 20 04:31:20 2014
@@ -80,7 +80,6 @@ int highIndex = (viewIndex+1)*viewSize;
 context.lowIndex = lowIndex;
 int arraySize = 0;
 List resultPartialList = null;
-    conditions = [EntityCondition.makeCondition("contentIdStart", EntityOperator.EQUALS,(String)parameters.get("contentId"))];
 
 if ((highIndex - lowIndex + 1) > 0) {
     // get the results as an entity list iterator
@@ -88,9 +87,7 @@ if ((highIndex - lowIndex + 1) > 0) {
     if(resultPartialList==null){
     try {
         beganTransaction = TransactionUtil.begin();
-        allConditions = EntityCondition.makeCondition( conditions, EntityOperator.AND );
-        findOptions = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
-        EntityListIterator listIt = delegator.find("ContentAssocViewTo", allConditions, null, null, ["contentId ASC"], findOptions);
+        EntityListIterator listIt = from("ContentAssocViewTo").where("contentIdStart", (String)parameters.get("contentId")).orderBy("contentId ASC").cursorScrollInsensitive().cache(true).queryIterator();
         resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1);
         
         arraySize = listIt.getResultsSizeAfterPartialList();

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy Sat Dec 20 04:31:20 2014
@@ -27,15 +27,14 @@ import org.ofbiz.content.ContentManageme
 
 paramMap = UtilHttp.getParameterMap(request);
 forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context);
-blogRoles = delegator.findList("RoleType", EntityCondition.makeCondition([parentTypeId : 'BLOG']), null, null, null, true);
+blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList();
 
 if (forumId) {
     siteRoleMap = [:];
     for (int i=0; i < blogRoles.size(); i++) {
         roleType = blogRoles.get(i);
         roleTypeId = roleType.roleTypeId;
-        contentRoleList = delegator.findList("ContentRole", EntityCondition.makeCondition([contentId : forumId, roleTypeId : roleTypeId]), null, null, null, false);
-        filteredRoleList = EntityUtil.filterByDate(contentRoleList);
+        filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList();
         cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId);
 
         filteredRoleList.each { contentRole ->

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy Sat Dec 20 04:31:20 2014
@@ -25,11 +25,11 @@ import org.ofbiz.widget.html.*
 surveyQuestionId = parameters.surveyQuestionId;
 context.surveyQuestionId = surveyQuestionId;
 
-surveyQuestion = delegator.findOne("SurveyQuestion", [surveyQuestionId : surveyQuestionId], false);
+surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne();
 
-surveyQuestionAndApplList = delegator.findList("SurveyQuestionAndAppl", EntityCondition.makeCondition([surveyId : surveyId]), null, ['sequenceNum'], null, false);
-surveyPageList = delegator.findList("SurveyPage", EntityCondition.makeCondition([surveyId : surveyId]), null, ['sequenceNum'], null, false);
-surveyMultiRespList = delegator.findList("SurveyMultiResp", EntityCondition.makeCondition([surveyId : surveyId]), null, ['multiRespTitle'], null, false);
+surveyQuestionAndApplList = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
+surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList();
+surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList();
 
 HtmlFormWrapper createSurveyQuestionWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestion", request, response);
 createSurveyQuestionWrapper.putInContext("surveyId", surveyId);
@@ -40,7 +40,7 @@ createSurveyQuestionCategoryWrapper.putI
 
 if (surveyQuestion && surveyQuestion.surveyQuestionTypeId && "OPTION".equals(surveyQuestion.surveyQuestionTypeId)) {
     // get the options
-    questionOptions = delegator.findList("SurveyQuestionOption", EntityCondition.makeCondition([surveyQuestionId : surveyQuestionId]), null, ['sequenceNum'], null, false);
+    questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList();
     context.questionOptions = questionOptions;
 
     HtmlFormWrapper createSurveyOptionWrapper = new HtmlFormWrapper("component://content/widget/survey/SurveyForms.xml", "CreateSurveyQuestionOption", request, response);
@@ -49,7 +49,7 @@ if (surveyQuestion && surveyQuestion.sur
     optionSeqId = parameters.surveyOptionSeqId;
     surveyQuestionOption = null;
     if (optionSeqId) {
-        surveyQuestionOption = delegator.findOne("SurveyQuestionOption", [surveyQuestionId : surveyQuestionId, surveyOptionSeqId : optionSeqId], false);
+        surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne();
     }
     context.surveyQuestionOption = surveyQuestionOption;
 
@@ -63,12 +63,12 @@ surveyQuestionCategoryId = parameters.su
 surveyQuestionCategory = null;
 categoryQuestions = null;
 if (surveyQuestionCategoryId) {
-    surveyQuestionCategory = delegator.findOne("SurveyQuestionCategory", [surveyQuestionCategoryId : surveyQuestionCategoryId], false);
+    surveyQuestionCategory = from("SurveyQuestionCategory").where("surveyQuestionCategoryId", surveyQuestionCategoryId).queryOne();
     if (surveyQuestionCategory) {
         categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion", null, null, false);
     }
 }
-questionCategories = delegator.findList("SurveyQuestionCategory", null, null, ['description'], null, false);
+questionCategories = from("SurveyQuestionCategory").orderBy("description").queryList();
 context.surveyQuestion = surveyQuestion;
 
 context.surveyQuestionAndApplList = surveyQuestionAndApplList;

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy Sat Dec 20 04:31:20 2014
@@ -24,7 +24,8 @@ surveyResponseId = parameters.surveyResp
 partyId = null;
 
 if (!surveyId && surveyResponseId) {
-   surveyResponse = delegator.findOne("SurveyResponse", [surveyResponseId : surveyResponseId], false);
+   surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
+  
    surveyId = surveyResponse.surveyId;
    context.surveyId = surveyId;
 }

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy Sat Dec 20 04:31:20 2014
@@ -22,11 +22,11 @@ import org.ofbiz.content.survey.SurveyWr
 if (!survey) {
     surveyResponseId = parameters.surveyResponseId;
     if (surveyResponseId) {
-        surveyResponse = delegator.findOne("SurveyResponse", [surveyResponseId : surveyResponseId], false);
+        surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
         if (surveyResponse) {
             surveyId = surveyResponse.surveyId;
             if (surveyId) {
-                survey = delegator.findOne("Survey", [surveyId : surveyId], false);
+                survey = from("Survey").where("surveyId", surveyId).queryOne();
                 context.survey = survey;
                 context.surveyId = surveyId;
             }

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy Sat Dec 20 04:31:20 2014
@@ -23,36 +23,28 @@ import org.ofbiz.entity.util.*
 
 if (content) {
     // lookup assoc content
-    titles = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'title']), null, ['-fromDate'], null, false);
-    titles = EntityUtil.filterByDate(titles);
-    title = EntityUtil.getFirst(titles);
+    title = from("ContentAssoc").where("contentId", contentId, "mapKey", "title").orderBy("-fromDate").filterByDate().queryFirst();
     if (title) {
         tc = title.getRelatedOne("ToContent", false);
         tcdr = tc.getRelatedOne("DataResource", false);
         context.title = tcdr;
     }
 
-    titleProps = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'titleProperty']), null, ['-fromDate'], null, false);
-    titleProps = EntityUtil.filterByDate(titleProps);
-    titleProp = EntityUtil.getFirst(titleProps);
+    titleProp = from("ContentAssoc").where("contentId", contentId, "mapKey", "titleProperty").orderBy("-fromDate").filterByDate().queryFirst();
     if (titleProp) {
         tpc = titleProp.getRelatedOne("ToContent", false);
         tpcdr = tpc.getRelatedOne("DataResource", false);
         context.titleProperty = tpcdr;
     }
 
-    metaDescs = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'metaDescription']), null, ['-fromDate'], null, false);
-    metaDescs = EntityUtil.filterByDate(metaDescs);
-    metaDesc = EntityUtil.getFirst(metaDescs);
+    metaDesc = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaDescription").orderBy("-fromDate").filterByDate().queryFirst();
     if (metaDesc) {
         mdc = metaDesc.getRelatedOne("ToContent", false);
         mdcdr = mdc.getRelatedOne("DataResource", false);
         context.metaDescription = mdcdr;
     }
 
-    metaKeys = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'metaKeywords']), null, ['-fromDate'], null, false);
-    metaKeys = EntityUtil.filterByDate(metaKeys);
-    metaKey = EntityUtil.getFirst(metaKeys);
+    metaKey = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaKeywords").orderBy("-fromDate").filterByDate().queryFirst();
     if (metaKey) {
         mkc = metaKey.getRelatedOne("ToContent", false);
         mkcdr = mkc.getRelatedOne("DataResource", false);

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy Sat Dec 20 04:31:20 2014
@@ -20,10 +20,7 @@
 import org.ofbiz.entity.condition.*
 import org.ofbiz.entity.util.*
 
-pplookupMap = [webSiteId : webSiteId, webSiteContentTypeId : 'PUBLISH_POINT'];
-webSiteContents = delegator.findList("WebSiteContent", EntityCondition.makeCondition(pplookupMap), null, ['-fromDate'], null, false);
-webSiteContents = EntityUtil.filterByDate(webSiteContents);
-webSiteContent = EntityUtil.getFirst(webSiteContents);
+webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").filterByDate().queryFirst();
 if (webSiteContent) {
     content = webSiteContent.getRelatedOne("Content", false);
     contentRoot = content.contentId;
@@ -31,13 +28,11 @@ if (webSiteContent) {
     context.contentRoot = contentRoot;
 
     // get all sub content for the publish point
-    subsites = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentRoot]), null, null, null, false);
+    subsites = from("ContentAssoc").where("contentId", contentRoot).queryList();
     context.subsites = subsites;
 }
 
-mnlookupMap = [webSiteId : webSiteId, webSiteContentTypeId : 'MENU_ROOT'];
-webSiteMenus = delegator.findList("WebSiteContent", EntityCondition.makeCondition(mnlookupMap), null, ['-fromDate'], null, false);
-webSiteMenu = EntityUtil.getFirst(webSiteMenus);
+webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").queryFirst();
 if (webSiteMenu) {
     menu = webSiteMenu.getRelatedOne("Content", false);
     menuRoot = menu.contentId;
@@ -45,13 +40,11 @@ if (webSiteMenu) {
     context.menuRoot = menuRoot;
 
     // get all sub content for the menu root
-    menus = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : menuRoot]), null, null, null, false);
+    menus = from("ContentAssoc").where("contentId", menuRoot).queryList();
     context.menus = menus;
 }
 
-erlookupMap = [webSiteId : webSiteId, webSiteContentTypeId : 'ERROR_ROOT'];
-webSiteErrors = delegator.findList("WebSiteContent", EntityCondition.makeCondition(erlookupMap), null, ['-fromDate'], null, false);
-webSiteError = EntityUtil.getFirst(webSiteErrors);
+webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").queryFirst();
 if (webSiteError) {
     error = webSiteError.getRelatedOne("Content", false);
     errorRoot = error.contentId;
@@ -59,6 +52,6 @@ if (webSiteError) {
     context.errorRoot = errorRoot;
 
     // get all sub content for the error root
-    errors = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : errorRoot]), null, null, null, false);
+    errors = from("ContentAssoc").where("contentId", errorRoot).queryList();
     context.errors = errors;
 }

Modified: ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy (original)
+++ ofbiz/trunk/applications/humanres/webapp/humanres/WEB-INF/actions/category/CategoryTree.groovy Sat Dec 20 04:31:20 2014
@@ -41,17 +41,17 @@ existParties =  FastList.newInstance();
 subtopLists =  FastList.newInstance();
 
 //internalOrg list
-partyRelationships = EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", [partyIdFrom : partyId, partyRelationshipTypeId : "GROUP_ROLLUP"], null, false));
+partyRelationships = from("PartyRelationship").where("partyIdFrom", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").filterByDate().queryList();
 if (partyRelationships) {
     //root
-    partyRoot = delegator.findOne("PartyGroup", [partyId : partyId], false);
+    partyRoot = from("PartyGroup").where("partyId", partyId).queryOne();
     partyRootMap = FastMap.newInstance();
     partyRootMap.put("partyId", partyId);
     partyRootMap.put("groupName", partyRoot.getString("groupName"));
 
     //child
     for(partyRelationship in partyRelationships) {
-        partyGroup = delegator.findOne("PartyGroup", [partyId : partyRelationship.getString("partyIdTo")], false);
+        partyGroup = from("PartyGroup").where("partyId", partyRelationship.getString("partyIdTo"))
         partyGroupMap = FastMap.newInstance();
         partyGroupMap.put("partyId", partyGroup.getString("partyId"));
         partyGroupMap.put("groupName", partyGroup.getString("groupName"));

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/EditProductBom.groovy Sat Dec 20 04:31:20 2014
@@ -44,7 +44,7 @@ Timestamp fromDate = null;
 if (fromDateStr) fromDate = Timestamp.valueOf(fromDateStr) ?: (Timestamp)request.getAttribute("ProductAssocCreateFromDate");;
 context.fromDate = fromDate;
 
-productAssoc = delegator.findOne("ProductAssoc", [productId : productId, productIdTo : productIdTo, productAssocTypeId : productAssocTypeId, fromDate : fromDate], false);
+productAssoc = from("ProductAssoc").where("productId", productId, "productIdTo", productIdTo, "productAssocTypeId", productAssocTypeId, "fromDate", fromDate).queryOne();
 if (updateMode) {
     productAssoc = [:];
     context.remove("productIdTo");
@@ -58,10 +58,10 @@ if (!productAssoc) useValues = false;
 
 context.useValues = useValues;
 
-Collection assocTypes = delegator.findByAnd("ProductAssocType", [parentTypeId : "PRODUCT_COMPONENT"], ["productAssocTypeId", "description"], false);
+Collection assocTypes = from("ProductAssocType").where("parentTypeId", "PRODUCT_COMPONENT").orderBy("productAssocTypeId", "description").queryList();
 context.assocTypes = assocTypes;
 
-Collection formulae = delegator.findByAnd("CustomMethod", [customMethodTypeId : "BOM_FORMULA"], ["customMethodId", "description"], false);
+Collection formulae = from("CustomMethod").where("customMethodTypeId", "BOM_FORMULA").orderBy("customMethodId", "description").queryList();
 context.formulae = formulae;
 
 if (product) {

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/bom/FindProductBom.groovy Sat Dec 20 04:31:20 2014
@@ -20,9 +20,6 @@
 import org.ofbiz.entity.util.*;
 import org.ofbiz.entity.condition.*;
 
-fieldToSelect = ["productId", "internalName", "productAssocTypeId"] as Set;
-orderBy = ["productId", "productAssocTypeId"];
-
 condList = [];
 if (parameters.productId) {
     cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId);
@@ -41,8 +38,12 @@ if (parameters.productAssocTypeId) {
                                           ], EntityOperator.OR);
     condList.add(cond);
 }
-cond =  EntityCondition.makeCondition(condList, EntityOperator.AND);
-findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
-bomListIterator = delegator.find("ProductAndAssoc", cond, null, fieldToSelect, orderBy, findOpts);
+bomListIterator = select("productId", "internalName", "productAssocTypeId")
+                    .from("ProductAndAssoc")
+                    .where(condList)
+                    .orderBy("productId", "productAssocTypeId")
+                    .cursorScrollInsensitive()
+                    .cache(true)
+                    .queryIterator();
 
 context.ListProductBom = bomListIterator;

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunActualComponents.groovy Sat Dec 20 04:31:20 2014
@@ -22,9 +22,9 @@ import org.ofbiz.widget.html.HtmlFormWra
 productionRunId = parameters.productionRunId ?: parameters.workEffortId;
 
 taskInfos = [];
-tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"], false);
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
 tasks.each { task ->
-    records = delegator.findByAnd("InventoryItemDetail", [workEffortId : task.workEffortId], null, false);
+    records = from("InventoryItemDetail").where("workEffortId", task.workEffortId).queryList();
     HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/widget/manufacturing/ProductionRunForms.xml", "ProductionRunTaskActualComponents", request, response);
     taskForm.putInContext("records", records);
     taskInfos.add([task : task, taskForm : taskForm]);

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunComponents.groovy Sat Dec 20 04:31:20 2014
@@ -22,9 +22,9 @@ import org.ofbiz.widget.html.HtmlFormWra
 productionRunId = parameters.productionRunId ?: parameters.workEffortId;
 
 taskInfos = [];
-tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"], false);
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
 tasks.each { task ->
-    records = delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : task.workEffortId], null, false);
+    records = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId).queryList();
     HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/widget/manufacturing/ProductionRunForms.xml", "ProductionRunTaskComponents", request, response);
     taskForm.putInContext("records", records);
     taskInfos.add([task : task, taskForm : taskForm]);

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunContent.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunContent.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunContent.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunContent.groovy Sat Dec 20 04:31:20 2014
@@ -23,12 +23,12 @@ import org.ofbiz.entity.util.EntityUtil;
 productionRunId = parameters.productionRunId ?: parameters.workEffortId;
 context.productionRunId = productionRunId;
 
-delivGoodStandard = EntityUtil.getFirst(delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : productionRunId, workEffortGoodStdTypeId : "PRUN_PROD_DELIV", statusId : "WEGS_CREATED"], ["-fromDate"], false));
+delivGoodStandard = from("WorkEffortGoodStandard").where("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").orderBy("-fromDate").queryFirst();
 if (delivGoodStandard) {
     context.delivProductId = delivGoodStandard.productId;
 }
 if (context.delivProductId && (parameters.partyId || parameters.contentLocale)) {
-    delivProductContents = EntityUtil.filterByDate(delegator.findByAnd("ProductContentAndInfo", [productId : context.delivProductId], ["-fromDate"], false));
+    delivProductContents = from("ProductContentAndInfo").where("productId", context.delivProductId).orderBy("-fromDate").filterByDate().queryList();
     context.delivProductContents = delivProductContents;
 
     Locale contentLocale = null;
@@ -38,7 +38,7 @@ if (context.delivProductId && (parameter
     delivProductContentsForLocaleAndUser = [];
     delivProductContents.each { delivProductContent ->
         GenericValue content = ContentWorker.findContentForRendering(delegator, delivProductContent.contentId, contentLocale, parameters.partyId, parameters.roleTypeId, true);
-        delivProductContentsForLocaleAndUser.add(EntityUtil.getFirst(delegator.findByAnd("ContentDataResourceView", [contentId : content.contentId], null, false)));
+        delivProductContentsForLocaleAndUser.add(from("ContentDataResourceView").where("contentId", content.contentId).queryFirst());
     }
     context.delivProductContentsForLocaleAndUser = delivProductContentsForLocaleAndUser;
 }

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunCosts.groovy Sat Dec 20 04:31:20 2014
@@ -22,16 +22,16 @@ import org.ofbiz.widget.html.HtmlFormWra
 
 productionRunId = parameters.productionRunId ?: parameters.workEffortId;
 taskCosts = [];
-tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"], false);
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
 tasks.each { task ->
-    costs = EntityUtil.filterByDate(delegator.findByAnd("CostComponent", [workEffortId : task.workEffortId], null, false));
+    costs = from("CostComponent").where("workEffortId", task.workEffortId).filterByDate().queryList();
     HtmlFormWrapper taskCostsForm = new HtmlFormWrapper("component://manufacturing/widget/manufacturing/ProductionRunForms.xml", "ProductionRunTaskCosts", request, response);
     taskCostsForm.putInContext("taskCosts", costs);
     taskCosts.add([task : task ,costsForm : taskCostsForm]);
 }
 // get the costs directly associated to the production run (e.g. overhead costs)
-productionRun = delegator.findOne("WorkEffort", [workEffortId: productionRunId], true);
-costs = EntityUtil.filterByDate(delegator.findByAnd("CostComponent", [workEffortId : productionRunId], null, false));
+productionRun = from("WorkEffort").where("workEffortId", productionRunId).cache(true).queryOne();
+costs = from("CostComponent").where("workEffortId", productionRunId).filterByDate().queryList();
 HtmlFormWrapper taskCostsForm = new HtmlFormWrapper("component://manufacturing/widget/manufacturing/ProductionRunForms.xml", "ProductionRunTaskCosts", request, response);
 taskCostsForm.putInContext("taskCosts", costs);
 taskCosts.add([task : productionRun ,costsForm : taskCostsForm]);

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunDeclaration.groovy Sat Dec 20 04:31:20 2014
@@ -36,7 +36,7 @@ if (productionRunId) {
         context.productionRun = productionRun.getGenericValue();
 
         // Find all the order items to which this production run is linked.
-        orderItems = delegator.findByAnd("WorkOrderItemFulfillment", [workEffortId : productionRunId], null, false);
+        orderItems = from("WorkOrderItemFulfillment").where("workEffortId", productionRunId).queryList();
         if (orderItems) {
             context.orderItems = orderItems;
         }
@@ -44,7 +44,7 @@ if (productionRunId) {
         quantityToProduce = productionRun.getGenericValue().get("quantityToProduce") ?: 0.0;
 
         // Find the inventory items produced
-        inventoryItems = delegator.findByAnd("WorkEffortInventoryProduced", [workEffortId : productionRunId], null, false);
+        inventoryItems = from("WorkEffortInventoryProduced").where("workEffortId", productionRunId).queryList();
         context.inventoryItems = inventoryItems;
         if (inventoryItems) {
             lastWorkEffortInventoryProduced = (GenericValue)inventoryItems.get(inventoryItems.size() - 1);
@@ -95,7 +95,7 @@ if (productionRunId) {
         // routingTask update sub-screen
         routingTaskId = parameters.routingTaskId;
         if (routingTaskId && (actionForm.equals("UpdateRoutingTask") || actionForm.equals("EditRoutingTask"))) {
-            routingTask = delegator.findOne("WorkEffort", [workEffortId : routingTaskId], false);
+            routingTask = from("WorkEffort").where("workEffortId", routingTaskId).queryOne();
             Map routingTaskData = routingTask.getAllFields();
             routingTaskData.estimatedSetupMillis = routingTask.getDouble("estimatedSetupMillis");
             routingTaskData.estimatedMilliSeconds = routingTask.getDouble("estimatedMilliSeconds");
@@ -105,7 +105,7 @@ if (productionRunId) {
             // Get the list of deliverable products, i.e. the WorkEffortGoodStandard entries
             // with workEffortGoodStdTypeId = "PRUNT_PROD_DELIV":
             // first of all we get the template task (the routing task)
-            templateTaskAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("WorkEffortAssoc", [workEffortIdTo : routingTask.workEffortId, workEffortAssocTypeId : "WORK_EFF_TEMPLATE"], null, false)));
+            templateTaskAssoc = from("WorkEffortAssoc").where("workEffortIdTo", routingTask.workEffortId, "workEffortAssocTypeId", "WORK_EFF_TEMPLATE").filterByDate().queryFirst();
             templateTask = [:];
             if (templateTaskAssoc) {
                 templateTask = templateTaskAssoc.getRelatedOne("FromWorkEffort", false);
@@ -116,7 +116,7 @@ if (productionRunId) {
             }
             context.delivProducts = delivProducts;
             // Get the list of delivered products, i.e. inventory items
-            prunInventoryProduced = delegator.findByAnd("WorkEffortAndInventoryProduced", [workEffortId : routingTaskId], null, false);
+            prunInventoryProduced = from("WorkEffortAndInventoryProduced").where("workEffortId", routingTaskId).queryList();
             context.prunInventoryProduced = prunInventoryProduced;
         }
 
@@ -130,9 +130,8 @@ if (productionRunId) {
             if ("PRUN_RUNNING".equals(task.currentStatusId)) {
                 // Use WorkEffortGoodStandard to figure out if there are products which are needed for this task (PRUNT_PRODNEEDED) and which have not been issued (ie, WEGS_CREATED).
                 // If so this task should have products issued
-                components = delegator.findByAnd("WorkEffortGoodStandard", [workEffortId : task.workEffortId, workEffortGoodStdTypeId : "PRUNT_PROD_NEEDED"], null, false);
-                List notIssued = EntityUtil.filterByAnd(components, [statusId : "WEGS_CREATED"]);
-                if (components && notIssued) {
+                components = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", "statusId", "WEGS_CREATED").queryList();
+                if (components) {
                     issueTaskId = task.workEffortId;
                 }
                 if (!issueTaskId) {
@@ -170,7 +169,7 @@ if (productionRunId) {
                 componentData.internalName = componentName;
                 componentData.workEffortName = workEffortName;
                 componentData.facilityId = productionRunTask.facilityId;
-                issuances = delegator.findByAnd("WorkEffortAndInventoryAssign", [workEffortId : component.workEffortId, productId : product.productId], null, false);
+                issuances = from("WorkEffortAndInventoryAssign").where("workEffortId", component.workEffortId, "productId", product.productId).queryList();
                 totalIssued = 0.0;
                 issuances.each { issuance ->
                     issued = issuance.quantity;
@@ -178,10 +177,10 @@ if (productionRunId) {
                         totalIssued += issued;
                     }
                 }
-                returns = delegator.findByAnd("WorkEffortAndInventoryProduced", [workEffortId : component.workEffortId , productId : product.productId], null, false);
+                returns = from("WorkEffortAndInventoryProduced").where("workEffortId", component.workEffortId , "productId", product.productId).queryList();
                 totalReturned = 0.0;
                 returns.each { returned ->
-                    returnDetail = EntityUtil.getFirst(delegator.findByAnd("InventoryItemDetail", [inventoryItemId : returned.inventoryItemId], ["inventoryItemDetailSeqId"], false));
+                    returnDetail = from("InventoryItemDetail").where("inventoryItemId", returned.inventoryItemId).orderBy("inventoryItemDetailSeqId").queryFirst();
                     if (returnDetail) {
                         qtyReturned = returnDetail.quantityOnHandDiff;
                         if (qtyReturned) {
@@ -206,7 +205,7 @@ if (productionRunId) {
             }
         }
         // Content
-        productionRunContents = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortContentAndInfo", [workEffortId : productionRunId], ["-fromDate"], false));
+        productionRunContents = from("WorkEffortContentAndInfo").where("workEffortId", productionRunId).orderBy("-fromDate").filterByDate().queryList();
         context.productionRunContents = productionRunContents;
         context.productionRunComponentsData = productionRunComponentsData;
         context.productionRunComponentsDataReadyForIssuance = productionRunComponentsDataReadyForIssuance;

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ProductionRunFixedAssets.groovy Sat Dec 20 04:31:20 2014
@@ -22,7 +22,7 @@ import org.ofbiz.widget.html.HtmlFormWra
 productionRunId = parameters.productionRunId ?: parameters.workEffortId;
 
 taskInfos = [];
-tasks = delegator.findByAnd("WorkEffort", [workEffortParentId : productionRunId, workEffortTypeId : "PROD_ORDER_TASK"], ["workEffortId"], false);
+tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList();
 tasks.each { task ->
     records = task.getRelated("WorkEffortFixedAssetAssign", null, null, false);
     HtmlFormWrapper taskForm = new HtmlFormWrapper("component://manufacturing/widget/manufacturing/ProductionRunForms.xml", "ProductionRunTaskFixedAssets", request, response);

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/ViewProductionRun.groovy Sat Dec 20 04:31:20 2014
@@ -44,7 +44,7 @@ if (productionRunId) {
         context.productionRunData = productionRunData;
 
         // Find all the order items to which this production run is linked.
-        orderItems = delegator.findByAnd("WorkOrderItemFulfillment", [workEffortId : productionRunId], null, false);
+        orderItems = from("WorkOrderItemFulfillment").where("workEffortId", productionRunId).queryList();
         if (orderItems) {
             context.orderItems = orderItems;
         }
@@ -55,7 +55,7 @@ if (productionRunId) {
         context.productionRunComponents = productionRun.getProductionRunComponents();;
 
         // Find all the notes linked to this production run.
-        productionRunNoteData = delegator.findByAnd("WorkEffortNoteAndData", [workEffortId : productionRunId], null, false);
+        productionRunNoteData = from("WorkEffortNoteAndData").where("workEffortId", productionRunId).queryList();
         if (productionRunNoteData) {
             context.productionRunNoteData = productionRunNoteData;
         }

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/jobshopmgt/WorkWithShipmentPlans.groovy Sat Dec 20 04:31:20 2014
@@ -25,7 +25,7 @@ import org.ofbiz.manufacturing.jobshopmg
 shipmentPlans = [];
 rows = [];
 if (shipment && shipment.shipmentId) {
-    shipmentPlans = delegator.findByAnd("OrderShipment", [shipmentId : shipment.shipmentId], null, false);
+    shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList();
 }
 if (shipmentPlans) {
     workInProgress = "false";
@@ -67,7 +67,7 @@ if (shipmentPlans) {
         // Total quantity planned not issued
         plannedQuantity = 0.0;
         qtyPlannedInShipment = [:];
-        plans = delegator.findByAnd("OrderShipment", [orderId : orderItem.orderId ,orderItemSeqId : orderItem.orderItemSeqId], null, false);
+        plans = from("OrderShipment").where("orderId", orderItem.orderId ,"orderItemSeqId", orderItem.orderItemSeqId).queryList();
         plans.each { plan ->
             if (plan.quantity) {
                 netPlanQty = plan.quantity;
@@ -120,7 +120,7 @@ if (shipmentPlans) {
         }
         oneRow.weight = weight;
         if (product.weightUomId) {
-            weightUom = delegator.findOne("Uom", [uomId : product.weightUomId], true);
+            weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne();
             oneRow.weightUom = weightUom.abbreviation;
         }
         volume = 0.0;
@@ -138,16 +138,16 @@ if (shipmentPlans) {
             product.widthUomId &&
             product.depthUomId) {
 
-            heightUom = delegator.findOne("Uom", [uomId : product.heightUomId], true);
-            widthUom = delegator.findOne("Uom", [uomId : product.widthUomId], true);
-            depthUom = delegator.findOne("Uom", [uomId : product.depthUomId], true);
+            heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne();
+            widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne();
+            depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne();
             oneRow.volumeUom = heightUom.abbreviation + "x" +
                                     widthUom.abbreviation + "x" +
                                     depthUom.abbreviation;
         }
         rows.add(oneRow);
         // Select the production runs, if available
-        productionRuns = delegator.findByAnd("WorkOrderItemFulfillment", [orderId : shipmentPlan.orderId, orderItemSeqId : shipmentPlan.orderItemSeqId, shipGroupSeqId : shipmentPlan.shipGroupSeqId],["workEffortId"], null, false); // TODO: add shipmentId
+        productionRuns = from("WorkOrderItemFulfillment").where("orderId", shipmentPlan.orderId, "orderItemSeqId", shipmentPlan.orderItemSeqId, "shipGroupSeqId", shipmentPlan.shipGroupSeqId).orderBy("workEffortId").queryList();
         if (productionRuns) {
             workInProgress = "true";
             productionRunsId = "";

Modified: ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy (original)
+++ ofbiz/trunk/applications/manufacturing/webapp/manufacturing/WEB-INF/actions/mrp/FindInventoryEventPlan.groovy Sat Dec 20 04:31:20 2014
@@ -60,7 +60,7 @@ if (lookupFlag) {
 
     if ( mainCond) {
     // do the lookup
-        inventoryList = delegator.findList("MrpEvent", mainCond, null, ["productId", "eventDate"], null, false);
+        inventoryList = from("MrpEvent").where(mainCond).orderBy("productId", "eventDate").queryList();
     }
 
     context.inventoryList = inventoryList;