svn commit: r664478 - /ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/

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

svn commit: r664478 - /ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/

mrisaliti
Author: mrisaliti
Date: Sun Jun  8 03:18:18 2008
New Revision: 664478

URL: http://svn.apache.org/viewvc?rev=664478&view=rev
Log:
Misc improvements suggested by Scott after conversion to groovy (Part of issue OFBIZ-1801)

Removed:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductFeatures.bsh
Modified:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductAssoc.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductFeatures.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/QuickAddVariants.groovy

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy Sun Jun  8 03:18:18 2008
@@ -21,7 +21,7 @@
 import org.ofbiz.entity.condition.*
 import org.ofbiz.entity.util.EntityFindOptions
 import org.ofbiz.entity.transaction.*
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.*
 
 module = "ApplyFeaturesFromCategory.groovy";
 
@@ -32,22 +32,22 @@
 
 context.selFeatureApplTypeId = request.getParameter("productFeatureApplTypeId");
 
-context.curProductFeatureCategory = delegator.findByPrimaryKey("ProductFeatureCategory", ['productFeatureCategoryId' : productFeatureCategoryId]);
+context.curProductFeatureCategory = delegator.findOne("ProductFeatureCategory", [productFeatureCategoryId : productFeatureCategoryId], false);
 
 context.productFeatureTypes = delegator.findList("ProductFeatureType", null, null, ['description'], null, false);
 
 context.productFeatureCategories = delegator.findList("ProductFeatureCategory", null, null, ['description'], null, false);
 
 //we only need these if we will be showing the apply feature to category forms
