Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
 Fri Dec 26 06:54:50 2014
@@ -125,7 +125,6 @@ if (action) {
     }
 
     // set distinct on so we only get one row per product
-    findOpts = new EntityFindOptions(true, 
EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, 
true);
     searchCondition = EntityCondition.makeCondition(conditionMap, 
EntityOperator.AND);
     notVirtualCondition = 
EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual", 
EntityOperator.EQUALS, null),
                                                         EntityOperator.OR,
@@ -223,8 +222,7 @@ if (action) {
         // get the indexes for the partial list
         lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1);
         highIndex = (viewIndex.intValue() + 1) * viewSize.intValue();
-        findOpts.setMaxRows(highIndex);
-        prodsEli = delegator.findListIteratorByCondition(prodView, 
whereCondition, null, null, orderBy, findOpts);
+        prodsEli = 
from(prodView).where(whereCondition).orderBy(orderBy).cursorScrollInsensitive().maxRows(highIndex).distinct().queryIterator();
 
         // get the partial list for this page
         prods = prodsEli.getPartialList(lowIndex, highIndex);
@@ -259,15 +257,13 @@ if (action) {
             if (checkTime) {
 
                 // Make a query against the sales usage view entity
-                salesUsageIt = 
delegator.findListIteratorByCondition(salesUsageViewEntity,
-                        EntityCondition.makeCondition(
-                            [EntityCondition.makeCondition("facilityId", 
EntityOperator.EQUALS, facilityId),
-                             EntityCondition.makeCondition("productId", 
EntityOperator.EQUALS, oneProd.productId),
-                             EntityCondition.makeCondition("statusId", 
EntityOperator.IN, ['ORDER_COMPLETED', 'ORDER_APPROVED', 'ORDER_HELD']),
-                             EntityCondition.makeCondition("orderTypeId", 
EntityOperator.EQUALS, "SALES_ORDER"),
-                             EntityCondition.makeCondition("orderDate", 
EntityOperator.GREATER_THAN_EQUAL_TO, checkTime)
-                            ],
-                            EntityOperator.AND), null, null, null, null);
+                salesUsageIt = from(salesUsageViewEntity)
+                                    
.where(EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, 
facilityId),
+                                        
EntityCondition.makeCondition("productId", EntityOperator.EQUALS, 
oneProd.productId),
+                                        
EntityCondition.makeCondition("statusId", EntityOperator.IN, 
['ORDER_COMPLETED', 'ORDER_APPROVED', 'ORDER_HELD']),
+                                        
EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, 
"SALES_ORDER"),
+                                        
EntityCondition.makeCondition("orderDate", 
EntityOperator.GREATER_THAN_EQUAL_TO, checkTime))
+                                    .queryIterator();
 
                 // Sum the sales usage quantities found
                 salesUsageQuantity = 0;
@@ -283,14 +279,12 @@ if (action) {
                 salesUsageIt.close();
 
                 // Make a query against the production usage view entity
-                productionUsageIt = 
delegator.findListIteratorByCondition(productionUsageViewEntity,
-                        EntityCondition.makeCondition(
-                            [EntityCondition.makeCondition("facilityId", 
EntityOperator.EQUALS, facilityId),
-                             EntityCondition.makeCondition("productId", 
EntityOperator.EQUALS, oneProd.productId),
-                             EntityCondition.makeCondition("workEffortTypeId", 
EntityOperator.EQUALS, "PROD_ORDER_TASK"),
-                             
EntityCondition.makeCondition("actualCompletionDate", 
EntityOperator.GREATER_THAN_EQUAL_TO, checkTime)
-                            ],
-                            EntityOperator.AND), null, null, null, null);
+                productionUsageIt = from(productionUsageViewEntity)
+                                    
.where(EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, 
facilityId),
+                                         
EntityCondition.makeCondition("productId", EntityOperator.EQUALS, 
oneProd.productId),
+                                         
EntityCondition.makeCondition("workEffortTypeId", EntityOperator.EQUALS, 
"PROD_ORDER_TASK"),
+                                         
EntityCondition.makeCondition("actualCompletionDate", 
EntityOperator.GREATER_THAN_EQUAL_TO, checkTime))
+                                    .queryIterator();
 
                 // Sum the production usage quantities found
                 productionUsageQuantity = 0;

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditContactMech.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditContactMech.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditContactMech.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditContactMech.groovy
 Fri Dec 26 06:54:50 2014
@@ -22,7 +22,7 @@ import org.ofbiz.party.contact.*;
 facilityId = parameters.facilityId;
 context.facilityId = facilityId;
 
-facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+facility = from("Facility").where("facilityId", facilityId).queryOne();
 context.facility = facility;
 
 mechMap = [:];
@@ -62,7 +62,7 @@ if (!cmNewPurposeTypeId) {
 }
 if (cmNewPurposeTypeId) {
     context.contactMechPurposeTypeId = cmNewPurposeTypeId;
-    contactMechPurposeType = delegator.findOne("ContactMechPurposeType", 
[contactMechPurposeTypeId : cmNewPurposeTypeId], false);
+    contactMechPurposeType = 
from("ContactMechPurposeType").where("contactMechPurposeTypeId", 
cmNewPurposeTypeId).queryOne();
     if (contactMechPurposeType) {
         context.contactMechPurposeType = contactMechPurposeType;
     }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacility.groovy
 Fri Dec 26 06:54:50 2014
@@ -23,7 +23,7 @@ facilityId = parameters.facilityId;
 if (!facilityId && request.getAttribute("facilityId")) {
   facilityId = request.getAttribute("facilityId");
 }
-facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+facility = from("Facility").where("facilityId", facilityId).queryOne();
 if (!facility) {
   facility = delegator.makeValue("Facility");
   facilityType = delegator.makeValue("FacilityType");
@@ -35,16 +35,16 @@ context.facilityType = facilityType;
 context.facilityId = facilityId;
 
 //Facility types
-facilityTypes = delegator.findList("FacilityType", null, null, null, null, 
false);
+facilityTypes = from("FacilityType").queryList();
 if (facilityTypes) {
   context.facilityTypes = facilityTypes;
 }
 
 // all possible inventory item types
-context.inventoryItemTypes = delegator.findList("InventoryItemType", null, 
null, ['description'], null, true);
+context.inventoryItemTypes = 
from("InventoryItemType").orderBy("description").cache(true).queryList();
 
 // weight unit of measures
-context.weightUomList = delegator.findList("Uom", 
EntityCondition.makeCondition([uomTypeId : 'WEIGHT_MEASURE']), null, null, 
null, true);
+context.weightUomList = from("Uom").where("uomTypeId", 
"WEIGHT_MEASURE").cache(true).queryList();
 
 // area unit of measures
-context.areaUomList = delegator.findList("Uom", 
EntityCondition.makeCondition([uomTypeId : 'AREA_MEASURE']), null, null, null, 
true);
+context.areaUomList = from("Uom").where("uomTypeId", 
"AREA_MEASURE").cache(true).queryList();

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacilityLocation.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacilityLocation.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacilityLocation.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/EditFacilityLocation.groovy
 Fri Dec 26 06:54:50 2014
@@ -33,13 +33,13 @@ if (!locationSeqId && request.getAttribu
 }
 
 if (facilityId && locationSeqId) {
-    facilityLocation = delegator.findOne("FacilityLocation", [facilityId : 
facilityId, locationSeqId : locationSeqId], false);
+    facilityLocation = from("FacilityLocation").where("facilityId", 
facilityId, "locationSeqId", locationSeqId).queryOne();
 }
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
 }
 
-locationTypeEnums = delegator.findList("Enumeration", 
EntityCondition.makeCondition([enumTypeId : 'FACLOC_TYPE']), null, null, null, 
false);
+locationTypeEnums = from("Enumeration").where("enumTypeId", 
"FACLOC_TYPE").queryList();
 
 // ProductFacilityLocation stuff
 productFacilityLocations = null;

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy
 Fri Dec 26 06:54:50 2014
@@ -42,7 +42,7 @@ if (facilityId && locationSeqId) {
         context.geoChart = geoChart;
     }
     if (latestGeoPoint && latestGeoPoint.elevationUomId) {
-        elevationUom = delegator.findOne("Uom", [uomId : 
latestGeoPoint.elevationUomId], false);
+        elevationUom = from("Uom").where("uomId", 
latestGeoPoint.elevationUomId).queryOne();
         context.elevationUomAbbr = elevationUom.abbreviation;
     }
 }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacility.groovy
 Fri Dec 26 06:54:50 2014
