svn commit: r757089 [5/6] - in /ofbiz/trunk/applications/product/src: ./ org/ofbiz/product/catalog/ org/ofbiz/product/category/ org/ofbiz/product/config/ org/ofbiz/product/feature/ org/ofbiz/product/image/ org/ofbiz/product/inventory/ org/ofbiz/product...

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

svn commit: r757089 [5/6] - in /ofbiz/trunk/applications/product/src: ./ org/ofbiz/product/catalog/ org/ofbiz/product/category/ org/ofbiz/product/config/ org/ofbiz/product/feature/ org/ofbiz/product/image/ org/ofbiz/product/inventory/ org/ofbiz/product...

doogie-3
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -161,7 +161,7 @@
                 } else if (!update) {
                     resQty = resQty.subtract(resPackedQty);
                 }
-                
+
                 BigDecimal thisQty = resQty.compareTo(qtyRemain) > 0 ? qtyRemain : resQty;
 
                 int thisCheck = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, thisQty, packageSeqId, update);
@@ -210,7 +210,7 @@
                     orderItemSeqId.equals(line.getOrderItemSeqId()) &&
                     shipGroupSeqId.equals(line.getShipGroupSeqId()) &&
                     productId.equals(line.getProductId()) &&
-                    inventoryItemId.equals(line.getInventoryItemId()) &&
+                    inventoryItemId.equals(line.getInventoryItemId()) &&
                     packageSeq == line.getPackageSeq()) {
                 return line;
             }
@@ -236,7 +236,7 @@
 
         // Add the line weight to the package weight
         if (weight.compareTo(BigDecimal.ZERO) > 0) this.addToPackageWeight(packageSeqId, weight);
-        
+
         // update the package sequence
         if (packageSeqId > packageSeq) {
             this.packageSeq = packageSeqId;
@@ -566,7 +566,7 @@
             this.clear();
             return packageSeq;
         }
-        
+
         List<PackingSessionLine> currentLines = UtilMisc.makeListWritable(this.packLines);
         for (PackingSessionLine line: currentLines) {
             if (line.getPackageSeq() == packageSeq) {
@@ -647,7 +647,7 @@
     }
 
     protected void checkReservations(boolean ignore) throws GeneralException {
-        List<String> errors = FastList.newInstance();        
+        List<String> errors = FastList.newInstance();
         for (PackingSessionLine line: this.getLines()) {
             BigDecimal reservedQty =  this.getCurrentReservedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId());
             BigDecimal packedQty = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId());
@@ -751,7 +751,7 @@
 
         return true;
     }
