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=712911&r1=712910&r2=712911&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:12:00 2008 @@ -21,6 +21,7 @@ import java.util.*; import java.math.BigDecimal; +import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.*; @@ -52,9 +53,9 @@ public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); public static Map createShipmentEstimate(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); - List storeAll = new ArrayList(); + List storeAll = FastList.newInstance(); String productStoreShipMethId = (String)context.get("productStoreShipMethId"); @@ -279,7 +280,7 @@ shipAddress.set("postalCodeGeoId", shippingPostalCode); } // Get the possible estimates. - ArrayList estimateList = new ArrayList(); + List estimateList = FastList.newInstance(); Iterator i = estimates.iterator(); while (i.hasNext()) { @@ -381,8 +382,8 @@ } // make the shippable item size/feature objects - List shippableItemSizes = new LinkedList(); - Map shippableFeatureMap = new HashMap(); + List shippableItemSizes = FastList.newInstance(); + Map shippableFeatureMap = FastMap.newInstance(); if (shippableItemInfo != null) { Iterator sii = shippableItemInfo.iterator(); while (sii.hasNext()) { @@ -618,7 +619,7 @@ GenericValue routeSeg = EntityUtil.getFirst(routeSegs); // to store list - List toStore = new ArrayList(); + List toStore = FastList.newInstance(); String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId"); String orderId = shipment.getString("primaryOrderId"); @@ -876,7 +877,7 @@ if (shipmentAndItems.size() == 0) return ServiceUtil.returnSuccess(); // store the quanitity of each product shipped in a hashmap keyed to productId - Map shippedCountMap = new HashMap(); + Map shippedCountMap = FastMap.newInstance(); Iterator iter = shipmentAndItems.iterator(); while (iter.hasNext()) { GenericValue item = (GenericValue) iter.next(); @@ -887,7 +888,7 @@ } // store the quanitity of each product received in a hashmap keyed to productId - Map receivedCountMap = new HashMap(); + Map receivedCountMap = FastMap.newInstance(); iter = shipmentReceipts.iterator(); while (iter.hasNext()) { GenericValue item = (GenericValue) iter.next(); 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=712911&r1=712910&r2=712911&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 Mon Nov 10 18:12:00 2008 @@ -20,16 +20,16 @@ import java.io.IOException; import java.io.StringWriter; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import javax.xml.parsers.ParserConfigurationException; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.ofbiz.base.util.Base64; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; @@ -230,7 +230,7 @@ return ServiceUtil.returnError("Cannot get DHL Estimate: DHL Rate template not configured (shipment.template.dhl.rate.estimate"); } StringWriter outWriter = new StringWriter(); - Map inContext = new HashMap(); + Map inContext = FastMap.newInstance(); inContext.put("action", "RateEstimate"); inContext.put("userid", userid); inContext.put("password", password); @@ -297,8 +297,8 @@ * Parses an XML document from DHL to get the rate estimate */ public static Map handleDhlRateResponse(Document rateResponseDocument) { - List errorList = new LinkedList(); - Map dhlRateCodeMap = new HashMap(); + List errorList = FastList.newInstance(); + Map dhlRateCodeMap = FastMap.newInstance(); // process RateResponse Element rateResponseElement = rateResponseDocument.getDocumentElement(); DhlServices.handleErrors(rateResponseElement, errorList); @@ -341,10 +341,10 @@ List chargeNodeList = UtilXml.childElementList(responseChargesElement, "Charge"); - List chargeList = new ArrayList(); + List chargeList = FastList.newInstance(); if (UtilValidate.isNotEmpty(chargeNodeList)) { for (int i = 0; chargeNodeList.size() > i; i++) { - Map charge = new HashMap(); + Map charge = FastMap.newInstance(); Element responseChargeElement = (Element) chargeNodeList.get(i); Element responseChargeTypeElement = UtilXml.firstChildElement( @@ -381,7 +381,7 @@ */ public static Map dhlRegisterInquire(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); String postalCode = (String) context.get("postalCode"); String accountNbr = UtilProperties.getPropertyValue("shipment", "shipment.dhl.access.accountNbr"); @@ -457,7 +457,7 @@ */ public static Map handleDhlRegisterResponse( Document registerResponseDocument) { - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); // process RegisterResponse Element registerResponseElement = registerResponseDocument .getDocumentElement(); @@ -502,7 +502,7 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); - Map result = new HashMap(); + Map result = FastMap.newInstance(); String shipmentConfirmResponseString = null; try { GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); @@ -705,7 +705,7 @@ return ServiceUtil.returnError("Cannot get DHL Estimate: DHL Rate template not configured (shipment.template.dhl.rate.estimate"); } StringWriter outWriter = new StringWriter(); - Map inContext = new HashMap(); + Map inContext = FastMap.newInstance(); inContext.put("action", "GenerateLabel"); inContext.put("userid", userid); inContext.put("password", password); @@ -776,7 +776,7 @@ // NOTE: Must VOID shipments on errors public static Map handleDhlShipmentConfirmResponse(String rateResponseString, GenericValue shipmentRouteSegment, List shipmentPackageRouteSegs) throws GenericEntityException { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericValue shipmentPackageRouteSeg = (GenericValue) shipmentPackageRouteSegs.get(0); // TODO: figure out how to handle validation on return XML, which can be mangled 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=712911&r1=712910&r2=712911&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 Mon Nov 10 18:12:00 2008 @@ -23,8 +23,6 @@ import java.io.StringWriter; import java.math.BigDecimal; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -32,6 +30,9 @@ import javax.xml.parsers.ParserConfigurationException; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.ofbiz.base.util.Base64; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; @@ -136,7 +137,7 @@ */ public static Map fedexSubscriptionRequest( DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); - List errorList = new ArrayList(); + List errorList = FastList.newInstance(); Boolean replaceMeterNumber = (Boolean) context.get("replaceMeterNumber"); @@ -150,7 +151,7 @@ String companyPartyId = (String) context.get("companyPartyId"); String contactPartyName = (String) context.get("contactPartyName"); - Map result = new HashMap(); + Map result = FastMap.newInstance(); String accountNumber = UtilProperties.getPropertyValue(shipmentPropertiesFile, "shipment.fedex.access.accountNbr"); if (UtilValidate.isEmpty(accountNumber)) { @@ -190,7 +191,7 @@ partyContactDetails = EntityUtil.filterByDate(partyContactDetails, UtilDateTime.nowTimestamp(), "purposeFromDate", "purposeThruDate", true); // Get the first valid postal address (address1, city, postalCode and countryGeoId are required by Fedex) - List postalAddressConditions = new ArrayList(); + List postalAddressConditions = FastList.newInstance(); postalAddressConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "POSTAL_ADDRESS")); postalAddressConditions.add(EntityCondition.makeCondition("address1", EntityOperator.NOT_EQUAL, null)); postalAddressConditions.add(EntityCondition.makeCondition("address1", EntityOperator.NOT_EQUAL, "")); @@ -228,7 +229,7 @@ } // Get the first valid primary phone number (required by Fedex) - List phoneNumberConditions = new ArrayList(); + List phoneNumberConditions = FastList.newInstance(); phoneNumberConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "TELECOM_NUMBER")); phoneNumberConditions.add(EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.EQUALS, "PRIMARY_PHONE")); phoneNumberConditions.add(EntityCondition.makeCondition("areaCode", EntityOperator.NOT_EQUAL, null)); @@ -250,7 +251,7 @@ phoneNumber = phoneNumber.replaceAll("[^+\\d]", ""); // Get the first valid fax number - List faxNumberConditions = new ArrayList(); + List faxNumberConditions = FastList.newInstance(); faxNumberConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "TELECOM_NUMBER")); faxNumberConditions.add(EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.EQUALS, "FAX_NUMBER")); faxNumberConditions.add(EntityCondition.makeCondition("areaCode", EntityOperator.NOT_EQUAL, null)); @@ -269,7 +270,7 @@ } // Get the first valid email address - List emailConditions = new ArrayList(); + List emailConditions = FastList.newInstance(); emailConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "EMAIL_ADDRESS")); emailConditions.add(EntityCondition.makeCondition("infoString", EntityOperator.NOT_EQUAL, null)); emailConditions.add(EntityCondition.makeCondition("infoString", EntityOperator.NOT_EQUAL, "")); @@ -286,7 +287,7 @@ } // Populate the Freemarker context - Map subscriptionRequestContext = new HashMap(); + Map subscriptionRequestContext = FastMap.newInstance(); subscriptionRequestContext.put("AccountNumber", accountNumber); subscriptionRequestContext.put("PersonName", contactPartyName); subscriptionRequestContext.put("CompanyName", companyName); @@ -430,7 +431,7 @@ try { - Map shipRequestContext = new HashMap(); + Map shipRequestContext = FastMap.newInstance(); // Get the shipment and the shipmentRouteSegment GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); @@ -865,7 +866,7 @@ * @throws GenericEntityException */ public static Map handleFedexShipReply(String fDXShipReplyString, GenericValue shipmentRouteSegment, List shipmentPackageRouteSegs) throws GenericEntityException { - List errorList = new ArrayList(); + List errorList = FastList.newInstance(); GenericValue shipmentPackageRouteSeg = (GenericValue) shipmentPackageRouteSegs.get(0); Document fdxShipReplyDocument = null; Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?rev=712911&r1=712910&r2=712911&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Mon Nov 10 18:12:00 2008 @@ -22,9 +22,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.math.BigDecimal; -import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Locale; @@ -34,6 +32,9 @@ import javax.xml.parsers.ParserConfigurationException; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.ofbiz.base.util.Base64; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; @@ -68,8 +69,8 @@ public final static String module = UpsServices.class.getName(); - public static Map unitsUpsToOfbiz = new HashMap(); - public static Map unitsOfbizToUps = new HashMap(); + public static Map unitsUpsToOfbiz = FastMap.newInstance(); + public static Map unitsOfbizToUps = FastMap.newInstance(); static { unitsUpsToOfbiz.put("LBS", "WT_lb"); unitsUpsToOfbiz.put("KGS", "WT_kg"); @@ -84,7 +85,7 @@ public static final int rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding"); public static Map upsShipmentConfirm(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -617,7 +618,7 @@ String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); String responseStatusDescription = UtilXml.childElementValue(responseElement, "ResponseStatusDescription"); - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); UpsServices.handleErrors(responseElement, errorList); if ("1".equals(responseStatusCode)) { @@ -716,7 +717,7 @@ } public static Map upsShipmentAccept(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); @@ -878,7 +879,7 @@ String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); String responseStatusDescription = UtilXml.childElementValue(responseElement, "ResponseStatusDescription"); - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); UpsServices.handleErrors(responseElement, errorList); if ("1".equals(responseStatusCode)) { @@ -1083,7 +1084,7 @@ } public static Map upsVoidShipment(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); @@ -1230,7 +1231,7 @@ String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); String responseStatusDescription = UtilXml.childElementValue(responseElement, "ResponseStatusDescription"); - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); UpsServices.handleErrors(responseElement, errorList); // handle other response elements @@ -1271,7 +1272,7 @@ } public static Map upsTrackShipment(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); @@ -1421,7 +1422,7 @@ String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); String responseStatusDescription = UtilXml.childElementValue(responseElement, "ResponseStatusDescription"); - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); UpsServices.handleErrors(responseElement, errorList); if ("1".equals(responseStatusCode)) { @@ -1629,7 +1630,7 @@ private static List getPackageSplit(List shippableItemInfo, double maxWeight) { // create the package list w/ the first package - List packages = new LinkedList(); + List packages = FastList.newInstance(); if (shippableItemInfo != null) { Iterator sii = shippableItemInfo.iterator(); @@ -1650,17 +1651,17 @@ double partialQty = pieces > 1 ? 1.000 / pieces : 1; for (long x = 0; x < pieces; x++) { if(itemInfo.get("inShippingBox") != null && ((String) itemInfo.get("inShippingBox")).equalsIgnoreCase("Y")) { - Map newPackage = new HashMap(); + Map newPackage = FastMap.newInstance(); newPackage.put(productId, new Double(partialQty)); packages.add(newPackage); } else if (weight >= maxWeight) { - Map newPackage = new HashMap(); + Map newPackage = FastMap.newInstance(); newPackage.put(productId, new Double(partialQty)); packages.add(newPackage); } else if (totalWeight > 0) { // create the first package if (packages.size() == 0) { - packages.add(new HashMap()); + packages.add(FastMap.newInstance()); } // package loop @@ -1679,7 +1680,7 @@ } } if (!addedToPackage) { - Map packageMap = new HashMap(); + Map packageMap = FastMap.newInstance(); packageMap.put(productId, new Double(partialQty)); packages.add(packageMap); } @@ -1730,12 +1731,12 @@ String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); String responseStatusDescription = UtilXml.childElementValue(responseElement, "ResponseStatusDescription"); - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); UpsServices.handleErrors(responseElement, errorList); if ("1".equals(responseStatusCode)) { List rates = UtilXml.childElementList(rateResponseElement, "RatedShipment"); - Map rateMap = new HashMap(); + Map rateMap = FastMap.newInstance(); Double firstRate = null; if (rates == null || rates.size() == 0) { return ServiceUtil.returnError("No rates available at this time"); @@ -2221,11 +2222,11 @@ Element responseElement = UtilXml.firstChildElement(avResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = FastList.newInstance(); UpsServices.handleErrors(responseElement, errorList); if ("1".equals(responseStatusCode)) { - List matches = new LinkedList(); + List matches = FastList.newInstance(); List avResultList = UtilXml.childElementList(avResponseElement, "AddressValidationResult"); // TODO: return error if there are no matches? @@ -2234,7 +2235,7 @@ while (i.hasNext()) { Element avResultElement = (Element) i.next(); - Map match = new HashMap(); + Map match = FastMap.newInstance(); match.put("Rank", UtilXml.childElementValue(avResultElement, "Rank")); match.put("Quality", UtilXml.childElementValue(avResultElement, "Quality")); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=712911&r1=712910&r2=712911&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java Mon Nov 10 18:12:00 2008 @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; import javolution.util.FastList; +import javolution.util.FastMap; import org.ofbiz.base.util.*; import org.ofbiz.entity.GenericDelegator; @@ -239,13 +240,13 @@ double partialQty = pieces > 1 ? 1.000 / pieces : 1; for (long x = 0; x < pieces; x++) { if (weight >= maxWeight) { - Map newPackage = new HashMap(); + Map newPackage = FastMap.newInstance(); newPackage.put(productId, new Double(partialQty)); packages.add(newPackage); } else if (totalWeight > 0) { // create the first package if (packages.size() == 0) { - packages.add(new HashMap()); + packages.add(FastMap.newInstance()); } // package loop @@ -264,7 +265,7 @@ } } if (!addedToPackage) { - Map packageMap = new HashMap(); + Map packageMap = FastMap.newInstance(); packageMap.put(productId, new Double(partialQty)); packages.add(packageMap); } @@ -304,7 +305,7 @@ } if (!"WT_lb".equals(weightUomId)) { // attempt a conversion to pounds - Map result = new HashMap(); + Map result = FastMap.newInstance(); try { result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", new Double(productWeight))); } catch (GenericServiceException ex) { @@ -387,7 +388,7 @@ List detailElementList = UtilXml.childElementList(trackInfoElement, "TrackDetail"); if (UtilValidate.isNotEmpty(detailElementList)) { - List trackingDetailList = new ArrayList(); + List trackingDetailList = FastList.newInstance(); for (Iterator iter = detailElementList.iterator(); iter.hasNext();) { trackingDetailList.add(UtilXml.elementValue((Element) iter.next())); } @@ -914,7 +915,7 @@ } if (!"WT_lb".equals(weightUomId)) { // attempt a conversion to pounds - Map result = new HashMap(); + Map result = FastMap.newInstance(); try { result = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", new Double(weight))); } catch (GenericServiceException ex) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java?rev=712911&r1=712910&r2=712911&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java Mon Nov 10 18:12:00 2008 @@ -21,7 +21,8 @@ import java.util.List; import java.util.Map; -import java.util.HashMap; + +import javolution.util.FastMap; import junit.framework.TestCase; import org.ofbiz.base.util.Debug; @@ -176,7 +177,7 @@ public void testUspsDomesticRate() throws Exception { // prepare the context - Map context = new HashMap(); + Map context = FastMap.newInstance(); context.put("service", "Priority"); context.put("originZip", "20770"); |
Free forum by Nabble | Edit this page |