@@ -18,7 +18,7 @@
  */
  import org.ofbiz.base.util.*
 
-findResult = delegator.findList("Facility", null, null, null, null, false);
+findResult = from("Facility").queryList();
 findResultSize = findResult.size();
 if (findResultSize == 1) {
     context.showScreen = "one";

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityLocation.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityLocation.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityLocation.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityLocation.groovy
 Fri Dec 26 06:54:50 2014
@@ -32,7 +32,7 @@ if (itemId) {
 itemId = session.getAttribute("inventoryItemId");
 context.itemId = itemId;
 
-facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+facility = from("Facility").where("facilityId", facilityId).queryOne();
 context.facility = facility;
 
 UtilHttp.parametersToAttributes(request);
@@ -46,7 +46,7 @@ if (lookup) {
             paramMap.remove(key);
         }
     }
-    foundLocations = delegator.findList("FacilityLocation", 
EntityCondition.makeCondition(paramMap), null, null, null, false);
+    foundLocations = from("FacilityLocation").where(paramMap).queryList();
     if (foundLocations) {
         context.foundLocations = foundLocations;
     }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityTransfers.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityTransfers.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityTransfers.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindFacilityTransfers.groovy
 Fri Dec 26 06:54:50 2014
@@ -39,8 +39,7 @@ if (completeRequested) {
     exprsTo = [EntityCondition.makeCondition("facilityIdTo", 
EntityOperator.EQUALS, facilityId),
                EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, "IXF_REQUESTED")];
 }
-ecl = EntityCondition.makeCondition(exprsTo, EntityOperator.AND);
-toTransfers = delegator.findList("InventoryTransfer", ecl, null, ['sendDate'], 
null, false);
+toTransfers = 
from("InventoryTransfer").where(exprsTo).orderBy("sendDate").queryList();
 if (toTransfers) {
     context.toTransfers = toTransfers;
 }
@@ -58,7 +57,7 @@ if (completeRequested) {
                  EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, "IXF_REQUESTED")];
 }
 ecl = EntityCondition.makeCondition(exprsFrom, EntityOperator.AND);
-fromTransfers = delegator.findList("InventoryTransfer", ecl, null, 
['sendDate'], null, false);
+fromTransfers = 
from("InventoryTransfer").where(exprsFrom).orderBy("sendDate").queryList();
 if (fromTransfers) {
     context.fromTransfers = fromTransfers;
 }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindInventoryItemsByLabels.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindInventoryItemsByLabels.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindInventoryItemsByLabels.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FindInventoryItemsByLabels.groovy
 Fri Dec 26 06:54:50 2014