-    
+
     protected void createPackages() throws GeneralException {
         for (int i = 0; i < packageSeq; i++) {
             String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5);
@@ -831,7 +831,7 @@
     public void setAdditionalShippingCharge(BigDecimal additionalShippingCharge) {
         this.additionalShippingCharge = additionalShippingCharge;
     }
-    
+
     public BigDecimal getTotalWeight() {
         BigDecimal total = BigDecimal.ZERO;
         for (int i = 0; i < packageSeq; i++) {
@@ -845,16 +845,16 @@
 
     public BigDecimal getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId, List<GenericValue> shippableItemInfo, BigDecimal shippableTotal, BigDecimal shippableWeight, BigDecimal shippableQuantity) {
         return getShipmentCostEstimate(orderItemShipGroup.getString("contactMechId"), orderItemShipGroup.getString("shipmentMethodTypeId"),
-                                       orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"),
+                                       orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"),
                                        productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
     }
-    
+
     public BigDecimal getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId) {
         return getShipmentCostEstimate(orderItemShipGroup.getString("contactMechId"), orderItemShipGroup.getString("shipmentMethodTypeId"),
-                                       orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"),
+                                       orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"),
                                        productStoreId, null, null, null, null);
     }
-    
+
     public BigDecimal getShipmentCostEstimate(String shippingContactMechId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String productStoreId, List<GenericValue> shippableItemInfo, BigDecimal shippableTotal, BigDecimal shippableWeight, BigDecimal shippableQuantity) {
 
         BigDecimal shipmentCostEstimate = null;
@@ -866,7 +866,7 @@
             serviceContext.put("carrierPartyId", carrierPartyId);
             serviceContext.put("carrierRoleTypeId", carrierRoleTypeId);
             serviceContext.put("productStoreId", productStoreId);
-    
+
             if (UtilValidate.isEmpty(shippableItemInfo)) {
                 shippableItemInfo = FastList.newInstance();
                 for (PackingSessionLine line: getLines()) {
@@ -890,22 +890,22 @@
                 shippableTotal = BigDecimal.ZERO;
             }
             serviceContext.put("shippableTotal", shippableTotal);
-    
+
             serviceResult = getDispatcher().runSync("calcShipmentCostEstimate", serviceContext);
         } catch ( GenericEntityException e ) {
             Debug.logError(e, module);
         } catch ( GenericServiceException e ) {
             Debug.logError(e, module);
         }
-        
+
         if (! UtilValidate.isEmpty(serviceResult.get("shippingEstimateAmount"))) {
             shipmentCostEstimate = (BigDecimal) serviceResult.get("shippingEstimateAmount");
         }
-        
+
         return shipmentCostEstimate;
-        
+
     }
-  
+
     public String getWeightUomId() {
         return weightUomId;
     }
@@ -913,7 +913,7 @@
     public void setWeightUomId(String weightUomId) {
         this.weightUomId = weightUomId;
     }
-    
+
     public List<Integer> getPackageSeqIds() {
         Set<Integer> packageSeqIds = new TreeSet<Integer>();
         if (! UtilValidate.isEmpty(this.getLines())) {
@@ -923,7 +923,7 @@
         }
         return UtilMisc.makeListWritable(packageSeqIds);
     }
-    
+
     public void setPackageWeight(int packageSeqId, BigDecimal packageWeight) {
         if (UtilValidate.isEmpty(packageWeight)) {
             packageWeights.remove(Integer.valueOf(packageSeqId));
@@ -931,7 +931,7 @@
             packageWeights.put(Integer.valueOf(packageSeqId), packageWeight);
         }
     }
-    
+
     public BigDecimal getPackageWeight(int packageSeqId) {
         if (this.packageWeights == null) return null;
         BigDecimal packageWeight = null;
@@ -941,7 +941,7 @@
         }
         return packageWeight;
     }
-    
+
     public void addToPackageWeight(int packageSeqId, BigDecimal weight) {
         if (UtilValidate.isEmpty(weight)) return;
         BigDecimal packageWeight = getPackageWeight(packageSeqId);
@@ -1006,11 +1006,11 @@
                     sameOrderItemProduct = false;
                 }
                 return (d.productId.equals(productId) &&
-                        d.getOrderItem().getString("orderItemSeqId").equals(orderItem.getString("orderItemSeqId")) &&
+                        d.getOrderItem().getString("orderItemSeqId").equals(orderItem.getString("orderItemSeqId")) &&
                         sameOrderItemProduct);
             } else {
                 return false;
-            }            
+            }
         }
     }
 }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -38,17 +38,17 @@
  * ShippingEvents - Events used for processing shipping fees
  */
 public class ShipmentEvents {
-    
+
     public static final String module = ShipmentEvents.class.getName();
 
     public static String viewShipmentPackageRouteSegLabelImage(HttpServletRequest request, HttpServletResponse response) {
-        
+
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-        
+
         String shipmentId = request.getParameter("shipmentId");
         String shipmentRouteSegmentId = request.getParameter("shipmentRouteSegmentId");
         String shipmentPackageSeqId = request.getParameter("shipmentPackageSeqId");
-        
+
         GenericValue shipmentPackageRouteSeg = null;
         try {
             shipmentPackageRouteSeg = delegator.findByPrimaryKey("ShipmentPackageRouteSeg", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentPackageSeqId", shipmentPackageSeqId));
@@ -58,18 +58,18 @@
             request.setAttribute("_ERROR_MESSAGE_", errorMsg);
             return "error";
         }
-        
+
         if (shipmentPackageRouteSeg == null) {
             request.setAttribute("_ERROR_MESSAGE_", "Could not find ShipmentPackageRouteSeg where shipmentId=[" + shipmentId + "], shipmentRouteSegmentId=[" + shipmentRouteSegmentId + "], shipmentPackageSeqId=[" + shipmentPackageSeqId + "]");
             return "error";
         }
-        
+
         byte[] bytes = shipmentPackageRouteSeg.getBytes("labelImage");
         if (bytes == null || bytes.length == 0) {
             request.setAttribute("_ERROR_MESSAGE_", "The ShipmentPackageRouteSeg was found where shipmentId=[" + shipmentId + "], shipmentRouteSegmentId=[" + shipmentRouteSegmentId + "], shipmentPackageSeqId=[" + shipmentPackageSeqId + "], but there was no labelImage on the value.");
             return "error";
         }
-        
+
         // TODO: record the image format somehow to make this block nicer.  Right now we're just trying GIF first as a default, then if it doesn't work, trying PNG.
         // It would be nice to store the actual type of the image alongside the image data.
         try {
@@ -84,8 +84,8 @@
                 return "error";
             }
         }
-        
-        return "success";                                                
+
+        return "success";
     }
 
     public static String checkForceShipmentReceived(HttpServletRequest request, HttpServletResponse response) {

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -52,7 +52,7 @@
     public static final String resource_error = "OrderErrorUiLabels";
     public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
     public static final int rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding");
-    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);    
+    public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding);
 
     public static Map<String, Object> createShipmentEstimate(DispatchContext dctx, Map<String, ? extends Object> context) {
         Map<String, Object> result = FastMap.newInstance();
@@ -243,14 +243,14 @@
         // get the ShipmentCostEstimate(s)
         Map<String, String> estFields = UtilMisc.toMap("productStoreId", productStoreId, "shipmentMethodTypeId", shipmentMethodTypeId,
                 "carrierPartyId", carrierPartyId, "carrierRoleTypeId", carrierRoleTypeId);
-        EntityCondition estFieldsCond = EntityCondition.makeCondition(estFields, EntityOperator.AND);
-        
+        EntityCondition estFieldsCond = EntityCondition.makeCondition(estFields, EntityOperator.AND);
+
         if (UtilValidate.isNotEmpty(productStoreShipMethId)) {
             // if the productStoreShipMethId field is passed, then also get estimates that have the field set
             List<EntityCondition> condList = UtilMisc.toList(EntityCondition.makeCondition("productStoreShipMethId", EntityOperator.EQUALS, productStoreShipMethId), estFieldsCond);
             estFieldsCond = EntityCondition.makeCondition(condList, EntityOperator.OR);
-        }
-        
+        }
+
         Collection<GenericValue> estimates = null;
         try {
             estimates = delegator.findList("ShipmentCostEstimate", estFieldsCond, null, null, null, true);
@@ -350,7 +350,7 @@
                         }
                         if (shippableWeight.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableWeight.compareTo(max) <= 0)) {
                             weightValid = true;
-                        }    
+                        }
                     }
                     if (qv != null) {
                         useQty = true;
@@ -364,7 +364,7 @@
                         }
                         if (shippableQuantity.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableQuantity.compareTo(max) <= 0)) {
                             qtyValid = true;
-                        }    
+                        }
                     }
                     if (pv != null) {
                         usePrice = true;
@@ -378,12 +378,12 @@
                         }
                         if (shippableTotal.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableTotal.compareTo(max) <= 0)) {
                             priceValid = true;
-                        }    
+                        }
                     }
                     // Now check the tests.
                     if ((useWeight && weightValid) || (useQty && qtyValid) || (usePrice && priceValid)) {
                         estimateList.add(thisEstimate);
-                    }    
+                    }
                 }
             }
 
@@ -439,22 +439,22 @@
                 int prioritySum = 0;
                 if (UtilValidate.isNotEmpty(currentEstimate.getString("partyId"))) {
                     prioritySum += PRIORITY_PARTY;
-                }    
+                }
                 if (UtilValidate.isNotEmpty(currentEstimate.getString("roleTypeId"))) {
                     prioritySum += PRIORITY_ROLE;
-                }    
+                }
                 if (UtilValidate.isNotEmpty(currentEstimate.getString("geoIdTo"))) {
                     prioritySum += PRIORITY_GEO;
-                }    
+                }
                 if (UtilValidate.isNotEmpty(currentEstimate.getString("weightBreakId"))) {
                     prioritySum += PRIORITY_WEIGHT;
-                }    
+                }
                 if (UtilValidate.isNotEmpty(currentEstimate.getString("quantityBreakId"))) {
                     prioritySum += PRIORITY_QTY;
-                }    
+                }
                 if (UtilValidate.isNotEmpty(currentEstimate.getString("priceBreakId"))) {
                     prioritySum += PRIORITY_PRICE;
-                }    
+                }
 
                 // there will be only one of each priority; latest will replace
                 estimatePriority.put(Integer.valueOf(prioritySum), currentEstimate);
