svn commit: r1081071 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: shoppingcart/product/ task/ test/ thirdparty/zipsales/

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

svn commit: r1081071 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: shoppingcart/product/ task/ test/ thirdparty/zipsales/

mrisaliti
Author: mrisaliti
Date: Sun Mar 13 10:35:11 2011
New Revision: 1081071

URL: http://svn.apache.org/viewvc?rev=1081071&view=rev
Log:
Remove some reduntant cast warning in product component part 2 (OFBIZ-4102)

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java?rev=1081071&r1=1081070&r2=1081071&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java Sun Mar 13 10:35:11 2011
@@ -195,7 +195,7 @@ public class ProductDisplayWorker {
 
                                 products.put(product.getString("productId"), product);
 
-                                BigDecimal curQuant = (BigDecimal) productQuantities.get(product.get("productId"));
+                                BigDecimal curQuant = productQuantities.get(product.get("productId"));
 
                                 if (curQuant == null) curQuant = BigDecimal.ZERO;
                                 BigDecimal orderQuant = orderItem.getBigDecimal("quantity");
@@ -203,7 +203,7 @@ public class ProductDisplayWorker {
                                 if (orderQuant == null) orderQuant = BigDecimal.ZERO;
                                 productQuantities.put(product.getString("productId"), curQuant.add(orderQuant));
 
-                                Integer curOcc = (Integer) productOccurances.get(product.get("productId"));
+                                Integer curOcc = productOccurances.get(product.get("productId"));
 
                                 if (curOcc == null) curOcc = Integer.valueOf(0);
                                 productOccurances.put(product.getString("productId"), Integer.valueOf(curOcc.intValue() + 1));
@@ -215,8 +215,8 @@ public class ProductDisplayWorker {
                 // go through each product quantity and divide it by the occurances to get the average
                 for (Map.Entry<String, BigDecimal> entry : productQuantities.entrySet()) {
                     String prodId = entry.getKey();
-                    BigDecimal quantity = (BigDecimal) entry.getValue();
-                    Integer occs = (Integer) productOccurances.get(prodId);
+                    BigDecimal quantity = entry.getValue();
+                    Integer occs = productOccurances.get(prodId);
                     BigDecimal nqint = quantity.divide(new BigDecimal(occs), new MathContext(10));
 
                     if (nqint.compareTo(BigDecimal.ONE) < 0) nqint = BigDecimal.ONE;
@@ -280,8 +280,8 @@ public class ProductDisplayWorker {
             Map<String, Object> newMetric = FastMap.newInstance();
             for (Map.Entry<String, Integer> entry : productOccurances.entrySet()) {
                 String prodId = entry.getKey();
-                Integer quantity = (Integer) entry.getValue();
-                BigDecimal occs = (BigDecimal) productQuantities.get(prodId);
+                Integer quantity = entry.getValue();
+                BigDecimal occs = productQuantities.get(prodId);
                 BigDecimal nqdbl = quantityModifier.multiply(new BigDecimal(quantity)).add(occs.multiply(occurancesModifier));
 
                 newMetric.put(prodId, nqdbl);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1081071&r1=1081070&r2=1081071&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Sun Mar 13 10:35:11 2011
@@ -175,7 +175,7 @@ public class ProductPromoWorker {
         try {
             Iterator<GenericValue> productStorePromoAppls = UtilMisc.toIterator(EntityUtil.filterByDate(productStore.getRelatedCache("ProductStorePromoAppl", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNum")), true));
             while (productStorePromoAppls != null && productStorePromoAppls.hasNext()) {
-                GenericValue productStorePromoAppl = (GenericValue) productStorePromoAppls.next();
+                GenericValue productStorePromoAppl = productStorePromoAppls.next();
                 if (UtilValidate.isNotEmpty(productStorePromoAppl.getString("manualOnly")) && "Y".equals(productStorePromoAppl.getString("manualOnly"))) {
                     // manual only promotions are not automatically evaluated (they must be explicitly selected by the user)
                     if (Debug.verboseOn()) Debug.logVerbose("Skipping promotion with id [" + productStorePromoAppl.getString("productPromoId") + "] because it is applied to the store with ID " + productStoreId + " as a manual only promotion.", module);
@@ -184,7 +184,7 @@ public class ProductPromoWorker {
                 GenericValue productPromo = productStorePromoAppl.getRelatedOneCache("ProductPromo");
                 Iterator<GenericValue> productPromoCodesIter = UtilMisc.toIterator(productPromo.getRelatedCache("ProductPromoCode", null, null));
                 while (productPromoCodesIter != null && productPromoCodesIter.hasNext()) {
-                    GenericValue productPromoCode = (GenericValue) productPromoCodesIter.next();
+                    GenericValue productPromoCode = productPromoCodesIter.next();
                     promoCodes.add(productPromoCode.getString("productPromoCodeId"));
                 }
             }
@@ -330,7 +330,7 @@ public class ProductPromoWorker {
             List<Map<Object, Object>> productPromoDiscountMapListOrderTotal = FastList.newInstance();
             Iterator<GenericValue> productPromoIter = productPromoList.iterator();
             while (productPromoIter.hasNext()) {
-                GenericValue productPromo = (GenericValue) productPromoIter.next();
+                GenericValue productPromo = productPromoIter.next();
                 Map<Object, Object> productPromoDiscountMap = UtilGenerics.checkMap(UtilMisc.toMap("productPromo", productPromo, "totalDiscountAmount", cart.getProductPromoUseTotalDiscount(productPromo.getString("productPromoId"))));
                 if (hasOrderTotalCondition(productPromo, delegator)) {
                     productPromoDiscountMapListOrderTotal.add(productPromoDiscountMap);
@@ -426,7 +426,7 @@ public class ProductPromoWorker {
                                 List<GenericValue> orderproductPromoCodes =  delegator.findList("OrderProductPromoCode", EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, cart.getOrderId()), null, null, null, false);
                                 Iterator<GenericValue> orderproductPromoCodesItr = UtilMisc.toIterator(orderproductPromoCodes);
                                 while (orderproductPromoCodesItr != null && orderproductPromoCodesItr.hasNext()) {
-                                    GenericValue orderproductPromoCode = (GenericValue) orderproductPromoCodesItr.next();
+                                    GenericValue orderproductPromoCode = orderproductPromoCodesItr.next();
                                     enteredCodes.add(orderproductPromoCode.getString("productPromoCodeId"));
                                 }
                             }
@@ -753,7 +753,7 @@ public class ProductPromoWorker {
 
             Iterator<GenericValue> promoRulesIter = productPromoRules.iterator();
             while (promoRulesIter != null && promoRulesIter.hasNext()) {
-                GenericValue productPromoRule = (GenericValue) promoRulesIter.next();
+                GenericValue productPromoRule = promoRulesIter.next();
 
                 // if apply then performActions when no conditions are false, so default to true
                 boolean performActions = true;
@@ -766,7 +766,7 @@ public class ProductPromoWorker {
 
                 Iterator<GenericValue> productPromoCondIter = UtilMisc.toIterator(productPromoConds);
                 while (productPromoCondIter != null && productPromoCondIter.hasNext()) {
-                    GenericValue productPromoCond = (GenericValue) productPromoCondIter.next();
+                    GenericValue productPromoCond = productPromoCondIter.next();
 
                     boolean condResult = checkCondition(productPromoCond, cart, delegator, dispatcher, nowTimestamp);
 
@@ -783,7 +783,7 @@ public class ProductPromoWorker {
                     List<GenericValue> productPromoActions = productPromoRule.getRelatedCache("ProductPromoAction", null, UtilMisc.toList("productPromoActionSeqId"));
                     Iterator<GenericValue> productPromoActionIter = UtilMisc.toIterator(productPromoActions);
                     while (productPromoActionIter != null && productPromoActionIter.hasNext()) {
-                        GenericValue productPromoAction = (GenericValue) productPromoActionIter.next();
+                        GenericValue productPromoAction = productPromoActionIter.next();
                         try {
                             ActionResultInfo actionResultInfo = performAction(productPromoAction, cart, delegator, dispatcher, nowTimestamp);
                             totalDiscountAmount = totalDiscountAmount.add(actionResultInfo.totalDiscountAmount);
@@ -1672,7 +1672,7 @@ public class ProductPromoWorker {
             List<ShoppingCartItem> lineOrderedByBasePriceList = cart.getLineListOrderedByBasePrice(false);
             Iterator<ShoppingCartItem> lineOrderedByBasePriceIter = lineOrderedByBasePriceList.iterator();
             while (quantityDesired.compareTo(BigDecimal.ZERO) > 0 && lineOrderedByBasePriceIter.hasNext()) {
-                ShoppingCartItem cartItem = (ShoppingCartItem) lineOrderedByBasePriceIter.next();
+                ShoppingCartItem cartItem = lineOrderedByBasePriceIter.next();
                 // only include if it is in the productId Set for this check and if it is not a Promo (GWP) item
                 String parentProductId = cartItem.getParentProductId();
                 GenericValue product = cartItem.getProduct();

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java?rev=1081071&r1=1081070&r2=1081071&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java Sun Mar 13 10:35:11 2011
@@ -53,7 +53,7 @@ public class TaskWorker {
 
     public static String getPrettyStatus(GenericValue orderTaskList) {
         String statusId = orderTaskList.getString("currentStatusId");
-        String prettyStatus = (String) statusMapping.get(statusId);
+        String prettyStatus = statusMapping.get(statusId);
         if (prettyStatus == null)
             prettyStatus = "?";
         return prettyStatus;

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java?rev=1081071&r1=1081070&r2=1081071&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java Sun Mar 13 10:35:11 2011
@@ -98,7 +98,7 @@ public class OrderTestServices {
                     if (productCategoryMembers != null) {
                         Iterator<GenericValue> i = productCategoryMembers.iterator();
                         while (i.hasNext()) {
-                            GenericValue prodCatMemb = (GenericValue) i.next();
+                            GenericValue prodCatMemb = i.next();
                             if (prodCatMemb != null) {
                                 productsList.add(prodCatMemb.getString("productId"));
                             }
@@ -136,11 +136,11 @@ public class OrderTestServices {
             // get a product
             int k = r.nextInt(productsList.size());
             try {
-                cart.addOrIncreaseItem((String) productsList.get(k), null, BigDecimal.ONE, null, null, null,
+                cart.addOrIncreaseItem(productsList.get(k), null, BigDecimal.ONE, null, null, null,
                                        null, null, null, null,
                                        null /*catalogId*/, null, null/*itemType*/, null/*itemGroupNumber*/, null, dispatcher);
             } catch (Exception exc) {
-                Debug.logWarning("Error adding product with id " + (String) productsList.get(k) + " to the cart: " + exc.getMessage(), module);
+                Debug.logWarning("Error adding product with id " + productsList.get(k) + " to the cart: " + exc.getMessage(), module);
             }
         }
         cart.setDefaultCheckoutOptions(dispatcher);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java?rev=1081071&r1=1081070&r2=1081071&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java Sun Mar 13 10:35:11 2011
@@ -243,9 +243,9 @@ public class ZipSalesServices {
         try {
             // loop through and get per item tax rates
             for (int i = 0; i < itemProductList.size(); i++) {
-                GenericValue product = (GenericValue) itemProductList.get(i);
-                BigDecimal itemAmount = (BigDecimal) itemAmountList.get(i);
-                BigDecimal shippingAmount = (BigDecimal) itemShippingList.get(i);
+                GenericValue product = itemProductList.get(i);
+                BigDecimal itemAmount = itemAmountList.get(i);
+                BigDecimal shippingAmount = itemShippingList.get(i);
                 itemAdjustments.add(getItemTaxList(delegator, product, postalCode, city, itemAmount, shippingAmount, false));
             }
             if (orderShippingAmount.compareTo(BigDecimal.ZERO) > 0) {
@@ -318,7 +318,7 @@ public class ZipSalesServices {
         // get the first one
         GenericValue taxEntry = null;
         if (UtilValidate.isNotEmpty(taxLookup)) {
-            taxEntry = (GenericValue) taxLookup.iterator().next();
+            taxEntry = taxLookup.iterator().next();
         }
 
         if (taxEntry == null) {
@@ -368,7 +368,7 @@ public class ZipSalesServices {
                     // if we found an rule which passes no need to contine (all rules are ||)
                     break;
                 }
-                GenericValue rule = (GenericValue) ruleIterator.next();
+                GenericValue rule = ruleIterator.next();
                 String idCode = rule.getString("idCode");
                 String taxable = rule.getString("taxable");
                 String condition = rule.getString("shipCond");