You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2008/11/11 03:20:55 UTC

svn commit: r712919 [1/3] - in /ofbiz/trunk/applications/product/src/org/ofbiz: product/catalog/ product/category/ product/config/ product/feature/ product/inventory/ product/price/ product/product/ product/spreadsheetimport/ product/store/ product/sub...

Author: doogie
Date: Mon Nov 10 18:20:53 2008
New Revision: 712919

URL: http://svn.apache.org/viewvc?rev=712919&view=rev
Log:
Make use of enhanced-for loops.

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ProductFeatureServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearch.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchEvents.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductUtilServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductWorker.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/spreadsheetimport/ImportProductServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/store/ProductStoreWorker.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/catalog/CatalogWorker.java Mon Nov 10 18:20:53 2008
@@ -19,7 +19,6 @@
 package org.ofbiz.product.catalog;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -67,9 +66,7 @@
             Debug.logError(e, "Error looking up all catalogs", module);
         }
         if (catalogs != null) {
-            Iterator<GenericValue> i = catalogs.iterator();
-            while (i.hasNext()) {
-                GenericValue c = i.next();
+            for (GenericValue c: catalogs) {
                 catalogIds.add(c.getString("prodCatalogId"));
             }
         }
@@ -189,9 +186,7 @@
         if (storeCatalogs != null) allCatalogLinks.addAll(storeCatalogs);
         
         if (allCatalogLinks.size() > 0) {
-            Iterator<GenericValue> aclIter = allCatalogLinks.iterator();
-            while (aclIter.hasNext()) {
-                GenericValue catalogLink = aclIter.next();
+            for (GenericValue catalogLink: allCatalogLinks) {
                 categoryIds.add(catalogLink.getString("prodCatalogId"));
             }
         }
@@ -382,11 +377,7 @@
         Collection<GenericValue> prodCatalogCategories = getProdCatalogCategories(request, prodCatalogId, "PCCT_QUICK_ADD");
 
         if (UtilValidate.isNotEmpty(prodCatalogCategories)) {
-            Iterator<GenericValue> pccIter = prodCatalogCategories.iterator();
-
-            while (pccIter.hasNext()) {
-                GenericValue prodCatalogCategory = pccIter.next();
-
+            for (GenericValue prodCatalogCategory: prodCatalogCategories) {
                 categoryIds.add(prodCatalogCategory.getString("productCategoryId"));
             }
         }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Mon Nov 10 18:20:53 2008
@@ -19,7 +19,6 @@
 package org.ofbiz.product.category;
 
 import java.sql.Timestamp;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -105,9 +104,7 @@
         
 
         if (productId != null && index == null) {
-            Iterator<GenericValue> i = productCategoryMembers.iterator();
-            while (i.hasNext()) {
-                GenericValue v = i.next();
+            for (GenericValue v: productCategoryMembers) {
                 if (v.getString("productId").equals(productId)) {
                     index = Integer.valueOf(productCategoryMembers.indexOf(v));
                 }
@@ -156,9 +153,7 @@
         
         ModelEntity productModel = delegator.getModelEntity("Product");
         ModelEntity productCategoryMemberModel = delegator.getModelEntity("ProductCategoryMember");
-        Iterator<String> orderByFieldIter = orderByFields.iterator();
-        while (orderByFieldIter.hasNext()) {
-            String orderByField = orderByFieldIter.next();
+        for (String orderByField: orderByFields) {
             // Get the real field name from the order by field removing ascending/descending order
             if (UtilValidate.isNotEmpty(orderByField)) {
                 int startPos = 0, endPos = orderByField.length();

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java Mon Nov 10 18:20:53 2008
@@ -19,7 +19,6 @@
 package org.ofbiz.product.category;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -98,10 +97,7 @@
 
             if (allCategories == null)
                 return;
-            Iterator<GenericValue> aciter = allCategories.iterator();
-
-            while (aciter.hasNext()) {
-                GenericValue curCat = aciter.next();
+            for (GenericValue curCat: allCategories) {
                 Collection<GenericValue> parentCats = curCat.getRelatedCache("CurrentProductCategoryRollup");
 
                 if (parentCats == null || parentCats.size() <= 0)
@@ -181,10 +177,7 @@
         }
         if (UtilValidate.isNotEmpty(rollups)) {
             // Debug.log("Rollup size: " + rollups.size(), module);
-            Iterator<GenericValue> ri = rollups.iterator();
-
-            while (ri.hasNext()) {
-                GenericValue parent = ri.next();
+            for (GenericValue parent: rollups) {
                 // Debug.log("Adding child of: " + parent.getString("parentProductCategoryId"), module);
                 GenericValue cv = null;
 
@@ -414,9 +407,7 @@
             List<GenericValue> productAssocs = ProductWorker.getVariantVirtualAssocs(product);
             //this does take into account that a product could be a variant of multiple products, but this shouldn't ever really happen...
             if (UtilValidate.isNotEmpty(productAssocs)) {
-                Iterator<GenericValue> pasIter = productAssocs.iterator();
-                while (pasIter.hasNext()) {
-                    GenericValue productAssoc = pasIter.next();
+                for (GenericValue productAssoc: productAssocs) {
                     if (isProductInCategory(delegator, productAssoc.getString("productId"), productCategoryId)) {
                         return true;
                     }
@@ -439,9 +430,7 @@
         if (productCategoryId == null) return newList;
         if (valueObjects == null) return null;
         
-        Iterator<GenericValue> valIter = valueObjects.iterator();
-        while (valIter.hasNext()) {
-            GenericValue curValue = valIter.next();
+        for (GenericValue curValue: valueObjects) {
             String productId = curValue.getString(productIdFieldName);
             if (isProductInCategory(delegator, productId, productCategoryId)) {
                 newList.add(curValue);
@@ -454,9 +443,7 @@
         if (catContentWrappers == null || categoryList == null) {
             return;
         }
-        Iterator<GenericValue> catIterator = categoryList.iterator();
-        while (catIterator.hasNext()) {
-            GenericValue cat = catIterator.next();
+        for (GenericValue cat: categoryList) {
             String productCategoryId = (String) cat.get("productCategoryId");
             
             if (catContentWrappers.containsKey(productCategoryId)) {

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWorker.java Mon Nov 10 18:20:53 2008
@@ -18,7 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.product.config;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -106,10 +105,10 @@
                 }
                 continue;
             }
-            for (int h = 0; h < opts.length; h++) {
+            for (String opt: opts) {
                 int cnt = -1;
                 try {
-                    cnt = Integer.parseInt(opts[h]);
+                    cnt = Integer.parseInt(opt);
                     String comments = null;
                     ProductConfigWrapper.ConfigItem question = (ProductConfigWrapper.ConfigItem) configWrapper.getQuestions().get(k);
                     if (question.isSingleChoice()) {
@@ -186,18 +185,15 @@
         List<ConfigItem> questions = configWrapper.getQuestions();
         List<GenericValue> configsToCheck = FastList.newInstance();
         int selectedOptionSize = 0;
-        for (int i = 0; i < questions.size(); i++) {
+        for (ConfigItem ci: questions) {
             String configItemId = null;
             Long sequenceNum = null;
             List<ProductConfigWrapper.ConfigOption> selectedOptions = FastList.newInstance();        
-            ConfigItem ci = questions.get(i);
             List<ConfigOption> options = ci.getOptions();
             if (ci.isStandard()) {
                 selectedOptions.addAll(options);
             } else {
-                Iterator<ConfigOption> availOptions = options.iterator();
-                while (availOptions.hasNext()) {
-                    ConfigOption oneOption = availOptions.next();
+                for (ConfigOption oneOption: options) {
                     if (oneOption.isSelected()) {
                         selectedOptions.add(oneOption);
                     }
@@ -210,12 +206,8 @@
                 sequenceNum = ci.getConfigItemAssoc().getLong("sequenceNum");
                 try {
                     List<GenericValue> configs = delegator.findByAnd("ProductConfigConfig", UtilMisc.toMap("configItemId",configItemId,"sequenceNum", sequenceNum));
-                    Iterator<GenericValue> configIt = configs.iterator();
-                    while (configIt.hasNext()) {
-                        GenericValue productConfigConfig = configIt.next();
-                        Iterator<ConfigOption> selOpIt = selectedOptions.iterator();
-                        while (selOpIt.hasNext()) {
-                            ConfigOption oneOption = selOpIt.next();
+                    for (GenericValue productConfigConfig: configs) {
+                        for (ConfigOption oneOption: selectedOptions) {
                             String configOptionId = oneOption.configOption.getString("configOptionId");                            
                             if (productConfigConfig.getString("configOptionId").equals(configOptionId)) {
                                 String comments = oneOption.getComments() != null ? oneOption.getComments() : "";
@@ -233,9 +225,7 @@
             }  
         }
         if (UtilValidate.isNotEmpty(configsToCheck)) {
-            Iterator<GenericValue> ctci = configsToCheck.iterator();
-            while (ctci.hasNext()) {
-                GenericValue productConfigConfig =  ctci.next();
+            for (GenericValue productConfigConfig: configsToCheck) {
                 String tempConfigId = productConfigConfig.getString("configId");
                 try {
                     List<GenericValue> tempResult = delegator.findByAnd("ProductConfigConfig", UtilMisc.toMap("configId",tempConfigId));
@@ -244,18 +234,15 @@
                         if (UtilValidate.isNotEmpty(configOptionProductOptions)) {
                             
                             //  check for variant product equality
-                            for (int i = 0; i < questions.size(); i++) {
+                            for (ConfigItem ci: questions) {
                                 String configItemId = null;
                                 Long sequenceNum = null;
                                 List<ProductConfigWrapper.ConfigOption> selectedOptions = FastList.newInstance();        
-                                ConfigItem ci = questions.get(i);
                                 List<ConfigOption> options = ci.getOptions();
                                 if (ci.isStandard()) {
                                     selectedOptions.addAll(options);
                                 } else {
-                                    Iterator<ConfigOption> availOptions = options.iterator();
-                                    while (availOptions.hasNext()) {
-                                        ConfigOption oneOption = availOptions.next();
+                                    for (ConfigOption oneOption: options) {
                                         if (oneOption.isSelected()) {
                                             selectedOptions.add(oneOption);
                                         }
@@ -313,18 +300,15 @@
         
         //Current configuration is not found in ProductConfigConfig entity. So lets store this one
         boolean nextId = true;
-        for (int i = 0; i < questions.size(); i++) {
+        for (ConfigItem ci: questions) {
             String configItemId = null;
             Long sequenceNum = null;
             List<ProductConfigWrapper.ConfigOption> selectedOptions = FastList.newInstance();        
-            ConfigItem ci = questions.get(i);
             List<ConfigOption> options = ci.getOptions();
            if (ci.isStandard()) {
                 selectedOptions.addAll(options);
             } else {
-                Iterator<ConfigOption> availOptions = options.iterator();
-                while (availOptions.hasNext()) {
-                    ConfigOption oneOption = availOptions.next();
+                for (ConfigOption oneOption: options) {
                     if (oneOption.isSelected()) {
                         selectedOptions.add(oneOption);
                     }
@@ -339,10 +323,8 @@
                 }
                 configItemId = ci.getConfigItemAssoc().getString("configItemId");
                 sequenceNum = ci.getConfigItemAssoc().getLong("sequenceNum");
-                Iterator<ConfigOption> selOpIt = selectedOptions.iterator();
-                while (selOpIt.hasNext()) {
+                for (ConfigOption oneOption: selectedOptions) {
                     List<GenericValue> toBeStored = FastList.newInstance();
-                    ConfigOption oneOption = selOpIt.next();
                     String configOptionId = oneOption.configOption.getString("configOptionId");
                     String description = oneOption.getComments();
                     GenericValue productConfigConfig = delegator.makeValue("ProductConfigConfig");
@@ -355,8 +337,7 @@
 
                     if (oneOption.hasVirtualComponent()) {                        
                         List<GenericValue> components = oneOption.getComponents(); 
-                        for (int j = 0; j < components.size(); j++) {       
-                            GenericValue component = (GenericValue)components.get(j);
+                        for (GenericValue component: components) {
                             if (oneOption.isVirtualComponent(component)) {
                                 String componentOption = (String)oneOption.componentOptions.get(component.getString("productId"));                                
                                 GenericValue configOptionProductOption = delegator.makeValue("ConfigOptionProductOption");

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java Mon Nov 10 18:20:53 2008
@@ -21,7 +21,6 @@
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -82,8 +81,8 @@
         currencyUomId = pcw.currencyUomId;
         delegator = pcw.delegator;
         autoUserLogin = pcw.autoUserLogin;
-        for (int i = 0; i < pcw.questions.size(); i++) {
-            questions.add(new ConfigItem(pcw.questions.get(i)));
+        for (ConfigItem ci: pcw.questions) {
+            questions.add(new ConfigItem(ci));
         }
     }
 
@@ -113,9 +112,8 @@
             List<GenericValue> questionsValues = delegator.findByAnd("ProductConfig", UtilMisc.toMap("productId", productId), UtilMisc.toList("sequenceNum"));
             questionsValues = EntityUtil.filterByDate(questionsValues);
             Set<String> itemIds = FastSet.newInstance();
-            Iterator<GenericValue> questionsValuesIt = questionsValues.iterator();
-            while (questionsValuesIt.hasNext()) {
-                ConfigItem oneQuestion = new ConfigItem(questionsValuesIt.next());
+            for (GenericValue questionsValue: questionsValues) {
+                ConfigItem oneQuestion = new ConfigItem(questionsValue);
                 oneQuestion.setContent(locale, "text/html"); // TODO: mime-type shouldn't be hardcoded
                 if (itemIds.contains(oneQuestion.getConfigItem().getString("configItemId"))) {
                     oneQuestion.setFirst(false);
@@ -124,9 +122,8 @@
                 }
                 questions.add(oneQuestion);
                 List<GenericValue> configOptions = delegator.findByAnd("ProductConfigOption", UtilMisc.toMap("configItemId", oneQuestion.getConfigItemAssoc().getString("configItemId")), UtilMisc.toList("sequenceNum"));
-                Iterator<GenericValue> configOptionsIt = configOptions.iterator();
-                while (configOptionsIt.hasNext()) {
-                    ConfigOption option = new ConfigOption(delegator, dispatcher, configOptionsIt.next(), oneQuestion, catalogId, webSiteId, currencyUomId, autoUserLogin);
+                for (GenericValue configOption: configOptions) {
+                    ConfigOption option = new ConfigOption(delegator, dispatcher, configOption, oneQuestion, catalogId, webSiteId, currencyUomId, autoUserLogin);
                     oneQuestion.addOption(option);
                 }
             }
@@ -140,9 +137,7 @@
             this.configId = configId;
             List<GenericValue> productConfigConfig = delegator.findByAnd("ProductConfigConfig", UtilMisc.toMap("configId", configId));
             if (UtilValidate.isNotEmpty(productConfigConfig)) {
-                Iterator<GenericValue> pccIt = productConfigConfig.iterator();
-                while (pccIt.hasNext()) {
-                    GenericValue pcc = pccIt.next();
+                for (GenericValue pcc: productConfigConfig) {
                     String configItemId = pcc.getString("configItemId");
                     String configOptionId = pcc.getString("configOptionId");
                     Long sequenceNum = pcc.getLong("sequenceNum");
@@ -170,12 +165,10 @@
     }    
     
     public void resetConfig() {
-        for (int i = 0; i < questions.size(); i++) {
-            ConfigItem ci = questions.get(i);
+        for (ConfigItem ci: questions) {
             if (!ci.isStandard()) {
                 List<ConfigOption> options = ci.getOptions();
-                for (int j = 0; j < options.size(); j++) {
-                    ConfigOption co = options.get(j);
+                for (ConfigOption co: options) {
                     co.setSelected(false);
                     co.setComments(null);
                 }
@@ -185,8 +178,7 @@
     
     public void setDefaultConfig() {
         resetConfig();
-        for (int i = 0; i < questions.size(); i++) {
-            ConfigItem ci = questions.get(i);
+        for (ConfigItem ci: questions) {
             if (ci.isMandatory()) {
                 ConfigOption co = ci.getDefault();
                 if(co != null){
@@ -275,14 +267,11 @@
     
     public List<ConfigOption> getSelectedOptions() {
         List<ConfigOption> selectedOptions = FastList.newInstance();
-        for (int i = 0; i < questions.size(); i++) {
-            ConfigItem ci = questions.get(i);
+        for (ConfigItem ci: questions) {
             if (ci.isStandard()) {
                 selectedOptions.addAll(ci.getOptions());
             } else {
-                Iterator<ConfigOption> availOptions = ci.getOptions().iterator();
-                while (availOptions.hasNext()) {
-                    ConfigOption oneOption = availOptions.next();
+                for (ConfigOption oneOption: ci.getOptions()) {
                     if (oneOption.isSelected()) {
                         selectedOptions.add(oneOption);
                     }
@@ -294,8 +283,7 @@
 
     public List<ConfigOption> getDefaultOptions() {
         List<ConfigOption> defaultOptions = FastList.newInstance();
-        for (int i = 0; i < questions.size(); i++) {
-            ConfigItem ci = questions.get(i);
+        for (ConfigItem ci: questions) {
             ConfigOption co = ci.getDefault();
             if (co != null){
                 defaultOptions.add(co);
@@ -307,8 +295,7 @@
     public double getTotalPrice() {
         double totalPrice = basePrice;
         List<ConfigOption> options = getSelectedOptions();
-        for (int i = 0; i < options.size(); i++) {
-            ConfigOption oneOption = options.get(i);
+        for (ConfigOption oneOption: options) {
             totalPrice += oneOption.getPrice();
         }
         return totalPrice;
@@ -317,8 +304,7 @@
     private void setDefaultPrice() {
         double totalPrice = basePrice;
         List<ConfigOption> options = getDefaultOptions();
-        for (int i = 0; i < options.size(); i++) {
-            ConfigOption oneOption = options.get(i);
+        for (ConfigOption oneOption: options) {
             totalPrice += oneOption.getPrice();
         }
         defaultPrice = totalPrice;
@@ -330,12 +316,10 @@
     
     public boolean isCompleted() {
         boolean completed = true;
-        for (int i = 0; i < questions.size(); i++) {
-            ConfigItem ci = questions.get(i);
+        for (ConfigItem ci: questions) {
             if (!ci.isStandard() && ci.isMandatory()) {
-                Iterator<ConfigOption> availOptions = ci.getOptions().iterator();
-                while (availOptions.hasNext()) {
-                    ConfigOption oneOption = availOptions.next();
+                List<ConfigOption> availOptions = ci.getOptions();
+                for (ConfigOption oneOption: availOptions) {
                     if (oneOption.isSelected()) {
                         completed = true;
                         break;
@@ -381,8 +365,8 @@
             configItem = GenericValue.create(ci.configItem);
             configItemAssoc = GenericValue.create(ci.configItemAssoc);
             options = FastList.newInstance();
-            for (int i = 0; i < ci.options.size(); i++) {
-                options.add(new ConfigOption(ci.options.get(i)));
+            for (ConfigOption co: ci.options) {
+                options.add(new ConfigOption(co));
             }
             first = ci.first;
             content = ci.content; // FIXME: this should be cloned
@@ -462,9 +446,7 @@
 
         public boolean isSelected() {
             if (isStandard()) return true;
-            Iterator<ConfigOption> availOptions = getOptions().iterator();
-            while (availOptions.hasNext()) {
-                ConfigOption oneOption = availOptions.next();
+            for (ConfigOption oneOption: getOptions()) {
                 if (oneOption.isSelected()) {
                     return true;
                 }
@@ -473,9 +455,7 @@
         }
         
         public ConfigOption getSelected() {
-            Iterator<ConfigOption> availOptions = getOptions().iterator();
-            while (availOptions.hasNext()) {
-                ConfigOption oneOption = availOptions.next();
+            for (ConfigOption oneOption: getOptions()) {
                 if (oneOption.isSelected()) {
                     return oneOption;
                 }
@@ -537,10 +517,8 @@
             configOption = option;
             parentConfigItem = configItem;
             componentList = option.getRelated("ConfigOptionProductConfigProduct");
-            Iterator<GenericValue> componentsIt = componentList.iterator();
-            while (componentsIt.hasNext()) {
+            for (GenericValue oneComponent: componentList) {
                 double price = 0;
-                GenericValue oneComponent = componentsIt.next();
                 // Get the component's price
                 Map<String, Object> fieldMap = UtilMisc.toMap("product", oneComponent.getRelatedOne("ProductProduct"), "prodCatalogId", catalogId, "webSiteId", webSiteId,
                         "currencyUomId", currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", autoUserLogin);
@@ -572,8 +550,8 @@
         public ConfigOption(ConfigOption co) {
             configOption = GenericValue.create(co.configOption);
             componentList = FastList.newInstance();
-            for (int i = 0; i < co.componentList.size(); i++) {
-                componentList.add(GenericValue.create(co.componentList.get(i)));
+            for (GenericValue component: co.componentList) {
+                componentList.add(GenericValue.create(component));
             }
             optionPrice = co.optionPrice;
             available = co.available;
@@ -583,10 +561,8 @@
         
         public void recalculateOptionPrice(ProductConfigWrapper pcw) throws Exception {
             optionPrice = 0;
-            Iterator<GenericValue> componentsIt = componentList.iterator();
-            while (componentsIt.hasNext()) {
+            for (GenericValue oneComponent: componentList) {
                 double price = 0;
-                GenericValue oneComponent = componentsIt.next();
                 GenericValue oneComponentProduct = oneComponent.getRelatedOne("ProductProduct");        
                 String variantProductId = componentOptions.get(oneComponent.getString("productId"));        
                 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ParametricSearch.java Mon Nov 10 18:20:53 2008
@@ -18,7 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.product.feature;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -66,13 +65,9 @@
             List<GenericValue> productFeatureCategoryAppls = delegator.findByAndCache("ProductFeatureCategoryAppl", UtilMisc.toMap("productCategoryId", productCategoryId));
             productFeatureCategoryAppls = EntityUtil.filterByDate(productFeatureCategoryAppls, true);
             if (productFeatureCategoryAppls != null) { 
-                Iterator<GenericValue> pfcasIter = productFeatureCategoryAppls.iterator();
-                while (pfcasIter.hasNext()) {
-                    GenericValue productFeatureCategoryAppl = pfcasIter.next();
+                for (GenericValue productFeatureCategoryAppl: productFeatureCategoryAppls) {
                     List<GenericValue> productFeatures = delegator.findByAndCache("ProductFeature", UtilMisc.toMap("productFeatureCategoryId", productFeatureCategoryAppl.get("productFeatureCategoryId")));
-                    Iterator<GenericValue> pfsIter = productFeatures.iterator();
-                    while (pfsIter.hasNext()) {
-                        GenericValue productFeature = pfsIter.next();
+                    for (GenericValue productFeature: productFeatures) {
                         String productFeatureTypeId = productFeature.getString("productFeatureTypeId");
                         Map<String, GenericValue> featuresByType = productFeaturesByTypeMap.get(productFeatureTypeId);
                         if (featuresByType == null) {
@@ -93,13 +88,9 @@
             List<GenericValue> productFeatureCatGrpAppls = delegator.findByAndCache("ProductFeatureCatGrpAppl", UtilMisc.toMap("productCategoryId", productCategoryId));
             productFeatureCatGrpAppls = EntityUtil.filterByDate(productFeatureCatGrpAppls, true);
             if (productFeatureCatGrpAppls != null) { 
-                Iterator<GenericValue> pfcgasIter = productFeatureCatGrpAppls.iterator();
-                while (pfcgasIter.hasNext()) {
-                    GenericValue productFeatureCatGrpAppl = pfcgasIter.next();
+                for (GenericValue productFeatureCatGrpAppl: productFeatureCatGrpAppls) {
                     List<GenericValue> productFeatureGroupAppls = delegator.findByAndCache("ProductFeatureGroupAppl", UtilMisc.toMap("productFeatureGroupId", productFeatureCatGrpAppl.get("productFeatureGroupId")));
-                    Iterator<GenericValue> pfgaasIter = productFeatureGroupAppls.iterator();
-                    while (pfgaasIter.hasNext()) {
-                        GenericValue productFeatureGroupAppl = pfgaasIter.next();
+                    for (GenericValue productFeatureGroupAppl: productFeatureGroupAppls) {
                         GenericValue productFeature = delegator.findByPrimaryKeyCache("ProductFeature", UtilMisc.toMap("productFeatureId", productFeatureGroupAppl.get("productFeatureId")));
                         
                         String productFeatureTypeId = productFeature.getString("productFeatureTypeId");
@@ -120,9 +111,7 @@
            
         // now before returning, order the features in each list by description
         Map<String, List<GenericValue>> productFeaturesByTypeMapSorted = FastMap.newInstance();
-        Iterator<Map.Entry<String, Map<String, GenericValue>>> productFeatureTypeEntries = productFeaturesByTypeMap.entrySet().iterator();
-        while (productFeatureTypeEntries.hasNext()) {
-            Map.Entry<String, Map<String, GenericValue>> entry = productFeatureTypeEntries.next();
+        for (Map.Entry<String, Map<String, GenericValue>> entry: productFeaturesByTypeMap.entrySet()) {
             List<GenericValue> sortedFeatures = EntityUtil.orderBy(entry.getValue().values(), UtilMisc.toList("description"));
             productFeaturesByTypeMapSorted.put(entry.getKey(), sortedFeatures);
         }
@@ -173,12 +162,11 @@
         if (parameters == null) return featureIdByType;
         
 
-        Iterator<String> parameterNameIter = parameters.keySet().iterator();
-        while (parameterNameIter.hasNext()) {
-            String parameterName = parameterNameIter.next();
+        for (Map.Entry<String, Object> entry: parameters.entrySet()) {
+            String parameterName = entry.getKey();
             if (parameterName.startsWith("pft_")) {
                 String productFeatureTypeId = parameterName.substring(4);
-                String productFeatureId = (String) parameters.get(parameterName);
+                String productFeatureId = (String) entry.getValue();
                 if (productFeatureId != null && productFeatureId.length() > 0) {
                     featureIdByType.put(productFeatureTypeId, productFeatureId);
                 }
@@ -193,11 +181,10 @@
         List<String> featureIdList = FastList.newInstance();
         if (parameters == null) return featureIdList;
         
-        Iterator<String> parameterNameIter = parameters.keySet().iterator();
-        while (parameterNameIter.hasNext()) {
-            String parameterName = parameterNameIter.next();
+        for (Map.Entry<String, Object> entry: parameters.entrySet()) {
+            String parameterName = entry.getKey();
             if (parameterName.startsWith("SEARCH_FEAT")) {
-                String productFeatureId = (String) parameters.get(parameterName);
+                String productFeatureId = (String) entry.getValue();
                 if (productFeatureId != null && productFeatureId.length() > 0) {
                     featureIdList.add(productFeatureId);
                 }
@@ -213,9 +200,7 @@
         }
         
         StringBuilder outSb = new StringBuilder();
-        Iterator<Map.Entry<String, String>> fbtIter = featureIdByType.entrySet().iterator();
-        while (fbtIter.hasNext()) {
-            Map.Entry<String, String> entry = fbtIter.next();
+        for (Map.Entry<String, String> entry: featureIdByType.entrySet()) {
             if (outSb.length() > 0) {
                 outSb.append('&');
             }
@@ -238,11 +223,10 @@
         List<String> prodFeatureCategoryIdList = FastList.newInstance();
         if (parameters == null) return prodFeatureCategoryIdList;
         
-        Iterator<String> parameterNameIter = parameters.keySet().iterator();
-        while (parameterNameIter.hasNext()) {
-            String parameterName = parameterNameIter.next();
+        for (Map.Entry<String, Object> entry: parameters.entrySet()) {
+            String parameterName = entry.getKey();
             if (parameterName.startsWith("SEARCH_PROD_FEAT_CAT")) {
-                String productFeatureCategoryId = (String) parameters.get(parameterName);
+                String productFeatureCategoryId = (String) entry.getValue();
                 if (productFeatureCategoryId != null && productFeatureCategoryId.length() > 0) {
                    prodFeatureCategoryIdList.add(productFeatureCategoryId);
                 }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ProductFeatureServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ProductFeatureServices.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ProductFeatureServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/feature/ProductFeatureServices.java Mon Nov 10 18:20:53 2008
@@ -18,7 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.product.feature;
 
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -99,9 +98,7 @@
                 
             List<String> featureTypes = FastList.newInstance();
             Map<String, List<GenericValue>> featuresByType = new LinkedHashMap<String, List<GenericValue>>();
-            GenericValue feature = null;
-            for (Iterator<GenericValue> featuresIter = allFeatures.iterator(); featuresIter.hasNext(); ) {
-                feature = featuresIter.next();
+            for (GenericValue feature: allFeatures) {
                 String featureType = feature.getString("productFeatureTypeId");
                 if (!featureTypes.contains(featureType)) {
                     featureTypes.add(featureType);
@@ -143,15 +140,11 @@
              * it qualifies and add it to the list of existingVariantProductIds.
              */
             List<GenericValue> productAssocs = EntityUtil.filterByDate(delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT")));
-            Iterator<GenericValue> productAssocIter = productAssocs.iterator();
-            while (productAssocIter.hasNext()) {
-                GenericEntity productAssoc = productAssocIter.next();
+            for (GenericValue productAssoc: productAssocs) {
 
                 //for each associated product, if it has all standard features, display it's productId
                 boolean hasAllFeatures = true;
-                Iterator<String> curProductFeatureAndApplIter = curProductFeatureAndAppls.iterator();
-                while (curProductFeatureAndApplIter.hasNext()) {
-                    String productFeatureAndAppl = curProductFeatureAndApplIter.next();
+                for (String productFeatureAndAppl: curProductFeatureAndAppls) {
                     Map<String, String> findByMap = UtilMisc.toMap("productId", productAssoc.getString("productIdTo"), 
                             "productFeatureId", productFeatureAndAppl,
                             "productFeatureApplTypeId", "STANDARD_FEATURE");
@@ -208,9 +201,9 @@
             List<Map<String, Object>> oldCombinations = FastList.newInstance();
             
             // loop through each feature type
-            for (Iterator<String> fi = features.keySet().iterator(); fi.hasNext(); ) {
-                String currentFeatureType = fi.next();
-                List<GenericValue> currentFeatures = features.get(currentFeatureType);
+            for (Map.Entry<String, List<GenericValue>> entry: features.entrySet()) {
+                String currentFeatureType = entry.getKey();
+                List<GenericValue> currentFeatures = entry.getValue();
                 
                 List<Map<String, Object>> newCombinations = FastList.newInstance();
                 List<Map<String, Object>> combinations;
@@ -227,8 +220,7 @@
                 // of the next variant.  just a matter of whether we're starting with an
                 // existing list of features and id code or from scratch.
                 if (combinations.size()==0) {
-                    for (Iterator<GenericValue> cFi = currentFeatures.iterator(); cFi.hasNext(); ) {
-                        GenericValue currentFeature = cFi.next();
+                    for (GenericValue currentFeature: currentFeatures) {
                         if (currentFeature.getString("productFeatureApplTypeId").equals("SELECTABLE_FEATURE")) {
                             Map<String, Object> newCombination = FastMap.newInstance();
                             List<GenericValue> newFeatures = FastList.newInstance();
@@ -246,10 +238,8 @@
                         }
                     }
                 } else {
-                    for (Iterator<Map<String, Object>> comboIt = combinations.iterator(); comboIt.hasNext(); ) {
-                        Map<String, Object> combination = comboIt.next();
-                        for (Iterator<GenericValue> cFi = currentFeatures.iterator(); cFi.hasNext(); ) {
-                            GenericValue currentFeature = cFi.next();
+                    for (Map<String, Object> combination: combinations) {
+                        for (GenericValue currentFeature: currentFeatures) {
                             if (currentFeature.getString("productFeatureApplTypeId").equals("SELECTABLE_FEATURE")) {
                                 Map<String, Object> newCombination = FastMap.newInstance();
                                 // .clone() is important, or you'll keep adding to the same List for all the variants
@@ -280,8 +270,7 @@
             defaultVariantProductIds.add(productId);
             
             // now figure out which of these combinations already have productIds associated with them
-            for (Iterator<Map<String, Object>> fCi = oldCombinations.iterator(); fCi.hasNext(); ) {
-                Map<String, Object> combination = fCi.next();
+            for (Map<String, Object> combination: oldCombinations) {
                 // Verify if the default code is already used, if so add a numeric suffix
                 if (defaultVariantProductIds.contains((String) combination.get("defaultVariantProductId"))) {
                     combination.put("defaultVariantProductId", combination.get("defaultVariantProductId") + (defaultCodeCounter < 10? "0" + defaultCodeCounter: "" + defaultCodeCounter));
@@ -326,15 +315,13 @@
         if ((memberProducts != null) && (memberProducts.size() > 0)) {
             // construct a Map of productFeatureTypeId -> productFeatureId from the productFeatures List
             Map<String, String> featuresByType = FastMap.newInstance();
-            for (Iterator<GenericValue> pFi = productFeatures.iterator(); pFi.hasNext(); ) {
-                GenericValue nextFeature = pFi.next();
+            for (GenericValue nextFeature: productFeatures) {
                 featuresByType.put(nextFeature.getString("productFeatureTypeId"), nextFeature.getString("productFeatureId"));
             }
 
             List<GenericValue> products = FastList.newInstance();  // final list of variant products  
-            for (Iterator<GenericValue> mPi = memberProducts.iterator(); mPi.hasNext(); ) {
+            for (GenericValue memberProduct: memberProducts) {
                 // find variants for each member product of the category
-                GenericValue memberProduct = mPi.next();
 
                 try {
                     result = dispatcher.runSync("getProductVariant", UtilMisc.toMap("productId", memberProduct.getString("productId"), "selectedFeatures", featuresByType));

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Mon Nov 10 18:20:53 2008
@@ -20,7 +20,6 @@
 
 import java.sql.Timestamp;
 import java.util.Calendar;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -375,9 +374,7 @@
         
         Debug.log("OOS Inventory Items: " + inventoryItems.size(), module);
         
-        Iterator<GenericValue> itemsIter = inventoryItems.iterator();
-        while (itemsIter.hasNext()) {
-            GenericValue inventoryItem = itemsIter.next();
+        for (GenericValue inventoryItem: inventoryItems) {
             // get the incomming shipment information for the item
             List<GenericValue> shipmentAndItems = null;
             try {
@@ -414,9 +411,7 @@
             double availableBeforeReserved = inventoryItem.getDouble("availableToPromiseTotal").doubleValue();
             
             // go through all the reservations in order
-            Iterator<GenericValue> ri = reservations.iterator();
-            while (ri.hasNext()) {
-                GenericValue reservation = ri.next();
+            for (GenericValue reservation: reservations) {
                 String orderId = reservation.getString("orderId");
                 String orderItemSeqId = reservation.getString("orderItemSeqId");
                 Timestamp promisedDate = reservation.getTimestamp("promisedDatetime");
@@ -436,9 +431,7 @@
                 // find the next possible ship date
                 Timestamp nextShipDate = null;
                 double availableAtTime = 0.00;
-                Iterator<GenericValue> si = shipmentAndItems.iterator();
-                while (si.hasNext()) {
-                    GenericValue shipmentItem = si.next();
+                for (GenericValue shipmentItem: shipmentAndItems) {
                     availableAtTime += shipmentItem.getDouble("quantity").doubleValue();
                     if (availableAtTime >= availableBeforeReserved) {
                         nextShipDate = shipmentItem.getTimestamp("estimatedArrivalDate");
@@ -519,11 +512,9 @@
                
         // all items to cancel will also be in the notify list so start with that
         List<String> ordersToNotify = FastList.newInstance();
-        Set<String> orderSet = ordersToUpdate.keySet();
-        Iterator<String> orderIter = orderSet.iterator();
-        while (orderIter.hasNext()) {
-            String orderId = orderIter.next();
-            Map<String, Timestamp> backOrderedItems = ordersToUpdate.get(orderId);
+        for (Map.Entry<String, Map<String, Timestamp>> entry: ordersToUpdate.entrySet()) {
+            String orderId = entry.getKey();
+            Map<String, Timestamp> backOrderedItems = entry.getValue();
             Map<String, Timestamp> cancelItems = ordersToCancel.get(orderId);
             boolean cancelAll = false;
             Timestamp cancelAllTime = null;
@@ -536,9 +527,7 @@
                 Debug.logError(e, "Cannot get OrderItemShipGroups from orderId" + orderId, module);
             }
             
-            Iterator<GenericValue> orderItemShipGroupsIter = orderItemShipGroups.iterator();
-            while (orderItemShipGroupsIter.hasNext()) {
-                GenericValue orderItemShipGroup = orderItemShipGroupsIter.next();
+            for (GenericValue orderItemShipGroup: orderItemShipGroups) {
                 List<GenericValue> orderItems = FastList.newInstance();
                 List<GenericValue> orderItemShipGroupAssoc = null;
                 try {                    
@@ -549,9 +538,7 @@
                                         "orderId",
                                         orderId));
                     
-                    Iterator<GenericValue> assocIter = orderItemShipGroupAssoc.iterator();
-                    while (assocIter.hasNext()) {
-                        GenericValue assoc = assocIter.next();
+                    for (GenericValue assoc: orderItemShipGroupAssoc) {
                         GenericValue orderItem = assoc.getRelatedOne("OrderItem");
                         if (orderItem != null) {
                             orderItems.add(orderItem);
@@ -582,9 +569,7 @@
                 
                 if (orderItems != null) {            
                     List<GenericValue> toBeStored = FastList.newInstance();
-                    Iterator<GenericValue> orderItemsIter = orderItems.iterator();
-                    while (orderItemsIter.hasNext()) {
-                        GenericValue orderItem = orderItemsIter.next();
+                    for (GenericValue orderItem: orderItems) {
                         String orderItemSeqId = orderItem.getString("orderItemSeqId");
                         Timestamp shipDate = (Timestamp) backOrderedItems.get(orderItemSeqId);
                         Timestamp cancelDate = (Timestamp) cancelItems.get(orderItemSeqId);
@@ -624,10 +609,7 @@
         }
         
         // send off a notification for each order        
-        Iterator<String> orderNotifyIter = ordersToNotify.iterator();
-        while (orderNotifyIter.hasNext()) {                       
-            String orderId = orderNotifyIter.next();                                  
-            
+        for (String orderId: ordersToNotify) {
             try {
                 dispatcher.runAsync("sendOrderBackorderNotification", UtilMisc.<String, Object>toMap("orderId", orderId, "userLogin", userLogin));
             } catch (GenericServiceException e) {
@@ -658,8 +640,7 @@
            double minAvailableToPromiseTotal = Double.MAX_VALUE;
            
            // loop through each associated product.  
-           for (int i = 0; productAssocList.size() > i; i++) {
-               GenericValue productAssoc = productAssocList.get(i);
+           for (GenericValue productAssoc: productAssocList) {
                String productIdTo = productAssoc.getString("productIdTo");
                Double assocQuantity = productAssoc.getDouble("quantity");
                
@@ -739,9 +720,7 @@
         }
 
         // loop through all the order items
-        Iterator<GenericValue> iter = orderItems.iterator();
-        while (iter.hasNext()) {
-            GenericValue orderItem = iter.next();
+        for (GenericValue orderItem: orderItems) {
             String productId = orderItem.getString("productId");
 
             if ((productId == null) || productId.equals("")) continue;
@@ -758,11 +737,9 @@
             double qoh = 0.0;
             double mktgPkgAtp = 0.0;
             double mktgPkgQoh = 0.0;
-            Iterator<GenericValue> facilityIter = facilities.iterator();
 
             // loop through all the facilities
-            while (facilityIter.hasNext()) {
-                GenericValue facility = facilityIter.next();
+            for (GenericValue facility: facilities) {
                 Map<String, Object> invResult = null;
                 Map<String, Object> mktgPkgInvResult = null;
 
@@ -877,10 +854,8 @@
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
-        Iterator<GenericValue> pricesIt = productPrices.iterator();
         //change this for product price
-        while (pricesIt.hasNext()) {
-            GenericValue onePrice = pricesIt.next();
+        for (GenericValue onePrice: productPrices) {
             if(onePrice.getString("productPriceTypeId").equals("DEFAULT_PRICE")){ //defaultPrice
                 result.put("defultPrice", onePrice.getDouble("price"));
             }else if(onePrice.getString("productPriceTypeId").equals("WHOLESALE_PRICE")){//

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java Mon Nov 10 18:20:53 2008
@@ -20,7 +20,6 @@
 package org.ofbiz.product.inventory;
 
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -78,8 +77,7 @@
         if (UtilValidate.isEmpty(purchaseOrders)) {
             return qty;
         } else {
-            for (Iterator<GenericValue> pOi = purchaseOrders.iterator(); pOi.hasNext();) {
-                GenericValue nextOrder = pOi.next();
+            for (GenericValue nextOrder: purchaseOrders) {
                 if (nextOrder.get("quantity") != null) {
                     double itemQuantity = nextOrder.getDouble("quantity").doubleValue();
                     double cancelQuantity = 0.0;
@@ -125,8 +123,7 @@
         Map<String, Double> results = FastMap.newInstance();
         try {
             List<GenericValue> orderedProducts = delegator.findList("OrderItemQuantityReportGroupByProduct", conditions, fieldsToSelect, null, null, false);
-            for (Iterator<GenericValue> iter = orderedProducts.iterator(); iter.hasNext(); ) {
-                GenericValue value = iter.next();
+            for (GenericValue value: orderedProducts) {
                 results.put(value.getString("productId"), value.getDouble("quantityOpen"));
             }
         } catch (GenericEntityException e) {

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Mon Nov 10 18:20:53 2008
@@ -21,7 +21,6 @@
 import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
@@ -367,12 +366,10 @@
                 //use the cache to find the variant with the lowest default price
                 try {
                     List<GenericValue> variantAssocList = EntityUtil.filterByDate(delegator.findByAndCache("ProductAssoc", UtilMisc.toMap("productId", product.get("productId"), "productAssocTypeId", "PRODUCT_VARIANT"), UtilMisc.toList("-fromDate")));
-                    Iterator<GenericValue> variantAssocIter = variantAssocList.iterator();
                     double minDefaultPrice = Double.MAX_VALUE;
                     List<GenericValue> variantProductPrices = null;
                     String variantProductId = null;
-                    while (variantAssocIter.hasNext()) {
-                        GenericValue variantAssoc = variantAssocIter.next();
+                    for (GenericValue variantAssoc: variantAssocList) {
                         String curVariantProductId = variantAssoc.getString("productIdTo");
                         List<GenericValue> curVariantPriceList = EntityUtil.filterByDate(delegator.findByAndCache("ProductPrice", UtilMisc.toMap("productId", curVariantProductId), UtilMisc.toList("-fromDate")), nowTimestamp);
                         List<GenericValue> tempDefaultPriceList = EntityUtil.filterByAnd(curVariantPriceList, UtilMisc.toMap("productPriceTypeId", "DEFAULT_PRICE"));
@@ -568,17 +565,13 @@
                     // split into list with quantity conditions and list without, then iterate through each quantity cond one
                     quantityProductPriceRules = FastList.newInstance();
                     nonQuantityProductPriceRules = FastList.newInstance();
-                    Iterator<GenericValue> productPriceRulesIter = allProductPriceRules.iterator();
-                    while (productPriceRulesIter.hasNext()) {
-                        GenericValue productPriceRule = productPriceRulesIter.next();
+                    for (GenericValue productPriceRule: allProductPriceRules) {
                         List<GenericValue> productPriceCondList = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("productPriceRuleId", productPriceRule.get("productPriceRuleId")));
                         
                         boolean foundQuantityInputParam = false;
                         // only consider a rule if all conditions except the quantity condition are true
                         boolean allExceptQuantTrue = true;
-                        Iterator<GenericValue> productPriceCondIter = productPriceCondList.iterator();
-                        while (productPriceCondIter.hasNext()) {
-                            GenericValue productPriceCond = productPriceCondIter.next();
+                        for (GenericValue productPriceCond: productPriceCondList) {
                             if ("PRIP_QUANTITY".equals(productPriceCond.getString("inputParamEnumId"))) {
                                 foundQuantityInputParam = true;
                             } else {
@@ -601,10 +594,7 @@
                     
                     // if findAllQuantityPrices then iterate through quantityProductPriceRules
                     // foreach create an entry in the out list and eval that rule and all nonQuantityProductPriceRules rather than a single rule
-                    Iterator<GenericValue> quantityProductPriceRuleIter = quantityProductPriceRules.iterator();
-                    while (quantityProductPriceRuleIter.hasNext()) {
-                        GenericValue quantityProductPriceRule = quantityProductPriceRuleIter.next();
-
+                    for (GenericValue quantityProductPriceRule: quantityProductPriceRules) {
                         List<GenericValue> ruleListToUse = FastList.newInstance();
                         ruleListToUse.add(quantityProductPriceRule);
                         ruleListToUse.addAll(nonQuantityProductPriceRules);
@@ -741,9 +731,7 @@
             // note that we always want to put the category, quantity, etc ones that find all rules with these conditions in separate cache lists so that they can be easily cleared
             Collection<GenericValue> productCategoryIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PROD_CAT_ID"));
             if (UtilValidate.isNotEmpty(productCategoryIdConds)) {
-                Iterator<GenericValue> productCategoryIdCondsIter = productCategoryIdConds.iterator();
-                while (productCategoryIdCondsIter.hasNext()) {
-                    GenericValue productCategoryIdCond = productCategoryIdCondsIter.next();
+                for (GenericValue productCategoryIdCond: productCategoryIdConds) {
                     productPriceRuleIds.add(productCategoryIdCond.getString("productPriceRuleId"));
                 }
             }
@@ -751,9 +739,7 @@
             // by productFeatureId
             Collection<GenericValue> productFeatureIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PROD_FEAT_ID"));
             if (UtilValidate.isNotEmpty(productFeatureIdConds)) {
-                Iterator<GenericValue> productFeatureIdCondsIter = productFeatureIdConds.iterator();
-                while (productFeatureIdCondsIter.hasNext()) {
-                    GenericValue productFeatureIdCond = productFeatureIdCondsIter.next();
+                for (GenericValue productFeatureIdCond: productFeatureIdConds) {
                     productPriceRuleIds.add(productFeatureIdCond.getString("productPriceRuleId"));
                 }
             }
@@ -763,9 +749,7 @@
             // but, no we'll do it the other way, any that have a quantity will always get compared
             Collection<GenericValue> quantityConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_QUANTITY"));
             if (UtilValidate.isNotEmpty(quantityConds)) {
-                Iterator<GenericValue> quantityCondsIter = quantityConds.iterator();
-                while (quantityCondsIter.hasNext()) {
-                    GenericValue quantityCond = quantityCondsIter.next();
+                for (GenericValue quantityCond: quantityConds) {
                     productPriceRuleIds.add(quantityCond.getString("productPriceRuleId"));
                 }
             }
@@ -773,9 +757,7 @@
             // by roleTypeId
             Collection<GenericValue> roleTypeIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_ROLE_TYPE"));
             if (UtilValidate.isNotEmpty(roleTypeIdConds)) {
-                Iterator<GenericValue> roleTypeIdCondsIter = roleTypeIdConds.iterator();
-                while (roleTypeIdCondsIter.hasNext()) {
-                    GenericValue roleTypeIdCond = roleTypeIdCondsIter.next();
+                for (GenericValue roleTypeIdCond: roleTypeIdConds) {
                     productPriceRuleIds.add(roleTypeIdCond.getString("productPriceRuleId"));
                 }
             }
@@ -787,9 +769,7 @@
             // by listPrice
             Collection<GenericValue> listPriceConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_LIST_PRICE"));
             if (UtilValidate.isNotEmpty(listPriceConds)) {
-                Iterator<GenericValue> listPriceCondsIter = listPriceConds.iterator();
-                while (listPriceCondsIter.hasNext()) {
-                    GenericValue listPriceCond = listPriceCondsIter.next();
+                for (GenericValue listPriceCond: listPriceConds) {
                     productPriceRuleIds.add(listPriceCond.getString("productPriceRuleId"));
                 }
             }
@@ -799,9 +779,7 @@
             // by productId
             Collection<GenericValue> productIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PRODUCT_ID", "condValue", productId));
             if (UtilValidate.isNotEmpty(productIdConds)) {
-                Iterator<GenericValue> productIdCondsIter = productIdConds.iterator();
-                while (productIdCondsIter.hasNext()) {
-                    GenericValue productIdCond = productIdCondsIter.next();
+                for (GenericValue productIdCond: productIdConds) {
                     productPriceRuleIds.add(productIdCond.getString("productPriceRuleId"));
                 }
             }
@@ -810,9 +788,7 @@
             if (virtualProductId != null) {
                 Collection<GenericValue> virtualProductIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PRODUCT_ID", "condValue", virtualProductId));
                 if (UtilValidate.isNotEmpty(virtualProductIdConds)) {
-                    Iterator<GenericValue> virtualProductIdCondsIter = virtualProductIdConds.iterator();
-                    while (virtualProductIdCondsIter.hasNext()) {
-                        GenericValue virtualProductIdCond = virtualProductIdCondsIter.next();
+                    for (GenericValue virtualProductIdCond: virtualProductIdConds) {
                         productPriceRuleIds.add(virtualProductIdCond.getString("productPriceRuleId"));
                     }
                 }
@@ -822,9 +798,7 @@
             if (UtilValidate.isNotEmpty(prodCatalogId)) {
                 Collection<GenericValue> prodCatalogIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PROD_CLG_ID", "condValue", prodCatalogId));
                 if (UtilValidate.isNotEmpty(prodCatalogIdConds)) {
-                    Iterator<GenericValue> prodCatalogIdCondsIter = prodCatalogIdConds.iterator();
-                    while (prodCatalogIdCondsIter.hasNext()) {
-                        GenericValue prodCatalogIdCond = prodCatalogIdCondsIter.next();
+                    for (GenericValue prodCatalogIdCond: prodCatalogIdConds) {
                         productPriceRuleIds.add(prodCatalogIdCond.getString("productPriceRuleId"));
                     }
                 }
@@ -834,9 +808,7 @@
             if (UtilValidate.isNotEmpty(productStoreGroupId)) {
                 Collection<GenericValue> storeGroupConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PROD_SGRP_ID", "condValue", productStoreGroupId));
                 if (UtilValidate.isNotEmpty(storeGroupConds)) {
-                    Iterator<GenericValue> storeGroupCondsIter = storeGroupConds.iterator();
-                    while (storeGroupCondsIter.hasNext()) {
-                        GenericValue storeGroupCond = storeGroupCondsIter.next();
+                    for (GenericValue storeGroupCond: storeGroupConds) {
                         productPriceRuleIds.add(storeGroupCond.getString("productPriceRuleId"));
                     }
                 }
@@ -846,9 +818,7 @@
             if (UtilValidate.isNotEmpty(webSiteId)) {
                 Collection<GenericValue> webSiteIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_WEBSITE_ID", "condValue", webSiteId));
                 if (UtilValidate.isNotEmpty(webSiteIdConds)) {
-                    Iterator<GenericValue> webSiteIdCondsIter = webSiteIdConds.iterator();
-                    while (webSiteIdCondsIter.hasNext()) {
-                        GenericValue webSiteIdCond = webSiteIdCondsIter.next();
+                    for (GenericValue webSiteIdCond: webSiteIdConds) {
                         productPriceRuleIds.add(webSiteIdCond.getString("productPriceRuleId"));
                     }
                 }
@@ -858,9 +828,7 @@
             if (UtilValidate.isNotEmpty(partyId)) {
                 Collection<GenericValue> partyIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_PARTY_ID", "condValue", partyId));
                 if (UtilValidate.isNotEmpty(partyIdConds)) {
-                    Iterator<GenericValue> partyIdCondsIter = partyIdConds.iterator();
-                    while (partyIdCondsIter.hasNext()) {
-                        GenericValue partyIdCond = partyIdCondsIter.next();
+                    for (GenericValue partyIdCond: partyIdConds) {
                         productPriceRuleIds.add(partyIdCond.getString("productPriceRuleId"));
                     }
                 }
@@ -869,17 +837,13 @@
             // by currencyUomId
             Collection<GenericValue> currencyUomIdConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("inputParamEnumId", "PRIP_CURRENCY_UOMID", "condValue", currencyUomId));
             if (UtilValidate.isNotEmpty(currencyUomIdConds)) {
-                Iterator<GenericValue> currencyUomIdCondsIter = currencyUomIdConds.iterator();
-                while (currencyUomIdCondsIter.hasNext()) {
-                    GenericValue currencyUomIdCond = currencyUomIdCondsIter.next();
+                for (GenericValue currencyUomIdCond: currencyUomIdConds) {
                     productPriceRuleIds.add(currencyUomIdCond.getString("productPriceRuleId"));
                 }
             }
 
             productPriceRules = FastList.newInstance();
-            Iterator<String> productPriceRuleIdsIter = productPriceRuleIds.iterator();
-            while (productPriceRuleIdsIter.hasNext()) {
-                String productPriceRuleId = productPriceRuleIdsIter.next();
+            for (String productPriceRuleId: productPriceRuleIds) {
                 GenericValue productPriceRule = delegator.findByPrimaryKeyCache("ProductPriceRule", UtilMisc.toMap("productPriceRuleId", productPriceRuleId));
                 if (productPriceRule == null) continue;
                 productPriceRules.add(productPriceRule);
@@ -920,9 +884,7 @@
         // calculate running sum based on listPrice and rules found
         double price = listPrice;
         
-        Iterator<GenericValue> productPriceRulesIter = productPriceRules.iterator();
-        while (productPriceRulesIter.hasNext()) {
-            GenericValue productPriceRule = productPriceRulesIter.next();
+        for (GenericValue productPriceRule: productPriceRules) {
             String productPriceRuleId = productPriceRule.getString("productPriceRuleId");
 
             // check from/thru dates
@@ -942,10 +904,7 @@
             boolean allTrue = true;
             StringBuilder condsDescription = new StringBuilder();
             List<GenericValue> productPriceConds = delegator.findByAndCache("ProductPriceCond", UtilMisc.toMap("productPriceRuleId", productPriceRuleId));
-            Iterator<GenericValue> productPriceCondsIter = UtilMisc.toIterator(productPriceConds);
-
-            while (productPriceCondsIter != null && productPriceCondsIter.hasNext()) {
-                GenericValue productPriceCond = productPriceCondsIter.next();
+            for (GenericValue productPriceCond: productPriceConds) {
 
                 totalConds++;
 
@@ -987,10 +946,7 @@
                 }
 
                 Collection<GenericValue> productPriceActions = delegator.findByAndCache("ProductPriceAction", UtilMisc.toMap("productPriceRuleId", productPriceRuleId));
-                Iterator<GenericValue> productPriceActionsIter = UtilMisc.toIterator(productPriceActions);
-
-                while (productPriceActionsIter != null && productPriceActionsIter.hasNext()) {
-                    GenericValue productPriceAction = productPriceActionsIter.next();
+                for (GenericValue productPriceAction: productPriceActions) {
 
                     totalActions++;
 
@@ -1110,9 +1066,7 @@
         if (Debug.verboseOn()) {
             Debug.logVerbose("Unchecked Calculated price: " + price, module);
             Debug.logVerbose("PriceInfo:", module);
-            Iterator<GenericValue> orderItemPriceInfosIter = orderItemPriceInfos.iterator();
-            while (orderItemPriceInfosIter.hasNext()) {
-                GenericValue orderItemPriceInfo = orderItemPriceInfosIter.next();
+            for (GenericValue orderItemPriceInfo: orderItemPriceInfos) {
                 Debug.logVerbose(" --- " + orderItemPriceInfo.toString(), module);
             }
         }
@@ -1365,8 +1319,7 @@
                 return ServiceUtil.returnError(gse.getMessage());
             }
             if (productSuppliers != null) {
-                for (int i = 0; i < productSuppliers.size(); i++) {
-                    GenericValue productSupplier = productSuppliers.get(i);
+                for (GenericValue productSupplier: productSuppliers) {
                     if (!validPriceFound) {
                         price = ((Double)productSupplier.get("lastPrice")).doubleValue();
                         validPriceFound = true;

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java Mon Nov 10 18:20:53 2008
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.sql.Timestamp;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -118,9 +117,8 @@
             !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0")) ||
             !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0"))) {
             // get strings from attributes and features
-            Iterator<GenericValue> productFeatureAndAppls = UtilMisc.toIterator(delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId)));
-            while (productFeatureAndAppls != null && productFeatureAndAppls.hasNext()) {
-                GenericValue productFeatureAndAppl = productFeatureAndAppls.next();
+            List<GenericValue> productFeatureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", UtilMisc.toMap("productId", productId));
+            for (GenericValue productFeatureAndAppl: productFeatureAndAppls) {
                 addWeightedKeywordSourceString(productFeatureAndAppl, "description", strings);
                 addWeightedKeywordSourceString(productFeatureAndAppl, "abbrev", strings);
                 addWeightedKeywordSourceString(productFeatureAndAppl, "idCode", strings);
@@ -130,9 +128,8 @@
         // ProductAttribute
         if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0")) ||
                 !"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0"))) {
-            Iterator<GenericValue> productAttributes = UtilMisc.toIterator(delegator.findByAnd("ProductAttribute", UtilMisc.toMap("productId", productId)));
-            while (productAttributes != null && productAttributes.hasNext()) {
-                GenericValue productAttribute = productAttributes.next();
+            List<GenericValue> productAttributes = delegator.findByAnd("ProductAttribute", UtilMisc.toMap("productId", productId));
+            for (GenericValue productAttribute: productAttributes) {
                 addWeightedKeywordSourceString(productAttribute, "attrName", strings);
                 addWeightedKeywordSourceString(productAttribute, "attrValue", strings);
             }
@@ -140,9 +137,8 @@
 
         // GoodIdentification
         if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.GoodIdentification.idValue", "0"))) {
-            Iterator<GenericValue> goodIdentifications = UtilMisc.toIterator(delegator.findByAnd("GoodIdentification", UtilMisc.toMap("productId", productId)));
-            while (goodIdentifications != null && goodIdentifications.hasNext()) {
-                GenericValue goodIdentification = goodIdentifications.next();
+            List<GenericValue> goodIdentifications = delegator.findByAnd("GoodIdentification", UtilMisc.toMap("productId", productId));
+            for (GenericValue goodIdentification: goodIdentifications) {
                 addWeightedKeywordSourceString(goodIdentification, "idValue", strings);
             }
         }
@@ -152,9 +148,7 @@
             if (!"0".equals(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"))) {
                 List<GenericValue> variantProductAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT"));
                 variantProductAssocs = EntityUtil.filterByDate(variantProductAssocs);
-                Iterator<GenericValue> variantProductAssocsIt = variantProductAssocs.iterator();
-                while (variantProductAssocsIt.hasNext()) {
-                    GenericValue variantProductAssoc = variantProductAssocsIt.next();
+                for (GenericValue variantProductAssoc: variantProductAssocs) {
                     int weight = 1;
                     try {
                         weight = Integer.parseInt(UtilProperties.getPropertyValue("prodsearch", "index.weight.Variant.Product.productId", "0"));
@@ -169,11 +163,7 @@
         }
         
         String productContentTypes = UtilProperties.getPropertyValue("prodsearch", "index.include.ProductContentTypes");
-        List<String> productContentTypeList = Arrays.asList(productContentTypes.split(","));
-        Iterator<String> productContentTypeIter = productContentTypeList.iterator();
-        while (productContentTypeIter.hasNext()) {
-            String productContentTypeId = productContentTypeIter.next();
-
+        for (String productContentTypeId: productContentTypes.split(",")) {
             int weight = 1;
             try {
                 // this is defaulting to a weight of 1 because you specified you wanted to index this type
@@ -183,32 +173,24 @@
             }
             
             List<GenericValue> productContentAndInfos = delegator.findByAnd("ProductContentAndInfo", UtilMisc.toMap("productId", productId, "productContentTypeId", productContentTypeId), null);
-            Iterator<GenericValue> productContentAndInfoIter = productContentAndInfos.iterator();
-            while (productContentAndInfoIter.hasNext()) {
-                GenericValue productContentAndInfo = productContentAndInfoIter.next();
+            for (GenericValue productContentAndInfo: productContentAndInfos) {
                 addWeightedDataResourceString(productContentAndInfo, weight, strings, delegator, product);
                 
                 List<GenericValue> alternateViews = productContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"));
                 alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true);
-                Iterator<GenericValue> alternateViewIter = alternateViews.iterator();
-                while (alternateViewIter.hasNext()) {
-                    GenericValue thisView = alternateViewIter.next();
+                for (GenericValue thisView: alternateViews) {
                     addWeightedDataResourceString(thisView, weight, strings, delegator, product);
                 }
             }
         }
         
-        Iterator<String> strIter = strings.iterator();
-        while (strIter.hasNext()) {
-            String str = strIter.next();
+        for (String str: strings) {
             // call process keywords method here
             KeywordSearchUtil.processKeywordsForIndex(str, keywords, separators, stopWordBagAnd, stopWordBagOr, removeStems, stemSet);
         }
 
         List<GenericValue> toBeStored = FastList.newInstance();
-        Iterator<Map.Entry<String, Long>> kiter = keywords.entrySet().iterator();
-        while (kiter.hasNext()) {
-            Map.Entry<String, Long> entry = kiter.next();
+        for (Map.Entry<String, Long> entry: keywords.entrySet()) {
             GenericValue productKeyword = delegator.makeValue("ProductKeyword", UtilMisc.toMap("productId", product.getString("productId"), "keyword", entry.getKey(), "relevancyWeight", entry.getValue()));
             toBeStored.add(productKeyword);
         }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=712919&r1=712918&r2=712919&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Mon Nov 10 18:20:53 2008
@@ -538,10 +538,8 @@
         List<GenericValue> typeUomProductFeatureAndApplList = EntityUtil.filterByAnd(currentProductFeatureAndAppls, UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "uomId", uomId));
 
         // go through each; need to remove? do it now
-        Iterator<GenericValue> typeUomProductFeatureAndApplIter = typeUomProductFeatureAndApplList.iterator();
         boolean foundOneEqual = false;
-        while (typeUomProductFeatureAndApplIter.hasNext()) {
-            GenericValue typeUomProductFeatureAndAppl = typeUomProductFeatureAndApplIter.next();
+        for (GenericValue typeUomProductFeatureAndAppl: typeUomProductFeatureAndApplList) {
             if ((numberSpecified != null) && (numberSpecified.equals(typeUomProductFeatureAndAppl.getDouble("numberSpecified")))) {
                 foundOneEqual = true;
             } else {
@@ -773,23 +771,17 @@
             List<GenericValue> variantAssocs = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"));
             variantAssocs = EntityUtil.filterByDate(variantAssocs);
             List<GenericValue> variants = EntityUtil.getRelated("AssocProduct", variantAssocs);
-            Iterator<GenericValue> variantIter = variants.iterator();
-            while (variantIter.hasNext()) {
-                GenericValue variant = variantIter.next();
+            for (GenericValue variant: variants) {
                 // get the selectable features for the variant
                 List<GenericValue> productFeatureAndAppls = variant.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "STANDARD_FEATURE"), null);
-                Iterator<GenericValue> productFeatureAndApplIter = productFeatureAndAppls.iterator();
-                while (productFeatureAndApplIter.hasNext()) {
-                    GenericValue productFeatureAndAppl = productFeatureAndApplIter.next();
+                for (GenericValue productFeatureAndAppl: productFeatureAndAppls) {
                     GenericPK productFeatureApplPK = delegator.makePK("ProductFeatureAppl");
                     productFeatureApplPK.setPKFields(productFeatureAndAppl);
                     delegator.removeByPrimaryKey(productFeatureApplPK);
                 }
             }
             List<GenericValue> productFeatureAndAppls = product.getRelated("ProductFeatureAndAppl", UtilMisc.toMap("productFeatureTypeId", productFeatureTypeId, "productFeatureApplTypeId", "SELECTABLE_FEATURE"), null);
-            Iterator<GenericValue> productFeatureAndApplIter = productFeatureAndAppls.iterator();
-            while (productFeatureAndApplIter.hasNext()) {
-                GenericValue productFeatureAndAppl = productFeatureAndApplIter.next();
+            for (GenericValue productFeatureAndAppl: productFeatureAndAppls) {
                 GenericPK productFeatureApplPK = delegator.makePK("ProductFeatureAppl");
                 productFeatureApplPK.setPKFields(productFeatureAndAppl);
                 delegator.removeByPrimaryKey(productFeatureApplPK);
@@ -832,17 +824,17 @@
         if ((fromDate == null) || (fromDate.trim().length() == 0)) {
             fromDate = UtilDateTime.nowTimestamp().toString();
         }
-        String[] categoryId = request.getParameterValues("categoryId");
-        if (categoryId != null) {
-            for (int i = 0; i < categoryId.length; i++) {
+        String[] categoryIds = request.getParameterValues("categoryId");
+        if (categoryIds != null) {
+            for (String categoryId: categoryIds) {
                 try {
                     List<GenericValue> catMembs = delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap(
-                            "productCategoryId", categoryId[i],
+                            "productCategoryId", categoryId,
                             "productId", productId));
                     catMembs = EntityUtil.filterByDate(catMembs);
                     if (catMembs.size() == 0) {
                         delegator.create("ProductCategoryMember",
-                                UtilMisc.toMap("productCategoryId", categoryId[i], "productId", productId, "fromDate", fromDate));
+                                UtilMisc.toMap("productCategoryId", categoryId, "productId", productId, "fromDate", fromDate));
                     }
                 } catch (GenericEntityException e) {
                     String errMsg = "Error adding to category: " + e.toString();
@@ -893,17 +885,17 @@
         String[] productFeatureIdArray = request.getParameterValues("productFeatureId");
         if (productFeatureIdArray != null && productFeatureIdArray.length > 0) {
             try {
-                for (int i = 0; i < productFeatureIdArray.length; i++) {
-                    if (!productFeatureIdArray[i].equals("~~any~~")) {
+                for (String productFeatureId: productFeatureIdArray) {
+                    if (!productFeatureId.equals("~~any~~")) {
                         List<GenericValue> featureAppls = delegator.findByAnd("ProductFeatureAppl",
                                 UtilMisc.toMap("productId", productId,
-                                        "productFeatureId", productFeatureIdArray[i],
+                                        "productFeatureId", productFeatureId,
                                         "productFeatureApplTypeId", productFeatureApplTypeId));
                         if (featureAppls.size() == 0) {
                             // no existing application for this
                             delegator.create("ProductFeatureAppl",
                                     UtilMisc.toMap("productId", productId,
-                                        "productFeatureId", productFeatureIdArray[i],
+                                        "productFeatureId", productFeatureId,
                                         "productFeatureApplTypeId", productFeatureApplTypeId,
                                         "fromDate", fromDate));
                         }