svn commit: r1642398 [1/2] - in /ofbiz/trunk/specialpurpose: assetmaint/src/org/ofbiz/assetmaint/ ebay/src/org/ofbiz/ebay/ ebaystore/src/org/ofbiz/ebaystore/ googlebase/src/org/ofbiz/googlebase/ googlecheckout/src/org/ofbiz/googlecheckout/ hhfacility/s...

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

svn commit: r1642398 [1/2] - in /ofbiz/trunk/specialpurpose: assetmaint/src/org/ofbiz/assetmaint/ ebay/src/org/ofbiz/ebay/ ebaystore/src/org/ofbiz/ebaystore/ googlebase/src/org/ofbiz/googlebase/ googlecheckout/src/org/ofbiz/googlecheckout/ hhfacility/s...

ashish-18
Author: ashish
Date: Sat Nov 29 08:00:37 2014
New Revision: 1642398

URL: http://svn.apache.org/r1642398
Log:
Applied patch from jira issue OFBIZ-5844 - Convert java files to EntityQuery.
Thanks Arun for the contribution.

Modified:
    ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java
    ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java
    ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
    ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java
    ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java
    ofbiz/trunk/specialpurpose/hhfacility/src/org/ofbiz/hhfacility/FacilityServices.java
    ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java
    ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/SearchServices.java
    ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/SearchWorker.java
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/guiapp/xui/XuiSession.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/ManagerEvents.java
    ofbiz/trunk/specialpurpose/projectmgr/src/org/ofbiz/project/Various.java
    ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumEvents.java
    ofbiz/trunk/specialpurpose/scrum/src/org/ofbiz/scrum/ScrumServices.java
    ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/search/WebPosSearch.java

Modified: ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java (original)
+++ ofbiz/trunk/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java Sat Nov 29 08:00:37 2014
@@ -35,6 +35,7 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.product.product.ProductWorker;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -82,7 +83,7 @@ public class FixedAssetMaintServices {
                     EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
                     EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.GREATER_THAN, "0")),
                     EntityOperator.AND);
