Author: jleroux
Date: Mon Oct 13 16:02:22 2014
New Revision: 1631452

URL: http://svn.apache.org/r1631452
Log:
Keeps in sync with OFBiz trunk HEAD
Merged revision(s) 1629587-1631449 from ofbiz/trunk:
Removes a number of duplicated labels certainly introduced with 
https://issues.apache.org/jira/browse/OFBIZ-5737
There are still some, I reopen the Jira issue
........
Add cache(boolean) method to EntityQuery to allow the cache to be used or not 
based on a boolean variable.  Avoids the need to use an if block when the 
caching decision isn't hardcoded
........
No functional change, clean end line space
........
Add junit test to control entity-auto on create, update and delete to ensure no 
regression when the entity-auto engine will be improve (like OFBIZ-5800)
........
Better French translation
........
Add where(EntityCondition...) to EntityQuery
........
Make use of EntityQuery.where(EntityCondition...)
........
Complete conversion of accounting java files from delegator to EntityQuery
........
Parameter name correction
........
Fix dead code warning by moving null check to the correct spot
........
Remove dead code
........


Added:
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/lib/freemarker-2.3.21.jar
      - copied unchanged from r1631449, 
ofbiz/trunk/framework/base/lib/freemarker-2.3.21.jar
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
      - copied unchanged from r1631449, 
ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEntityAutoTests.java
Removed:
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/lib/freemarker-2.3.21-rc02.jar
Modified:
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/   (props changed)
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath
    ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/config/ProductUiLabels.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/CatalogUrlFilter.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/config/UrlLoader.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/config/CommonUiLabels.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/entitydef/entitymodel_test.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/util/EntityQuery.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/servicedef/services_test_se.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/testdef/servicetests.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/example/config/ExampleEntityLabels.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/example/config/ExampleUiLabels.xml
    
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/projectmgr/config/ProjectMgrUiLabels.xml

Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1629587-1631449

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath 
(original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/.classpath Mon Oct 
13 16:02:22 2014
@@ -21,7 +21,7 @@
     <classpathentry kind="lib" 
path="framework/base/lib/clhm-release-1.0-lru.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/hamcrest-all-1.2.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/fop-1.1.jar"/>
-    <classpathentry kind="lib" 
path="framework/base/lib/freemarker-2.3.21-rc02.jar"/>
+    <classpathentry kind="lib" 
path="framework/base/lib/freemarker-2.3.21.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/httpclient-4.2.1.jar"/>
     <classpathentry kind="lib" 
path="framework/base/lib/httpclient-cache-4.2.1.jar"/>
     <classpathentry kind="lib" path="framework/base/lib/httpcore-4.2.1.jar"/>

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/LICENSE Mon Oct 13 
16:02:22 2014
@@ -18,6 +18,7 @@ framework/base/lib/avalon-framework-4.2.
 framework/base/lib/batik-all-1.7.jar
 framework/base/lib/barcode4j-2.1-barcode4j-fop-ext-complete.jar
 framework/base/lib/clhm-release-1.0-lru.jar
+framework/base/lib/freemarker-2.3.21.jar
 framework/base/lib/httpclient-4.2.1.jar
 framework/base/lib/httpclient-cache-4.2.1.jar
 framework/base/lib/httpcore-4.2.1.jar
@@ -435,7 +436,6 @@ BSD License:
 applications/content/lib/dom4j-1.6.1.jar
 framework/base/lib/antisamy-bin.1.2.jar
 framework/base/lib/bsh-engine-modified.jar
-framework/base/lib/freemarker-2.3.21-rc02.jar
 framework/base/lib/hamcrest-all-1.2.jar
 framework/base/lib/httpunit-1.7.jar
 framework/base/lib/ical4j-1.0-rc2.jar

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
 Mon Oct 13 16:02:22 2014
@@ -903,12 +903,11 @@ public class FinAccountPaymentServices {
         GenericValue trans = null;
         try {
             trans = EntityQuery.use(delegator).from("FinAccountTrans")
-                    .where(UtilMisc.toList(
+                    .where(
                             
EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, 
"DEPOSIT"),
                             EntityCondition.makeCondition("finAccountId", 
EntityOperator.EQUALS, finAccountId),
                             EntityCondition.makeCondition("orderId", 
EntityOperator.NOT_EQUAL, null)
-                            ))
-                            .orderBy("-transactionDate").queryFirst();
+                    ).orderBy("-transactionDate").queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
 Mon Oct 13 16:02:22 2014
@@ -761,10 +761,9 @@ public class InvoiceServices {
 
             // check for previous order payments
             List<GenericValue> orderPaymentPrefs = 
EntityQuery.use(delegator).from("OrderPaymentPreference")
-                    .where(UtilMisc.<EntityCondition>toList(
-                            EntityCondition.makeCondition("orderId", 
EntityOperator.EQUALS, orderId),
+                    .where(EntityCondition.makeCondition("orderId", 
EntityOperator.EQUALS, orderId),
                             EntityCondition.makeCondition("statusId", 
EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")
-                    )).queryList();
+                    ).queryList();
             List<GenericValue> currentPayments = FastList.newInstance();
             for (GenericValue paymentPref : orderPaymentPrefs) {
                 List<GenericValue> payments = 
paymentPref.getRelated("Payment", null, null, false);

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceWorker.java
 Mon Oct 13 16:02:22 2014
@@ -654,9 +654,8 @@ public class InvoiceWorker {
         try {
             Delegator delegator = invoice.getDelegator();
             invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem")
-                    .where(UtilMisc.<EntityCondition>toList(
-                            EntityCondition.makeCondition("invoiceId", 
invoice.getString("invoiceId")),
-                            EntityCondition.makeCondition("invoiceItemTypeId", 
EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)))
+                    .where(EntityCondition.makeCondition("invoiceId", 
invoice.getString("invoiceId")),
+                            EntityCondition.makeCondition("invoiceItemTypeId", 
EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator))
                     ).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Trouble getting InvoiceItem list", module);
@@ -692,11 +691,10 @@ public class InvoiceWorker {
         try {
             Delegator delegator = invoice.getDelegator();
             invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem")
-                    .where(UtilMisc.toList(
-                            EntityCondition.makeCondition("invoiceId", 
invoice.getString("invoiceId")),
+                    .where(EntityCondition.makeCondition("invoiceId", 
invoice.getString("invoiceId")),
                             EntityCondition.makeCondition("invoiceItemTypeId", 
EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)),
                             EntityCondition.makeCondition("taxAuthPartyId", 
taxAuthPartyId),
-                            EntityCondition.makeCondition("taxAuthGeoId", 
taxAuthGeoId))
+                            EntityCondition.makeCondition("taxAuthGeoId", 
taxAuthGeoId)
                     ).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Trouble getting InvoiceItem list", module);
@@ -714,11 +712,10 @@ public class InvoiceWorker {
          try {
              Delegator delegator = invoice.getDelegator();
              invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem")
-                     .where(UtilMisc.toList(
-                             EntityCondition.makeCondition("invoiceId", 
invoice.get("invoiceId")),
+                     .where(EntityCondition.makeCondition("invoiceId", 
invoice.get("invoiceId")),
                              
EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, 
getTaxableInvoiceItemTypeIds(delegator)),
-                             EntityCondition.makeCondition("taxAuthPartyId", 
null)))
-                     .queryList();
+                             EntityCondition.makeCondition("taxAuthPartyId", 
null)
+                     ).queryList();
          } catch (GenericEntityException e) {
              Debug.logError(e, "Trouble getting InvoiceItem list", module);
              return null;

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/BillingAccountWorker.java
 Mon Oct 13 16:02:22 2014
@@ -79,10 +79,9 @@ public class BillingAccountWorker {
         List<String> relatedPartyIdList = 
UtilGenerics.checkList(agentResult.get("relatedPartyIdList"));
 
         List<GenericValue> billingAccountRoleList = 
EntityQuery.use(delegator).from("BillingAccountRole")
-                .where(UtilMisc.toList(
-                        EntityCondition.makeCondition("partyId", 
EntityOperator.IN, relatedPartyIdList),
-                        EntityCondition.makeCondition("roleTypeId", 
EntityOperator.EQUALS, "BILL_TO_CUSTOMER")))
-                .filterByDate().queryList();
+                .where(EntityCondition.makeCondition("partyId", 
EntityOperator.IN, relatedPartyIdList),
+                        EntityCondition.makeCondition("roleTypeId", 
EntityOperator.EQUALS, "BILL_TO_CUSTOMER")
+                ).filterByDate().queryList();
 
         if (billingAccountRoleList.size() > 0) {
             BigDecimal totalAvailable = BigDecimal.ZERO;
@@ -115,12 +114,11 @@ public class BillingAccountWorker {
      */
     public static List<GenericValue> getBillingAccountOpenOrders(Delegator 
delegator, String billingAccountId) throws GenericEntityException {
         return EntityQuery.use(delegator).from("OrderHeader")
-                .where(UtilMisc.toList(
-                        EntityCondition.makeCondition("billingAccountId", 
EntityOperator.EQUALS, billingAccountId),
+                .where(EntityCondition.makeCondition("billingAccountId", 
EntityOperator.EQUALS, billingAccountId),
                         EntityCondition.makeCondition("statusId", 
EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
                         EntityCondition.makeCondition("statusId", 
EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
-                        EntityCondition.makeCondition("statusId", 
EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")))
-                .queryList();
+                        EntityCondition.makeCondition("statusId", 
EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")
+                ).queryList();
     }
 
     /**

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
 Mon Oct 13 16:02:22 2014
@@ -2698,9 +2698,8 @@ public class PaymentGatewayServices {
         EntityListIterator eli = null;
         try {
             eli = EntityQuery.use(delegator).from("OrderPaymentPreference")
-                    .where(UtilMisc.toList(
-                            EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
-                            EntityCondition.makeCondition("processAttempt", 
EntityOperator.GREATER_THAN, Long.valueOf(0))))
+                    .where(EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
+                            EntityCondition.makeCondition("processAttempt", 
EntityOperator.GREATER_THAN, Long.valueOf(0)))
                     .orderBy("orderId").queryIterator();
             List<String> processList = FastList.newInstance();
             if (eli != null) {
@@ -2748,9 +2747,8 @@ public class PaymentGatewayServices {
         EntityListIterator eli = null;
         try {
             eli = EntityQuery.use(delegator).from("OrderPaymentPreference")
-                    .where(UtilMisc.toList(
-                            EntityCondition.makeCondition("needsNsfRetry", 
EntityOperator.EQUALS, "Y"), 
-                            
EntityCondition.makeCondition(ModelEntity.STAMP_FIELD, 
EntityOperator.LESS_THAN_EQUAL_TO, oneWeekAgo)))
+                    .where(EntityCondition.makeCondition("needsNsfRetry", 
EntityOperator.EQUALS, "Y"), 
+                            
EntityCondition.makeCondition(ModelEntity.STAMP_FIELD, 
EntityOperator.LESS_THAN_EQUAL_TO, oneWeekAgo))
                     .orderBy("orderId").queryIterator();
 
             List<String> processList = FastList.newInstance();

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java
 Mon Oct 13 16:02:22 2014
@@ -28,11 +28,13 @@ import java.util.Map;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
 
@@ -65,27 +67,26 @@ public class PeriodServices {
             List<EntityCondition> findClosedConditions = 
UtilMisc.toList(EntityCondition.makeConditionMap("organizationPartyId", 
organizationPartyId),
                     EntityCondition.makeCondition("thruDate", 
EntityOperator.LESS_THAN_EQUAL_TO, findDate),
                     EntityCondition.makeConditionMap("isClosed", "Y"));
-            if ((periodTypeId != null) && !(periodTypeId.equals(""))) {
+            if (UtilValidate.isNotEmpty(periodTypeId)) {
                 // if a periodTypeId was supplied, use it
                 
findClosedConditions.add(EntityCondition.makeConditionMap("periodTypeId", 
periodTypeId));
             }
-            List<GenericValue> closedTimePeriods = 
delegator.findList("CustomTimePeriod", 
EntityCondition.makeCondition(findClosedConditions),
-                    UtilMisc.toSet("customTimePeriodId", "periodTypeId", 
"isClosed", "fromDate", "thruDate"),
-                    UtilMisc.toList("thruDate DESC"), null, false);
+            GenericValue closedTimePeriod = 
EntityQuery.use(delegator).select("customTimePeriodId", "periodTypeId", 
"isClosed", "fromDate", "thruDate")
+                    .where(findClosedConditions).orderBy("thruDate 
DESC").queryFirst();
 
-            if ((closedTimePeriods != null) && (closedTimePeriods.size() > 0) 
&& (closedTimePeriods.get(0).get("thruDate") != null)) {
-                lastClosedTimePeriod = closedTimePeriods.get(0);
+            if (closedTimePeriod != null && closedTimePeriod.get("thruDate") 
!= null) {
+                lastClosedTimePeriod = closedTimePeriod;
                 lastClosedDate = 
UtilDateTime.toTimestamp(lastClosedTimePeriod.getDate("thruDate"));
             } else {
                 // uh oh, no time periods have been closed?  in that case, 
just find the earliest beginning of a time period for this organization
                 // and optionally, for this period type
                 Map<String, String> findParams = 
UtilMisc.toMap("organizationPartyId", organizationPartyId);
-                if ((periodTypeId != null) && !(periodTypeId.equals(""))) {
+                if (UtilValidate.isNotEmpty(periodTypeId)) {
                     findParams.put("periodTypeId", periodTypeId);
                 }
-                List<GenericValue> timePeriods = 
delegator.findByAnd("CustomTimePeriod", findParams, UtilMisc.toList("fromDate 
ASC"), false);
-                if ((timePeriods != null) && (timePeriods.size() > 0) && 
(timePeriods.get(0).get("fromDate") != null)) {
-                    lastClosedDate = 
UtilDateTime.toTimestamp(timePeriods.get(0).getDate("fromDate"));
+                GenericValue timePeriod = 
EntityQuery.use(delegator).from("CustomTimePeriod").where(findParams).orderBy("fromDate
 ASC").queryFirst();
+                if (timePeriod != null && timePeriod.get("fromDate") != null) {
+                    lastClosedDate = 
UtilDateTime.toTimestamp(timePeriod.getDate("fromDate"));
                 } else {
                     return 
ServiceUtil.returnError(UtilProperties.getMessage(resource, 
                             "AccountingPeriodCannotGet", locale));

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java
 Mon Oct 13 16:02:22 2014
@@ -42,7 +42,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.party.contact.ContactMechWorker;
 import org.ofbiz.product.product.ProductWorker;
 import org.ofbiz.service.DispatchContext;
@@ -82,8 +82,8 @@ public class TaxAuthorityServices {
         if (shippingPrice != null) priceWithTax = 
priceWithTax.add(shippingPrice);
 
         try {
-            GenericValue product = delegator.findOne("Product", 
UtilMisc.toMap("productId", productId), true);
-            GenericValue productStore = delegator.findOne("ProductStore", 
UtilMisc.toMap("productStoreId", productStoreId), true);
+            GenericValue product = 
EntityQuery.use(delegator).from("Product").where("productId", 
productId).cache().queryOne();
+            GenericValue productStore = 
EntityQuery.use(delegator).from("ProductStore").where("productStoreId", 
productStoreId).cache().queryOne();
             if (productStore == null) {
                 throw new IllegalArgumentException("Could not find 
ProductStore with ID [" + productStoreId + "] for tax calculation");
             }
@@ -91,10 +91,11 @@ public class TaxAuthorityServices {
             if ("Y".equals(productStore.getString("showPricesWithVatTax"))) {
                 Set<GenericValue> taxAuthoritySet = FastSet.newInstance();
                 if (productStore.get("vatTaxAuthPartyId") == null) {
-                    List<GenericValue> taxAuthorityRawList = 
delegator.findList("TaxAuthority", 
EntityCondition.makeCondition("taxAuthGeoId", EntityOperator.EQUALS, 
productStore.get("vatTaxAuthGeoId")), null, null, null, true);
+                    List<GenericValue> taxAuthorityRawList = 
EntityQuery.use(delegator).from("TaxAuthority")
+                            .where("taxAuthGeoId", 
productStore.get("vatTaxAuthGeoId")).cache().queryList();
                     taxAuthoritySet.addAll(taxAuthorityRawList);
                 } else {
-                    GenericValue taxAuthority = 
delegator.findOne("TaxAuthority", UtilMisc.toMap("taxAuthGeoId", 
productStore.get("vatTaxAuthGeoId"), "taxAuthPartyId", 
productStore.get("vatTaxAuthPartyId")), true);
+                    GenericValue taxAuthority = 
EntityQuery.use(delegator).from("TaxAuthority").where("taxAuthGeoId", 
productStore.get("vatTaxAuthGeoId"), "taxAuthPartyId", 
productStore.get("vatTaxAuthPartyId")).cache().queryOne();
                     taxAuthoritySet.add(taxAuthority);
                 }
 
@@ -154,10 +155,10 @@ public class TaxAuthorityServices {
         GenericValue facility = null;
         try {
             if (productStoreId != null) {
-                productStore = delegator.findOne("ProductStore", 
UtilMisc.toMap("productStoreId", productStoreId), false);
+                productStore = 
EntityQuery.use(delegator).from("ProductStore").where("productStoreId", 
productStoreId).queryOne();
             }
             if (facilityId != null) {
-                facility = delegator.findOne("Facility", 
UtilMisc.toMap("facilityId", facilityId), false);
+                facility = 
EntityQuery.use(delegator).from("Facility").where("facilityId", 
facilityId).queryOne();
             }
         } catch (GenericEntityException e) {
             Debug.logError(e, "Data error getting tax settings: " + 
e.toString(), module);
@@ -173,8 +174,7 @@ public class TaxAuthorityServices {
             try {
                 GenericValue facilityContactMech = 
ContactMechWorker.getFacilityContactMechByPurpose(delegator, facilityId, 
UtilMisc.toList("SHIP_ORIG_LOCATION", "PRIMARY_LOCATION"));
                 if (facilityContactMech != null) {
-                    shippingAddress = delegator.findOne("PostalAddress",
-                            UtilMisc.toMap("contactMechId", 
facilityContactMech.getString("contactMechId")), false);
+                    shippingAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
facilityContactMech.get("contactMechId")).queryOne();
                 }
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Data error getting tax settings: " + 
e.toString(), module);
@@ -258,7 +258,8 @@ public class TaxAuthorityServices {
         geoIdByTypeMap = GeoWorker.expandGeoRegionDeep(geoIdByTypeMap, 
delegator);
         //Debug.logInfo("Tax calc geoIdByTypeMap after expand:" + 
geoIdByTypeMap, module);
 
-        List<GenericValue> taxAuthorityRawList = 
delegator.findList("TaxAuthority", 
EntityCondition.makeCondition("taxAuthGeoId", EntityOperator.IN, 
geoIdByTypeMap.values()), null, null, null, true);
+        List<GenericValue> taxAuthorityRawList = EntityQuery.use(delegator)
+                
.from("TaxAuthority").where(EntityCondition.makeCondition("taxAuthGeoId", 
EntityOperator.IN, geoIdByTypeMap.values())).cache().queryList();
         taxAuthoritySet.addAll(taxAuthorityRawList);
         //Debug.logInfo("Tax calc taxAuthoritySet after expand:" + 
taxAuthoritySet, module);
     }
@@ -325,8 +326,9 @@ public class TaxAuthorityServices {
                 } else {
                     productIdCond = EntityCondition.makeCondition("productId", 
EntityOperator.EQUALS, product.getString("productId"));
                 }
-                List<GenericValue> pcmList = 
delegator.findList("ProductCategoryMember", productIdCond, 
UtilMisc.toSet("productCategoryId", "fromDate", "thruDate"), null, null, true);
-                pcmList = EntityUtil.filterByDate(pcmList, true);
+                List<GenericValue> pcmList = 
EntityQuery.use(delegator).select("productCategoryId", "fromDate", "thruDate")
+                        .from("ProductCategoryMember")
+                        
.where(productIdCond).cache().filterByDate().queryList();
                 for (GenericValue pcm : pcmList) {
                     
productCategoryIdSet.add(pcm.getString("productCategoryId"));
                 }
@@ -376,20 +378,17 @@ public class TaxAuthorityServices {
             
mainExprs.add(EntityCondition.makeCondition(EntityCondition.makeCondition("minPurchase",
 EntityOperator.EQUALS, null), EntityOperator.OR, 
EntityCondition.makeCondition("minPurchase", EntityOperator.LESS_THAN_EQUAL_TO, 
itemAmount)));
             EntityCondition mainCondition = 
EntityCondition.makeCondition(mainExprs, EntityOperator.AND);
 
-            // create the orderby clause
-            List<String> orderList = UtilMisc.<String>toList("minItemPrice", 
"minPurchase", "fromDate");
-
             // finally ready... do the rate query
-            List<GenericValue> lookupList = 
delegator.findList("TaxAuthorityRateProduct", mainCondition, null, orderList, 
null, false);
-            List<GenericValue> filteredList = 
EntityUtil.filterByDate(lookupList, true);
+            List<GenericValue> lookupList = 
EntityQuery.use(delegator).from("TaxAuthorityRateProduct")
+                    .where(mainCondition).orderBy("minItemPrice", 
"minPurchase", "fromDate").filterByDate().queryList();
 
-            if (filteredList.size() == 0) {
+            if (lookupList.size() == 0) {
                 Debug.logWarning("In TaxAuthority Product Rate no records were 
found for condition:" + mainCondition.toString(), module);
                 return adjustments;
             }
 
             // find the right entry(s) based on purchase amount
-            for (GenericValue taxAuthorityRateProduct : filteredList) {
+            for (GenericValue taxAuthorityRateProduct : lookupList) {
                 BigDecimal taxRate = 
taxAuthorityRateProduct.get("taxPercentage") != null ? 
taxAuthorityRateProduct.getBigDecimal("taxPercentage") : ZERO_BASE;
                 BigDecimal taxable = ZERO_BASE;
 
@@ -415,7 +414,8 @@ public class TaxAuthorityServices {
                 String taxAuthPartyId = 
taxAuthorityRateProduct.getString("taxAuthPartyId");
 
                 // get glAccountId from TaxAuthorityGlAccount entity using the 
payToPartyId as the organizationPartyId
-                GenericValue taxAuthorityGlAccount = 
delegator.findOne("TaxAuthorityGlAccount", UtilMisc.toMap("taxAuthPartyId", 
taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, "organizationPartyId", 
payToPartyId), false);
+                GenericValue taxAuthorityGlAccount = 
EntityQuery.use(delegator).from("TaxAuthorityGlAccount")
+                        .where("taxAuthPartyId", taxAuthPartyId, 
"taxAuthGeoId", taxAuthGeoId, "organizationPartyId", payToPartyId).queryOne();
                 String taxAuthGlAccountId = null;
                 if (taxAuthorityGlAccount != null) {
                     taxAuthGlAccountId = 
taxAuthorityGlAccount.getString("glAccountId");
@@ -426,15 +426,13 @@ public class TaxAuthorityServices {
                 GenericValue productPrice = null;
                 if (product != null && taxAuthPartyId != null && taxAuthGeoId 
!= null) {
                     // find a ProductPrice for the productId and taxAuth* 
values, and see if it has a priceWithTax value
-                    Map<String, String> priceFindMap = 
UtilMisc.toMap("productId", product.getString("productId"), 
-                            "taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", 
taxAuthGeoId, 
-                            "productPricePurposeId", "PURCHASE");
-                    List<GenericValue> productPriceList = 
delegator.findByAnd("ProductPrice", priceFindMap, UtilMisc.toList("-fromDate"), 
false);
-                    productPriceList = 
EntityUtil.filterByDate(productPriceList, true);
-                    productPrice = (productPriceList != null && 
productPriceList.size() > 0) ? productPriceList.get(0): null;
+                    productPrice = 
EntityQuery.use(delegator).from("ProductPrice")
+                            .where("productId", product.get("productId"), 
+                                    "taxAuthPartyId", taxAuthPartyId, 
"taxAuthGeoId", taxAuthGeoId, 
+                                    "productPricePurposeId", "PURCHASE")
+                            .orderBy("-fromDate").filterByDate().queryFirst();
                     //Debug.logInfo("=================== productId=" + 
product.getString("productId"), module);
                     //Debug.logInfo("=================== productPrice=" + 
productPrice, module);
-                    
                 }
 
                 GenericValue taxAdjValue = 
delegator.makeValue("OrderAdjustment");
@@ -468,7 +466,10 @@ public class TaxAuthorityServices {
                     // look for PartyRelationship with 
partyRelationshipTypeId=GROUP_ROLLUP, the partyIdTo is the group member, so the 
partyIdFrom is the groupPartyId
                     Set<String> billToPartyIdSet = FastSet.newInstance();
                     billToPartyIdSet.add(billToPartyId);
-                    List<GenericValue> partyRelationshipList = 
EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", 
UtilMisc.toMap("partyIdTo", billToPartyId, "partyRelationshipTypeId", 
"GROUP_ROLLUP"), null, true), true);
+                    List<GenericValue> partyRelationshipList = 
EntityQuery.use(delegator).from("PartyRelationship")
+                            .where("partyIdTo", billToPartyId, 
"partyRelationshipTypeId", "GROUP_ROLLUP")
+                            .cache().filterByDate().queryList();
+
                     for (GenericValue partyRelationship : 
partyRelationshipList) {
                         
billToPartyIdSet.add(partyRelationship.getString("partyIdFrom"));
                     }
@@ -543,11 +544,10 @@ public class TaxAuthorityServices {
         
ptiConditionList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate",
 EntityOperator.EQUALS, null), EntityOperator.OR, 
EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, 
nowTimestamp)));
         EntityCondition ptiCondition = 
EntityCondition.makeCondition(ptiConditionList, EntityOperator.AND);
         // sort by -fromDate to get the newest (largest) first, just in case 
there is more than one, we only want the most recent valid one, should only be 
one per jurisdiction...
-        List<GenericValue> partyTaxInfos = 
delegator.findList("PartyTaxAuthInfo", ptiCondition, null, 
UtilMisc.toList("-fromDate"), null, false);
+        GenericValue partyTaxInfo = 
EntityQuery.use(delegator).from("PartyTaxAuthInfo").where(ptiCondition).orderBy("-fromDate").queryFirst();
 
         boolean foundExemption = false;
-        if (partyTaxInfos.size() > 0) {
-            GenericValue partyTaxInfo = partyTaxInfos.get(0);
+        if (partyTaxInfo != null) {
             adjValue.set("customerReferenceId", 
partyTaxInfo.get("partyTaxId"));
             if ("Y".equals(partyTaxInfo.getString("isExempt"))) {
                 adjValue.set("amount", BigDecimal.ZERO);
@@ -559,11 +559,9 @@ public class TaxAuthorityServices {
         // if no exceptions were found for the current; try the parent
         if (!foundExemption) {
             // try the "parent" TaxAuthority
-            List<GenericValue> taxAuthorityAssocList = 
delegator.findByAnd("TaxAuthorityAssoc",
-                    UtilMisc.toMap("toTaxAuthGeoId", taxAuthGeoId, 
"toTaxAuthPartyId", taxAuthPartyId, "taxAuthorityAssocTypeId", "EXEMPT_INHER"),
-                    UtilMisc.toList("-fromDate"), true);
-            taxAuthorityAssocList = 
EntityUtil.filterByDate(taxAuthorityAssocList, true);
-            GenericValue taxAuthorityAssoc = 
EntityUtil.getFirst(taxAuthorityAssocList);
+            GenericValue taxAuthorityAssoc = 
EntityQuery.use(delegator).from("TaxAuthorityAssoc")
+                    .where("toTaxAuthGeoId", taxAuthGeoId, "toTaxAuthPartyId", 
taxAuthPartyId, "taxAuthorityAssocTypeId", "EXEMPT_INHER")
+                    .orderBy("-fromDate").filterByDate().queryFirst();
             // Debug.logInfo("Parent assoc to " + taxAuthGeoId + " : " + 
taxAuthorityAssoc, module);
             if (taxAuthorityAssoc != null) {
                 handlePartyTaxExempt(adjValue, billToPartyIdSet, 
taxAuthorityAssoc.getString("taxAuthGeoId"), 
taxAuthorityAssoc.getString("taxAuthPartyId"), taxAmount, nowTimestamp, 
delegator);

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java
 Mon Oct 13 16:02:22 2014
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.service.testtools.OFBizTestCase;
 
@@ -38,7 +39,7 @@ public class FinAccountTests extends OFB
     }
 
     public void testFinAccountOperations() throws Exception {
-        GenericValue userLogin = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", "system"), false);
+        GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
"system").queryOne();
         Map<String, Object> ctx = new HashMap<String, Object>();
         ctx.put("finAccountId", "TESTACCOUNT1");
         ctx.put("finAccountName", "Test Financial Account");

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
 Mon Oct 13 16:02:22 2014
@@ -40,6 +40,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceUtil;
@@ -790,7 +791,7 @@ public class AIMPaymentServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue payflowPro = 
delegator.findOne("PaymentGatewayAuthorizeNet", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                GenericValue payflowPro = 
EntityQuery.use(delegator).from("PaymentGatewayAuthorizeNet").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(payflowPro)) {
                     Object payflowProField = 
payflowPro.get(paymentGatewayConfigParameterName);
                     if (payflowProField != null) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
 Mon Oct 13 16:02:22 2014
@@ -673,7 +673,7 @@ public class IcsPaymentServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue cyberSource = 
delegator.findOne("PaymentGatewayCyberSource", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                GenericValue cyberSource = 
EntityQuery.use(delegator).from("PaymentGatewayCyberSource").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(cyberSource)) {
                     Object cyberSourceField = 
cyberSource.get(paymentGatewayConfigParameterName);
                     if (cyberSourceField != null) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/eway/EwayServices.java
 Mon Oct 13 16:02:22 2014
@@ -30,6 +30,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
 
@@ -267,8 +268,9 @@ public class EwayServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(cfgId)) {
             try {
-                GenericValue gv = delegator.findOne("PaymentGatewayEway", 
true, "paymentGatewayConfigId", cfgId);                         
-                if (UtilValidate.isNotEmpty(gv)) {
+                GenericValue gv = 
EntityQuery.use(delegator).from("PaymentGatewayEway")
+                        .where("paymantGatewayConfigId", 
cfgId).cache().queryOne();
+                if (gv != null) {
                     Object field = gv.get(cfgParamName);
                     if (field != null) {
                         returnValue = field.toString().trim();

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
 Mon Oct 13 16:02:22 2014
@@ -38,6 +38,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -364,9 +365,8 @@ public class RitaServices {
                 Timestamp orderDate = orderHeader.getTimestamp("orderDate");
                 GenericValue terminalState = null;
                 try {
-                    List<GenericValue> states = 
delegator.findByAnd("PosTerminalState", UtilMisc.toMap("posTerminalId", 
terminalId), null, false);
-                    states = EntityUtil.filterByDate(states, 
UtilDateTime.nowTimestamp(), "openedDate", "closedDate", true);
-                    terminalState = EntityUtil.getFirst(states);
+                    terminalState = 
EntityQuery.use(delegator).from("PosTerminalState")
+                            .where("posTerminalId", 
terminalId).filterByDate("openedDate", "closedDate").queryFirst();
                 } catch (GenericEntityException e) {
                     Debug.logError(e, module);
                 }
@@ -405,7 +405,7 @@ public class RitaServices {
         GenericValue orderPaymentPreference = (GenericValue) 
context.get("orderPaymentPreference");
         GenericValue creditCard = (GenericValue) context.get("creditCard");
         if (creditCard == null) {
-            creditCard = delegator.findOne("CreditCard", 
UtilMisc.toMap("paymentMethodId", 
orderPaymentPreference.getString("paymentMethodId")), false);
+            creditCard = 
EntityQuery.use(delegator).from("CreditCard").where("paymentMethodId", 
orderPaymentPreference.getString("paymentMethodId")).queryOne();
         }
         if (creditCard != null) {
             List<String> expDateList = 
StringUtil.split(creditCard.getString("expireDate"), "/");

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/ideal/IdealEvents.java
 Mon Oct 13 16:02:22 2014
@@ -48,6 +48,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.order.order.OrderChangeHelper;
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.service.GenericServiceException;
@@ -83,8 +84,8 @@ public class IdealEvents {
         GenericValue orderHeader = null;
         List<GenericValue> orderItemList = null;
         try {
-            orderHeader = delegator.findOne("OrderHeader", 
UtilMisc.toMap("orderId", orderId), false);
-            orderItemList = delegator.findByAnd("OrderItem", 
UtilMisc.toMap("orderId", orderId));
+            orderHeader = 
EntityQuery.use(delegator).from("OrderHeader").where("orderId", 
orderId).queryOne();
+            orderItemList = 
EntityQuery.use(delegator).from("OrderItem").where("orderId", 
orderId).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot get the order header for order: " + 
orderId, module);
             request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage(resourceErr, 
"idealEvents.problemsGettingOrderHeader", locale));
@@ -225,7 +226,7 @@ public class IdealEvents {
         if (userLogin == null) {
             String userLoginId = "system";
             try {
-                userLogin = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", userLoginId), false);
+                userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
userLoginId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Cannot get UserLogin for: " + userLoginId + 
"; cannot continue", module);
                 request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage(resourceErr, 
"idealEvents.problemsGettingAuthenticationUser", locale));
@@ -236,7 +237,7 @@ public class IdealEvents {
         GenericValue orderHeader = null;
         if (UtilValidate.isNotEmpty(orderId)) {
             try {
-                orderHeader = delegator.findOne("OrderHeader", 
UtilMisc.toMap("orderId", orderId), false);
+                orderHeader = 
EntityQuery.use(delegator).from("OrderHeader").where("orderId", 
orderId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Cannot get the order header for order: " + 
orderId, module);
                 request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage(resourceErr, 
"idealEvents.problemsGettingOrderHeader", locale));
@@ -311,8 +312,8 @@ public class IdealEvents {
         Debug.logVerbose("Setting payment prefrences..", module);
         List <GenericValue> paymentPrefs = null;
         try {
-            Map <String, String> paymentFields = UtilMisc.toMap("orderId", 
orderId, "statusId", "PAYMENT_NOT_RECEIVED");
-            paymentPrefs = delegator.findByAnd("OrderPaymentPreference", 
paymentFields);
+            paymentPrefs = 
EntityQuery.use(delegator).from("OrderPaymentPreference")
+                    .where("orderId", orderId, "statusId", 
"PAYMENT_NOT_RECEIVED").queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot get payment preferences for order #" + 
orderId, module);
             return false;
@@ -374,7 +375,7 @@ public class IdealEvents {
 
         GenericValue userLoginId = null;
         try {
-            userLoginId = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", "system"), false);
+            userLoginId = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
"system").queryOne();
         } catch (GenericEntityException e) {
             return false;
         }
@@ -405,7 +406,7 @@ public class IdealEvents {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue ideal = delegator.findOne("PaymentGatewayiDEAL", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                GenericValue ideal = 
EntityQuery.use(delegator).from("PaymentGatewayiDEAL").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(ideal)) {
                     Object idealField = 
ideal.get(paymentGatewayConfigParameterName);
                     if (idealField != null) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java
 Mon Oct 13 16:02:22 2014
@@ -34,6 +34,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ModelService;
@@ -291,7 +292,7 @@ public class OrbitalPaymentServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue paymentGatewayOrbital = 
delegator.findOne("PaymentGatewayOrbital", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                GenericValue paymentGatewayOrbital = 
EntityQuery.use(delegator).from("PaymentGatewayOrbital").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(paymentGatewayOrbital)) {
                     Object paymentGatewayOrbitalField = 
paymentGatewayOrbital.get(paymentGatewayConfigParameterName);
                     if (UtilValidate.isNotEmpty(paymentGatewayOrbitalField)) {
@@ -630,13 +631,12 @@ public class OrbitalPaymentServices {
     private static String getShippingRefForOrder(String orderId, Delegator 
delegator) {
         String shippingRef = "";
         try {
-            GenericValue orderHeader = delegator.findOne("OrderHeader", false, 
UtilMisc.toMap("orderId", orderId));
-            GenericValue trackingCodeOrder = 
EntityUtil.getFirst(orderHeader.getRelated("TrackingCodeOrder", null, null, 
false));
+            GenericValue trackingCodeOrder = 
EntityQuery.use(delegator).from("TrackingCodeOrder").where("orderId", 
orderId).queryFirst();
             GenericValue trackingCode = null;
-            if (UtilValidate.isNotEmpty(trackingCodeOrder)) {
+            if (trackingCodeOrder != null) {
                 trackingCode = trackingCodeOrder.getRelatedOne("TrackingCode", 
false);
             }
-            if (UtilValidate.isNotEmpty(trackingCode) && 
UtilValidate.isNotEmpty(trackingCode.getString("description"))) {
+            if (trackingCode != null && 
UtilValidate.isNotEmpty(trackingCode.getString("description"))) {
                 // get tracking code description and provide it into shipping 
reference.
                 shippingRef = trackingCode.getString("trackingCodeId") + 
"====" + trackingCode.getString("description");
             } else {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java
 Mon Oct 13 16:02:22 2014
@@ -48,6 +48,7 @@ import org.ofbiz.entity.GenericEntityExc
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.order.order.OrderChangeHelper;
 import org.ofbiz.product.store.ProductStoreWorker;
 import org.ofbiz.service.GenericServiceException;
@@ -74,7 +75,7 @@ public class PayPalEvents {
         // get the order header
         GenericValue orderHeader = null;
         try {
-            orderHeader = delegator.findOne("OrderHeader", 
UtilMisc.toMap("orderId", orderId), false);
+            orderHeader = 
EntityQuery.use(delegator).from("OrderHeader").where("orderId", 
orderId).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot get the order header for order: " + 
orderId, module);
             request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage(resourceErr, 
"payPalEvents.problemsGettingOrderHeader", locale));
@@ -260,7 +261,7 @@ public class PayPalEvents {
         // get the system user
         GenericValue userLogin = null;
         try {
-            userLogin = delegator.findOne("UserLogin", 
UtilMisc.toMap("userLoginId", "system"), false);
+            userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
"system").queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot get UserLogin for: system; cannot 
continue", module);
             request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage(resourceErr, 
"payPalEvents.problemsGettingAuthenticationUser", locale));
@@ -274,7 +275,7 @@ public class PayPalEvents {
         GenericValue orderHeader = null;
         if (UtilValidate.isNotEmpty(orderId)) {
             try {
-                orderHeader = delegator.findOne("OrderHeader", 
UtilMisc.toMap("orderId", orderId), false);
+                orderHeader = 
EntityQuery.use(delegator).from("OrderHeader").where("orderId", 
orderId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Cannot get the order header for order: " + 
orderId, module);
                 request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage(resourceErr, 
"payPalEvents.problemsGettingOrderHeader", locale));
@@ -405,8 +406,7 @@ public class PayPalEvents {
         Debug.logVerbose("Setting payment prefrences..", module);
         List <GenericValue> paymentPrefs = null;
         try {
-            Map <String, String> paymentFields = UtilMisc.toMap("orderId", 
orderId, "statusId", "PAYMENT_NOT_RECEIVED");
-            paymentPrefs = delegator.findByAnd("OrderPaymentPreference", 
paymentFields, null, false);
+            paymentPrefs = 
EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", 
orderId, "statusId", "PAYMENT_NOT_RECEIVED").queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Cannot get payment preferences for order #" + 
orderId, module);
             return false;
@@ -509,11 +509,11 @@ public class PayPalEvents {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue payPal = 
delegator.findOne("PaymentGatewayPayPal", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
-                if (UtilValidate.isNotEmpty(payPal)) {
-                    Object payPalField = 
payPal.get(paymentGatewayConfigParameterName);
+                GenericValue payPal = 
EntityQuery.use(delegator).from("PaymentGatewayPayPal").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
+                if (payPal != null) {
+                    String payPalField = 
payPal.getString(paymentGatewayConfigParameterName);
                     if (payPalField != null) {
-                        returnValue = payPalField.toString().trim();
+                        returnValue = payPalField.trim();
                     }
                 }
             } catch (GenericEntityException e) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalServices.java
 Mon Oct 13 16:02:22 2014
@@ -54,6 +54,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityFunction;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.order.order.OrderReadHelper;
 import org.ofbiz.order.shoppingcart.CartItemModifyException;
@@ -205,7 +206,7 @@ public class PayPalServices {
         inMap.put("postalCode", paramMap.get("SHIPTOZIP"));
 
         try {
-            GenericValue userLogin = delegator.findOne("UserLogin", true, 
UtilMisc.toMap("userLoginId", "system"));
+            GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
"system").cache().queryOne();
             inMap.put("userLogin", userLogin);
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
@@ -286,9 +287,9 @@ public class PayPalServices {
 
         // Remove the temporary ship address
         try {
-            GenericValue postalAddress = delegator.findOne("PostalAddress", 
false, UtilMisc.toMap("contactMechId", contactMechId));
+            GenericValue postalAddress = 
EntityQuery.use(delegator).from("PostalAddress").where("contactMechId", 
contactMechId).queryOne();
             postalAddress.remove();
-            GenericValue contactMech = delegator.findOne("ContactMech", false, 
UtilMisc.toMap("contactMechId", contactMechId));
+            GenericValue contactMech = 
EntityQuery.use(delegator).from("ContactMech").where("contactMechId", 
contactMechId).queryOne();
             contactMech.remove();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
@@ -383,7 +384,7 @@ public class PayPalServices {
 
         if (cart.getUserLogin() == null) {
             try {
-                GenericValue userLogin = delegator.findOne("UserLogin", false, 
"userLoginId", "anonymous");
+                GenericValue userLogin = 
EntityQuery.use(delegator).from("UserLogin").where("userLoginId", 
"anonymous").queryOne();
                 try {
                     cart.setUserLogin(userLogin, dispatcher);
                 } catch (CartItemModifyException e) {
@@ -406,7 +407,7 @@ public class PayPalServices {
         if (partyId != null) {
             GenericValue party = null;
             try {
-                party = delegator.findOne("Party", false, "partyId", partyId);
+                party = 
EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }
@@ -449,22 +450,23 @@ public class PayPalServices {
         if (!newParty) {
             EntityCondition cond = 
EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition(UtilMisc.toMap("partyId", 
partyId, "contactMechTypeId", "EMAIL_ADDRESS")),
-                    
EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), 
EntityComparisonOperator.EQUALS, EntityFunction.UPPER(emailAddress)),
-                    EntityUtil.getFilterByDateExpr()
+                    
EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), 
EntityComparisonOperator.EQUALS, EntityFunction.UPPER(emailAddress))
 
            ));
             try {
-                GenericValue matchingEmail = 
EntityUtil.getFirst(delegator.findList("PartyAndContactMech", cond, null, 
UtilMisc.toList("fromDate"), null, false));
+                GenericValue matchingEmail = 
EntityQuery.use(delegator).from("PartyAndContactMech").where(cond).orderBy("fromDate").filterByDate().queryFirst();
                 if (matchingEmail != null) {
                     emailContactMechId = 
matchingEmail.getString("contactMechId");
                 } else {
                     // No email found so we'll need to create one but first 
check if it should be PRIMARY or just BILLING
-                    cond = EntityCondition.makeCondition(UtilMisc.toList(
-                            
EntityCondition.makeCondition(UtilMisc.toMap("partyId", partyId, 
"contactMechTypeId", "EMAIL_ADDRESS", "contactMechPurposeTypeId", 
"PRIMARY_EMAIL")),
-                            
EntityCondition.makeConditionDate("contactFromDate", "contactThruDate"),
-                            
EntityCondition.makeConditionDate("purposeFromDate", "purposeThruDate")));
-                    List<GenericValue> primaryEmails = 
delegator.findList("PartyContactWithPurpose", cond, null, null, null, false);
-                    if (UtilValidate.isNotEmpty(primaryEmails)) 
emailContactPurposeTypeId = "BILLING_EMAIL";
+                    long primaryEmails = EntityQuery.use(delegator)
+                            .from("PartyContactWithPurpose")
+                            .where("partyId", partyId, 
+                                    "contactMechTypeId", "EMAIL_ADDRESS", 
+                                    "contactMechPurposeTypeId", 
"PRIMARY_EMAIL")
+                            .filterByDate("contactFromDate", 
"contactThruDate", "purposeFromDate", "purposeThruDate")
+                            .queryCount();
+                    if (primaryEmails > 0) emailContactPurposeTypeId = 
"BILLING_EMAIL";
                 }
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
@@ -535,18 +537,16 @@ public class PayPalServices {
             EntityCondition cond = 
EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition(postalMap),
                     EntityCondition.makeCondition(UtilMisc.toMap("attnName", 
null, "directions", null, "postalCodeExt", null,"postalCodeGeoId", null)),
-                    EntityUtil.getFilterByDateExpr(),
                     EntityCondition.makeCondition("partyId", partyId)
            ));
             try {
-                GenericValue postalMatch = 
EntityUtil.getFirst(delegator.findList("PartyAndPostalAddress", cond, null, 
UtilMisc.toList("fromDate"), null, false));
+                GenericValue postalMatch = 
EntityQuery.use(delegator).from("PartyAndPostalAddress")
+                        
.where(cond).orderBy("fromDate").filterByDate().queryFirst();
                 if (postalMatch != null) {
                     postalContactId = postalMatch.getString("contactMechId");
-                    EntityCondition purposeCond = 
EntityCondition.makeCondition(UtilMisc.toList(
-                            
EntityCondition.makeCondition(UtilMisc.toMap("partyId", partyId, 
"contactMechId", postalContactId)),
-                            EntityUtil.getFilterByDateExpr()
-                   ));
-                    List<GenericValue> postalPurposes = 
delegator.findList("PartyContactMechPurpose", purposeCond, null, null, null, 
false);
+                    List<GenericValue> postalPurposes = 
EntityQuery.use(delegator).from("PartyContactMechPurpose")
+                            .where("partyId", partyId, "contactMechId", 
postalContactId)
+                            .filterByDate().queryList();
                     List<Object> purposeStrings = 
EntityUtil.getFieldListFromEntityList(postalPurposes, 
"contactMechPurposeTypeId", false);
                     if (UtilValidate.isNotEmpty(purposeStrings) && 
purposeStrings.contains("SHIPPING_LOCATION")) {
                         needsShippingPurpose = false;
@@ -601,10 +601,13 @@ public class PayPalServices {
             cart.setAllCarrierPartyId(shipMethodSplit[0]);
             String shippingMethodTypeDesc = StringUtils.join(shipMethodSplit, 
" - ", 1, shipMethodSplit.length);
             try {
-                EntityCondition cond = EntityCondition.makeCondition(
-                        UtilMisc.toMap("productStoreId", 
cart.getProductStoreId(), "partyId", shipMethodSplit[0], "roleTypeId", 
"CARRIER", "description", shippingMethodTypeDesc)
-               );
-                GenericValue shipmentMethod = 
EntityUtil.getFirst(delegator.findList("ProductStoreShipmentMethView", cond, 
null, null, null, false));
+                GenericValue shipmentMethod = EntityQuery.use(delegator)
+                        .from("ProductStoreShipmentMethView")
+                        .where("productStoreId", cart.getProductStoreId(), 
+                                "partyId", shipMethodSplit[0], 
+                                "roleTypeId", "CARRIER", 
+                                "description", shippingMethodTypeDesc)
+                        .queryFirst();
                 
cart.setAllShipmentMethodTypeId(shipmentMethod.getString("shipmentMethodTypeId"));
             } catch (GenericEntityException e1) {
                 Debug.logError(e1, module);
@@ -983,7 +986,7 @@ public class PayPalServices {
         }
         if (paymentGatewayConfigId != null) {
             try {
-                payPalGatewayConfig = 
delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", 
paymentGatewayConfigId);
+                payPalGatewayConfig = 
EntityQuery.use(delegator).from("PaymentGatewayPayPal").where("paymentGatewayConfigId",
 paymentGatewayConfigId).cache().queryOne();
             } catch (GenericEntityException e) {
                 Debug.logError(e, module);
             }
@@ -1019,8 +1022,8 @@ public class PayPalServices {
     private static String getCountryGeoIdFromGeoCode(String geoCode, Delegator 
delegator) {
         String geoId = null;
         try {
-            EntityCondition cond 
=EntityCondition.makeCondition(UtilMisc.toMap("geoTypeId", "COUNTRY", 
"geoCode", geoCode));
-            GenericValue countryGeo = 
EntityUtil.getFirst(delegator.findList("Geo", cond, null, null, null, true));
+            GenericValue countryGeo = EntityQuery.use(delegator).from("Geo")
+                    .where("geoTypeId", "COUNTRY", "geoCode", 
geoCode).cache().queryFirst();
             if (countryGeo != null) {
                 geoId = countryGeo.getString("geoId");
             }
@@ -1045,7 +1048,8 @@ public class PayPalServices {
         EntityCondition cond = EntityCondition.makeCondition(conditionList);
         GenericValue geoAssocAndGeoTo = null;
         try {
-            geoAssocAndGeoTo = 
EntityUtil.getFirst(delegator.findList("GeoAssocAndGeoTo", cond, null, null, 
null, true));
+            geoAssocAndGeoTo = 
EntityQuery.use(delegator).from("GeoAssocAndGeoTo").where(cond).cache().queryFirst();
+            
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
 Mon Oct 13 16:02:22 2014
@@ -303,7 +303,7 @@ public class SagePayPaymentServices {
         Debug.logInfo("SagePay ccRefund captureTransaction : " + 
captureTransaction, module);
         GenericValue creditCard = null;
         try {
-            creditCard = delegator.getRelatedOne("CreditCard", 
orderPaymentPreference, false);
+            creditCard = orderPaymentPreference.getRelatedOne("CreditCard", 
false);
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error getting CreditCard for 
OrderPaymentPreference : " + orderPaymentPreference, module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
"AccountingPaymentUnableToGetCCInfo", locale) + " " + orderPaymentPreference);

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
 Mon Oct 13 16:02:22 2014
@@ -38,6 +38,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceUtil;
@@ -55,7 +56,7 @@ public class SagePayServices
 
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue sagePay = 
delegator.findOne("PaymentGatewaySagePay", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                GenericValue sagePay = 
EntityQuery.use(delegator).from("PaymentGatewaySagePay").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(sagePay)) {
                     Map<String, Object> tmp = sagePay.getAllFields();
                     Set<String> keys = tmp.keySet();

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
 Mon Oct 13 16:02:22 2014
@@ -32,6 +32,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ServiceUtil;
 
@@ -298,17 +299,13 @@ public class SecurePayPaymentServices {
                     
"AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale));
         }
 
-        List<GenericValue> paymentGatewayResponse = null;
         String referenceNum = null;
         try {
-            paymentGatewayResponse = 
delegator.findByAnd("PaymentGatewayResponse", UtilMisc.toMap(
-                    "orderPaymentPreferenceId", 
authTransaction.getString("orderPaymentPreferenceId"),
-                    "paymentServiceTypeEnumId", "PRDS_PAY_CAPTURE"));
-            if (paymentGatewayResponse.size() > 0) {
-                referenceNum = (String) 
paymentGatewayResponse.get(0).get("referenceNum");
-            } else {
-                referenceNum = authTransaction.getString("referenceNum");
-            }
+            GenericValue paymentGatewayResponse = 
EntityQuery.use(delegator).from("PaymentGatewayResponse")
+                    .where("orderPaymentPreferenceId", 
authTransaction.get("orderPaymentPreferenceId"),
+                            "paymentServiceTypeEnumId", "PRDS_PAY_CAPTURE")
+                    .queryFirst();
+            referenceNum = paymentGatewayResponse != null ? 
paymentGatewayResponse.get("referenceNum") : 
authTransaction.getString("referenceNum");
         } catch (GenericEntityException e) {
             e.printStackTrace();
         }
@@ -483,7 +480,7 @@ public class SecurePayPaymentServices {
         String returnValue = "";
         if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
             try {
-                GenericValue securePay = 
delegator.findOne("PaymentGatewaySecurePay", 
UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                GenericValue securePay = 
EntityQuery.use(delegator).from("PaymentGatewaySecurePay").where("paymentGatewayConfigId",
 paymentGatewayConfigId).queryOne();
                 if (UtilValidate.isNotEmpty(securePay)) {
                     Object securePayField = 
securePay.get(paymentGatewayConfigParameterName);
                     if (securePayField != null) {

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java
 Mon Oct 13 16:02:22 2014
@@ -104,7 +104,7 @@ public class SecurePayServiceTest extend
             "maxAmount", new BigDecimal("200.00"), 
             "statusId", "PAYMENT_AUTHORIZED"));
         
-        GenericValue checkOrderPaymentPreference = 
delegator.findOne("OrderPaymentPreference", 
UtilMisc.toMap("orderPaymentPreferenceId", "testOrder1000_01"), false);
+        GenericValue checkOrderPaymentPreference = 
EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId",
 "testOrder1000_01").queryOne();
         if (UtilValidate.isEmpty(checkOrderPaymentPreference)) {
             orderPaymentPreference.create();
         }
@@ -151,7 +151,7 @@ public class SecurePayServiceTest extend
                         "paymentServiceTypeEnumId", "PRDS_PAY_AUTH",
                         "currencyUomId", "AUD"
                         ));
-                GenericValue checkPaymentGatewayResponse = 
delegator.findOne("PaymentGatewayResponse", 
UtilMisc.toMap("paymentGatewayResponseId", "testOrder1000_01"), false);
+                GenericValue checkPaymentGatewayResponse = 
EntityQuery.use(delegator).from("PaymentGatewayResponse").where("paymentGatewayResponseId",
 "testOrder1000_01").queryOne();
                 if (UtilValidate.isEmpty(checkPaymentGatewayResponse)) {
                     paymentGatewayResponse.create();
                 }
@@ -163,7 +163,7 @@ public class SecurePayServiceTest extend
 
     public void testdoCapture() throws Exception {
         Debug.logInfo("=====[testdoCapture] starting....", module);
-        GenericValue paymentGatewayResponse = 
delegator.findOne("PaymentGatewayResponse", 
UtilMisc.toMap("paymentGatewayResponseId", "testOrder1000_01"), false);
+        GenericValue paymentGatewayResponse = 
EntityQuery.use(delegator).from("PaymentGatewayResponse").where("paymentGatewayResponseId",
 "testOrder1000_01").queryOne();
         try {
             Map<String, Object> serviceInput = UtilMisc.<String, Object>toMap(
                     "paymentConfig", configFile,
@@ -185,7 +185,7 @@ public class SecurePayServiceTest extend
                 TestCase.fail("Returned messages:" + 
result.get("internalRespMsgs"));
             } else {
                 String captureRefNum = (String) result.get("captureRefNum");
-                GenericValue checkPaymentGatewayResponse = 
delegator.findOne("PaymentGatewayResponse", 
UtilMisc.toMap("paymentGatewayResponseId", "testOrder1000_01"), false);
+                GenericValue checkPaymentGatewayResponse = 
EntityQuery.use(delegator).from("PaymentGatewayResponse").where("paymentGatewayResponseId",
 "testOrder1000_01").queryOne();
                 checkPaymentGatewayResponse.set("referenceNum", captureRefNum);
                 checkPaymentGatewayResponse.store();
                 Debug.logInfo("[testdoCapture] Result from SecurePay: " + 
result, module);

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java?rev=1631452&r1=1631451&r2=1631452&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
 Mon Oct 13 16:02:22 2014
@@ -66,6 +66,7 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.util.EntityQuery;
 
 /**
  * ValueLinkApi - Implementation of ValueLink Encryption & Transport
@@ -739,7 +740,7 @@ public class ValueLinkApi {
     public GenericValue getGenericValue() {
         GenericValue value = null;
         try {
-            value = delegator.findOne("ValueLinkKey", 
UtilMisc.toMap("merchantId", merchantId), true);
+            value = 
EntityQuery.use(delegator).from("ValueLinkKey").where("merchantId", 
merchantId).cache().queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }


Reply via email to