You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/12/18 06:02:08 UTC

svn commit: r727642 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Author: jleroux
Date: Wed Dec 17 21:02:08 2008
New Revision: 727642

URL: http://svn.apache.org/viewvc?rev=727642&view=rev
Log:
Genericization and as much as possible new for loop style instead of iterator.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=727642&r1=727641&r2=727642&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Wed Dec 17 21:02:08 2008
@@ -19,27 +19,25 @@
 package org.ofbiz.order.shoppingcart;
 
 import java.math.BigDecimal;
+import java.sql.Timestamp;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.sql.Timestamp;
 
+import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityConditionList;
 import org.ofbiz.entity.condition.EntityExpr;
 import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.entity.util.EntityUtil;
@@ -60,7 +58,7 @@
     public static final String resource = "OrderUiLabels";
     public static final String resource_error = "OrderErrorUiLabels";
 
-    public static Map assignItemShipGroup(DispatchContext dctx, Map context) {
+    public static Map<String, Object> assignItemShipGroup(DispatchContext dctx, Map<String, Object> context) {
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
         Integer fromGroupIndex = (Integer) context.get("fromGroupIndex");
         Integer toGroupIndex = (Integer) context.get("toGroupIndex");
@@ -85,7 +83,7 @@
         return ServiceUtil.returnSuccess();
     }
 
-    public static Map setShippingOptions(DispatchContext dctx, Map context) {
+    public static Map<String, Object>setShippingOptions(DispatchContext dctx, Map<String, Object> context) {
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
         Integer groupIndex = (Integer) context.get("groupIndex");
         String shippingContactMechId = (String) context.get("shippingContactMechId");
@@ -130,13 +128,13 @@
         return ServiceUtil.returnSuccess();
     }
 
-    public static Map setPaymentOptions(DispatchContext dctx, Map context) {
+    public static Map<String, Object>setPaymentOptions(DispatchContext dctx, Map<String, Object> context) {
         Locale locale = (Locale) context.get("locale");
 
         return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderServiceNotYetImplemented",locale));
     }
 
-    public static Map setOtherOptions(DispatchContext dctx, Map context) {
+    public static Map<String, Object>setOtherOptions(DispatchContext dctx, Map<String, Object> context) {
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
         String orderAdditionalEmails = (String) context.get("orderAdditionalEmails");
         String correspondingPoId = (String) context.get("correspondingPoId");
@@ -151,7 +149,7 @@
         return ServiceUtil.returnSuccess();
     }
 
-    public static Map loadCartFromOrder(DispatchContext dctx, Map context) {
+    public static Map<String, Object>loadCartFromOrder(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -244,9 +242,9 @@
         }
 
         // load the payment infos
-        List orderPaymentPrefs = null;
+        List<GenericValue> orderPaymentPrefs = null;
         try {
-            List exprs = UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId));
+            List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId));
             exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_RECEIVED"));
             exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED"));
             exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_DECLINED"));
@@ -258,7 +256,7 @@
             return ServiceUtil.returnError(e.getMessage());
         }
         if (UtilValidate.isNotEmpty(orderPaymentPrefs)) {
-            Iterator oppi = orderPaymentPrefs.iterator();
+            Iterator<GenericValue> oppi = orderPaymentPrefs.iterator();
             while (oppi.hasNext()) {
                 GenericValue opp = (GenericValue) oppi.next();
                 String paymentId = opp.getString("paymentMethodId");
@@ -288,13 +286,10 @@
             Debug.log("No payment preferences found for order #" + orderId, module);
         }
 
-        List orderItems = orh.getValidOrderItems();
+        List<GenericValue> orderItems = orh.getValidOrderItems();
         long nextItemSeq = 0;
-        if (orderItems != null) {
-            Iterator i = orderItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = (GenericValue) i.next();
-
+        if (UtilValidate.isNotEmpty(orderItems)) {
+            for (GenericValue item : orderItems) {
                 // get the next item sequence id
                 String orderItemSeqId = item.getString("orderItemSeqId");
                 try {
@@ -376,7 +371,7 @@
                     try {
                         GenericValue product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
                         if ("AGGREGATED_CONF".equals(product.getString("productTypeId"))) {
-                            List productAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF", "productIdTo", product.getString("productId")));
+                            List<GenericValue>productAssocs = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF", "productIdTo", product.getString("productId")));
                             productAssocs = EntityUtil.filterByDate(productAssocs);
                             if (UtilValidate.isNotEmpty(productAssocs)) {
                                 productId = EntityUtil.getFirst(productAssocs).getString("productId");
@@ -454,7 +449,7 @@
                 cart.setPoNumber(item.getString("correspondingPoId"));
 
                 // set the item's ship group info
-                List shipGroups = orh.getOrderItemShipGroupAssocs(item);
+                List<GenericValue>shipGroups = orh.getOrderItemShipGroupAssocs(item);
                 for (int g = 0; g < shipGroups.size(); g++) {
                     GenericValue sgAssoc = (GenericValue) shipGroups.get(g);
                     Double shipGroupQty = OrderReadHelper.getOrderItemShipGroupQuantity(sgAssoc);
@@ -496,12 +491,12 @@
             }
         }
 
-        Map result = ServiceUtil.returnSuccess();
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         result.put("shoppingCart", cart);
         return result;
     }
     
-    public static Map loadCartFromQuote(DispatchContext dctx, Map context) {
+    public static Map<String, Object> loadCartFromQuote(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -543,10 +538,10 @@
         cart.setOrderName(quote.getString("quoteName"));
         cart.setChannelType(quote.getString("salesChannelEnumId"));
         
-        List quoteItems = null;
-        List quoteAdjs = null;
-        List quoteRoles = null;
-        List quoteAttributes = null;
+        List<GenericValue>quoteItems = null;
+        List<GenericValue>quoteAdjs = null;
+        List<GenericValue>quoteRoles = null;
+        List<GenericValue>quoteAttributes = null;
         try {
             quoteItems = quote.getRelated("QuoteItem", UtilMisc.toList("quoteItemSeqId"));
             quoteAdjs = quote.getRelated("QuoteAdjustment");
@@ -558,10 +553,8 @@
         }
         // set the role information
         cart.setOrderPartyId(quote.getString("partyId"));
-        if (quoteRoles != null) {
-            Iterator quoteRolesIt = quoteRoles.iterator();
-            while (quoteRolesIt.hasNext()) {
-                GenericValue quoteRole = (GenericValue)quoteRolesIt.next();
+        if (UtilValidate.isNotEmpty(quoteRoles)) {
+            for(GenericValue quoteRole : quoteRoles) {
                 String quoteRoleTypeId = quoteRole.getString("roleTypeId");
                 String quoteRolePartyId = quoteRole.getString("partyId");
                 if ("PLACING_CUSTOMER".equals(quoteRoleTypeId)) {
@@ -581,24 +574,20 @@
         }
 
         // set the attribute information
-        if (quoteAttributes != null) {
-            Iterator quoteAttributesIt = quoteAttributes.iterator();
-            while (quoteAttributesIt.hasNext()) {
-                GenericValue quoteAttribute = (GenericValue)quoteAttributesIt.next();
+        if (UtilValidate.isNotEmpty(quoteAttributes)) {
+            for(GenericValue quoteAttribute : quoteAttributes) {
                 cart.setOrderAttribute(quoteAttribute.getString("attrName"), quoteAttribute.getString("attrValue"));
             }
         }
 
         // Convert the quote adjustment to order header adjustments and
         // put them in a map: the key/values pairs are quoteItemSeqId/List of adjs
-        Map orderAdjsMap = new HashMap();
-        Iterator quoteAdjsIter = quoteAdjs.iterator();
-        while (quoteAdjsIter.hasNext()) {
-            GenericValue quoteAdj = (GenericValue)quoteAdjsIter.next();
-            List orderAdjs = (List)orderAdjsMap.get(quoteAdj.get("quoteItemSeqId"));
+        Map<String, List<GenericValue>> orderAdjsMap = FastMap.newInstance() ;
+        for (GenericValue quoteAdj : quoteAdjs) {
+            List<GenericValue> orderAdjs = (List<GenericValue>)orderAdjsMap.get(quoteAdj.get("quoteItemSeqId"));
             if (orderAdjs == null) {
-                orderAdjs = new LinkedList();
-                orderAdjsMap.put(quoteAdj.get("quoteItemSeqId"), orderAdjs);
+                orderAdjs = FastList.newInstance();
+                orderAdjsMap.put(quoteAdj.getString("quoteItemSeqId"), orderAdjs);
             }
             // convert quote adjustments to order adjustments
             GenericValue orderAdj = delegator.makeValue("OrderAdjustment");
@@ -630,13 +619,10 @@
         }
 
         long nextItemSeq = 0;
-        if (quoteItems != null) {
-            Iterator i = quoteItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = (GenericValue) i.next();
-
+        if (UtilValidate.isNotEmpty(quoteItems)) {
+            for(GenericValue quoteItem : quoteItems) {
                 // get the next item sequence id
-                String orderItemSeqId = item.getString("quoteItemSeqId");
+                String orderItemSeqId = quoteItem.getString("quoteItemSeqId");
                 try {
                     long seq = Long.parseLong(orderItemSeqId);
                     if (seq > nextItemSeq) {
@@ -647,22 +633,22 @@
                     return ServiceUtil.returnError(e.getMessage());
                 }
 
-                boolean isPromo = item.get("isPromo") != null && "Y".equals(item.getString("isPromo"));
+                boolean isPromo = quoteItem.get("isPromo") != null && "Y".equals(quoteItem.getString("isPromo"));
                 if (isPromo && !applyQuoteAdjustments) {
                     // do not include PROMO items
                     continue;
                 }
 
                 // not a promo item; go ahead and add it in
-                Double amount = item.getDouble("selectedAmount");
+                Double amount = quoteItem.getDouble("selectedAmount");
                 if (amount == null) {
                     amount = new Double(0);
                 }
-                Double quantity = item.getDouble("quantity");
+                Double quantity = quoteItem.getDouble("quantity");
                 if (quantity == null) {
                     quantity = new Double(0);
                 }
-                Double quoteUnitPrice = item.getDouble("quoteUnitPrice");
+                Double quoteUnitPrice = quoteItem.getDouble("quoteUnitPrice");
                 if (quoteUnitPrice == null) {
                     quoteUnitPrice = new Double(0);
                 }
@@ -673,16 +659,16 @@
                 }
                 
                 //rental product data
-                Timestamp reservStart = item.getTimestamp("reservStart");
-                Double reservLength = item.getDouble("reservLength");
-                Double reservPersons = item.getDouble("reservPersons");
-                //String accommodationMapId = item.getString("accommodationMapId");
-                //String accommodationSpotId = item.getString("accommodationSpotId");
+                Timestamp reservStart = quoteItem.getTimestamp("reservStart");
+                Double reservLength = quoteItem.getDouble("reservLength");
+                Double reservPersons = quoteItem.getDouble("reservPersons");
+                //String accommodationMapId = quoteItem.getString("accommodationMapId");
+                //String accommodationSpotId = quoteItem.getString("accommodationSpotId");
                 
                 int itemIndex = -1;
-                if (item.get("productId") == null) {
+                if (quoteItem.get("productId") == null) {
                     // non-product item
-                    String desc = item.getString("comments");
+                    String desc = quoteItem.getString("comments");
                     try {
                         // note that passing in null for itemGroupNumber as there is no real grouping concept in the quotes right now
                         itemIndex = cart.addNonProductItem(null, desc, null, null, quantity.doubleValue(), null, null, null, dispatcher);
@@ -692,10 +678,10 @@
                     }
                 } else {
                     // product item
-                    String productId = item.getString("productId");
+                    String productId = quoteItem.getString("productId");
                     ProductConfigWrapper configWrapper = null;
-                    if (UtilValidate.isNotEmpty(item.getString("configId"))) {
-                        configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, item.getString("configId"), productId, productStoreId, null, null, currency, locale, userLogin);
+                    if (UtilValidate.isNotEmpty(quoteItem.getString("configId"))) {
+                        configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, quoteItem.getString("configId"), productId, productStoreId, null, null, currency, locale, userLogin);
                     }                    
                     try {
                             itemIndex = cart.addItemToEnd(productId, amount, quantity.doubleValue(), quoteUnitPrice, reservStart, reservLength, reservPersons,null,null, null, null, null, configWrapper, null, dispatcher, new Boolean(!applyQuoteAdjustments), new Boolean(quoteUnitPrice.doubleValue() == 0), Boolean.FALSE, Boolean.FALSE);
@@ -713,15 +699,15 @@
                 ShoppingCartItem cartItem = cart.findCartItem(itemIndex);
                 cartItem.setOrderItemSeqId(orderItemSeqId);
                 // attach additional item information
-                cartItem.setItemComment(item.getString("comments"));
-                cartItem.setQuoteId(item.getString("quoteId"));
-                cartItem.setQuoteItemSeqId(item.getString("quoteItemSeqId"));
+                cartItem.setItemComment(quoteItem.getString("comments"));
+                cartItem.setQuoteId(quoteItem.getString("quoteId"));
+                cartItem.setQuoteItemSeqId(quoteItem.getString("quoteItemSeqId"));
                 cartItem.setIsPromo(isPromo);
-                //cartItem.setDesiredDeliveryDate(item.getTimestamp("estimatedDeliveryDate"));
-                //cartItem.setStatusId(item.getString("statusId"));
-                //cartItem.setItemType(item.getString("orderItemTypeId"));
-                //cartItem.setProductCategoryId(item.getString("productCategoryId"));
-                //cartItem.setShoppingList(item.getString("shoppingListId"), item.getString("shoppingListItemSeqId"));
+                //cartItem.setDesiredDeliveryDate(quoteItem.getTimestamp("estimatedDeliveryDate"));
+                //cartItem.setStatusId(quoteItem.getString("statusId"));
+                //cartItem.setItemType(quoteItem.getString("orderItemTypeId"));
+                //cartItem.setProductCategoryId(quoteItem.getString("productCategoryId"));
+                //cartItem.setShoppingList(quoteItem.getString("shoppingListId"), quoteItem.getString("shoppingListItemSeqId"));
             }
 
         }
@@ -729,7 +715,7 @@
         // If applyQuoteAdjustments is set to false then standard cart adjustments are used.
         if (applyQuoteAdjustments) {
             // The cart adjustments, derived from quote adjustments, are added to the cart
-            List adjs = (List)orderAdjsMap.get(null);
+            List<GenericValue> adjs = (List<GenericValue>)orderAdjsMap.get(null);
             if (adjs != null) {
                 cart.getAdjustments().addAll(adjs);
             }
@@ -755,12 +741,12 @@
             }
         }
 
-        Map result = ServiceUtil.returnSuccess();
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         result.put("shoppingCart", cart);
         return result;
     }
 
-    public static Map loadCartFromShoppingList(DispatchContext dctx, Map context) {
+    public static Map<String, Object>loadCartFromShoppingList(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
 
@@ -810,7 +796,7 @@
         // set the role information
         cart.setOrderPartyId(shoppingList.getString("partyId"));
 
-        List shoppingListItems = null;
+        List<GenericValue>shoppingListItems = null;
         try {
             shoppingListItems = shoppingList.getRelated("ShoppingListItem");
         } catch (GenericEntityException e) {
@@ -819,13 +805,10 @@
         }
 
         long nextItemSeq = 0;
-        if (shoppingListItems != null) {
-            Iterator i = shoppingListItems.iterator();
-            while (i.hasNext()) {
-                GenericValue item = (GenericValue) i.next();
-
+        if (UtilValidate.isNotEmpty(shoppingListItems)) {
+            for(GenericValue shoppingListItem : shoppingListItems) {        
                 // get the next item sequence id
-                String orderItemSeqId = item.getString("shoppingListItemSeqId");
+                String orderItemSeqId = shoppingListItem.getString("shoppingListItemSeqId");
                 try {
                     long seq = Long.parseLong(orderItemSeqId);
                     if (seq > nextItemSeq) {
@@ -836,22 +819,22 @@
                     return ServiceUtil.returnError(e.getMessage());
                 }
                 /*
-                Double amount = item.getDouble("selectedAmount");
+                Double amount = shoppingListItem.getDouble("selectedAmount");
                 if (amount == null) {
                     amount = new Double(0);
                 }
                  */
-                Double quantity = item.getDouble("quantity");
+                Double quantity = shoppingListItem.getDouble("quantity");
                 if (quantity == null) {
                     quantity = new Double(0);
                 }
                 int itemIndex = -1;
-                if (item.get("productId") != null) {
+                if (shoppingListItem.get("productId") != null) {
                     // product item
-                    String productId = item.getString("productId");
+                    String productId = shoppingListItem.getString("productId");
                     ProductConfigWrapper configWrapper = null;
-                    if (UtilValidate.isNotEmpty(item.getString("configId"))) {
-                        configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, item.getString("configId"), productId, productStoreId, null, null, currency, locale, userLogin);
+                    if (UtilValidate.isNotEmpty(shoppingListItem.getString("configId"))) {
+                        configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, shoppingListItem.getString("configId"), productId, productStoreId, null, null, currency, locale, userLogin);
                     }
                     try {
                         itemIndex = cart.addItemToEnd(productId, null, quantity.doubleValue(), null, null, null, null, null, configWrapper, dispatcher, Boolean.TRUE, Boolean.TRUE);
@@ -868,7 +851,7 @@
                 ShoppingCartItem cartItem = cart.findCartItem(itemIndex);
                 cartItem.setOrderItemSeqId(orderItemSeqId);
                 // attach additional item information
-                cartItem.setShoppingList(item.getString("shoppingListId"), item.getString("shoppingListItemSeqId"));
+                cartItem.setShoppingList(shoppingListItem.getString("shoppingListId"), shoppingListItem.getString("shoppingListItemSeqId"));
             }
 
         }
@@ -883,13 +866,13 @@
             }
         }
 
-        Map result = ServiceUtil.returnSuccess();
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         result.put("shoppingCart", cart);
         return result;
     }
     
-    public static Map getShoppingCartData(DispatchContext dctx, Map context){
-        Map result = ServiceUtil.returnSuccess();
+    public static Map<String, Object>getShoppingCartData(DispatchContext dctx, Map<String, Object> context){
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         Locale locale = (Locale) context.get("locale");
         ShoppingCart shoppingCart = (ShoppingCart) context.get("shoppingCart");
         if(shoppingCart != null){
@@ -907,7 +890,7 @@
             double orderAdjustmentsTotal = OrderReadHelper.calcOrderAdjustments(OrderReadHelper.getOrderHeaderAdjustments(shoppingCart.getAdjustments(), null), BigDecimal.valueOf(shoppingCart.getSubTotal()), true, true, true).doubleValue();
             result.put("displayOrderAdjustmentsTotalCurrencyFormatted", org.ofbiz.base.util.UtilFormatOut.formatCurrency(orderAdjustmentsTotal, isoCode, locale));
             Iterator i = shoppingCart.iterator();
-            Map cartItemData = FastMap.newInstance();
+            Map<String, Object> cartItemData = FastMap.newInstance();
             while (i.hasNext()) {
                 ShoppingCartItem cartLine = (ShoppingCartItem) i.next();
                 int cartLineIndex = shoppingCart.getItemIndex(cartLine);
@@ -920,12 +903,11 @@
         return result;
     }
     
-    public static Map getShoppingCartItemIndex(DispatchContext dctx, Map context){
-        Map result = ServiceUtil.returnSuccess();
-        Locale locale = (Locale) context.get("locale");
+    public static Map<String, Object>getShoppingCartItemIndex(DispatchContext dctx, Map<String, Object> context){
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         ShoppingCart shoppingCart = (ShoppingCart) context.get("shoppingCart");
         String productId = (String) context.get("productId");
-        if (shoppingCart != null && shoppingCart.items() != null && shoppingCart.items().size() > 0){
+        if (shoppingCart != null && UtilValidate.isNotEmpty(shoppingCart.items())){
             List allItems = shoppingCart.items(); 
             List items = shoppingCart.findAllCartItems(productId);
             if (items.size() > 0) {
@@ -937,8 +919,8 @@
         return result;
     }
     
-    public static Map resetShipGroupItems(DispatchContext dctx, Map context) {
-        Map result = ServiceUtil.returnSuccess();
+    public static Map<String, Object>resetShipGroupItems(DispatchContext dctx, Map<String, Object> context) {
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
         Iterator sciIter = cart.iterator();
         while (sciIter.hasNext()) {
@@ -949,13 +931,13 @@
         return result;
     }
     
-    public static Map prepareVendorShipGroups(DispatchContext dctx, Map context) {
+    public static Map<String, Object>prepareVendorShipGroups(DispatchContext dctx, Map<String, Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
-        Map result = ServiceUtil.returnSuccess();
+        Map<String, Object> result = ServiceUtil.returnSuccess();
         try {
-            Map resp = dispatcher.runSync("resetShipGroupItems", context);
+            Map<String, Object> resp = dispatcher.runSync("resetShipGroupItems", context);
             if (ServiceUtil.isError(resp)) {
                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resp));
             }
@@ -963,7 +945,7 @@
             Debug.logError(e.toString(), module);
             return ServiceUtil.returnError(e.toString());
         }
-        Map vendorMap = FastMap.newInstance();
+        Map<String, Object> vendorMap = FastMap.newInstance();
         Iterator sciIter = cart.iterator();
         while (sciIter.hasNext()) {
             ShoppingCartItem item = (ShoppingCartItem) sciIter.next();