-            List<GenericValue> inventoryItems = delegator.findList("InventoryItem", ecl, null, null, null, false);   //&& inventoryItems.size() > 0
+            List<GenericValue> inventoryItems = EntityQuery.use(delegator).from("InventoryItem").where(ecl).queryList();   //&& inventoryItems.size() > 0
             Iterator<GenericValue> itr = inventoryItems.iterator();
             while (requestedQty > 0 && itr.hasNext()) {
                 GenericValue inventoryItem = itr.next();

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java Sat Nov 29 08:00:37 2014
@@ -178,8 +178,7 @@ public class EbayHelper {
                 shipmentMethodTypeId = ebayShippingMethod.getString("shipmentMethodTypeId");
             } else {
                 //Find ebay shipping method on the basis of shipmentMethodName so that we can create new record with productStorId, EbayShippingMethod data is required for atleast one productStore
-                List<GenericValue> ebayShippingMethods = delegator.findByAnd("EbayShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingService), null, false);
-                ebayShippingMethod = EntityUtil.getFirst(ebayShippingMethods);
+                ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService).queryFirst();
                 ebayShippingMethod.put("productStoreId", productStoreId);
                 delegator.create(ebayShippingMethod);
                 partyId = ebayShippingMethod.getString("carrierPartyId");
@@ -196,9 +195,7 @@ public class EbayHelper {
         String orderId, String externalId, Timestamp orderDate, BigDecimal amount, String partyIdFrom) {
         List<GenericValue> paymentPreferences = null;
         try {
-            Map<String, String> paymentFields = UtilMisc.toMap("orderId", orderId, "statusId", "PAYMENT_RECEIVED",
-                    "paymentMethodTypeId", "EXT_EBAY");
-            paymentPreferences = delegator.findByAnd("OrderPaymentPreference", paymentFields, null, false);
+            paymentPreferences = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", "PAYMENT_RECEIVED", "paymentMethodTypeId", "EXT_EBAY").queryList();
 
             if (UtilValidate.isNotEmpty(paymentPreferences)) {
                 Iterator<GenericValue> i = paymentPreferences.iterator();
@@ -209,9 +206,7 @@ public class EbayHelper {
                         return false;
                 }
             } else {
-                paymentFields = UtilMisc.toMap("orderId", orderId, "statusId", "PAYMENT_NOT_RECEIVED",
-                    "paymentMethodTypeId", "EXT_EBAY");
-                paymentPreferences = delegator.findByAnd("OrderPaymentPreference", paymentFields, null, false);
+                paymentPreferences = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", "PAYMENT_NOT_RECEIVED", "paymentMethodTypeId", "EXT_EBAY").queryList();
                 if (UtilValidate.isNotEmpty(paymentPreferences)) {
                     Iterator<GenericValue> i = paymentPreferences.iterator();
                     while (i.hasNext()) {
@@ -476,8 +471,7 @@ public class EbayHelper {
         try {
             Debug.logInfo("geocode: " + geoCode, module);
 
-            geo = EntityUtil.getFirst(delegator.findByAnd("Geo", UtilMisc.toMap("geoCode", geoCode.toUpperCase(),
-                    "geoTypeId", "COUNTRY"), null, false));
+            geo = EntityQuery.use(delegator).from("Geo").where("geoCode", geoCode.toUpperCase(), "geoTypeId", "COUNTRY").queryFirst();
             Debug.logInfo("Found a geo entity " + geo, module);
             if (UtilValidate.isEmpty(geo)) {
                 geo = delegator.makeValue("Geo");
@@ -589,8 +583,7 @@ public class EbayHelper {
             GenericValue phoneNumber;
             try {
                 // get the phone number for this contact mech
-                phoneNumber = delegator.findOne("TelecomNumber", UtilMisc
-                        .toMap("contactMechId", contactMechId), false);
+                phoneNumber = EntityQuery.use(delegator).from("TelecomNumber").where("contactMechId", contactMechId).queryOne();
 
                 // now compare values. If one matches, that's our phone number.
                 // Return the related contact mech id.
@@ -612,7 +605,7 @@ public class EbayHelper {
         String productId = "";
         try {
             // First try to get an exact match: title == internalName
-            List<GenericValue> products = delegator.findByAnd("Product", UtilMisc.toMap("internalName", title), null, false);
+            List<GenericValue> products = EntityQuery.use(delegator).from("Product").where("internalName", title).queryList();
             if (UtilValidate.isNotEmpty(products) && products.size() == 1) {
                 productId = (String) (products.get(0)).get("productId");
             }

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java Sat Nov 29 08:00:37 2014
@@ -1142,7 +1142,7 @@ public class EbayOrderServices {
                 // If matching party not found then try to find partyId from PartyAttribute entity.
                 GenericValue partyAttribute = null;
                 if (UtilValidate.isNotEmpty(context.get("eiasTokenBuyer"))) {
-                    partyAttribute = EntityUtil.getFirst(delegator.findByAnd("PartyAttribute", UtilMisc.toMap("attrValue", (String) context.get("eiasTokenBuyer")), null, false));
+                    partyAttribute = EntityQuery.use(delegator).from("PartyAttribute").where("attrValue", (String) context.get("eiasTokenBuyer")).queryFirst();
                     if (UtilValidate.isNotEmpty(partyAttribute)) {
                         partyId = (String) partyAttribute.get("partyId");
                     }
@@ -1251,12 +1251,10 @@ public class EbayOrderServices {
     // Made some changes transactionId removed.
     private static GenericValue externalOrderExists(Delegator delegator, String externalId) throws GenericEntityException {
         Debug.logInfo("Checking for existing externalId: " + externalId, module);
-        GenericValue orderHeader = null;
         EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("externalId", EntityComparisonOperator.EQUALS, externalId), EntityCondition.makeCondition("statusId", EntityComparisonOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityComparisonOperator.AND);
-        List<GenericValue> orderHeaderList = delegator.findList("OrderHeader", condition, null, null, null, true);
-        if (UtilValidate.isNotEmpty(orderHeaderList)) {
-            orderHeader = EntityUtil.getFirst(orderHeaderList);
-        }
+        GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader")
+                .where(condition)
+                .cache(true).queryFirst();
         return orderHeader;
     }
 

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java Sat Nov 29 08:00:37 2014
@@ -40,7 +40,6 @@ 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.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityComparisonOperator;
 import org.ofbiz.order.order.OrderChangeHelper;
@@ -729,7 +728,7 @@ public class ImportOrdersFromEbay {
                 String contactMechId = "";
                 GenericValue partyAttribute = null;
                 if (UtilValidate.isNotEmpty(parameters.get("eiasTokenBuyer"))) {
-                    partyAttribute = EntityUtil.getFirst(delegator.findByAnd("PartyAttribute", UtilMisc.toMap("attrValue", (String)parameters.get("eiasTokenBuyer")), null, false));
+                    partyAttribute = EntityQuery.use(delegator).from("PartyAttribute").where("attrValue", (String)parameters.get("eiasTokenBuyer")).queryFirst();
                 }
 
                 // if we get a party, check its contact information.
@@ -823,12 +822,11 @@ public class ImportOrdersFromEbay {
 
     private static GenericValue externalOrderExists(Delegator delegator, String externalId) throws GenericEntityException {
         Debug.logInfo("Checking for existing externalId: " + externalId, module);
-        GenericValue orderHeader = null;
         EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("externalId", EntityComparisonOperator.EQUALS, externalId), EntityCondition.makeCondition("statusId", EntityComparisonOperator.NOT_EQUAL, "ORDER_CANCELLED")), EntityComparisonOperator.AND);
-        List<GenericValue> orderHeaderList = delegator.findList("OrderHeader", condition, null, null, null, true);
-        if (UtilValidate.isNotEmpty(orderHeaderList)) {
-            orderHeader = EntityUtil.getFirst(orderHeaderList);
-        }
+        GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader")
+                .where(condition)
+                .cache(true)
+                .queryFirst();
         return orderHeader;
     }
 }

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Sat Nov 29 08:00:37 2014
@@ -43,6 +43,7 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.entity.util.EntityUtilProperties;
 import org.ofbiz.service.DispatchContext;
@@ -71,7 +72,7 @@ public class ProductsExportToEbay {
         Map<String, Object> response = null;
         try {
             List<String> selectResult = UtilGenerics.checkList(context.get("selectResult"), String.class);
-            List<GenericValue> productsList  = delegator.findList("Product", EntityCondition.makeCondition("productId", EntityOperator.IN, selectResult), null, null, null, false);
+            List<GenericValue> productsList  = EntityQuery.use(delegator).from("Product").where(EntityCondition.makeCondition("productId", EntityOperator.IN, selectResult)).queryList();
             if (UtilValidate.isNotEmpty(productsList)) {
                 for (GenericValue product : productsList) {
                     GenericValue startPriceValue = EntityUtil.getFirst(EntityUtil.filterByDate(product.getRelated("ProductPrice", UtilMisc.toMap("productPricePurposeId", "EBAY", "productPriceTypeId", "MINIMUM_PRICE"), null, false)));
@@ -302,7 +303,10 @@ public class ProductsExportToEbay {
                         primaryCategoryId = categoryCode;
                     }
                 } else {
-                    GenericValue productCategoryValue = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryAndMember", UtilMisc.toMap("productCategoryTypeId", "EBAY_CATEGORY", "productId", prod.getString("productId")), null, false)));
+                    GenericValue productCategoryValue = EntityQuery.use(delegator).from("ProductCategoryAndMember")
+                            .where("productCategoryTypeId", "EBAY_CATEGORY", "productId", prod.getString("productId"))
+                            .filterByDate()
+                            .queryFirst();
                     if (UtilValidate.isNotEmpty(productCategoryValue)) {
                         primaryCategoryId = productCategoryValue.getString("categoryName");
                     }

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java Sat Nov 29 08:00:37 2014
@@ -175,7 +175,7 @@ public class EbayBestOfferAutoPref {
                 dispatcher.runSync("updateEbayProductStorePref",ebayPref);
 
                 String parentPrefCondId = productStorePref.getString("parentPrefCondId");
-                List<GenericValue> productPref = delegator.findByAnd("EbayProductStorePrefCond", UtilMisc.toMap("parentPrefCondId",parentPrefCondId), null, false);
+                List<GenericValue> productPref = EntityQuery.use(delegator).from("EbayProductStorePrefCond").where("parentPrefCondId",parentPrefCondId).queryList();
                 if (productPref.size() != 0) {
                     String[] condition = {condition1, condition2, condition3, condition4, condition5, condition6, condition7, condition8, condition9, condition10, condition11};
                     Map<String, Object> ebayPrefCond = UtilMisc.<String, Object>toMap("userLogin", userLogin);

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java Sat Nov 29 08:00:37 2014
@@ -43,7 +43,6 @@ 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.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 
@@ -865,7 +864,7 @@ public class EbayEvents {
                         attributeMapList.put("Currency", "USD");
 
                         if (UtilValidate.isNotEmpty(requestParams.get("requireEbayInventory")) && "Y".equals(requestParams.get("requireEbayInventory").toString())) {
-                            GenericValue ebayProductStore = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("EbayProductStoreInventory", UtilMisc.toMap("productStoreId", productStoreId, "productId", productId), null, false)));
+                            GenericValue ebayProductStore = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productStoreId", productStoreId, "productId", productId).filterByDate().queryFirst();
                             if (UtilValidate.isNotEmpty(ebayProductStore)) {
                                 String facilityId = ebayProductStore.getString("facilityId");
                                 BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing");
@@ -901,14 +900,13 @@ public class EbayEvents {
                             itemObj.put("isAutoRelist", "Y");
                         }
                         try {
-                            GenericValue storeRole = EntityUtil.getFirst(delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStoreId, "roleTypeId", "EBAY_ACCOUNT"), null, false));
+                            GenericValue storeRole = EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", productStoreId, "roleTypeId", "EBAY_ACCOUNT").queryFirst();
                             if (UtilValidate.isNotEmpty(storeRole)) {
-                                List<GenericValue> ebayUserLoginList = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", storeRole.get("partyId")), null, false);
-                                if (ebayUserLoginList.size() > 0) {
-                                    GenericValue eBayUserLogin = EntityUtil.getFirst(ebayUserLoginList);
-                                    if (UtilValidate.isNotEmpty(eBayUserLogin)) {
-                                        prodMap.put("userLoginId", eBayUserLogin.get("userLoginId").toString());
-                                    }
+                                GenericValue eBayUserLogin = EntityQuery.use(delegator).from("UserLogin")
+                                                                           .where("partyId", storeRole.get("partyId"))
+                                                                           .queryFirst();
+                                if (UtilValidate.isNotEmpty(eBayUserLogin)) {
+                                    prodMap.put("userLoginId", eBayUserLogin.get("userLoginId").toString());
                                 }
                             }
                         } catch (GenericEntityException ex) {

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java Sat Nov 29 08:00:37 2014
@@ -19,7 +19,6 @@
 package org.ofbiz.ebaystore;
 
 import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericValue;
@@ -98,8 +97,10 @@ public class EbayFeedback {
                     partyId = userLoginEx.getString("partyId");
                 }
                 //PartyRole For eBay User
-                List<GenericValue> partyRoles = delegator.findByAnd("PartyRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER"), null, false);
-                if (partyRoles.size() == 0) {
+                GenericValue ownerPartyRole = EntityQuery.use(delegator).from("PartyRole")
+                                                    .where("partyId", partyId, "roleTypeId", "OWNER")
+                                                    .queryOne();
+                if (UtilValidate.isEmpty(ownerPartyRole)) {
                     GenericValue partyRole =  delegator.makeValue("PartyRole");
                     partyRole.put("partyId", partyId);
                     partyRole.put("roleTypeId", "OWNER");
@@ -117,8 +118,10 @@ public class EbayFeedback {
                     String textData = feedback[i].getCommentText();
                     String commentingUserId= feedback[i].getCommentingUser();
                     String commentingPartyId = null;
-                    List<GenericValue> CommentingUserLogins = delegator.findByAnd("UserLogin", UtilMisc.toMap("userLoginId", commentingUserId), null, false);
-                    if (CommentingUserLogins.size() == 0) {
+                    GenericValue CommentingUserLogin = EntityQuery.use(delegator).from("UserLogin")
+                                                                  .where("userLoginId", commentingUserId)
+                                                                  .queryOne();
+                    if (UtilValidate.isEmpty(CommentingUserLogin)) {
                         //Party
                         GenericValue party =  delegator.makeValue("Party");
                         commentingPartyId = delegator.getNextSeqId("Party");
@@ -131,8 +134,7 @@ public class EbayFeedback {
                         userLoginEx.put("partyId", commentingPartyId);
                         userLoginEx.create();
                     } else {
-                        userLoginEx = CommentingUserLogins.get(0);
-                        commentingPartyId = userLoginEx.getString("partyId");
+                        commentingPartyId = CommentingUserLogin.getString("partyId");
                     }
                     //DataResource
                     GenericValue dataResource =  delegator.makeValue("DataResource");
@@ -159,16 +161,20 @@ public class EbayFeedback {
                     contentPurpose.put("contentPurposeTypeId", "FEEDBACK");
                     contentPurpose.create();
                     //PartyRole For eBay Commentator
-                    List<GenericValue> commentingPartyRoles = delegator.findByAnd("PartyRole", UtilMisc.toMap("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR"), null, false);
-                    if (commentingPartyRoles.size() == 0) {
+                    GenericValue commentingPartyRole = EntityQuery.use(delegator).from("PartyRole")
+                                                           .where("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR")
+                                                           .queryOne();
+                    if (UtilValidate.isEmpty(commentingPartyRole)) {
                         GenericValue partyRole =  delegator.makeValue("PartyRole");
                         partyRole.put("partyId", commentingPartyId);
                         partyRole.put("roleTypeId", "COMMENTATOR");
                         partyRole.create();
                     }
                     //ContentRole for eBay User
-                    List<GenericValue> contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER", "contentId", contentId), null, false);
-                    if (contentRoles.size() == 0) {
+                    GenericValue ownerContentRole = EntityQuery.use(delegator).from("ContentRole")
+                                                   .where("partyId", partyId, "roleTypeId", "OWNER", "contentId", contentId)
+                                                   .queryFirst();
+                    if (UtilValidate.isEmpty(ownerContentRole)) {
                         GenericValue contentRole =  delegator.makeValue("ContentRole");
                         contentRole.put("contentId", contentId);
                         contentRole.put("partyId", partyId);
@@ -177,8 +183,10 @@ public class EbayFeedback {
                         contentRole.create();
                     }
                     //ContentRole for Commentator
-                    List<GenericValue> commentingContentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR", "contentId", contentId), null, false);
-                    if (commentingContentRoles.size() == 0) {
+                    GenericValue commentingContentRole = EntityQuery.use(delegator).from("ContentRole")
+                                                             .where("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR", "contentId", contentId)
+                                                             .queryFirst();
+                    if (UtilValidate.isEmpty(commentingContentRole)) {
                         GenericValue contentRole =  delegator.makeValue("ContentRole");
                         contentRole.put("contentId", contentId);
                         contentRole.put("partyId", commentingPartyId);

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Sat Nov 29 08:00:37 2014
@@ -56,7 +56,6 @@ 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;
 import org.ofbiz.service.LocalDispatcher;
@@ -237,7 +236,7 @@ public class EbayStore {
         try {
             SetStoreCategoriesCall  call = new SetStoreCategoriesCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
 
-            catalogCategories = delegator.findByAnd("ProdCatalogCategory", UtilMisc.toMap("prodCatalogId", context.get("prodCatalogId").toString(),"prodCatalogCategoryTypeId","PCCT_EBAY_ROOT"), UtilMisc.toList("sequenceNum ASC"), false);
+            catalogCategories = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", context.get("prodCatalogId").toString(),"prodCatalogCategoryTypeId","PCCT_EBAY_ROOT").orderBy("sequenceNum ASC").queryList();
             if (catalogCategories != null && catalogCategories.size() > 0) {
                 List<StoreCustomCategoryType> listAdd = FastList.newInstance();
                 List<StoreCustomCategoryType> listEdit = FastList.newInstance();
@@ -280,7 +279,7 @@ public class EbayStore {
                     if (productCategory != null) {
                         String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), context.get("partyId").toString());
                         if (ebayParentCategoryId != null) {
-                            List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId", productCategory.getString("productCategoryId")), UtilMisc.toList("sequenceNum ASC"), false);
+                            List<GenericValue> productCategoryRollupList = EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId", productCategory.getString("productCategoryId")).orderBy("sequenceNum ASC").queryList();
                             for (GenericValue productCategoryRollup : productCategoryRollupList) {
                                 productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productCategoryRollup.getString("productCategoryId")).queryOne();
                                 StoreCustomCategoryType childCategoryType = new StoreCustomCategoryType();
@@ -319,11 +318,11 @@ public class EbayStore {
                 for (GenericValue catalogCategory : catalogCategories) {
                     GenericValue productCategory = catalogCategory.getRelatedOne("ProductCategory", false);
                     if (productCategory != null) {
-                        List<GenericValue> productParentCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productCategory.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"), false);
+                        List<GenericValue> productParentCategoryRollupList = EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",productCategory.getString("productCategoryId")).orderBy("sequenceNum ASC").queryList();
                         for (GenericValue productParentCategoryRollup : productParentCategoryRollupList) {
                             String ebayParentCategoryId = EbayStoreHelper.retriveEbayCategoryIdByPartyId(delegator,productParentCategoryRollup.getString("productCategoryId"),context.get("partyId").toString());
                             if (ebayParentCategoryId != null) {
-                                List<GenericValue> productChildCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")),UtilMisc.toList("sequenceNum ASC"), false);
+                                List<GenericValue> productChildCategoryRollupList = EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",productParentCategoryRollup.getString("productCategoryId")).orderBy("sequenceNum ASC").queryList();
                                 for (GenericValue productChildCategoryRollup : productChildCategoryRollupList) {
                                     productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", productChildCategoryRollup.getString("productCategoryId")).queryOne();
                                     StoreCustomCategoryType childCategoryType = new StoreCustomCategoryType();
@@ -397,7 +396,7 @@ public class EbayStore {
                     if (actionCode.equals(StoreCategoryUpdateActionCodeType.ADD) && returnedCustomCategory != null) {
                         StoreCustomCategoryType[] returnCategoryTypeList = returnedCustomCategory.getCustomCategory();
                         for (StoreCustomCategoryType returnCategoryType : returnCategoryTypeList) {
-                            List<GenericValue> productCategoryList = delegator.findByAnd("ProductCategory", UtilMisc.toMap("categoryName",returnCategoryType.getName(),"productCategoryTypeId","EBAY_CATEGORY"), null, false);
+                            List<GenericValue> productCategoryList = EntityQuery.use(delegator).from("ProductCategory").where("categoryName",returnCategoryType.getName(),"productCategoryTypeId","EBAY_CATEGORY").queryList();
                             for (GenericValue productCategory : productCategoryList) {
                                 if (EbayStoreHelper.veriflyCategoryInCatalog(delegator,catalogCategories,productCategory.getString("productCategoryId"))) {
                                     if (EbayStoreHelper.createEbayCategoryIdByPartyId(delegator, productCategory.getString("productCategoryId"), partyId, String.valueOf(returnCategoryType.getCategoryID()))) {
@@ -444,7 +443,7 @@ public class EbayStore {
                 // Prepare data for set to XML
                 GenericValue productStore = null;
                 if (UtilValidate.isNotEmpty(context.get("productStoreId").toString())) {
-                    productStore = delegator.findOne("ProductStore",UtilMisc.toMap("productStoreId", context.get("productStoreId").toString()), false);
+                    productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", context.get("productStoreId").toString()).queryOne();
                 }
                 Element itemElem = UtilXml.addChildElement(storeRequestElem, "Store", storeDocument);
                 UtilXml.addChildElementValue(itemElem, "Name", productStore.getString("storeName"), storeDocument);
@@ -599,10 +598,10 @@ public class EbayStore {
         Delegator delegator = dctx.getDelegator();
         String productStoreId = (String) context.get("productStoreId");
         try {
-            List<GenericValue> productStores = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStoreId, "roleTypeId", "EBAY_ACCOUNT"), null, false);
+            List<GenericValue> productStores = EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", productStoreId, "roleTypeId", "EBAY_ACCOUNT").queryList();
             if (productStores.size() != 0) {
                 String partyId = (productStores.get(0)).getString("partyId");
-                List<GenericValue> userLoginStore = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", partyId), null, false);
+                List<GenericValue> userLoginStore = EntityQuery.use(delegator).from("UserLogin").where("partyId", partyId).queryList();
                 if (userLoginStore.size() != 0) {
                 String    userLoginId = (userLoginStore.get(0)).getString("userLoginId");
                 result.put("userLoginId", userLoginId);
@@ -629,10 +628,10 @@ public class EbayStore {
         if (context.get("productStoreId") != null) {
             String partyId = null;
             try {
-                List<GenericValue> productStoreRoles = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", context.get("productStoreId").toString(),"roleTypeId","EBAY_ACCOUNT"), null, false);
+                List<GenericValue> productStoreRoles = EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", context.get("productStoreId").toString(),"roleTypeId","EBAY_ACCOUNT").queryList();
                 if (productStoreRoles.size() != 0) {
                     partyId=  (String)productStoreRoles.get(0).get("partyId");
-                    List<GenericValue> userLogins = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", partyId), null, false);
+                    List<GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where("partyId", partyId).queryList();
                     if (userLogins.size() != 0) {
                         userLoginId = (String)userLogins.get(0).get("userLoginId");
                     }
@@ -1550,7 +1549,7 @@ public class EbayStore {
             int intAtp = 1;
             String facilityId = "";
             if (UtilValidate.isNotEmpty(context.get("requireEbayInventory")) && "on".equals(context.get("requireEbayInventory").toString())) {
-                GenericValue ebayProductStore = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("EbayProductStoreInventory", UtilMisc.toMap("productStoreId", context.get("productStoreId").toString(), "productId", context.get("productId")), null, false)));
+                GenericValue ebayProductStore = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productStoreId", context.get("productStoreId").toString(), "productId", context.get("productId")).filterByDate().queryFirst();
                 if (UtilValidate.isNotEmpty(ebayProductStore)) {
                     facilityId = ebayProductStore.getString("facilityId");
                     BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing");
@@ -1563,9 +1562,9 @@ public class EbayStore {
             }
             GenericValue userLogin = (GenericValue) context.get("userLogin");
             if (UtilValidate.isNotEmpty(context.get("productCategoryId"))) {
-                GenericValue prodCategoryMember = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap("productCategoryId", context.get("productCategoryId"),"productId", context.get("productId")), null, false)));
+                GenericValue prodCategoryMember = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId", context.get("productCategoryId"),"productId", context.get("productId")).filterByDate().queryFirst();
                 if (UtilValidate.isNotEmpty(prodCategoryMember)) {
-                    GenericValue prodCategoryRole = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryRole", UtilMisc.toMap("productCategoryId", prodCategoryMember.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT"), null, false)));
+                    GenericValue prodCategoryRole = EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId", prodCategoryMember.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT").filterByDate().queryFirst();
                     if (UtilValidate.isNotEmpty(prodCategoryRole)) {
                         context.put("ebayCategory", prodCategoryRole.get("comments"));
                     } else {
@@ -1574,13 +1573,13 @@ public class EbayStore {
                     }
                 }
             } else {
-                List<GenericValue> prodCategoryMember = EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap("productId", context.get("productId")), null, false));
+                List<GenericValue> prodCategoryMember = EntityQuery.use(delegator).from("ProductCategoryMember").where("productId", context.get("productId")).filterByDate().queryList();
                 Iterator<GenericValue> prodCategoryMemberIter = prodCategoryMember.iterator();
                 while (prodCategoryMemberIter.hasNext()) {
                     GenericValue prodCategory = prodCategoryMemberIter.next();
-                    GenericValue prodCatalogCategory = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProdCatalogCategory", UtilMisc.toMap("prodCatalogId", context.get("prodCatalogId"), "productCategoryId", prodCategory.get("productCategoryId").toString()), null, false)));
+                    GenericValue prodCatalogCategory = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", context.get("prodCatalogId"), "productCategoryId", prodCategory.get("productCategoryId").toString()).filterByDate().queryFirst();
                     if (UtilValidate.isNotEmpty(prodCatalogCategory)) {
-                        GenericValue prodCategoryRole = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("ProductCategoryRole", UtilMisc.toMap("productCategoryId", prodCatalogCategory.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT"), null, false)));
+                        GenericValue prodCategoryRole = EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId", prodCatalogCategory.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT").filterByDate().queryFirst();
                         if (UtilValidate.isNotEmpty(prodCategoryRole)) {
                             context.put("ebayCategory", prodCategoryRole.get("comments"));
                         } else {

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java Sat Nov 29 08:00:37 2014
@@ -397,7 +397,7 @@ public class EbayStoreAutoPreferences {
             Map<String, Object> serviceMap = FastMap.newInstance();
             serviceMap.put("userLogin", userLogin);
             //ProductStore
-            List<GenericValue> productStores = delegator.findByAnd("EbayProductStorePref", UtilMisc.toMap("autoPrefJobId", jobId), null, false);
+            List<GenericValue> productStores = EntityQuery.use(delegator).from("EbayProductStorePref").where("autoPrefJobId", jobId).queryList();
             if (productStores.size() != 0) {
                 // get auto preference setting
                 String productStoreId = productStores.get(0).getString("productStoreId");
@@ -429,7 +429,7 @@ public class EbayStoreAutoPreferences {
                                     inMap.put("userLogin", userLogin);
                                     dispatcher.runSync("createProduct", inMap);
                                     // ProductRole (VENDOR)
-                                    List<GenericValue> productRole = delegator.findByAnd("ProductRole", UtilMisc.toMap("partyId", partyId, "productId", soldItemMap.get("itemId"), "roleTypeId", "VENDOR"), null, false);
+                                    List<GenericValue> productRole = EntityQuery.use(delegator).from("ProductRole").where("partyId", partyId, "productId", soldItemMap.get("itemId"), "roleTypeId", "VENDOR").queryList();
                                     if (productRole.size() == 0) {
                                         Map<String, Object> addRole = FastMap.newInstance();
                                         addRole.put("productId", soldItemMap.get("itemId"));
@@ -459,7 +459,7 @@ public class EbayStoreAutoPreferences {
                         }
                     }
                     //check product role
-                    List<GenericValue> productRoles = delegator.findByAnd("ProductRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "VENDOR"), null, false);
+                    List<GenericValue> productRoles = EntityQuery.use(delegator).from("ProductRole").where("partyId", partyId, "roleTypeId", "VENDOR").queryList();
                     List<String> productRoleIds = FastList.newInstance();
                     if (productRoles.size() != 0) {
                         for (int itemCount = 0; itemCount < productRoles.size(); itemCount++) {
@@ -476,8 +476,7 @@ public class EbayStoreAutoPreferences {
                     andExpr.add(isVirtualCond);
                     EntityCondition productRole = EntityCondition.makeCondition("productId", EntityOperator.IN, productRoleIds);
                     andExpr.add(productRole);
-                    EntityCondition andCond = EntityCondition.makeCondition(andExpr, EntityOperator.AND);
-                    List<GenericValue> itemsToRelist = delegator.findList("Product", andCond, null, null, null, false);
+                    List<GenericValue> itemsToRelist = EntityQuery.use(delegator).from("Product").where(andExpr).queryList();
                     if (itemsToRelist.size() != 0) {
                         //re-list sold items and not active
                         ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator);
@@ -509,7 +508,7 @@ public class EbayStoreAutoPreferences {
         String jobId = (String) context.get("jobId");
         try {
             GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne();
-            List<GenericValue> productStores = delegator.findByAnd("EbayProductStorePref", UtilMisc.toMap("autoPrefJobId", jobId), null, false);
+            List<GenericValue> productStores = EntityQuery.use(delegator).from("EbayProductStorePref").where("autoPrefJobId", jobId).queryList();
             if (productStores.size() != 0) {
                 // get automatic setting
                 String productStoreId = productStores.get(0).getString("productStoreId");
@@ -580,7 +579,7 @@ public class EbayStoreAutoPreferences {
         String jobId = (String) context.get("jobId");
         try {
             GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne();
-            List<GenericValue> productStores = delegator.findByAnd("EbayProductStorePref", UtilMisc.toMap("autoPrefJobId", jobId), null, false);
+            List<GenericValue> productStores = EntityQuery.use(delegator).from("EbayProductStorePref").where("autoPrefJobId", jobId).queryList();
             if (productStores.size() != 0) {
                 // get automatic setting
                 String productStoreId = productStores.get(0).getString("productStoreId");
@@ -1113,7 +1112,7 @@ public class EbayStoreAutoPreferences {
             expressions.add(expression2);
             expressions.add(expression3);
             EntityCondition cond = EntityCondition.makeCondition(expressions, EntityOperator.AND);
-            List<GenericValue> ebayProductListings = delegator.findList("EbayProductListing", cond , null, null, null, false);
+            List<GenericValue> ebayProductListings = EntityQuery.use(delegator).from("EbayProductListing").where(expressions).queryList();
             for (int index = 0; index < ebayProductListings.size(); index++) {
                 Map<String, Object> inMap = FastMap.newInstance();
                 AddItemCall addItemCall = new AddItemCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator));
@@ -1150,7 +1149,7 @@ public class EbayStoreAutoPreferences {
             String productStoreId = (String) context.get("productStoreId");
             GenericValue ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_BEST_OFFER").queryOne();
             String parentPrefCondId = ebayProductStorePref.getString("parentPrefCondId");
-            List<GenericValue> ebayProductStorePrefCond = delegator.findByAnd("EbayProductStorePrefCond", UtilMisc.toMap("parentPrefCondId", parentPrefCondId), null, false);
+            List<GenericValue> ebayProductStorePrefCond = EntityQuery.use(delegator).from("EbayProductStorePrefCond").where("parentPrefCondId", parentPrefCondId).queryList();
             //Parameters
             String priceType = ebayProductStorePrefCond.get(0).getString("acceptanceCondition");
             String acceptBestOfferValue = ebayProductStorePrefCond.get(1).getString("acceptanceCondition");
@@ -1240,7 +1239,7 @@ public class EbayStoreAutoPreferences {
                         } else if (priceType.equals("RETAIL_PRICE")) {
                             //ignore
                         } else if (priceType.equals("SELLER_COST")) {
-                            List<GenericValue> supplierProduct = delegator.findByAnd("SupplierProduct", UtilMisc.toMap("productId", SKUItem), UtilMisc.toList("availableFromDate DESC"), false);
+                            List<GenericValue> supplierProduct = EntityQuery.use(delegator).from("SupplierProduct").where("productId", SKUItem).orderBy("availableFromDate DESC").queryList();
                             String lastPrice = supplierProduct.get(0).getString("lastPrice");
                             doBasePrice = Double.parseDouble(lastPrice);
                         } else if (priceType.equals("SECOND_CHANCE_PRICE")) {

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java Sat Nov 29 08:00:37 2014
@@ -46,7 +46,6 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.serialize.SerializeException;
 import org.ofbiz.entity.serialize.XmlSerializer;
 import org.ofbiz.entity.util.EntityQuery;
-import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
@@ -194,7 +193,7 @@ public class EbayStoreHelper {
                 Debug.logError("Require field partyId.",module);
                 return ebayCategoryId;
             }
-            productCategoryRoles = delegator.findByAnd("ProductCategoryRole", UtilMisc.toMap("productCategoryId", productCategoryId, "partyId", partyId, "roleTypeId", "EBAY_ACCOUNT"), null, false);
+            productCategoryRoles = EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId", productCategoryId, "partyId", partyId, "roleTypeId", "EBAY_ACCOUNT").queryList();
             if (productCategoryRoles != null && productCategoryRoles.size()>0) {
                 for (GenericValue productCategoryRole : productCategoryRoles) {
                     ebayCategoryId = productCategoryRole.getString("comments");
@@ -239,14 +238,14 @@ public class EbayStoreHelper {
                     break;
                 } else {
                     // check from child category level 1
-                    List<GenericValue> productCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",catalogCategory.getString("productCategoryId")), null, false);
+                    List<GenericValue> productCategoryRollupList = EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",catalogCategory.getString("productCategoryId")).queryList();
                     for (GenericValue productCategoryRollup : productCategoryRollupList) {
                         if (productCategoryRollup.containsValue(productCategoryId)) {
                             flag = true;
                             break;
                         } else {
                             // check from level 2
-                            List<GenericValue> prodCategoryRollupList = delegator.findByAnd("ProductCategoryRollup",  UtilMisc.toMap("parentProductCategoryId",productCategoryRollup.getString("productCategoryId")), null, false);
+                            List<GenericValue> prodCategoryRollupList = EntityQuery.use(delegator).from("ProductCategoryRollup").where("parentProductCategoryId",productCategoryRollup.getString("productCategoryId")).queryList();
                             for (GenericValue prodCategoryRollup : prodCategoryRollupList) {
                                 if (prodCategoryRollup.containsValue(productCategoryId)) {
                                     flag = true;
@@ -277,7 +276,7 @@ public class EbayStoreHelper {
             GenericValue ebayProductPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId).queryOne();
             String jobId = ebayProductPref.getString("autoPrefJobId");
             if (UtilValidate.isNotEmpty(jobId)) {
-                List<GenericValue> jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("parentJobId", jobId, "statusId", "SERVICE_PENDING"), null, false);
+                List<GenericValue> jobs = EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", jobId, "statusId", "SERVICE_PENDING").queryList();
                 if (jobs.size() == 0) {
                     Map<String, Object>inMap = FastMap.newInstance();
                     inMap.put("jobId", jobId);
@@ -358,7 +357,7 @@ public class EbayStoreHelper {
         try {
             GenericValue ebayProductPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", autoPrefEnumId).queryOne();
             String jobId = ebayProductPref.getString("autoPrefJobId");
-            List<GenericValue> jobs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("parentJobId", jobId ,"statusId", "SERVICE_PENDING"), null, false);
+            List<GenericValue> jobs = EntityQuery.use(delegator).from("JobSandbox").where("parentJobId", jobId ,"statusId", "SERVICE_PENDING").queryList();
 
             Map<String, Object>inMap = FastMap.newInstance();
             inMap.put("userLogin", userLogin);
@@ -471,7 +470,7 @@ public class EbayStoreHelper {
         HashMap<String, Object> attributeMapList = UtilGenerics.cast(context.get("attributeMapList"));
         String productListingId = (String) context.get("productListingId");
         try {
-           List<GenericValue> attributeToClears = delegator.findByAnd("EbayProductListingAttribute", UtilMisc.toMap("productListingId", productListingId), null, false);
+           List<GenericValue> attributeToClears = EntityQuery.use(delegator).from("EbayProductListingAttribute").where("productListingId", productListingId).queryList();
            for (int clearCount = 0; clearCount < attributeToClears.size(); clearCount++) {
               GenericValue valueToClear = attributeToClears.get(clearCount);
               if (valueToClear != null) {
@@ -496,7 +495,7 @@ public class EbayStoreHelper {
     public static ItemType prepareAddItem(Delegator delegator, GenericValue attribute) {
         ItemType item = new ItemType();
         try {
-            List<GenericValue> attrs = delegator.findByAnd("EbayProductListingAttribute", UtilMisc.toMap("productListingId", attribute.getString("productListingId")), null, false);
+            List<GenericValue> attrs = EntityQuery.use(delegator).from("EbayProductListingAttribute").where("productListingId", attribute.getString("productListingId")).queryList();
             AmountType amount = new AmountType();
             AmountType shippingServiceCost = new AmountType();
             PictureDetailsType picture = new PictureDetailsType();
@@ -718,7 +717,7 @@ public class EbayStoreHelper {
     public static boolean isReserveInventory(Delegator delegator, String productId, String productStoreId) {
         boolean isReserve = false;
         try {
-            GenericValue ebayProductStore = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("EbayProductStoreInventory", UtilMisc.toMap("productStoreId", productStoreId, "productId", productId), null, false)));
+            GenericValue ebayProductStore = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productStoreId", productStoreId, "productId", productId).filterByDate().queryFirst();
             if (UtilValidate.isNotEmpty(ebayProductStore)) {
                 BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing");
                 int intAtp = atp.intValue();

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java Sat Nov 29 08:00:37 2014
@@ -386,7 +386,7 @@ public class EbayStoreInventoryServices
 
         try {
             if (context.get("productStoreId") != null && context.get("facilityId") != null) {
-                ebayProductStoreInventoryList = delegator.findByAnd("EbayProductStoreInventory", UtilMisc.toMap("facilityId",(String)context.get("facilityId"),"productStoreId",(String)context.get("productStoreId")), null, false);
+                ebayProductStoreInventoryList = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("facilityId",(String)context.get("facilityId"),"productStoreId",(String)context.get("productStoreId")).queryList();
                 for (GenericValue ebayProductStoreInventory : ebayProductStoreInventoryList) {
                     if (ebayProductStoreInventory.get("ebayProductId") != null) {
                         dispatcher.runSync("updateEbayInventoryStatusByProductId", UtilMisc.toMap("productStoreId", (String)context.get("productStoreId"), "facilityId", (String)context.get("facilityId"), "folderId", ebayProductStoreInventory.get("folderId"), "productId", ebayProductStoreInventory.get("productId"), "ebayProductId", ebayProductStoreInventory.get("ebayProductId"), "userLogin", context.get("userLogin")));

Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java Sat Nov 29 08:00:37 2014
@@ -35,7 +35,6 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilGenerics;
-import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.ebay.EbayHelper;
@@ -213,7 +212,7 @@ public class EbayStoreOrder {
                 String contactMechId = "";
                 GenericValue partyAttribute = null;
                 if (UtilValidate.isNotEmpty(context.get("eiasTokenBuyer").toString())) {
-                    partyAttribute = EntityUtil.getFirst(delegator.findByAnd("PartyAttribute", UtilMisc.toMap("attrValue", context.get("eiasTokenBuyer").toString()), null, false));
+                    partyAttribute = EntityQuery.use(delegator).from("PartyAttribute").where("attrValue", context.get("eiasTokenBuyer").toString()).queryFirst();
                 }
 
                 // if we get a party, check its contact information.
@@ -444,7 +443,7 @@ public class EbayStoreOrder {
             // If matching party not found then try to find partyId from PartyAttribute entity.
             GenericValue partyAttribute = null;
             if (UtilValidate.isNotEmpty(context.get("eiasTokenBuyer"))) {
-                partyAttribute = EntityUtil.getFirst(delegator.findByAnd("PartyAttribute", UtilMisc.toMap("attrValue", (String) context.get("eiasTokenBuyer")), null, false));
+                partyAttribute = EntityQuery.use(delegator).from("PartyAttribute").where("attrValue", (String) context.get("eiasTokenBuyer")).queryFirst();
                 if (UtilValidate.isNotEmpty(partyAttribute)) {
                     partyId = (String) partyAttribute.get("partyId");
                 }

Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original)
+++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Sat Nov 29 08:00:37 2014
@@ -398,7 +398,7 @@ public class ProductsExportToGoogle {
                 return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToGoogle.invalidCountryCode", locale));
             }
             // Get the list of products to be exported to Google Base
-            List<GenericValue> productsList  = delegator.findList("Product", EntityCondition.makeCondition("productId", EntityOperator.IN, selectResult), null, null, null, false);
+            List<GenericValue> productsList  = EntityQuery.use(delegator).from("Product").where(EntityCondition.makeCondition("productId", EntityOperator.IN, selectResult)).queryList();
 
             // Get the tracking code
             if (UtilValidate.isEmpty(trackingCodeId) || "_NA_".equals(trackingCodeId)) {
@@ -433,7 +433,7 @@ public class ProductsExportToGoogle {
                 String productName = null;
                 String productDescription = null;
                 //String productURL = null;
-                List<GenericValue> productAndInfos = delegator.findByAnd("ProductContentAndInfo", UtilMisc.toMap("productId", prod.getString("productId"), "localeString", localeString, "thruDate", null), null, false);
+                List<GenericValue> productAndInfos = EntityQuery.use(delegator).from("ProductContentAndInfo").where("productId", prod.getString("productId"), "localeString", localeString, "thruDate", null).queryList();
                 if (productAndInfos.size() > 0) {
                     for (GenericValue productContentAndInfo : productAndInfos ) {
                         String dataReSourceId = productContentAndInfo.getString("dataResourceId");
@@ -548,7 +548,7 @@ public class ProductsExportToGoogle {
                 // item_type is the categories in which your product should belong.
                 UtilXml.addChildElementNSValue(entryElem, "g:item_type", "products", feedDocument, googleBaseNSUrl);
 
-                List<GenericValue> productCategoryMembers = delegator.findList("ProductCategoryMember", EntityCondition.makeCondition("productId", EntityOperator.EQUALS, prod.getString("productId")), null, UtilMisc.toList("productCategoryId"), null, false);
+                List<GenericValue> productCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where("productId", prod.getString("productId")).orderBy("productCategoryId").queryList();
 
                 Iterator<GenericValue> productCategoryMembersIter = productCategoryMembers.iterator();
                 while (productCategoryMembersIter.hasNext()) {
@@ -758,7 +758,7 @@ public class ProductsExportToGoogle {
             }
             
             //Add quantity item
-            List<GenericValue> inventoryItems = delegator.findByAnd("InventoryItem", UtilMisc.toMap("productId", product.getString("productId")), null, false);
+            List<GenericValue> inventoryItems = EntityQuery.use(delegator).from("InventoryItem").where("productId", product.getString("productId")).queryList();
             if (UtilValidate.isNotEmpty(inventoryItems)) {
                 BigDecimal totalquantity = new BigDecimal(0);
                 for (GenericValue inventoryItem : inventoryItems) {
@@ -780,7 +780,7 @@ public class ProductsExportToGoogle {
                 String shippingWeight = product.getString("weight") + " " + uom.getString("description");
                 UtilXml.addChildElementNSValue(entryElem, "g:shipping_weight", shippingWeight, feedDocument, googleBaseNSUrl);
             }
-            List<GenericValue> productFeatureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", product.getString("productId")), null, false);
+            List<GenericValue> productFeatureAndAppls = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", product.getString("productId")).queryList();
             if (productFeatureAndAppls.size() > 0) {
                 for (GenericValue productFeatureAndAppl : productFeatureAndAppls) {
                     //Add Genre

Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java (original)
+++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.java Sat Nov 29 08:00:37 2014
@@ -97,8 +97,7 @@ public class GoogleCheckoutHelper {
         String externalId = info.getGoogleOrderNumber();
         GenericValue order = null;
         try {
-            List<GenericValue> orders = delegator.findByAnd("OrderHeader", UtilMisc.toMap("externalId", externalId, "salesChannelEnumId" , SALES_CHANNEL), null, false);
-            order = EntityUtil.getFirst(orders);
+            order = EntityQuery.use(delegator).from("OrderHeader").where("externalId", externalId, "salesChannelEnumId" , SALES_CHANNEL).queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -140,15 +139,16 @@ public class GoogleCheckoutHelper {
 
     public void processAuthNotification(AuthorizationAmountNotification info) throws GeneralException {
         String externalId = info.getGoogleOrderNumber();
-        List<GenericValue> orders = null;
+        GenericValue order = null;
         GenericValue orderPaymentPreference = null;
         try {
-            orders = delegator.findByAnd("OrderHeader", UtilMisc.toMap("externalId", externalId, "salesChannelEnumId", SALES_CHANNEL), null, false);
+            order = EntityQuery.use(delegator).from("OrderHeader")
+                         .where("externalId", externalId, "salesChannelEnumId", SALES_CHANNEL)
+                         .queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
-        if (UtilValidate.isNotEmpty(orders)) {
-            GenericValue order = EntityUtil.getFirst(orders);
+        if (UtilValidate.isNotEmpty(order)) {
             List<GenericValue> orderPaymentPreferences = order.getRelated("OrderPaymentPreference", null, null, false);
             if (UtilValidate.isNotEmpty(orderPaymentPreferences)) {
                 orderPaymentPreference = EntityUtil.getFirst(orderPaymentPreferences);
@@ -169,15 +169,16 @@ public class GoogleCheckoutHelper {
 
     public void processChargeNotification(ChargeAmountNotification info) throws GeneralException {
         String externalId = info.getGoogleOrderNumber();
-        List<GenericValue> orders = null;
+        GenericValue order = null;
         GenericValue orderPaymentPreference = null;
         try {
-            orders = delegator.findByAnd("OrderHeader", UtilMisc.toMap("externalId", externalId, "salesChannelEnumId", SALES_CHANNEL), null, false);
+            order = EntityQuery.use(delegator).from("OrderHeader")
+                         .where("externalId", externalId, "salesChannelEnumId", SALES_CHANNEL)
+                         .queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
-        if (UtilValidate.isNotEmpty(orders)) {
-            GenericValue order = EntityUtil.getFirst(orders);
+        if (UtilValidate.isNotEmpty(order)) {
             List<GenericValue> orderPaymentPreferences = order.getRelated("OrderPaymentPreference", null, null, false);
             if (UtilValidate.isNotEmpty(orderPaymentPreferences)) {
                 orderPaymentPreference = EntityUtil.getFirst(orderPaymentPreferences);
@@ -199,15 +200,16 @@ public class GoogleCheckoutHelper {
 
     public void processRefundNotification(RefundAmountNotification info) throws GeneralException {
         String externalId = info.getGoogleOrderNumber();
-        List<GenericValue> orders = null;
+        GenericValue order = null;
         GenericValue orderPaymentPreference = null;
         try {
-            orders = delegator.findByAnd("OrderHeader", UtilMisc.toMap("externalId", externalId, "salesChannelEnumId", SALES_CHANNEL), null, false);
+            order = EntityQuery.use(delegator).from("OrderHeader")
+                        .where("externalId", externalId, "salesChannelEnumId", SALES_CHANNEL)
+                        .queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
-        if (UtilValidate.isNotEmpty(orders)) {
-            GenericValue order = EntityUtil.getFirst(orders);
+        if (UtilValidate.isNotEmpty(order)) {
             List<GenericValue> orderPaymentPreferences = order.getRelated("OrderPaymentPreference", null, null, false);
             if (UtilValidate.isNotEmpty(orderPaymentPreferences)) {
                 orderPaymentPreference = EntityUtil.getFirst(orderPaymentPreferences);
@@ -237,7 +239,7 @@ public class GoogleCheckoutHelper {
         String externalId = info.getGoogleOrderNumber();
 
         // check and make sure this order doesn't already exist
-        List<GenericValue> existingOrder = delegator.findByAnd("OrderHeader", UtilMisc.toMap("externalId", externalId), null, false);
+        List<GenericValue> existingOrder = EntityQuery.use(delegator).from("OrderHeader").where("externalId", externalId).queryList();
         if (UtilValidate.isNotEmpty(existingOrder)) {
             //throw new GeneralException("Google order #" + externalId + " already exists.");
             Debug.logWarning("Google order #" + externalId + " already exists.", module);
@@ -409,8 +411,7 @@ public class GoogleCheckoutHelper {
         String shippingName = shipping.getShippingName();
         GenericValue googleShipping = null;
         try {
-            googleShipping = delegator.findOne("GoogleCoShippingMethod", UtilMisc.toMap("shipmentMethodName", shippingName,
-                    "productStoreId", cart.getProductStoreId()), false);
+            googleShipping = EntityQuery.use(delegator).from("GoogleCoShippingMethod").where("shipmentMethodName", shippingName, "productStoreId", cart.getProductStoreId()).queryOne();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -556,10 +557,10 @@ public class GoogleCheckoutHelper {
         String contactMechPurposeTypeId = getAddressType(addrType);
 
         // check to make sure the purpose doesn't already exist
-        List<GenericValue> values = delegator.findByAnd("PartyContactWithPurpose", UtilMisc.toMap("partyId", partyId,
-                "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId), null, false);
-        values = EntityUtil.filterByDate(values, null, "contactFromDate", "contactThruDate", true);
-        values = EntityUtil.filterByDate(values, null, "purposeFromDate", "purposeThruDate", true);
+        List<GenericValue> values = EntityQuery.use(delegator).from("PartyContactWithPurpose")
+                .where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId)
+                .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate")
+                .queryList();
 
         if (UtilValidate.isEmpty(values)) {
             Map<String, Object> addPurposeMap = FastMap.newInstance();
@@ -606,8 +607,7 @@ public class GoogleCheckoutHelper {
 
         List<GenericValue> cmLookup;
         try {
-            cmLookup = delegator.findByAnd(entityName, lookupMap, UtilMisc.toList("-fromDate"), false);
-            cmLookup = EntityUtil.filterByDate(cmLookup);
+            cmLookup = EntityQuery.use(delegator).from(entityName).where(lookupMap).orderBy("-fromDate").filterByDate().queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             throw e;
@@ -657,14 +657,14 @@ public class GoogleCheckoutHelper {
         if (geoCode != null && geoCode.length() == 3) {
             return geoCode;
         }
-        List<GenericValue> geos = null;
+        GenericValue geo = null;
         try {
-            geos = delegator.findByAnd("Geo", UtilMisc.toMap("geoCode", geoCode, "geoTypeId", "COUNTRY"), null, false);
+            geo = EntityQuery.use(delegator).from("Geo").where("geoCode", geoCode, "geoTypeId", "COUNTRY").queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
-        if (UtilValidate.isNotEmpty(geos)) {
-            return EntityUtil.getFirst(geos).getString("geoId");
+        if (UtilValidate.isNotEmpty(geo)) {
+            return geo.getString("geoId");
         } else {
             return "_NA_";
         }
@@ -673,10 +673,9 @@ public class GoogleCheckoutHelper {
     protected boolean hasHoldOrderNotes(String orderId) {
         EntityCondition idCond = EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId);
         EntityCondition content = EntityCondition.makeCondition("noteInfo", EntityOperator.LIKE, "%Order is held%");
-        EntityCondition mainCond = EntityCondition.makeCondition(UtilMisc.toList(idCond, content), EntityOperator.AND);
         List<GenericValue> holdOrderNotes = null;
         try {
-            holdOrderNotes = delegator.findList("OrderHeaderNoteView", mainCond, null, null, null, false);
+            holdOrderNotes = EntityQuery.use(delegator).from("OrderHeaderNoteView").where(idCond, content).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }

Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java (original)
+++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Sat Nov 29 08:00:37 2014
@@ -29,7 +29,6 @@ import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilNumber;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
@@ -131,7 +130,7 @@ public class GoogleRequestServices {
         // setup shipping options support
         List<GenericValue> shippingOptions = null;
         try {
-            shippingOptions = delegator.findByAnd("GoogleCoShippingMethod", UtilMisc.toMap("productStoreId", productStoreId), null, false);
+            shippingOptions = EntityQuery.use(delegator).from("GoogleCoShippingMethod").where("productStoreId", productStoreId).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -303,7 +302,7 @@ public class GoogleRequestServices {
 
         List<GenericValue> returnItems = null;
         try {
-            returnItems = delegator.findByAnd("ReturnItem", UtilMisc.toMap("returnId", returnId), null, false);
+            returnItems = EntityQuery.use(delegator).from("ReturnItem").where("returnId", returnId).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
         }
@@ -512,7 +511,7 @@ public class GoogleRequestServices {
     }
 
     private static void sendItemsShipped(Delegator delegator, String shipmentId) throws GeneralException {
-        List<GenericValue> issued = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("shipmentId", shipmentId), null, false);
+        List<GenericValue> issued = EntityQuery.use(delegator).from("ItemIssuance").where("shipmentId", shipmentId).queryList();
         if (UtilValidate.isNotEmpty(issued)) {
             try {
                 GenericValue googleOrder = null;
@@ -534,9 +533,7 @@ public class GoogleRequestServices {
                             isr = new ShipItemsRequest(mInfo, externalId);
                         }
                         // locate the shipment package content record
-                        Map<String, ? extends Object> spcLup = UtilMisc.toMap("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId);
-                        List<GenericValue> spc = delegator.findByAnd("ShipmentPackageContent", spcLup, null, false);
-                        GenericValue packageContent = EntityUtil.getFirst(spc);
+                        GenericValue packageContent = EntityQuery.use(delegator).from("ShipmentPackageContent").where("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItemSeqId).queryFirst();
                         String carrier = null;
                         if (UtilValidate.isNotEmpty(packageContent)) {
                             GenericValue shipPackage = packageContent.getRelatedOne("ShipmentPackage", false);

Modified: ofbiz/trunk/specialpurpose/hhfacility/src/org/ofbiz/hhfacility/FacilityServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/hhfacility/src/org/ofbiz/hhfacility/FacilityServices.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/hhfacility/src/org/ofbiz/hhfacility/FacilityServices.java (original)
+++ ofbiz/trunk/specialpurpose/hhfacility/src/org/ofbiz/hhfacility/FacilityServices.java Sat Nov 29 08:00:37 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.product.product.ProductWorker;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -75,8 +76,7 @@ public class FacilityServices {
         // todo: change this to a select from inv_items where productId and facilityId matches distinct (locationSeqId).
         List<GenericValue> invItemList = null;
         try {
-            invItemList = delegator.findByAnd("InventoryItem",
-                UtilMisc.toMap("productId", productId, "facilityId", facilityId), null, false);
+            invItemList = EntityQuery.use(delegator).from("InventoryItem").where("productId", productId, "facilityId", facilityId).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             throw new GeneralRuntimeException(e.getMessage());
@@ -138,7 +138,7 @@ public class FacilityServices {
         // Now get the inventory items that are found for that location, facility and product
         List<GenericValue> invItemList = null;
         try {
-            invItemList = delegator.findByAnd("InventoryItem", UtilMisc.toMap("productId", productId, "facilityId", facilityId, "locationSeqId", locationSeqId), null, false);
+            invItemList = EntityQuery.use(delegator).from("InventoryItem").where("productId", productId, "facilityId", facilityId, "locationSeqId", locationSeqId).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "updateProductStocktake failed getting inventory items", module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductErrorFailedProductStockTake", locale));

Modified: ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java?rev=1642398&r1=1642397&r2=1642398&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java (original)
+++ ofbiz/trunk/specialpurpose/lucene/src/org/ofbiz/content/search/ProductDocument.java Sat Nov 29 08:00:37 2014
@@ -99,7 +99,7 @@ public class ProductDocument implements
                         !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0")) ||
                         !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0"))) {
 
-                    List<GenericValue> productFeatureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId), null, false);
+                    List<GenericValue> productFeatureAndAppls = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", productId).queryList();
                     productFeatureAndAppls = this.filterByThruDate(productFeatureAndAppls);
 
                     for (GenericValue productFeatureAndAppl: productFeatureAndAppls) {
@@ -119,7 +119,7 @@ public class ProductDocument implements
                         this.addTextFieldByWeight(doc, "featureAbbreviation", productFeatureAndAppl.getString("abbrev"), "index.weight.ProductFeatureAndAppl.abbrev", 0, false, "fullText");
                         this.addTextFieldByWeight(doc, "featureCode", productFeatureAndAppl.getString("idCode"), "index.weight.ProductFeatureAndAppl.idCode", 0, false, "fullText");
                         // Get the ProductFeatureGroupIds
-                        List<GenericValue> productFeatureGroupAppls = delegator.findByAnd("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureId", productFeatureAndAppl.get("productFeatureId")), null, false);
+                        List<GenericValue> productFeatureGroupAppls = EntityQuery.use(delegator).from("ProductFeatureGroupAppl").where("productFeatureId", productFeatureAndAppl.get("productFeatureId")).queryList();
                         productFeatureGroupAppls = this.filterByThruDate(productFeatureGroupAppls);
                         for (GenericValue productFeatureGroupAppl : productFeatureGroupAppls) {
                             fromDate = productFeatureGroupAppl.getTimestamp("fromDate");
@@ -140,7 +140,7 @@ public class ProductDocument implements
                 if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0")) ||
                         !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0"))) {
 
-                    List<GenericValue> productAttributes = delegator.findByAnd("ProductAttribute", UtilMisc.toMap("productId", productId), null, false);
+                    List<GenericValue> productAttributes = EntityQuery.use(delegator).from("ProductAttribute").where("productId", productId).queryList();
                     for (GenericValue productAttribute: productAttributes) {
                         this.addTextFieldByWeight(doc, "attributeName", productAttribute.getString("attrName"), "index.weight.ProductAttribute.attrName", 0, false, "fullText");
                         this.addTextFieldByWeight(doc, "attributeValue", productAttribute.getString("attrValue"), "index.weight.ProductAttribute.attrValue", 0, false, "fullText");
@@ -149,7 +149,7 @@ public class ProductDocument implements
 
                 // GoodIdentification
                 if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0"))) {
-                    List<GenericValue> goodIdentifications = delegator.findByAnd("GoodIdentification", UtilMisc.toMap("productId", productId), null, false);
+                    List<GenericValue> goodIdentifications = EntityQuery.use(delegator).from("GoodIdentification").where("productId", productId).queryList();
                     for (GenericValue goodIdentification: goodIdentifications) {
                         String goodIdentificationTypeId = goodIdentification.getString("goodIdentificationTypeId");
                         String idValue = goodIdentification.getString("idValue");
@@ -162,7 +162,7 @@ public class ProductDocument implements
                 // Virtual ProductIds
                 if ("Y".equals(product.getString("isVirtual"))) {
                     if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"))) {
-                        List<GenericValue> variantProductAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT"), null, false);
+                        List<GenericValue> variantProductAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT").queryList();
                         variantProductAssocs = this.filterByThruDate(variantProductAssocs);
                         for (GenericValue variantProductAssoc: variantProductAssocs) {
                             Timestamp fromDate = variantProductAssoc.getTimestamp("fromDate");
@@ -190,7 +190,7 @@ public class ProductDocument implements
                         Debug.logWarning("Could not parse weight number: " + e.toString(), module);
                     }
 
-                    List<GenericValue> productContentAndInfos = delegator.findByAnd("ProductContentAndInfo", UtilMisc.toMap("productId", productId, "productContentTypeId", productContentTypeId), null, false);
+                    List<GenericValue> productContentAndInfos = EntityQuery.use(delegator).from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", productContentTypeId).queryList();
                     productContentAndInfos = this.filterByThruDate(productContentAndInfos);
                     for (GenericValue productContentAndInfo: productContentAndInfos) {
                         Timestamp fromDate = productContentAndInfo.getTimestamp("fromDate");