@@ -62,10 +62,8 @@ if (andCondition.size() > 1) {
         lowIndex = ((viewIndex * viewSize) + 1);
         highIndex = (viewIndex - 1) * viewSize;
 
-        findOpts = new EntityFindOptions(true, 
EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, 
true);
-        findOpts.setMaxRows(highIndex);
         beganTransaction = TransactionUtil.begin();
-        inventoryItemsEli = 
delegator.findListIteratorByCondition(inventoryItemAndLabelsView, 
EntityCondition.makeCondition(andCondition, EntityOperator.AND), null, null, 
null, findOpts);
+        inventoryItemsEli = 
from(inventoryItemAndLabelsView).where(andCondition).cursorScrollInsensitive().distinct().maxRows(highIndex).queryIterator();
 
         inventoryItemsSize = 
inventoryItemsEli.getResultsSizeAfterPartialList();
         context.inventoryItemsSize = inventoryItemsSize;

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewContactMechs.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewContactMechs.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewContactMechs.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewContactMechs.groovy
 Fri Dec 26 06:54:50 2014
@@ -23,7 +23,7 @@ import org.ofbiz.party.contact.*
 context.nowStr = UtilDateTime.nowTimestamp();
 
 facilityId = parameters.facilityId;
-facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+facility = from("Facility").where("facilityId", facilityId).queryOne();
 facilityType = null;
 if (!facility) {
   context.facility = delegator.makeValue("Facility", null);

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
 Fri Dec 26 06:54:50 2014
@@ -92,7 +92,6 @@ if (action) {
     }
 
     // set distinct on so we only get one row per product
-    findOpts = new EntityFindOptions(true, 
EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, 
true);
     searchCondition = EntityCondition.makeCondition(conditionMap, 
EntityOperator.AND);
     notVirtualCondition = 
EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual", 
EntityOperator.EQUALS, null),
                                                          EntityOperator.OR,
@@ -128,7 +127,7 @@ if (action) {
     List prods = null;
     try {
         beganTransaction = TransactionUtil.begin();
-        prodsEli = delegator.findListIteratorByCondition(prodView, 
whereCondition, null, null, ['productId'], findOpts);
+        prodsEli = 
from(prodView).where(whereCondition).orderBy("productId").cursorScrollInsensitive().distinct().queryIterator();
         prods = prodsEli.getCompleteList();
         prodsEli.close();
     } catch (GenericEntityException e) {

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy
 Fri Dec 26 06:54:50 2014
@@ -38,8 +38,7 @@ if (internalName) {
 }
 
 if (conditions.size() > 2) {
-    ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
-    physicalInventory = delegator.findList("ProductInventoryItem", ecl, null, 
['productId'], null, false);
+    physicalInventory = 
from("ProductInventoryItem").where(conditions).orderBy("productId").queryList();
 
     // also need the overal product QOH and ATP for each product
     atpMap = [:];

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryAverageCosts.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryAverageCosts.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryAverageCosts.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryAverageCosts.groovy
 Fri Dec 26 06:54:50 2014
@@ -28,12 +28,12 @@ import org.ofbiz.entity.util.EntityUtil;
 facilityId = context.get("facilityId");
 
 EntityCondition whereConditions = EntityCondition.makeCondition("facilityId", 
EntityOperator.EQUALS, facilityId);
-inventoryItems = delegator.findList("InventoryItem", whereConditions, 
UtilMisc.toSet("productId"), UtilMisc.toList("productId"), null, false);
+inventoryItems = select("productId").from("InventoryItem").where("facilityId", 
facilityId).orderBy("productId").queryList();
 inventoryItemProducts = EntityUtil.getFieldListFromEntityList(inventoryItems, 
"productId", true);
 
 inventoryAverageCosts = FastList.newInstance();
 inventoryItemProducts.each { productId ->
-    productFacility = delegator.findOne("ProductFacility", 
UtilMisc.toMap("productId", productId, "facilityId", facilityId), false);
+    productFacility = from("ProductFacility").where("productId", productId, 
"facilityId", facilityId).queryOne();
     if (UtilValidate.isNotEmpty(productFacility)) {
         result = runService('calculateProductAverageCost', 
UtilMisc.toMap("productId": productId, "facilityId": facilityId, "userLogin": 
userLogin));
         totalQuantityOnHand = result.get("totalQuantityOnHand");

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
 Fri Dec 26 06:54:50 2014
@@ -37,11 +37,11 @@ if (action) {
     conditionList = EntityCondition.makeCondition(conditions, 
EntityOperator.OR);
     try {
         beganTransaction = TransactionUtil.begin();
-        invItemListItr = delegator.find("InventoryItem", conditionList, null, 
null, ['productId'], null);
+        invItemListItr = 
from("InventoryItem").where(conditionList).orderBy("productId").queryIterator();
         while ((inventoryItem = invItemListItr.next()) != null) {
             productId = inventoryItem.productId;
-            product = delegator.findOne("Product", [productId : productId], 
false);
-            productFacility = delegator.findOne("ProductFacility", [productId 
: productId, facilityId : facilityId], false);
+            product = from("Product").where("productId", productId).queryOne();
+            productFacility = from("ProductFacility").where("productId", 
productId, "facilityId", facilityId).queryOne();
             if (productFacility) {
                 quantityOnHandTotal = 
inventoryItem.getDouble("quantityOnHandTotal");
                 availableToPromiseTotal = 
inventoryItem.getDouble("availableToPromiseTotal");

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/LookupInventoryItems.groovy
 Fri Dec 26 06:54:50 2014
@@ -22,16 +22,16 @@ partyId = parameters.partyId;
 productId = parameters.productId;
 
 if (orderId && productId) {
-    shipmentReceiptAndItems = delegator.findByAnd("ShipmentReceiptAndItem", 
[orderId : orderId, productId : productId], null, false);
+    shipmentReceiptAndItems = from("ShipmentReceiptAndItem").where("orderId", 
orderId, "productId", productId).queryList();
     context.inventoryItemsForPo = shipmentReceiptAndItems;
     context.orderId = orderId;
 }
 
 if (partyId && productId) {
-    orderRoles = delegator.findByAnd("OrderRole", [partyId : partyId, 
roleTypeId : "BILL_FROM_VENDOR"], null, false);
+    orderRoles = from("OrderRole").where("partyId", partyId, "roleTypeId", 
"BILL_FROM_VENDOR").queryList();
     inventoryItemsForSupplier = [];
     orderRoles.each { orderRole ->
-        shipmentReceiptAndItems = 
delegator.findByAnd("ShipmentReceiptAndItem", [productId : productId, orderId : 
orderRole.orderId], null, false);
+        shipmentReceiptAndItems = 
from("ShipmentReceiptAndItem").where("productId", productId, "orderId", 
orderRole.orderId).queryList();
         inventoryItemsForSupplier.addAll(shipmentReceiptAndItems);
     }
     context.inventoryItemsForSupplier = inventoryItemsForSupplier;
@@ -39,9 +39,9 @@ if (partyId && productId) {
 }
 
 if (productId) {
-    inventoryItems = delegator.findByAnd("InventoryItem", [productId : 
productId], null, false);
+    inventoryItems = from("InventoryItem").where("productId", 
productId).queryList();
     context.inventoryItemsForProduct = inventoryItems;
     context.productId = productId;
-    product = delegator.findOne("Product", [productId : productId], false);
+    product = from("Product").where("productId", productId).queryOne();
     context.internalName = product.internalName;
 }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy
 Fri Dec 26 06:54:50 2014
@@ -21,7 +21,7 @@ import org.ofbiz.entity.condition.Entity
 
 // get physicalInventoryAndVarianceDatas if this is a NON_SERIAL_INV_ITEM
 if (inventoryItem && 
"NON_SERIAL_INV_ITEM".equals(inventoryItem.inventoryItemTypeId)) {
-    physicalInventoryAndVariances = 
delegator.findList("PhysicalInventoryAndVariance", 
EntityCondition.makeCondition([inventoryItemId : inventoryItemId]), null, 
['-physicalInventoryDate', '-physicalInventoryId'], null, false);
+    physicalInventoryAndVariances = 
from("PhysicalInventoryAndVariance").where("inventoryItemId", 
inventoryItemId).orderBy("-physicalInventoryDate", 
"-physicalInventoryId").queryList();
     physicalInventoryAndVarianceDatas = new 
ArrayList(physicalInventoryAndVariances.size());
     physicalInventoryAndVariances.each { physicalInventoryAndVariance ->
         physicalInventoryAndVarianceData = [:];

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy
 Fri Dec 26 06:54:50 2014
@@ -34,7 +34,7 @@ if (partialReceive) {
 
 facility = null;
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
 }
 
 ownerAcctgPref = null;
@@ -50,7 +50,7 @@ if (facility) {
 
 purchaseOrder = null;
 if (purchaseOrderId) {
-    purchaseOrder = delegator.findOne("OrderHeader", [orderId : 
purchaseOrderId], false);
+    purchaseOrder = from("OrderHeader").where("orderId", 
purchaseOrderId).queryOne();
     if (purchaseOrder && !"PURCHASE_ORDER".equals(purchaseOrder.orderTypeId)) {
         purchaseOrder = null;
     }
@@ -58,13 +58,13 @@ if (purchaseOrderId) {
 
 product = null;
 if (productId) {
-    product = delegator.findOne("Product", [productId : productId], false);
-    context.supplierPartyIds = 
EntityUtil.getFieldListFromEntityList(EntityUtil.filterByDate(delegator.findList("SupplierProduct",
 EntityCondition.makeCondition([productId : productId]), null, ["partyId"], 
null, false), nowTimestamp, "availableFromDate", "availableThruDate", true), 
"partyId", true);
+    product = from("Product").where("productId", productId).queryOne();
+    context.supplierPartyIds = 
EntityUtil.getFieldListFromEntityList(from("SupplierProduct").where("productId",
 productId).orderBy("partyId").filterByDate(nowTimestamp, "availableFromDate", 
"availableThruDate").queryList(), "partyId", true);
 }
 
 shipments = null;
 if (purchaseOrder && !shipmentId) {
-    orderShipments = delegator.findList("OrderShipment", 
EntityCondition.makeCondition([orderId : purchaseOrderId]), null, null, null, 
false);
+    orderShipments = from("OrderShipment").where("orderId", 
purchaseOrderId).queryList();
     if (orderShipments) {
         shipments = [] as TreeSet;
         orderShipments.each { orderShipment ->
@@ -77,7 +77,7 @@ if (purchaseOrder && !shipmentId) {
         }
     }
     // This is here for backward compatibility: ItemIssuances are no more 
created for purchase shipments.
-    issuances = delegator.findList("ItemIssuance", 
EntityCondition.makeCondition([orderId : purchaseOrderId]), null, null, null, 
false);
+    issuances = from("ItemIssuance").where("orderId", 
purchaseOrderId).queryList();
     if (issuances) {
         shipments = [] as TreeSet;
         issuances.each { issuance ->
@@ -93,7 +93,7 @@ if (purchaseOrder && !shipmentId) {
 
 shipment = null;
 if (shipmentId && !shipmentId.equals("_NA_")) {
-    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 }
 
 shippedQuantities = [:];
@@ -188,10 +188,7 @@ if (purchaseOrderItems) {
         }
         receivedQuantities.put(thisItem.orderItemSeqId, new 
Double(totalReceived));
         //----------------------
-        salesOrderItemAssocs = delegator.findList("OrderItemAssoc", 
EntityCondition.makeCondition([orderItemAssocTypeId : 'PURCHASE_ORDER',
-                                                                     toOrderId 
: thisItem.orderId,
-                                                                     
toOrderItemSeqId : thisItem.orderItemSeqId]),
-                                                                     null, 
null, null, false);
+        salesOrderItemAssocs = 
from("OrderItemAssoc").where(orderItemAssocTypeId : 'PURCHASE_ORDER', toOrderId 
: thisItem.orderId, toOrderItemSeqId : thisItem.orderItemSeqId).queryList();
         if (salesOrderItemAssocs) {
             salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs);
             salesOrderItems.put(thisItem.orderItemSeqId, salesOrderItem);
@@ -201,7 +198,7 @@ if (purchaseOrderItems) {
 
 receivedItems = null;
 if (purchaseOrder) {
-    receivedItems = delegator.findList("ShipmentReceiptAndItem", 
EntityCondition.makeCondition([orderId : purchaseOrderId, facilityId : 
facilityId]), null, null, null, false);
+    receivedItems = from("ShipmentReceiptAndItem").where("orderId", 
purchaseOrderId, "facilityId", facilityId).queryList();
     context.receivedItems = receivedItems;
 }
 
@@ -212,13 +209,13 @@ if (productId && !product) {
 }
 
 // reject reasons
-rejectReasons = delegator.findList("RejectionReason", null, null, null, null, 
false);
+rejectReasons = from("RejectionReason").queryList();
 
 // inv item types
-inventoryItemTypes = delegator.findList("InventoryItemType", null, null, null, 
null, false);
+inventoryItemTypes = from("InventoryItemType").queryList();
 
 // facilities
-facilities = delegator.findList("Facility", null, null, null, null, false);
+facilities = from("Facility").queryList();
 
 // default per unit cost for both shipment or individual product
 standardCosts = [:];

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy
 Fri Dec 26 06:54:50 2014
@@ -29,7 +29,7 @@ inventoryItemId = request.getParameter("
 inventoryTransfer = null;
 
 if (inventoryTransferId) {
-    inventoryTransfer = delegator.findOne("InventoryTransfer", 
[inventoryTransferId : inventoryTransferId], false);
+    inventoryTransfer = from("InventoryTransfer").where("inventoryTransferId", 
inventoryTransferId).queryOne();
     if (inventoryTransfer) {
         context.inventoryTransfer = inventoryTransfer;
         if (!facilityId) {
@@ -42,18 +42,18 @@ if (inventoryTransferId) {
     }
 }
 
-facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+facility = from("Facility").where("facilityId", facilityId).queryOne();
 context.facilityId = facilityId;
 context.facility = facility;
 context.inventoryItemId = inventoryItemId;
 
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
 }
 
 String illegalInventoryItem = null;
 if (inventoryItemId) {
-    inventoryItem = delegator.findOne("InventoryItem", [inventoryItemId : 
inventoryItemId], false);
+    inventoryItem = from("InventoryItem").where("inventoryItemId", 
inventoryItemId).queryOne();
     if (facilityId && inventoryItem && inventoryItem.facilityId && 
!inventoryItem.facilityId.equals(facilityId)) {
         illegalInventoryItem = "Inventory item not found for this facility.";
         inventoryItem = null;
@@ -75,15 +75,15 @@ if (inventoryItemId) {
 }
 
 // facilities
-context.facilities = delegator.findList("Facility", null, null, null, null, 
false);
+context.facilities = from("Facility").queryList();
 
 // status items
 if (inventoryTransfer && inventoryTransfer.statusId) {
-    statusChange = delegator.findList("StatusValidChange", 
EntityCondition.makeCondition([statusId : inventoryTransfer.statusId]), null, 
null, null, false);
+    statusChange = from("StatusValidChange").where("statusId", 
inventoryTransfer.statusId).queryList();
     if (statusChange) {
         statusItems = [] as ArrayList;
         statusChange.each { curStatusChange ->
-            curStatusItem = delegator.findOne("StatusItem", [statusId : 
curStatusChange.statusIdTo], false);
+            curStatusItem = from("StatusItem").where("statusId", 
curStatusChange.statusIdTo).queryOne();
             if (curStatusItem) {
                 statusItems.add(curStatusItem);
             }
@@ -92,7 +92,7 @@ if (inventoryTransfer && inventoryTransf
         context.statusItems = statusItems;
     }
 } else {
-    statusItems = delegator.findList("StatusItem", 
EntityCondition.makeCondition([statusTypeId : 'INVENTORY_XFER_STTS']), null, 
['sequenceId'], null, false);
+    statusItems = from("StatusItem").where("statusTypeId", 
"INVENTORY_XFER_STTS").orderBy("sequenceId").queryList();
     if (statusItems) {
         context.statusItems = statusItems;
     }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy
 Fri Dec 26 06:54:50 2014
@@ -27,13 +27,13 @@ returnId = request.getParameter("returnI
 
 facility = null;
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
 }
 
 returnHeader = null;
 returnItems = null;
 if (returnId) {
-    returnHeader = delegator.findOne("ReturnHeader", [returnId : returnId], 
false);
+    returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne();
     if (returnHeader) {
         if ("RETURN_ACCEPTED".equals(returnHeader.statusId)) {
             returnItems = returnHeader.getRelated("ReturnItem", null, null, 
false);
@@ -71,14 +71,14 @@ if (returnItems) {
 }
 
 if (returnHeader) {
-    context.receivedItems = delegator.findList("ShipmentReceipt", 
EntityCondition.makeCondition("returnId", returnId), null, null, null, false);
+    context.receivedItems = from("ShipmentReceipt").where("returnId", 
returnId).queryList();
 }
 
 // facilities
-facilities = delegator.findList("Facility", null, null, null, null, false);
+facilities = from("Facility").queryList();
 
 //all possible inventory item types
-inventoryItemTypes = delegator.findList("InventoryItemType", null, null, 
['description'], null, true);
+inventoryItemTypes = 
from("InventoryItemType").orderBy("description").cache(true).queryList();
 
 context.facilityId = facilityId;
 context.facility = facility;

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromInventory.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromInventory.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromInventory.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromInventory.groovy
 Fri Dec 26 06:54:50 2014
@@ -23,7 +23,7 @@ import org.ofbiz.entity.condition.Entity
 
 shipmentId = parameters.shipmentId;
 items = [];
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 partyId = shipment.partyIdTo;
 shipmentItems = shipment.getRelated("ShipmentItem", null, null, false);
 shipmentItems.each { shipmentItem ->
@@ -31,7 +31,7 @@ shipmentItems.each { shipmentItem ->
     internalName = shipmentItem.getRelated("Product", null, null, 
false).internalName;
     EntityCondition cond = 
EntityCondition.makeCondition([EntityCondition.makeCondition("returnId", 
shipment.primaryReturnId),
                                    EntityCondition.makeCondition("productId", 
productId)], EntityOperator.AND);
-    returnItem = EntityUtil.getFirst(delegator.findList("ReturnItem", cond, 
null, null, null, true));
+    returnItem = from("ReturnItem").where("returnId", 
shipment.primaryReturnId, "productId", productId).cache(true).queryFirst();
     returnQuantity = Double.valueOf(returnItem.returnQuantity);
 
     shipmentItemQty = Double.valueOf(shipmentItem.quantity);

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.groovy
 Fri Dec 26 06:54:50 2014
@@ -26,7 +26,7 @@ orderId = request.getParameter("orderId"
 shipGroupSeqId = request.getParameter("shipGroupSeqId");
 selectFromShipmentPlan = request.getParameter("selectFromShipmentPlan");
 
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 
 if (shipment) {
     context.originFacility = shipment.getRelatedOne("OriginFacility", false);
@@ -41,7 +41,7 @@ if (!shipGroupSeqId && shipment) {
 }
 
 if (orderId && shipment) {
-    orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
     context.orderHeader = orderHeader;
 
     if (orderHeader) {
@@ -53,7 +53,7 @@ if (orderId && shipment) {
 
         orderItemShipGroup = null;
         if (shipGroupSeqId) {
-            orderItemShipGroup = delegator.findOne("OrderItemShipGroup", 
[orderId : orderId, shipGroupSeqId : shipGroupSeqId], false);
+            orderItemShipGroup = from("OrderItemShipGroup").where("orderId", 
orderId, "shipGroupSeqId", shipGroupSeqId).queryOne();
             context.orderItemShipGroup = orderItemShipGroup;
         }
 
@@ -114,7 +114,7 @@ if (orderId && shipment) {
     }
 }
 if (shipment && selectFromShipmentPlan) {
-    shipmentPlans = delegator.findList("OrderShipment", 
EntityCondition.makeCondition([shipmentId : shipment.shipmentId]), null, 
['orderId', 'orderItemSeqId'], null, false);
+    shipmentPlans = from("OrderShipment").where("shipmentId", 
shipment.shipmentId).orderBy("orderId", "orderItemSeqId").queryList();
     orderItemDatas = [] as LinkedList;
 
     context.isSalesOrder = true;
@@ -124,7 +124,7 @@ if (shipment && selectFromShipmentPlan)
 
         orderItemShipGroup = null;
         if (shipGroupSeqId) {
-            orderItemShipGroup = delegator.findOne("OrderItemShipGroup", 
[orderId : orderItem.orderId, shipGroupSeqId : shipGroupSeqId], false);
+            orderItemShipGroup = from("OrderItemShipGroup").where("orderId", 
orderItem.orderId, "shipGroupSeqId", shipGroupSeqId).queryOne();
             context.orderItemShipGroup = orderItemShipGroup;
         }
 

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy
 Fri Dec 26 06:54:50 2014
@@ -21,7 +21,7 @@ import org.ofbiz.entity.condition.*
 import org.ofbiz.widget.html.HtmlFormWrapper
 
 shipmentId = parameters.shipmentId;
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 
 // orderHeader is needed here to determine type of order and hence types of 
shipment status
 if (!shipment) {
@@ -29,7 +29,7 @@ if (!shipment) {
 } else {
     primaryOrderId = shipment.primaryOrderId;
 }
-orderHeader = delegator.findOne("OrderHeader", [orderId : primaryOrderId], 
false);
+orderHeader = from("OrderHeader").where(orderId : primaryOrderId).queryOne();
 
 // the kind of StatusItem to use is based on the type of order
 statusItemTypeId = "SHIPMENT_STATUS";

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy
 Fri Dec 26 06:54:50 2014
@@ -27,7 +27,7 @@ if (!shipmentId) {
 
 shipment = null;
 if (shipmentId) {
-    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 }
 
 if (shipment) {

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.groovy
 Fri Dec 26 06:54:50 2014
@@ -26,7 +26,7 @@ if (!shipmentId) {
 
 shipment = null;
 if (shipmentId) {
-    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 }
 
 if (shipment) {
@@ -45,8 +45,8 @@ if (shipment) {
 
     shipmentItems = shipment.getRelated("ShipmentItem", null, 
['shipmentItemSeqId'], false);
     shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, 
['shipmentRouteSegmentId'], false);
-    weightUoms = delegator.findList("Uom", 
EntityCondition.makeCondition([uomTypeId : 'WEIGHT_MEASURE']), null, 
['description'], null, false);
-    boxTypes = delegator.findList("ShipmentBoxType", null, null, null, null, 
false);
+    weightUoms = from("Uom").where("uomTypeId", 
"WEIGHT_MEASURE").orderBy("description").queryList();
+    boxTypes = from("ShipmentBoxType").queryList();
 
     context.shipment = shipment;
     context.shipmentPackageDatas = shipmentPackageDatas;

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.groovy
 Fri Dec 26 06:54:50 2014
@@ -31,7 +31,7 @@ action = request.getParameter("action");
 
 shipment = null;
 if (shipmentId) {
-    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 }
 
 
@@ -44,9 +44,9 @@ orderItemShipGroupAssocs = null;
 // **************************************
 if (action && orderId) {
     if (shipGroupSeqId) {
-        orderItemShipGroupAssocs = 
delegator.findList("OrderItemShipGroupAssoc", 
EntityCondition.makeCondition([orderId : orderId, shipGroupSeqId : 
shipGroupSeqId]), null, null, null, false);
+        orderItemShipGroupAssocs = 
from("OrderItemShipGroupAssoc").where("orderId", orderId, "shipGroupSeqId", 
shipGroupSeqId).queryList();
     } else {
-        orderItemShipGroupAssocs = 
delegator.findList("OrderItemShipGroupAssoc", 
EntityCondition.makeCondition([orderId : orderId]), null, null, null, false);
+        orderItemShipGroupAssocs = 
from("OrderItemShipGroupAssoc").where("orderId", orderId).queryList();
     }
 }
 
@@ -59,7 +59,7 @@ shipmentPlans = null;
 shipmentPlansIt = null;
 rows = [] as ArrayList;
 if (shipment) {
-    shipmentPlans = delegator.findList("OrderShipment", 
EntityCondition.makeCondition([shipmentId : shipment.shipmentId]), null, null, 
null, false);
+    shipmentPlans = from("OrderShipment").where("shipmentId", 
shipment.shipmentId).queryList();
 }
 if (shipmentPlans) {
     shipmentPlans.each { shipmentPlan ->
@@ -104,7 +104,7 @@ if (shipmentPlans) {
         // Total quantity planned not issued
         plannedQuantity = 0.0;
         qtyPlannedInShipment = [:];
-        plans = delegator.findList("OrderShipment", 
EntityCondition.makeCondition([orderId : orderItem.orderId, orderItemSeqId : 
orderItem.orderItemSeqId]), null, null, null, false);
+        plans = from("OrderShipment").where("orderId", orderItem.orderId, 
"orderItemSeqId", orderItem.orderItemSeqId).queryList();
         plans.each { plan ->
             if (plan.quantity) {
                 netPlanQty = plan.getDouble("quantity");
@@ -158,7 +158,7 @@ if (shipmentPlans) {
         }
         oneRow.weight = weight;
         if (product.weightUomId) {
-            weightUom = delegator.findOne("Uom", [uomId : 
product.weightUomId], false);
+            weightUom = from("Uom").where("uomId", 
product.weightUomId).queryOne();
             oneRow.weightUom = weightUom.abbreviation;
         }
         volume = 0.0;
@@ -173,9 +173,9 @@ if (shipmentPlans) {
         }
         oneRow.volume = volume;
         if (product.heightUomId && product.widthUomId && product.depthUomId) {
-            heightUom = delegator.findOne("Uom",[uomId : product.heightUomId], 
true);
-            widthUom = delegator.findOne("Uom", [uomId : product.widthUomId], 
true);
-            depthUom = delegator.findOne("Uom", [uomId : product.depthUomId], 
true);
+            heightUom = from("Uom").where("uomId", 
product.heightUomId).cache(true).queryOne();
+            widthUom = from("Uom").where("uomId", 
product.widthUomId).cache(true).queryOne();
+            depthUom = from("Uom").where("uomId", 
product.depthUomId).cache(true).queryOne();
             oneRow.volumeUom = heightUom.abbreviation + "x" + 
widthUom.abbreviation + "x" + depthUom.abbreviation;
         }
         totWeight += weight;
@@ -235,7 +235,7 @@ if (orderItemShipGroupAssocs) {
         } else {
             orderShipmentCondition = EntityCondition.makeCondition([orderId : 
orderItemShipGroupAssoc.orderId, orderItemSeqId : 
orderItemShipGroupAssoc.orderItemSeqId]);
         }
-        plans = delegator.findList("OrderShipment", orderShipmentCondition, 
null, null, null, false);
+        plans = 
from("OrderShipment").where(orderShipmentCondition).queryList();
         plans.each { plan ->
             if (plan.quantity) {
                 netPlanQty = plan.getDouble("quantity");
@@ -257,7 +257,7 @@ if (orderItemShipGroupAssocs) {
         oneRow.weight = weight;
 
         if (product.weightUomId) {
-            weightUom = delegator.findOne("Uom", [uomId : 
product.weightUomId], true);
+            weightUom = from("Uom").where("uomId", 
product.weightUomId).cache(true).queryOne();
             oneRow.weightUom = weightUom.abbreviation;
         }
         volume = 0.0;
@@ -270,9 +270,9 @@ if (orderItemShipGroupAssocs) {
 
         oneRow.volume = volume;
         if (product.heightUomId && product.widthUomId && product.depthUomId) {
-            heightUom = delegator.findOne("Uom", [uomId : 
product.heightUomId], true);
-            widthUom = delegator.findOne("Uom", [uomId : product.widthUomId], 
true);
-            depthUom = delegator.findOne("Uom", [uomId : product.depthUomId], 
true);
+            heightUom = from("Uom").where("uomId", 
product.heightUomId).cache(true).queryOne();
+            widthUom = from("Uom").where("uomId", 
product.widthUomId).cache(true).queryOne();
+            depthUom = from("Uom").where("uomId", 
product.depthUomId).cache(true).queryOne();
             oneRow.volumeUom = heightUom.abbreviation + "x" + 
widthUom.abbreviation + "x" + depthUom.abbreviation;
         }
         addRows.add(oneRow);

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy
 Fri Dec 26 06:54:50 2014
@@ -27,7 +27,7 @@ if (!shipmentId) {
 
 shipment = null;
 if (shipmentId) {
-    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 }
 
 if (shipment) {
@@ -51,21 +51,21 @@ if (shipment) {
             shipmentRouteSegmentData.currencyUom = 
shipmentRouteSegment.getRelatedOne("CurrencyUom", false);
             shipmentRouteSegmentData.billingWeightUom = 
shipmentRouteSegment.getRelatedOne("BillingWeightUom", false);
             if (shipmentRouteSegment.carrierServiceStatusId) {
-                
shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = 
delegator.findList("StatusValidChangeToDetail", 
EntityCondition.makeCondition([statusId : 
shipmentRouteSegment.carrierServiceStatusId]), null, ['sequenceId'], null, 
false);
+                
shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = 
from("StatusValidChangeToDetail").where("statusId", 
shipmentRouteSegment.carrierServiceStatusId).orderBy("sequenceId").queryList();
             } else {
-                
shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = 
delegator.findList("StatusValidChangeToDetail", 
EntityCondition.makeCondition([statusId : 'SHRSCS_NOT_STARTED']), null, 
['sequenceId'], null, false);
+                
shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = 
from("StatusValidChangeToDetail").where("statusId", 
"SHRSCS_NOT_STARTED").orderBy("sequenceId").queryList();
             }
             shipmentRouteSegmentDatas.add(shipmentRouteSegmentData);
         }
     }
 
     shipmentPackages = shipment.getRelated("ShipmentPackage", null, 
['shipmentPackageSeqId'], false);
-    facilities = delegator.findList("Facility", null, null, ['facilityName'], 
null, false);
-    shipmentMethodTypes = delegator.findList("ShipmentMethodType", null, null, 
['description'], null, false);
-    weightUoms = delegator.findList("Uom", 
EntityCondition.makeCondition([uomTypeId : 'WEIGHT_MEASURE']), null, null, 
null, false);
-    currencyUoms = delegator.findList("Uom", 
EntityCondition.makeCondition([uomTypeId : 'CURRENCY_MEASURE']), null, null, 
null, false);
+    facilities = from("Facility").orderBy("facilityName").queryList();
+    shipmentMethodTypes = 
from("ShipmentMethodType").orderBy("description").queryList();
+    weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").queryList();
+    currencyUoms = from("Uom").where("uomTypeId", 
"CURRENCY_MEASURE").queryList();
 
-    carrierPartyRoles = delegator.findList("PartyRole", 
EntityCondition.makeCondition([roleTypeId : 'CARRIER']), null, null, null, 
false);
+    carrierPartyRoles = from("PartyRole").where("roleTypeId", 
"CARRIER").queryList();
     carrierPartyDatas = [] as LinkedList;
     carrierPartyRoles.each { carrierPartyRole ->
         party = carrierPartyRole.getRelatedOne("Party", false);

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy
 Fri Dec 26 06:54:50 2014
@@ -59,21 +59,21 @@ if (shipmentTypeId) {
     paramListBuffer.append("&shipmentTypeId=");
     paramListBuffer.append(shipmentTypeId);
     findShipmentExprs.add(EntityCondition.makeCondition("shipmentTypeId", 
EntityOperator.EQUALS, shipmentTypeId));
-    currentShipmentType = delegator.findOne("ShipmentType", [shipmentTypeId : 
shipmentTypeId], true);
+    currentShipmentType = from("ShipmentType").where("shipmentTypeId", 
shipmentTypeId).cache(true).queryOne();
     context.currentShipmentType = currentShipmentType;
 }
 if (originFacilityId) {
     paramListBuffer.append("&originFacilityId=");
     paramListBuffer.append(originFacilityId);
     findShipmentExprs.add(EntityCondition.makeCondition("originFacilityId", 
EntityOperator.EQUALS, originFacilityId));
-    currentOriginFacility = delegator.findOne("Facility", [facilityId : 
originFacilityId], true);
+    currentOriginFacility = from("Facility").where("facilityId", 
originFacilityId).cache(true).queryOne();
     context.currentOriginFacility = currentOriginFacility;
 }
 if (destinationFacilityId) {
     paramListBuffer.append("&destinationFacilityId=");
     paramListBuffer.append(destinationFacilityId);
     
findShipmentExprs.add(EntityCondition.makeCondition("destinationFacilityId", 
EntityOperator.EQUALS, destinationFacilityId));
-    currentDestinationFacility = delegator.findOne("Facility", [facilityId : 
destinationFacilityId], true);
+    currentDestinationFacility = from("Facility").where("facilityId", 
destinationFacilityId).cache(true).queryOne();
     context.currentDestinationFacility = currentDestinationFacility;
 }
 if (statusId) {
@@ -82,7 +82,7 @@ if (statusId) {
     if (!orderReturnValue) {
         findShipmentExprs.add(EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, statusId));
     }
-    currentStatus = delegator.findOne("StatusItem", [statusId : statusId], 
true);
+    currentStatus = from("StatusItem").where("statusId", 
statusId).cache(true).queryOne();
     context.currentStatus = currentStatus;
 }
 if (minDate && minDate.length() > 8) {
@@ -117,12 +117,10 @@ if (maxDate && maxDate.length() > 8) {
 if ("Y".equals(lookupFlag)) {
     context.paramList = paramListBuffer.toString();
 
-    findOpts = new EntityFindOptions(true, 
EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, 
true);
     mainCond = null;
     if (findShipmentExprs.size() > 0) {
         mainCond = EntityCondition.makeCondition(findShipmentExprs, 
EntityOperator.AND);
     }
-    orderBy = ['-estimatedShipDate'];
 
     beganTransaction = false;
     try {
@@ -131,11 +129,10 @@ if ("Y".equals(lookupFlag)) {
         // get the indexes for the partial list
         lowIndex = viewIndex * viewSize + 1;
         highIndex = (viewIndex + 1) * viewSize;
-        findOpts.setMaxRows(highIndex);
         
         if (!orderReturnValue) {
             // using list iterator
-            orli = delegator.find("Shipment", mainCond, null, null, orderBy, 
findOpts);
+            orli = 
from("Shipment").where(mainCond).orderBy("-estimatedShipDate").cursorScrollInsensitive().distinct().maxRows(highIndex).queryIterator();
     
             shipmentListSize = orli.getResultsSizeAfterPartialList();
             if (highIndex > shipmentListSize) {
@@ -172,7 +169,7 @@ if ("Y".equals(lookupFlag)) {
             OrderReturnViewEntity.addAlias("RH", "entryDate");
             OrderReturnViewEntity.addAlias("RH", "returnStatusId", "statusId", 
null, null, null, null);
             
-            orderReturnIt = 
delegator.findListIteratorByCondition(OrderReturnViewEntity, returnCond, null, 
null, null, null);
+            orderReturnIt = 
from(OrderReturnViewEntity).where(returnCond).queryList();
             shipmentListSize = orderReturnIt.getResultsSizeAfterPartialList();
             
             if (highIndex > shipmentListSize) {
@@ -211,16 +208,16 @@ if ("Y".equals(lookupFlag)) {
 
 // =============== Prepare the Option Data for the Find Form =================
 
-context.shipmentTypes = delegator.findList("ShipmentType", null, null, 
['description'], null, false);
+context.shipmentTypes = 
from("ShipmentType").orderBy("description").queryList();
 
-context.facilities = delegator.findList("Facility", null, null, 
['facilityName'], null, false);
+context.facilities = from("Facility").orderBy("facilityName").queryList();
 
 // since purchase and sales shipments have different status codes, we'll need 
to make two separate lists
-context.shipmentStatuses = delegator.findList("StatusItem", 
EntityCondition.makeCondition([statusTypeId : 'SHIPMENT_STATUS']), null, 
['sequenceId'], null, false);
-context.purchaseShipmentStatuses = delegator.findList("StatusItem", 
EntityCondition.makeCondition([statusTypeId : 'PURCH_SHIP_STATUS']), null, 
['sequenceId'], null, false);
+context.shipmentStatuses = from("StatusItem").where("statusTypeId", 
"SHIPMENT_STATUS").orderBy("sequenceId").queryList();
+context.purchaseShipmentStatuses = from("StatusItem").where("statusTypeId", 
"PURCH_SHIP_STATUS").orderBy("sequenceId").queryList();
 
 /// Get return status lists
-context.returnStatuses = delegator.findList("StatusItem", 
EntityCondition.makeCondition([statusTypeId : 'ORDER_RETURN_STTS']), null, 
['sequenceId'], null, false);
+context.returnStatuses = from("StatusItem").where("statusTypeId", 
"ORDER_RETURN_STTS").orderBy("sequenceId").queryList();
 
 // create the fromDate for calendar
 fromCal = Calendar.getInstance();

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy
 Fri Dec 26 06:54:50 2014
@@ -26,7 +26,7 @@ import org.ofbiz.entity.condition.Entity
 
 facilityId = parameters.facilityId;
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
     context.facilityId = facilityId;
     context.facility = facility;
 }
@@ -44,9 +44,9 @@ context.shipmentId = shipmentId;
 invoiceIds = null;
 if (shipmentId) {
     // Get the primaryOrderId from the shipment
-    shipment = delegator.findOne("Shipment",  [shipmentId : shipmentId], 
false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
     if (shipment && shipment.primaryOrderId) {
-        orderItemBillingList = delegator.findList("OrderItemBilling", 
EntityCondition.makeCondition([orderId : shipment.primaryOrderId]), null, 
['invoiceId'], null, false);
+        orderItemBillingList = from("OrderItemBilling").where("orderId", 
shipment.primaryOrderId).orderBy("invoiceId").queryList();
         invoiceIds = 
EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true);
         if (invoiceIds) {
             context.invoiceIds = invoiceIds;
@@ -95,7 +95,7 @@ if (!picklistBinId) {
     picklistBinId = packSession.getPicklistBinId();
 }
 if (picklistBinId) {
-    bin = delegator.findOne("PicklistBin", [picklistBinId : picklistBinId], 
false);
+    bin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne();
     if (bin) {
         orderId = bin.primaryOrderId;
         shipGroupSeqId = bin.primaryShipGroupSeqId;
@@ -115,7 +115,7 @@ packSession.setFacilityId(facilityId);
 if (invoiceIds) {
     orderId = null;
 }
-shipment = EntityUtil.getFirst(delegator.findByAnd("Shipment", [primaryOrderId 
: orderId, statusId : "SHIPMENT_PICKED"], null, false));
+shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", 
"SHIPMENT_PICKED").queryFirst();
 context.shipment = shipment;
 
 context.packingSession = packSession;
@@ -125,7 +125,7 @@ context.picklistBinId = picklistBinId;
 
 // grab the order information
 if (orderId) {
-    orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
     if (orderHeader) {
         OrderReadHelper orh = new OrderReadHelper(orderHeader);
         context.orderId = orderId;
@@ -134,7 +134,7 @@ if (orderId) {
         orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId);
         context.orderItemShipGroup = orderItemShipGroup;
         carrierPartyId = orderItemShipGroup.carrierPartyId;
-            carrierShipmentBoxTypes = 
delegator.findList("CarrierShipmentBoxType", 
EntityCondition.makeCondition([partyId : carrierPartyId]), null, null, null, 
false);
+            carrierShipmentBoxTypes = 
from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList();
             if (carrierShipmentBoxTypes) {
             context.carrierShipmentBoxTypes = carrierShipmentBoxTypes;
             }
@@ -146,7 +146,7 @@ if (orderId) {
                     // Generate the shipment cost estimate for the ship group
                     productStoreId = orh.getProductStoreId();
                     shippableItemInfo = 
orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
-                    shippableItems = 
delegator.findList("OrderItemAndShipGrpInvResAndItemSum", 
EntityCondition.makeCondition([orderId : orderId, shipGroupSeqId : 
shipGroupSeqId]), null, null, null, false);
+                    shippableItems = 
from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, 
"shipGroupSeqId", shipGroupSeqId).queryList();
                     shippableTotal = new 
Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
                     shippableWeight = new 
Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
                     shippableQuantity = new 
Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy
 Fri Dec 26 06:54:50 2014
@@ -48,15 +48,16 @@ shipmentItems.each { shipmentItem ->
 }
 
 // Add in the total of all previously shipped items
-previousShipmentIter = delegator.find("Shipment",
-        EntityCondition.makeCondition(
-            UtilMisc.toList(
-                EntityCondition.makeCondition("primaryOrderId", 
EntityOperator.EQUALS, shipment.getString("primaryOrderId")),
-                EntityCondition.makeCondition("shipmentTypeId", 
EntityOperator.EQUALS, "SALES_SHIPMENT"),
-                EntityCondition.makeCondition("createdDate", 
EntityOperator.LESS_THAN_EQUAL_TO,
-                        
ObjectType.simpleTypeConvert(shipment.getString("createdDate"), "Timestamp", 
null, null))
-            ),
-        EntityOperator.AND), null, null, null, null);
+previousShipmentIter = from("Shipment")
+                            .where(EntityCondition.makeCondition(
+                                            UtilMisc.toList(
+                                                
EntityCondition.makeCondition("primaryOrderId", EntityOperator.EQUALS, 
shipment.getString("primaryOrderId")),
+                                                
EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, 
"SALES_SHIPMENT"),
+                                                
EntityCondition.makeCondition("createdDate", EntityOperator.LESS_THAN_EQUAL_TO,
+                                                    
ObjectType.simpleTypeConvert(shipment.getString("createdDate"), "Timestamp", 
null, null))
+                                            ),
+                                        EntityOperator.AND))
+                            .queryIterator();
 
 while (previousShipmentItem = previousShipmentIter.next()) {
     if (!previousShipmentItem.shipmentId.equals(shipment.shipmentId)) {

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PrintPickSheets.groovy
 Fri Dec 26 06:54:50 2014
@@ -59,13 +59,13 @@ if (toPrintOrders) {
                     orderMap.orderId = orderId;
                     orderMap.orderDate = orderHeader.orderDate;
                     billingOrderContactMechs = [];
-                    billingOrderContactMechs = 
delegator.findByAnd("OrderContactMech", [orderId : orderId, 
contactMechPurposeTypeId : "BILLING_LOCATION"], null, false);
+                    billingOrderContactMechs = 
from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", 
"BILLING_LOCATION").queryList();
                     if (billingOrderContactMechs.size() > 0) {
                         billingContactMechId = 
EntityUtil.getFirst(billingOrderContactMechs).contactMechId;
-                        billingAddress = delegator.findOne("PostalAddress", 
[contactMechId : billingContactMechId], false);
+                        billingAddress = 
from("PostalAddress").where("contactMechId", billingContactMechId).queryOne();
                     }
-                    shippingContactMechId = 
EntityUtil.getFirst(delegator.findByAnd("OrderContactMech", [orderId : orderId, 
contactMechPurposeTypeId : "SHIPPING_LOCATION"], null, false)).contactMechId;
-                    shippingAddress = delegator.findOne("PostalAddress", 
[contactMechId : shippingContactMechId], false);
+                    shippingContactMechId = 
from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", 
"SHIPPING_LOCATION").queryFirst().contactMechId;
+                    shippingAddress = 
from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne();
                     orderItemShipGroups.each { orderItemShipGroup ->
                         if (orderItemShipGroup.orderId == orderId) {
                             orderMap.shipmentMethodType = 
EntityUtil.getFirst(orderItemShipGroup.getRelated("ShipmentMethodType", null, 
null, false)).description;

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy
 Fri Dec 26 06:54:50 2014
@@ -23,14 +23,14 @@ import org.ofbiz.entity.util.EntityUtilP
 
 facilityId = parameters.facilityId;
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
     context.facilityId = facilityId;
     context.facility = facility;
 }
 
 orderId = parameters.orderId
 if (orderId) {
-    orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
     if (orderHeader) {
         OrderReadHelper orh = new OrderReadHelper(orderHeader);
         context.orderId = orderId;
@@ -43,7 +43,7 @@ if (orderId) {
 
 shipmentId = parameters.shipmentId;
 if (shipmentId) {
-    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
     if (shipment) {
         // nuke event message - throws off the flow
         request.setAttribute("_EVENT_MESSAGE_", null);
@@ -65,10 +65,10 @@ if (shipmentId) {
         context.shipment = shipment;
         context.shipmentId = shipmentId;
 
-        weightUoms = delegator.findList("Uom", 
EntityCondition.makeCondition(['uomTypeId' : 'WEIGHT_MEASURE']), null, 
['description'], null, false);
+        weightUoms = from("Uom").where("uomTypeId", 
"WEIGHT_MEASURE").orderBy("description").queryList();
         defaultWeightUom = 
EntityUtilProperties.getPropertyValue("shipment.properties", 
"shipment.default.weight.uom", delegator);
         if (defaultWeightUom) {
-            defaultWeight = delegator.findOne("Uom", [uomId : 
defaultWeightUom], false);
+            defaultWeight = from("Uom").where("uomId", 
defaultWeightUom).queryOne();
             if (defaultWeight) {
                 weightUoms.add(0, defaultWeight);
             }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
 Fri Dec 26 06:54:50 2014
@@ -43,7 +43,7 @@ if (itemQuantitiesToReceive) {
     }
 }
 
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 context.shipment = shipment;
 if (!shipment) {
     return;
@@ -72,7 +72,7 @@ if (!orderId) {
     return;
 }
 
-orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
 context.orderHeader = orderHeader;
 if (!orderHeader) {
     return;
@@ -99,7 +99,7 @@ if (facility) {
     }
 }
 
-inventoryItemTypes = delegator.findList("InventoryItemType", null, null, null, 
null, false);
+inventoryItemTypes = from("InventoryItemType").queryList();
 context.inventoryItemTypes = inventoryItemTypes;
 
 // Populate the tracking map with shipment and order IDs
@@ -121,7 +121,7 @@ orderItems.each { orderItemAndShipGroupA
     product = orderItemAndShipGroupAssoc.getRelatedOne("Product", false);
 
     // Get the order item, since the orderItemAndShipGroupAssoc's quantity 
field is manipulated in some cases
-    orderItem = delegator.findOne("OrderItem", [orderId : orderId, 
orderItemSeqId : orderItemAndShipGroupAssoc.orderItemSeqId], false);
+    orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", 
orderItemAndShipGroupAssoc.orderItemSeqId).queryOne();
     orderItemData = [:];
 
     // Get the item's ordered quantity
@@ -137,7 +137,7 @@ orderItems.each { orderItemAndShipGroupA
 
     // Get the item quantity received from all shipments via the 
ShipmentReceipt entity
     totalReceived = 0.0;
-    receipts = delegator.findList("ShipmentReceipt", 
EntityCondition.makeCondition([orderId : orderId, orderItemSeqId : 
orderItem.orderItemSeqId]), null, null, null, false);
+    receipts = from("ShipmentReceipt").where("orderId", orderId, 
"orderItemSeqId", orderItem.orderItemSeqId).queryList();
     fulfilledReservations = [] as ArrayList;
     if (receipts) {
         receipts.each { rec ->
@@ -150,7 +150,7 @@ orderItems.each { orderItemAndShipGroupA
                 totalReceived += rejected.doubleValue();
             }
             // Get the reservations related to this receipt
-            oisgirs = delegator.findList("OrderItemShipGrpInvRes", 
EntityCondition.makeCondition([inventoryItemId : rec.inventoryItemId]), null, 
null, null, false);
+            oisgirs = from("OrderItemShipGrpInvRes").where("inventoryItemId", 
rec.inventoryItemId).queryList();
             if (oisgirs) {
                 fulfilledReservations.addAll(oisgirs);
             }
@@ -172,7 +172,7 @@ orderItems.each { orderItemAndShipGroupA
     // TODO: limit to a facility? The shipment destination facility is not 
necessarily the same facility as the inventory
     conditions = [EntityCondition.makeCondition("productId", 
EntityOperator.EQUALS, product.productId),
                   EntityCondition.makeCondition("availableToPromiseTotal", 
EntityOperator.LESS_THAN, BigDecimal.ZERO)];
-    negativeInventoryItems = delegator.findList("InventoryItem",  
EntityCondition.makeCondition(conditions, EntityOperator.AND), null, null, 
null, false);
+    negativeInventoryItems = 
from("InventoryItem").where(conditions).queryList();
     backOrderedQuantity = 0;
     negativeInventoryItems.each { negativeInventoryItem ->
         backOrderedQuantity += 
negativeInventoryItem.getDouble("availableToPromiseTotal").doubleValue();
@@ -201,7 +201,7 @@ if (productIdToReceive) {
 
     // If the productId as given isn't found in the order, try any 
goodIdentifications and use the first match
     if (!candidateOrderItems) {
-        goodIdentifications = delegator.findList("GoodIdentification", 
EntityCondition.makeCondition([idValue : productIdToReceive]), null, null, 
null, false);
+        goodIdentifications = from("GoodIdentification").where("idValue", 
productIdToReceive).queryList();
         if (goodIdentifications) {
             giit = goodIdentifications.iterator();
             while (giit.hasNext()) {

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReviewOrdersNotPickedOrPacked.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReviewOrdersNotPickedOrPacked.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReviewOrdersNotPickedOrPacked.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReviewOrdersNotPickedOrPacked.groovy
 Fri Dec 26 06:54:50 2014
@@ -27,12 +27,11 @@ condList = [];
 condList.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, 
"ORDER_APPROVED"));
 condList.add(EntityCondition.makeCondition("orderTypeId", 
EntityOperator.EQUALS, "SALES_ORDER"));
 condList.add(EntityCondition.makeCondition("pickSheetPrintedDate", 
EntityOperator.NOT_EQUAL, null));
-cond = EntityCondition.makeCondition(condList, EntityOperator.AND);
-orderHeaders = delegator.findList("OrderHeader", cond, null, null, null, 
false);
+orderHeaders = from("OrderHeader").where(condList).queryList();
 orders = [];
 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'/'K:mm a");
-orderHeaders.each { orderHeader ->
-    itemIssuanceList = delegator.findByAnd("ItemIssuance", [orderId : 
orderHeader.orderId], null, false);
+orderHeaders.each { orderHeader ->k
+    itemIssuanceList = from("ItemIssuance").where("orderId", 
orderHeader.orderId).queryList();
     if (itemIssuanceList) {
         orders.add([orderId : orderHeader.orderId, pickSheetPrintedDate : 
dateFormat.format(orderHeader.pickSheetPrintedDate), isVerified : "Y"]);
     } else {

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy
 Fri Dec 26 06:54:50 2014
@@ -22,7 +22,7 @@ import org.ofbiz.base.util.*
 import org.ofbiz.content.report.*
 
 shipmentId = request.getParameter("shipmentId");
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 
 if (shipment) {
     shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", 
null, ['shipmentRouteSegmentId', 'shipmentPackageSeqId'], false);

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/VerifyPick.groovy
 Fri Dec 26 06:54:50 2014
@@ -39,7 +39,7 @@ context.shipmentId = shipmentId;
 
 if (shipmentId) {
     context.orderId = null;
-    shipment = delegator.findOne("Shipment",  [shipmentId : shipmentId], 
false);
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
     if (shipment) {
         shipmentItemBillingList = shipment.getRelated("ShipmentItemBilling", 
null, null, false);
         invoiceIds = 
EntityUtil.getFieldListFromEntityList(shipmentItemBillingList, "invoiceId", 
true);
@@ -52,7 +52,7 @@ if (shipmentId) {
 
 facilityId = parameters.facilityId;
 if (facilityId) {
-    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    facility = from("Facility").where("facilityId", facilityId).queryOne();
     context.facility = facility;
 }
 verifyPickSession.setFacilityId(facilityId);
@@ -69,7 +69,7 @@ if (orderId && !shipGroupSeqId && orderI
 
 picklistBinId = parameters.picklistBinId;
 if (picklistBinId) {
-    picklistBin = delegator.findOne("PicklistBin", [picklistBinId : 
picklistBinId], false);
+    picklistBin = from("PicklistBin").where("picklistBinId", 
picklistBinId).queryOne();
     if (picklistBin) {
         orderId = picklistBin.primaryOrderId;
         shipGroupSeqId = picklistBin.primaryShipGroupSeqId;
@@ -78,7 +78,7 @@ if (picklistBinId) {
 }
 
 if (orderId && !picklistBinId) {
-    picklistBin = EntityUtil.getFirst(delegator.findByAnd("PicklistBin", 
[primaryOrderId : orderId], null, false));
+    picklistBin = from("PicklistBin").where("primaryOrderId", 
orderId).queryFirst();
     if (picklistBin) {
         picklistBinId = picklistBin.picklistBinId;
         verifyPickSession.setPicklistBinId(picklistBinId);
@@ -91,7 +91,7 @@ context.picklistBinId = picklistBinId;
 context.isOrderStatusApproved = false;
 
 if (orderId) {
-    orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
     if (orderHeader) {
         OrderReadHelper orh = new OrderReadHelper(orderHeader);
         context.orderId = orderId;
@@ -108,7 +108,7 @@ if (orderId) {
             if (shipGroupSeqId) {
                 productStoreId = orh.getProductStoreId();
                 context.productStoreId = productStoreId;
-                shipments = delegator.findByAnd("Shipment", [primaryOrderId : 
orderId, statusId : "SHIPMENT_PICKED"], null, false);
+                shipments = from("Shipment").where("primaryOrderId", orderId, 
"statusId", "SHIPMENT_PICKED").queryList();
                 if (shipments) {
                     request.setAttribute("_ERROR_MESSAGE_", 
UtilProperties.getMessage("OrderErrorUiLabels", 
"OrderErrorAllItemsOfOrderAreAlreadyVerified", [orderId : orderId], locale));
                 }

Modified: 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy?rev=1647937&r1=1647936&r2=1647937&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy
 (original)
+++ 
ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy
 Fri Dec 26 06:54:50 2014
@@ -23,7 +23,7 @@ shipmentId = parameters.shipmentId;
 if (!shipmentId) {
     shipmentId = request.getAttribute("shipmentId");
 }
-shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
 
 context.shipmentId = shipmentId;
 context.shipment = shipment;
@@ -50,8 +50,7 @@ if (security.hasEntityPermission("FACILI
     if (shipment) {
         if (shipment.primaryOrderId) {
             // allow if userLogin is associated with the primaryOrderId with 
the SUPPLIER_AGENT roleTypeId
-            orderRoleCheckMap = [orderId : shipment.primaryOrderId, partyId : 
userLogin.partyId, roleTypeId : 'SUPPLIER_AGENT'];
-            orderRole = delegator.findOne("OrderRole", orderRoleCheckMap, 
false);
+            orderRole = from("OrderRole").where("orderId", 
shipment.primaryOrderId, "partyId", userLogin.partyId, "roleTypeId", 
"SUPPLIER_AGENT").queryOne();
             if (orderRole) {
                 hasPermission = true;
             }


Reply via email to