@@ -474,39 +474,39 @@
         BigDecimal orderFlat = BigDecimal.ZERO;
         if (estimate.getBigDecimal("orderFlatPrice") != null) {
             orderFlat = estimate.getBigDecimal("orderFlatPrice");
-        }    
+        }
 
         BigDecimal orderItemFlat = BigDecimal.ZERO;
         if (estimate.getBigDecimal("orderItemFlatPrice") != null) {
             orderItemFlat = estimate.getBigDecimal("orderItemFlatPrice");
-        }    
+        }
 
         BigDecimal orderPercent = BigDecimal.ZERO;
         if (estimate.getBigDecimal("orderPricePercent") != null) {
             orderPercent = estimate.getBigDecimal("orderPricePercent");
-        }    
+        }
 
         BigDecimal itemFlatAmount = shippableQuantity.multiply(orderItemFlat);
         BigDecimal orderPercentage = shippableTotal.multiply(orderPercent.movePointLeft(2));
 
         // flat total
-        BigDecimal flatTotal = orderFlat.add(itemFlatAmount).add(orderPercentage);        
+        BigDecimal flatTotal = orderFlat.add(itemFlatAmount).add(orderPercentage);
 
         // spans
         BigDecimal weightUnit = BigDecimal.ZERO;
         if (estimate.getBigDecimal("weightUnitPrice") != null) {
             weightUnit = estimate.getBigDecimal("weightUnitPrice");
-        }    
+        }
 
         BigDecimal qtyUnit = BigDecimal.ZERO;
         if (estimate.getBigDecimal("quantityUnitPrice") != null) {
             qtyUnit = estimate.getBigDecimal("quantityUnitPrice");
-        }    
+        }
 
         BigDecimal priceUnit = BigDecimal.ZERO;
         if (estimate.getBigDecimal("priceUnitPrice") != null) {
             priceUnit = estimate.getBigDecimal("priceUnitPrice");
-        }    
+        }
 
         BigDecimal weightAmount = shippableWeight.multiply(weightUnit);
         BigDecimal quantityAmount = shippableQuantity.multiply(qtyUnit);
@@ -571,7 +571,7 @@
         BigDecimal shippingPricePercent = BigDecimal.ZERO;
         if (estimate.getBigDecimal("shippingPricePercent") != null) {
             shippingPricePercent = estimate.getBigDecimal("shippingPricePercent");
-        }    
+        }
 
         // shipping total
         BigDecimal shippingTotal = subTotal.add((subTotal.add(initialEstimateAmt)).multiply(shippingPricePercent.movePointLeft(2)));
@@ -662,7 +662,7 @@
 
 
             for (GenericValue shipmentPkg: packages) {
-                GenericValue stagePkg = delegator.makeValue("OdbcPackageOut");              
+                GenericValue stagePkg = delegator.makeValue("OdbcPackageOut");
                 stagePkg.set("shipmentId", shipmentPkg.get("shipmentId"));
                 stagePkg.set("shipmentPackageSeqId", shipmentPkg.get("shipmentPackageSeqId"));
                 stagePkg.set("orderId", shipment.get("primaryOrderId"));
@@ -864,8 +864,8 @@
     /**
      * Whenever a ShipmentReceipt is generated, check the Shipment associated
      * with it to see if all items were received. If so, change its status to
-     * PURCH_SHIP_RECEIVED. The check is accomplished by counting the
-     * products shipped (from ShipmentAndItem) and matching them with the
+     * PURCH_SHIP_RECEIVED. The check is accomplished by counting the
+     * products shipped (from ShipmentAndItem) and matching them with the
      * products received (from ShipmentReceipt).
      */
     public static Map<String, Object> updatePurchaseShipmentFromReceipt(DispatchContext dctx, Map<String, ? extends Object> context) {
@@ -886,7 +886,7 @@
                     return updateShipmentMap;
                 }
             }
-            
+
             List<GenericValue> shipmentAndItems = delegator.findByAnd("ShipmentAndItem", UtilMisc.toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED"));
             if (shipmentAndItems.size() == 0) {
                 return ServiceUtil.returnSuccess();
@@ -934,7 +934,7 @@
 
         String shipmentId = (String) context.get("shipmentId");
         String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
-    
+
         Map<String, Object> results = ServiceUtil.returnSuccess();
 
         try {
@@ -965,7 +965,7 @@
         } catch (GenericServiceException ex) {
             return ServiceUtil.returnError(ex.getMessage());
         }
-    }
+    }
     /**
      * Service to call a ShipmentRouteSegment.carrierPartyId's confirm shipment method asynchronously
      */
