Return-Path: Delivered-To: apmail-ofbiz-commits-archive@www.apache.org Received: (qmail 90028 invoked from network); 7 Feb 2011 20:29:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Feb 2011 20:29:50 -0000 Received: (qmail 2406 invoked by uid 500); 7 Feb 2011 20:29:50 -0000 Delivered-To: apmail-ofbiz-commits-archive@ofbiz.apache.org Received: (qmail 2362 invoked by uid 500); 7 Feb 2011 20:29:49 -0000 Mailing-List: contact commits-help@ofbiz.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ofbiz.apache.org Delivered-To: mailing list commits@ofbiz.apache.org Received: (qmail 2355 invoked by uid 99); 7 Feb 2011 20:29:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 20:29:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Feb 2011 20:29:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5CF1923889E1; Mon, 7 Feb 2011 20:29:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1068103 [1/2] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ specialpurpose/ebay/src/org/ofbiz/ebay/ specialpurpose/ebaystore/src/org/ofbiz/ebaystore/ specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/ Date: Mon, 07 Feb 2011 20:29:22 -0000 To: commits@ofbiz.apache.org From: mrisaliti@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110207202922.5CF1923889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mrisaliti Date: Mon Feb 7 20:29:21 2011 New Revision: 1068103 URL: http://svn.apache.org/viewvc?rev=1068103&view=rev Log: Remove all compilation warnings of ShoppingCart/ShoppingCartItem and related invoked methods (OFBIZ-4102) Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayOrderServices.java ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleCheckoutHelper.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=1068103&r1=1068102&r2=1068103&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 Mon Feb 7 20:29:21 2011 @@ -53,6 +53,7 @@ import java.util.*; /** * Shopping Cart Object */ +@SuppressWarnings("serial") public class ShoppingCart implements Iterable, Serializable { public static final String module = ShoppingCart.class.getName(); @@ -471,7 +472,7 @@ public class ShoppingCart implements Ite * @throws CartItemModifyException */ public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, - Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features, Map attributes, String prodCatalogId, + Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features, Map attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException { return addOrIncreaseItem(productId,selectedAmount,quantity,reservStart,reservLength,reservPersons, @@ -482,7 +483,7 @@ public class ShoppingCart implements Ite /** add rental (with accommodation) item to cart */ public int addOrIncreaseItem(String productId, BigDecimal selectedAmount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, - Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features, Map attributes, String prodCatalogId, + Timestamp shipBeforeDate, Timestamp shipAfterDate, Map features, Map attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, String itemGroupNumber, String parentProductId, LocalDispatcher dispatcher) throws CartItemModifyException, ItemNotFoundException { if (isReadOnlyCart()) { throw new CartItemModifyException("Cart items cannot be changed"); @@ -513,7 +514,7 @@ public class ShoppingCart implements Ite // check to see if the related fixed asset is available for the new quantity String isAvailable = ShoppingCartItem.checkAvailability(productId, newQuantity, reservStart, reservLength, this); if (isAvailable.compareTo("OK") != 0) { - Map messageMap = UtilMisc.toMap("productId", productId, "availableMessage", isAvailable); + Map messageMap = UtilMisc.toMap("productId", productId, "availableMessage", isAvailable); String excMsg = UtilProperties.getMessage(ShoppingCartItem.resource, "item.product_not_available", messageMap, this.getLocale()); Debug.logInfo(excMsg, module); throw new CartItemModifyException(isAvailable); @@ -566,7 +567,7 @@ public class ShoppingCart implements Ite * @throws CartItemModifyException */ public int addNonProductItem(String itemType, String description, String categoryId, BigDecimal price, BigDecimal quantity, - Map attributes, String prodCatalogId, String itemGroupNumber, LocalDispatcher dispatcher) throws CartItemModifyException { + Map attributes, String prodCatalogId, String itemGroupNumber, LocalDispatcher dispatcher) throws CartItemModifyException { ShoppingCart.ShoppingCartItemGroup itemGroup = this.getItemGroupByNumber(itemGroupNumber); return this.addItem(0, ShoppingCartItem.makeItem(Integer.valueOf(0), itemType, description, categoryId, price, null, quantity, attributes, prodCatalogId, itemGroup, dispatcher, this, Boolean.TRUE)); } @@ -596,47 +597,47 @@ public class ShoppingCart implements Ite } /** Add an item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, ProductConfigWrapper configWrapper, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, ProductConfigWrapper configWrapper, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, Boolean.FALSE, Boolean.FALSE)); } /** Add an item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(productId, amount, quantity, unitPrice, features, attributes, prodCatalogId, itemType, dispatcher, triggerExternalOps, triggerPriceRules, Boolean.FALSE, Boolean.FALSE); } /** Add an (rental)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersons, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, Boolean.FALSE, Boolean.FALSE)); } /** Add an (rental)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersons, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); } /** Add an (rental/aggregated)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap features, HashMap attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, HashMap features, HashMap attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersons, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); } /** Add an accommodation(rental)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, Boolean.FALSE, Boolean.FALSE)); } /** Add an accommodation(rental)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersons, accommodationMapId, accommodationSpotId, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); } /** Add an accommodation(rental/aggregated)item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersonsDbl,String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersonsDbl,String accommodationMapId, String accommodationSpotId, HashMap features, HashMap attributes, String prodCatalogId, ProductConfigWrapper configWrapper, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, reservStart, reservLength, reservPersonsDbl, accommodationMapId, accommodationSpotId, null, null, features, attributes, prodCatalogId, configWrapper, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); } /** Add an item to the shopping cart. */ - public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { + public int addItemToEnd(String productId, BigDecimal amount, BigDecimal quantity, BigDecimal unitPrice, HashMap features, HashMap attributes, String prodCatalogId, String itemType, LocalDispatcher dispatcher, Boolean triggerExternalOps, Boolean triggerPriceRules, Boolean skipInventoryChecks, Boolean skipProductChecks) throws CartItemModifyException, ItemNotFoundException { return addItemToEnd(ShoppingCartItem.makeItem(null, productId, amount, quantity, unitPrice, null, null, null, null, null, features, attributes, prodCatalogId, null, itemType, null, dispatcher, this, triggerExternalOps, triggerPriceRules, null, skipInventoryChecks, skipProductChecks)); } @@ -646,7 +647,7 @@ public class ShoppingCart implements Ite } /** Get a ShoppingCartItem from the cart object. */ - public ShoppingCartItem findCartItem(String productId, Map features, Map attributes, String prodCatalogId, BigDecimal selectedAmount) { + public ShoppingCartItem findCartItem(String productId, Map features, Map attributes, String prodCatalogId, BigDecimal selectedAmount) { // Check for existing cart item. for (int i = 0; i < this.cartLines.size(); i++) { ShoppingCartItem cartItem = cartLines.get(i); @@ -2004,11 +2005,11 @@ public class ShoppingCart implements Ite return this.shipInfo; } - public Map getShipGroups(ShoppingCartItem item) { - Map shipGroups = new LinkedHashMap(); + public Map getShipGroups(ShoppingCartItem item) { + Map shipGroups = new LinkedHashMap(); if (item != null) { for (int i = 0; i < this.shipInfo.size(); i++) { - CartShipInfo csi = (CartShipInfo) shipInfo.get(i); + CartShipInfo csi = shipInfo.get(i); CartShipInfo.CartShipItemInfo csii = csi.shipItemInfo.get(item); if (csii != null) { if (this.checkShipItemInfo(csi, csii)) { @@ -2020,7 +2021,7 @@ public class ShoppingCart implements Ite return shipGroups; } - public Map getShipGroups(int itemIndex) { + public Map getShipGroups(int itemIndex) { return this.getShipGroups(this.findCartItem(itemIndex)); } @@ -2075,11 +2076,11 @@ public class ShoppingCart implements Ite * @param item */ public void setShipGroupShipDatesFromItem(ShoppingCartItem item) { - Map shipGroups = this.getShipGroups(item); + Map shipGroups = this.getShipGroups(item); if ((shipGroups != null) && (shipGroups.keySet() != null)) { - for (Iterator shipGroupKeys = shipGroups.keySet().iterator(); shipGroupKeys.hasNext();) { - Integer shipGroup = (Integer) shipGroupKeys.next(); + for (Iterator shipGroupKeys = shipGroups.keySet().iterator(); shipGroupKeys.hasNext();) { + Integer shipGroup = shipGroupKeys.next(); CartShipInfo cartShipInfo = this.getShipInfo(shipGroup.intValue()); cartShipInfo.resetShipAfterDateIfBefore(item.getShipAfterDate()); @@ -3625,7 +3626,8 @@ public class ShoppingCart implements Ite Iterator fsppas = this.freeShippingProductPromoActions.iterator(); while (fsppas.hasNext()) { - GenericValue productPromoAction = fsppas.next(); + //FIXME can be removed ? + // GenericValue productPromoAction = fsppas.next(); // TODO - we need to change the way free shipping promotions work /* @@ -3665,7 +3667,8 @@ public class ShoppingCart implements Ite Iterator fsppas = this.freeShippingProductPromoActions.iterator(); while (fsppas.hasNext()) { - GenericValue productPromoAction = fsppas.next(); + //FIXME can be removed ? + // GenericValue productPromoAction = fsppas.next(); // TODO - fix the free shipping promotions!! /* @@ -3871,17 +3874,14 @@ public class ShoppingCart implements Ite } /** make a list of OrderContactMechs from the ShoppingCart and the ShoppingCartItems */ - public List makeAllOrderItemContactMechs() { - List allOrderContactMechs = new LinkedList(); + public List makeAllOrderItemContactMechs() { + List allOrderContactMechs = new LinkedList(); for (ShoppingCartItem item : cartLines) { - Map itemContactMechIds = item.getOrderItemContactMechIds(); + Map itemContactMechIds = item.getOrderItemContactMechIds(); if (itemContactMechIds != null) { - Iterator cMechIdsIter = itemContactMechIds.entrySet().iterator(); - - while (cMechIdsIter.hasNext()) { - Map.Entry entry = (Map.Entry) cMechIdsIter.next(); + for (Map.Entry entry: itemContactMechIds.entrySet()) { GenericValue orderContactMech = getDelegator().makeValue("OrderItemContactMech"); orderContactMech.set("contactMechPurposeTypeId", entry.getKey()); @@ -4108,8 +4108,8 @@ public class ShoppingCart implements Ite return result; } - public Map getShipGroupsBySupplier(String supplierPartyId) { - Map shipGroups = new TreeMap(); + public TreeMap getShipGroupsBySupplier(String supplierPartyId) { + TreeMap shipGroups = new TreeMap(); for (int i = 0; i < this.shipInfo.size(); i++) { CartShipInfo csi = (CartShipInfo) shipInfo.get(i); if ((csi.supplierPartyId == null && supplierPartyId == null) || @@ -4139,15 +4139,15 @@ public class ShoppingCart implements Ite } } - List shipGroups = getShipGroups(); + List shipGroups = getShipGroups(); if (shipGroups == null) return; // Intermediate structure supplierPartyId -> { ShoppingCartItem = { originalShipGroupIndex = dropShipQuantity } } to collect drop-shippable items - Map dropShipItems = new HashMap(); + Map>> dropShipItems = new HashMap>>(); for (int shipGroupIndex = 0; shipGroupIndex < shipGroups.size(); shipGroupIndex++) { - CartShipInfo shipInfo = (CartShipInfo) shipGroups.get(shipGroupIndex); + CartShipInfo shipInfo = shipGroups.get(shipGroupIndex); // Ignore ship groups that are already drop shipped String shipGroupSupplierPartyId = shipInfo.getSupplierPartyId(); @@ -4156,13 +4156,13 @@ public class ShoppingCart implements Ite } // Ignore empty ship groups - Set shipItems = shipInfo.getShipItems(); + Set shipItems = shipInfo.getShipItems(); if (UtilValidate.isEmpty(shipItems)) continue; - Iterator siit = shipItems.iterator(); + Iterator siit = shipItems.iterator(); while (siit.hasNext()) { - ShoppingCartItem cartItem = (ShoppingCartItem) siit.next(); + ShoppingCartItem cartItem = siit.next(); BigDecimal itemQuantity = cartItem.getQuantity(); BigDecimal dropShipQuantity = BigDecimal.ZERO; @@ -4185,7 +4185,7 @@ public class ShoppingCart implements Ite try { // Get ATP for the product - Map getProductInventoryAvailableResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", productId, "facilityId", facilityId)); + Map getProductInventoryAvailableResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", productId, "facilityId", facilityId)); BigDecimal availableToPromise = (BigDecimal) getProductInventoryAvailableResult.get("availableToPromiseTotal"); if (itemQuantity.compareTo(availableToPromise) <= 0) { @@ -4208,8 +4208,8 @@ public class ShoppingCart implements Ite // Find a supplier for the product String supplierPartyId = null; try { - Map getSuppliersForProductResult = dispatcher.runSync("getSuppliersForProduct", UtilMisc.toMap("productId", productId, "quantity", dropShipQuantity, "canDropShip", "Y", "currencyUomId", getCurrency())); - List supplierProducts = (List) getSuppliersForProductResult.get("supplierProducts"); + Map getSuppliersForProductResult = dispatcher.runSync("getSuppliersForProduct", UtilMisc.toMap("productId", productId, "quantity", dropShipQuantity, "canDropShip", "Y", "currencyUomId", getCurrency())); + List supplierProducts = UtilGenerics.checkList(getSuppliersForProductResult.get("supplierProducts")); // Order suppliers by supplierPrefOrderId so that preferred suppliers are used first supplierProducts = EntityUtil.orderBy(supplierProducts, UtilMisc.toList("supplierPrefOrderId")); @@ -4224,26 +4224,26 @@ public class ShoppingCart implements Ite // Leave the items untouched if we couldn't find a supplier if (UtilValidate.isEmpty(supplierPartyId)) continue; - if (! dropShipItems.containsKey(supplierPartyId)) dropShipItems.put(supplierPartyId, new HashMap()); - Map supplierCartItems = (Map) dropShipItems.get(supplierPartyId); + if (! dropShipItems.containsKey(supplierPartyId)) dropShipItems.put(supplierPartyId, new HashMap>()); + Map> supplierCartItems = UtilGenerics.checkMap(dropShipItems.get(supplierPartyId)); - if (! supplierCartItems.containsKey(cartItem)) supplierCartItems.put(cartItem, new HashMap()); - Map cartItemGroupQuantities = (Map) supplierCartItems.get(cartItem); + if (! supplierCartItems.containsKey(cartItem)) supplierCartItems.put(cartItem, new HashMap()); + Map cartItemGroupQuantities = UtilGenerics.checkMap(supplierCartItems.get(cartItem)); cartItemGroupQuantities.put(Integer.valueOf(shipGroupIndex), dropShipQuantity); } } // Reassign the drop-shippable item quantities to new or existing drop-ship groups - Iterator dsit = dropShipItems.keySet().iterator(); + Iterator dsit = dropShipItems.keySet().iterator(); while (dsit.hasNext()) { - String supplierPartyId = (String) dsit.next(); + String supplierPartyId = dsit.next(); CartShipInfo shipInfo = null; int newShipGroupIndex = -1 ; // Attempt to get the first ship group for the supplierPartyId - TreeMap supplierShipGroups = (TreeMap) this.getShipGroupsBySupplier(supplierPartyId); + TreeMap supplierShipGroups = this.getShipGroupsBySupplier(supplierPartyId); if (! UtilValidate.isEmpty(supplierShipGroups)) { newShipGroupIndex = ((Integer) supplierShipGroups.firstKey()).intValue(); shipInfo = (CartShipInfo) supplierShipGroups.get(supplierShipGroups.firstKey()); @@ -4253,25 +4253,25 @@ public class ShoppingCart implements Ite shipInfo = (CartShipInfo) this.shipInfo.get(newShipGroupIndex); } shipInfo.supplierPartyId = supplierPartyId; - - Map supplierCartItems = (Map) dropShipItems.get(supplierPartyId); - Iterator itit = supplierCartItems.keySet().iterator(); + + Map> supplierCartItems = UtilGenerics.checkMap(dropShipItems.get(supplierPartyId)); + Iterator itit = supplierCartItems.keySet().iterator(); while (itit.hasNext()) { - ShoppingCartItem cartItem = (ShoppingCartItem) itit.next(); - Map cartItemGroupQuantities = (Map) supplierCartItems.get(cartItem); - Iterator cigit = cartItemGroupQuantities.keySet().iterator(); + ShoppingCartItem cartItem = itit.next(); + Map cartItemGroupQuantities = UtilGenerics.checkMap(supplierCartItems.get(cartItem)); + Iterator cigit = cartItemGroupQuantities.keySet().iterator(); while (cigit.hasNext()) { - Integer previousShipGroupIndex = (Integer) cigit.next(); - BigDecimal dropShipQuantity = (BigDecimal) cartItemGroupQuantities.get(previousShipGroupIndex); + Integer previousShipGroupIndex = cigit.next(); + BigDecimal dropShipQuantity = cartItemGroupQuantities.get(previousShipGroupIndex); positionItemToGroup(cartItem, dropShipQuantity, previousShipGroupIndex.intValue(), newShipGroupIndex, true); } } } } - static class BasePriceOrderComparator implements Comparator, Serializable { + static class BasePriceOrderComparator implements Comparator, Serializable { private boolean ascending = false; BasePriceOrderComparator(boolean ascending) { @@ -4305,6 +4305,7 @@ public class ShoppingCart implements Ite private ShoppingCartItemGroup parentGroup; // don't allow empty constructor + @SuppressWarnings("unused") private ShoppingCartItemGroup() {} protected ShoppingCartItemGroup(long groupNumber, String groupName) { @@ -4460,9 +4461,9 @@ public class ShoppingCart implements Ite public void clearAllTaxInfo() { this.shipTaxAdj.clear(); - Iterator i = shipItemInfo.values().iterator(); + Iterator i = shipItemInfo.values().iterator(); while (i.hasNext()) { - CartShipItemInfo itemInfo = (CartShipItemInfo) i.next(); + CartShipItemInfo itemInfo = i.next(); itemInfo.itemTaxAdj.clear(); } } @@ -4579,7 +4580,7 @@ public class ShoppingCart implements Ite return values; } - public CartShipItemInfo setItemInfo(ShoppingCartItem item, BigDecimal quantity, List taxAdj) { + public CartShipItemInfo setItemInfo(ShoppingCartItem item, BigDecimal quantity, List taxAdj) { CartShipItemInfo itemInfo = shipItemInfo.get(item); if (itemInfo == null) { if (!isShippableToAddress(item)) { @@ -4599,7 +4600,7 @@ public class ShoppingCart implements Ite return itemInfo; } - public CartShipItemInfo setItemInfo(ShoppingCartItem item, List taxAdj) { + public CartShipItemInfo setItemInfo(ShoppingCartItem item, List taxAdj) { return setItemInfo(item, BigDecimal.ONE.negate(), taxAdj); } @@ -4662,7 +4663,6 @@ public class ShoppingCart implements Ite public BigDecimal getTotalTax(ShoppingCart cart) { List taxAdjustments = FastList.newInstance(); taxAdjustments.addAll(shipTaxAdj); - Iterator iter = shipItemInfo.values().iterator(); for (CartShipItemInfo info : shipItemInfo.values()) { taxAdjustments.addAll(info.itemTaxAdj); } @@ -4710,7 +4710,7 @@ public class ShoppingCart implements Ite } } - public static class CartPaymentInfo implements Serializable, Comparable { + public static class CartPaymentInfo implements Serializable, Comparable { public String paymentMethodTypeId = null; public String paymentMethodId = null; public String finAccountId = null; @@ -4726,12 +4726,12 @@ public class ShoppingCart implements Ite public GenericValue getValueObject(Delegator delegator) { String entityName = null; - Map lookupFields = null; + Map lookupFields = null; if (paymentMethodId != null) { - lookupFields = UtilMisc.toMap("paymentMethodId", paymentMethodId); + lookupFields = UtilMisc.toMap("paymentMethodId", paymentMethodId); entityName = "PaymentMethod"; } else if (paymentMethodTypeId != null) { - lookupFields = UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId); + lookupFields = UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId); entityName = "PaymentMethodType"; } else { throw new IllegalArgumentException("Could not create value object because paymentMethodId and paymentMethodTypeId are null"); @@ -4753,7 +4753,7 @@ public class ShoppingCart implements Ite if ("PaymentMethod".equals(valueObj.getEntityName())) { String paymentMethodTypeId = valueObj.getString("paymentMethodTypeId"); String paymentMethodId = valueObj.getString("paymentMethodId"); - Map lookupFields = UtilMisc.toMap("paymentMethodId", paymentMethodId); + Map lookupFields = UtilMisc.toMap("paymentMethodId", paymentMethodId); // billing account, credit card, gift card, eft account all have postal address try { @@ -4782,10 +4782,10 @@ public class ShoppingCart implements Ite return postalAddress; } - public List makeOrderPaymentInfos(Delegator delegator, ShoppingCart cart) { + public List makeOrderPaymentInfos(Delegator delegator, ShoppingCart cart) { BigDecimal maxAmount = ZERO; GenericValue valueObj = this.getValueObject(delegator); - List values = new LinkedList(); + List values = new LinkedList(); if (valueObj != null) { // first create a BILLING_LOCATION for the payment method address if there is one if ("PaymentMethod".equals(valueObj.getEntityName())) { @@ -4824,9 +4824,9 @@ public class ShoppingCart implements Ite throw new GeneralRuntimeException("Split Payment Preference per Ship Group does not yet support multiple Payment Methods"); } if ("Y".equals(splitPayPrefPerShpGrp) && cart.paymentInfo.size() == 1) { - Iterator shipIter = cart.getShipGroups().iterator(); + Iterator shipIter = cart.getShipGroups().iterator(); while (shipIter.hasNext()) { - CartShipInfo csi = (CartShipInfo) shipIter.next(); + CartShipInfo csi = shipIter.next(); maxAmount = csi.getTotal().add(cart.getOrderOtherAdjustmentTotal().divide(new BigDecimal(cart.getShipGroupSize()), generalRounding)).add(csi.getShipEstimate().add(csi.getTotalTax(cart))); maxAmount = maxAmount.setScale(scale, rounding);