svn commit: r1817989 [1/2] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/groovyScripts/reports/ applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/template/finaccounttrans/ applications/commo...

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

svn commit: r1817989 [1/2] - in /ofbiz/ofbiz-framework/trunk: applications/accounting/groovyScripts/reports/ applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/ applications/accounting/template/finaccounttrans/ applications/commo...

Deepak Dixit-5
Author: deepak
Date: Wed Dec 13 09:21:33 2017
New Revision: 1817989

URL: http://svn.apache.org/viewvc?rev=1817989&view=rev
Log:
Improved: Replace all delegator findByAnd and findOne method calling by EntityQuery methods (OFBIZ-10029)
Applied slightly modified patch, rearrange import properly,
Thanks Suraj Khurana for your contribution

Modified:
    ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy
    ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
    ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/FinAccountTrans.ftl
    ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/GlReconciledFinAccountTrans.ftl
    ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/ShowGlTransactions.ftl
    ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy
    ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy
    ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
    ofbiz/ofbiz-framework/trunk/applications/content/template/content/ContentNav.ftl
    ofbiz/ofbiz-framework/trunk/applications/content/template/content/DisplayContentNav.ftl
    ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy
    ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy
    ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy
    ofbiz/ofbiz-framework/trunk/applications/manufacturing/template/mrp/FindInventoryEventPlan.ftl
    ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
    ofbiz/ofbiz-framework/trunk/applications/order/template/order/EditOrderItems.ftl
    ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderItems.ftl
    ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderShippingInfo.ftl
    ofbiz/ofbiz-framework/trunk/applications/order/template/quote/ViewQuoteItemInfo.ftl
    ofbiz/ofbiz-framework/trunk/applications/order/template/return/ReturnLinks.ftl
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContentUrlFilter.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java
    ofbiz/ofbiz-framework/trunk/applications/product/template/category/CreateProductInCategoryStart.ftl
    ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PrintPickSheets.fo.ftl
    ofbiz/ofbiz-framework/trunk/applications/product/template/imagemanagement/ShowPeopleApprove.ftl
    ofbiz/ofbiz-framework/trunk/applications/product/template/product/ViewProductOrders.ftl
    ofbiz/ofbiz-framework/trunk/applications/product/template/shipment/VerifyPick.ftl
    ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java
    ofbiz/ofbiz-framework/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy
    ofbiz/ofbiz-framework/trunk/applications/workeffort/template/calendar/CalendarEventContent.ftl
    ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GeoLocation.groovy
    ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy
    ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/SetLocaleFromBrowser.groovy
    ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityQueryTestSuite.java
    ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/test/ServiceEntityAutoTests.java
    ofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
    ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
    ofbiz/ofbiz-framework/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
    ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/HomeMenu.ftl
    ofbiz/ofbiz-framework/trunk/themes/rainbowstone/template/includes/TopAppBar.ftl

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy Wed Dec 13 09:21:33 2017
@@ -20,16 +20,15 @@
 import org.apache.ofbiz.base.util.UtilMisc
 import org.apache.ofbiz.entity.condition.EntityCondition
 import org.apache.ofbiz.entity.condition.EntityOperator
-import org.apache.ofbiz.entity.util.EntityUtil
 
 invoiceId = parameters.invoiceId
 userLoginId = userLogin.userLoginId
-userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false)
-userLoginNameView = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", userLogin.get("partyId")), false)
+userLogin = from("UserLogin").where("userLoginId", userLoginId).queryOne();
+userLoginNameView = from("PartyNameView").where("partyId", userLogin.get("partyId")).queryOne();
 userLoginName = userLoginNameView.getString("firstName") + " " + userLoginNameView.getString("lastName")
 dateFormatter = new java.text.SimpleDateFormat("dd MMMMM yyyy")
 