-if (productId != null && productId.length() > 0) {
+if (productId) {
     context.productFeatureApplTypes = delegator.findList("ProductFeatureApplType", null, null, ['description'], null, false);
 }
 
-productFeaturesSize = delegator.findCountByCondition("ProductFeature", new EntityExpr("productFeatureCategoryId", EntityOperator.EQUALS, productFeatureCategoryId), null, null);
+productFeaturesSize = delegator.findCountByCondition("ProductFeature", EntityCondition.makeCondition("productFeatureCategoryId", EntityOperator.EQUALS, productFeatureCategoryId), null, null);
 
-int highIndex = 0;
-int lowIndex = 0;
-int listSize = (int) productFeaturesSize;
+highIndex = 0;
+lowIndex = 0;
+listSize = (int) productFeaturesSize;
 
 if (viewIndex == null) {
     viewIndex = 0;
@@ -64,7 +64,7 @@
 context.lowIndex = lowIndex;
 context.highIndex = highIndex;
 
-whereCondition = new EntityFieldMap(['productFeatureCategoryId' : productFeatureCategoryId], EntityOperator.AND);
+whereCondition = EntityCondition.makeCondition([productFeatureCategoryId : productFeatureCategoryId], EntityOperator.AND);
 EntityFindOptions efo = new EntityFindOptions();
 efo.setDistinct(true);
 efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
@@ -94,15 +94,15 @@
 
 context.productFeatures = productFeatures;
 
-productFeatureApplMap = new HashMap();
+productFeatureApplMap = [:];
 productFeatureAppls = null;
 productFeatureIter = productFeatures.iterator();
 productFeatureApplIter = null;
-while (productFeatureIter.hasNext()) {
+while (productFeatureIter) {
     productFeature = productFeatureIter.next();
-    productFeatureAppls = delegator.findByAnd("ProductFeatureAppl", ['productId' : productId, 'productFeatureId' : productFeature.productFeatureId], null);
+    productFeatureAppls = delegator.findList("ProductFeatureAppl", EntityCondition.makeCondition([productId : productId, productFeatureId : productFeature.productFeatureId]), null, null, null, false);
     productFeatureApplIter = productFeatureAppls.iterator();
-    while (productFeatureApplIter.hasNext()) {
+    while (productFeatureApplIter) {
         productFeatureAppl = productFeatureApplIter.next();
         productFeatureApplMap.put(productFeatureAppl.productFeatureId, productFeatureAppl.productFeatureApplTypeId);
     }

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy Sun Jun  8 03:18:18 2008
@@ -22,16 +22,14 @@
  * Puts productFeatureGroup and productFeatures which are put of this group into the context.  Currently does not break out the features by view size.
  */
 
-import org.ofbiz.base.util.UtilMisc
-import org.ofbiz.entity.GenericDelegator
-import org.ofbiz.entity.GenericEntity
+import org.ofbiz.entity.*
 
 productFeatureGroupId = parameters.get("productFeatureGroupId");
-if ((productFeatureGroupId != null) && !(productFeatureGroupId.equals(""))) {
-    productFeatureGroup = delegator.findByPrimaryKey("ProductFeatureGroup", ['productFeatureGroupId' : productFeatureGroupId]);
-    productFeatures = new LinkedList();
+if ((productFeatureGroupId) && !(productFeatureGroupId.equals(""))) {
+    productFeatureGroup = delegator.findOne("ProductFeatureGroup", [productFeatureGroupId : productFeatureGroupId], false);
+    productFeatures = [];
     productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl", ['sequenceNum']);
-    for (pFGAi = productFeatureGroupAppls.iterator(); pFGAi.hasNext(); ) {
+    for (pFGAi = productFeatureGroupAppls.iterator(); pFGAi;) {
         productFeatureGroupAppl = (GenericEntity)pFGAi.next();
         productFeature = (GenericEntity)productFeatureGroupAppl.getRelatedOne("ProductFeature");
         productFeature.set("defaultSequenceNum", productFeatureGroupAppl.getLong("sequenceNum"));
@@ -39,6 +37,7 @@
     }
     context.productFeatureGroup = productFeatureGroup;
     context.productFeatures = productFeatures;
+    
     // this will not break out the product features by view size
     context.listSize = productFeatures.size();
     context.highIndex = productFeatures.size();

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductAssoc.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductAssoc.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductAssoc.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductAssoc.groovy Sun Jun  8 03:18:18 2008
@@ -17,29 +17,26 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.widget.html.*;
+import org.ofbiz.entity.*
+import org.ofbiz.base.util.*
 
 context.nowDate = UtilDateTime.nowDate();
 context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
 
-boolean useValues = true;
-if (request.getAttribute("_ERROR_MESSAGE_") != null) {
+useValues = true;
+if (request.getAttribute("_ERROR_MESSAGE_")) {
     useValues = false;
 }
 
 productId = parameters.productId;
-if (productId == null) {
+if (!productId) {
     productId = parameters.PRODUCT_ID;
-}
-
-if (productId != null) {
+} else {
     context.productId = productId;
 }
 
 productIdTo = parameters.PRODUCT_ID_TO;
-if (productIdTo != null) {
+if (productIdTo) {
     context.productIdTo = productIdTo;
 }
 
@@ -54,38 +51,38 @@
 if (UtilValidate.isNotEmpty(fromDateStr)) {
     fromDate = Timestamp.valueOf(fromDateStr);
 }
-if (fromDate == null) {
+if (!fromDate) {
     fromDate = request.getAttribute("ProductAssocCreateFromDate");
-}
-if (fromDate != null) {
+} else {
     context.fromDate = fromDate;
 }
 
-product = delegator.findByPrimaryKey("Product", ['productId' : productId]);
-if (product != null) {
+product = delegator.findOne("Product", [productId : productId], false);
+if (product) {
     context.product = product;
 }
 
-productAssoc = delegator.findByPrimaryKey("ProductAssoc", ['productId' : productId, 'productIdTo' : productIdTo, 'productAssocTypeId' : productAssocTypeId, 'fromDate' : fromDate]);
-if (productAssoc != null) {
+productAssoc = delegator.findOne("ProductAssoc", [productId : productId, productIdTo : productIdTo, productAssocTypeId : productAssocTypeId, fromDate : fromDate], false);
+if (productAssoc) {
     context.productAssoc = productAssoc;
 }
 
-if("true".equalsIgnoreCase(parameters.useValues)) {
+if ("true".equalsIgnoreCase(parameters.useValues)) {
     useValues = true;
 }
-if(productAssoc == null) useValues = false;
+
+if (!productAssoc) {
+    useValues = false;
+}
 
 context.useValues = useValues;
 context.isCreate = true;
 
-Collection assocTypes = delegator.findList("ProductAssocType", null, null, ['description'], null, false);
-context.put("assocTypes", assocTypes);
+assocTypes = delegator.findList("ProductAssocType", null, null, ['description'], null, false);
+context.assocTypes = assocTypes;
 
-if (product != null) {
-    assocFromProducts = product.getRelated("MainProductAssoc", null, ['sequenceNum']);
-    context.assocFromProducts = assocFromProducts;
+if (product) {
+    context.assocFromProducts = product.getRelated("MainProductAssoc", null, ['sequenceNum']);
     
-    assocToProducts = product.getRelated("AssocProductAssoc");
-    context.assocToProducts = assocToProducts;
-}
+    context.assocToProducts = product.getRelated("AssocProductAssoc");
+}
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy Sun Jun  8 03:18:18 2008
@@ -32,10 +32,10 @@
 context.imageUrlPrefix = imageUrlPrefix;
 
 filenameExpander = new FlexibleStringExpander(imageFilenameFormat);
-context.imageNameSmall = imageUrlPrefix + "/" + filenameExpander.expandString(['location' : 'products', 'type' : 'small' , 'id' : productId]);
-context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString(['location' : 'products', 'type' : 'medium', 'id' : productId]);
-context.imageNameLarge = imageUrlPrefix + "/" + filenameExpander.expandString(['location' : 'products', 'type' : 'large' , 'id' : productId]);
-context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString(['location' : 'products', 'type' : 'detail', 'id' : productId]);
+context.imageNameSmall  = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'small' , id : productId]);
+context.imageNameMedium = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'medium', id : productId]);
+context.imageNameLarge  = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'large' , id : productId]);
+context.imageNameDetail = imageUrlPrefix + "/" + filenameExpander.expandString([location : 'products', type : 'detail', id : productId]);
 
 // Start ProductContent stuff
 productContent = null;
@@ -45,7 +45,7 @@
 context.productContent = productContent;
 // End ProductContent stuff
 
-boolean tryEntity = true;
+tryEntity = true;
 if (request.getAttribute("_ERROR_MESSAGE_")) {
     tryEntity = false;
 }
@@ -65,7 +65,7 @@
 if (fileType) {
     context.fileType = fileType;
     
-    fileLocation = filenameExpander.expandString(['location' : 'products', 'type' : fileType, 'id' : productId]);
+    fileLocation = filenameExpander.expandString([location : 'products', type : fileType, id : productId]);
     filePathPrefix = "";
     filenameToUse = fileLocation;
     if (fileLocation.lastIndexOf("/") != -1) {

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductFeatures.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductFeatures.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductFeatures.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductFeatures.groovy Sun Jun  8 03:18:18 2008
@@ -20,7 +20,7 @@
 import org.ofbiz.entity.condition.*;
 
 context.productFeatureAndAppls = delegator.findList('ProductFeatureAndAppl',
-        EntityCondition.makeCondition(['productId' : productId]), null,
+        EntityCondition.makeCondition([productId : productId]), null,
         ['sequenceNum', 'productFeatureApplTypeId', 'productFeatureTypeId', 'description'], null, false);
 
 context.productFeatureCategories = delegator.findList('ProductFeatureCategory', null, null, ['description'], null, false);

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductInventoryItems.groovy Sun Jun  8 03:18:18 2008
@@ -21,33 +21,33 @@
 import org.ofbiz.product.inventory.InventoryWorker
 
 //If product is virtual gather summary data from variants
-if (product.isVirtual != null && "Y".equals(product.isVirtual)) {
+if (product.isVirtual && "Y".equals(product.isVirtual)) {
     //Get the virtual product feature types
-    result = dispatcher.runSync("getProductFeaturesByType", ['productId' : productId, 'productFeatureApplTypeId' : 'SELECTABLE_FEATURE']);
+    result = dispatcher.runSync("getProductFeaturesByType", [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
     featureTypeIds = result.productFeatureTypes;
     
     //Get the variants
-    result = dispatcher.runSync("getAllProductVariants", ['productId' : productId]);
+    result = dispatcher.runSync("getAllProductVariants", [productId : productId]);
     variants = result.assocProducts;
     variantIterator = variants.iterator();
-    variantInventorySummaries = new ArrayList();
-    while(variantIterator.hasNext()) {
+    variantInventorySummaries = [];
+    while(variantIterator) {
         variant = variantIterator.next();
 
         //create a map of each variant id and inventory summary (all facilities)
-        inventoryAvailable = dispatcher.runSync("getProductInventoryAvailable", ['productId' : variant.productIdTo]);
+        inventoryAvailable = dispatcher.runSync("getProductInventoryAvailable", [productId : variant.productIdTo]);
 
-        variantInventorySummary = ['productId' :  variant.productIdTo,
-                                   'availableToPromiseTotal' : inventoryAvailable.availableToPromiseTotal,
-                                   'quantityOnHandTotal' : inventoryAvailable.quantityOnHandTotal];
+        variantInventorySummary = [productId : variant.productIdTo,
+                                   availableToPromiseTotal : inventoryAvailable.availableToPromiseTotal,
+                                   quantityOnHandTotal : inventoryAvailable.quantityOnHandTotal];
 
         //add the applicable features to the map
         featureTypeIdsIterator = featureTypeIds.iterator();
-        while (featureTypeIdsIterator.hasNext()) {
+        while (featureTypeIdsIterator) {
             featureTypeId = featureTypeIdsIterator.next();
-            result = dispatcher.runSync("getProductFeatures", ['productId' : variant.productIdTo, 'type' : 'STANDARD_FEATURE', 'distinct' : featureTypeId]);
+            result = dispatcher.runSync("getProductFeatures", [productId : variant.productIdTo, type : 'STANDARD_FEATURE', distinct : featureTypeId]);
             variantFeatures = result.productFeatures;
-            if (variantFeatures.size() > 0) {
+            if (variantFeatures) {
                 //there should only be one result in this collection
                 variantInventorySummary.put(featureTypeId, variantFeatures.get(0));
             }
@@ -57,15 +57,15 @@
     context.featureTypeIds = featureTypeIds;
     context.variantInventorySummaries = variantInventorySummaries;
 } else { //Gather information for a non virtual product
-    quantitySummaryByFacility = new HashMap();
-    manufacturingInQuantitySummaryByFacility = new HashMap();
-    manufacturingOutQuantitySummaryByFacility = new HashMap();
+    quantitySummaryByFacility = [:];
+    manufacturingInQuantitySummaryByFacility = [:];
+    manufacturingOutQuantitySummaryByFacility = [:];
     // The warehouse list is selected
     showAllFacilities = parameters.showAllFacilities;
-    if (showAllFacilities != null && showAllFacilities.equals("Y")) {
+    if (showAllFacilities && "Y".equals(showAllFacilities)) {
         facilityList = delegator.findList("Facility", null, null, null, null, false);
     } else {
-        facilityList = delegator.findByAnd("ProductFacility", ['productId' : productId]);
+        facilityList = delegator.findList("ProductFacility", EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), null, null, null, false);
     }
     facilityIterator = facilityList.iterator();
     dispatcher = request.getAttribute("dispatcher");
@@ -74,65 +74,65 @@
     
     // inventory quantity summary by facility: For every warehouse the product's atp and qoh
     // are obtained (calling the "getInventoryAvailableByFacility" service)
-    while (facilityIterator.hasNext()) {
+    while (facilityIterator) {
         facility = facilityIterator.next();
-        resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", ['productId' : productId, 'facilityId' : facility.facilityId]);
+        resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : productId, facilityId : facility.facilityId]);
         
-        quantitySummary = new HashMap();
-        quantitySummary.put("facilityId", facility.facilityId);
-        quantitySummary.put("totalQuantityOnHand", resultOutput.quantityOnHandTotal);
-        quantitySummary.put("totalAvailableToPromise", resultOutput.availableToPromiseTotal);
+        quantitySummary = [:];
+        quantitySummary.facilityId = facility.facilityId;
+        quantitySummary.totalQuantityOnHand = resultOutput.quantityOnHandTotal;
+        quantitySummary.totalAvailableToPromise = resultOutput.availableToPromiseTotal;
 
         // if the product is a MARKETING_PKG_AUTO/PICK, then also get the quantity which can be produced from components
         if ("MARKETING_PKG_AUTO".equals(product.productTypeId) ||
             "MARKETING_PKG_PICK".equals(product.productTypeId)) {
-            resultOutput = dispatcher.runSync("getMktgPackagesAvailable", ['productId' : productId, 'facilityId' : facility.facilityId]);
-            quantitySummary.put("mktgPkgQOH", resultOutput.quantityOnHandTotal);
-            quantitySummary.put("mktgPkgATP", resultOutput.availableToPromiseTotal);
+            resultOutput = dispatcher.runSync("getMktgPackagesAvailable", [productId : productId, facilityId : facility.facilityId]);
+            quantitySummary.mktgPkgQOH = resultOutput.quantityOnHandTotal;
+            quantitySummary.mktgPkgATP = resultOutput.availableToPromiseTotal;
         }
         
         quantitySummaryByFacility.put(facility.facilityId, quantitySummary);
     }
 
     productInventoryItems = delegator.findByAnd("InventoryItem",
-            ['productId' : productId],
+            [productId : productId],
             ['facilityId', '-datetimeReceived', '-inventoryItemId']);
 
     // TODO: get all incoming shipments not yet arrived coming into each facility that this product is in, use a view entity with ShipmentAndItem
-    findIncomingShipmentsConds = new LinkedList();
+    findIncomingShipmentsConds = [];
 
-    findIncomingShipmentsConds.add(new EntityExpr('productId', EntityOperator.EQUALS, productId));
+    findIncomingShipmentsConds.add(EntityCondition.makeCondition('productId', EntityOperator.EQUALS, productId));
 
-    findIncomingShipmentsTypeConds = new LinkedList();
-    findIncomingShipmentsTypeConds.add(new EntityExpr("shipmentTypeId", EntityOperator.EQUALS, "INCOMING_SHIPMENT"));
-    findIncomingShipmentsTypeConds.add(new EntityExpr("shipmentTypeId", EntityOperator.EQUALS, "PURCHASE_SHIPMENT"));
-    findIncomingShipmentsTypeConds.add(new EntityExpr("shipmentTypeId", EntityOperator.EQUALS, "SALES_RETURN"));
-    findIncomingShipmentsConds.add(new EntityConditionList(findIncomingShipmentsTypeConds, EntityOperator.OR));
-
-    findIncomingShipmentsStatusConds = new LinkedList();
-    findIncomingShipmentsStatusConds.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_DELIVERED"));
-    findIncomingShipmentsStatusConds.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_CANCELLED"));
-    findIncomingShipmentsStatusConds.add(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "PURCH_SHIP_RECEIVED"));
-    findIncomingShipmentsConds.add(new EntityConditionList(findIncomingShipmentsStatusConds, EntityOperator.AND));
+    findIncomingShipmentsTypeConds = [];
+    findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "INCOMING_SHIPMENT"));
+    findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "PURCHASE_SHIPMENT"));
+    findIncomingShipmentsTypeConds.add(EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "SALES_RETURN"));
+    findIncomingShipmentsConds.add(EntityCondition.makeCondition(findIncomingShipmentsTypeConds, EntityOperator.OR));
+
+    findIncomingShipmentsStatusConds = [];
+    findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_DELIVERED"));
+    findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "SHIPMENT_CANCELLED"));
+    findIncomingShipmentsStatusConds.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PURCH_SHIP_RECEIVED"));
+    findIncomingShipmentsConds.add(EntityCondition.makeCondition(findIncomingShipmentsStatusConds, EntityOperator.AND));
 
-    findIncomingShipmentsStatusCondition = new EntityConditionList(findIncomingShipmentsConds, EntityOperator.AND);
+    findIncomingShipmentsStatusCondition = EntityCondition.makeCondition(findIncomingShipmentsConds, EntityOperator.AND);
     incomingShipmentAndItems = delegator.findList("ShipmentAndItem", findIncomingShipmentsStatusCondition, null, ['-estimatedArrivalDate'], null, false);
     incomingShipmentAndItemIter = incomingShipmentAndItems.iterator();
-    while (incomingShipmentAndItemIter.hasNext()) {
+    while (incomingShipmentAndItemIter) {
         incomingShipmentAndItem = incomingShipmentAndItemIter.next();
         facilityId = incomingShipmentAndItem.destinationFacilityId;
 
         quantitySummary = quantitySummaryByFacility.get(facilityId);
-        if (quantitySummary == null) {
-            quantitySummary = new HashMap();
-            quantitySummary.put("facilityId", facilityId);
-            quantitySummaryByFacility.put(facilityId, quantitySummary);
+        if (!quantitySummary) {
+            quantitySummary = [:];
+            quantitySummary.facilityId = facilityId;
+            quantitySummaryByFacility.facilityId = quantitySummary;
         }
 
         incomingShipmentAndItemList = quantitySummary.incomingShipmentAndItemList;
-        if (incomingShipmentAndItemList == null) {
-            incomingShipmentAndItemList = new LinkedList();
-            quantitySummary.put("incomingShipmentAndItemList", incomingShipmentAndItemList);
+        if (!incomingShipmentAndItemList) {
+            incomingShipmentAndItemList = [];
+            quantitySummary.incomingShipmentAndItemList = incomingShipmentAndItemList;
         }
 
         incomingShipmentAndItemList.add(incomingShipmentAndItem);
@@ -141,7 +141,7 @@
     // --------------------
     // Production Runs
     resultOutput = dispatcher.runSync("getProductManufacturingSummaryByFacility",
-                   ['productId' : productId, 'userLogin' : userLogin]);
+                   [productId : productId, userLogin : userLogin]);
     // incoming products
     manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility;
     // outgoing products (materials)

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductQuickAdmin.groovy Sun Jun  8 03:18:18 2008
@@ -32,38 +32,38 @@
 // add/remove feature types
 addedFeatureTypes = (HashMap) session.getAttribute("addedFeatureTypes");
 if (addedFeatureTypes == null) {
-    addedFeatureTypes = new HashMap();
+    addedFeatureTypes = [:];
     session.setAttribute("addedFeatureTypes", addedFeatureTypes);
 }
 
 featuresByType = new HashMap();
 String[] addFeatureTypeId = request.getParameterValues("addFeatureTypeId");
-List addFeatureTypeIdList = new ArrayList();
-if (addFeatureTypeId != null) {
+List addFeatureTypeIdList = [];
+if (addFeatureTypeId) {
     addFeatureTypeIdList.addAll(Arrays.asList(addFeatureTypeId));
 }
 
 addFeatureTypeIdIter = addFeatureTypeIdList.iterator();
-while (addFeatureTypeIdIter.hasNext()) {
+while (addFeatureTypeIdIter) {
     String curFeatureTypeId = addFeatureTypeIdIter.next();
-    GenericValue featureType = delegator.findByPrimaryKey("ProductFeatureType", ['productFeatureTypeId' : curFeatureTypeId]);
-    if ((featureType != null) && !addedFeatureTypes.containsKey(curFeatureTypeId)) {
+    GenericValue featureType = delegator.findOne("ProductFeatureType", [productFeatureTypeId : curFeatureTypeId], false);
+    if ((featureType) && !addedFeatureTypes.containsKey(curFeatureTypeId)) {
         addedFeatureTypes.put(curFeatureTypeId, featureType);
     }
 }
 
 String[] removeFeatureTypeId = request.getParameterValues("removeFeatureTypeId");
-if (removeFeatureTypeId != null) {
+if (removeFeatureTypeId) {
     for (int i = 0; i < removeFeatureTypeId.length; i++) {
-        GenericValue featureType = delegator.findByPrimaryKey("ProductFeatureType", ['productFeatureTypeId' : addFeatureTypeId[i]]);
-        if ((featureType != null) && addedFeatureTypes.containsKey(removeFeatureTypeId[i])) {
+        GenericValue featureType = delegator.findOne("ProductFeatureType", [productFeatureTypeId : addFeatureTypeId[i]], false);
+        if ((featureType) && addedFeatureTypes.containsKey(removeFeatureTypeId[i])) {
             addedFeatureTypes.remove(removeFeatureTypeId[i]);
             featuresByType.remove(removeFeatureTypeId[i]);
         }
     }
 }
 Iterator iter = addedFeatureTypes.values().iterator();
-while (iter.hasNext()) {
+while (iter) {
     GenericValue featureType = (GenericValue)iter.next();
     featuresByType.put(featureType.productFeatureTypeId, featureType.getRelated("ProductFeature", ['description']));
 }
@@ -73,26 +73,26 @@
 context.featuresByType = featuresByType;
 
 productId = request.getParameter("productId");
-if (productId == null) {
+if (!productId) {
     productId = request.getParameter("PRODUCT_ID");
 }
-if (productId == null) {
+if (!productId) {
     productId = request.getAttribute("productId");
 }
-if (productId != null) {
+if (productId) {
     context.productId = productId;
 }
 
-product = delegator.findByPrimaryKey("Product", ['productId' : productId]);
-List assocProducts = new ArrayList();
-featureFloz = new HashMap();
-featureMl = new HashMap();
-featureNtwt = new HashMap();
-featureGrams = new HashMap();
-featureHazmat = new HashMap();
-featureSalesThru = new HashMap();
-featureThruDate = new HashMap();
-selFeatureDesc = new HashMap();
+product = delegator.findOne("Product", [productId : productId], false);
+assocProducts = [];
+featureFloz = [:];
+featureMl = [:];
+featureNtwt = [:];
+featureGrams = [:];
+featureHazmat = [:];
+featureSalesThru = [:];
+featureThruDate = [:];
+selFeatureDesc = [:];
 Double floz = null;
 Double ml = null;
 Double ntwt = null;
@@ -103,27 +103,27 @@
 String productFeatureTypeId = request.getParameter("productFeatureTypeId");
 context.productFeatureTypeId = productFeatureTypeId;
 
-if (product != null) {
+if (product) {
     context.product = product;
 
     // get categories
-    List allCategories = delegator.findList("ProductCategory",
-            new EntityExpr(new EntityExpr("showInSelect", EntityOperator.EQUALS, null), EntityOperator.OR, new EntityExpr("showInSelect", EntityOperator.NOT_EQUAL, "N")),
+    allCategories = delegator.findList("ProductCategory",
+            EntityCondition.makeCondition(EntityCondition.makeCondition("showInSelect", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("showInSelect", EntityOperator.NOT_EQUAL, "N")),
             null, ['description'], null, false);
 
-    List categoryMembers = product.getRelated("ProductCategoryMember");
+    categoryMembers = product.getRelated("ProductCategoryMember");
     categoryMembers = EntityUtil.filterByDate(categoryMembers);
     context.allCategories = allCategories;
     context.productCategoryMembers = categoryMembers;
 
-    List productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl");
+    productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl");
     
     // get standard features for this product
-    List standardFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureApplTypeId' : "STANDARD_FEATURE"]);
-    productFeatureTypeLookup = new HashMap();
-    standardFeatureLookup = new HashMap();
+    standardFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureApplTypeId : "STANDARD_FEATURE"]);
+    productFeatureTypeLookup = [:];
+    standardFeatureLookup = [:];
     Iterator standardFeatureApplIter = standardFeatureAppls.iterator();
-    while (standardFeatureApplIter.hasNext()) {
+    while (standardFeatureApplIter) {
         GenericValue standardFeatureAndAppl = (GenericValue) standardFeatureApplIter.next();
         GenericValue featureType = standardFeatureAndAppl.getRelatedOneCache("ProductFeatureType");
         productFeatureTypeLookup.put(standardFeatureAndAppl.getString("productFeatureId"), featureType);
@@ -133,13 +133,13 @@
     context.standardFeatureAppls = standardFeatureAppls;
 
     // get selectable features for this product
-    List selectableFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureApplTypeId' : 'SELECTABLE_FEATURE']);
-    selectableFeatureLookup = new HashMap();
+    List selectableFeatureAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
+    selectableFeatureLookup = [:];
     // get feature types that are deleteable from selectable features section
     Set selectableFeatureTypes = new HashSet();
 
     Iterator selectableFeatureAndApplIter = selectableFeatureAppls.iterator();
-    while (selectableFeatureAndApplIter.hasNext()) {
+    while (selectableFeatureAndApplIter) {
         GenericValue selectableFeatureAndAppl = (GenericValue) selectableFeatureAndApplIter.next();
         GenericValue featureType = selectableFeatureAndAppl.getRelatedOneCache("ProductFeatureType");
         productFeatureTypeLookup.put(selectableFeatureAndAppl.productFeatureId, featureType);
@@ -154,7 +154,7 @@
         Set distinguishingFeatures = ProductWorker.getVariantDistinguishingFeatures(product);
         context.distinguishingFeatures = distinguishingFeatures;
         Iterator distinguishingFeatureIter = distinguishingFeatures.iterator();
-        while (distinguishingFeatureIter.hasNext()) {
+        while (distinguishingFeatureIter) {
             distFeature = (GenericValue) distinguishingFeatureIter.next();
             featureType = distFeature.getRelatedOneCache("ProductFeatureType");
             if (!productFeatureTypeLookup.containsKey(distFeature.productFeatureId)) {
@@ -166,9 +166,8 @@
 
 
     // get shipping dimensions and weights for single product
-    List prodFeaturesFiltered = null;
-    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'VLIQ_ozUS']);
-    if (prodFeaturesFiltered.size() > 0) {
+    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS']);
+    if (prodFeaturesFiltered) {
         try {
             floz = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
         } catch (Exception e) {
@@ -176,8 +175,8 @@
         }
         context.floz = floz;
     }
-    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'VLIQ_ml']);
-    if (prodFeaturesFiltered.size() > 0) {
+    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml']);
+    if (prodFeaturesFiltered) {
         try {
             ml = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
         } catch (Exception e) {
@@ -185,8 +184,8 @@
         }
         context.ml = ml;
     }
-    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'WT_g']);
-    if (prodFeaturesFiltered.size() > 0) {
+    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g']);
+    if (prodFeaturesFiltered) {
         try {
             grams = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
         } catch (Exception e) {
@@ -194,8 +193,8 @@
         }
         context.grams = grams;
     }
-    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'WT_oz']);
-    if (prodFeaturesFiltered.size() > 0) {
+    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz']);
+    if (prodFeaturesFiltered) {
         try {
             ntwt = ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified");
         } catch (Exception e) {
@@ -203,8 +202,8 @@
         }
         context.ntwt = ntwt;
     }
-    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureTypeId' : 'HAZMAT']);
-    if (prodFeaturesFiltered.size() > 0) {
+    prodFeaturesFiltered = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : 'HAZMAT']);
+    if (prodFeaturesFiltered) {
         try {
             hazmat = ((GenericValue)prodFeaturesFiltered.get(0)).getString("description");
         } catch (Exception e) {
@@ -216,7 +215,7 @@
         context.hazmat = hazmat;
     }
     java.sql.Timestamp salesThru = product.getTimestamp("salesDiscontinuationDate");
-    if (salesThru == null) {
+    if (!salesThru) {
         salesthru = "[&nbsp;]";
     } else if (salesThru.after(new java.util.Date())) {
         salesthru = "<div style='color: blue'>[x]</div>";
@@ -228,41 +227,41 @@
     context.thrudate = thrudate;
 
     // get all variants - associations first
-    Collection productAssocs = product.getRelatedByAnd("MainProductAssoc", ['productAssocTypeId' : 'PRODUCT_VARIANT']);
+    productAssocs = product.getRelatedByAnd("MainProductAssoc", [productAssocTypeId : 'PRODUCT_VARIANT']);
     Iterator productAssocIter = productAssocs.iterator();
     // get shipping dimensions and weights for all the variants
-    while (productAssocIter.hasNext()) {
+    while (productAssocIter) {
         // now get the variant product
         productAssoc = (GenericValue)productAssocIter.next();
         assocProduct = productAssoc.getRelatedOne("AssocProduct");
-        if (assocProduct != null) {
+        if (assocProduct) {
             assocProducts.add(assocProduct);
             assocProductFeatureAndAppls = assocProduct.getRelated("ProductFeatureAndAppl");
-            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'VLIQ_ozUS']);
-            if (prodFeaturesFiltered.size() > 0) {
+            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ozUS']);
+            if (prodFeaturesFiltered) {
                 featureFloz.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
             }
-            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'VLIQ_ml']);
-            if (prodFeaturesFiltered.size() > 0) {
+            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'VLIQ_ml']);
+            if (prodFeaturesFiltered) {
                 featureMl.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
             }
-            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'WT_g']);
-            if (prodFeaturesFiltered.size() > 0) {
+            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_g']);
+            if (prodFeaturesFiltered) {
                 featureGrams.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
             }
-            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, ['productFeatureTypeId' : 'AMOUNT', 'uomId' : 'WT_oz']);
-            if (prodFeaturesFiltered.size() > 0) {
+            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'AMOUNT', uomId : 'WT_oz']);
+            if (prodFeaturesFiltered) {
                 featureNtwt.put(assocProduct.productId, ((GenericValue)prodFeaturesFiltered.get(0)).getDouble("numberSpecified"));
             }
-            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, ['productFeatureTypeId' : 'HAZMAT']);
-            if (prodFeaturesFiltered.size() > 0) {
+            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : 'HAZMAT']);
+            if (prodFeaturesFiltered) {
                 featureHazmat.put(assocProduct.productId,
                     ((GenericValue)prodFeaturesFiltered.get(0)).getString("description"));
             } else {
                 featureHazmat.put(assocProduct.productId, "&nbsp;");
             }
             salesThru = assocProduct.getTimestamp("salesDiscontinuationDate");
-            if (salesThru == null) {
+            if (!salesThru) {
                 featureSalesThru.put(assocProduct.productId, "<div style='color: blue'>[&nbsp;]</div>");
             } else if (salesThru.after(new java.util.Date())) {
                 featureSalesThru.put(assocProduct.productId, "<div style='color: blue'>[x]</div>");
@@ -270,7 +269,7 @@
                 featureSalesThru.put(assocProduct.productId, "<div style='color: red'>[x]</div>");
             }
             java.sql.Timestamp thruDate = productAssoc.getTimestamp("thruDate");
-            if (thruDate == null) {
+            if (!thruDate) {
                 featureThruDate.put(assocProduct.productId, "<div style='color: blue'>[&nbsp;]</div>");
             } else if (thruDate.after(new java.util.Date())) {
                 featureThruDate.put(assocProduct.productId, "<div style='color: blue'>[x]</div>");
@@ -278,12 +277,12 @@
                 featureThruDate.put(assocProduct.productId, "<div style='color: red'>[x]</div>");
             }
 
-            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, ['productFeatureTypeId' : productFeatureTypeId]);
-            if (prodFeaturesFiltered.size() > 0) {
+            prodFeaturesFiltered = EntityUtil.filterByAnd(assocProductFeatureAndAppls, [productFeatureTypeId : productFeatureTypeId]);
+            if (prodFeaturesFiltered) {
                 // this is used for the selectable feature descriptions section; only include here iff the description is also associated with the virtual product as a selectable feature, ie if this is a distinguishing feature
                 String curSelDescription = ((GenericValue) prodFeaturesFiltered.get(0)).getString("description");
-                testProductFeatureAndAppls = EntityUtil.filterByAnd(productFeatureAndAppls, ['productFeatureTypeId' : productFeatureTypeId, 'description' : curSelDescription, 'productFeatureApplTypeId' : 'SELECTABLE_FEATURE']);
-                if (testProductFeatureAndAppls.size() > 0) {
+                testProductFeatureAndAppls = EntityUtil.filterByAnd(productFeatureAndAppls, [productFeatureTypeId : productFeatureTypeId, description : curSelDescription, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
+                if (testProductFeatureAndAppls) {
                     selFeatureDesc.put(assocProduct.productId, curSelDescription);
                 }
             }
@@ -308,7 +307,7 @@
 context.allCategoryId = allCategoryId;
 
 // show the publish or unpublish section
-List prodCatMembs = delegator.findByAnd("ProductCategoryMember", ['productCategoryId' : allCategoryId, 'productId' : productId]);
+prodCatMembs = delegator.findList("ProductCategoryMember", EntityCondition.makeCondition([productCategoryId : allCategoryId, productId : productId]), null, null, null, false);
 //don't filter by date, show all categories: prodCatMembs = EntityUtil.filterByDate(prodCatMembs);
 
 String showPublish = "false";

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/QuickAddVariants.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/QuickAddVariants.groovy?rev=664478&r1=664477&r2=664478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/QuickAddVariants.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/QuickAddVariants.groovy Sun Jun  8 03:18:18 2008
@@ -17,8 +17,8 @@
  * under the License.
  */
 
-result = dispatcher.runSync("getProductFeaturesByType", ['productId' : productId, 'productFeatureApplTypeId' : 'SELECTABLE_FEATURE']);
+result = dispatcher.runSync("getProductFeaturesByType", [productId : productId, productFeatureApplTypeId : 'SELECTABLE_FEATURE']);
 context.featureTypes = result.productFeatureTypes;
 
-result = dispatcher.runSync("getVariantCombinations", ['productId' : productId]);
+result = dispatcher.runSync("getVariantCombinations", [productId : productId]);
 context.featureCombinationInfos = result.featureCombinations;
\ No newline at end of file