svn commit: r1305309 [1/3] - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: ./ order/ quote/ requirement/ shoppingcart/ shoppingcart/product/ shoppinglist/ test/ thirdparty/zipsales/

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

svn commit: r1305309 [1/3] - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: ./ order/ quote/ requirement/ shoppingcart/ shoppingcart/product/ shoppinglist/ test/ thirdparty/zipsales/

erwan
Author: erwan
Date: Mon Mar 26 11:08:11 2012
New Revision: 1305309

URL: http://svn.apache.org/viewvc?rev=1305309&view=rev
Log:
Replacement of iterators with for-each loops for order component

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Mon Mar 26 11:08:11 2012
@@ -19,7 +19,6 @@
 package org.ofbiz.order;
 
 import java.math.BigDecimal;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -83,11 +82,9 @@ public class OrderManagerEvents {
                 return "error";
             }
             if (paymentPrefs != null) {
-                Iterator<GenericValue> i = paymentPrefs.iterator();
-                while (i.hasNext()) {
+                for(GenericValue ppref : paymentPrefs) {
                     // update the preference to received
                     // TODO: updating payment preferences should be done as a service
-                    GenericValue ppref = i.next();
                     ppref.set("statusId", "PAYMENT_RECEIVED");
                     ppref.set("authDate", UtilDateTime.nowTimestamp());
                     toBeStored.add(ppref);
@@ -179,9 +176,7 @@ public class OrderManagerEvents {
             return "error";
         }
 
-        Iterator<GenericValue> pmti = paymentMethodTypes.iterator();
-        while (pmti.hasNext()) {
-            GenericValue paymentMethodType = pmti.next();
+        for(GenericValue paymentMethodType : paymentMethodTypes) {
             String paymentMethodTypeId = paymentMethodType.getString("paymentMethodTypeId");
             String amountStr = request.getParameter(paymentMethodTypeId + "_amount");
             String paymentReference = request.getParameter(paymentMethodTypeId + "_reference");
@@ -251,9 +246,7 @@ public class OrderManagerEvents {
             Debug.logError(e, "ERROR: Unable to get existing payment preferences from order", module);
         }
         if (UtilValidate.isNotEmpty(currentPrefs)) {
-            Iterator<GenericValue> cpi = currentPrefs.iterator();
-            while (cpi.hasNext()) {
-                GenericValue cp = cpi.next();
+            for(GenericValue cp : currentPrefs) {
                 String paymentMethodType = cp.getString("paymentMethodTypeId");
                 if ("EXT_OFFLINE".equals(paymentMethodType)) {
                     offlineValue = cp;

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java Mon Mar 26 11:08:11 2012
@@ -18,7 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.order.order;
 
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -185,9 +184,7 @@ public class OrderChangeHelper {
                     Debug.logError(e, "ERROR: Unable to get OrderItem records for OrderHeader : " + orderId, module);
                 }
                 if (UtilValidate.isNotEmpty(orderItems)) {
-                    Iterator<GenericValue> oii = orderItems.iterator();
-                    while (oii.hasNext()) {
-                        GenericValue orderItem = oii.next();
+                    for(GenericValue orderItem : orderItems) {
                         String orderItemSeqId = orderItem.getString("orderItemSeqId");
                         GenericValue product = null;
 
@@ -264,9 +261,7 @@ public class OrderChangeHelper {
             }
 
             List<GenericValue> opps = orh.getPaymentPreferences();
-            Iterator<GenericValue> oppi = opps.iterator();
-            while (oppi.hasNext()) {
-                GenericValue opp = oppi.next();
+            for(GenericValue opp : opps) {
                 if ("PAYMENT_RECEIVED".equals(opp.getString("statusId"))) {
                     List<GenericValue> payments = orh.getOrderPayments(opp);
                     if (UtilValidate.isEmpty(payments)) {

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java Mon Mar 26 11:08:11 2012
@@ -167,8 +167,7 @@ public class OrderListState implements S
     }
 
     private void changeOrderListStates(HttpServletRequest request) {
-        for (Iterator<String> iter = parameterToOrderStatusId.keySet().iterator(); iter.hasNext();) {
-            String param = iter.next();
+        for(String param : parameterToOrderStatusId.keySet()) {
             String value = request.getParameter(param);
             if ("Y".equals(value)) {
                 orderStatusState.put(param, "Y");
@@ -176,8 +175,7 @@ public class OrderListState implements S
                 orderStatusState.put(param, "N");
             }
         }
-        for (Iterator<String> iter = parameterToOrderTypeId.keySet().iterator(); iter.hasNext();) {
-            String param = iter.next();
+        for(String param : parameterToOrderTypeId.keySet()) {
             String value = request.getParameter(param);
             if ("Y".equals(value)) {
                 orderTypeState.put(param, "Y");
@@ -185,8 +183,7 @@ public class OrderListState implements S
                 orderTypeState.put(param, "N");
             }
         }
-        for (Iterator<String> iter = parameterToFilterId.keySet().iterator(); iter.hasNext();) {
-            String param = iter.next();
+        for(String param : parameterToFilterId.keySet()) {
             String value = request.getParameter(param);
             if ("Y".equals(value)) {
                 orderFilterState.put(param, "Y");
@@ -244,14 +241,12 @@ public class OrderListState implements S
         }
 
         List<EntityCondition> statusConditions = FastList.newInstance();
-        for (Iterator<String> iter = orderStatusState.keySet().iterator(); iter.hasNext();) {
-            String status = iter.next();
+        for(String status : orderFilterState.keySet()) {
             if (!hasStatus(status)) continue;
             statusConditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameterToOrderStatusId.get(status)));
         }
         List<EntityCondition> typeConditions = FastList.newInstance();
-        for (Iterator<String> iter = orderTypeState.keySet().iterator(); iter.hasNext();) {
-            String type = iter.next();
+        for(String type : orderTypeState.keySet()) {
             if (!hasType(type)) continue;
             typeConditions.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, parameterToOrderTypeId.get(type)));
         }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Mon Mar 26 11:08:11 2012
@@ -20,7 +20,6 @@
 package org.ofbiz.order.order;
 
 import java.math.BigDecimal;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -115,10 +114,8 @@ public class OrderLookupServices {
         // the base order header fields
         List<String> orderTypeList = UtilGenerics.checkList(context.get("orderTypeId"));
         if (orderTypeList != null) {
-            Iterator<String> i = orderTypeList.iterator();
             List<EntityExpr> orExprs = FastList.newInstance();
-            while (i.hasNext()) {
-                String orderTypeId = i.next();
+            for(String orderTypeId : orderTypeList) {
                 paramList.add("orderTypeId=" + orderTypeId);
 
                 if (!"PURCHASE_ORDER".equals(orderTypeId) || ("PURCHASE_ORDER".equals(orderTypeId) && canViewPo)) {
@@ -136,10 +133,8 @@ public class OrderLookupServices {
 
         List<String> orderStatusList = UtilGenerics.checkList(context.get("orderStatusId"));
         if (orderStatusList != null) {
-            Iterator<String> i = orderStatusList.iterator();
             List<EntityCondition> orExprs = FastList.newInstance();
-            while (i.hasNext()) {
-                String orderStatusId = i.next();
+            for(String orderStatusId : orderStatusList) {
                 paramList.add("orderStatusId=" + orderStatusId);
                 if ("PENDING".equals(orderStatusId)) {
                     List<EntityExpr> pendExprs = FastList.newInstance();
@@ -156,10 +151,8 @@ public class OrderLookupServices {
 
         List<String> productStoreList = UtilGenerics.checkList(context.get("productStoreId"));
         if (productStoreList != null) {
-            Iterator<String> i = productStoreList.iterator();
             List<EntityExpr> orExprs = FastList.newInstance();
-            while (i.hasNext()) {
-                String productStoreId = i.next();
+            for(String productStoreId : productStoreList) {
                 paramList.add("productStoreId=" + productStoreId);
                 orExprs.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId));
             }
@@ -168,10 +161,8 @@ public class OrderLookupServices {
 
         List<String> webSiteList = UtilGenerics.checkList(context.get("orderWebSiteId"));
         if (webSiteList != null) {
-            Iterator<String> i = webSiteList.iterator();
             List<EntityExpr> orExprs = FastList.newInstance();
-            while (i.hasNext()) {
-                String webSiteId = i.next();
+            for(String webSiteId : webSiteList) {
                 paramList.add("webSiteId=" + webSiteId);
                 orExprs.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId));
             }
@@ -180,10 +171,8 @@ public class OrderLookupServices {
 
         List<String> saleChannelList = UtilGenerics.checkList(context.get("salesChannelEnumId"));
         if (saleChannelList != null) {
-            Iterator<String> i = saleChannelList.iterator();
             List<EntityExpr> orExprs = FastList.newInstance();
-            while (i.hasNext()) {
-                String salesChannelEnumId = i.next();
+            for(String salesChannelEnumId : saleChannelList) {
                 paramList.add("salesChannelEnumId=" + salesChannelEnumId);
                 orExprs.add(EntityCondition.makeCondition("salesChannelEnumId", EntityOperator.EQUALS, salesChannelEnumId));
             }
@@ -335,10 +324,8 @@ public class OrderLookupServices {
 
         if (roleTypeList != null) {
             fieldsToSelect.add("roleTypeId");
-            Iterator<String> i = roleTypeList.iterator();
             List<EntityExpr> orExprs = FastList.newInstance();
-            while (i.hasNext()) {
-                String roleTypeId = i.next();
+            for(String roleTypeId : roleTypeList) {
                 paramList.add("roleTypeId=" + roleTypeId);
                 orExprs.add(makeExpr("roleTypeId", roleTypeId));
             }
@@ -397,9 +384,7 @@ public class OrderLookupServices {
                         }
                         List<GenericValue> variants = UtilGenerics.checkList(varLookup.get("assocProducts"));
                         if (variants != null) {
-                            Iterator<GenericValue> i = variants.iterator();
-                            while (i.hasNext()) {
-                                GenericValue v = i.next();
+                            for(GenericValue v : variants) {
                                 orExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, v.getString("productIdTo")));
                             }
                         }
@@ -639,9 +624,7 @@ public class OrderLookupServices {
 
         if ("Y".equals(doFilter) && orderList.size() > 0) {
             paramList.add("filterInventoryProblems=Y");
-            Iterator<GenericValue> i = orderList.iterator();
-            while (i.hasNext()) {
-                GenericValue orderHeader = i.next();
+            for(GenericValue orderHeader : orderList) {
                 OrderReadHelper orh = new OrderReadHelper(orderHeader);
                 BigDecimal backorderQty = orh.getOrderBackorderQuantity();
                 if (backorderQty.compareTo(BigDecimal.ZERO) == 1) {
@@ -682,9 +665,7 @@ public class OrderLookupServices {
         }
 
         if (doPoFilter && orderList.size() > 0) {
-            Iterator<GenericValue> i = orderList.iterator();
-            while (i.hasNext()) {
-                GenericValue orderHeader = i.next();
+            for(GenericValue orderHeader : orderList) {
                 OrderReadHelper orh = new OrderReadHelper(orderHeader);
                 String orderType = orh.getOrderTypeId();
                 String orderId = orh.getOrderId();

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Mon Mar 26 11:08:11 2012
@@ -214,9 +214,7 @@ public class OrderReadHelper {
     public Map<String, BigDecimal> getReceivedPaymentTotalsByPaymentMethod() {
         Map<String, BigDecimal> paymentMethodAmounts = FastMap.newInstance();
         List<GenericValue> paymentPrefs = getPaymentPreferences();
-        Iterator<GenericValue> ppit = paymentPrefs.iterator();
-        while (ppit.hasNext()) {
-            GenericValue paymentPref = ppit.next();
+        for(GenericValue paymentPref : paymentPrefs) {
             List<GenericValue> payments = FastList.newInstance();
             try {
                 List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"),
@@ -234,9 +232,7 @@ public class OrderReadHelper {
             }
 
             BigDecimal chargedToPaymentPref = ZERO;
-            Iterator<GenericValue> payit = payments.iterator();
-            while (payit.hasNext()) {
-                GenericValue payment = payit.next();
+            for(GenericValue payment : payments) {
                 if (payment.get("amount") != null) {
                     chargedToPaymentPref = chargedToPaymentPref.add(payment.getBigDecimal("amount")).setScale(scale+1, rounding);
                 }
@@ -263,9 +259,7 @@ public class OrderReadHelper {
     public Map<String, BigDecimal> getReturnedTotalsByPaymentMethod() {
         Map<String, BigDecimal> paymentMethodAmounts = FastMap.newInstance();
         List<GenericValue> paymentPrefs = getPaymentPreferences();
-        Iterator<GenericValue> ppit = paymentPrefs.iterator();
-        while (ppit.hasNext()) {
-            GenericValue paymentPref = ppit.next();
+        for(GenericValue paymentPref : paymentPrefs) {
             List<GenericValue> returnItemResponses = FastList.newInstance();
             try {
                 returnItemResponses = orderHeader.getDelegator().findByAnd("ReturnItemResponse", UtilMisc.toMap("orderPaymentPreferenceId", paymentPref.getString("orderPaymentPreferenceId")));
@@ -273,9 +267,7 @@ public class OrderReadHelper {
                 Debug.logError(e, module);
             }
             BigDecimal refundedToPaymentPref = ZERO;
-            Iterator<GenericValue> ririt = returnItemResponses.iterator();
-            while (ririt.hasNext()) {
-                GenericValue returnItemResponse = ririt.next();
+            for(GenericValue returnItemResponse : returnItemResponses) {
                 refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount")).setScale(scale+1, rounding);
             }
 
@@ -302,9 +294,7 @@ public class OrderReadHelper {
             prefs = UtilMisc.toList(orderPaymentPreference);
         }
         if (prefs != null) {
-            Iterator<GenericValue> i = prefs.iterator();
-            while (i.hasNext()) {
-                GenericValue payPref = i.next();
+            for(GenericValue payPref : prefs) {
                 try {
                     orderPayments.addAll(payPref.getRelated("Payment"));
                 } catch (GenericEntityException e) {
@@ -405,9 +395,7 @@ public class OrderReadHelper {
     }
 
     public boolean hasPhysicalProductItems() throws GenericEntityException {
-        Iterator<GenericValue> orderItemIter = this.getOrderItems().iterator();
-        while (orderItemIter.hasNext()) {
-            GenericValue orderItem = orderItemIter.next();
+        for(GenericValue orderItem : this.getOrderItems()) {
             GenericValue product = orderItem.getRelatedOneCache("Product");
             if (product != null) {
                 GenericValue productType = product.getRelatedOneCache("ProductType");
@@ -442,9 +430,7 @@ public class OrderReadHelper {
         List<GenericValue> shippingLocations = FastList.newInstance();
         List<GenericValue> shippingCms = this.getOrderContactMechs("SHIPPING_LOCATION");
         if (shippingCms != null) {
-            Iterator<GenericValue> i = shippingCms.iterator();
-            while (i.hasNext()) {
-                GenericValue ocm = i.next();
+            for(GenericValue ocm : shippingCms) {
                 if (ocm != null) {
                     try {
                         GenericValue addr = ocm.getDelegator().findByPrimaryKey("PostalAddress",
@@ -500,9 +486,7 @@ public class OrderReadHelper {
         List<GenericValue> billingLocations = FastList.newInstance();
         List<GenericValue> billingCms = this.getOrderContactMechs("BILLING_LOCATION");
         if (billingCms != null) {
-            Iterator<GenericValue> i = billingCms.iterator();
-            while (i.hasNext()) {
-                GenericValue ocm = i.next();
+            for(GenericValue ocm : billingCms) {
                 if (ocm != null) {
                     try {
                         GenericValue addr = ocm.getDelegator().findByPrimaryKey("PostalAddress",
@@ -807,9 +791,7 @@ public class OrderReadHelper {
                 Debug.logError(e, "Unable to get ProductFeatureAppl for item : " + item, module);
             }
             if (featureAppls != null) {
-                Iterator<GenericValue> fai = featureAppls.iterator();
-                while (fai.hasNext()) {
-                    GenericValue appl = fai.next();
+                for(GenericValue appl : featureAppls) {
                     featureSet.add(appl.getString("productFeatureId"));
                 }
             }
@@ -823,9 +805,7 @@ public class OrderReadHelper {
             Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, module);
         }
         if (additionalFeatures != null) {
-            Iterator<GenericValue> afi = additionalFeatures.iterator();
-            while (afi.hasNext()) {
-                GenericValue adj = afi.next();
+            for(GenericValue adj : additionalFeatures) {
                 String featureId = adj.getString("productFeatureId");
                 if (featureId != null) {
                     featureSet.add(featureId);
@@ -840,9 +820,7 @@ public class OrderReadHelper {
         Map<String, BigDecimal> featureMap = FastMap.newInstance();
         List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 List<GenericValue> featureAppls = null;
                 if (item.get("productId") != null) {
                     try {
@@ -854,9 +832,7 @@ public class OrderReadHelper {
                         Debug.logError(e, "Unable to get ProductFeatureAppl for item : " + item, module);
                     }
                     if (featureAppls != null) {
-                        Iterator<GenericValue> fai = featureAppls.iterator();
-                        while (fai.hasNext()) {
-                            GenericValue appl = fai.next();
+                        for(GenericValue appl : featureAppls) {
                             BigDecimal lastQuantity = featureMap.get(appl.getString("productFeatureId"));
                             if (lastQuantity == null) {
                                 lastQuantity = BigDecimal.ZERO;
@@ -875,9 +851,7 @@ public class OrderReadHelper {
                     Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, module);
                 }
                 if (additionalFeatures != null) {
-                    Iterator<GenericValue> afi = additionalFeatures.iterator();
-                    while (afi.hasNext()) {
-                        GenericValue adj = afi.next();
+                    for(GenericValue adj : additionalFeatures) {
                         String featureId = adj.getString("productFeatureId");
                         if (featureId != null) {
                             BigDecimal lastQuantity = featureMap.get(featureId);
@@ -899,9 +873,7 @@ public class OrderReadHelper {
         boolean shippingApplies = false;
         List<GenericValue> validItems = this.getValidOrderItems();
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 GenericValue product = null;
                 try {
                     product = item.getRelatedOne("Product");
@@ -923,9 +895,7 @@ public class OrderReadHelper {
         boolean taxApplies = false;
         List<GenericValue> validItems = this.getValidOrderItems();
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 GenericValue product = null;
                 try {
                     product = item.getRelatedOne("Product");
@@ -947,9 +917,7 @@ public class OrderReadHelper {
         BigDecimal shippableTotal = ZERO;
         List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 GenericValue product = null;
                 try {
                     product = item.getRelatedOne("Product");
@@ -971,9 +939,7 @@ public class OrderReadHelper {
         BigDecimal shippableQuantity = ZERO;
         List<GenericValue> shipGroups = getOrderItemShipGroups();
         if (UtilValidate.isNotEmpty(shipGroups)) {
-            Iterator<GenericValue> shipGroupsIt = shipGroups.iterator();
-            while (shipGroupsIt.hasNext()) {
-                GenericValue shipGroup = shipGroupsIt.next();
+            for(GenericValue shipGroup : shipGroups) {
                 shippableQuantity = shippableQuantity.add(getShippableQuantity(shipGroup.getString("shipGroupSeqId")));
             }
         }
@@ -984,9 +950,7 @@ public class OrderReadHelper {
         BigDecimal shippableQuantity = ZERO;
         List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 GenericValue product = null;
                 try {
                     product = item.getRelatedOne("Product");
@@ -1008,9 +972,7 @@ public class OrderReadHelper {
         BigDecimal shippableWeight = ZERO;
         List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 shippableWeight = shippableWeight.add(this.getItemWeight(item).multiply(getOrderItemQuantity(item))).setScale(scale, rounding);
             }
         }
@@ -1062,9 +1024,7 @@ public class OrderReadHelper {
 
         List<GenericValue> validItems = getValidOrderItems();
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 shippableSizes.add(this.getItemSize(item));
             }
         }
@@ -1077,8 +1037,7 @@ public class OrderReadHelper {
      */
     public BigDecimal getOrderPaymentPreferenceTotalByType(String paymentMethodTypeId) {
         BigDecimal total = ZERO;
-        for (Iterator<GenericValue> iter = getPaymentPreferences().iterator(); iter.hasNext();) {
-            GenericValue preference = iter.next();
+        for(GenericValue preference : getPaymentPreferences()) {
             if (preference.get("maxAmount") == null) continue;
             if (paymentMethodTypeId == null || paymentMethodTypeId.equals(preference.get("paymentMethodTypeId"))) {
                 total = total.add(preference.getBigDecimal("maxAmount")).setScale(scale, rounding);
@@ -1111,8 +1070,7 @@ public class OrderReadHelper {
             // get a set of invoice IDs that belong to the order
             List<GenericValue> orderItemBillings = orderHeader.getRelatedCache("OrderItemBilling");
             Set<String> invoiceIds = new HashSet<String>();
-            for (Iterator<GenericValue> iter = orderItemBillings.iterator(); iter.hasNext();) {
-                GenericValue orderItemBilling = iter.next();
+            for(GenericValue orderItemBilling : orderItemBillings) {
                 invoiceIds.add(orderItemBilling.getString("invoiceId"));
             }
 
@@ -1126,8 +1084,7 @@ public class OrderReadHelper {
             EntityConditionList<EntityExpr> ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
             List<GenericValue> payments = orderHeader.getDelegator().findList("PaymentAndApplication", ecl, null, null, null, true);
 
-            for (Iterator<GenericValue> iter = payments.iterator(); iter.hasNext();) {
-                GenericValue payment = iter.next();
+            for (GenericValue payment : payments) {
                 if (payment.get("amountApplied") == null) continue;
                 total = total.add(payment.getBigDecimal("amountApplied")).setScale(scale, rounding);
             }
@@ -1235,9 +1192,7 @@ public class OrderReadHelper {
 
         List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId);
         if (validItems != null) {
-            Iterator<GenericValue> i = validItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = i.next();
+            for(GenericValue item : validItems) {
                 shippableInfo.add(this.getItemInfoMap(item));
             }
         }
@@ -1269,10 +1224,8 @@ public class OrderReadHelper {
 
         StringBuilder emails = new StringBuilder();
         if (orderContactMechs != null) {
-            Iterator<GenericValue> oci = orderContactMechs.iterator();
-            while (oci.hasNext()) {
+            for(GenericValue orderContactMech : orderContactMechs) {
                 try {
-                    GenericValue orderContactMech = oci.next();
                     GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech");
                     emails.append(emails.length() > 0 ? "," : "").append(contactMech.getString("infoString"));
                 } catch (GenericEntityException e) {
@@ -1301,22 +1254,19 @@ public class OrderReadHelper {
         List<GenericValue> prefs = getPaymentPreferences();
 
         // add up the covered amount, but skip preferences which are declined or cancelled
-        for (Iterator<GenericValue> iter = prefs.iterator(); iter.hasNext();) {
-            GenericValue pref = iter.next();
+        for(GenericValue pref : prefs) {
             if ("PAYMENT_CANCELLED".equals(pref.get("statusId")) || "PAYMENT_DECLINED".equals(pref.get("statusId"))) {
                 continue;
             } else if ("PAYMENT_SETTLED".equals(pref.get("statusId"))) {
                 List<GenericValue> responses = pref.getRelatedByAnd("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_CAPTURE"));
-                for (Iterator<GenericValue> respIter = responses.iterator(); respIter.hasNext();) {
-                    GenericValue response = respIter.next();
+                for(GenericValue response : responses) {
                     BigDecimal amount = response.getBigDecimal("amount");
                     if (amount != null) {
                         openAmount = openAmount.add(amount);
                     }
                 }
                 responses = pref.getRelatedByAnd("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_REFUND"));
-                for (Iterator<GenericValue> respIter = responses.iterator(); respIter.hasNext();) {
-                    GenericValue response = respIter.next();
+                for(GenericValue response : responses) {
                     BigDecimal amount = response.getBigDecimal("amount");
                     if (amount != null) {
                         openAmount = openAmount.subtract(amount);
@@ -1449,9 +1399,7 @@ public class OrderReadHelper {
 
     public boolean getRejectedOrderItems() {
         List<GenericValue> items = getOrderItems();
-        Iterator<GenericValue> i = items.iterator();
-        while (i.hasNext()) {
-            GenericValue item = i.next();
+        for(GenericValue item : items) {
             List<GenericValue> receipts = null;
             try {
                 receipts = item.getRelated("ShipmentReceipt");
@@ -1459,9 +1407,7 @@ public class OrderReadHelper {
                 Debug.logWarning(e, module);
             }
             if (UtilValidate.isNotEmpty(receipts)) {
-                Iterator<GenericValue> recIter = receipts.iterator();
-                while (recIter.hasNext()) {
-                    GenericValue rec = recIter.next();
+                for(GenericValue rec : receipts) {
                     BigDecimal rejected = rec.getBigDecimal("quantityRejected");
                     if (rejected != null && rejected.compareTo(BigDecimal.ZERO) > 0) {
                         return true;
@@ -1487,9 +1433,7 @@ public class OrderReadHelper {
         return false;
     }*/
         List<GenericValue> items = getOrderItems();
-        Iterator<GenericValue> i = items.iterator();
-        while (i.hasNext()) {
-            GenericValue item = i.next();
+        for(GenericValue item : items) {
             List<GenericValue> receipts = null;
             try {
                 receipts = item.getRelated("ShipmentReceipt");
@@ -1497,9 +1441,7 @@ public class OrderReadHelper {
                 Debug.logWarning(e, module);
             }
             if (UtilValidate.isNotEmpty(receipts)) {
-                Iterator<GenericValue> recIter = receipts.iterator();
-                while (recIter.hasNext()) {
-                    GenericValue rec = recIter.next();
+                for(GenericValue rec : receipts) {
                     BigDecimal acceptedQuantity = rec.getBigDecimal("quantityAccepted");
                     BigDecimal orderedQuantity = (BigDecimal) item.get("quantity");
                     if (acceptedQuantity.intValue() != orderedQuantity.intValue() && acceptedQuantity.intValue()  > 0) {
@@ -1532,9 +1474,7 @@ public class OrderReadHelper {
                 EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED"),
                 EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_COMPLETED"));
         List<GenericValue> items = EntityUtil.filterByOr(getOrderItems(), exprs);
-        Iterator<GenericValue> i = items.iterator();
-        while (i.hasNext()) {
-            GenericValue item = i.next();
+        for(GenericValue item : items) {
             if (item.get("productId") != null) {
                 GenericValue product = null;
                 try {
@@ -1580,9 +1520,7 @@ public class OrderReadHelper {
 
                                 if (UtilValidate.isNotEmpty(productContents)) {
                                     // make sure we are still within the allowed timeframe and use limits
-                                    Iterator<GenericValue> pci = productContents.iterator();
-                                    while (pci.hasNext()) {
-                                        GenericValue productContent = pci.next();
+                                    for(GenericValue productContent : productContents) {
                                         Timestamp fromDate = productContent.getTimestamp("purchaseFromDate");
                                         Timestamp thruDate = productContent.getTimestamp("purchaseThruDate");
                                         if (fromDate == null || item.getTimestamp("orderDate").after(fromDate)) {
@@ -1742,8 +1680,7 @@ public class OrderReadHelper {
 
        // since we don't have a handy grouped view entity, we'll have to group the return items by hand
        Map<String, BigDecimal> returnMap = FastMap.newInstance();
-       for (Iterator<GenericValue> iter = this.getValidOrderItems().iterator(); iter.hasNext();) {
-           GenericValue orderItem = iter.next();
+       for(GenericValue orderItem : this.getValidOrderItems()) {
            List<GenericValue> group = EntityUtil.filterByAnd(returnItems, UtilMisc.toList(
                                               EntityCondition.makeCondition("orderId", orderItem.get("orderId")),
                                               EntityCondition.makeCondition("orderItemSeqId", orderItem.get("orderItemSeqId")),
@@ -1751,8 +1688,7 @@ public class OrderReadHelper {
 
            // add up the returned quantities for this group TODO: received quantity should be used eventually
            BigDecimal returned = BigDecimal.ZERO;
-           for (Iterator<GenericValue> groupiter = group.iterator(); groupiter.hasNext();) {
-               GenericValue returnItem = groupiter.next();
+           for(GenericValue returnItem : group) {
                if (returnItem.getBigDecimal("returnQuantity") != null) {
                    returned = returned.add(returnItem.getBigDecimal("returnQuantity"));
                }
@@ -1788,9 +1724,7 @@ public class OrderReadHelper {
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED")));
 
         BigDecimal returnedQuantity = ZERO;
-        Iterator<GenericValue> i = returnedItems.iterator();
-        while (i.hasNext()) {
-            GenericValue returnedItem = i.next();
+        for(GenericValue returnedItem : returnedItems) {
             if (returnedItem.get("returnQuantity") != null) {
                 returnedQuantity = returnedQuantity.add(returnedItem.getBigDecimal("returnQuantity")).setScale(scale, rounding);
             }
@@ -1821,11 +1755,9 @@ public class OrderReadHelper {
                     UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "RETURN_CANCELLED"))));
         }
         BigDecimal returnedAmount = ZERO;
-        Iterator<GenericValue> i = returnedItems.iterator();
         String orderId = orderHeader.getString("orderId");
         List<String> returnHeaderList = FastList.newInstance();
-        while (i.hasNext()) {
-            GenericValue returnedItem = i.next();
+        for(GenericValue returnedItem : returnedItems) {
             if ((returnedItem.get("returnPrice") != null) && (returnedItem.get("returnQuantity") != null)) {
                 returnedAmount = returnedAmount.add(returnedItem.getBigDecimal("returnPrice").multiply(returnedItem.getBigDecimal("returnQuantity")).setScale(scale, rounding));
             }
@@ -1836,9 +1768,7 @@ public class OrderReadHelper {
             }
         }
         //get  returnedAmount from returnHeader adjustments whose orderId must equals to current orderHeader.orderId
-        Iterator<String> returnHeaderIterator = returnHeaderList.iterator();
-        while (returnHeaderIterator.hasNext()) {
-            String returnId = returnHeaderIterator.next();
+        for(String returnId : returnHeaderList) {
             Map<String, Object> returnHeaderAdjFilter = UtilMisc.<String, Object>toMap("returnId", returnId, "returnItemSeqId", "_NA_", "returnTypeId", returnTypeId);
             returnedAmount =returnedAmount.add(getReturnAdjustmentTotal(orderHeader.getDelegator(), returnHeaderAdjFilter)).setScale(scale, rounding);
         }
@@ -1878,9 +1808,7 @@ public class OrderReadHelper {
         returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED")));
 
         Map<String, BigDecimal> itemReturnedQuantities = FastMap.newInstance();
-        Iterator<GenericValue> i = returnedItems.iterator();
-        while (i.hasNext()) {
-            GenericValue returnedItem = i.next();
+        for(GenericValue returnedItem : returnedItems) {
             String orderItemSeqId = returnedItem.getString("orderItemSeqId");
             BigDecimal returnedQuantity = returnedItem.getBigDecimal("returnQuantity");
             if (orderItemSeqId != null && returnedQuantity != null) {
@@ -1898,10 +1826,7 @@ public class OrderReadHelper {
         BigDecimal totalTaxNotReturned = ZERO;
         BigDecimal totalShippingNotReturned = ZERO;
 
-        Iterator<GenericValue> orderItems = this.getValidOrderItems().iterator();
-        while (orderItems.hasNext()) {
-            GenericValue orderItem = orderItems.next();
-
+        for(GenericValue orderItem : this.getValidOrderItems()) {
             BigDecimal itemQuantityDbl = orderItem.getBigDecimal("quantity");
             if (itemQuantityDbl == null || itemQuantityDbl.compareTo(ZERO) == 0) {
                 continue;
@@ -1960,8 +1885,7 @@ public class OrderReadHelper {
 
         // sum up the return items that have a return item response with a billing account defined
         try {
-            for (Iterator<GenericValue> iter = returnedItems.iterator(); iter.hasNext();) {
-                GenericValue returnItem = iter.next();
+            for(GenericValue returnItem : returnedItems) {
                 GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse");
                 if (returnItemResponse == null) continue;
                 if (returnItemResponse.get("billingAccountId") == null) continue;
@@ -1999,14 +1923,10 @@ public class OrderReadHelper {
         BigDecimal backorder = ZERO;
         List<GenericValue> items = this.getValidOrderItems();
         if (items != null) {
-            Iterator<GenericValue> ii = items.iterator();
-            while (ii.hasNext()) {
-                GenericValue item = ii.next();
+            for(GenericValue item : items) {
                 List<GenericValue> reses = this.getOrderItemShipGrpInvResList(item);
                 if (reses != null) {
-                    Iterator<GenericValue> ri = reses.iterator();
-                    while (ri.hasNext()) {
-                        GenericValue res = ri.next();
+                    for(GenericValue res : reses) {
                         BigDecimal nav = res.getBigDecimal("quantityNotAvailable");
                         if (nav != null) {
                             backorder = backorder.add(nav).setScale(scale, rounding);
@@ -2035,9 +1955,7 @@ public class OrderReadHelper {
         }
 
         if (picked != null) {
-            Iterator<GenericValue> i = picked.iterator();
-            while (i.hasNext()) {
-                GenericValue pickedItem = i.next();
+            for(GenericValue pickedItem : picked) {
                 BigDecimal issueQty = pickedItem.getBigDecimal("quantity");
                 if (issueQty != null) {
                     quantityPicked = quantityPicked.add(issueQty).setScale(scale, rounding);
@@ -2051,9 +1969,7 @@ public class OrderReadHelper {
         BigDecimal quantityShipped = ZERO;
         List<GenericValue> issuance = getOrderItemIssuances(orderItem);
         if (issuance != null) {
-            Iterator<GenericValue> i = issuance.iterator();
-            while (i.hasNext()) {
-                GenericValue issue = i.next();
+            for(GenericValue issue : issuance) {
                 BigDecimal issueQty = issue.getBigDecimal("quantity");
                 BigDecimal cancelQty = issue.getBigDecimal("cancelQuantity");
                 if (cancelQty == null) {
@@ -2073,9 +1989,7 @@ public class OrderReadHelper {
 
         List<GenericValue> reses = getOrderItemShipGrpInvResList(orderItem);
         if (reses != null) {
-            Iterator<GenericValue> i = reses.iterator();
-            while (i.hasNext()) {
-                GenericValue res = i.next();
+            for(GenericValue res : reses) {
                 BigDecimal quantity = res.getBigDecimal("quantity");
                 if (quantity != null) {
                     reserved = reserved.add(quantity).setScale(scale, rounding);
@@ -2093,9 +2007,7 @@ public class OrderReadHelper {
 
         List<GenericValue> reses = getOrderItemShipGrpInvResList(orderItem);
         if (reses != null) {
-            Iterator<GenericValue> i = reses.iterator();
-            while (i.hasNext()) {
-                GenericValue res = i.next();
+            for(GenericValue res : reses) {
                 Timestamp promised = res.getTimestamp("currentPromisedDate");
                 if (promised == null) {
                     promised = res.getTimestamp("promisedDatetime");
@@ -2414,11 +2326,7 @@ public class OrderReadHelper {
 
         if (UtilValidate.isNotEmpty(orderHeaderAdjustments)) {
             List<GenericValue> filteredAdjs = filterOrderAdjustments(orderHeaderAdjustments, includeOther, includeTax, includeShipping, false, false);
-            Iterator<GenericValue> adjIt = filteredAdjs.iterator();
-
-            while (adjIt.hasNext()) {
-                GenericValue orderAdjustment = adjIt.next();
-
+            for (GenericValue orderAdjustment : filteredAdjs) {
                 adjTotal = adjTotal.add(OrderReadHelper.calcOrderAdjustment(orderAdjustment, subTotal)).setScale(scale, rounding);
             }
         }
@@ -2449,17 +2357,12 @@ public class OrderReadHelper {
 
     public static BigDecimal getOrderItemsSubTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, List<GenericValue> workEfforts) {
         BigDecimal result = ZERO;
-        Iterator<GenericValue> itemIter = UtilMisc.toIterator(orderItems);
-
-        while (itemIter != null && itemIter.hasNext()) {
-            GenericValue orderItem = itemIter.next();
+        for(GenericValue orderItem : orderItems) {
             BigDecimal itemTotal = getOrderItemSubTotal(orderItem, adjustments);
             // Debug.logInfo("Item : " + orderItem.getString("orderId") + " / " + orderItem.getString("orderItemSeqId") + " = " + itemTotal, module);
 
             if (workEfforts != null && orderItem.getString("orderItemTypeId").compareTo("RENTAL_ORDER_ITEM") == 0) {
-                Iterator<GenericValue> weIter = UtilMisc.toIterator(workEfforts);
-                while (weIter != null && weIter.hasNext()) {
-                    GenericValue workEffort = weIter.next();
+                for(GenericValue workEffort : workEfforts) {
                     if (workEffort.getString("workEffortId").compareTo(orderItem.getString("orderItemSeqId")) == 0)    {
                         itemTotal = itemTotal.multiply(getWorkEffortRentalQuantity(workEffort)).setScale(scale, rounding);
                         break;
@@ -2519,10 +2422,8 @@ public class OrderReadHelper {
 
     public static BigDecimal getOrderItemsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments) {
         BigDecimal result = ZERO;
-        Iterator<GenericValue> itemIter = UtilMisc.toIterator(orderItems);
-
-        while (itemIter != null && itemIter.hasNext()) {
-            result = result.add(getOrderItemTotal(itemIter.next(), adjustments));
+        for(GenericValue orderItem : orderItems) {
+            result = result.add(getOrderItemTotal(orderItem, adjustments));
         }
         return result.setScale(scale,  rounding);
     }
@@ -2538,9 +2439,7 @@ public class OrderReadHelper {
         List<GenericValue> promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT"));
         
         if (UtilValidate.isNotEmpty(promoAdjustments)) {
-            Iterator<GenericValue> promoAdjIter = promoAdjustments.iterator();
-            while (promoAdjIter.hasNext()) {
-                GenericValue promoAdjustment = promoAdjIter.next();
+            for(GenericValue promoAdjustment : promoAdjustments) {
                 if (promoAdjustment != null) {
                     BigDecimal amount = promoAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding);
                     promoAdjTotal = promoAdjTotal.add(amount);
@@ -2593,10 +2492,8 @@ public class OrderReadHelper {
 
     public static BigDecimal getAllOrderItemsAdjustmentsTotal(List<GenericValue> orderItems, List<GenericValue> adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) {
         BigDecimal result = ZERO;
-        Iterator<GenericValue> itemIter = UtilMisc.toIterator(orderItems);
-
-        while (itemIter != null && itemIter.hasNext()) {
-            result = result.add(getOrderItemAdjustmentsTotal(itemIter.next(), adjustments, includeOther, includeTax, includeShipping));
+        for(GenericValue orderItem : orderItems) {
+            result = result.add(getOrderItemAdjustmentsTotal(orderItem, adjustments, includeOther, includeTax, includeShipping));
         }
         return result.setScale(scale, rounding);
     }
@@ -2636,11 +2533,7 @@ public class OrderReadHelper {
 
         if (UtilValidate.isNotEmpty(adjustments)) {
             List<GenericValue> filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping);
-            Iterator<GenericValue> adjIt = filteredAdjs.iterator();
-
-            while (adjIt.hasNext()) {
-                GenericValue orderAdjustment = adjIt.next();
-
+            for(GenericValue orderAdjustment : filteredAdjs) {
                 adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustment(orderAdjustment, quantity, unitPrice));
             }
         }
@@ -2652,11 +2545,7 @@ public class OrderReadHelper {
 
         if (UtilValidate.isNotEmpty(adjustments)) {
             List<GenericValue> filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping);
-            Iterator<GenericValue> adjIt = filteredAdjs.iterator();
-
-            while (adjIt.hasNext()) {
-                GenericValue orderAdjustment = adjIt.next();
-
+            for(GenericValue orderAdjustment : filteredAdjs) {
                 adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustmentRecurringBd(orderAdjustment, quantity, unitPrice)).setScale(scale, rounding);
             }
         }
@@ -2693,11 +2582,7 @@ public class OrderReadHelper {
         List<GenericValue> newOrderAdjustmentsList = FastList.newInstance();
 
         if (UtilValidate.isNotEmpty(adjustments)) {
-            Iterator<GenericValue> adjIt = adjustments.iterator();
-
-            while (adjIt.hasNext()) {
-                GenericValue orderAdjustment = adjIt.next();
-
+            for(GenericValue orderAdjustment : newOrderAdjustmentsList) {
                 boolean includeAdjustment = false;
 
                 if ("SALES_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) ||
@@ -2746,9 +2631,7 @@ public class OrderReadHelper {
         }
 
         if (UtilValidate.isNotEmpty(openOrders)) {
-            Iterator<GenericValue> i = openOrders.iterator();
-            while (i.hasNext()) {
-                GenericValue order = i.next();
+            for(GenericValue order : openOrders) {
                 BigDecimal thisQty = order.getBigDecimal("quantity");
                 if (thisQty == null) {
                     thisQty = BigDecimal.ZERO;
@@ -2802,9 +2685,7 @@ public class OrderReadHelper {
         List<GenericValue> orderHeaderAdjustments = this.getOrderHeaderAdjustments();
         List<GenericValue> filteredAdjustments = FastList.newInstance();
         if (orderHeaderAdjustments != null) {
-            Iterator<GenericValue> orderAdjIterator = orderHeaderAdjustments.iterator();
-            while (orderAdjIterator.hasNext()) {
-                GenericValue orderAdjustment = orderAdjIterator.next();
+            for(GenericValue orderAdjustment : orderHeaderAdjustments) {
                 long count = 0;
                 try {
                     count = orderHeader.getDelegator().findCountByCondition("ReturnAdjustment", EntityCondition.makeCondition("orderAdjustmentId", EntityOperator.EQUALS, orderAdjustment.get("orderAdjustmentId")), null, null);
@@ -2832,9 +2713,7 @@ public class OrderReadHelper {
             // TODO: find on a view-entity with a sum is probably more efficient
             adjustments = delegator.findByAnd("ReturnAdjustment", condition);
             if (adjustments != null) {
-                Iterator<GenericValue> adjustmentIterator = adjustments.iterator();
-                while (adjustmentIterator.hasNext()) {
-                    GenericValue returnAdjustment = adjustmentIterator.next();
+                for(GenericValue returnAdjustment : adjustments) {
                     total = total.add(setScaleByType("RET_SALES_TAX_ADJ".equals(returnAdjustment.get("returnAdjustmentTypeId")),returnAdjustment.getBigDecimal("amount")));
                 }
             }
@@ -2855,8 +2734,7 @@ public class OrderReadHelper {
        try {
            // this is simply the sum of quantity billed in all related OrderItemBillings
            List<GenericValue> billings = orderItem.getRelated("OrderItemBilling");
-           for (Iterator<GenericValue> iter = billings.iterator(); iter.hasNext();) {
-               GenericValue billing = iter.next();
+           for(GenericValue billing : billings) {
                BigDecimal quantity = billing.getBigDecimal("quantity");
                if (quantity != null) {
                    invoiced = invoiced.add(quantity);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Mon Mar 26 11:08:11 2012
@@ -429,9 +429,7 @@ public class OrderReturnServices {
                 returnableQuantity = orderQty;
             } else {
                 BigDecimal returnedQty = BigDecimal.ZERO;
-                Iterator<GenericValue> ri = returnedItems.iterator();
-                while (ri.hasNext()) {
-                    GenericValue returnItem = ri.next();
+                for(GenericValue returnItem : returnedItems) {
                     GenericValue returnHeader = null;
                     try {
                         returnHeader = returnItem.getRelatedOne("ReturnHeader");
@@ -498,9 +496,7 @@ public class OrderReturnServices {
             }
 
             if (orderItemQuantitiesIssued != null) {
-                Iterator<GenericValue> i = orderItemQuantitiesIssued.iterator();
-                while (i.hasNext()) {
-                    GenericValue orderItemQuantityIssued = i.next();
+                for(GenericValue orderItemQuantityIssued : orderItemQuantitiesIssued) {
                     GenericValue item = null;
                     try {
                         item = orderItemQuantityIssued.getRelatedOne("OrderItem");
@@ -578,9 +574,7 @@ public class OrderReturnServices {
                                     "OrderErrorUnableToGetOrderAdjustmentsFromItem", locale));
                         }
                         if (UtilValidate.isNotEmpty(itemAdjustments)) {
-                            Iterator<GenericValue> itemAdjustmentsIt = itemAdjustments.iterator();
-                            while (itemAdjustmentsIt.hasNext()) {
-                                GenericValue itemAdjustment = itemAdjustmentsIt.next();
+                            for(GenericValue itemAdjustment : itemAdjustments) {
                                 returnInfo = FastMap.newInstance();
                                 returnInfo.put("returnableQuantity", BigDecimal.ONE);
                                  // TODO: the returnablePrice should be set to the amount minus the already returned amount
@@ -637,9 +631,7 @@ public class OrderReturnServices {
 
         List<GenericValue> completedItems = FastList.newInstance();
         if (returnHeader != null && UtilValidate.isNotEmpty(returnItems)) {
-            Iterator<GenericValue> itemsIter = returnItems.iterator();
-            while (itemsIter.hasNext()) {
-                GenericValue item = itemsIter.next();
+            for(GenericValue item : returnItems) {
                 String itemStatus = item != null ? item.getString("statusId") : null;
                 if (itemStatus != null) {
                     // both completed and cancelled items qualify for completed status change
@@ -782,9 +774,8 @@ public class OrderReturnServices {
                 billingAccounts = EntityUtil.filterByDate(billingAccounts);
                 billingAccounts = EntityUtil.orderBy(billingAccounts, UtilMisc.toList("-fromDate"));
                 if (UtilValidate.isNotEmpty(billingAccounts)) {
-                    ListIterator<GenericValue> billingAccountItr = billingAccounts.listIterator();
-                    while (billingAccountItr.hasNext() && billingAccountId == null) {
-                        String thisBillingAccountId = billingAccountItr.next().getString("billingAccountId");
+                    for(GenericValue billingAccount : billingAccounts) {
+                        String thisBillingAccountId = billingAccount.getString("billingAccountId");
                         BigDecimal billingAccountBalance = ZERO;
                         try {
                             billingAccountBalance = getBillingAccountBalance(thisBillingAccountId, dctx);
@@ -881,8 +872,7 @@ public class OrderReturnServices {
 
             // first, compute the total credit from the return items
             BigDecimal creditTotal = ZERO;
-            for (Iterator<GenericValue> itemsIter = returnItems.iterator(); itemsIter.hasNext();) {
-                GenericValue item = itemsIter.next();
+            for(GenericValue item : returnItems) {
                 BigDecimal quantity = item.getBigDecimal("returnQuantity");
                 BigDecimal price = item.getBigDecimal("returnPrice");
                 if (quantity == null) quantity = ZERO;
@@ -962,8 +952,7 @@ public class OrderReturnServices {
             String itemResponseId = (String) serviceResults.get("returnItemResponseId");
 
             // loop through the items again to update them and store a status change history
-            for (Iterator<GenericValue> itemsIter = returnItems.iterator(); itemsIter.hasNext();) {
-                GenericValue item = itemsIter.next();
+            for(GenericValue item : returnItems) {
                 Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", itemResponseId, "returnId", item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", "RETURN_COMPLETED", "userLogin", userLogin);
                 // store the item changes (attached responseId)
                 try {
@@ -1040,16 +1029,14 @@ public class OrderReturnServices {
            ), EntityOperator.AND);
 
         List<GenericValue> orderPaymentPreferenceSums = delegator.findList("OrderPurchasePaymentSummary", whereConditions, UtilMisc.toSet("maxAmount"), null, null, false);
-        for (Iterator<GenericValue> oppsi = orderPaymentPreferenceSums.iterator(); oppsi.hasNext();) {
-            GenericValue orderPaymentPreferenceSum = oppsi.next();
+        for(GenericValue orderPaymentPreferenceSum : orderPaymentPreferenceSums) {
             BigDecimal maxAmount = orderPaymentPreferenceSum.getBigDecimal("maxAmount");
             balance = maxAmount != null ? balance.subtract(maxAmount) : balance;
         }
 
         List<GenericValue> paymentAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("billingAccountId", billingAccountId));
         // TODO: cancelled payments?
-        for (Iterator<GenericValue> pAi = paymentAppls.iterator(); pAi.hasNext();) {
-            GenericValue paymentAppl = pAi.next();
+        for(GenericValue paymentAppl : paymentAppls) {
             if (paymentAppl.getString("invoiceId") == null) {
                 BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied");
                 balance = balance.add(amountApplied);
@@ -1087,8 +1074,7 @@ public class OrderReturnServices {
 
             // find the minimum storeCreditValidDays of all the ProductStores associated with all the Orders on the Return, skipping null ones
             Long storeCreditValidDays = null;
-            for (Iterator<GenericValue> iter = productStores.iterator(); iter.hasNext();) {
-                GenericValue productStore = iter.next();
+            for(GenericValue productStore : productStores) {
                 Long thisStoreValidDays = productStore.getLong("storeCreditValidDays");
                 if (thisStoreValidDays == null) continue;
 
@@ -1314,9 +1300,7 @@ public class OrderReturnServices {
                  * the intent is to get the refundable amounts per orderPaymentPreference, grouped by payment method type.
                  */
                 Map<String, List<Map<String, Object>>> prefSplitMap = FastMap.newInstance();
-                Iterator<GenericValue> oppit = orderPayPrefs.iterator();
-                while (oppit.hasNext()) {
-                    GenericValue orderPayPref = oppit.next();
+                for(GenericValue orderPayPref : orderPayPrefs) {
                     String paymentMethodTypeId = orderPayPref.getString("paymentMethodTypeId");
                     String orderPayPrefKey = orderPayPref.getString("paymentMethodId") != null ? orderPayPref.getString("paymentMethodId") : orderPayPref.getString("paymentMethodTypeId");
 
@@ -1484,10 +1468,7 @@ public class OrderReturnServices {
                             String responseId = (String) serviceResults.get("returnItemResponseId");
 
                             // Set the response on each item
-                            Iterator<GenericValue> itemsIter = items.iterator();
-                            while (itemsIter.hasNext()) {
-                                GenericValue item = itemsIter.next();
-
+                            for(GenericValue item : items) {
                                 Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", responseId, "returnId", item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", returnItemStatusId, "userLogin", userLogin);
                                 //Debug.logInfo("Updating item status", module);
                                 try {
@@ -1647,11 +1628,9 @@ public class OrderReturnServices {
             // for each return item in the response, get the list of return item billings and then a list of invoices
             Map<String, GenericValue> returnInvoices = FastMap.newInstance(); // key is invoiceId, value is Invoice GenericValue
             List<GenericValue> items = response.getRelated("ReturnItem");
-            for (Iterator<GenericValue> itemIter = items.iterator(); itemIter.hasNext();) {
-                GenericValue item = itemIter.next();
+            for (GenericValue item : items) {
                 List<GenericValue> billings = item.getRelated("ReturnItemBilling");
-                for (Iterator<GenericValue> billIter = billings.iterator(); billIter.hasNext();) {
-                    GenericValue billing = billIter.next();
+                for (GenericValue billing : billings) {
                     GenericValue invoice = billing.getRelatedOne("Invoice");
 
                     // put the invoice in the map if it doesn't already exist (a very loopy way of doing group by invoiceId without creating a view)
@@ -1664,13 +1643,10 @@ public class OrderReturnServices {
             // for each return invoice found, sum up the related billings
             Map<String, BigDecimal> invoiceTotals = FastMap.newInstance(); // key is invoiceId, value is the sum of all billings for that invoice
             BigDecimal grandTotal = ZERO; // The sum of all return invoice totals
-            for (Iterator<GenericValue> iter = returnInvoices.values().iterator(); iter.hasNext();) {
-                GenericValue invoice = iter.next();
-
+            for (GenericValue invoice : returnInvoices.values()) {
                 List<GenericValue> billings = invoice.getRelated("ReturnItemBilling");
                 BigDecimal runningTotal = ZERO;
-                for (Iterator<GenericValue> billIter = billings.iterator(); billIter.hasNext();) {
-                    GenericValue billing = billIter.next();
+                for (GenericValue billing : billings) {
                     runningTotal = runningTotal.add(billing.getBigDecimal("amount").multiply(billing.getBigDecimal("quantity")).setScale(decimals, rounding));
                 }
 
@@ -1679,8 +1655,7 @@ public class OrderReturnServices {
             }
 
             // now allocate responseAmount * invoiceTotal / grandTotal to each invoice
-            for (Iterator<GenericValue> iter = returnInvoices.values().iterator(); iter.hasNext();) {
-                GenericValue invoice = iter.next();
+            for (GenericValue invoice : returnInvoices.values()) {
                 String invoiceId = invoice.getString("invoiceId");
                 BigDecimal invoiceTotal = invoiceTotals.get(invoiceId);
 
@@ -1793,9 +1768,7 @@ public class OrderReturnServices {
                     Debug.logError(e, module);
                 }
                 if (orderCm != null) {
-                    Iterator<GenericValue> orderCmi = orderCm.iterator();
-                    while (orderCmi.hasNext()) {
-                        GenericValue v = orderCmi.next();
+                    for(GenericValue v : orderCm) {
                         contactMechs.add(GenericValue.create(v));
                     }
                     orderMap.put("orderContactMechs", contactMechs);
@@ -1829,10 +1802,8 @@ public class OrderReturnServices {
                 List<String> orderItemShipGroupIds = FastList.newInstance(); // this is used to store the ship group ids of the groups already added to the orderItemShipGroupInfo list
                 List<GenericValue> orderItemAssocs = FastList.newInstance();
                 if (returnItemList != null) {
-                    Iterator<GenericValue> returnItemIter = returnItemList.iterator();
                     int itemCount = 1;
-                    while (returnItemIter.hasNext()) {
-                        GenericValue returnItem = returnItemIter.next();
+                    for(GenericValue returnItem : returnItemList) {
                         GenericValue orderItem = null;
                         GenericValue product = null;
                         try {
@@ -1946,9 +1917,7 @@ public class OrderReturnServices {
                                         continue;
                                     }
                                     if (UtilValidate.isNotEmpty(repairItems)) {
-                                        Iterator<GenericValue> repairItemIt = repairItems.iterator();
-                                        while (repairItemIt.hasNext()) {
-                                            GenericValue repairItem = repairItemIt.next();
+                                        for(GenericValue repairItem : repairItems) {
                                             GenericValue repairItemProduct = null;
                                             try {
                                                 repairItemProduct = repairItem.getRelatedOne("AssocProduct");
@@ -2094,9 +2063,7 @@ public class OrderReturnServices {
                     List<GenericValue> orderRoles = orderHeader.getRelated("OrderRole");
                     Map<String, List<String>> orderRolesMap = FastMap.newInstance();
                     if (orderRoles != null) {
-                        Iterator<GenericValue> orderRolesIt = orderRoles.iterator();
-                        while (orderRolesIt.hasNext()) {
-                            GenericValue orderRole = orderRolesIt.next();
+                        for(GenericValue orderRole : orderRoles) {
                             List<String> parties = orderRolesMap.get(orderRole.getString("roleTypeId"));
                             if (parties == null) {
                                 parties = FastList.newInstance();
@@ -2173,9 +2140,7 @@ public class OrderReturnServices {
                                 "OrderProblemCreatingReturnItemResponseRecord", locale));
                     }
 
-                    Iterator<GenericValue> updateReturnItemIter = returnItemList.iterator();
-                    while (updateReturnItemIter.hasNext()) {
-                        GenericValue returnItem = updateReturnItemIter.next();
+                    for(GenericValue returnItem : returnItemList) {
                         Map<String, Object> updateReturnItemCtx = FastMap.newInstance();
                         updateReturnItemCtx.put("returnId", returnId);
                         updateReturnItemCtx.put("returnItemSeqId", returnItem.get("returnItemSeqId"));
@@ -2233,9 +2198,7 @@ public class OrderReturnServices {
         }
 
         if (returnItems != null) {
-            Iterator<GenericValue> ri = returnItems.iterator();
-            while (ri.hasNext()) {
-                GenericValue returnItem = ri.next();
+            for(GenericValue returnItem : returnItems) {
                 String orderItemSeqId = returnItem.getString("orderItemSeqId");
                 String orderId = returnItem.getString("orderId");
 
@@ -2250,9 +2213,7 @@ public class OrderReturnServices {
 
                 // cancel all current subscriptions
                 if (subscriptions != null) {
-                    Iterator<GenericValue> si = subscriptions.iterator();
-                    while (si.hasNext()) {
-                        GenericValue subscription = si.next();
+                    for(GenericValue subscription : subscriptions) {
                         Timestamp thruDate = subscription.getTimestamp("thruDate");
                         if (thruDate == null || thruDate.after(now)) {
                             subscription.set("thruDate", now);
@@ -2281,9 +2242,7 @@ public class OrderReturnServices {
      * @param returnTypeId the return type id
      */
     public static void groupReturnItemsByOrder(List<GenericValue> returnItems, Map<String, List<GenericValue>> returnItemsByOrderId, Map<String, BigDecimal> totalByOrder, Delegator delegator, String returnId, String returnTypeId) {
-        Iterator<GenericValue> itemIt = returnItems.iterator();
-        while (itemIt.hasNext()) {
-            GenericValue returnItem = itemIt.next();
+        for(GenericValue returnItem : returnItems) {
             String orderId = returnItem.getString("orderId");
             if (orderId != null) {
                 if (returnItemsByOrderId != null) {
@@ -2326,9 +2285,7 @@ public class OrderReturnServices {
 
         // We may also have some order-level adjustments, so we need to go through each order again and add those as well
         if ((totalByOrder != null) && (totalByOrder.keySet() != null)) {
-            Iterator<String> orderIterator = totalByOrder.keySet().iterator();
-            while (orderIterator.hasNext()) {
-                String orderId = orderIterator.next();
+            for(String orderId : totalByOrder.keySet()) {
                 // find returnAdjustment for returnHeader
                 Map<String, Object> condition = UtilMisc.<String, Object>toMap("returnId", returnId,
                                                "returnItemSeqId", org.ofbiz.common.DataModelConstants.SEQ_ID_NA,
@@ -2355,20 +2312,14 @@ public class OrderReturnServices {
                     "OrderErrorGettingReturnHeaderItemInformation", locale));
         }
         if ((returnItems != null) && (returnItems.size() > 0)) {
-            Iterator<GenericValue> returnItemIterator = returnItems.iterator();
-            GenericValue returnItem = null;
-            GenericValue returnItemResponse = null;
-            GenericValue payment = null;
-            String orderId;
             List<String> paymentList = FastList.newInstance();
-            while (returnItemIterator.hasNext()) {
-                returnItem = returnItemIterator.next();
-                orderId = returnItem.getString("orderId");
+            for(GenericValue returnItem : returnItems) {
+                String orderId = returnItem.getString("orderId");
                 try {
-                    returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse");
+                    GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse");
                     if ((returnItemResponse != null) && (orderId != null)) {
                         // TODO should we filter on payment's status (PMNT_SENT,PMNT_RECEIVED)
-                        payment = returnItemResponse.getRelatedOne("Payment");
+                        GenericValue payment = returnItemResponse.getRelatedOne("Payment");
                         if ((payment != null) && (payment.getBigDecimal("amount") != null) &&
                                 !paymentList.contains(payment.get("paymentId"))) {
                             UtilMisc.addToBigDecimalInMap(returnAmountByOrder, orderId, payment.getBigDecimal("amount"));
@@ -2407,9 +2358,7 @@ public class OrderReturnServices {
         }
 
         if ((returnAmountByOrder != null) && (returnAmountByOrder.keySet() != null)) {
-            Iterator<String> orderIterator = returnAmountByOrder.keySet().iterator();
-            while (orderIterator.hasNext()) {
-                String orderId = orderIterator.next();
+            for(String orderId : returnAmountByOrder.keySet()) {
                 BigDecimal returnAmount = returnAmountByOrder.get(orderId);
                 if (returnAmount.abs().compareTo(new BigDecimal("0.000001")) < 0) {
                     Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] less than zero", module);
@@ -2662,9 +2611,7 @@ public class OrderReturnServices {
             // TODO: find on a view-entity with a sum is probably more efficient
             adjustments = delegator.findByAnd("ReturnAdjustment", condition);
             if (adjustments != null) {
-                Iterator<GenericValue> adjustmentIterator = adjustments.iterator();
-                while (adjustmentIterator.hasNext()) {
-                    GenericValue returnAdjustment = adjustmentIterator.next();
+                for(GenericValue returnAdjustment : adjustments) {
                     if ((returnAdjustment != null) && (returnAdjustment.get("amount") != null)) {
                        total = total.add(returnAdjustment.getBigDecimal("amount"));
                     }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Mon Mar 26 11:08:11 2012
@@ -925,11 +925,10 @@ public class OrderServices {
         Set<String> orderProductPromoCodes = UtilGenerics.checkSet(context.get("orderProductPromoCodes"));
         if (UtilValidate.isNotEmpty(orderProductPromoCodes)) {
             GenericValue orderProductPromoCode = delegator.makeValue("OrderProductPromoCode");
-            Iterator<String> orderProductPromoCodeIter = orderProductPromoCodes.iterator();
-            while (orderProductPromoCodeIter.hasNext()) {
+            for(String productPromoCodeId : orderProductPromoCodes) {
                 orderProductPromoCode.clear();
                 orderProductPromoCode.set("orderId", orderId);
-                orderProductPromoCode.set("productPromoCodeId", orderProductPromoCodeIter.next());
+                orderProductPromoCode.set("productPromoCodeId", productPromoCodeId);
                 toBeStored.add(orderProductPromoCode);
             }
         }
@@ -4891,8 +4890,7 @@ public class OrderServices {
             // the original method did a "\d+" regexp to decide which is the case, this version is more explicit with its lookup of PaymentMethodType
             if (checkOutPaymentId != null) {
                 List<GenericValue> paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, null, null, true);
-                for (Iterator<GenericValue> iter = paymentMethodTypes.iterator(); iter.hasNext();) {
-                    GenericValue type = iter.next();
+                for (GenericValue type : paymentMethodTypes) {
                     if (type.get("paymentMethodTypeId").equals(checkOutPaymentId)) {
                         paymentMethodTypeId = (String) type.get("paymentMethodTypeId");
                         break;

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java Mon Mar 26 11:08:11 2012
@@ -19,7 +19,6 @@
 package org.ofbiz.order.quote;
 
 import java.sql.Timestamp;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -192,9 +191,7 @@ public class QuoteServices {
 
                 // create Quote Items
                 if (UtilValidate.isNotEmpty(quoteItems)) {
-                    Iterator<GenericValue> quoteIt = quoteItems.iterator();
-                    while (quoteIt.hasNext()) {
-                        GenericValue quoteItem = quoteIt.next();
+                    for(GenericValue quoteItem : quoteItems) {
                         quoteItem.set("quoteId", quoteId);
                         Map<String, Object> quoteItemIn = quoteItem.getAllFields();
                         quoteItemIn.put("userLogin", userLogin);
@@ -205,9 +202,7 @@ public class QuoteServices {
 
                 // create Quote Attributes
                 if (UtilValidate.isNotEmpty(quoteAttributes)) {
-                    Iterator<GenericValue> quoteAttrIt = quoteAttributes.iterator();
-                    while (quoteAttrIt.hasNext()) {
-                        GenericValue quoteAttr = quoteAttrIt.next();
+                    for(GenericValue quoteAttr : quoteAttributes) {
                         quoteAttr.set("quoteId", quoteId);
                         Map<String, Object> quoteAttrIn = quoteAttr.getAllFields();
                         quoteAttrIn.put("userLogin", userLogin);
@@ -218,9 +213,7 @@ public class QuoteServices {
 
                 // create Quote Coefficients
                 if (UtilValidate.isNotEmpty(quoteCoefficients)) {
-                    Iterator<GenericValue> quoteCoefficientIt = quoteCoefficients.iterator();
-                    while (quoteCoefficientIt.hasNext()) {
-                        GenericValue quoteCoefficient = quoteCoefficientIt.next();
+                    for(GenericValue quoteCoefficient : quoteCoefficients) {
                         quoteCoefficient.set("quoteId", quoteId);
                         Map<String, Object> quoteCoefficientIn = quoteCoefficient.getAllFields();
                         quoteCoefficientIn.put("userLogin", userLogin);
@@ -231,9 +224,7 @@ public class QuoteServices {
 
                 // create Quote Roles
                 if (UtilValidate.isNotEmpty(quoteRoles)) {
-                    Iterator<GenericValue> quoteRoleIt = quoteRoles.iterator();
-                    while (quoteRoleIt.hasNext()) {
-                        GenericValue quoteRole = quoteRoleIt.next();
+                    for(GenericValue quoteRole : quoteRoles) {
                         quoteRole.set("quoteId", quoteId);
                         Map<String, Object> quoteRoleIn = quoteRole.getAllFields();
                         quoteRoleIn.put("userLogin", userLogin);
@@ -244,9 +235,7 @@ public class QuoteServices {
 
                 // create Quote WorkEfforts
                 if (UtilValidate.isNotEmpty(quoteWorkEfforts)) {
-                    Iterator<GenericValue> quoteWorkEffortIt = quoteWorkEfforts.iterator();
-                    while (quoteWorkEffortIt.hasNext()) {
-                        GenericValue quoteWorkEffort = quoteWorkEffortIt.next();
+                    for(GenericValue quoteWorkEffort : quoteWorkEfforts) {
                         quoteWorkEffort.set("quoteId", quoteId);
                         Map<String, Object> quoteWorkEffortIn = quoteWorkEffort.getAllFields();
                         quoteWorkEffortIn.put("userLogin", userLogin);
@@ -257,9 +246,7 @@ public class QuoteServices {
 
                 // create Quote Adjustments
                 if (UtilValidate.isNotEmpty(quoteAdjustments)) {
-                    Iterator<GenericValue> quoteAdjustmentIt = quoteAdjustments.iterator();
-                    while (quoteAdjustmentIt.hasNext()) {
-                        GenericValue quoteAdjustment = quoteAdjustmentIt.next();
+                    for(GenericValue quoteAdjustment : quoteAdjustments) {
                         quoteAdjustment.set("quoteId", quoteId);
                         Map<String, Object> quoteAdjustmentIn = quoteAdjustment.getAllFields();
                         quoteAdjustmentIn.put("userLogin", userLogin);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java Mon Mar 26 11:08:11 2012
@@ -99,9 +99,8 @@ public class RequirementServices {
 
             // join in fields with extra data about the suppliers and products
             List<Map<String, Object>> requirements = FastList.newInstance();
-            for (Iterator<GenericValue> iter = requirementAndRoles.iterator(); iter.hasNext();) {
+            for(GenericValue requirement : requirementAndRoles) {
                 Map<String, Object> union = FastMap.newInstance();
-                GenericValue requirement = iter.next();
                 String productId = requirement.getString("productId");
                 partyId = requirement.getString("partyId");
                 String facilityId = requirement.getString("facilityId");
@@ -217,8 +216,7 @@ public class RequirementServices {
             }
             String facilityId = productStore.getString("inventoryFacilityId");
             List<GenericValue> orderItems = order.getRelated("OrderItem");
-            for (Iterator<GenericValue> iter = orderItems.iterator(); iter.hasNext();) {
-                GenericValue item = iter.next();
+            for(GenericValue item : orderItems) {
                 GenericValue product = item.getRelatedOne("Product");
                 if (product == null) continue;
                 if ((!"PRODRQM_AUTO".equals(product.get("requirementMethodEnumId")) &&
@@ -277,8 +275,7 @@ public class RequirementServices {
             }
             String facilityId = productStore.getString("inventoryFacilityId");
             List<GenericValue> orderItems = order.getRelated("OrderItem");
-            for (Iterator<GenericValue> iter = orderItems.iterator(); iter.hasNext();) {
-                GenericValue item = iter.next();
+            for(GenericValue item : orderItems) {
                 GenericValue product = item.getRelatedOne("Product");
                 if (product == null) continue;
 
@@ -312,8 +309,7 @@ public class RequirementServices {
                         EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "REQ_REJECTED")),
                         EntityOperator.AND);
                 List<GenericValue> requirements = delegator.findList("Requirement", ecl, null, null, null, false);
-                for (Iterator<GenericValue> riter = requirements.iterator(); riter.hasNext();) {
-                    GenericValue requirement = riter.next();
+                for(GenericValue requirement : requirements) {
                     pendingRequirements = pendingRequirements.add(requirement.get("quantity") == null ? BigDecimal.ZERO : requirement.getBigDecimal("quantity"));
                 }
 

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=1305309&r1=1305308&r2=1305309&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java Mon Mar 26 11:08:11 2012
@@ -18,8 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.order.shoppingcart;
 
-import java.util.Iterator;
-
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionEvent;
 import javax.servlet.http.HttpSessionListener;
@@ -78,10 +76,8 @@ public class CartEventListener implement
             }
 
             Debug.logInfo("Saving abandoned cart", module);
-            Iterator<ShoppingCartItem> cartItems = cart.iterator();
             int seqId = 1;
-            while (cartItems.hasNext()) {
-                ShoppingCartItem cartItem = cartItems.next();
+            for(ShoppingCartItem cartItem : cart) {
                 GenericValue cartAbandonedLine = delegator.makeValue("CartAbandonedLine");
 
                 cartAbandonedLine.set("visitId", visit.get("visitId"));