svn commit: r1067522 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart: ShoppingCart.java ShoppingCartEvents.java ShoppingCartHelper.java

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

svn commit: r1067522 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart: ShoppingCart.java ShoppingCartEvents.java ShoppingCartHelper.java

mrisaliti
Author: mrisaliti
Date: Sat Feb  5 21:00:50 2011
New Revision: 1067522

URL: http://svn.apache.org/viewvc?rev=1067522&view=rev
Log:
Remove of compilation warnings of ShoppingCartHelper/ShoppingCartEvents and some related method invoked of ShoppingCart (OFBIZ-4102)

Modified:
    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

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1067522&r1=1067521&r2=1067522&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sat Feb  5 21:00:50 2011
@@ -106,7 +106,7 @@ public class ShoppingCart implements Ite
     private List<GenericValue> adjustments = FastList.newInstance();
     // OrderTerms
     private boolean orderTermSet = false;
-    private List orderTerms = new LinkedList();
+    private List<GenericValue> orderTerms = new LinkedList<GenericValue>();
 
     private List<ShoppingCartItem> cartLines = FastList.newInstance();
     private Map itemGroupByNumberMap = FastMap.newInstance();
@@ -2766,7 +2766,7 @@ public class ShoppingCart implements Ite
     }
 
     /** Get a List of orderTerms on the order (ie cart) */