@@ -980,7 +980,7 @@
 
         // get the carrierPartyId
         try {
-            GenericValue shipmentRouteSegment = delegator.findByPrimaryKeyCache("ShipmentRouteSegment",
+            GenericValue shipmentRouteSegment = delegator.findByPrimaryKeyCache("ShipmentRouteSegment",
                     UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId));
             carrierPartyId = shipmentRouteSegment.getString("carrierPartyId");
         } catch (GenericEntityException e) {
@@ -1009,7 +1009,7 @@
 
     /**
      * Calculates the total value of a shipment package by totalling the results of the getOrderItemInvoicedAmountAndQuantity
-     *  service for the orderItem related to each ShipmentPackageContent, prorated by the quantity of the orderItem issued to the
+     *  service for the orderItem related to each ShipmentPackageContent, prorated by the quantity of the orderItem issued to the
      *  ShipmentPackageContent. Value is converted according to the incoming currencyUomId.
      * @param dctx DispatchContext
      * @param context Map
@@ -1020,7 +1020,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         Locale locale = (Locale) context.get("locale");
-        
+
         String shipmentId = (String) context.get("shipmentId");
         String shipmentPackageSeqId = (String) context.get("shipmentPackageSeqId");
         String currencyUomId = (String) context.get("currencyUomId");
@@ -1037,32 +1037,32 @@
                 Debug.logError(errorMessage, module);
                 return ServiceUtil.returnError(errorMessage);
             }
-            
+
             shipmentPackage = delegator.findByPrimaryKey("ShipmentPackage", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId));
             if (UtilValidate.isEmpty(shipmentPackage)) {
                 String errorMessage = UtilProperties.getMessage(resource, "ProductShipmentPackageNotFound", context, locale);
                 Debug.logError(errorMessage, module);
                 return ServiceUtil.returnError(errorMessage);
             }
-            
+
             List<GenericValue> packageContents = delegator.findByAnd("PackedQtyVsOrderItemQuantity", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId));
             for (GenericValue packageContent: packageContents) {
                 String orderId = packageContent.getString("orderId");
                 String orderItemSeqId = packageContent.getString("orderItemSeqId");
-            
+
                 // Get the value of the orderItem by calling the getOrderItemInvoicedAmountAndQuantity service
                 Map<String, Object> getOrderItemValueResult = dispatcher.runSync("getOrderItemInvoicedAmountAndQuantity", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "userLogin", userLogin, "locale", locale));
                 if (ServiceUtil.isError(getOrderItemValueResult)) return getOrderItemValueResult;
                 BigDecimal invoicedAmount = (BigDecimal) getOrderItemValueResult.get("invoicedAmount");
                 BigDecimal invoicedQuantity = (BigDecimal) getOrderItemValueResult.get("invoicedQuantity");
-            
+
                 // How much of the invoiced quantity does the issued quantity represent?
                 BigDecimal issuedQuantity = packageContent.getBigDecimal("issuedQuantity");
                 BigDecimal proportionOfInvoicedQuantity = invoicedQuantity.signum() == 0 ? ZERO : issuedQuantity.divide(invoicedQuantity, 10, rounding);
-            
+
                 // Prorate the orderItem's invoiced amount by that proportion
                 BigDecimal packageContentValue = proportionOfInvoicedQuantity.multiply(invoicedAmount).setScale(decimals, rounding);
-            
+
                 // Convert the value to the shipment currency, if necessary
                 GenericValue orderHeader = packageContent.getRelatedOne("OrderHeader");
                 Map<String, Object> convertUomResult = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", currencyUomId, "originalValue", packageContentValue));
@@ -1072,7 +1072,7 @@
                 if (convertUomResult.containsKey("convertedValue")) {
                     packageContentValue = ((BigDecimal) convertUomResult.get("convertedValue")).setScale(decimals, rounding);
                 }
-                
+
                 // Add the value of the packed item to the package's total value
                 packageTotalValue = packageTotalValue.add(packageContentValue);
             }
@@ -1088,7 +1088,7 @@
         result.put("packageValue", packageTotalValue);
         return result;
     }
-    
+
     public static Map<String, Object> sendShipmentCompleteNotification(DispatchContext dctx, Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
@@ -1127,7 +1127,7 @@
         } else {
             sendMap.put("bodyScreenUri", screenUri);
         }
-                
+
         String partyId = shipment.getString("partyIdTo");
 
         // get the email address
@@ -1147,11 +1147,11 @@
         ResourceBundleMapWrapper uiLabelMap = (ResourceBundleMapWrapper) UtilProperties.getResourceBundleMap("EcommerceUiLabels", locale);
         uiLabelMap.addBottomResourceBundle("OrderUiLabels");
         uiLabelMap.addBottomResourceBundle("CommonUiLabels");
-                
+
         Map<String, Object> bodyParameters = UtilMisc.<String, Object>toMap("partyId", partyId, "shipmentId", shipmentId, "orderId", shipment.getString("primaryOrderId"), "userLogin", userLogin, "uiLabelMap", uiLabelMap, "locale", locale);
         sendMap.put("bodyParameters", bodyParameters);
         sendMap.put("userLogin",userLogin);
-                
+
         if (productStoreEmail != null) {
             sendMap.put("subject", productStoreEmail.getString("subject"));
             sendMap.put("contentType", productStoreEmail.get("contentType"));
@@ -1181,5 +1181,5 @@
             return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderProblemSendingEmail", locale), null, null, sendResp);
         }
         return sendResp;
-    }    
+    }
 }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -61,7 +61,7 @@
 
 /**
  * DHL ShipmentServices
- *
+ *
  * <p>Implementation of DHL US domestic shipment interface using DHL ShipIT XML APi.</p>
  *
  * Shipment services not supported in DHL ShipIT 1.1
@@ -73,7 +73,7 @@
  * <li>Label size 4"x6"</li>
  * <li>Out of origin shipping</li>
  * </ul>
- *
+ *
  * TODO: International
  */
 public class DhlServices {
@@ -84,7 +84,7 @@
 
     /**
      * Opens a URL to DHL and makes a request.
-     *
+     *
      * @param xmlString
      *            Name of the DHL service to invoke
      * @param xmlString
@@ -165,7 +165,7 @@
         BigDecimal shippableTotal = (BigDecimal) context.get("shippableTotal");
         BigDecimal shippableQuantity = (BigDecimal) context.get("shippableQuantity");
         BigDecimal shippableWeight = (BigDecimal) context.get("shippableWeight");
-        
+
         if (shipmentMethodTypeId.equals("NO_SHIPPING")) {
             Map<String, Object> result = ServiceUtil.returnSuccess();
             result.put("shippingEstimateAmount", null);
@@ -501,13 +501,13 @@
     public static Map<String, Object> dhlShipmentConfirm(DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
-        Locale locale = (Locale) context.get("locale");        
-        
+        Locale locale = (Locale) context.get("locale");
+
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         String shipmentId = (String) context.get("shipmentId");
         String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
         Map<String, Object> result = FastMap.newInstance();
-        String shipmentConfirmResponseString = null;        
+        String shipmentConfirmResponseString = null;
         try {
             GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
             if (shipment == null) {
@@ -517,16 +517,16 @@
             if (shipmentRouteSegment == null) {
                 return ServiceUtil.returnError("ShipmentRouteSegment not found with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
             }
-            
+
             if (!"DHL".equals(shipmentRouteSegment.getString("carrierPartyId"))) {
                 return ServiceUtil.returnError("ERROR: The Carrier for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is not DHL.");
             }
-            
+
             // add ShipmentRouteSegment carrierServiceStatusId, check before all DHL services
             if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("carrierServiceStatusId")) && !"SHRSCS_NOT_STARTED".equals(shipmentRouteSegment.getString("carrierServiceStatusId"))) {
                 return ServiceUtil.returnError("ERROR: The Carrier Service Status for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is [" + shipmentRouteSegment.getString("carrierServiceStatusId") + "], but must be not-set or [SHRSCS_NOT_STARTED] to perform the DHL Shipment Confirm operation.");
             }
-            
+
             // Get Origin Info
             GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress");
             if (originPostalAddress == null) {
@@ -543,7 +543,7 @@
             }
             originPhoneNumber = StringUtil.replaceString(originPhoneNumber, "-", "");
             originPhoneNumber = StringUtil.replaceString(originPhoneNumber, " ", "");
-            
+
             // lookup the two letter country code (in the geoCode field)
             GenericValue originCountryGeo = originPostalAddress.getRelatedOne("CountryGeo");
             if (originCountryGeo == null) {
@@ -574,7 +574,7 @@
             if (results.get("emailAddress") != null) {
                 recipientEmail = (String) results.get("emailAddress");
             }
-            
+
             // lookup the two letter country code (in the geoCode field)
             GenericValue destCountryGeo = destPostalAddress.getRelatedOne("CountryGeo");
             if (destCountryGeo == null) {
@@ -621,9 +621,9 @@
                 List<GenericValue> carrierShipmentBoxTypes = shipmentPackage.getRelated("CarrierShipmentBoxType", UtilMisc.toMap("partyId", "DHL"), null);
                 GenericValue carrierShipmentBoxType = null;
                 if (carrierShipmentBoxTypes.size() > 0) {
-                    carrierShipmentBoxType = carrierShipmentBoxTypes.get(0);
+                    carrierShipmentBoxType = carrierShipmentBoxTypes.get(0);
                 }
-                
+
                 // TODO: determine what default UoM is (assuming inches) - there should be a defaultDimensionUomId in Facility
                 if (shipmentBoxType != null) {
                     GenericValue dimensionUom = shipmentBoxType.getRelatedOne("DimensionUom");
@@ -631,7 +631,7 @@
                     width = shipmentBoxType.get("boxWidth").toString();
                     height = shipmentBoxType.get("boxHeight").toString();
                 }
-                
+
                 // next step is weight determination, so skip if we have a billing weight
                 if (hasBillingWeight) continue;
 
@@ -664,14 +664,14 @@
 
             // pick which weight to use and round it
             BigDecimal weight = null;
-            if (hasBillingWeight) {
+            if (hasBillingWeight) {
                 weight = billingWeight;
             } else {
                 weight = packageWeight;
             }
             // want the rounded weight as a string, so we use the "" + int shortcut
             String roundedWeight = weight.setScale(0, BigDecimal.ROUND_HALF_UP).toPlainString();
-            
+
             // translate shipmentMethodTypeId to DHL service code
             String shipmentMethodTypeId = shipmentRouteSegment.getString("shipmentMethodTypeId");
             String dhlShipmentDetailCode = null;
@@ -690,7 +690,7 @@
             if ((shippingKey == null) || (accountNbr == null) || (shippingKey.length() == 0) || (accountNbr.length() == 0)) {
                 return ServiceUtil.returnError("DHL Shipping Credentials are not configured. (check shipment.dhl.access)");
             }
-            
+
             // label image preference (PNG or GIF)
             String labelImagePreference = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.dhl.label.image.format");
             if (labelImagePreference == null) {
@@ -700,7 +700,7 @@
                 Debug.logError("Illegal shipment.dhl.label.image.format: " + labelImagePreference, module);
                 return ServiceUtil.returnError("Unknown DHL Label Image Format: " + labelImagePreference);
             }
-            
+
             // create AccessRequest XML doc using FreeMarker template
             String templateName = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.template.dhl.rate.estimate");
             if ((templateName == null) || (templateName.trim().length() == 0)) {
@@ -776,11 +776,11 @@
     }
 
     // NOTE: Must VOID shipments on errors
-    public static Map<String, Object> handleDhlShipmentConfirmResponse(String rateResponseString, GenericValue shipmentRouteSegment,
+    public static Map<String, Object> handleDhlShipmentConfirmResponse(String rateResponseString, GenericValue shipmentRouteSegment,
             List<GenericValue> shipmentPackageRouteSegs) throws GenericEntityException {
         Map<String, Object> result = FastMap.newInstance();
         GenericValue shipmentPackageRouteSeg = shipmentPackageRouteSegs.get(0);
-        
+
         // TODO: figure out how to handle validation on return XML, which can be mangled
         // Ideas: try again right away, let user try again, etc.
         Document rateResponseDocument = null;
@@ -799,13 +799,13 @@
             Debug.logError(e2, excErrMsg, module);
             // TODO VOID
         }
-        
+
         // tracking number: Shipment/ShipmentDetail/AirbillNbr
         Element rootElement = rateResponseDocument.getDocumentElement();
         Element shipmentElement = UtilXml.firstChildElement(rootElement, "Shipment");
         Element shipmentDetailElement = UtilXml.firstChildElement(shipmentElement, "ShipmentDetail");
         String trackingNumber = UtilXml.childElementValue(shipmentDetailElement, "AirbillNbr");
-        
+
         // label: Shipment/Label/Image
         Element labelElement = UtilXml.firstChildElement(shipmentElement, "Label");
         String encodedImageString = UtilXml.childElementValue(labelElement, "Image");
@@ -813,7 +813,7 @@
             Debug.logError("Cannot find response DHL shipment label.  Rate response document is: " + rateResponseString, module);
             return ServiceUtil.returnError("Cannot get response DHL shipment label for shipment package route segment " + shipmentPackageRouteSeg + ".  DHL response is: " + rateResponseString);
         }
-        
+
         // TODO: this is a temporary hack to replace the newlines so that Base64 likes the input This is NOT platform independent
         int size = encodedImageString.length();
         StringBuilder sb = new StringBuilder();
@@ -823,7 +823,7 @@
             sb.append(encodedImageString.charAt(i));
         }
         byte[] labelBytes = Base64.base64Decode(sb.toString().getBytes());
-        
+
         if (labelBytes != null) {
             // store in db blob
             shipmentPackageRouteSeg.setBytes("labelImage", labelBytes);
@@ -831,15 +831,15 @@
             Debug.log("Failed to either decode returned DHL label or no data found in eCommerce/Shipment/Label/Image.");
             // TODO: VOID
         }
-        
+
         shipmentPackageRouteSeg.set("trackingCode", trackingNumber);
         shipmentPackageRouteSeg.set("labelHtml", sb.toString());
         shipmentPackageRouteSeg.store();
-        
+
         shipmentRouteSegment.set("trackingIdNumber", trackingNumber);
         shipmentRouteSegment.put("carrierServiceStatusId", "SHRSCS_CONFIRMED");
         shipmentRouteSegment.store();
-        
+
         return ServiceUtil.returnSuccess("DHL Shipment Confirmed.");
     }
 

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java?rev=757089&r1=757088&r2=757089&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java Sat Mar 21 23:44:24 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -59,9 +59,9 @@
 
 /**
  * Fedex Shipment Services
- *
+ *
  * Implementation of Fedex shipment interface using Ship Manager Direct API
- *
+ *
  * TODO: FDXShipDeleteRequest/Reply (on error and via service call)
  * TODO: FDXCloseRequest/Reply
  * TODO: FDXRateRequest/Reply
@@ -77,7 +77,7 @@
 
     /**
      * Opens a URL to Fedex and makes a request.
-     *
+     *
      * @param xmlString XML message to send
      * @return XML string response from FedEx
      * @throws FedexConnectException
@@ -166,7 +166,7 @@
         String faxNumber = null;
         String emailAddress = null;
         try {
-            
+
             // Make sure the company exists
             GenericValue companyParty = delegator.findByPrimaryKeyCache("Party", UtilMisc.toMap("partyId", companyPartyId));
             if (companyParty == null) {
@@ -283,7 +283,7 @@
             if (UtilValidate.isEmpty(templateLocation)) {
                 return ServiceUtil.returnError("Can't find location for FDXSubscriptionRequest template - should be in " + shipmentPropertiesFile + ":shipment.template.fedex.subscription.location");
             }
-            
+
             // Populate the Freemarker context
             Map<String, Object> subscriptionRequestContext = FastMap.newInstance();
             subscriptionRequestContext.put("AccountNumber", accountNumber);
@@ -348,13 +348,13 @@
 
             Element fedexSubscriptionReplyElement = fDXSubscriptionReplyDocument.getDocumentElement();
             handleErrors(fedexSubscriptionReplyElement, errorList);
-    
+
             if (UtilValidate.isNotEmpty(errorList)) {
                 return ServiceUtil.returnError(errorList);
             }
-    
+
             String meterNumber = UtilXml.childElementValue(fedexSubscriptionReplyElement, "MeterNumber");
-    
+
             result.put("meterNumber", meterNumber);
 
         } catch ( GenericEntityException e ) {
@@ -366,15 +366,15 @@
     }
 
     /**
-     *
+     *
      * Send a FDXShipRequest via the Ship Manager Direct API
      */
     public static Map<String, Object> fedexShipRequest( DispatchContext dctx, Map<String, ? extends Object> context) {
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
-        //GenericValue userLogin = (GenericValue) context.get("userLogin");        
-        //Locale locale = (Locale) context.get("locale");        
-        
+        //GenericValue userLogin = (GenericValue) context.get("userLogin");
+        //Locale locale = (Locale) context.get("locale");
+
         String shipmentId = (String) context.get("shipmentId");
         String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId");
 
@@ -425,7 +425,7 @@
         if (UtilValidate.isEmpty(dropoffType)) {
             return ServiceUtil.returnError("Default dropoff type not found for Fedex ship request - should be in " + shipmentPropertiesFile + ":shipment.fedex.default.dropoffType.");
         }
-        
+
         try {
 
             Map<String, Object> shipRequestContext = FastMap.newInstance();
@@ -439,18 +439,18 @@
             if (UtilValidate.isEmpty(shipmentRouteSegment)) {
                 return ServiceUtil.returnError("ShipmentRouteSegment not found with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
             }
-            
+
             // Determine the Fedex carrier
             String carrierPartyId = shipmentRouteSegment.getString("carrierPartyId");
             if (! "FEDEX".equals(carrierPartyId)) {
                 return ServiceUtil.returnError("ERROR: The Carrier for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is not Fedex.");
             }
-            
+
             // Check the shipmentRouteSegment's carrier status
             if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("carrierServiceStatusId")) && !"SHRSCS_NOT_STARTED".equals(shipmentRouteSegment.getString("carrierServiceStatusId"))) {
                 return ServiceUtil.returnError("ERROR: The Carrier Service Status for ShipmentRouteSegment " + shipmentRouteSegmentId + " of Shipment " + shipmentId + ", is [" + shipmentRouteSegment.getString("carrierServiceStatusId") + "], but must be not-set or [SHRSCS_NOT_STARTED] to perform the Fedex Shipment Confirm operation.");
             }
-            
+
             // Translate shipmentMethodTypeId to Fedex service code and carrier code
             String shipmentMethodTypeId = shipmentRouteSegment.getString("shipmentMethodTypeId");
             GenericValue carrierShipmentMethod = delegator.findByPrimaryKey("CarrierShipmentMethod", UtilMisc.toMap("shipmentMethodTypeId", shipmentMethodTypeId, "partyId", "FEDEX", "roleTypeId", "CARRIER"));
@@ -461,7 +461,7 @@
                 return ServiceUtil.returnError("No Carrier service code for carrier Fedex shipmentMethodTypeId " + shipmentMethodTypeId);
             }
             String service = carrierShipmentMethod.getString("carrierServiceCode");
-            
+
             // CarrierCode is FDXG only for FEDEXGROUND and GROUNDHOMEDELIVERY services.
             boolean isGroundService = service.equals("FEDEXGROUND") || service.equals("GROUNDHOMEDELIVERY");
             String carrierCode = isGroundService ? "FDXG" : "FDXE";
@@ -475,7 +475,7 @@
             } else {
                 currencyCode = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD");
             }
-            
+
             // Get and validate origin postal address
             GenericValue originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress");
             if (UtilValidate.isEmpty(originPostalAddress)) {
@@ -492,7 +492,7 @@
             }
             String originAddressCountryCode = originCountryGeo.getString("geoCode");
             String originAddressStateOrProvinceCode = null;
-            
+
             // Only add the StateOrProvinceCode element if the address is in USA or Canada
             if (originAddressCountryCode.equals("CA") || originAddressCountryCode.equals("US")) {
                 if (UtilValidate.isEmpty(originPostalAddress.getString("stateProvinceGeoId"))) {
@@ -501,20 +501,20 @@
                 GenericValue stateProvinceGeo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", originPostalAddress.getString("stateProvinceGeoId")));
                 originAddressStateOrProvinceCode = stateProvinceGeo.getString("geoCode");
             }
-            
+
             // Get and validate origin telecom number
             GenericValue originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber");
             if (UtilValidate.isEmpty(originTelecomNumber)) {
                 return ServiceUtil.returnError("OriginTelecomNumber not found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
             }
             String originContactPhoneNumber = originTelecomNumber.getString("areaCode") + originTelecomNumber.getString("contactNumber");
-            
+
             // Fedex doesn't want the North American country code
             if (UtilValidate.isNotEmpty(originTelecomNumber.getString("countryCode")) && !(originAddressCountryCode.equals("CA") || originAddressCountryCode.equals("US"))) {
                 originContactPhoneNumber = originTelecomNumber.getString("countryCode") + originContactPhoneNumber;
             }
             originContactPhoneNumber = originContactPhoneNumber.replaceAll("[^+\\d]", "");
-            
+
             // Get the origin contact name from the owner of the origin facility
             GenericValue partyFrom = null;
             GenericValue originFacility = shipment.getRelatedOne("OriginFacility");
@@ -526,13 +526,13 @@
                     return ServiceUtil.returnError("Facility.ownerPartyId is required for Fedex shipments: shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + ", facilityId " + originFacility.getString("facilityId"));
                 }
             }
-            
+
             String originContactKey = "PERSON".equals(partyFrom.getString("partyTypeId")) ? "OriginContactPersonName" : "OriginContactCompanyName";
             String originContactName = PartyHelper.getPartyName(partyFrom, false);
             if (UtilValidate.isEmpty(originContactName)) {
                 return ServiceUtil.returnError("partyIdFrom for shipmentId " + shipmentId + ", shipmentRouteSegmentId " + shipmentRouteSegmentId + " has no name (required for Fedex shipments)" );
             }
-            
+
             // Get and validate destination postal address
             GenericValue destinationPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress");
             if (UtilValidate.isEmpty(destinationPostalAddress)) {
@@ -549,7 +549,7 @@
             }
             String destinationAddressCountryCode = destinationCountryGeo.getString("geoCode");
             String destinationAddressStateOrProvinceCode = null;
-            
+
             // Only add the StateOrProvinceCode element if the address is in USA or Canada
             if (destinationAddressCountryCode.equals("CA") || destinationAddressCountryCode.equals("US")) {
                 if (UtilValidate.isEmpty(destinationPostalAddress.getString("stateProvinceGeoId"))) {
@@ -558,7 +558,7 @@
                 GenericValue stateProvinceGeo = delegator.findByPrimaryKeyCache("Geo", UtilMisc.toMap("geoId", destinationPostalAddress.getString("stateProvinceGeoId")));
                 destinationAddressStateOrProvinceCode = stateProvinceGeo.getString("geoCode");
             }
-            
+
             // Get and validate destination telecom number
             GenericValue destinationTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber");
             if (UtilValidate.isEmpty(destinationTelecomNumber)) {
@@ -571,7 +571,7 @@
                 destinationContactPhoneNumber = destinationTelecomNumber.getString("countryCode") + destinationContactPhoneNumber;
             }
             destinationContactPhoneNumber = destinationContactPhoneNumber.replaceAll("[^+\\d]", "");
-            
+
             // Get the destination contact name
             String destinationPartyId = shipment.getString("partyIdTo");
             if (UtilValidate.isEmpty(destinationPartyId)) {
@@ -587,7 +587,7 @@
             String homeDeliveryType = null;
             Timestamp homeDeliveryDate = null;
             if ("GROUNDHOMEDELIVERY".equals(service)) {
-                
+
                 // Determine the home-delivery instructions
                 homeDeliveryType = shipmentRouteSegment.getString("homeDeliveryType");
                 if (UtilValidate.isNotEmpty(homeDeliveryType)) {
@@ -602,7 +602,7 @@
                     return ServiceUtil.returnError("homeDeliveryDate is before the current time for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
                 }
             }
-            
+
             List<GenericValue> shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", UtilMisc.toList("+shipmentPackageSeqId"));
             if (UtilValidate.isEmpty(shipmentPackageRouteSegs)) {
                 return ServiceUtil.returnError("No ShipmentPackageRouteSegs (ie No Packages) found for ShipmentRouteSegment with shipmentId " + shipmentId + " and shipmentRouteSegmentId " + shipmentRouteSegmentId);
@@ -610,7 +610,7 @@
             if (shipmentPackageRouteSegs.size() != 1) {
                return ServiceUtil.returnError("Cannot confirm shipment: fedexShipRequest service does not currently support more than one package per shipment.");
             }
-            
+
             // TODO: Multi-piece shipments, including logic to cancel packages 1-n if FDXShipRequest n+1 fails
 
             // Populate the Freemarker context with the non-package-related information
@@ -667,13 +667,13 @@
                     Debug.logWarning("Shipment Route Segment missing billingWeightUomId in shipmentId " + shipmentId + ", assuming default shipment.fedex.weightUomId of " + weightUomId + " from " + shipmentPropertiesFile,  module);
                     billingWeightUomId = weightUomId;
                 }
-                
+
                 // Convert the weight if necessary
                 if (! billingWeightUomId.equals(weightUomId)) {
                     Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", billingWeightUomId, "uomIdTo", weightUomId, "originalValue", billingWeight));
                     if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) {
                         Debug.logWarning("Unable to convert billing weights for shipmentId " + shipmentId , module);
-    
+
                         // Try getting the weight from package instead
                         hasBillingWeight = false;
                     } else {
@@ -691,7 +691,7 @@
                 String packaging = null;
                 if (UtilValidate.isEmpty(shipmentBoxType)) {
                     Debug.logWarning("Package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipment " + shipmentId + " has no packaging type set - defaulting to " + shipmentPropertiesFile + ":shipment.fedex.default.packagingType", module);
-                    
+
                     // Try to get the default packaging type
                     packaging = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.fedex.default.packagingType");
                     if (UtilValidate.isEmpty(packaging)) {
@@ -709,7 +709,7 @@
                     return ServiceUtil.returnError("Cannot confirm shipment: Package type for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipment " + shipmentId + " is missing packagingTypeCode.");
                 }
                 packaging = carrierShipmentBoxType.getString("packagingTypeCode");
-                
+
                 // Determine the dimensions of the package
                 BigDecimal dimensionsLength = null;
                 BigDecimal dimensionsWidth = null;
@@ -737,7 +737,7 @@
                                 dimensionsLength = (BigDecimal) results.get("convertedValue");
                             }
                         }
-                        
+
                     }
                     if (dimensionsWidth != null && dimensionsWidth.compareTo(BigDecimal.ZERO) > 0) {
                         if (! boxDimensionsUomId.equals(dimensionsUomId)) {
@@ -749,7 +749,7 @@
                                 dimensionsWidth = (BigDecimal) results.get("convertedValue");
                             }
                         }
-                        
+
                     }
                     if (dimensionsHeight != null && dimensionsHeight.compareTo(BigDecimal.ZERO) > 0) {
                         if (! boxDimensionsUomId.equals(dimensionsUomId)) {
@@ -761,7 +761,7 @@
                                 dimensionsHeight = (BigDecimal) results.get("convertedValue");
                             }
                         }
-                        
+
                     }
                 }
 
@@ -780,7 +780,7 @@
                             packageWeight = BigDecimal.ONE;
                         }
                     }