-invoice = delegator.findOne("Invoice", UtilMisc.toMap("invoiceId", invoiceId), false)
+invoice = from("Invoice").where("invoiceId", invoiceId).queryOne();
 if (invoice) {
     context.invoiceDescription = invoice.get("description")
     context.invoiceTypeDescription = invoice.getRelatedOne("InvoiceType", false).get("description")
@@ -44,7 +43,7 @@ if ("PURCHASE_INVOICE".equals(invoice.ge
     partyId = invoice.get("partyId")
 }
 partyName = ""
-partyNameView = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), false)
+partyNameView = from("PartyNameView").where("partyId", partyId).queryOne();
 if (partyNameView.get("firstName")) {
     partyName += partyNameView.get("firstName") + " "
 }

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Wed Dec 13 09:21:33 2017
@@ -597,10 +597,10 @@ public class InvoiceServices {
                                                                               to adjust tax amount in invoice item.
                                          */
                                         BigDecimal otherInvoiceTaxAmount = BigDecimal.ZERO;
-                                        GenericValue orderAdjBilling = EntityUtil.getFirst(delegator.findByAnd("OrderAdjustmentBilling", UtilMisc.toMap("orderAdjustmentId", adj.getString("orderAdjustmentId")), null, false));
+                                        GenericValue orderAdjBilling = EntityQuery.use(delegator).from("OrderAdjustmentBilling").where("orderAdjustmentId", adj.getString("orderAdjustmentId")).queryFirst();
                                         if (UtilValidate.isNotEmpty(orderAdjBilling)) {
-                                            List<GenericValue> invoiceItems = delegator.findByAnd("InvoiceItem",
-                                                    UtilMisc.toMap("invoiceId", orderAdjBilling.getString("invoiceId"), "invoiceItemTypeId", "ITM_SALES_TAX", "productId", originalOrderItem.getString("productId")), null, isTaxIncludedInPrice);
+                                            //FIXME: isTaxIncludedInPrice is passed to get data from cache, need to check why its done
+                                            List<GenericValue> invoiceItems = EntityQuery.use(delegator).from("InvoiceItem").where("invoiceId", orderAdjBilling.getString("invoiceId"), "invoiceItemTypeId", "ITM_SALES_TAX", "productId", originalOrderItem.getString("productId")).cache(isTaxIncludedInPrice).queryList();
                                             for (GenericValue invoiceItem : invoiceItems) {
                                                 otherInvoiceTaxAmount = otherInvoiceTaxAmount.add(invoiceItem.getBigDecimal("amount"));
                                             }

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/FinAccountTrans.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/FinAccountTrans.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/FinAccountTrans.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/FinAccountTrans.ftl Wed Dec 13 09:21:33 2017
@@ -95,7 +95,7 @@ function getFinAccountTransRunningTotalA
         <input name="reconciledBalance" type="hidden" value="${(glReconciliation.reconciledBalance)!}"/>
         <input name="reconciledBalanceWithUom" type="hidden" id="reconciledBalanceWithUom" value="<@ofbizCurrency amount=(glReconciliation.reconciledBalance)?default('0')/>"/>
       </#if>
-      <#assign glReconciliations = delegator.findByAnd("GlReconciliation", {"glAccountId" : finAccount.postToGlAccountId!, "statusId" : "GLREC_CREATED"}, Static["org.apache.ofbiz.base.util.UtilMisc"].toList("reconciledDate DESC"), false)>
+      <#assign glReconciliations = EntityQuery.use(delegator).from("GlReconciliation").where("glAccountId", finAccount.postToGlAccountId!, "statusId", "GLREC_CREATED").orderBy("reconciledDate DESC").queryList()!>
       <#if (glReconciliationId?has_content && ("_NA_" == glReconciliationId && finAccountTransList?has_content)) || !grandTotal??>
         <div align="right">
           <#if grandTotal??>
@@ -153,26 +153,26 @@ function getFinAccountTransRunningTotalA
           <#assign glReconciliation = "">
           <#assign partyName = "">
           <#if finAccountTrans.paymentId?has_content>
-            <#assign payment = delegator.findOne("Payment", {"paymentId" : finAccountTrans.paymentId}, true)>
+            <#assign payment = EntityQuery.use(delegator).from("Payment").where("paymentId", finAccountTrans.paymentId!).cache().queryOne()!>
           <#else>
-            <#assign payments = delegator.findByAnd("Payment", {"finAccountTransId" : finAccountTrans.finAccountTransId}, null, false)>
+            <#assign payments = EntityQuery.use(delegator).from("Payment").where("finAccountTransId", finAccountTrans.finAccountTransId!).queryList()!>
           </#if>
-          <#assign finAccountTransType = delegator.findOne("FinAccountTransType", {"finAccountTransTypeId" : finAccountTrans.finAccountTransTypeId}, true)>
+          <#assign finAccountTransType = EntityQuery.use(delegator).from("FinAccountTransType").where("finAccountTransTypeId", finAccountTrans.finAccountTransTypeId!).cache().queryOne()!>
           <#if finAccountTrans.statusId?has_content>
-            <#assign status = delegator.findOne("StatusItem", {"statusId" : finAccountTrans.statusId}, true)>
+            <#assign status = EntityQuery.use(delegator).from("StatusItem").where("statusId", finAccountTrans.statusId!).cache().queryOne()!>
           </#if>
           <#if payment?has_content && payment.paymentTypeId?has_content>
-            <#assign paymentType = delegator.findOne("PaymentType", {"paymentTypeId" : payment.paymentTypeId}, true)>
+            <#assign paymentType = EntityQuery.use(delegator).from("PaymentType").where("paymentTypeId", payment.paymentTypeId!).cache().queryOne()!>
           </#if>
           <#if payment?has_content && payment.paymentMethodTypeId?has_content>
-            <#assign paymentMethodType = delegator.findOne("PaymentMethodType", {"paymentMethodTypeId" : payment.paymentMethodTypeId}, true)>
+            <#assign paymentMethodType = EntityQuery.use(delegator).from("PaymentMethodType").where("paymentMethodTypeId", payment.paymentMethodTypeId!).cache().queryOne()!>
           </#if>
           <#if finAccountTrans.glReconciliationId?has_content>
-            <#assign glReconciliation = delegator.findOne("GlReconciliation", {"glReconciliationId" : finAccountTrans.glReconciliationId}, true)>
+            <#assign glReconciliation = EntityQuery.use(delegator).from("GlReconciliation").where("glReconciliationId", finAccountTrans.glReconciliationId!).cache().queryOne()!>
             <input name="openingBalance_o_${finAccountTrans_index}" type="hidden" value="${glReconciliation.openingBalance!}"/>
           </#if>
           <#if finAccountTrans.partyId?has_content>
-            <#assign partyName = (delegator.findOne("PartyNameView", {"partyId" : finAccountTrans.partyId}, true))!>
+            <#assign partyName = EntityQuery.use(delegator).from("PartyNameView").where("partyId", finAccountTrans.partyId!).cache().queryOne()!!>
           </#if>
           <tr valign="middle"<#if alt_row> class="alternate-row"</#if>>
             <td>
@@ -191,17 +191,17 @@ function getFinAccountTransRunningTotalA
                     </tr>
                     <#list payments as payment>
                       <#if payment?? && payment.paymentTypeId?has_content>
-                        <#assign paymentType = delegator.findOne("PaymentType", {"paymentTypeId" : payment.paymentTypeId}, true)>
+                        <#assign paymentType = EntityQuery.use(delegator).from("PaymentType").where("paymentTypeId", payment.paymentTypeId!).cache().queryOne()!>
                       </#if>
                       <#if payment?has_content && payment.paymentMethodTypeId?has_content>
-                        <#assign paymentMethodType = delegator.findOne("PaymentMethodType", {"paymentMethodTypeId" : payment.paymentMethodTypeId}, true)>
+                        <#assign paymentMethodType = EntityQuery.use(delegator).from("PaymentMethodType").where("paymentMethodTypeId", payment.paymentMethodTypeId!).cache().queryOne()!>
                       </#if>
                       <#if payment?has_content>
                         <#assign paymentGroupMembers = Static["org.apache.ofbiz.entity.util.EntityUtil"].filterByDate(payment.getRelated("PaymentGroupMember", null, null, false)!) />
                         <#assign fromParty = payment.getRelatedOne("FromParty", false)! />
-                        <#assign fromPartyName = delegator.findOne("PartyNameView", {"partyId" : fromParty.partyId}, true) />
+                        <#assign fromPartyName = EntityQuery.use(delegator).from("PartyNameView").where("partyId", fromParty.partyId!).cache().queryOne()!/>
                         <#assign toParty = payment.getRelatedOne("ToParty", false)! />
-                        <#assign toPartyName = delegator.findOne("PartyNameView", {"partyId" : toParty.partyId}, true) />
+                        <#assign toPartyName =EntityQuery.use(delegator).from("PartyNameView").where("partyId", toParty.partyId!).cache().queryOne()!/>
                         <#if paymentGroupMembers?has_content>
                           <#assign paymentGroupMember = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(paymentGroupMembers) />
                         </#if>

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/GlReconciledFinAccountTrans.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/GlReconciledFinAccountTrans.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/GlReconciledFinAccountTrans.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/GlReconciledFinAccountTrans.ftl Wed Dec 13 09:21:33 2017
@@ -30,7 +30,7 @@ under the License.
     </div>
     <div class="screenlet-body">
       <a href="<@ofbizUrl>EditFinAccountReconciliations?finAccountId=${finAccountId}&amp;glReconciliationId=${glReconciliationId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonEdit}</a>
-      <#assign finAcctTransCondList = delegator.findByAnd("FinAccountTrans", {"glReconciliationId" : glReconciliationId, "statusId" : "FINACT_TRNS_CREATED"}, null, false)>
+      <#assign finAcctTransCondList = EntityQuery.use(delegator).from("FinAccountTrans").where("glReconciliationId", glReconciliationId!, "statusId", "FINACT_TRNS_CREATED").queryList()!>
       <#if finAcctTransCondList?has_content>
         <a href="javascript:document.CancelBankReconciliationForm.submit();" class="buttontext">${uiLabelMap.AccountingCancelBankReconciliation}</a>
       </#if>
@@ -152,20 +152,20 @@ under the License.
             <#assign paymentMethodType = "">
             <#assign partyName = "">
             <#if finAccountTrans.paymentId?has_content>
-              <#assign payment = delegator.findOne("Payment", {"paymentId" : finAccountTrans.paymentId}, true)>
+              <#assign payment = EntityQuery.use(delegator).from("Payment").where("paymentId", finAccountTrans.paymentId!).cache().queryOne()!>
             </#if>
-            <#assign finAccountTransType = delegator.findOne("FinAccountTransType", {"finAccountTransTypeId" : finAccountTrans.finAccountTransTypeId}, true)>
+            <#assign finAccountTransType = EntityQuery.use(delegator).from("FinAccountTransType").where("finAccountTransTypeId", finAccountTrans.finAccountTransTypeId!).cache().queryOne()!>
             <#if finAccountTrans.statusId?has_content>
-              <#assign status = delegator.findOne("StatusItem", {"statusId" : finAccountTrans.statusId}, true)>
+              <#assign status = EntityQuery.use(delegator).from("StatusItem").where("statusId", finAccountTrans.statusId!).cache().queryOne()!>
             </#if>
             <#if payment?has_content && payment.paymentTypeId?has_content>
-              <#assign paymentType = delegator.findOne("PaymentType", {"paymentTypeId" : payment.paymentTypeId}, true)>
+              <#assign paymentType = EntityQuery.use(delegator).from("PaymentType").where("paymentTypeId", payment.paymentTypeId!).cache().queryOne()!>
             </#if>
             <#if payment?has_content && payment.paymentMethodTypeId?has_content>
-              <#assign paymentMethodType = delegator.findOne("PaymentMethodType", {"paymentMethodTypeId" : payment.paymentMethodTypeId}, true)>
+              <#assign paymentMethodType = EntityQuery.use(delegator).from("PaymentMethodType").where("paymentMethodTypeId", payment.paymentMethodTypeId!).cache().queryOne()!>
             </#if>
             <#if finAccountTrans.partyId?has_content>
-              <#assign partyName = (delegator.findOne("PartyNameView", {"partyId" : finAccountTrans.partyId}, true))>
+              <#assign partyName = EntityQuery.use(delegator).from("PartyNameView").where("partyId", finAccountTrans.partyId!).cache().queryOne()!>
             </#if>
             <tr valign="middle"<#if alt_row> class="alternate-row"</#if>>
               <td>

Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/ShowGlTransactions.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/ShowGlTransactions.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/ShowGlTransactions.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/template/finaccounttrans/ShowGlTransactions.ftl Wed Dec 13 09:21:33 2017
@@ -53,13 +53,13 @@ under the License.
        <td>${acctgTransEntry.isPosted!}</td>
        <td>
          <#if acctgTransEntry.glFiscalTypeId?has_content>
-           <#assign glFiscalType = delegator.findOne("GlFiscalType", {"glFiscalTypeId" : acctgTransEntry.glFiscalTypeId}, false)/>
+           <#assign glFiscalType = EntityQuery.use(delegator).from("GlFiscalType").where("glFiscalTypeId", acctgTransEntry.glFiscalTypeId!).queryOne()!/>
              ${glFiscalType.description!}
          </#if>
        </td>
        <td>
          <#if acctgTransEntry.acctgTransTypeId?has_content>
-           <#assign acctgTransType = delegator.findOne("AcctgTransType", {"acctgTransTypeId" : acctgTransEntry.acctgTransTypeId}, false)/>
+           <#assign acctgTransType = EntityQuery.use(delegator).from("AcctgTransType").where("acctgTransTypeId", acctgTransEntry.acctgTransTypeId!).queryOne()!/>
              ${acctgTransType.description!}
          </#if>
        </td>
@@ -75,7 +75,7 @@ under the License.
        <td>${acctgTransEntry.origAmount!}</td>
        <td>
          <#if acctgTransEntry.organizationPartyId?has_content>
-           <#assign partyName = delegator.findOne("PartyNameView", {"partyId" : acctgTransEntry.organizationPartyId}, false)>
+           <#assign partyName = EntityQuery.use(delegator).from("PartyNameView").where("partyId", acctgTransEntry.organizationPartyId!).queryOne()!>
            <#if "PERSON" == partyName.partyTypeId>
              ${partyName.firstName!} ${partyName.lastName!}
            <#elseif (partyName.partyTypeId) != "PARTY_GROUP">
@@ -85,7 +85,7 @@ under the License.
        </td>
        <td>
          <#if (acctgTransEntry.glAccountTypeId)?has_content>
-           <#assign glAccountType = delegator.findOne("GlAccountType", {"glAccountTypeId" : acctgTransEntry.glAccountTypeId}, false)>
+           <#assign glAccountType = EntityQuery.use(delegator).from("GlAccountType").where("glAccountTypeId", acctgTransEntry.glAccountTypeId!).queryOne()!>
              ${glAccountType.description!}
          </#if>
        </td>
@@ -93,20 +93,20 @@ under the License.
        <td>${acctgTransEntry.accountName!}</td>
        <td>
          <#if acctgTransEntry.glAccountClassId?has_content>
-           <#assign glAccountClass = delegator.findOne("GlAccountClass", {"glAccountClassId" : acctgTransEntry.glAccountClassId}, false)/>
+           <#assign glAccountClass = EntityQuery.use(delegator).from("GlAccountClass").where("glAccountClassId", acctgTransEntry.glAccountClassId!).queryOne()!/>
              ${glAccountClass.description!}
          </#if>
        </td>
        <td>${acctgTransEntry.partyId!}</td>
        <td>
          <#if acctgTransEntry.reconcileStatusId?has_content>
-           <#assign status = delegator.findOne("StatusItem", {"statusId" : finAccountTrans.statusId}, true)>
+           <#assign status =EntityQuery.use(delegator).from("StatusItem").where("statusId", finAccountTrans.statusId!).cache().queryOne()!>
              ${status.description!}
          </#if>
        </td>
        <td>
          <#if acctgTransEntry.acctgTransEntryTypeId?has_content>
-           <#assign acctgTransEntryType = delegator.findOne("AcctgTransEntryType", {"acctgTransEntryTypeId" : acctgTransEntry.acctgTransEntryTypeId}, true)>
+           <#assign acctgTransEntryType = EntityQuery.use(delegator).from("AcctgTransEntryType").where("acctgTransEntryTypeId", acctgTransEntry.acctgTransEntryTypeId!).cache().queryOne()!>
              ${acctgTransEntryType.description!}
          </#if>
        </td>

Modified: ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/FindFacility.groovy Wed Dec 13 09:21:33 2017
@@ -18,7 +18,7 @@
  */
  import org.apache.ofbiz.entity.util.EntityUtil
 
-findResult = delegator.findByAnd("Facility", [ownerPartyId: partyId], null, false)
+findResult = from("Facility").where("ownerPartyId", partyId).queryList();
 findResultSize = findResult.size()
 if (findResultSize == 1) {
     context.showScreen = "one"
@@ -32,7 +32,7 @@ if ((findResultSize > 1 ) && (findResult
     context.showScreen = "more"
 }
 
-listPartyPostalAddress = delegator.findByAnd("PartyAndPostalAddress", [partyId: partyId], null, false)
+listPartyPostalAddress = from("PartyAndPostalAddress").where("partyId", partyId).queryList();
 partyPostalAddress = EntityUtil.getFirst(EntityUtil.filterByDate(listPartyPostalAddress))
 context.partyPostalAddress = partyPostalAddress
 
@@ -49,7 +49,7 @@ if("productstore".equals(tabButtonItemTo
     if (!facilityId && request.getAttribute("facilityId")) {
       facilityId = request.getAttribute("facilityId")
     }
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false)
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
     if(facility){
         facilityType = facility.getRelatedOne("FacilityType", false)
         context.facilityType = facilityType

Modified: ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProdCatalog.groovy Wed Dec 13 09:21:33 2017
@@ -25,7 +25,7 @@
  showScreen = "origin"
  List errMsgList = []
 
- productStore = EntityUtil.getFirst(delegator.findByAnd("ProductStore", [payToPartyId: partyId], null, false))
+ productStore = from("ProductStore").where("payToPartyId", partyId).queryFirst();
  if(productStore){
      context.productStoreId = productStore.productStoreId
  }
@@ -33,8 +33,8 @@
      errMsgList.add("Product Store not set!")
      showScreen = "message"
  } else {
-     facility = delegator.findOne("Facility", [facilityId : productStore.inventoryFacilityId], false)
-     webSite = EntityUtil.getFirst(delegator.findByAnd("WebSite", [productStoreId: productStore.productStoreId], null, false))
+     facility =from("Facility").where("facilityId", productStore.inventoryFacilityId).queryOne();
+     webSite = from("WebSite").where("productStoreId", productStore.productStoreId).queryFirst();
     
      if(UtilValidate.isEmpty(facility)){
          errMsgList.add("Facility not set!")
@@ -50,7 +50,7 @@
     return
  }
 
- productStoreCatalog = EntityUtil.getFirst(delegator.findByAnd("ProductStoreCatalog", [productStoreId: productStore.productStoreId], null, false))
+ productStoreCatalog = from("ProductStoreCatalog").where("productStoreId", productStore.productStoreId).queryFirst();
  if(productStoreCatalog){
      prodCatalog = productStoreCatalog.getRelatedOne("ProdCatalog", false)
      prodCatalogId = prodCatalog.prodCatalogId
@@ -69,9 +69,9 @@
          showErrorMsg = "Y"
      }
     
-     prodCatalogCategory  = EntityUtil.getFirst(delegator.findByAnd("ProdCatalogCategory", [prodCatalogId: prodCatalogId, sequenceNum: new Long(1)], null, false))
+     prodCatalogCategory  = from("ProdCatalogCategory").where("prodCatalogId", prodCatalogId, "sequenceNum", new Long(1)).queryFirst();
      if(prodCatalogCategory){
-         productCategory = EntityUtil.getFirst(delegator.findByAnd("ProductCategory", [primaryParentCategoryId : prodCatalogCategory.productCategoryId], null, false))
+         productCategory = from("ProductCategory").where("primaryParentCategoryId", prodCatalogCategory.productCategoryId).queryFirst();
          if(productCategory){
              productCategoryId = productCategory.productCategoryId
          }
@@ -88,12 +88,12 @@
              showErrorMsg = "Y"
          }
          /**************** get product from ProductCategory ******************/
-         productCategoryMember  = EntityUtil.getFirst(delegator.findByAnd("ProductCategoryMember", [productCategoryId: productCategoryId], null, false))
+         productCategoryMember  = from("ProductCategoryMember").where("productCategoryId", productCategoryId).queryFirst();
          if(productCategoryMember){
              product = productCategoryMember.getRelatedOne("Product", false)
              productId = product.productId
              // Average cost
-             averageCostValues = delegator.findByAnd("ProductPrice", [productId : productId, productPricePurposeId : "PURCHASE", productPriceTypeId : "AVERAGE_COST"], null, false)
+             averageCostValues = from("ProductPrice").where("productId", productId, "productPricePurposeId", "PURCHASE", "productPriceTypeId", "AVERAGE_COST").queryList()
              if(averageCostValues){
                  averageCostValue = EntityUtil.getFirst(EntityUtil.filterByDate(averageCostValues))
                  if (averageCostValue?.price != null) {
@@ -101,7 +101,7 @@
                  }
              }
              //    Default cost
-             defaultPriceValues = delegator.findByAnd("ProductPrice", [productId : productId, productPricePurposeId : "PURCHASE", productPriceTypeId : "DEFAULT_PRICE"], null, false)
+             defaultPriceValues = from("ProductPrice").where("productId", productId, "productPricePurposeId", "PURCHASE", "productPriceTypeId", "DEFAULT_PRICE").queryList();
              if(defaultPriceValues){
                  defaultPrice = EntityUtil.getFirst(EntityUtil.filterByDate(defaultPriceValues))
                  if (defaultPrice?.price != null) {

Modified: ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/commonext/groovyScripts/ofbizsetup/GetProductStoreAndWebSite.groovy Wed Dec 13 09:21:33 2017
@@ -20,7 +20,7 @@
 
  productStoreId = null
 
-productStore = EntityUtil.getFirst(delegator.findByAnd("ProductStore", [payToPartyId: partyId], null, false))
+productStore = from("ProductStore").where("payToPartyId", partyId).queryFirst();
 if(productStore){
     productStoreId = productStore.productStoreId
 }
@@ -29,7 +29,7 @@ context.productStore = productStore
 
 if("website".equals(tabButtonItemTop)){
     if(productStoreId != null){
-        webSite = EntityUtil.getFirst(delegator.findByAnd("WebSite", [productStoreId: productStoreId], null, false))
+        webSite = from("WebSite").where("productStoreId", productStoreId).queryFirst();
         context.showScreen = "origin"
     }else{
         request.setAttribute("_ERROR_MESSAGE_", "Product Store not set!")

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java Wed Dec 13 09:21:33 2017
@@ -44,6 +44,7 @@ import org.apache.ofbiz.entity.GenericVa
 import org.apache.ofbiz.entity.condition.EntityCondition;
 import org.apache.ofbiz.entity.transaction.TransactionUtil;
 import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityQuery;
 
 public class ContentJsonEvents {
 
@@ -103,7 +104,7 @@ public class ContentJsonEvents {
         GenericValue assoc = TransactionUtil.inTransaction(new Callable<GenericValue>() {
             @Override
             public GenericValue call() throws Exception {
-                GenericValue oldAssoc = delegator.findOne("ContentAssoc", UtilMisc.toMap("contentIdTo", contentIdTo, "contentId", contentIdFrom, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), false);
+                GenericValue oldAssoc = EntityQuery.use(delegator).from("ContentAssoc").where("contentIdTo", contentIdTo, "contentId", contentIdFrom, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate).queryOne();
                 if (oldAssoc == null) {
                     throw new GenericEntityNotFoundException("Could not find ContentAssoc by primary key [contentIdTo: $contentIdTo, contentId: $contentIdFrom, contentAssocTypeId: $contentAssocTypeId, fromDate: $fromDate]");
                 }

Modified: ofbiz/ofbiz-framework/trunk/applications/content/template/content/ContentNav.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/template/content/ContentNav.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/template/content/ContentNav.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/template/content/ContentNav.ftl Wed Dec 13 09:21:33 2017
@@ -37,7 +37,7 @@ var rawdata = [
                 <#assign content  = delegator.findOne("Content",Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("contentId",assoc.contentIdTo), false)/>
                 {
                 "data": {"title" : unescapeHtmlText("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('${assoc.contentIdTo}');"}},
-                <#assign assocChilds  = delegator.findByAnd("ContentAssoc",Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("contentId",assoc.contentIdTo,"contentAssocTypeId", "TREE_CHILD"), null, false)/>
+                <#assign assocChilds  = EntityQuery.use(delegator).from("ContentAssoc").where("contentId", assoc.contentIdTo!, "contentAssocTypeId", "TREE_CHILD").queryList()!/>
                     "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "AssocType" : "${assoc.contentAssocTypeId}", "fromDate" : "${assoc.fromDate}"}
                 <#if assocChilds?has_content>
                     ,"children": [

Modified: ofbiz/ofbiz-framework/trunk/applications/content/template/content/DisplayContentNav.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/template/content/DisplayContentNav.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/template/content/DisplayContentNav.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/template/content/DisplayContentNav.ftl Wed Dec 13 09:21:33 2017
@@ -42,7 +42,7 @@ var rawdata = [
                 </#if>
                 {
                 "data": {"title" : unescapeHtmlText("${content.contentName!assoc.contentIdTo}"), "attr": {"href": "javascript:void(0);", "onClick" : "callDocument('${assoc.contentIdTo}');"}},
-                <#assign assocChilds  = delegator.findByAnd("ContentAssoc",Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("contentId",assoc.contentIdTo,"contentAssocTypeId", "TREE_CHILD"), Static["org.apache.ofbiz.base.util.UtilMisc"].toList("sequenceNum"), false)/>
+                <#assign assocChilds  = EntityQuery.use(delegator).from("ContentAssoc").where("contentId", assoc.contentIdTo!, "contentAssocTypeId", "TREE_CHILD").orderBy("sequenceNum").queryList()!/>
                     "attr": {"id" : "${assoc.contentIdTo}", "contentId" : "${assoc.contentId}", "AssocType" : "${assoc.contentAssocTypeId}", "fromDate" : "${assoc.fromDate}"}
                 <#if assocChilds?has_content>
                     ,"children": [

Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy Wed Dec 13 09:21:33 2017
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.util.EntityQuery
 import org.apache.ofbiz.entity.condition.EntityCondition
 import org.apache.ofbiz.entity.condition.EntityOperator
 

Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ShowProductionRun.groovy Wed Dec 13 09:21:33 2017
@@ -31,11 +31,11 @@ if (UtilValidate.isEmpty(productionRunId
 }
 if (UtilValidate.isNotEmpty(productionRunId)) {
 
-    GenericValue productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRunId), false)
+    GenericValue productionRun = from("WorkEffort").where("workEffortId", productionRunId).queryOne();
     if (UtilValidate.isNotEmpty(productionRun)) {
         // If this is a task, get the parent production run
         if (productionRun.getString("workEffortTypeId") != null && "PROD_ORDER_TASK".equals(productionRun.getString("workEffortTypeId"))) {
-            productionRun = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", productionRun.getString("workEffortParentId")), false)
+            productionRun = from("WorkEffort").where("workEffortId", productionRun.getString("workEffortParentId")).queryOne();
         }
     }
 

Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/reports/CuttingListReport.groovy Wed Dec 13 09:21:33 2017
@@ -37,7 +37,7 @@ selectPrimaryCategoryIdParameter = "CABI
 shipmentId = request.getParameter("shipmentId")
 context.shipmentId = shipmentId
 
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false)
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 context.shipment = shipment
 
 // dimensionsByFeatureMap [key=feature; value=productsByShapeMap]

Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/template/mrp/FindInventoryEventPlan.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/template/mrp/FindInventoryEventPlan.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/template/mrp/FindInventoryEventPlan.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/template/mrp/FindInventoryEventPlan.ftl Wed Dec 13 09:21:33 2017
@@ -152,8 +152,8 @@ document.lookupinventory.productId.focus
             </#if>
             <#if !(product == productTmp)>
                 <#assign quantityAvailableAtDate = 0>
-                <#assign errorEvents = delegator.findByAnd("MrpEvent", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("mrpEventTypeId", "ERROR", "productId", inven.productId), null, false)>
-                <#assign qohEvents = delegator.findByAnd("MrpEvent", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("mrpEventTypeId", "INITIAL_QOH", "productId", inven.productId), null, false)>
+                <#assign errorEvents = EntityQuery.use(delegator).from("MrpEvent").where("mrpEventTypeId", "ERROR", "productId", inven.productId!).queryList()!>
+                <#assign qohEvents = EntityQuery.use(delegator).from("MrpEvent").where("mrpEventTypeId", "INITIAL_QOH", "productId", inven.productId!).queryList()!>
                 <#assign additionalErrorMessage = "">
                 <#assign initialQohEvent = "">
                 <#assign productFacility = "">

Modified: ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/catalog/ProductSummary.groovy Wed Dec 13 09:21:33 2017
@@ -24,7 +24,6 @@
 
 import org.apache.ofbiz.base.util.UtilMisc
 import org.apache.ofbiz.base.util.UtilProperties
-import org.apache.ofbiz.entity.util.EntityQuery
 import org.apache.ofbiz.product.product.ProductContentWrapper
 import org.apache.ofbiz.product.config.ProductConfigWorker
 import org.apache.ofbiz.product.catalog.CatalogWorker
@@ -53,7 +52,7 @@ if (cart.isSalesOrder()) {
 }
 
 if (!facilityId) {
-    productStoreFacility = EntityQuery.use(delegator).select("facilityId").from("ProductStoreFacility").where("productStoreId", productStoreId).queryFirst()
+    productStoreFacility = select("facilityId").from("ProductStoreFacility").where("productStoreId", productStoreId).queryFirst()
     if (productStoreFacility) {
         facilityId = productStoreFacility.facilityId
     }

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Wed Dec 13 09:21:33 2017
@@ -4956,7 +4956,7 @@ public class OrderServices {
                         // This ship group is a drop shipment: we create a purchase order for it
                         String supplierPartyId = shipGroup.getString("supplierPartyId");
                         // Set supplier preferred currency for drop-ship (PO) order to support multi currency
-                        GenericValue supplierParty = delegator.findOne("Party", UtilMisc.toMap("partyId", supplierPartyId), false);
+                        GenericValue supplierParty = EntityQuery.use(delegator).from("Party").where("partyId", supplierPartyId).queryOne();
                         String currencyUomId = supplierParty.getString("preferredCurrencyUomId");
                         // If supplier currency not found then set currency of sales order
                         if (UtilValidate.isEmpty(currencyUomId)) {
@@ -6378,8 +6378,8 @@ public class OrderServices {
                     String newShipMethTypeDesc =null;
                     String shipMethTypeDesc=null;
                     try {
-                        shipMethTypeDesc = delegator.findOne("ShipmentMethodType", UtilMisc.toMap("shipmentMethodTypeId", shipmentMethodTypeId), false).getString("description");
-                        newShipMethTypeDesc = delegator.findOne("ShipmentMethodType", UtilMisc.toMap("shipmentMethodTypeId", shippingMethods.get(0).getString("shipmentMethodTypeId")), false).getString("description");
+                        shipMethTypeDesc = EntityQuery.use(delegator).from("ShipmentMethodType").where("shipmentMethodTypeId", shipmentMethodTypeId).queryOne().getString("description");
+                        newShipMethTypeDesc = EntityQuery.use(delegator).from("ShipmentMethodType").where("shipmentMethodTypeId", shippingMethods.get(0).getString("shipmentMethodTypeId")).queryOne().getString("description");
                     } catch(GenericEntityException e) {
                         Debug.logError(e, module);
                     }

Modified: ofbiz/ofbiz-framework/trunk/applications/order/template/order/EditOrderItems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/template/order/EditOrderItems.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/template/order/EditOrderItems.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/template/order/EditOrderItems.ftl Wed Dec 13 09:21:33 2017
@@ -137,7 +137,7 @@ under the License.
                               </td>
                               <td class="align-text" valign="top" nowrap="nowrap">
                                 <#assign shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)>
-                                <#assign shipmentReceipts = delegator.findByAnd("ShipmentReceipt", {"orderId" : orderHeader.getString("orderId"), "orderItemSeqId" : orderItem.orderItemSeqId}, null, false)/>
+                                <#assign shipmentReceipts = EntityQuery.use(delegator).from("ShipmentReceipt").where("orderId", orderHeader.getString("orderId")!, "orderItemSeqId", orderItem.orderItemSeqId!).queryList()!/>
                                 <#assign totalReceived = 0.0>
                                 <#if shipmentReceipts?? && shipmentReceipts?has_content>
                                   <#list shipmentReceipts as shipmentReceipt>
@@ -302,7 +302,7 @@ under the License.
             <#assign productPromoCodeId = ''>
             <#if "PROMOTION_ADJUSTMENT" == adjustmentType.get("orderAdjustmentTypeId") && orderHeaderAdjustment.get("productPromoId")?has_content>
                 <#assign productPromo = orderHeaderAdjustment.getRelatedOne("ProductPromo", false)>
-                <#assign productPromoCodes = delegator.findByAnd("ProductPromoCode", {"productPromoId":productPromo.productPromoId}, null, false)>
+                <#assign productPromoCodes = EntityQuery.use(delegator).from("ProductPromoCode").where("productPromoId", productPromo.productPromoId!).queryList()!>
                 <#assign orderProductPromoCode = ''>
                 <#list productPromoCodes as productPromoCode>
                     <#if !(orderProductPromoCode?has_content)>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderItems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderItems.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderItems.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderItems.ftl Wed Dec 13 09:21:33 2017
@@ -81,13 +81,7 @@ under the License.
                                         </#if>
                                     </div>
                                     <div style="float:right;">
-                                        <#assign downloadContents = delegator.findByAnd("OrderItemAndProductContentInfo", {
-                                                                                        "orderId" : orderItem.orderId,
-                                                                                        "orderItemSeqId" : orderItem.orderItemSeqId,
-                                                                                        "productContentTypeId" : "DIGITAL_DOWNLOAD",
-                                                                                        "statusId" : "ITEM_COMPLETED"},
-                                                                                        null,
-                                                                                        false)/>
+                                        <#assign downloadContents = EntityQuery.use(delegator).from("OrderItemAndProductContentInfo").where( "orderId", orderItem.orderId!, "orderItemSeqId", orderItem.orderItemSeqId!, "productContentTypeId", "DIGITAL_DOWNLOAD", "statusId", "ITEM_COMPLETED").queryList()!/>
                                         <#if downloadContents?has_content>
                                             <#list downloadContents as downloadContent>
                                                 <a href="/content/control/ViewSimpleContent?contentId=${downloadContent.contentId}" class="buttontext" target="_blank">${uiLabelMap.ContentDownload}</a>&nbsp;
@@ -228,7 +222,7 @@ under the License.
                                             <table>
                                                 <tr valign="top">
                                                     <#assign shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem)>
-                                                    <#assign shipmentReceipts = delegator.findByAnd("ShipmentReceipt", {"orderId" : orderHeader.getString("orderId"), "orderItemSeqId" : orderItem.orderItemSeqId}, null, false)/>
+                                                    <#assign shipmentReceipts = EntityQuery.use(delegator).from("ShipmentReceipt").where("orderId", orderHeader.getString("orderId")!, "orderItemSeqId", orderItem.orderItemSeqId!).queryList()!/>
                                                     <#assign totalReceived = 0.0>
                                                     <#if shipmentReceipts?? && shipmentReceipts?has_content>
                                                         <#list shipmentReceipts as shipmentReceipt>
@@ -358,8 +352,8 @@ under the License.
                             </#list>
                         </#if>
                         <#-- show linked order lines -->
-                        <#assign linkedOrderItemsTo = delegator.findByAnd("OrderItemAssoc", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")), null, false)>
-                        <#assign linkedOrderItemsFrom = delegator.findByAnd("OrderItemAssoc", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("toOrderId", orderItem.getString("orderId"), "toOrderItemSeqId", orderItem.getString("orderItemSeqId")), null, false)>
+                        <#assign linkedOrderItemsTo = EntityQuery.use(delegator).from("OrderItemAssoc").where("orderId", orderItem.getString("orderId"), "orderItemSeqId", orderItem.getString("orderItemSeqId")).queryList()!>
+                        <#assign linkedOrderItemsFrom = EntityQuery.use(delegator).from("OrderItemAssoc").where("toOrderId", orderItem.getString("orderId")!, "toOrderItemSeqId", orderItem.getString("orderItemSeqId")!).queryList()!>
                         <#if linkedOrderItemsTo?has_content>
                             <#list linkedOrderItemsTo as linkedOrderItem>
                                 <#assign linkedOrderId = linkedOrderItem.toOrderId>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderShippingInfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderShippingInfo.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderShippingInfo.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/template/order/OrderShippingInfo.ftl Wed Dec 13 09:21:33 2017
@@ -757,7 +757,7 @@ under the License.
                         ${uiLabelMap.CommonNbr}<a href="/facility/control/ViewShipment?shipmentId=${shipment.shipmentId}${StringUtil.wrapString(externalKeyParam)}" class="buttontext">${shipment.shipmentId}</a>&nbsp;&nbsp;
                         <a target="_BLANK" href="/facility/control/PackingSlip.pdf?shipmentId=${shipment.shipmentId}${StringUtil.wrapString(externalKeyParam)}" class="buttontext">${uiLabelMap.ProductPackingSlip}</a>
                         <#if "SALES_ORDER" == orderHeader.orderTypeId && "ORDER_COMPLETED" == orderHeader.statusId>
-                          <#assign shipmentRouteSegments = delegator.findByAnd("ShipmentRouteSegment", {"shipmentId" : shipment.shipmentId}, null, false)>
+                          <#assign shipmentRouteSegments = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipment.shipmentId!).queryList()!>
                           <#if shipmentRouteSegments?has_content>
                             <#assign shipmentRouteSegment = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(shipmentRouteSegments)>
                           <#if "UPS" == (shipmentRouteSegment.carrierPartyId)!>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/template/quote/ViewQuoteItemInfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/template/quote/ViewQuoteItemInfo.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/template/quote/ViewQuoteItemInfo.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/template/quote/ViewQuoteItemInfo.ftl Wed Dec 13 09:21:33 2017
@@ -74,7 +74,7 @@ under the License.
                             ${quoteItem.quoteItemSeqId}
                         </#if>
                         </div>
-                        <#assign quoteTerms = delegator.findByAnd("QuoteTerm", {"quoteId" : quoteItem.quoteId, "quoteItemSeqId" : quoteItem.quoteItemSeqId}, null, false)>
+                        <#assign quoteTerms = EntityQuery.use(delegator).from("QuoteTerm").where("quoteId", quoteItem.quoteId!, "quoteItemSeqId", quoteItem.quoteItemSeqId!).queryList()!>
                     </td>
                     <td valign="top">
                         <div>

Modified: ofbiz/ofbiz-framework/trunk/applications/order/template/return/ReturnLinks.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/template/return/ReturnLinks.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/template/return/ReturnLinks.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/template/return/ReturnLinks.ftl Wed Dec 13 09:21:33 2017
@@ -37,22 +37,22 @@ under the License.
           <ul>
       <li><a href="<@ofbizUrl>return.pdf?returnId=${returnId!}</@ofbizUrl>" target="_BLANK" >PDF</a></li>
       <#if returnId??>
-        <#assign returnItems = delegator.findByAnd("ReturnItem", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("returnId", returnId, "returnTypeId", "RTN_REFUND"), null, false)/>
+        <#assign returnItems = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId!, "returnTypeId", "RTN_REFUND").queryList()!/>
         <#if returnItems?has_content>
           <#assign orderId = (Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(returnItems)).getString("orderId")/>
           <#assign partyId = "${(returnHeader.fromPartyId)!}"/>
           <a href="<@ofbizUrl>setOrderCurrencyAgreementShipDates?partyId=${partyId!}&amp;originOrderId=${orderId!}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderCreateExchangeOrder} ${uiLabelMap.CommonFor} ${orderId!}</a>
         </#if>
         <#if returnHeader.statusId?has_content && "RETURN_ACCEPTED" == returnHeader.statusId>
-          <#assign returnItems = delegator.findByAnd("ReturnItem", {"returnId" : returnId}, null, false)/>
+          <#assign returnItems = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId!).queryList()!/>
           <#if returnItems?has_content>
             <#assign orderId = (Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(returnItems)).getString("orderId")/>
-            <#assign shipGroupAssoc = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("OrderItemShipGroupAssoc", {"orderId" : orderId}, null, false))/>
+            <#assign shipGroupAssoc = EntityQuery.use(delegator).from("OrderItemShipGroupAssoc").where("orderId", orderId!).queryFirst()!/>
             <#assign shipGroup = delegator.findOne("OrderItemShipGroup", {"orderId" : orderId, "shipGroupSeqId" : shipGroupAssoc.shipGroupSeqId}, false)>
             <#if shipGroup?? && shipGroup.shipmentMethodTypeId != "NO_SHIPPING">
-              <#assign shipGroupShipment = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("Shipment", {"primaryOrderId" : shipGroup.orderId, "primaryShipGroupSeqId" : shipGroup.shipGroupSeqId}, null, false))/>
+              <#assign shipGroupShipment = EntityQuery.use(delegator).from("Shipment").where("primaryOrderId", shipGroup.orderId!, "primaryShipGroupSeqId", shipGroup.shipGroupSeqId!).queryFirst()! />
                 <#if shipGroupShipment??>
-                <#assign shipmentRouteSegment = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("ShipmentRouteSegment", {"shipmentId" : shipGroupShipment.shipmentId}, null, false))!>
+                <#assign shipmentRouteSegment = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipGroupShipment.shipmentId!).queryFirst()!>
                 <#if shipmentRouteSegment??>
                   <#if "UPS" == shipmentRouteSegment.carrierPartyId!>
                     <li><a href="javascript:document.upsEmailReturnLabel.submit();" class="buttontext">${uiLabelMap.ProductEmailReturnShippingLabelUPS}</a></li>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java Wed Dec 13 09:21:33 2017
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.StringUtil;
-import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericEntityException;
@@ -73,7 +73,7 @@ public class SeoCatalogUrlServlet extend
         String productId = null;
         try {
             String lastPathElement = pathElements.get(pathElements.size() - 1);
-            if (lastPathElement.startsWith("p_") || delegator.findOne("Product", UtilMisc.toMap("productId", lastPathElement), true) != null) {
+            if (lastPathElement.startsWith("p_") || EntityQuery.use(delegator).from("Product").where("productId", lastPathElement).cache().queryOne() != null) {
                 if (lastPathElement.startsWith("p_")) {
                     productId = lastPathElement.substring(2);
                 } else {

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContentUrlFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContentUrlFilter.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContentUrlFilter.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContentUrlFilter.java Wed Dec 13 09:21:33 2017
@@ -40,6 +40,7 @@ import org.apache.ofbiz.common.UrlServle
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.entity.util.EntityQuery;
 
 public class SeoContentUrlFilter implements Filter {
     public final static String module = SeoContentUrlFilter.class.getName();
@@ -64,12 +65,11 @@ public class SeoContentUrlFilter impleme
             String alternativeUrl = pathInfo.substring(pathInfo.lastIndexOf('/'));
             if (alternativeUrl.endsWith("-content")) {
                 try {
-                    List<GenericValue> contentDataResourceViews = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("drObjectInfo", alternativeUrl), null, false);
+                    List<GenericValue> contentDataResourceViews = EntityQuery.use(delegator).from("ContentDataResourceView").where("drObjectInfo", alternativeUrl).queryList();
                     if (contentDataResourceViews.size() > 0) {
                         contentDataResourceViews = EntityUtil.orderBy(contentDataResourceViews, UtilMisc.toList("createdDate DESC"));
                         GenericValue contentDataResourceView = EntityUtil.getFirst(contentDataResourceViews);
-                        List<GenericValue> contents = EntityUtil.filterByDate(delegator.findByAnd("ContentAssoc",
-                                UtilMisc.toMap("contentAssocTypeId", "ALTERNATIVE_URL", "contentIdTo", contentDataResourceView.getString("contentId")), null, false));
+                        List<GenericValue> contents = EntityQuery.use(delegator).from("ContentAssoc").where("contentAssocTypeId", "ALTERNATIVE_URL", "contentIdTo", contentDataResourceView.getString("contentId")).filterByDate().queryList();
                         if (contents.size() > 0) {
                             GenericValue content = EntityUtil.getFirst(contents);
                             urlContentId = content.getString("contentId");

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogAltUrlSeoTransform.java Wed Dec 13 09:21:33 2017
@@ -26,12 +26,12 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilMisc;
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.base.util.template.FreeMarkerWorker;
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericEntityException;
 import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.entity.util.EntityUtilProperties;
 import org.apache.ofbiz.product.category.CatalogUrlFilter;
 import org.apache.ofbiz.product.category.CategoryContentWrapper;
@@ -149,7 +149,7 @@ public class CatalogAltUrlSeoTransform i
                             contextPath = prefixString.substring(prefixString.lastIndexOf('/'));
                         }
                         if (UtilValidate.isNotEmpty(productId)) {
-                            GenericValue product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), false);
+                            GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne();
                             ProductContentWrapper wrapper = new ProductContentWrapper(dispatcher, product, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator));
                             if (SeoConfigUtil.isCategoryUrlEnabled(contextPath)) {
                                 url = CatalogUrlSeoTransform.makeProductUrl(delegator, wrapper, prefixString, contextPath, productCategoryId, previousCategoryId, productId);
@@ -157,7 +157,7 @@ public class CatalogAltUrlSeoTransform i
                                 url = CatalogUrlFilter.makeProductUrl(wrapper, null, prefixString, previousCategoryId, productCategoryId, productId);
                             }
                         } else {
-                            GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId), false);
+                            GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryId).queryOne();
                             CategoryContentWrapper wrapper = new CategoryContentWrapper(dispatcher, productCategory, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator));
                             if (SeoConfigUtil.isCategoryUrlEnabled(contextPath)) {
                                 url = CatalogUrlSeoTransform.makeCategoryUrl(delegator, wrapper, prefixString, productCategoryId, previousCategoryId, productId, viewSize, viewIndex, viewSort, searchString);

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java Wed Dec 13 09:21:33 2017
@@ -44,6 +44,7 @@ import org.apache.ofbiz.entity.GenericVa
 import org.apache.ofbiz.entity.condition.EntityCondition;
 import org.apache.ofbiz.entity.condition.EntityExpr;
 import org.apache.ofbiz.entity.condition.EntityOperator;
+import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.product.category.CatalogUrlServlet;
 import org.apache.ofbiz.product.category.CategoryContentWrapper;
 import org.apache.ofbiz.product.category.CategoryWorker;
@@ -208,7 +209,7 @@ public class CatalogUrlSeoTransform impl
                             categoryNameId = categoryIdName;
                         }
                     } else {
-                        GenericValue productCategory = delegator.findOne("ProductCategory", UtilMisc.toMap("productCategoryId", categoryId), true);
+                        GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", categoryId).cache().queryOne();
                         CategoryContentWrapper wrapper = new CategoryContentWrapper(productCategory, request);
                         StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL", "url");
                         if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) {
@@ -256,7 +257,7 @@ public class CatalogUrlSeoTransform impl
         }
         if (UtilValidate.isNotEmpty(productId)) {
             try {
-                product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+                product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error looking up product info for productId [" + productId + "]: " + e.toString(), module);
             }
@@ -546,7 +547,7 @@ public class CatalogUrlSeoTransform impl
                 List<String> urlElements = StringUtil.split(lastPathElement, URL_HYPHEN);
                 if (UtilValidate.isEmpty(urlElements)) {
                     try {
-                        if (delegator.findOne("Product", UtilMisc.toMap("productId", lastPathElement), true) != null) {
+                        if (EntityQuery.use(delegator).from("Product").where("productId", lastPathElement).cache().queryOne() != null) {
                             productId = lastPathElement;
                         }
                     } catch (GenericEntityException e) {
@@ -688,7 +689,7 @@ public class CatalogUrlSeoTransform impl
         }
         if (UtilValidate.isNotEmpty(productId)) {
             try {
-                product = delegator.findOne("Product", UtilMisc.toMap("productId", productId), true);
+                product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Error looking up product info for productId [" + productId + "]: " + e.toString(), module);
             }

Modified: ofbiz/ofbiz-framework/trunk/applications/product/template/category/CreateProductInCategoryStart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/template/category/CreateProductInCategoryStart.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/template/category/CreateProductInCategoryStart.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/template/category/CreateProductInCategoryStart.ftl Wed Dec 13 09:21:33 2017
@@ -67,7 +67,7 @@ under the License.
                     <td width="15%">${uiLabelMap.ProductDefaultPrice}:</td>
                     <td><input type="text" name="defaultPrice" size="8"/>
                     <#assign findCurrenciesMap = Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("uomTypeId", "CURRENCY_MEASURE")>
-                    <#assign currencies = delegator.findByAnd('Uom', findCurrenciesMap, null, true) />
+                    <#assign currencies = EntityQuery.use(delegator).from("Uom").where(findCurrenciesMap!).cache().queryList()! />
                     <#if currencies?has_content && (currencies?size > 0)>
                         <select name="currencyUomId">
                             <option value=""></option>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PrintPickSheets.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PrintPickSheets.fo.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PrintPickSheets.fo.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PrintPickSheets.fo.ftl Wed Dec 13 09:21:33 2017
@@ -205,7 +205,7 @@ under the License.
                                                     <#if workOrderItemFulfillment?has_content>
                                                         <#assign workEffort = workOrderItemFulfillment.getRelatedOne("WorkEffort", false)/>
                                                         <#if workEffort?has_content>
-                                                            <#assign workEffortTask = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("WorkEffort", {"workEffortParentId" :  workEffort.workEffortId}, null, false))/>
+                                                            <#assign workEffortTask = EntityQuery.use(delegator).from("WorkEffort").where("workEffortParentId", workEffort.workEffortId!).queryFirst()!/>
                                                             <#if workEffortTask?has_content>
                                                                 <#assign workEffortInventoryAssigns = workEffortTask.getRelated("WorkEffortInventoryAssign", null, null, false)/>
                                                                 <#if workEffortInventoryAssigns?has_content>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/template/imagemanagement/ShowPeopleApprove.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/template/imagemanagement/ShowPeopleApprove.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/template/imagemanagement/ShowPeopleApprove.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/template/imagemanagement/ShowPeopleApprove.ftl Wed Dec 13 09:21:33 2017
@@ -38,11 +38,11 @@ jQuery(document).ready(function(){
         <#list partyRoles as partyRole>
             <td>
                 <table>
-                    <#assign userLoginApprovers  = delegator.findByAnd("UserLogin",Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("partyId", partyRole.partyId), null, false)/>
+                    <#assign userLoginApprovers  = EntityQuery.use(delegator).from("UserLogin").where("partyId", partyRole.partyId!).queryList()!/>
                     <#assign userLoginApprover = userLoginApprovers[0]>
                     <#assign userLoginAndPartyDetails = delegator.findOne("UserLoginAndPartyDetails", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("partyId", userLoginApprover.partyId, "userLoginId", userLoginApprover.userLoginId), false)!>
                     <#if userLoginAndPartyDetails?has_content>
-                        <#assign partyContentDetail  = delegator.findByAnd("ContentApproval",Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("roleTypeId", "IMAGEAPPROVER", "approvalStatusId", "IM_PENDING", "partyId", userLoginAndPartyDetails.partyId), null, false)/>
+                        <#assign partyContentDetail  = EntityQuery.use(delegator).from("ContentApproval").where("roleTypeId", "IMAGEAPPROVER", "approvalStatusId", "IM_PENDING", "partyId", userLoginAndPartyDetails.partyId!).queryList()!/>
                         <#assign imageApproveSize = partyContentDetail.size()>
                         <#if userLoginAndPartyDetails.userLoginId == userLogin.userLoginId>
                             <#if userMap.checkUser == userLoginAndPartyDetails.userLoginId>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/template/product/ViewProductOrders.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/template/product/ViewProductOrders.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/template/product/ViewProductOrders.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/template/product/ViewProductOrders.ftl Wed Dec 13 09:21:33 2017
@@ -72,7 +72,7 @@ under the License.
       </tr>
       <#if orderList?has_content && productId??>
         <#list orderList as order>
-          <#assign orderItems = delegator.findByAnd("OrderItem", {"orderId" : order.orderId, "productId" : productId}, null, false)/>
+          <#assign orderItems = EntityQuery.use(delegator).from("OrderItem").where("orderId", order.orderId!, "productId", productId!).queryList()!/>
           <#list orderItems as orderItem>
             <tr>
               <td><a href="/ordermgr/control/orderview?orderId=${orderItem.orderId}" class='buttontext'>${orderItem.orderId}</a></td>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/template/shipment/VerifyPick.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/template/shipment/VerifyPick.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/template/shipment/VerifyPick.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/template/shipment/VerifyPick.ftl Wed Dec 13 09:21:33 2017
@@ -208,10 +208,10 @@ under the License.
                 <#assign readyToVerify = verifyPickSession.getReadyToVerifyQuantity(orderId,orderItemSeqId)>
                 <#assign orderItemQuantity = orderItem.getBigDecimal("quantity")>
                 <#assign verifiedQuantity = 0.000000>
-                <#assign shipments = delegator.findByAnd("Shipment", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("primaryOrderId", orderItem.getString("orderId"), "statusId", "SHIPMENT_PICKED"), null, false)/>
+                <#assign shipments = EntityQuery.use(delegator).from("Shipment").where("primaryOrderId", orderItem.getString("orderId")!, "statusId", "SHIPMENT_PICKED").queryList()!/>
                 <#if (shipments?has_content)>
                   <#list shipments as shipment>
-                    <#assign itemIssuances = delegator.findByAnd("ItemIssuance", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("shipmentId", shipment.getString("shipmentId"), "orderItemSeqId", orderItemSeqId), null, false)/>
+                    <#assign itemIssuances = EntityQuery.use(delegator).from("ItemIssuance").where("shipmentId", shipment.getString("shipmentId")!, "orderItemSeqId", orderItemSeqId!).queryList()!/>
                     <#if itemIssuances?has_content>
                       <#list itemIssuances as itemIssuance>
                         <#assign verifiedQuantity = verifiedQuantity + itemIssuance.getBigDecimal("quantity")>
@@ -267,7 +267,7 @@ under the License.
                   <#if workOrderItemFulfillment?has_content>
                     <#assign workEffort = workOrderItemFulfillment.getRelatedOne("WorkEffort", false)/>
                     <#if workEffort?has_content>
-                      <#assign workEffortTask = Static["org.apache.ofbiz.entity.util.EntityUtil"].getFirst(delegator.findByAnd("WorkEffort", Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("workEffortParentId", workEffort.workEffortId), null, false))/>
+                      <#assign workEffortTask = EntityQuery.use(delegator).from("WorkEffort").where("workEffortParentId", workEffort.workEffortId!).queryFirst()!/>
                       <#if workEffortTask?has_content>
                         <#assign workEffortInventoryAssigns = workEffortTask.getRelated("WorkEffortInventoryAssign", null, null, false)/>
                         <#if workEffortInventoryAssigns?has_content>

Modified: ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java Wed Dec 13 09:21:33 2017
@@ -127,7 +127,7 @@ public class LoginEvents {
         String errMsg = null;
 
         try {
-            GenericValue userLoginSecurityQuestion = delegator.findOne("UserLoginSecurityQuestion", UtilMisc.toMap("questionEnumId", questionEnumId, "userLoginId", userLoginId), true);
+            GenericValue userLoginSecurityQuestion = EntityQuery.use(delegator).from("UserLoginSecurityQuestion").where("questionEnumId", questionEnumId, "userLoginId", userLoginId).cache().queryOne();
             if (userLoginSecurityQuestion != null) {
                 if (UtilValidate.isEmpty(securityAnswer)) {
                     errMsg = UtilProperties.getMessage(resource, "loginservices.security_answer_empty", UtilHttp.getLocale(request));

Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/workeffort/groovyScripts/ical/IsCalOwner.groovy Wed Dec 13 09:21:33 2017
@@ -21,7 +21,7 @@ import java.util.*
 import org.apache.ofbiz.entity.util.*
 
 boolean isCalOwner = false
-List partyAssignments = EntityUtil.filterByDate(delegator.findByAnd("WorkEffortPartyAssignment", ["workEffortId" : parameters.workEffortId, "partyId" : parameters.userLogin.partyId], null, false))
+List partyAssignments = from("WorkEffortPartyAssignment").where("workEffortId", parameters.workEffortId, "partyId", parameters.userLogin.partyId).filterByDate().queryFirst();
 for (partyAssign in partyAssignments) {
     if ("CAL_OWNER".equals(partyAssign.roleTypeId) || "CAL_DELEGATE".equals(partyAssign.roleTypeId)) {
         isCalOwner = true

Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/template/calendar/CalendarEventContent.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/template/calendar/CalendarEventContent.ftl?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/workeffort/template/calendar/CalendarEventContent.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/workeffort/template/calendar/CalendarEventContent.ftl Wed Dec 13 09:21:33 2017
@@ -25,7 +25,7 @@ under the License.
   <#if workOrderItemFulfillments?has_content>
     <#list workOrderItemFulfillments as workOrderItemFulfillment>
       <br/>${uiLabelMap.OrderOrderId}: <a href="/ordermgr/control/orderview?orderId=${workOrderItemFulfillment.orderId}" class="event">${workOrderItemFulfillment.orderId} / ${workOrderItemFulfillment.orderItemSeqId}</a>
-      <#assign orderItemAndShipGroupAssocs = delegator.findByAnd("OrderHeaderItemAndShipGroup", {"orderId", workOrderItemFulfillment.orderId, "orderItemSeqId", workOrderItemFulfillment.orderItemSeqId}, null, false)!/>
+      <#assign orderItemAndShipGroupAssocs = EntityQuery.use(delegator).from("OrderHeaderItemAndShipGroup").where("orderId", workOrderItemFulfillment.orderId!, "orderItemSeqId", workOrderItemFulfillment.orderItemSeqId!).queryList()!/>
       <#list orderItemAndShipGroupAssocs as orderItemAndShipGroupAssoc>
         <#if orderItemAndShipGroupAssoc.shipByDate?has_content>
           ${uiLabelMap.OrderShipBeforeDate}: ${orderItemAndShipGroupAssoc.shipByDate}
@@ -41,7 +41,7 @@ under the License.
   <#if parentWorkOrderItemFulfillments?has_content>
     <#list parentWorkOrderItemFulfillments as parentWorkOrderItemFulfillment>
       <br/>${uiLabelMap.OrderOrderId}: <a href="/ordermgr/control/orderview?orderId=${parentWorkOrderItemFulfillment.orderId}" class="event">${parentWorkOrderItemFulfillment.orderId} / ${parentWorkOrderItemFulfillment.orderItemSeqId}</a>
-      <#assign orderItemAndShipGroupAssocs = delegator.findByAnd("OrderHeaderItemAndShipGroup", {"orderId", parentWorkOrderItemFulfillment.orderId, "orderItemSeqId", parentWorkOrderItemFulfillment.orderItemSeqId}, null, false)!/>
+      <#assign orderItemAndShipGroupAssocs = EntityQuery.use(delegator).from("OrderHeaderItemAndShipGroup").where("orderId", parentWorkOrderItemFulfillment.orderId!, "orderItemSeqId", parentWorkOrderItemFulfillment.orderItemSeqId!).queryList()!/>
       <#list orderItemAndShipGroupAssocs as orderItemAndShipGroupAssoc>
         <#if orderItemAndShipGroupAssoc.shipByDate?has_content>
           ${uiLabelMap.OrderShipBeforeDate}: ${orderItemAndShipGroupAssoc.shipByDate}

Modified: ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GeoLocation.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GeoLocation.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GeoLocation.groovy Wed Dec 13 09:21:33 2017
@@ -18,6 +18,6 @@
  */
 
 if (geoPoint && geoPoint.elevationUomId) {
-    elevationUom = delegator.findOne("Uom", [uomId : geoPoint.elevationUomId], false)
+    elevationUom = from("Uom").where("uomId", geoPoint.elevationUomId).queryList();
     context.elevationUomAbbr = elevationUom.abbreviation
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy?rev=1817989&r1=1817988&r2=1817989&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy Wed Dec 13 09:21:33 2017
@@ -43,7 +43,7 @@ if (userLogin && parameters.parentPortal
     if (portalMainPages) {
         portalPageId = portalMainPages.get(0).portalPageId
         // check if overridden with a privat page
-        privatMainPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPageId, ownerUserLoginId : userLogin.userLoginId], null, false)
+        privatMainPages = from("PortalPage").where("originalPortalPageId", portalPageId, "ownerUserLoginId", userLogin.userLoginId).queryList();
         if (privatMainPages) {
             context.parameters.portalPageId = privatMainPages.get(0).portalPageId
         } else {
@@ -53,7 +53,7 @@ if (userLogin && parameters.parentPortal
 }
 // Debug.log('======portalPageId: ' + parameters.portalPageId)
 if (userLogin && parameters.portalPageId) {
-    portalPage = delegator.findOne("PortalPage", [portalPageId : parameters.portalPageId], false)
+    portalPage = from("PortalPage").where("portalPageId", parameters.portalPageId).queryOne();
     if (portalPage) {
         if (portalPage.parentPortalPageId) {
             context.parameters.parentPortalPageId = portalPage.parentPortalPageId