Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java
 Mon Dec  1 10:16:27 2014
@@ -53,7 +53,6 @@ import org.ofbiz.entity.condition.Entity
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.util.EntityListIterator;
 import org.ofbiz.entity.util.EntityQuery;
-import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -92,9 +91,7 @@ public class WorkEffortServices {
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "CAL_CANCELLED")
                );
-                validWorkEfforts = EntityUtil.filterByDate(
-                        delegator.findList("WorkEffortAndPartyAssign", ecl, 
null, UtilMisc.toList("estimatedStartDate", "priority"), null, false)
-               );
+                validWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortAndPartyAssign").where(ecl).orderBy("estimatedStartDate",
 "priority").filterByDate().queryList();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -127,9 +124,7 @@ public class WorkEffortServices {
             conditionList.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "CAL_CANCELLED"));
 
             EntityConditionList<EntityExpr> ecl = 
EntityCondition.makeCondition(conditionList, EntityOperator.AND);
-            validWorkEfforts = EntityUtil.filterByDate(
-                    delegator.findList("WorkEffortAndPartyAssign", ecl, null, 
UtilMisc.toList("estimatedStartDate", "priority"), null, false)
-           );
+            validWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortAndPartyAssign").where(ecl).orderBy("estimatedStartDate",
 "priority").filterByDate().queryList();
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
             return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -162,7 +157,7 @@ public class WorkEffortServices {
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "CAL_CANCELLED"),
                         EntityCondition.makeCondition("statusId", 
EntityOperator.NOT_EQUAL, "PRTYASGN_UNASSIGNED"));
-                validWorkEfforts = 
EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, 
null, UtilMisc.toList("priority"), null, false));
+                validWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortAndPartyAssign").where(ecl).orderBy("priority").filterByDate().queryList();
                 ecl = EntityCondition.makeCondition(
                         EntityOperator.AND,
                         EntityCondition.makeCondition("partyId", 
EntityOperator.EQUALS, userLogin.get("partyId")),
@@ -170,7 +165,7 @@ public class WorkEffortServices {
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "PRUN_CANCELLED "),
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "PRUN_COMPLETED"),
                         EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "PRUN_CLOSED"));
-                
validWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign",
 ecl, null, UtilMisc.toList("createdDate DESC"), null, false)));
+                
validWorkEfforts.addAll(EntityQuery.use(delegator).from("WorkEffortAndPartyAssign").where(ecl).orderBy("createdDate
 DESC").filterByDate().queryList());
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -207,8 +202,7 @@ public class WorkEffortServices {
                 
constraints.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "WF_TERMINATED"));
                 
constraints.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "WF_ABORTED"));
 
-                EntityConditionList<EntityExpr> ecl = 
EntityCondition.makeCondition(constraints, EntityOperator.AND);
-                validWorkEfforts = 
EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssign", ecl, 
null, UtilMisc.toList("priority"), null, false));
+                validWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortAndPartyAssign").where(constraints).orderBy("priority").filterByDate().queryList();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -244,10 +238,7 @@ public class WorkEffortServices {
                 
constraints.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "WF_TERMINATED"));
                 
constraints.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "WF_ABORTED"));
 
-                EntityConditionList<EntityExpr> ecl = 
EntityCondition.makeCondition(constraints);
-                roleWorkEfforts = EntityUtil.filterByDate(
-                        delegator.findList("WorkEffortPartyAssignByRole", ecl, 
null, UtilMisc.toList("priority"), null, false)
-               );
+                roleWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortPartyAssignByRole").where(constraints).orderBy("priority").filterByDate().queryList();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -283,10 +274,7 @@ public class WorkEffortServices {
                 
constraints.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "WF_TERMINATED"));
                 
constraints.add(EntityCondition.makeCondition("currentStatusId", 
EntityOperator.NOT_EQUAL, "WF_ABORTED"));
 
-                EntityConditionList<EntityExpr> ecl = 
EntityCondition.makeCondition(constraints);
-                groupWorkEfforts = EntityUtil.filterByDate(
-                        delegator.findList("WorkEffortPartyAssignByGroup", 
ecl, null, UtilMisc.toList("priority"), null, false)
-               );
+                groupWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortPartyAssignByGroup").where(constraints).orderBy("priority").filterByDate().queryList();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, module);
                 return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