-                    
+
                     // Convert weight if necessary
                     String packageWeightUomId = shipmentPackage.getString("weightUomId");
                     if (UtilValidate.isEmpty(packageWeightUomId)) {
@@ -800,7 +800,7 @@
                 if (weight == null || weight.compareTo(BigDecimal.ZERO) < 0) {
                     ServiceUtil.returnError("Unable to determine weight for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId);
                 }
-                
+
                 // Populate the Freemarker context with package-related information
                 shipRequestContext.put("CustomerReference", shipmentId + ":" + shipmentRouteSegmentId + ":" + shipmentPackage.getString("shipmentPackageSeqId"));
                 shipRequestContext.put("DropoffType", dropoffType);
@@ -816,7 +816,7 @@
                 }
                 shipRequestContext.put("Weight", weight.setScale(1, BigDecimal.ROUND_UP).toString());
             }
-        
+
             StringWriter outWriter = new StringWriter();
             try {
                 FreeMarkerWorker.renderTemplateAtLocation(templateLocation, shipRequestContext, outWriter);
@@ -825,7 +825,7 @@
                 Debug.logError(e, errorMessage, module);
                 return ServiceUtil.returnError(errorMessage + ": " + e.getMessage());
             }
-            
+
             // Pass the request string to the sending method
             String fDXShipRequestString = outWriter.toString();
             String fDXShipReplyString = null;
