Author: doogie
Date: Mon Nov 10 18:19:19 2008 New Revision: 712918 URL: http://svn.apache.org/viewvc?rev=712918&view=rev Log: The final set of generics markup, for shipment. Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSessionLine.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/picklist/PickListServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentEvents.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java?rev=712918&r1=712917&r2=712918&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingServices.java Mon Nov 10 18:19:19 2008 @@ -23,6 +23,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.service.DispatchContext; @@ -32,7 +33,7 @@ public static final String module = PackingServices.class.getName(); - public static Map addPackLine(DispatchContext dctx, Map context) { + public static Map<String, Object> addPackLine(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); String orderId = (String) context.get("orderId"); @@ -70,7 +71,7 @@ return ServiceUtil.returnSuccess(); } - public static Map packBulk(DispatchContext dctx, Map context) { + public static Map<String, Object> packBulk(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); String orderId = (String) context.get("orderId"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); @@ -87,28 +88,28 @@ String pickerPartyId = (String) context.get("pickerPartyId"); session.setPickerPartyId(pickerPartyId); - Map selInfo = (Map) context.get("selInfo"); - Map iteInfo = (Map) context.get("iteInfo"); - Map prdInfo = (Map) context.get("prdInfo"); - Map qtyInfo = (Map) context.get("qtyInfo"); - Map pkgInfo = (Map) context.get("pkgInfo"); - Map wgtInfo = (Map) context.get("wgtInfo"); + Map<String, ?> selInfo = UtilGenerics.checkMap(context.get("selInfo")); + Map<String, String> iteInfo = UtilGenerics.checkMap(context.get("iteInfo")); + Map<String, String> prdInfo = UtilGenerics.checkMap(context.get("prdInfo")); + Map<String, String> qtyInfo = UtilGenerics.checkMap(context.get("qtyInfo")); + Map<String, String> pkgInfo = UtilGenerics.checkMap(context.get("pkgInfo")); + Map<String, String> wgtInfo = UtilGenerics.checkMap(context.get("wgtInfo")); if (selInfo != null) { - Iterator i = selInfo.keySet().iterator(); + Iterator<String> i = selInfo.keySet().iterator(); while (i.hasNext()) { - String rowKey = (String) i.next(); - String orderItemSeqId = (String) iteInfo.get(rowKey); - String prdStr = (String) prdInfo.get(rowKey); + String rowKey = i.next(); + String orderItemSeqId = iteInfo.get(rowKey); + String prdStr = prdInfo.get(rowKey); if (UtilValidate.isEmpty(prdStr)) { // set the productId to null if empty prdStr = null; } // base package/quantity/weight strings - String pkgStr = (String) pkgInfo.get(rowKey); - String qtyStr = (String) qtyInfo.get(rowKey); - String wgtStr = (String) wgtInfo.get(rowKey); + String pkgStr = pkgInfo.get(rowKey); + String qtyStr = qtyInfo.get(rowKey); + String wgtStr = wgtInfo.get(rowKey); Debug.log("Item: " + orderItemSeqId + " / Product: " + prdStr + " / Quantity: " + qtyStr + " / Package: " + pkgStr + " / Weight: " + wgtStr, module); @@ -172,23 +173,23 @@ return ServiceUtil.returnSuccess(); } - public static Map incrementPackageSeq(DispatchContext dctx, Map context) { + public static Map<String, Object> incrementPackageSeq(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); int nextSeq = session.nextPackageSeq(); - Map result = ServiceUtil.returnSuccess(); + Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("nextPackageSeq", Integer.valueOf(nextSeq)); return result; } - public static Map clearLastPackage(DispatchContext dctx, Map context) { + public static Map<String, Object> clearLastPackage(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); int nextSeq = session.clearLastPackage(); - Map result = ServiceUtil.returnSuccess(); + Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("nextPackageSeq", Integer.valueOf(nextSeq)); return result; } - public static Map clearPackLine(DispatchContext dctx, Map context) { + public static Map<String, Object> clearPackLine(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); @@ -210,16 +211,16 @@ return ServiceUtil.returnSuccess(); } - public static Map clearPackAll(DispatchContext dctx, Map context) { + public static Map<String, Object> clearPackAll(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); session.clearAllLines(); return ServiceUtil.returnSuccess(); } - public static Map calcPackSessionAdditionalShippingCharge(DispatchContext dctx, Map context) { + public static Map<String, Object> calcPackSessionAdditionalShippingCharge(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); - Map packageWeights = (Map) context.get("packageWeights"); + Map<String, String> packageWeights = UtilGenerics.checkMap(context.get("packageWeights")); String weightUomId = (String) context.get("weightUomId"); String shippingContactMechId = (String) context.get("shippingContactMechId"); String shipmentMethodTypeId = (String) context.get("shipmentMethodTypeId"); @@ -232,20 +233,20 @@ session.setAdditionalShippingCharge(estimatedShipCost); session.setWeightUomId(weightUomId); - Map result = ServiceUtil.returnSuccess(); + Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("additionalShippingCharge", estimatedShipCost); return result; } - public static Map completePack(DispatchContext dctx, Map context) { + public static Map<String, Object> completePack(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); // set the instructions -- will clear out previous if now null String instructions = (String) context.get("handlingInstructions"); String pickerPartyId = (String) context.get("pickerPartyId"); Double additionalShippingCharge = (Double) context.get("additionalShippingCharge"); - Map packageWeights = (Map) context.get("packageWeights"); + Map<String, String> packageWeights = UtilGenerics.checkMap(context.get("packageWeights")); String weightUomId = (String) context.get("weightUomId"); session.setHandlingInstructions(instructions); session.setPickerPartyId(pickerPartyId); @@ -266,7 +267,7 @@ return ServiceUtil.returnError(e.getMessage(), e.getMessageList()); } - Map resp; + Map<String, Object> resp; if ("EMPTY".equals(shipmentId)) { resp = ServiceUtil.returnError("No items currently set to be shipped. Cannot complete!"); } else { @@ -277,13 +278,13 @@ return resp; } - public static double setSessionPackageWeights(PackingSession session, Map packageWeights) { + public static double setSessionPackageWeights(PackingSession session, Map<String, String> packageWeights) { double shippableWeight = 0; if (! UtilValidate.isEmpty(packageWeights)) { - Iterator pwit = packageWeights.keySet().iterator(); + Iterator<String> pwit = packageWeights.keySet().iterator(); while (pwit.hasNext()) { - String packageSeqId = (String) pwit.next(); - String packageWeightStr = (String) packageWeights.get(packageSeqId); + String packageSeqId = pwit.next(); + String packageWeightStr = packageWeights.get(packageSeqId); if (UtilValidate.isNotEmpty(packageWeightStr)) { double packageWeight = UtilMisc.toDouble(packageWeights.get(packageSeqId)); session.setPackageWeight(Integer.parseInt(packageSeqId), Double.valueOf(packageWeight)); 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=712918&r1=712917&r2=712918&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 Mon Nov 10 18:19:19 2008 @@ -28,6 +28,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; @@ -56,10 +57,10 @@ protected String instructions = null; protected String weightUomId = null; protected Double additionalShippingCharge = null; - protected Map packageWeights = null; - protected List packEvents = null; - protected List packLines = null; - protected List itemInfos = null; + protected Map<Integer, Double> packageWeights = null; + protected List<PackingEvent> packEvents = null; + protected List<PackingSessionLine> packLines = null; + protected List<ItemDisplay> itemInfos = null; protected int packageSeq = -1; protected int status = 1; @@ -119,11 +120,11 @@ } // get the reservations for the item - Map invLookup = FastMap.newInstance(); + Map<String, Object> invLookup = FastMap.newInstance(); invLookup.put("orderId", orderId); invLookup.put("orderItemSeqId", orderItemSeqId); invLookup.put("shipGroupSeqId", shipGroupSeqId); - List reservations = this.getDelegator().findByAnd("OrderItemShipGrpInvRes", invLookup, UtilMisc.toList("quantity DESC")); + List<GenericValue> reservations = this.getDelegator().findByAnd("OrderItemShipGrpInvRes", invLookup, UtilMisc.toList("quantity DESC")); // no reservations we cannot add this item if (UtilValidate.isEmpty(reservations)) { @@ -137,12 +138,12 @@ this.createPackLineItem(checkCode, res, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, weight, packageSeqId); } else { // more than one reservation found - Map toCreateMap = FastMap.newInstance(); - Iterator i = reservations.iterator(); + Map<GenericValue, Double> toCreateMap = FastMap.newInstance(); + Iterator<GenericValue> i = reservations.iterator(); double qtyRemain = quantity; while (i.hasNext() && qtyRemain > 0) { - GenericValue res = (GenericValue) i.next(); + GenericValue res = i.next(); // Check that the inventory item product match with the current product to pack if (!productId.equals(res.getRelatedOne("InventoryItem").getString("productId"))) { @@ -177,10 +178,10 @@ } if (qtyRemain == 0) { - Iterator x = toCreateMap.keySet().iterator(); + Iterator<GenericValue> x = toCreateMap.keySet().iterator(); while (x.hasNext()) { - GenericValue res = (GenericValue) x.next(); - Double qty = (Double) toCreateMap.get(res); + GenericValue res = x.next(); + Double qty = toCreateMap.get(res); this.createPackLineItem(2, res, orderId, orderItemSeqId, shipGroupSeqId, productId, qty.doubleValue(), weight, packageSeqId); } } else { @@ -201,10 +202,10 @@ } public PackingSessionLine findLine(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, int packageSeq) { - List lines = this.getLines(); - Iterator i = lines.iterator(); + List<PackingSessionLine> lines = this.getLines(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); if (orderId.equals(line.getOrderId()) && orderItemSeqId.equals(line.getOrderItemSeqId()) && shipGroupSeqId.equals(line.getShipGroupSeqId()) && @@ -243,30 +244,30 @@ } protected String findOrderItemSeqId(String productId, String orderId, String shipGroupSeqId, double quantity) throws GeneralException { - Map lookupMap = FastMap.newInstance(); + Map<String, Object> lookupMap = FastMap.newInstance(); lookupMap.put("orderId", orderId); lookupMap.put("productId", productId); lookupMap.put("statusId", "ITEM_APPROVED"); lookupMap.put("shipGroupSeqId", shipGroupSeqId); - List sort = UtilMisc.toList("-quantity"); - List orderItems = this.getDelegator().findByAnd("OrderItemAndShipGroupAssoc", lookupMap, sort); + List<String> sort = UtilMisc.toList("-quantity"); + List<GenericValue> orderItems = this.getDelegator().findByAnd("OrderItemAndShipGroupAssoc", lookupMap, sort); String orderItemSeqId = null; if (orderItems != null) { - Iterator i = orderItems.iterator(); + Iterator<GenericValue> i = orderItems.iterator(); while (i.hasNext()) { - GenericValue item = (GenericValue) i.next(); + GenericValue item = i.next(); // get the reservations for the item - Map invLookup = FastMap.newInstance(); + Map<String, Object> invLookup = FastMap.newInstance(); invLookup.put("orderId", orderId); invLookup.put("orderItemSeqId", item.getString("orderItemSeqId")); invLookup.put("shipGroupSeqId", shipGroupSeqId); - List reservations = this.getDelegator().findByAnd("OrderItemShipGrpInvRes", invLookup); - Iterator resIter = reservations.iterator(); + List<GenericValue> reservations = this.getDelegator().findByAnd("OrderItemShipGrpInvRes", invLookup); + Iterator<GenericValue> resIter = reservations.iterator(); while (resIter.hasNext()) { - GenericValue res = (GenericValue) resIter.next(); + GenericValue res = resIter.next(); Double qty = res.getDouble("quantity"); if (quantity <= qty.doubleValue()) { orderItemSeqId = item.getString("orderItemSeqId"); @@ -312,14 +313,14 @@ } } - public void addItemInfo(List infos) { - Iterator i = infos.iterator(); + public void addItemInfo(List<GenericValue> infos) { + Iterator<GenericValue> i = infos.iterator(); while (i.hasNext()) { - GenericValue v = (GenericValue) i.next(); + GenericValue v = i.next(); ItemDisplay newItem = new ItemDisplay(v); int currentIdx = itemInfos.indexOf(newItem); if (currentIdx != -1) { - ItemDisplay existingItem = (ItemDisplay) itemInfos.get(currentIdx); + ItemDisplay existingItem = itemInfos.get(currentIdx); existingItem.quantity = existingItem.quantity.add(newItem.quantity); } else { itemInfos.add(newItem); @@ -327,7 +328,7 @@ } } - public List getItemInfos() { + public List<ItemDisplay> getItemInfos() { return itemInfos; } @@ -339,7 +340,7 @@ return this.shipmentId; } - public List getLines() { + public List<PackingSessionLine> getLines() { return this.packLines; } @@ -361,10 +362,10 @@ public double getPackedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, int packageSeq) { double total = 0.0; - List lines = this.getLines(); - Iterator i = lines.iterator(); + List<PackingSessionLine> lines = this.getLines(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); if (orderId.equals(line.getOrderId()) && orderItemSeqId.equals(line.getOrderItemSeqId()) && shipGroupSeqId.equals(line.getShipGroupSeqId()) && productId.equals(line.getProductId())) { if (inventoryItemId == null || inventoryItemId.equals(line.getInventoryItemId())) { @@ -388,10 +389,10 @@ double total = 0.0; if (productId != null ) { - List lines = this.getLines(); - Iterator i = lines.iterator(); + List<PackingSessionLine> lines = this.getLines(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); if (productId.equals(line.getProductId())) { if (packageSeq == -1 || packageSeq == line.getPackageSeq()) { total += line.getQuantity(); @@ -404,10 +405,10 @@ public double getPackedQuantity(int packageSeq) { double total = 0.0; - List lines = this.getLines(); - Iterator i = lines.iterator(); + List<PackingSessionLine> lines = this.getLines(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); if (packageSeq == -1 || packageSeq == line.getPackageSeq()) { total += line.getQuantity(); } @@ -437,11 +438,11 @@ public double getCurrentShippedQuantity(String orderId, String orderItemSeqId, String shipGroupSeqId) { double shipped = 0.0; - List issues = this.getItemIssuances(orderId, orderItemSeqId, shipGroupSeqId); + List<GenericValue> issues = this.getItemIssuances(orderId, orderItemSeqId, shipGroupSeqId); if (issues != null) { - Iterator i = issues.iterator(); + Iterator<GenericValue> i = issues.iterator(); while (i.hasNext()) { - GenericValue v = (GenericValue) i.next(); + GenericValue v = i.next(); Double qty = v.getDouble("quantity"); if (qty == null) qty = Double.valueOf(0); shipped += qty.doubleValue(); @@ -451,24 +452,24 @@ return shipped; } - public List getCurrentShipmentIds(String orderId, String orderItemSeqId, String shipGroupSeqId) { - Set shipmentIds = FastSet.newInstance(); - List issues = this.getItemIssuances(orderId, orderItemSeqId, shipGroupSeqId); + public List<String> getCurrentShipmentIds(String orderId, String orderItemSeqId, String shipGroupSeqId) { + Set<String> shipmentIds = FastSet.newInstance(); + List<GenericValue> issues = this.getItemIssuances(orderId, orderItemSeqId, shipGroupSeqId); if (issues != null) { - Iterator i = issues.iterator(); + Iterator<GenericValue> i = issues.iterator(); while (i.hasNext()) { - GenericValue v = (GenericValue) i.next(); + GenericValue v = i.next(); shipmentIds.add(v.getString("shipmentId")); } } - List retList = FastList.newInstance(); + List<String> retList = FastList.newInstance(); retList.addAll(shipmentIds); return retList; } - public List getCurrentShipmentIds(String orderId, String shipGroupSeqId) { + public List<String> getCurrentShipmentIds(String orderId, String shipGroupSeqId) { return this.getCurrentShipmentIds(orderId, null, shipGroupSeqId); } @@ -553,10 +554,10 @@ return packageSeq; } - List currentLines = UtilMisc.makeListWritable(this.packLines); - Iterator i = currentLines.iterator(); + List<PackingSessionLine> currentLines = UtilMisc.makeListWritable(this.packLines); + Iterator<PackingSessionLine> i = currentLines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); if (line.getPackageSeq() == packageSeq) { this.clearLine(line); } @@ -621,10 +622,10 @@ } protected void checkReservations(boolean ignore) throws GeneralException { - List errors = FastList.newInstance(); - Iterator i = this.getLines().iterator(); + List<String> errors = FastList.newInstance(); + Iterator<PackingSessionLine> i = this.getLines().iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); double reservedQty = this.getCurrentReservedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); double packedQty = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); @@ -643,11 +644,11 @@ } protected void checkEmptyLines() throws GeneralException { - List lines = FastList.newInstance(); + List<PackingSessionLine> lines = FastList.newInstance(); lines.addAll(this.getLines()); - Iterator i = lines.iterator(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine l = (PackingSessionLine) i.next(); + PackingSessionLine l = i.next(); if (l.getQuantity() == 0) { this.packLines.remove(l); } @@ -656,21 +657,21 @@ protected void runEvents(int eventCode) { if (this.packEvents.size() > 0) { - Iterator i = this.packEvents.iterator(); + Iterator<PackingEvent> i = this.packEvents.iterator(); while (i.hasNext()) { - PackingEvent event = (PackingEvent) i.next(); + PackingEvent event = i.next(); event.runEvent(this, eventCode); } } } - protected List getItemIssuances(String orderId, String orderItemSeqId, String shipGroupSeqId) { - List issues = null; + protected List<GenericValue> getItemIssuances(String orderId, String orderItemSeqId, String shipGroupSeqId) { + List<GenericValue> issues = null; if (orderId == null) { throw new IllegalArgumentException("Value for orderId is null"); } - Map lookupMap = FastMap.newInstance(); + Map<String, Object> lookupMap = FastMap.newInstance(); lookupMap.put("orderId", orderId); if (UtilValidate.isNotEmpty(orderItemSeqId)) { lookupMap.put("orderItemSeqId", orderItemSeqId); @@ -689,7 +690,7 @@ protected void createShipment() throws GeneralException { // first create the shipment - Map newShipment = FastMap.newInstance(); + Map<String, Object> newShipment = FastMap.newInstance(); newShipment.put("originFacilityId", this.facilityId); newShipment.put("primaryShipGroupSeqId", primaryShipGrp); newShipment.put("primaryOrderId", primaryOrderId); @@ -700,7 +701,7 @@ newShipment.put("additionalShippingCharge", additionalShippingCharge); newShipment.put("userLogin", userLogin); Debug.log("Creating new shipment with context: " + newShipment, module); - Map newShipResp = this.getDispatcher().runSync("createShipment", newShipment); + Map<String, Object> newShipResp = this.getDispatcher().runSync("createShipment", newShipment); if (ServiceUtil.isError(newShipResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(newShipResp)); @@ -709,11 +710,11 @@ } protected void issueItemsToShipment() throws GeneralException { - List processedLines = FastList.newInstance(); - List lines = this.getLines(); - Iterator i = lines.iterator(); + List<PackingSessionLine> processedLines = FastList.newInstance(); + List<PackingSessionLine> lines = this.getLines(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); if (this.checkLine(processedLines, line)) { double totalPacked = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId(), line.getInventoryItemId(), -1); @@ -724,10 +725,10 @@ } } - protected boolean checkLine(List processedLines, PackingSessionLine line) { - Iterator i = processedLines.iterator(); + protected boolean checkLine(List<PackingSessionLine> processedLines, PackingSessionLine line) { + Iterator<PackingSessionLine> i = processedLines.iterator(); while (i.hasNext()) { - PackingSessionLine l = (PackingSessionLine) i.next(); + PackingSessionLine l = i.next(); if (line.isSameItem(l)) { line.setShipmentItemSeqId(l.getShipmentItemSeqId()); return false; @@ -741,14 +742,14 @@ for (int i = 0; i < packageSeq; i++) { String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5); - Map pkgCtx = FastMap.newInstance(); + Map<String, Object> pkgCtx = FastMap.newInstance(); pkgCtx.put("shipmentId", shipmentId); pkgCtx.put("shipmentPackageSeqId", shipmentPackageSeqId); //pkgCtx.put("shipmentBoxTypeId", ""); pkgCtx.put("weight", getPackageWeight(i+1)); pkgCtx.put("weightUomId", getWeightUomId()); pkgCtx.put("userLogin", userLogin); - Map newPkgResp = this.getDispatcher().runSync("createShipmentPackage", pkgCtx); + Map<String, Object> newPkgResp = this.getDispatcher().runSync("createShipmentPackage", pkgCtx); if (ServiceUtil.isError(newPkgResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(newPkgResp)); @@ -757,10 +758,10 @@ } protected void applyItemsToPackages() throws GeneralException { - List lines = this.getLines(); - Iterator i = lines.iterator(); + List<PackingSessionLine> lines = this.getLines(); + Iterator<PackingSessionLine> i = lines.iterator(); while (i.hasNext()) { - PackingSessionLine line = (PackingSessionLine) i.next(); + PackingSessionLine line = i.next(); line.applyLineToPackage(shipmentId, userLogin, getDispatcher()); } } @@ -768,11 +769,11 @@ protected void updateShipmentRouteSegments() throws GeneralException { Double shipmentWeight = Double.valueOf(getTotalWeight()); if (shipmentWeight.doubleValue() <= 0) return; - List shipmentRouteSegments = getDelegator().findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", this.getShipmentId())); + List<GenericValue> shipmentRouteSegments = getDelegator().findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", this.getShipmentId())); if (! UtilValidate.isEmpty(shipmentRouteSegments)) { - Iterator srit = shipmentRouteSegments.iterator(); + Iterator<GenericValue> srit = shipmentRouteSegments.iterator(); while (srit.hasNext()) { - GenericValue shipmentRouteSegment = (GenericValue) srit.next(); + GenericValue shipmentRouteSegment = srit.next(); shipmentRouteSegment.set("billingWeight", shipmentWeight); shipmentRouteSegment.set("billingWeightUomId", getWeightUomId()); } @@ -781,8 +782,8 @@ } protected void setShipmentToPacked() throws GeneralException { - Map packedCtx = UtilMisc.toMap("shipmentId", shipmentId, "statusId", "SHIPMENT_PACKED", "userLogin", userLogin); - Map packedResp = this.getDispatcher().runSync("updateShipment", packedCtx); + Map<String, Object> packedCtx = UtilMisc.toMap("shipmentId", shipmentId, "statusId", "SHIPMENT_PACKED", "userLogin", userLogin); + Map<String, Object> packedResp = this.getDispatcher().runSync("updateShipment", packedCtx); if (packedResp != null && ServiceUtil.isError(packedResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(packedResp)); } @@ -793,19 +794,19 @@ // first find the picklist id GenericValue bin = this.getDelegator().findByPrimaryKey("PicklistBin", UtilMisc.toMap("picklistBinId", picklistBinId)); if (bin != null) { - Map ctx = FastMap.newInstance(); + Map<String, Object> ctx = FastMap.newInstance(); ctx.put("picklistId", bin.getString("picklistId")); ctx.put("partyId", pickerPartyId); ctx.put("roleTypeId", "PICKER"); // check if the role already exists and is valid - List currentRoles = this.getDelegator().findByAnd("PicklistRole", ctx); + List<GenericValue> currentRoles = this.getDelegator().findByAnd("PicklistRole", ctx); currentRoles = EntityUtil.filterByDate(currentRoles); // if not; create the role if (UtilValidate.isNotEmpty(currentRoles)) { ctx.put("userLogin", userLogin); - Map addRole = this.getDispatcher().runSync("createPicklistRole", ctx); + Map<String, Object> addRole = this.getDispatcher().runSync("createPicklistRole", ctx); if (ServiceUtil.isError(addRole)) { throw new GeneralException(ServiceUtil.getErrorMessage(addRole)); } @@ -833,7 +834,7 @@ return total; } - public Double getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId, List shippableItemInfo, Double shippableTotal, Double shippableWeight, Double shippableQuantity) { + public Double getShipmentCostEstimate(GenericValue orderItemShipGroup, String productStoreId, List<GenericValue> shippableItemInfo, Double shippableTotal, Double shippableWeight, Double shippableQuantity) { return getShipmentCostEstimate(orderItemShipGroup.getString("contactMechId"), orderItemShipGroup.getString("shipmentMethodTypeId"), orderItemShipGroup.getString("carrierPartyId"), orderItemShipGroup.getString("carrierRoleTypeId"), productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity); @@ -845,12 +846,12 @@ productStoreId, null, null, null, null); } - public Double getShipmentCostEstimate(String shippingContactMechId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String productStoreId, List shippableItemInfo, Double shippableTotal, Double shippableWeight, Double shippableQuantity) { + public Double getShipmentCostEstimate(String shippingContactMechId, String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String productStoreId, List<GenericValue> shippableItemInfo, Double shippableTotal, Double shippableWeight, Double shippableQuantity) { Double shipmentCostEstimate = null; - Map serviceResult = null; + Map<String, Object> serviceResult = null; try { - Map serviceContext = FastMap.newInstance(); + Map<String, Object> serviceContext = FastMap.newInstance(); serviceContext.put("shippingContactMechId", shippingContactMechId); serviceContext.put("shipmentMethodTypeId", shipmentMethodTypeId); serviceContext.put("carrierPartyId", carrierPartyId); @@ -859,10 +860,10 @@ if (UtilValidate.isEmpty(shippableItemInfo)) { shippableItemInfo = FastList.newInstance(); - Iterator lit = getLines().iterator(); + Iterator<PackingSessionLine> lit = getLines().iterator(); while (lit.hasNext()) { - PackingSessionLine line = (PackingSessionLine) lit.next(); - List oiasgas = getDelegator().findByAnd("OrderItemAndShipGroupAssoc", UtilMisc.toMap("orderId", line.getOrderId(), "orderItemSeqId", line.getOrderItemSeqId(), "shipGroupSeqId", line.getShipGroupSeqId())); + PackingSessionLine line = lit.next(); + List<GenericValue> oiasgas = getDelegator().findByAnd("OrderItemAndShipGroupAssoc", UtilMisc.toMap("orderId", line.getOrderId(), "orderItemSeqId", line.getOrderItemSeqId(), "shipGroupSeqId", line.getShipGroupSeqId())); shippableItemInfo.addAll(oiasgas); } } @@ -906,12 +907,12 @@ this.weightUomId = weightUomId; } - public List getPackageSeqIds() { - Set packageSeqIds = new TreeSet(); + public List<Integer> getPackageSeqIds() { + Set<Integer> packageSeqIds = new TreeSet<Integer>(); if (! UtilValidate.isEmpty(this.getLines())) { - Iterator lit = this.getLines().iterator(); + Iterator<PackingSessionLine> lit = this.getLines().iterator(); while (lit.hasNext()) { - PackingSessionLine line = (PackingSessionLine) lit.next(); + PackingSessionLine line = lit.next(); packageSeqIds.add(Integer.valueOf(line.getPackageSeq())); } } @@ -928,11 +929,7 @@ public Double getPackageWeight(int packageSeqId) { if (this.packageWeights == null) return null; - Double packageWeight = null; - Object p = packageWeights.get(Integer.valueOf(packageSeqId)); - if (p != null) { - packageWeight = (Double) p; - } + Double packageWeight = packageWeights.get(Integer.valueOf(packageSeqId)); return packageWeight; } 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=712918&r1=712917&r2=712918&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 Mon Nov 10 18:19:19 2008 @@ -129,7 +129,7 @@ quantity = Double.valueOf(this.getQuantity()); } - Map issueMap = FastMap.newInstance(); + Map<String, Object> issueMap = FastMap.newInstance(); issueMap.put("shipmentId", shipmentId); issueMap.put("orderId", this.getOrderId()); issueMap.put("orderItemSeqId", this.getOrderItemSeqId()); @@ -138,7 +138,7 @@ issueMap.put("quantity", quantity); issueMap.put("userLogin", userLogin); - Map issueResp = dispatcher.runSync("issueOrderItemShipGrpInvResToShipment", issueMap); + Map<String, Object> issueResp = dispatcher.runSync("issueOrderItemShipGrpInvResToShipment", issueMap); if (ServiceUtil.isError(issueResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(issueResp)); } @@ -154,7 +154,7 @@ // find the pick list item Debug.log("Looking up picklist item for bin ID #" + picklistBinId, module); GenericDelegator delegator = dispatcher.getDelegator(); - Map itemLookup = FastMap.newInstance(); + Map<String, Object> itemLookup = FastMap.newInstance(); itemLookup.put("picklistBinId", picklistBinId); itemLookup.put("orderId", this.getOrderId()); itemLookup.put("orderItemSeqId", this.getOrderItemSeqId()); @@ -172,7 +172,7 @@ } itemLookup.put("userLogin", userLogin); - Map itemUpdateResp = dispatcher.runSync("updatePicklistItem", itemLookup); + Map<String, Object> itemUpdateResp = dispatcher.runSync("updatePicklistItem", itemLookup); if (ServiceUtil.isError(itemUpdateResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(issueResp)); } @@ -188,13 +188,13 @@ // assign item to package String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(this.getPackageSeq(), 5); - Map packageMap = FastMap.newInstance(); + Map<String, Object> packageMap = FastMap.newInstance(); packageMap.put("shipmentId", shipmentId); packageMap.put("shipmentItemSeqId", this.getShipmentItemSeqId()); packageMap.put("quantity", Double.valueOf(this.getQuantity())); packageMap.put("shipmentPackageSeqId", shipmentPackageSeqId); packageMap.put("userLogin", userLogin); - Map packageResp = dispatcher.runSync("addShipmentContentToPackage", packageMap); + Map<String, Object> packageResp = dispatcher.runSync("addShipmentContentToPackage", packageMap); if (ServiceUtil.isError(packageResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(packageResp)); 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=712918&r1=712917&r2=712918&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 Mon Nov 10 18:19:19 2008 @@ -34,6 +34,7 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilValidate; @@ -42,27 +43,27 @@ public static final String module = PickListServices.class.getName(); - public static Map convertOrderIdListToHeaders(DispatchContext dctx, Map context) { + public static Map<String, Object> convertOrderIdListToHeaders(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); - List orderHeaderList = (List) context.get("orderHeaderList"); - List orderIdList = (List) context.get("orderIdList"); + List<GenericValue> orderHeaderList = UtilGenerics.checkList(context.get("orderHeaderList")); + List<String> orderIdList = UtilGenerics.checkList(context.get("orderIdList")); // we don't want to process if there is already a header list if (orderHeaderList == null) { // convert the ID list to headers if (orderIdList != null) { - List conditionList1 = FastList.newInstance(); - List conditionList2 = FastList.newInstance(); + List<EntityCondition> conditionList1 = FastList.newInstance(); + List<EntityCondition> conditionList2 = FastList.newInstance(); // we are only concerned about approved sales orders conditionList2.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED")); conditionList2.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")); // build the expression list from the IDs - Iterator i = orderIdList.iterator(); + Iterator<String> i = orderIdList.iterator(); while (i.hasNext()) { - String orderId = (String) i.next(); + String orderId = i.next(); conditionList1.add(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId)); } @@ -84,14 +85,14 @@ } } - Map result = ServiceUtil.returnSuccess(); + Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("orderHeaderList", orderHeaderList); return result; } public static boolean isBinComplete(GenericDelegator delegator, String picklistBinId) throws GeneralException { // lookup the items in the bin - List items; + List<GenericValue> items; try { items = delegator.findByAnd("PicklistItem", UtilMisc.toMap("picklistBinId", picklistBinId)); } catch (GenericEntityException e) { @@ -100,9 +101,9 @@ } if (!UtilValidate.isEmpty(items)) { - Iterator i = items.iterator(); + Iterator<GenericValue> i = items.iterator(); while (i.hasNext()) { - GenericValue v = (GenericValue) i.next(); + GenericValue v = i.next(); String itemStatus = v.getString("itemStatusId"); if (itemStatus != null) { if (!"PICKITEM_COMPLETED".equals(itemStatus)) { 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=712918&r1=712917&r2=712918&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 Mon Nov 10 18:19:19 2008 @@ -97,7 +97,7 @@ String orderId = request.getParameter("orderId"); if (UtilValidate.isNotEmpty(shipmentId) && "Y".equals(forceShipmentReceived)) { try { - Map inputMap = UtilMisc.toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_RECEIVED"); + Map<String, Object> inputMap = UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_RECEIVED"); inputMap.put("userLogin", userLogin); dispatcher.runSync("updateShipment", inputMap); } catch (GenericServiceException gse) { 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=712918&r1=712917&r2=712918&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 Mon Nov 10 18:19:19 2008 @@ -52,10 +52,10 @@ public static final int rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding"); public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); - public static Map createShipmentEstimate(DispatchContext dctx, Map context) { - Map result = FastMap.newInstance(); + public static Map<String, Object> createShipmentEstimate(DispatchContext dctx, Map<String, ? extends Object> context) { + Map<String, Object> result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); - List storeAll = FastList.newInstance(); + List<GenericValue> storeAll = FastList.newInstance(); String productStoreShipMethId = (String)context.get("productStoreShipMethId"); @@ -124,7 +124,7 @@ return result; } - public static Map removeShipmentEstimate(DispatchContext dctx, Map context) { + public static Map<String, Object> removeShipmentEstimate(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); String shipmentCostEstimateId = (String) context.get("shipmentCostEstimateId"); @@ -161,7 +161,7 @@ return ServiceUtil.returnSuccess(); } - private static boolean applyQuantityBreak(Map context, Map result, List storeAll, GenericDelegator delegator, + private static boolean applyQuantityBreak(Map context, Map<String, Object> result, List<GenericValue> storeAll, GenericDelegator delegator, GenericValue estimate, String prefix, String breakType, String breakTypeString) { Double min = (Double) context.get(prefix + "min"); Double max = (Double) context.get(prefix + "max"); @@ -203,7 +203,7 @@ } // ShippingEstimate Calc Service - public static Map calcShipmentCostEstimate(DispatchContext dctx, Map context) { + public static Map<String, Object> calcShipmentCostEstimate(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); // prepare the data @@ -215,7 +215,7 @@ String shippingPostalCode = (String) context.get("shippingPostalCode"); String shippingCountryCode = (String) context.get("shippingCountryCode"); - List shippableItemInfo = (List) context.get("shippableItemInfo"); + List<Map<String, Object>> shippableItemInfo = UtilGenerics.checkList(context.get("shippableItemInfo")); //Map shippableFeatureMap = (Map) context.get("shippableFeatureMap"); //List shippableItemSizes = (List) context.get("shippableItemSizes"); @@ -238,10 +238,10 @@ } // get the ShipmentCostEstimate(s) - Map estFields = UtilMisc.toMap("productStoreId", productStoreId, "shipmentMethodTypeId", shipmentMethodTypeId, + Map<String, String> estFields = UtilMisc.toMap("productStoreId", productStoreId, "shipmentMethodTypeId", shipmentMethodTypeId, "carrierPartyId", carrierPartyId, "carrierRoleTypeId", carrierRoleTypeId); - Collection estimates = null; + Collection<GenericValue> estimates = null; try { estimates = delegator.findByAnd("ShipmentCostEstimate", estFields); } catch (GenericEntityException e) { @@ -254,7 +254,7 @@ Debug.logWarning("No shipping estimates found; the shipping amount returned is 0!", module); } - Map respNow = ServiceUtil.returnSuccess(); + Map<String, Object> respNow = ServiceUtil.returnSuccess(); respNow.put("shippingEstimateAmount", Double.valueOf(0.00)); return respNow; } @@ -280,17 +280,17 @@ shipAddress.set("postalCodeGeoId", shippingPostalCode); } // Get the possible estimates. - List estimateList = FastList.newInstance(); - Iterator i = estimates.iterator(); + List<GenericValue> estimateList = FastList.newInstance(); + Iterator<GenericValue> i = estimates.iterator(); while (i.hasNext()) { - GenericValue thisEstimate = (GenericValue) i.next(); + GenericValue thisEstimate = i.next(); String toGeo = thisEstimate.getString("geoIdTo"); if(UtilValidate.isNotEmpty(toGeo) && shipAddress ==null){ // This estimate requires shipping address details. We don't have it so we cannot use this estimate. continue; } - List toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator); + List<GenericValue> toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator); // Make sure we have a valid GEOID. if (toGeoList == null || toGeoList.size() == 0 || GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) || @@ -382,12 +382,12 @@ } // make the shippable item size/feature objects - List shippableItemSizes = FastList.newInstance(); - Map shippableFeatureMap = FastMap.newInstance(); + List<Double> shippableItemSizes = FastList.newInstance(); + Map<String, Double> shippableFeatureMap = FastMap.newInstance(); if (shippableItemInfo != null) { - Iterator sii = shippableItemInfo.iterator(); + Iterator<Map<String, Object>> sii = shippableItemInfo.iterator(); while (sii.hasNext()) { - Map itemMap = (Map) sii.next(); + Map<String, Object> itemMap = sii.next(); // add the item sizes Double itemSize = (Double) itemMap.get("size"); @@ -397,12 +397,12 @@ // add the feature quantities Double quantity = (Double) itemMap.get("quantity"); - Set featureSet = (Set) itemMap.get("featureSet"); + Set<String> featureSet = UtilGenerics.checkSet(itemMap.get("featureSet")); if (UtilValidate.isNotEmpty(featureSet)) { - Iterator fi = featureSet.iterator(); + Iterator<String> fi = featureSet.iterator(); while (fi.hasNext()) { - String featureId = (String) fi.next(); - Double featureQuantity = (Double) shippableFeatureMap.get(featureId); + String featureId = fi.next(); + Double featureQuantity = shippableFeatureMap.get(featureId); if (featureQuantity == null) { featureQuantity = Double.valueOf(0.00); } @@ -425,11 +425,11 @@ int estimateIndex = 0; if (estimateList.size() > 1) { - TreeMap estimatePriority = new TreeMap(); + TreeMap<Integer, GenericValue> estimatePriority = new TreeMap<Integer, GenericValue>(); //int estimatePriority[] = new int[estimateList.size()]; for (int x = 0; x < estimateList.size(); x++) { - GenericValue currentEstimate = (GenericValue) estimateList.get(x); + GenericValue currentEstimate = estimateList.get(x); int prioritySum = 0; if (UtilValidate.isNotEmpty(currentEstimate.getString("partyId"))) @@ -455,7 +455,7 @@ } // Grab the estimate and work with it. - GenericValue estimate = (GenericValue) estimateList.get(estimateIndex); + GenericValue estimate = estimateList.get(estimateIndex); //Debug.log("[ShippingEvents.getShipEstimate] Working with estimate [" + estimateIndex + "]: " + estimate, module); @@ -511,14 +511,14 @@ } if (featureGroupId != null && featureGroupId.length() > 0 && shippableFeatureMap != null) { - Iterator fii = shippableFeatureMap.keySet().iterator(); + Iterator<String> fii = shippableFeatureMap.keySet().iterator(); while (fii.hasNext()) { - String featureId = (String) fii.next(); - Double quantity = (Double) shippableFeatureMap.get(featureId); + String featureId = fii.next(); + Double quantity = shippableFeatureMap.get(featureId); GenericValue appl = null; - Map fields = UtilMisc.toMap("productFeatureGroupId", featureGroupId, "productFeatureId", featureId); + Map<String, String> fields = UtilMisc.toMap("productFeatureGroupId", featureGroupId, "productFeatureId", featureId); try { - List appls = delegator.findByAndCache("ProductFeatureGroupAppl", fields); + List<GenericValue> appls = delegator.findByAndCache("ProductFeatureGroupAppl", fields); appls = EntityUtil.filterByDate(appls); appl = EntityUtil.getFirst(appls); } catch (GenericEntityException e) { @@ -537,9 +537,9 @@ Double sizePrice = estimate.getDouble("oversizePrice"); if (sizeUnit != null && sizeUnit.doubleValue() > 0) { if (shippableItemSizes != null) { - Iterator isi = shippableItemSizes.iterator(); + Iterator<Double> isi = shippableItemSizes.iterator(); while (isi.hasNext()) { - Double size = (Double) isi.next(); + Double size = isi.next(); if (size != null && size.doubleValue() >= sizeUnit.doubleValue()) { sizeSurcharge += sizePrice.doubleValue(); } @@ -562,12 +562,12 @@ double shippingTotal = subTotal + ((subTotal + initialEstimateAmt.doubleValue()) * (shippingPricePercent / 100)); // prepare the return result - Map responseResult = ServiceUtil.returnSuccess(); + Map<String, Object> responseResult = ServiceUtil.returnSuccess(); responseResult.put("shippingEstimateAmount", Double.valueOf(shippingTotal)); return responseResult; } - public static Map fillShipmentStagingTables(DispatchContext dctx, Map context) { + public static Map<String, Object> fillShipmentStagingTables(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); String shipmentId = (String) context.get("shipmentId"); @@ -597,7 +597,7 @@ return ServiceUtil.returnError("No address found for shipment!"); } - List packages = null; + List<GenericValue> packages = null; try { packages = shipment.getRelated("ShipmentPackage") ; } catch (GenericEntityException e) { @@ -609,7 +609,7 @@ return ServiceUtil.returnError("No packages are available for shipping!"); } - List routeSegs = null; + List<GenericValue> routeSegs = null; try { routeSegs = shipment.getRelated("ShipmentRouteSegment"); } catch (GenericEntityException e) { @@ -619,7 +619,7 @@ GenericValue routeSeg = EntityUtil.getFirst(routeSegs); // to store list - List toStore = FastList.newInstance(); + List<GenericValue> toStore = FastList.newInstance(); String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId"); String orderId = shipment.getString("primaryOrderId"); @@ -646,9 +646,9 @@ toStore.add(stageShip); - Iterator p = packages.iterator(); + Iterator<GenericValue> p = packages.iterator(); while (p.hasNext()) { - GenericValue shipmentPkg = (GenericValue) p.next(); + GenericValue shipmentPkg = p.next(); GenericValue stagePkg = delegator.makeValue("OdbcPackageOut"); stagePkg.set("shipmentId", shipmentPkg.get("shipmentId")); stagePkg.set("shipmentPackageSeqId", shipmentPkg.get("shipmentPackageSeqId")); @@ -672,19 +672,19 @@ return ServiceUtil.returnSuccess(); } - public static Map updateShipmentsFromStaging(DispatchContext dctx, Map context) { + public static Map<String, Object> updateShipmentsFromStaging(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); - List orderBy = UtilMisc.toList("shipmentId", "shipmentPackageSeqId", "voidIndicator"); - Map shipmentMap = FastMap.newInstance(); + List<String> orderBy = UtilMisc.toList("shipmentId", "shipmentPackageSeqId", "voidIndicator"); + Map<String, String> shipmentMap = FastMap.newInstance(); EntityListIterator eli = null; try { eli = delegator.find("OdbcPackageIn", null, null, null, orderBy, null); GenericValue pkgInfo; - while ((pkgInfo = (GenericValue) eli.next()) != null) { + while ((pkgInfo = eli.next()) != null) { String packageSeqId = pkgInfo.getString("shipmentPackageSeqId"); String shipmentId = pkgInfo.getString("shipmentId"); @@ -725,7 +725,7 @@ } } - Map pkgCtx = FastMap.newInstance(); + Map<String, Object> pkgCtx = FastMap.newInstance(); pkgCtx.put("shipmentId", shipmentId); pkgCtx.put("shipmentPackageSeqId", packageSeqId); @@ -779,7 +779,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - shipmentMap.put(shipmentId, pkgInfo.get("voidIndicator")); + shipmentMap.put(shipmentId, pkgInfo.getString("voidIndicator")); } } } catch (GenericEntityException e) { @@ -796,11 +796,11 @@ } // update the status of each shipment - Iterator i = shipmentMap.keySet().iterator(); + Iterator<String> i = shipmentMap.keySet().iterator(); while (i.hasNext()) { - String shipmentId = (String) i.next(); - String voidInd = (String) shipmentMap.get(shipmentId); - Map shipCtx = FastMap.newInstance(); + String shipmentId = i.next(); + String voidInd = shipmentMap.get(shipmentId); + Map<String, Object> shipCtx = FastMap.newInstance(); shipCtx.put("shipmentId", shipmentId); if ("Y".equals(voidInd)) { shipCtx.put("statusId", "SHIPMENT_CANCELLED"); @@ -808,7 +808,7 @@ shipCtx.put("statusId", "SHIPMENT_SHIPPED"); } shipCtx.put("userLogin", userLogin); - Map shipResp = null; + Map<String, Object> shipResp = null; try { shipResp = dispatcher.runSync("updateShipment", shipCtx); } catch (GenericServiceException e) { @@ -820,7 +820,7 @@ } // remove the shipment info - Map clearResp = null; + Map<String, Object> clearResp = null; try { clearResp = dispatcher.runSync("clearShipmentStaging", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "userLogin", userLogin)); } catch (GenericServiceException e) { @@ -835,7 +835,7 @@ return ServiceUtil.returnSuccess(); } - public static Map clearShipmentStagingInfo(DispatchContext dctx, Map context) { + public static Map<String, Object> clearShipmentStagingInfo(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); String shipmentId = (String) context.get("shipmentId"); try { @@ -856,44 +856,44 @@ * products shipped (from ShipmentAndItem) and matching them with the * products received (from ShipmentReceipt). */ - public static Map updatePurchaseShipmentFromReceipt(DispatchContext dctx, Map context) { + public static Map<String, Object> updatePurchaseShipmentFromReceipt(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String shipmentId = (String) context.get("shipmentId"); GenericValue userLogin = (GenericValue) context.get("userLogin"); try { - List shipmentReceipts = delegator.findByAnd("ShipmentReceipt", UtilMisc.toMap("shipmentId", shipmentId)); + List<GenericValue> shipmentReceipts = delegator.findByAnd("ShipmentReceipt", UtilMisc.toMap("shipmentId", shipmentId)); if (shipmentReceipts.size() == 0) return ServiceUtil.returnSuccess(); // If there are shipment receipts, the shipment must have been shipped, so set the shipment status to PURCH_SHIP_SHIPPED if it's only PURCH_SHIP_CREATED GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); if ((! UtilValidate.isEmpty(shipment)) && "PURCH_SHIP_CREATED".equals(shipment.getString("statusId"))) { - Map updateShipmentMap = dispatcher.runSync("updateShipment", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED", "userLogin", userLogin)); + Map<String, Object> updateShipmentMap = dispatcher.runSync("updateShipment", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED", "userLogin", userLogin)); if (ServiceUtil.isError(updateShipmentMap)) return updateShipmentMap; } - List shipmentAndItems = delegator.findByAnd("ShipmentAndItem", UtilMisc.toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED")); + List<GenericValue> shipmentAndItems = delegator.findByAnd("ShipmentAndItem", UtilMisc.toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED")); if (shipmentAndItems.size() == 0) return ServiceUtil.returnSuccess(); // store the quanitity of each product shipped in a hashmap keyed to productId - Map shippedCountMap = FastMap.newInstance(); - Iterator iter = shipmentAndItems.iterator(); + Map<String, Double> shippedCountMap = FastMap.newInstance(); + Iterator<GenericValue> iter = shipmentAndItems.iterator(); while (iter.hasNext()) { - GenericValue item = (GenericValue) iter.next(); + GenericValue item = iter.next(); double shippedQuantity = item.getDouble("quantity").doubleValue(); - Double quantity = (Double) shippedCountMap.get(item.getString("productId")); + Double quantity = shippedCountMap.get(item.getString("productId")); quantity = Double.valueOf(quantity == null ? shippedQuantity : shippedQuantity + quantity.doubleValue()); shippedCountMap.put(item.getString("productId"), quantity); } // store the quanitity of each product received in a hashmap keyed to productId - Map receivedCountMap = FastMap.newInstance(); + Map<String, Double> receivedCountMap = FastMap.newInstance(); iter = shipmentReceipts.iterator(); while (iter.hasNext()) { - GenericValue item = (GenericValue) iter.next(); + GenericValue item = iter.next(); double receivedQuantity = item.getDouble("quantityAccepted").doubleValue(); - Double quantity = (Double) receivedCountMap.get(item.getString("productId")); + Double quantity = receivedCountMap.get(item.getString("productId")); quantity = Double.valueOf(quantity == null ? receivedQuantity : receivedQuantity + quantity.doubleValue()); receivedCountMap.put(item.getString("productId"), quantity); } @@ -915,7 +915,7 @@ return ServiceUtil.returnSuccess("Intentional error at end to keep from committing."); } - public static Map duplicateShipmentRouteSegment(DispatchContext dctx, Map context) { + public static Map<String, Object> duplicateShipmentRouteSegment(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -923,7 +923,7 @@ String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); - Map results = ServiceUtil.returnSuccess(); + Map<String, Object> results = ServiceUtil.returnSuccess(); try { GenericValue shipmentRouteSeg = delegator.findByPrimaryKey("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId)); @@ -931,7 +931,7 @@ return ServiceUtil.returnError("Shipment Route Segment not found for shipment [" + shipmentId + "] route segment [" + shipmentRouteSegmentId + "]"); } - Map params = UtilMisc.toMap("shipmentId", shipmentId, "carrierPartyId", shipmentRouteSeg.getString("carrierPartyId"), "shipmentMethodTypeId", shipmentRouteSeg.getString("shipmentMethodTypeId"), + Map<String, Object> params = UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "carrierPartyId", shipmentRouteSeg.getString("carrierPartyId"), "shipmentMethodTypeId", shipmentRouteSeg.getString("shipmentMethodTypeId"), "originFacilityId", shipmentRouteSeg.getString("originFacilityId"), "originContactMechId", shipmentRouteSeg.getString("originContactMechId"), "originTelecomNumberId", shipmentRouteSeg.getString("originTelecomNumberId")); params.put("destFacilityId", shipmentRouteSeg.getString("destFacilityId")); @@ -941,7 +941,7 @@ params.put("billingWeightUomId", shipmentRouteSeg.get("billingWeightUomId")); params.put("userLogin", userLogin); - Map tmpResult = dispatcher.runSync("createShipmentRouteSegment", params); + Map<String, Object> tmpResult = dispatcher.runSync("createShipmentRouteSegment", params); if (ServiceUtil.isError(tmpResult)) { return tmpResult; } else { @@ -957,7 +957,7 @@ /** * Service to call a ShipmentRouteSegment.carrierPartyId's confirm shipment method asynchronously */ - public static Map quickScheduleShipmentRouteSegment(DispatchContext dctx, Map context) { + public static Map<String, Object> quickScheduleShipmentRouteSegment(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -980,7 +980,7 @@ // TODO: This may not need to be done asynchronously. The reason it's done that way right now is that calling it synchronously means that // if we can't confirm a single shipment, then all shipment route segments in a multi-form are rolled back. try { - Map input = UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId, "userLogin", userLogin); + Map<String, String> input = UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId, "userLogin", userLogin); // for DHL, we just need to confirm the shipment to get the label. Other carriers may have more elaborate requirements. if (carrierPartyId.equals("DHL")) { dispatcher.runAsync("dhlShipmentConfirm", input); @@ -1003,7 +1003,7 @@ * @param context Map * @return Map */ - public static Map getShipmentPackageValueFromOrders(DispatchContext dctx, Map context) { + public static Map<String, Object> getShipmentPackageValueFromOrders(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -1033,15 +1033,15 @@ return ServiceUtil.returnError(errorMessage); } - List packageContents = delegator.findByAnd("PackedQtyVsOrderItemQuantity", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId)); - Iterator packageContentsIt = packageContents.iterator(); + List<GenericValue> packageContents = delegator.findByAnd("PackedQtyVsOrderItemQuantity", UtilMisc.toMap("shipmentId", shipmentId, "shipmentPackageSeqId", shipmentPackageSeqId)); + Iterator<GenericValue> packageContentsIt = packageContents.iterator(); while (packageContentsIt.hasNext()) { - GenericValue packageContent = (GenericValue) packageContentsIt.next(); + GenericValue packageContent = packageContentsIt.next(); String orderId = packageContent.getString("orderId"); String orderItemSeqId = packageContent.getString("orderItemSeqId"); // Get the value of the orderItem by calling the getOrderItemInvoicedAmountAndQuantity service - Map getOrderItemValueResult = dispatcher.runSync("getOrderItemInvoicedAmountAndQuantity", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "userLogin", userLogin, "locale", locale)); + 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"); @@ -1055,7 +1055,7 @@ // Convert the value to the shipment currency, if necessary GenericValue orderHeader = packageContent.getRelatedOne("OrderHeader"); - Map convertUomResult = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", currencyUomId, "originalValue", Double.valueOf(packageContentValue.doubleValue()))); + Map<String, Object> convertUomResult = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", currencyUomId, "originalValue", Double.valueOf(packageContentValue.doubleValue()))); if (ServiceUtil.isError(convertUomResult)) return convertUomResult; if (convertUomResult.containsKey("convertedValue")) { packageContentValue = new BigDecimal(((Double) convertUomResult.get("convertedValue")).doubleValue()).setScale(decimals, rounding); @@ -1072,12 +1072,12 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - Map result = ServiceUtil.returnSuccess(); + Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("packageValue", packageTotalValue); return result; } - public static Map sendShipmentCompleteNotification(DispatchContext dctx, Map context) { + public static Map<String, Object> sendShipmentCompleteNotification(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -1086,7 +1086,7 @@ String screenUri = (String) context.get("screenUri"); // prepare the shipment information - Map sendMap = FastMap.newInstance(); + Map<String, Object> sendMap = FastMap.newInstance(); GenericValue shipment = null ; GenericValue orderHeader = null; try { @@ -1136,7 +1136,7 @@ uiLabelMap.addBottomResourceBundle("OrderUiLabels"); uiLabelMap.addBottomResourceBundle("CommonUiLabels"); - Map bodyParameters = UtilMisc.toMap("partyId", partyId, "shipmentId", shipmentId, "orderId", shipment.getString("primaryOrderId"), "userLogin", userLogin, "uiLabelMap", uiLabelMap, "locale", locale); + 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); @@ -1156,7 +1156,7 @@ sendMap.put("sendTo", emailString); } // send the notification - Map sendResp = null; + Map<String, Object> sendResp = null; try { sendResp = dispatcher.runSync("sendMailFromScreen", sendMap); } catch (Exception e) { |
Free forum by Nabble | Edit this page |