@@ -337,7 +325,7 @@ public class WorkEffortServices {
             // get a list of workEffortPartyAssignments, if empty then this 
user CANNOT view the event, unless they have permission to view all
             if (userLogin != null && userLogin.get("partyId") != null && 
workEffortId != null) {
                 try {
-                    workEffortPartyAssignments = 
delegator.findByAnd("WorkEffortPartyAssignment", UtilMisc.toMap("workEffortId", 
workEffortId, "partyId", userLogin.get("partyId")), null, false);
+                    workEffortPartyAssignments = 
EntityQuery.use(delegator).from("WorkEffortPartyAssignment").where("workEffortId",
 workEffortId, "partyId", userLogin.get("partyId")).queryList();
                 } catch (GenericEntityException e) {
                     Debug.logWarning(e, module);
                 }
@@ -635,20 +623,17 @@ public class WorkEffortServices {
         }
         */
 
-        EntityCondition eclTotal = 
EntityCondition.makeCondition(entityExprList, EntityJoinOperator.AND);
-
-        List<String> orderByList = UtilMisc.toList("estimatedStartDate");
         try {
             List<GenericValue> tempWorkEfforts = null;
             if (UtilValidate.isNotEmpty(partyIdsToUse)) {
                 // Debug.logInfo("=====conditions for party: " + eclTotal);
-                tempWorkEfforts = 
EntityUtil.filterByDate(delegator.findList("WorkEffortAndPartyAssignAndType", 
eclTotal, null, orderByList, null, false));
+                tempWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffortAndPartyAssignAndType").where(entityExprList).orderBy("estimatedStartDate").filterByDate().queryList();
             } else {
-                tempWorkEfforts = delegator.findList("WorkEffort", eclTotal, 
null, orderByList, null, false);
+                tempWorkEfforts = 
EntityQuery.use(delegator).from("WorkEffort").where(entityExprList).orderBy("estimatedStartDate").queryList();
             }
             if (!"CAL_PERSONAL".equals(calendarType) && 
UtilValidate.isNotEmpty(fixedAssetId)) {
                 // Get "new style" work efforts
-                
tempWorkEfforts.addAll(EntityUtil.filterByDate(delegator.findList("WorkEffortAndFixedAssetAssign",
 eclTotal, null, orderByList, null, false)));
+                
tempWorkEfforts.addAll(EntityQuery.use(delegator).from("WorkEffortAndFixedAssetAssign").where(entityExprList).orderBy("estimatedStartDate").filterByDate().queryList());
             }
             validWorkEfforts = 
WorkEffortWorker.removeDuplicateWorkEfforts(tempWorkEfforts);
         } catch (GenericEntityException e) {
@@ -790,15 +775,13 @@ public class WorkEffortServices {
             
findIncomingProductionRunsStatusConds.add(EntityCondition.makeCondition("currentStatusId",
 EntityOperator.EQUALS, "PRUN_RUNNING"));
             
findIncomingProductionRunsConds.add(EntityCondition.makeCondition(findIncomingProductionRunsStatusConds,
 EntityOperator.OR));
 
-            EntityConditionList<EntityCondition> 
findIncomingProductionRunsCondition = 
EntityCondition.makeCondition(findIncomingProductionRunsConds, 
EntityOperator.AND);
-
-            List<GenericValue> incomingProductionRuns = 
delegator.findList("WorkEffortAndGoods", findIncomingProductionRunsCondition, 
null, UtilMisc.toList("-estimatedCompletionDate"), null, false);
+            List<GenericValue> incomingProductionRuns = 
EntityQuery.use(delegator).from("WorkEffortAndGoods").where(findIncomingProductionRunsConds).orderBy("-estimatedCompletionDate").queryList();
             for (GenericValue incomingProductionRun: incomingProductionRuns) {
                 double producedQtyTot = 0.0;
                 if 
(incomingProductionRun.getString("currentStatusId").equals("PRUN_COMPLETED")) {
-                    List<GenericValue> inventoryItems = 
delegator.findByAnd("WorkEffortAndInventoryProduced", 
UtilMisc.toMap("productId", productId, "workEffortId", 
incomingProductionRun.getString("workEffortId")), null, false);
+                    List<GenericValue> inventoryItems = 
EntityQuery.use(delegator).from("WorkEffortAndInventoryProduced").where("productId",
 productId, "workEffortId", 
incomingProductionRun.getString("workEffortId")).queryList();
                     for (GenericValue inventoryItem: inventoryItems) {
-                        GenericValue inventoryItemDetail = 
EntityUtil.getFirst(delegator.findByAnd("InventoryItemDetail", 
UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")), 
UtilMisc.toList("inventoryItemDetailSeqId"), false));
+                        GenericValue inventoryItemDetail = 
EntityQuery.use(delegator).from("InventoryItemDetail").where("inventoryItemId", 
inventoryItem.getString("inventoryItemId")).orderBy("inventoryItemDetailSeqId").queryFirst();
                         if (inventoryItemDetail != null && 
inventoryItemDetail.get("quantityOnHandDiff") != null) {
                             Double inventoryItemQty = 
inventoryItemDetail.getDouble("quantityOnHandDiff");
                             producedQtyTot = producedQtyTot + 
inventoryItemQty.doubleValue();
@@ -857,8 +840,7 @@ public class WorkEffortServices {
             
findOutgoingProductionRunsStatusConds.add(EntityCondition.makeCondition("currentStatusId",
 EntityOperator.EQUALS, "PRUN_RUNNING"));
             
findOutgoingProductionRunsConds.add(EntityCondition.makeCondition(findOutgoingProductionRunsStatusConds,
 EntityOperator.OR));
 
-            EntityConditionList<EntityCondition> 
findOutgoingProductionRunsCondition = 
EntityCondition.makeCondition(findOutgoingProductionRunsConds, 
EntityOperator.AND);
-            List<GenericValue> outgoingProductionRuns = 
delegator.findList("WorkEffortAndGoods", findOutgoingProductionRunsCondition, 
null, UtilMisc.toList("-estimatedStartDate"), null, false);
+            List<GenericValue> outgoingProductionRuns = 
EntityQuery.use(delegator).from("WorkEffortAndGoods").where(findOutgoingProductionRunsConds).orderBy("-estimatedStartDate").queryList();
             for (GenericValue outgoingProductionRun: outgoingProductionRuns) {
                 String weFacilityId = 
outgoingProductionRun.getString("facilityId");
                 Double neededQuantity = 
outgoingProductionRun.getDouble("estimatedQuantity");
@@ -909,7 +891,10 @@ public class WorkEffortServices {
         Timestamp now = new Timestamp(System.currentTimeMillis());
         List<GenericValue> eventReminders = null;
         try {
-            eventReminders = delegator.findList("WorkEffortEventReminder", 
EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("reminderDateTime",
 EntityOperator.EQUALS, null), 
EntityCondition.makeCondition("reminderDateTime", 
EntityOperator.LESS_THAN_EQUAL_TO, now)), EntityOperator.OR), null, null, null, 
false);
+            eventReminders = 
EntityQuery.use(delegator).from("WorkEffortEventReminder")
+                    
.where(EntityCondition.makeCondition(UtilMisc.<EntityCondition>toList(EntityCondition.makeCondition("reminderDateTime",
 EntityOperator.EQUALS, null), 
+                            EntityCondition.makeCondition("reminderDateTime", 
EntityOperator.LESS_THAN_EQUAL_TO, now)), EntityOperator.OR))
+                            .queryList();
         } catch (GenericEntityException e) {
             return 
ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                     "WorkEffortEventRemindersRetrivingError", 
UtilMisc.toMap("errorString", e), localePar));
@@ -1114,7 +1099,7 @@ public class WorkEffortServices {
         if (modelEntity != null && modelEntity.getField("recurrenceOffset") != 
null) {
             List<GenericValue> eventReminders = null;
             try {
-                eventReminders = delegator.findList("WorkEffortEventReminder", 
null, null, null, null, false);
+                eventReminders = 
EntityQuery.use(delegator).from("WorkEffortEventReminder").queryList();
                 for (GenericValue reminder : eventReminders) {
                     if 
(UtilValidate.isNotEmpty(reminder.get("recurrenceOffset"))) {
                         reminder.set("reminderOffset", 
reminder.get("recurrenceOffset"));

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortWorker.java
 Mon Dec  1 10:16:27 2014
@@ -26,15 +26,11 @@ import javolution.util.FastList;
 import javolution.util.FastSet;
 
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilMisc;
 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.EntityConditionList;
-import org.ofbiz.entity.condition.EntityExpr;
-import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityQuery;
 
 
 /** WorkEffortWorker - Work Effort worker class. */
@@ -56,22 +52,13 @@ public class WorkEffortWorker {
 
         List<GenericValue> workEfforts = FastList.newInstance();
         try {
-            EntityConditionList<EntityExpr> exprsLevelFirst = 
EntityCondition.makeCondition(UtilMisc.toList(
-                    EntityCondition.makeCondition(left, workEffortId),
-                    EntityCondition.makeCondition("workEffortAssocTypeId", 
workEffortAssocTypeId)), EntityOperator.AND);
-            List<GenericValue> childWEAssocsLevelFirst = 
delegator.findList("WorkEffortAssoc", exprsLevelFirst, null, null, null, true);
+            List<GenericValue> childWEAssocsLevelFirst = 
EntityQuery.use(delegator).from("WorkEffortAssoc").where(left, workEffortId, 
"workEffortAssocTypeId", workEffortAssocTypeId).cache(true).queryList();
             for (GenericValue childWEAssocLevelFirst : 
childWEAssocsLevelFirst) {
-                EntityConditionList<EntityExpr> exprsLevelNext = 
EntityCondition.makeCondition(UtilMisc.toList(
-                        EntityCondition.makeCondition(left, 
childWEAssocLevelFirst.get(right)),
-                        EntityCondition.makeCondition("workEffortAssocTypeId", 
workEffortAssocTypeId)), EntityOperator.AND);
-                List<GenericValue> childWEAssocsLevelNext = 
delegator.findList("WorkEffortAssoc", exprsLevelNext, null, null, null, true);
+                List<GenericValue> childWEAssocsLevelNext = 
EntityQuery.use(delegator).from("WorkEffortAssoc").where(left, 
childWEAssocLevelFirst.get(right), "workEffortAssocTypeId", 
workEffortAssocTypeId).cache(true).queryList();
                 while (UtilValidate.isNotEmpty(childWEAssocsLevelNext)) {
                     List<GenericValue> tempWorkEffortList = 
FastList.newInstance();
                     for (GenericValue childWEAssocLevelNext : 
childWEAssocsLevelNext) {
-                        EntityConditionList<EntityExpr> exprsLevelNth = 
EntityCondition.makeCondition(UtilMisc.toList(
-                                EntityCondition.makeCondition(left, 
childWEAssocLevelNext.get(right)),
-                                
EntityCondition.makeCondition("workEffortAssocTypeId", workEffortAssocTypeId)), 
EntityOperator.AND);
-                        List<GenericValue> childWEAssocsLevelNth = 
delegator.findList("WorkEffortAssoc", exprsLevelNth, null, null, null, true);
+                        List<GenericValue> childWEAssocsLevelNth = 
EntityQuery.use(delegator).from("WorkEffortAssoc").where(left, 
childWEAssocLevelNext.get(right), "workEffortAssocTypeId", 
workEffortAssocTypeId).cache(true).queryList();
                         if (UtilValidate.isNotEmpty(childWEAssocsLevelNth)) {
                             tempWorkEffortList.addAll(childWEAssocsLevelNth);
                         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml 
(original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/build.xml Mon Dec  
1 10:16:27 2014
@@ -336,7 +336,47 @@ under the License.
     </target>
     
     <target name="patch" depends="patch-via-svn,patch-via-patch"/>
+
+    <target name="revert-dev"
+      description="Revert patch files present in runtime/patches applied by 
build-dev.">
+      <!-- Ant patch task can't handle a fileset => create a global patch -->
+      <concat destfile="${basedir}/runtime/patches/dev.patch" encoding="UTF-8" 
outputencoding="UTF-8">
+        <fileset dir="${basedir}/runtime/patches" casesensitive="no">
+          <exclude name="dev.patch"/> <!-- exclude the patch itself in case 
it's still there -->
+          <include name="*.patch"/>
+        </fileset>
+      </concat>
+      <if>
+        <available file="${basedir}/runtime/patches/dev.patch"/>
+        <then>
+            <antcall target="revert-patch">
+                <param name="dir-name" value="${basedir}"/>
+                <param name="diff-file" 
value="${basedir}/runtime/patches/dev.patch"/>
+            </antcall>
+            <delete file="${basedir}/runtime/patches/dev.patch"/>
+        </then>
+      </if>
+    </target>
+
+    <target name="revert-via-svn" depends="check-svn-patch-available" 
if="svn-version-ok">
+        <exec dir="${basedir}" executable="svn" failonerror="true">
+            <arg value="patch" />
+            <arg value="${diff-file}" />
+            <arg value="${dir-name}" />
+            <arg value="--reverse-diff" />
+        </exec>
+    </target>
     
+    <target name="revert-via-patch" depends="check-patch-available" 
if="patch-ok">
+        <exec dir="${basedir}" executable="patch" input="${diff-file}" 
failonerror="true">
+            <arg value="--binary" /><!-- To prevent EOL issues which comes 
when using mixed development platforms (ie Unix and Win) -->
+            <arg value="-p0" />
+            <arg value="-R" />
+        </exec>
+    </target>
+    
+    <target name="revert-patch" depends="revert-via-svn,revert-via-patch"/>
+
     <target name="build-test" 
         description="Patch and build all sources for use in a test 
environment. On Windows you need to have patch.exe in the path and patch files 
must all be in dos format (CR+LF)">
         <subant inheritall="false" target="prepare-to-build-test" 
failonerror="true">

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/build.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/build.xml?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/build.xml 
(original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/build.xml 
Mon Dec  1 10:16:27 2014
@@ -24,7 +24,7 @@ under the License.
                entity/build.xml,geronimo/build.xml,
                catalina/build.xml,
                security/build.xml,service/build.xml,entityext/build.xml,
-               bi/build.xml,minilang/build.xml,
+               minilang/build.xml,
                webapp/build.xml,widget/build.xml,
                common/build.xml,datafile/build.xml,
                testtools/build.xml,

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/ofbiz-component.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/ofbiz-component.xml?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/ofbiz-component.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/common/ofbiz-component.xml
 Mon Dec  1 10:16:27 2014
@@ -25,8 +25,6 @@ under the License.
     <classpath type="jar" location="build/lib/*"/>
     <classpath type="dir" location="config"/>
     <entity-resource type="model" reader-name="main" loader="main" 
location="entitydef/entitymodel.xml"/>
-    <entity-resource type="model" reader-name="main" loader="main" 
location="entitydef/entitymodel_olap.xml"/>
-    <entity-resource type="group" reader-name="main" loader="main" 
location="entitydef/entitygroup_olap.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" 
location="data/CommonSecurityPermissionSeedData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" 
location="data/CommonSecurityGroupDemoData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" 
location="data/CommonSystemPropertyData.xml"/>
@@ -62,13 +60,11 @@ under the License.
     <entity-resource type="data" reader-name="seed" loader="main" 
location="data/LanguageData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" 
location="data/UnitData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" 
location="data/PeriodData.xml"/>
-    <entity-resource type="data" reader-name="seed" loader="main" 
location="data/DimensionTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" 
location="data/CommonPortletData.xml"/>
 
     <service-resource type="model" loader="main" 
location="servicedef/services.xml"/>
     <service-resource type="model" loader="main" 
location="servicedef/services_cdyne.xml"/>
     <service-resource type="model" loader="main" 
location="servicedef/services_email.xml"/>
-    <service-resource type="model" loader="main" 
location="servicedef/services_olap.xml"/>
     <service-resource type="model" loader="main" 
location="servicedef/services_security.xml"/>
     <service-resource type="model" loader="main" 
location="servicedef/services_test.xml"/>
     <service-resource type="group" loader="main" 
location="servicedef/groups_test.xml"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/component-load.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/component-load.xml?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/component-load.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/component-load.xml
 Mon Dec  1 10:16:27 2014
@@ -31,7 +31,6 @@ under the License.
     <load-component component-location="service"/>
     <load-component component-location="catalina"/>
     <load-component component-location="entityext"/>
-    <load-component component-location="bi"/>
     <load-component component-location="webapp"/>
     <load-component component-location="widget"/>
     <load-component component-location="testtools"/>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
 Mon Dec  1 10:16:27 2014
@@ -325,33 +325,24 @@ public class EntityDataLoadContainer imp
         List<String> loadComponents = new LinkedList<String>();
         if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId()) && 
EntityUtil.isMultiTenantEnabled()) {
             try {
-                List<EntityExpr> exprs = new ArrayList<EntityExpr>();
-                exprs.add(EntityCondition.makeCondition("rootLocation", 
EntityOperator.NOT_LIKE, "%hot-deploy%"));
-                EntityCondition cond = EntityCondition.makeCondition(exprs);
-                List<GenericValue> components = 
baseDelegator.findList("Component", cond , null, 
UtilMisc.toList("lastUpdatedStamp"), null, false);
-                Debug.logInfo("===== Begin load specify components", module);
                 if (UtilValidate.isEmpty(this.component)) {
-                    for (GenericValue component : components) {
-                        
loadComponents.add(component.getString("componentName"));
-                        //Debug.logInfo("- loaded default component : " + 
component.getString("componentName"), module);
+                    for (ComponentConfig config : allComponents) {
+                        loadComponents.add(config.getComponentName());
                     }
-                    Debug.logInfo("- Loaded components by default : " + 
components.size() + " components", module);
                     List<GenericValue> tenantComponents = 
baseDelegator.findByAnd("TenantComponent", UtilMisc.toMap("tenantId", 
delegator.getDelegatorTenantId()), UtilMisc.toList("sequenceNum"), false);
                     for (GenericValue tenantComponent : tenantComponents) {
                         
loadComponents.add(tenantComponent.getString("componentName"));
-                        //Debug.logInfo("- loaded component by tenantId : " + 
tenantComponent.getString("tenantId") +", component : " + 
tenantComponent.getString("componentName"), module);
                     }
-                    Debug.logInfo("- Loaded components by tenantId : " + 
delegator.getDelegatorTenantId() + ", " + tenantComponents.size() + " 
components", module);
+                    Debug.logInfo("Loaded components by tenantId : " + 
delegator.getDelegatorTenantId() + ", " + tenantComponents.size() + " 
components", module);
                 } else {
                     List<GenericValue> tenantComponents = 
baseDelegator.findByAnd("TenantComponent", UtilMisc.toMap("tenantId", 
delegator.getDelegatorTenantId(), "componentName", this.component),
                             UtilMisc.toList("sequenceNum"), false);
                     for (GenericValue tenantComponent : tenantComponents) {
                         
loadComponents.add(tenantComponent.getString("componentName"));
-                        //Debug.logInfo("- loaded component by tenantId : " + 
tenantComponent.getString("tenantId") +", component : " + 
tenantComponent.getString("componentName"), module);
                     }
-                    Debug.logInfo("- Loaded tenantId : " + 
delegator.getDelegatorTenantId() + " and component : " + this.component, 
module);
+                    Debug.logInfo("Loaded tenantId : " + 
delegator.getDelegatorTenantId() + " and component : " + this.component, 
module);
                 }
-                Debug.logInfo("===== Loaded : " + loadComponents.size() + " 
components", module);
+                Debug.logInfo("Loaded : " + loadComponents.size() + " 
components", module);
             } catch (GenericEntityException e) {
                 Debug.logError(e.getMessage(), module);
             }

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/service/src/org/ofbiz/service/ServiceUtil.java
 Mon Dec  1 10:16:27 2014
@@ -424,11 +424,14 @@ public class ServiceUtil {
                     // begin this transaction
                     beganTx1 = TransactionUtil.begin();
 
-                    EntityListIterator foundJobs = 
delegator.find("JobSandbox", mainCond, null, UtilMisc.toSet("jobId"), null, 
findOptions);
+                    EntityListIterator foundJobs = null;
                     try {
+                        foundJobs = delegator.find("JobSandbox", mainCond, 
null, UtilMisc.toSet("jobId"), null, findOptions);
                         curList = foundJobs.getPartialList(1, 1000);
                     } finally {
-                        foundJobs.close();
+                        if (foundJobs != null) {
+                            foundJobs.close();
+                         }
                     }
                 } catch (GenericEntityException e) {
                     Debug.logError(e, "Cannot obtain job data from 
datasource", module);

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/src/org/ofbiz/assetmaint/FixedAssetMaintServices.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/build.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/build.xml?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/build.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/build.xml
 Mon Dec  1 10:16:27 2014
@@ -38,6 +38,7 @@
         pos/build.xml,
         projectmgr/build.xml,
         scrum/build.xml,
+        bi/build.xml,
         webpos/build.xml
     "/>
 </project>

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/component-load.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/component-load.xml?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/component-load.xml
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/component-load.xml
 Mon Dec  1 10:16:27 2014
@@ -38,6 +38,7 @@ under the License.
     <load-component component-location="ldap"/>
     <load-component component-location="webpos"/>
     <load-component component-location="birt"/>
+    <load-component component-location="bi"/>
     <load-component component-location="example"/>
     <load-component component-location="exampleext"/>
     <!-- <load-component component-location="jetty"/> -->

Modified: 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ImportOrdersFromEbay.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
 Mon Dec  1 10:16:27 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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1642661&r1=1642660&r2=1642661&view=diff
==============================================================================
--- 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java
 (original)
+++ 
ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java
 Mon Dec  1 10:16:27 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")) {


Reply via email to