-    public List getOrderTerms() {
+    public List<GenericValue> getOrderTerms() {
         return orderTerms;
     }
 
@@ -2811,9 +2811,9 @@ public class ShoppingCart implements Ite
         if (termTypeId == null) {
             return false;
         }
-        Iterator orderTermsIt = orderTerms.iterator();
+        Iterator<GenericValue> orderTermsIt = orderTerms.iterator();
         while (orderTermsIt.hasNext()) {
-            GenericValue orderTerm = (GenericValue)orderTermsIt.next();
+            GenericValue orderTerm = orderTermsIt.next();
             if (termTypeId.equals(orderTerm.getString("termTypeId"))) {
                 return true;
             }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1067522&r1=1067521&r2=1067522&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sat Feb  5 21:00:50 2011
@@ -21,8 +21,8 @@ package org.ofbiz.order.shoppingcart;
 import java.math.BigDecimal;
 import java.math.MathContext;
 import java.sql.Timestamp;
-import java.text.NumberFormat;
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -40,6 +40,7 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilFormatOut;
+import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
@@ -96,7 +97,7 @@ public class ShoppingCartEvents {
 
     public static String addItemGroup(HttpServletRequest request, HttpServletResponse response) {
         ShoppingCart cart = getCartObject(request);
-        Map parameters = UtilHttp.getParameterMap(request);
+        Map<String, Object> parameters = UtilHttp.getParameterMap(request);
         String groupName = (String) parameters.get("groupName");
         String parentGroupNumber = (String) parameters.get("parentGroupNumber");
         String groupNumber = cart.addItemGroup(groupName, parentGroupNumber);
@@ -106,7 +107,7 @@ public class ShoppingCartEvents {
 
     public static String addCartItemToGroup(HttpServletRequest request, HttpServletResponse response) {
         ShoppingCart cart = getCartObject(request);
-        Map parameters = UtilHttp.getParameterMap(request);
+        Map<String, Object> parameters = UtilHttp.getParameterMap(request);
         String itemGroupNumber = (String) parameters.get("itemGroupNumber");
         String indexStr = (String) parameters.get("lineIndex");
         int index = Integer.parseInt(indexStr);
@@ -122,7 +123,7 @@ public class ShoppingCartEvents {
         ShoppingCart cart = getCartObject(request);
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String controlDirective = null;
-        Map result = null;
+        Map<String, Object> result = null;
         String productId = null;
         String parentProductId = null;
         String itemType = null;
@@ -134,8 +135,8 @@ public class ShoppingCartEvents {
         BigDecimal quantity = BigDecimal.ZERO;
         String reservStartStr = null;
         String reservEndStr = null;
-        java.sql.Timestamp reservStart = null;
-        java.sql.Timestamp reservEnd = null;
+        Timestamp reservStart = null;
+        Timestamp reservEnd = null;
         String reservLengthStr = null;
         BigDecimal reservLength = null;
         String reservPersonsStr = null;
@@ -144,16 +145,15 @@ public class ShoppingCartEvents {
         String accommodationSpotId = null;
         String shipBeforeDateStr = null;
         String shipAfterDateStr = null;
-        java.sql.Timestamp shipBeforeDate = null;
-        java.sql.Timestamp shipAfterDate = null;
+        Timestamp shipBeforeDate = null;
+        Timestamp shipAfterDate = null;
 
         // not used right now: Map attributes = null;
         String catalogId = CatalogWorker.getCurrentCatalogId(request);
         Locale locale = UtilHttp.getLocale(request);
-        NumberFormat nf = NumberFormat.getNumberInstance(locale);
-
+      
         // Get the parameters as a MAP, remove the productId and quantity params.
-        Map paramMap = UtilHttp.getCombinedMap(request);
+        Map<String, Object> paramMap = UtilHttp.getCombinedMap(request);
 
         String itemGroupNumber = (String) paramMap.get("itemGroupNumber");
 
@@ -167,7 +167,8 @@ public class ShoppingCartEvents {
             try {
                 productId = (String) object;
             } catch (ClassCastException e) {
-                productId = (String) ((List) object).get(0);
+                List<String> productList = UtilGenerics.checkList(object);
+                productId = productList.get(0);
             }
         }
         if (paramMap.containsKey("PRODUCT_ID")) {
@@ -254,9 +255,9 @@ public class ShoppingCartEvents {
             if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, productId))) {
                 // get the selected features.
                 List<String> selectedFeatures = new LinkedList<String>();
-                java.util.Enumeration paramNames = request.getParameterNames();
+                Enumeration<String> paramNames = UtilGenerics.cast(request.getParameterNames());
                 while (paramNames.hasMoreElements()) {
-                    String paramName = (String) paramNames.nextElement();
+                    String paramName = paramNames.nextElement();
                     if (paramName.startsWith("FT")) {
                         selectedFeatures.add(request.getParameterValues(paramName)[0]);
                     }
@@ -457,10 +458,10 @@ public class ShoppingCartEvents {
         }
 
         // check for an add-to cart survey
-        List surveyResponses = null;
+        List<String> surveyResponses = null;
         if (productId != null) {
             String productStoreId = ProductStoreWorker.getProductStoreId(request);
-            List productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD", parentProductId);
+            List<GenericValue> productSurvey = ProductStoreWorker.getProductSurveys(delegator, productStoreId, productId, "CART_ADD", parentProductId);
             if (UtilValidate.isNotEmpty(productSurvey)) {
                 // TODO: implement multiple survey per product
                 GenericValue survey = EntityUtil.getFirst(productSurvey);
@@ -497,16 +498,16 @@ public class ShoppingCartEvents {
             String addToCartReplaceUpsell = productStore.getString("addToCartReplaceUpsell");
             try {
                 if ("Y".equals(addToCartRemoveIncompat)) {
-                    List productAssocs = null;
+                    List<GenericValue> productAssocs = null;
                     EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
                             EntityCondition.makeCondition(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId), EntityOperator.OR, EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, productId)),
                             EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_INCOMPATABLE")), EntityOperator.AND);
                     productAssocs = delegator.findList("ProductAssoc", cond, null, null, null, false);
                     productAssocs = EntityUtil.filterByDate(productAssocs);
-                    List productList = FastList.newInstance();
-                    Iterator iter = productAssocs.iterator();
+                    List<String> productList = FastList.newInstance();
+                    Iterator<GenericValue> iter = productAssocs.iterator();
                     while (iter.hasNext()) {
-                        GenericValue productAssoc = (GenericValue) iter.next();
+                        GenericValue productAssoc = iter.next();
                         if (productId.equals(productAssoc.getString("productId"))) {
                             productList.add(productAssoc.getString("productIdTo"));
                             continue;
@@ -516,9 +517,9 @@ public class ShoppingCartEvents {
                             continue;
                         }
                     }
-                    Iterator sciIter = cart.iterator();
+                    Iterator<ShoppingCartItem> sciIter = cart.iterator();
                     while (sciIter.hasNext()) {
-                        ShoppingCartItem sci = (ShoppingCartItem) sciIter.next();
+                        ShoppingCartItem sci = sciIter.next();
                         if (productList.contains(sci.getProductId())) {
                             try {
                                 cart.removeCartItem(sci, dispatcher);
@@ -529,15 +530,15 @@ public class ShoppingCartEvents {
                     }
                 }
                 if ("Y".equals(addToCartReplaceUpsell)) {
-                    List productList = null;
+                    List<GenericValue> productList = null;
                     EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
                             EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, productId),
                             EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "PRODUCT_UPGRADE")), EntityOperator.AND);
                     productList = delegator.findList("ProductAssoc", cond, UtilMisc.toSet("productId"), null, null, false);
                     if (productList != null) {
-                        Iterator sciIter = cart.iterator();
+                        Iterator<ShoppingCartItem> sciIter = cart.iterator();
                         while (sciIter.hasNext()) {
-                            ShoppingCartItem sci = (ShoppingCartItem) sciIter.next();
+                            ShoppingCartItem sci = sciIter.next();
                             if (productList.contains(sci.getProductId())) {
                                 try {
                                     cart.removeCartItem(sci, dispatcher);
@@ -598,7 +599,7 @@ public class ShoppingCartEvents {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String catalogId = CatalogWorker.getCurrentCatalogId(request);
-        Map result;
+        Map<String, Object> result;
         String controlDirective;
 
         boolean addAll = ("true".equals(request.getParameter("add_all")));
@@ -624,11 +625,11 @@ public class ShoppingCartEvents {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String controlDirective;
-        Map result;
+        Map<String, Object> result;
         // not used yet: Locale locale = UtilHttp.getLocale(request);
 
         //Convert the params to a map to pass in
-        Map paramMap = UtilHttp.getParameterMap(request);
+        Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
         String catalogId = CatalogWorker.getCurrentCatalogId(request);
         result = cartHelper.addToCartBulk(catalogId, categoryId, paramMap);
         controlDirective = processResult(result, request);
@@ -651,7 +652,7 @@ public class ShoppingCartEvents {
         // check the preferred currency of the supplier, if set, use that for the cart, otherwise use system defaults.
         ShoppingCart cart = null;
         try {
-         GenericValue supplierParty = delegator.findOne("Party", UtilMisc.toMap("partyId", supplierPartyId), false);
+            GenericValue supplierParty = delegator.findOne("Party", UtilMisc.toMap("partyId", supplierPartyId), false);
             if (UtilValidate.isNotEmpty(supplierParty.getString("preferredCurrencyUomId"))) {
                 cart = new WebShoppingCart(request, locale, supplierParty.getString("preferredCurrencyUomId"));
             } else {
@@ -721,11 +722,11 @@ public class ShoppingCartEvents {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String controlDirective;
-        Map result;
+        Map<String, Object> result;
         // not used yet: Locale locale = UtilHttp.getLocale(request);
 
         //Convert the params to a map to pass in
-        Map paramMap = UtilHttp.getParameterMap(request);
+        Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
         String catalogId = CatalogWorker.getCurrentCatalogId(request);
         result = cartHelper.addToCartBulkRequirements(catalogId, paramMap);
         controlDirective = processResult(result, request);
@@ -751,7 +752,7 @@ public class ShoppingCartEvents {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String controlDirective;
-        Map result;
+        Map<String, Object> result;
         BigDecimal totalQuantity;
         Locale locale = UtilHttp.getLocale(request);
 
@@ -763,7 +764,7 @@ public class ShoppingCartEvents {
             return "error";
         } else {
             totalQuantity = (BigDecimal)result.get("totalQuantity");
-            Map messageMap = UtilMisc.toMap("totalQuantity", UtilFormatOut.formatQuantity(totalQuantity.doubleValue()));
+            Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("totalQuantity", UtilFormatOut.formatQuantity(totalQuantity.doubleValue()));
 
             request.setAttribute("_EVENT_MESSAGE_",
                                   UtilProperties.getMessage(resource_error, "cart.add_category_defaults",
@@ -779,8 +780,8 @@ public class ShoppingCartEvents {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(null, dispatcher, cart);
         String controlDirective;
-        Map result;
-        Map paramMap = UtilHttp.getParameterMap(request);
+        Map<String, Object> result;
+        Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
         // not used yet: Locale locale = UtilHttp.getLocale(request);
 
         //Delegate the cart helper
@@ -805,10 +806,10 @@ public class ShoppingCartEvents {
         Security security = (Security) request.getAttribute("security");
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(null, dispatcher, cart);
         String controlDirective;
-        Map result;
+        Map<String, Object> result;
         // not used yet: Locale locale = UtilHttp.getLocale(request);
 
-        Map paramMap = UtilHttp.getParameterMap(request);
+        Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
 
         String removeSelectedFlag = request.getParameter("removeSelected");
         String selectedItems[] = request.getParameterValues("selectedItem");
@@ -903,7 +904,7 @@ public class ShoppingCartEvents {
                 Debug.logWarning("Invalid value for cart index =" + cartIndexStr, module);
             }
         }
-        List cartList = (List) session.getAttribute("shoppingCartList");
+        List<ShoppingCart> cartList = UtilGenerics.checkList(session.getAttribute("shoppingCartList"));
         if (UtilValidate.isEmpty(cartList)) {
             cartList = FastList.newInstance();
             session.setAttribute("shoppingCartList", cartList);
@@ -940,7 +941,7 @@ public class ShoppingCartEvents {
                 Debug.logWarning("Invalid value for cart index =" + cartIndexStr, module);
             }
         }
-        List cartList = (List) session.getAttribute("shoppingCartList");
+        List<ShoppingCart> cartList = UtilGenerics.checkList(session.getAttribute("shoppingCartList"));
         if (UtilValidate.isNotEmpty(cartList) && cartIndex >= 0 && cartIndex < cartList.size()) {
             cartList.remove(cartIndex);
         }
@@ -1024,9 +1025,9 @@ public class ShoppingCartEvents {
 
         if (cartLine.getIsPromo()) {
             // note that there should just be one promo adjustment, the reversal of the GWP, so use that to get the promo action key
-            Iterator checkOrderAdjustments = UtilMisc.toIterator(cartLine.getAdjustments());
+            Iterator<GenericValue> checkOrderAdjustments = UtilMisc.toIterator(cartLine.getAdjustments());
             while (checkOrderAdjustments != null && checkOrderAdjustments.hasNext()) {
-                GenericValue checkOrderAdjustment = (GenericValue) checkOrderAdjustments.next();
+                GenericValue checkOrderAdjustment = checkOrderAdjustments.next();
                 if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) &&
                         UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) &&
                         UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) {
@@ -1049,7 +1050,7 @@ public class ShoppingCartEvents {
         ShoppingCart cart = getCartObject(request);
         String partyId = request.getParameter("additionalPartyId");
         String roleTypeId[] = request.getParameterValues("additionalRoleTypeId");
-        List eventList = new LinkedList();
+        List<String> eventList = new LinkedList<String>();
         Locale locale = UtilHttp.getLocale(request);
         int i;
 
@@ -1059,7 +1060,8 @@ public class ShoppingCartEvents {
         }
 
         if (request.getAttribute("_EVENT_MESSAGE_LIST_") != null) {
-            eventList.addAll((List) request.getAttribute("_EVENT_MESSAGE_LIST_"));
+            List<String> msg = UtilGenerics.checkList(request.getAttribute("_EVENT_MESSAGE_LIST_"));
+            eventList.addAll(msg);
         }
 
         for (i = 0; i < roleTypeId.length; i++) {
@@ -1080,7 +1082,7 @@ public class ShoppingCartEvents {
         ShoppingCart cart = getCartObject(request);
         String partyId = request.getParameter("additionalPartyId");
         String roleTypeId[] = request.getParameterValues("additionalRoleTypeId");
-        List eventList = new LinkedList();
+        List<String> eventList = new LinkedList<String>();
         Locale locale = UtilHttp.getLocale(request);
         int i;
 
@@ -1090,7 +1092,8 @@ public class ShoppingCartEvents {
         }
 
         if (request.getAttribute("_EVENT_MESSAGE_LIST_") != null) {
-            eventList.addAll((List) request.getAttribute("_EVENT_MESSAGE_LIST_"));
+            List<String> msg = UtilGenerics.checkList(request.getAttribute("_EVENT_MESSAGE_LIST_"));
+            eventList.addAll(msg);
         }
 
         for (i = 0; i < roleTypeId.length; i++) {
@@ -1120,12 +1123,12 @@ public class ShoppingCartEvents {
      * in
      * @return one of NON_CRITICAL_ERROR, ERROR or NO_ERROR.
      */
-    private static String processResult(Map result, HttpServletRequest request) {
+    private static String processResult(Map<String, Object> result, HttpServletRequest request) {
         //Check for errors
         StringBuilder errMsg = new StringBuilder();
         if (result.containsKey(ModelService.ERROR_MESSAGE_LIST)) {
-            List errorMsgs = (List)result.get(ModelService.ERROR_MESSAGE_LIST);
-            Iterator iterator = errorMsgs.iterator();
+            List<String> errorMsgs = UtilGenerics.checkList(result.get(ModelService.ERROR_MESSAGE_LIST));
+            Iterator<String> iterator = errorMsgs.iterator();
             errMsg.append("<ul>");
             while (iterator.hasNext()) {
                 errMsg.append("<li>");
@@ -1158,7 +1161,7 @@ public class ShoppingCartEvents {
         ShoppingCart cart = getCartObject(request);
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String agreementId = request.getParameter("agreementId");
-        Map result = cartHelper.selectAgreement(agreementId);
+        Map<String, Object> result = cartHelper.selectAgreement(agreementId);
         if (ServiceUtil.isError(result)) {
            request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result));
            return "error";
@@ -1173,7 +1176,7 @@ public class ShoppingCartEvents {
         ShoppingCart cart = getCartObject(request);
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String currencyUomId = request.getParameter("currencyUomId");
-        Map result = cartHelper.setCurrency(currencyUomId);
+        Map<String, Object> result = cartHelper.setCurrency(currencyUomId);
         if (ServiceUtil.isError(result)) {
            request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(result));
            return "error";
@@ -1276,7 +1279,7 @@ public class ShoppingCartEvents {
             try {
                 Integer termIndex = Integer.parseInt(termIndexStr);
                 if (termIndex >= 0) {
-                    List orderTerms = cart.getOrderTerms();
+                    List<GenericValue> orderTerms = cart.getOrderTerms();
                     if (orderTerms != null && orderTerms.size() > termIndex) {
                         cart.removeOrderTerm(termIndex);
                     }
@@ -1299,7 +1302,7 @@ public class ShoppingCartEvents {
 
         ShoppingCart cart = null;
         try {
-            Map outMap = dispatcher.runSync("loadCartFromShoppingList",
+            Map<String, Object> outMap = dispatcher.runSync("loadCartFromShoppingList",
                     UtilMisc.<String, Object>toMap("shoppingListId", shoppingListId,
                     "userLogin", userLogin));
             cart = (ShoppingCart)outMap.get("shoppingCart");
@@ -1326,7 +1329,7 @@ public class ShoppingCartEvents {
 
         ShoppingCart cart = null;
         try {
-            Map outMap = dispatcher.runSync("loadCartFromQuote",
+            Map<String, Object> outMap = dispatcher.runSync("loadCartFromQuote",
                     UtilMisc.<String, Object>toMap("quoteId", quoteId,
                             "applyQuoteAdjustments", "true",
                             "userLogin", userLogin));
@@ -1377,8 +1380,8 @@ public class ShoppingCartEvents {
             cart.removeAdjustmentByType("PROMOTION_ADJUSTMENT");
             String shipGroupSeqId = null;
             long groupIndex = cart.getShipInfoSize();
-            List orderAdjustmentList = new ArrayList();
-            List orderAdjustments = new ArrayList();
+            List<GenericValue> orderAdjustmentList = new ArrayList<GenericValue>();
+            List<GenericValue> orderAdjustments = new ArrayList<GenericValue>();
             orderAdjustments = cart.getAdjustments();
             try {
                 orderAdjustmentList = delegator.findList("OrderAdjustment", EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId), null, null, null, false);
@@ -1388,7 +1391,7 @@ public class ShoppingCartEvents {
             for (long itr = 1; itr <= groupIndex; itr++) {
                 shipGroupSeqId = UtilFormatOut.formatPaddedNumber(1, 5);
                 List<GenericValue> duplicateAdjustmentList = new ArrayList<GenericValue>();
-                for (GenericValue adjustment: (List<GenericValue>)orderAdjustmentList) {
+                for (GenericValue adjustment: orderAdjustmentList) {
                     if ("PROMOTION_ADJUSTMENT".equals(adjustment.get("orderAdjustmentTypeId"))) {
                         cart.addAdjustment(adjustment);
                     }
@@ -1403,7 +1406,7 @@ public class ShoppingCartEvents {
                         }
                     }
                 }
-                for (GenericValue orderAdjustment: (List<GenericValue>)orderAdjustments) {
+                for (GenericValue orderAdjustment: orderAdjustments) {
                     if ("OrderAdjustment".equals(orderAdjustment.getEntityName())) {
                         if (("SHIPPING_CHARGES".equals(orderAdjustment.get("orderAdjustmentTypeId"))) &&
                                 orderAdjustment.get("orderId").equals(orderId) &&
@@ -1438,7 +1441,7 @@ public class ShoppingCartEvents {
         String destroyCart = request.getParameter("destroyCart");
 
         ShoppingCart cart = getCartObject(request);
-        Map result = null;
+        Map<String, Object> result = null;
         String quoteId = null;
         try {
             result = dispatcher.runSync("createQuoteFromCart",
@@ -1468,7 +1471,7 @@ public class ShoppingCartEvents {
         String destroyCart = request.getParameter("destroyCart");
 
         ShoppingCart cart = getCartObject(request);
-        Map result = null;
+        Map<String, Object> result = null;
         String custRequestId = null;
         try {
             result = dispatcher.runSync("createCustRequestFromCart",
@@ -1531,7 +1534,7 @@ public class ShoppingCartEvents {
                         hasPermission = true;
                     } else {
                         // if the user is a rep of the store, then he also has permission
-                        List storeReps = null;
+                        List<GenericValue> storeReps = null;
                         try {
                             storeReps = delegator.findByAnd("ProductStoreRole", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"),
                                                             "partyId", userLogin.getString("partyId"), "roleTypeId", "SALES_REP"));
@@ -1645,10 +1648,10 @@ public class ShoppingCartEvents {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         ShoppingCart cart = getCartObject(request);
-        List manualPromotions = new LinkedList();
+        List<GenericValue> manualPromotions = new LinkedList<GenericValue>();
 
         // iterate through the context and find all keys that start with "productPromoId_"
-        Map context = UtilHttp.getParameterMap(request);
+        Map<String, Object> context = UtilHttp.getParameterMap(request);
         String keyPrefix = "productPromoId_";
         for (int i = 1; i <= 50; i++) {
             String productPromoId = (String)context.get(keyPrefix + i);
@@ -1677,7 +1680,7 @@ public class ShoppingCartEvents {
         ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
         ShoppingCartHelper cartHelper = new ShoppingCartHelper(delegator, dispatcher, cart);
         String controlDirective = null;
-        Map result = null;
+        Map<String, Object> result = null;
         String productId = null;
         String productCategoryId = null;
         String quantityStr = null;
@@ -1688,7 +1691,7 @@ public class ShoppingCartEvents {
         String itemDescription = "";
 
         // Get the parameters as a MAP, remove the productId and quantity params.
-        Map paramMap = UtilHttp.getParameterMap(request);
+        Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
 
         String itemGroupNumber = request.getParameter("itemGroupNumber");
 
@@ -1756,7 +1759,7 @@ public class ShoppingCartEvents {
                     itemDescription = (String) paramMap.remove("itemDescription" + thisSuffix);
                 }
 
-                Map itemAttributes = UtilMisc.toMap("itemDesiredDeliveryDate", itemDesiredDeliveryDateStr);
+                Map<String, Object> itemAttributes = UtilMisc.<String, Object>toMap("itemDesiredDeliveryDate", itemDesiredDeliveryDateStr);
 
                 if (quantity.compareTo(BigDecimal.ZERO) > 0) {
                     Debug.logInfo("Attempting to add to cart with productId = " + productId + ", categoryId = " + productCategoryId +
@@ -1795,7 +1798,7 @@ public class ShoppingCartEvents {
         String orderName = request.getParameter("orderName");
         String correspondingPoId = request.getParameter("correspondingPoId");
         Locale locale = UtilHttp.getLocale(request);
-        Map result = null;
+        Map<String, Object> result = null;
 
         // set the agreement if specified otherwise set the currency
         if (UtilValidate.isNotEmpty(agreementId)) {
@@ -1876,7 +1879,6 @@ public class ShoppingCartEvents {
     }
 
     public static String bulkAddProductsInApprovedOrder(HttpServletRequest request, HttpServletResponse response) {
-        Delegator delegator = (Delegator) request.getAttribute("delegator");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         Locale locale = UtilHttp.getLocale(request);
         String productId = null;
@@ -1889,8 +1891,9 @@ public class ShoppingCartEvents {
         String orderId = null;
         String shipGroupSeqId = null;
 
-        Map paramMap = UtilHttp.getParameterMap(request);
-        String itemGroupNumber = request.getParameter("itemGroupNumber");
+        Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
+        //FIXME can be removed ?
+        // String itemGroupNumber = request.getParameter("itemGroupNumber");
         int rowCount = UtilHttp.getMultiFormRowCount(paramMap);
         if (rowCount < 1) {
             Debug.logWarning("No rows to process, as rowCount = " + rowCount, module);
@@ -1957,7 +1960,7 @@ public class ShoppingCartEvents {
                             ", quantity = " + quantity + ", itemType = " + itemType + " and itemDescription = " + itemDescription, module);
                     HttpSession session = request.getSession();
                     GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
-                    Map appendOrderItemMap = FastMap.newInstance();
+                    Map<String, Object> appendOrderItemMap = FastMap.newInstance();
                     appendOrderItemMap.put("productId", productId);
                     appendOrderItemMap.put("quantity", quantity);
                     appendOrderItemMap.put("orderId", orderId);
@@ -1966,7 +1969,7 @@ public class ShoppingCartEvents {
                     appendOrderItemMap.put("itemDesiredDeliveryDate", itemDesiredDeliveryDate);
                     appendOrderItemMap.put("shipGroupSeqId", shipGroupSeqId);
                     try {
-                        Map result = dispatcher.runSync("appendOrderItem", appendOrderItemMap);
+                        Map<String, Object> result = dispatcher.runSync("appendOrderItem", appendOrderItemMap);
                         request.setAttribute("shoppingCart", (ShoppingCart) result.get("shoppingCart"));
                         ShoppingCartEvents.destroyCart(request, response);
                     } catch (GenericServiceException e) {

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1067522&r1=1067521&r2=1067522&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Sat Feb  5 21:00:50 2011
@@ -98,12 +98,12 @@ public class ShoppingCartHelper {
     }
 
     /** Event to add an item to the shopping cart. */
-    public Map addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
+    public Map<String, Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
             String productCategoryId, String itemType, String itemDescription,
             BigDecimal price, BigDecimal amount, BigDecimal quantity,
             java.sql.Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
             java.sql.Timestamp shipBeforeDate, java.sql.Timestamp shipAfterDate,
-            ProductConfigWrapper configWrapper, String itemGroupNumber, Map context, String parentProductId) {
+            ProductConfigWrapper configWrapper, String itemGroupNumber, Map<String, ? extends Object> context, String parentProductId) {
 
         return addToCart(catalogId,shoppingListId,shoppingListItemSeqId,productId,
                 productCategoryId,itemType,itemDescription,price,amount,quantity,
@@ -112,14 +112,14 @@ public class ShoppingCartHelper {
     }
 
     /** Event to add an item to the shopping cart with accommodation. */
-    public Map addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
+    public Map<String, Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
             String productCategoryId, String itemType, String itemDescription,
             BigDecimal price, BigDecimal amount, BigDecimal quantity,
             java.sql.Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId,String accommodationSpotId,
             java.sql.Timestamp shipBeforeDate, java.sql.Timestamp shipAfterDate,
-            ProductConfigWrapper configWrapper, String itemGroupNumber, Map context, String parentProductId) {
-        Map result = null;
-        Map attributes = null;
+            ProductConfigWrapper configWrapper, String itemGroupNumber, Map<String, ? extends Object> context, String parentProductId) {
+        Map<String, Object> result = null;
+        Map<String, Object> attributes = null;
         String pProductId = null;
         pProductId = parentProductId;
         // price sanity check
@@ -180,7 +180,7 @@ public class ShoppingCartHelper {
         // Create a HashMap of product attributes - From ShoppingCartItem.attributeNames[]
         for (int namesIdx = 0; namesIdx < ShoppingCartItem.attributeNames.length; namesIdx++) {
             if (attributes == null)
-                attributes = new HashMap();
+                attributes = new HashMap<String, Object>();
             if (context.containsKey(ShoppingCartItem.attributeNames[namesIdx])) {
                 attributes.put(ShoppingCartItem.attributeNames[namesIdx], context.get(ShoppingCartItem.attributeNames[namesIdx]));
             }
@@ -205,11 +205,11 @@ public class ShoppingCartHelper {
         }
 
         // Get the additional features selected for the product (if any)
-        Map selectedFeatures = UtilHttp.makeParamMapWithPrefix(context, null, "FT", null);
-        Iterator selectedFeaturesTypes = selectedFeatures.keySet().iterator();
-        Map additionalFeaturesMap = FastMap.newInstance();
+        Map<String, Object> selectedFeatures = UtilHttp.makeParamMapWithPrefix(context, null, "FT", null);
+        Iterator<String> selectedFeaturesTypes = selectedFeatures.keySet().iterator();
+        Map<String, GenericValue> additionalFeaturesMap = FastMap.newInstance();
         while (selectedFeaturesTypes.hasNext()) {
-            String selectedFeatureType = (String)selectedFeaturesTypes.next();
+            String selectedFeatureType = selectedFeaturesTypes.next();
             String selectedFeatureValue = (String)selectedFeatures.get(selectedFeatureType);
             if (UtilValidate.isNotEmpty(selectedFeatureValue)) {
                 GenericValue productFeatureAndAppl = null;
@@ -265,9 +265,9 @@ public class ShoppingCartHelper {
         return result;
     }
 
-    public Map addToCartFromOrder(String catalogId, String orderId, String[] itemIds, boolean addAll, String itemGroupNumber) {
-        ArrayList errorMsgs = new ArrayList();
-        Map result;
+    public Map<String, Object> addToCartFromOrder(String catalogId, String orderId, String[] itemIds, boolean addAll, String itemGroupNumber) {
+        ArrayList<String> errorMsgs = new ArrayList<String>();
+        Map<String, Object> result;
         String errMsg = null;
 
         if (orderId == null || orderId.length() <= 0) {
@@ -277,8 +277,8 @@ public class ShoppingCartHelper {
         }
 
         boolean noItems = true;
-        List itemIdList = null;
-        Iterator itemIter = null;
+        List<? extends Object> itemIdList = null;
+        Iterator<? extends Object> itemIter = null;
         OrderReadHelper orderHelper = new OrderReadHelper(delegator, orderId);
         if (addAll) {
             itemIdList = orderHelper.getOrderItems();
@@ -364,7 +364,7 @@ public class ShoppingCartHelper {
      *  - name="quantity_${productId}" value="${quantity}
      *  - name="product_${whatever}" value="${productId}" (note: quantity is always 1)
      */
-    public Map addToCartBulk(String catalogId, String categoryId, Map context) {
+    public Map<String, Object> addToCartBulk(String catalogId, String categoryId, Map<String, ? extends Object> context) {
         String itemGroupNumber = (String) context.get("itemGroupNumber");
         // use this prefix for the main structure such as a checkbox or a text input where name="quantity_${productId}" value="${quantity}"
         String keyPrefix = "quantity_";
@@ -375,9 +375,7 @@ public class ShoppingCartHelper {
         String ignSeparator = "_ign_";
 
         // iterate through the context and find all keys that start with "quantity_"
-        Iterator entryIter = context.entrySet().iterator();
-        while (entryIter.hasNext()) {
-            Map.Entry entry = (Map.Entry) entryIter.next();
+        for (Map.Entry<String, ? extends Object> entry : context.entrySet()) {
             String productId = null;
             String quantStr = null;
             String itemGroupNumberToUse = itemGroupNumber;
@@ -450,8 +448,7 @@ public class ShoppingCartHelper {
     /**
      * Adds a set of requirements to the cart.
      */
-    public Map addToCartBulkRequirements(String catalogId, Map context) {
-        NumberFormat nf = NumberFormat.getNumberInstance(this.cart.getLocale());
+    public Map<String, Object> addToCartBulkRequirements(String catalogId, Map<String, ? extends Object> context) {
         String itemGroupNumber = (String) context.get("itemGroupNumber");
         // check if we are using per row submit
         boolean useRowSubmit = (!context.containsKey("_useRowSubmit"))? false :
@@ -508,10 +505,10 @@ public class ShoppingCartHelper {
                         quantity = BigDecimal.ZERO;
                     }
                     if (quantity.compareTo(BigDecimal.ZERO) > 0) {
-                        Iterator items = this.cart.iterator();
+                        Iterator<ShoppingCartItem> items = this.cart.iterator();
                         boolean requirementAlreadyInCart = false;
                         while (items.hasNext() && !requirementAlreadyInCart) {
-                            ShoppingCartItem sci = (ShoppingCartItem)items.next();
+                            ShoppingCartItem sci = items.next();
                             if (sci.getRequirementId() != null && sci.getRequirementId().equals(requirementId)) {
                                 requirementAlreadyInCart = true;
                                 continue;
@@ -544,9 +541,9 @@ public class ShoppingCartHelper {
      * for each; if no default for a certain product in the category, or if
      * quantity is 0, do not add
      */
-    public Map addCategoryDefaults(String catalogId, String categoryId, String itemGroupNumber) {
-        ArrayList errorMsgs = new ArrayList();
-        Map result = null;
+    public Map<String, Object> addCategoryDefaults(String catalogId, String categoryId, String itemGroupNumber) {
+        ArrayList<String> errorMsgs = new ArrayList<String>();
+        Map<String, Object> result = null;
         String errMsg = null;
 
         if (categoryId == null || categoryId.length() <= 0) {
@@ -555,13 +552,13 @@ public class ShoppingCartHelper {
             return result;
         }
 
-        Collection prodCatMemberCol = null;
+        Collection<GenericValue> prodCatMemberCol = null;
 
         try {
             prodCatMemberCol = delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productCategoryId", categoryId));
         } catch (GenericEntityException e) {
             Debug.logWarning(e.toString(), module);
-            Map messageMap = UtilMisc.toMap("categoryId", categoryId);
+            Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("categoryId", categoryId);
             messageMap.put("message", e.getMessage());
             errMsg = UtilProperties.getMessage(resource_error,"cart.could_not_get_products_in_category_cart", messageMap, this.cart.getLocale());
             result = ServiceUtil.returnError(errMsg);
@@ -569,17 +566,17 @@ public class ShoppingCartHelper {
         }
 
         if (prodCatMemberCol == null) {
-            Map messageMap = UtilMisc.toMap("categoryId", categoryId);
+            Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("categoryId", categoryId);
             errMsg = UtilProperties.getMessage(resource_error,"cart.could_not_get_products_in_category", messageMap, this.cart.getLocale());
             result = ServiceUtil.returnError(errMsg);
             return result;
         }
 
         BigDecimal totalQuantity = BigDecimal.ZERO;
-        Iterator pcmIter = prodCatMemberCol.iterator();
+        Iterator<GenericValue> pcmIter = prodCatMemberCol.iterator();
 
         while (pcmIter.hasNext()) {
-            GenericValue productCategoryMember = (GenericValue) pcmIter.next();
+            GenericValue productCategoryMember = pcmIter.next();
             BigDecimal quantity = productCategoryMember.getBigDecimal("quantity");
 
             if (quantity != null && quantity.compareTo(BigDecimal.ZERO) > 0) {
@@ -607,14 +604,14 @@ public class ShoppingCartHelper {
     }
 
     /** Delete an item from the shopping cart. */
-    public Map deleteFromCart(Map context) {
-        Map result = null;
-        Set names = context.keySet();
-        Iterator i = names.iterator();
-        ArrayList errorMsgs = new ArrayList();
+    public Map<String, Object> deleteFromCart(Map<String, ? extends Object> context) {
+        Map<String, Object> result = null;
+        Set<String> names = context.keySet();
+        Iterator<String> i = names.iterator();
+        ArrayList<String> errorMsgs = new ArrayList<String>();
 
         while (i.hasNext()) {
-            String o = (String) i.next();
+            String o = i.next();
 
             if (o.toUpperCase().startsWith("DELETE")) {
                 try {
@@ -641,17 +638,17 @@ public class ShoppingCartHelper {
     }
 
     /** Update the items in the shopping cart. */
-    public Map modifyCart(Security security, GenericValue userLogin, Map context, boolean removeSelected, String[] selectedItems, Locale locale) {
-        Map result = null;
+    public Map<String, Object> modifyCart(Security security, GenericValue userLogin, Map<String, ? extends Object> context, boolean removeSelected, String[] selectedItems, Locale locale) {
+        Map<String, Object> result = null;
         if (locale == null) {
             locale = this.cart.getLocale();
         }
 
-        ArrayList deleteList = new ArrayList();
-        ArrayList errorMsgs = new ArrayList();
+        ArrayList<ShoppingCartItem> deleteList = new ArrayList<ShoppingCartItem>();
+        ArrayList<String> errorMsgs = new ArrayList<String>();
 
-        Set parameterNames = context.keySet();
-        Iterator parameterNameIter = parameterNames.iterator();
+        Set<String> parameterNames = context.keySet();
+        Iterator<String> parameterNameIter = parameterNames.iterator();
 
         BigDecimal oldQuantity = BigDecimal.ONE.negate();
         String oldDescription = "";
@@ -666,7 +663,7 @@ public class ShoppingCartHelper {
 
         // TODO: This should be refactored to use UtilHttp.parseMultiFormData(parameters)
         while (parameterNameIter.hasNext()) {
-            String parameterName = (String) parameterNameIter.next();
+            String parameterName = parameterNameIter.next();
             int underscorePos = parameterName.lastIndexOf('_');
 
             if (underscorePos >= 0) {
@@ -862,10 +859,10 @@ public class ShoppingCartHelper {
             }
         }
 
-        Iterator di = deleteList.iterator();
+        Iterator<ShoppingCartItem> di = deleteList.iterator();
 
         while (di.hasNext()) {
-            ShoppingCartItem item = (ShoppingCartItem) di.next();
+            ShoppingCartItem item = di.next();
             int itemIndex = this.cart.getItemIndex(item);
 
             if (Debug.infoOn())
@@ -873,7 +870,7 @@ public class ShoppingCartHelper {
             try {
                 this.cart.removeCartItem(itemIndex, dispatcher);
             } catch (CartItemModifyException e) {
-                result = ServiceUtil.returnError(new ArrayList());
+                result = ServiceUtil.returnError(new ArrayList<String>());
                 errorMsgs.add(e.getMessage());
             }
         }
@@ -912,7 +909,7 @@ public class ShoppingCartHelper {
             throw new IllegalArgumentException("No delegator available to lookup ProductFeature");
         }
 
-        Map fields = UtilMisc.toMap("productId", productId, "productFeatureId", featureId);
+        Map<String, String> fields = UtilMisc.<String, String>toMap("productId", productId, "productFeatureId", featureId);
         if (optionField != null) {
             int featureTypeStartIndex = optionField.indexOf('^') + 1;
             int featureTypeEndIndex = optionField.lastIndexOf('_');
@@ -922,7 +919,7 @@ public class ShoppingCartHelper {
         }
 
         GenericValue productFeatureAppl = null;
-        List features = null;
+        List<GenericValue> features = null;
         try {
             features = delegator.findByAnd("ProductFeatureAndAppl", fields, UtilMisc.toList("-fromDate"));
         } catch (GenericEntityException e) {
@@ -955,8 +952,8 @@ public class ShoppingCartHelper {
      *
      * @param agreementId
      */
-    public Map selectAgreement(String agreementId) {
-        Map result = null;
+    public Map<String, Object> selectAgreement(String agreementId) {
+        Map<String, Object> result = null;
         GenericValue agreement = null;
 
         if ((this.delegator == null) || (this.dispatcher == null) || (this.cart == null)) {
@@ -984,7 +981,7 @@ public class ShoppingCartHelper {
             cart.setAgreementId(agreementId);
             try {
                 // set the currency based on the pricing agreement
-                List agreementItems = agreement.getRelated("AgreementItem", UtilMisc.toMap("agreementItemTypeId", "AGREEMENT_PRICING_PR"), null);
+                List<GenericValue> agreementItems = agreement.getRelated("AgreementItem", UtilMisc.toMap("agreementItemTypeId", "AGREEMENT_PRICING_PR"), null);
                 if (agreementItems.size() > 0) {
                     GenericValue agreementItem = (GenericValue) agreementItems.get(0);
                     String currencyUomId = (String) agreementItem.get("currencyUomId");
@@ -1007,7 +1004,7 @@ public class ShoppingCartHelper {
                  // clear the existing order terms
                  cart.removeOrderTerms();
                  // set order terms based on agreement terms
-                 List agreementTerms = EntityUtil.filterByDate(agreement.getRelated("AgreementTerm"));
+                 List<GenericValue> agreementTerms = EntityUtil.filterByDate(agreement.getRelated("AgreementTerm"));
                  if (agreementTerms.size() > 0) {
                       for (int i = 0; agreementTerms.size() > i;i++) {
                            GenericValue agreementTerm = (GenericValue) agreementTerms.get(i);
@@ -1027,8 +1024,8 @@ public class ShoppingCartHelper {
         return result;
     }
 
-    public Map setCurrency(String currencyUomId) {
-        Map result = null;
+    public Map<String, Object> setCurrency(String currencyUomId) {
+        Map<String, Object> result = null;
 
         try {
             this.cart.setCurrency(this.dispatcher,currencyUomId);
@@ -1040,19 +1037,19 @@ public class ShoppingCartHelper {
         return result;
     }
 
-    public Map addOrderTerm(String termTypeId, BigDecimal termValue, Long termDays) {
+    public Map<String, Object> addOrderTerm(String termTypeId, BigDecimal termValue, Long termDays) {
         return addOrderTerm(termTypeId, termValue, termDays, null);
     }
 
-    public Map addOrderTerm(String termTypeId, BigDecimal termValue,Long termDays, String textValue) {
-        Map result = null;
+    public Map<String, Object> addOrderTerm(String termTypeId, BigDecimal termValue,Long termDays, String textValue) {
+        Map<String, Object> result = null;
         this.cart.addOrderTerm(termTypeId,termValue,termDays,textValue);
         result = ServiceUtil.returnSuccess();
         return result;
     }
 
-    public Map removeOrderTerm(int index) {
-        Map result = null;
+    public Map<String, Object> removeOrderTerm(int index) {
+        Map<String, Object> result = null;
         this.cart.removeOrderTerm(index);
         result = ServiceUtil.returnSuccess();
         return result;