@@ -839,7 +839,7 @@
                 Debug.logError(e, errorMessage, module);
                 return ServiceUtil.returnError(errorMessage + e.toString());
             }
-            
+
             // Pass the reply to the handler method
             return handleFedexShipReply(fDXShipReplyString, shipmentRouteSegment, shipmentPackageRouteSegs);
 
@@ -879,11 +879,11 @@
             Debug.logError(ioe, errorMessage, module);
             // TODO Cancel the package
         }
-        
+
         if (UtilValidate.isEmpty(fdxShipReplyDocument)) {
             return ServiceUtil.returnError("Error parsing the FDXShipReply.");
         }
-        
+
         // Tracking number: Tracking/TrackingNumber
         Element rootElement = fdxShipReplyDocument.getDocumentElement();
 
@@ -895,7 +895,7 @@
 
         Element trackingElement = UtilXml.firstChildElement(rootElement, "Tracking");
         String trackingNumber = UtilXml.childElementValue(trackingElement, "TrackingNumber");
-        
+
         // Label: Labels/OutboundLabel
         Element labelElement = UtilXml.firstChildElement(rootElement, "Labels");
         String encodedImageString = UtilXml.childElementValue(labelElement, "OutboundLabel");
@@ -903,30 +903,30 @@
             Debug.logError("Cannot find FDXShipReply label. FDXShipReply document is: " + fDXShipReplyString, module);
             return ServiceUtil.returnError("Cannot get FDXShipReply label for shipment package route segment " + shipmentPackageRouteSeg + ".  FedEx response is: " + fDXShipReplyString);
         }
-        
+
         byte[] labelBytes = Base64.base64Decode(encodedImageString.getBytes());
-        
+
         if (labelBytes != null) {
-            
+
             // Store in db blob
             shipmentPackageRouteSeg.setBytes("labelImage", labelBytes);
         } else {
             Debug.log("Failed to either decode returned FedEx label or no data found in Labels/OutboundLabel.");
             // TODO: Cancel the package
         }
-        
+
         shipmentPackageRouteSeg.set("trackingCode", trackingNumber);
         shipmentPackageRouteSeg.set("labelHtml", encodedImageString);
         shipmentPackageRouteSeg.store();
-        
+
         shipmentRouteSegment.set("trackingIdNumber", trackingNumber);
         shipmentRouteSegment.put("carrierServiceStatusId", "SHRSCS_CONFIRMED");
         shipmentRouteSegment.store();
-        
+
         return ServiceUtil.returnSuccess("FedEx Shipment Confirmed.");
 
     }
-        
+
     public static void handleErrors(Element rootElement, List<Object> errorList) {
         Element errorElement = null;
         if ("Error".equalsIgnoreCase(rootElement.getNodeName())) {