This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 2d01d72 Improved: Corrected all checkstyle formatting issues: Line has trailing spaces in applications component. (OFBIZ-11880) Thanks Jacques for review. new 2b63a8b Merge branch 'trunk' of https://gitbox.apache.org/repos/asf/ofbiz-framework into trunk 2d01d72 is described below commit 2d01d722e6b1d19507149c2e17af4706702771a0 Author: Suraj Khurana <[hidden email]> AuthorDate: Mon Jul 13 14:15:34 2020 +0530 Improved: Corrected all checkstyle formatting issues: Line has trailing spaces in applications component. (OFBIZ-11880) Thanks Jacques for review. --- .../ofbiz/accounting/invoice/InvoiceServices.java | 17 +-- .../ofbiz/accounting/invoice/InvoiceWorker.java | 4 +- .../accounting/payment/BillingAccountWorker.java | 6 +- .../payment/GiftCertificateServices.java | 4 - .../accounting/payment/PaymentGatewayServices.java | 12 +- .../ofbiz/accounting/tax/TaxAuthorityServices.java | 9 +- .../authorizedotnet/AIMPaymentServices.java | 24 ++-- .../thirdparty/clearcommerce/CCServicesTest.java | 3 +- .../thirdparty/cybersource/IcsPaymentServices.java | 8 +- .../accounting/thirdparty/eway/EwayServices.java | 8 +- .../accounting/thirdparty/paypal/PayPalEvents.java | 4 +- .../thirdparty/paypal/PayPalServices.java | 2 +- .../securepay/SecurePayPaymentServices.java | 10 +- .../thirdparty/securepay/SecurePayServiceTest.java | 38 ++--- .../thirdparty/valuelink/ValueLinkServices.java | 12 +- .../accounting/thirdparty/verisign/PayflowPro.java | 46 +++--- .../thirdparty/worldpay/WorldPayEvents.java | 9 +- .../ofbiz/accounting/util/UtilAccounting.java | 2 +- .../ofbiz/content/ContentManagementServices.java | 20 +-- .../java/org/apache/ofbiz/content/ConvertTree.java | 38 ++--- .../org/apache/ofbiz/content/cms/CmsEvents.java | 2 +- .../ofbiz/content/compdoc/CompDocEvents.java | 2 +- .../ofbiz/content/compdoc/CompDocServices.java | 6 +- .../ofbiz/content/content/ContentEvents.java | 10 +- .../ofbiz/content/content/ContentKeywordIndex.java | 2 +- .../ofbiz/content/content/ContentMapFacade.java | 12 +- .../ofbiz/content/content/ContentSearch.java | 4 +- .../content/content/ContentSearchSession.java | 2 +- .../ofbiz/content/content/ContentServices.java | 8 +- .../content/content/ContentServicesComplex.java | 2 +- .../ofbiz/content/content/ContentUrlFilter.java | 4 +- .../ofbiz/content/content/ContentWorker.java | 6 +- .../content/content/UploadContentAndImage.java | 7 +- .../apache/ofbiz/content/data/DataServices.java | 4 +- .../apache/ofbiz/content/layout/LayoutWorker.java | 2 +- .../ofbiz/content/output/OutputServices.java | 4 +- .../ofbiz/content/survey/PdfSurveyServices.java | 6 +- .../webapp/ftl/LoopSubContentTransform.java | 2 +- .../webapp/ftl/WrapSubContentCacheTransform.java | 4 +- .../org/apache/ofbiz/humanres/HumanResEvents.java | 4 +- .../apache/ofbiz/manufacturing/bom/BOMHelper.java | 8 +- .../apache/ofbiz/manufacturing/bom/BOMNode.java | 2 +- .../ofbiz/manufacturing/bom/BOMServices.java | 18 +-- .../apache/ofbiz/manufacturing/bom/BOMTree.java | 2 +- .../manufacturing/jobshopmgt/ProductionRun.java | 6 +- .../jobshopmgt/ProductionRunEvents.java | 6 +- .../jobshopmgt/ProductionRunHelper.java | 5 +- .../jobshopmgt/ProductionRunServices.java | 65 +++++---- .../mrp/InventoryEventPlannedServices.java | 2 +- .../ofbiz/manufacturing/mrp/MrpServices.java | 19 ++- .../ofbiz/manufacturing/mrp/ProposedOrder.java | 6 +- .../manufacturing/techdata/TechDataServices.java | 16 +-- .../ofbiz/order/order/OrderReturnServices.java | 8 +- .../apache/ofbiz/order/order/OrderServices.java | 46 +++--- .../apache/ofbiz/order/quote/QuoteServices.java | 2 +- .../ofbiz/order/shoppingcart/CheckOutEvents.java | 6 +- .../ofbiz/order/shoppingcart/CheckOutHelper.java | 60 ++++---- .../ofbiz/order/shoppingcart/ShoppingCart.java | 11 +- .../order/shoppingcart/ShoppingCartEvents.java | 26 ++-- .../order/shoppingcart/ShoppingCartHelper.java | 30 ++-- .../ofbiz/order/shoppingcart/ShoppingCartItem.java | 8 +- .../order/shoppingcart/ShoppingCartServices.java | 4 +- .../shoppingcart/product/ProductPromoWorker.java | 18 ++- .../shoppingcart/shipping/ShippingEvents.java | 3 +- .../order/shoppinglist/ShoppingListEvents.java | 30 ++-- .../order/shoppinglist/ShoppingListServices.java | 18 +-- .../org/apache/ofbiz/order/task/TaskEvents.java | 8 +- .../apache/ofbiz/order/test/PurchaseOrderTest.java | 2 +- .../order/thirdparty/taxware/TaxwareServices.java | 2 +- .../thirdparty/zipsales/ZipSalesServices.java | 18 +-- .../communication/CommunicationEventServices.java | 8 +- .../ofbiz/party/content/PartyContentWrapper.java | 4 +- .../ofbiz/product/catalog/CatalogWorker.java | 2 +- .../ofbiz/product/category/CatalogUrlFilter.java | 31 ++-- .../product/category/CategoryContentWrapper.java | 2 +- .../ofbiz/product/category/CategoryServices.java | 16 +-- .../ofbiz/product/category/CategoryWorker.java | 11 +- .../ofbiz/product/category/SeoConfigUtil.java | 32 +---- .../ofbiz/product/category/SeoControlServlet.java | 3 +- .../ofbiz/product/config/ProductConfigWorker.java | 2 +- .../ofbiz/product/feature/ParametricSearch.java | 2 +- .../product/feature/ProductFeatureServices.java | 2 +- .../org/apache/ofbiz/product/image/ScaleImage.java | 14 +- .../ofbiz/product/imagemanagement/CropImage.java | 2 +- .../ofbiz/product/imagemanagement/FrameImage.java | 2 +- .../imagemanagement/ImageManagementServices.java | 6 +- .../product/imagemanagement/ReplaceImage.java | 2 +- .../ofbiz/product/imagemanagement/RotateImage.java | 2 +- .../ofbiz/product/inventory/InventoryServices.java | 4 +- .../apache/ofbiz/product/price/PriceServices.java | 12 +- .../ofbiz/product/product/ProductEvents.java | 42 +++--- .../ofbiz/product/product/ProductSearchEvents.java | 38 ++--- .../ofbiz/product/product/ProductServices.java | 6 +- .../ofbiz/product/product/ProductUtilServices.java | 24 ++-- .../ofbiz/product/product/ProductWorker.java | 8 +- .../ofbiz/product/product/VariantEvents.java | 16 +-- .../ofbiz/product/store/ProductStoreWorker.java | 2 +- .../product/subscription/SubscriptionServices.java | 4 +- .../apache/ofbiz/product/test/StockMovesTest.java | 2 +- .../ofbiz/shipment/packing/PackingServices.java | 1 - .../ofbiz/shipment/shipment/ShipmentServices.java | 8 +- .../apache/ofbiz/shipment/test/IssuanceTest.java | 6 +- .../ofbiz/shipment/thirdparty/dhl/DhlServices.java | 39 +++-- .../shipment/thirdparty/fedex/FedexServices.java | 88 ++++++------ .../ofbiz/shipment/thirdparty/ups/UpsServices.java | 159 ++++++++++----------- .../shipment/thirdparty/usps/UspsServices.java | 120 ++++++++-------- .../ofbiz/securityext/login/LoginEvents.java | 1 - .../workeffort/workeffort/WorkEffortSearch.java | 6 +- 108 files changed, 735 insertions(+), 818 deletions(-) diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java index 05e6e5e..344de9a 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java @@ -615,7 +615,7 @@ public class InvoiceServices { amount = adj.getBigDecimal("amount").divide(originalOrderItemQuantity, 100, ROUNDING); amount = amount.multiply(billingQuantity); } - } + } // Tax needs to be rounded differently from other order adjustments if ("SALES_TAX".equals(adj.getString("orderAdjustmentTypeId"))) { amount = amount.setScale(TAX_DECIMALS, TAX_ROUNDING); @@ -1199,7 +1199,7 @@ public class InvoiceServices { // Either no orderShipment exists, or there's a null invoicePerShipment in the OrderHeader. // In either case, use the default value from the properties if (invoicePerShipment == null) { - invoicePerShipment = EntityUtilProperties.getPropertyValue("accounting","create.invoice.per.shipment", delegator); + invoicePerShipment = EntityUtilProperties.getPropertyValue("accounting", "create.invoice.per.shipment", delegator); } if ("Y".equals(invoicePerShipment)) { @@ -2570,7 +2570,7 @@ public class InvoiceServices { */ public static Map<String, Object> updatePaymentApplication(DispatchContext dctx, Map<String, Object> context) { if (!context.containsKey("useHighestAmount")) { - context.put("useHighestAmount","N"); + context.put("useHighestAmount", "N"); } BigDecimal amountApplied = (BigDecimal) context.get("amountApplied"); if (amountApplied != null) { @@ -2592,7 +2592,7 @@ public class InvoiceServices { */ public static Map<String, Object> updatePaymentApplicationDef(DispatchContext dctx, Map<String, Object> context) { if (!context.containsKey("useHighestAmount")) { - context.put("useHighestAmount","Y"); + context.put("useHighestAmount", "Y"); } return updatePaymentApplication(dctx, context); } @@ -2607,10 +2607,10 @@ public class InvoiceServices { } if (!context.containsKey("useHighestAmount")) { - context.put("useHighestAmount","Y"); + context.put("useHighestAmount", "Y"); } - String defaultInvoiceProcessing = EntityUtilProperties.getPropertyValue("accounting","invoiceProcessing", delegator); + String defaultInvoiceProcessing = EntityUtilProperties.getPropertyValue("accounting", "invoiceProcessing", delegator); boolean debug = true; // show processing messages in the log..or not.... @@ -2965,7 +2965,7 @@ public class InvoiceServices { errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentLessRequested", UtilMisc.<String, Object>toMap("paymentId", paymentId, "paymentApplyAvailable", paymentApplyAvailable, - "amountApplied", amountApplied,"isoCode", currencyUomId), locale)); + "amountApplied", amountApplied, "isoCode", currencyUomId), locale)); } } } @@ -3537,18 +3537,15 @@ public class InvoiceServices { return ServiceUtil.returnError(se.getMessage()); } } - public static Map<String, Object> importInvoice(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); ByteBuffer fileBytes = (ByteBuffer) context.get("uploadedFile"); - if (fileBytes == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingUploadedFileDataNotFound", locale)); } - String organizationPartyId = (String) context.get("organizationPartyId"); String encoding = System.getProperty("file.encoding"); String csvString = Charset.forName(encoding).decode(fileBytes).toString(); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java index 229190f..a5e9353 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java @@ -543,7 +543,7 @@ public final class InvoiceWorker { GenericValue invoiceItem = null; try { - invoiceItem = EntityQuery.use(delegator).from("Invoice").where("invoiceId", invoiceId,"invoiceItemSeqId", invoiceItemSeqId).queryOne(); + invoiceItem = EntityQuery.use(delegator).from("Invoice").where("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting InvoiceItem", MODULE); } @@ -688,7 +688,7 @@ public final class InvoiceWorker { invoiceItems = null; } if (UtilValidate.isNotEmpty(invoiceItems)) { - invoiceItems = EntityUtil.orderBy(invoiceItems, UtilMisc.toList("taxAuthGeoId","taxAuthPartyId")); + invoiceItems = EntityUtil.orderBy(invoiceItems, UtilMisc.toList("taxAuthGeoId", "taxAuthPartyId")); // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeoId and taxAuthPartyId in invoiceItems. List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(invoiceItems, "taxAuthGeoId", true); List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(invoiceItems, "taxAuthPartyId", true); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java index 97c114e..4ca1175 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java @@ -21,7 +21,6 @@ package org.apache.ofbiz.accounting.payment; import java.io.Serializable; import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; @@ -171,7 +170,7 @@ public final class BillingAccountWorker { * Returns the amount of the billing account which could be captured, which is BillingAccount.accountLimit - net balance * @param billingAccount GenericValue object of the billing account * @return the amount of the billing account which could be captured - * @throws GenericEntityException + * @throws GenericEntityException */ public static BigDecimal availableToCapture(GenericValue billingAccount) throws GenericEntityException { BigDecimal netBalance = getBillingAccountNetBalance(billingAccount.getDelegator(), billingAccount.getString("billingAccountId")); @@ -208,12 +207,11 @@ public final class BillingAccountWorker { UtilMisc.toMap("billingAccountId", billingAccountId), locale)); } } - @SuppressWarnings("serial") protected static class BillingAccountComparator implements Comparator<Map<String, Object>>, Serializable { @Override public int compare(Map<String, Object> billingAccount1, Map<String, Object> billingAccount2) { - return ((BigDecimal)billingAccount1.get("accountBalance")).compareTo((BigDecimal)billingAccount2.get("accountBalance")); + return ((BigDecimal) billingAccount1.get("accountBalance")).compareTo((BigDecimal) billingAccount2.get("accountBalance")); } } } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java index a91112c..caa759c 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java @@ -114,7 +114,6 @@ public class GiftCertificateServices { if (ServiceUtil.isError(acctResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(acctResult)); } - } else { Map<String, Object> createAccountCtx = new HashMap<>(); createAccountCtx.put("ownerPartyId", partyId); @@ -619,7 +618,6 @@ public class GiftCertificateServices { BigDecimal amount, String currency, String resultPrefix, Locale locale) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); - // get the orderId for tracking String orderId = paymentPref.getString("orderId"); OrderReadHelper orh = new OrderReadHelper(delegator, orderId); @@ -1236,9 +1234,7 @@ public class GiftCertificateServices { if (ServiceUtil.isError(returnHeaderResp)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(returnHeaderResp)); } - String returnId = (String) returnHeaderResp.get("returnId"); - if (UtilValidate.isEmpty(returnId)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorCreateReturnHeaderWithoutId", locale)); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java index fe72185..8287bd4 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java @@ -973,7 +973,7 @@ public class PaymentGatewayServices { try { releaseResult = dispatcher.runSync(serviceName, releaseContext, TX_TIME, true); } catch (GenericServiceException e) { - Debug.logError(e,"Problem releasing payment", MODULE); + Debug.logError(e, "Problem releasing payment", MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale)); } @@ -1841,7 +1841,6 @@ public class PaymentGatewayServices { String currencyUomId = (String) context.get("currencyUomId"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); Locale locale = (Locale) context.get("locale"); - if (authResult == null) { Debug.logError("No authentification result available. Payment preference can't be checked.", MODULE); return ServiceUtil @@ -1933,7 +1932,7 @@ public class PaymentGatewayServices { // set the status of the OrderPaymentPreference boolean authResultOk = authResult; - + if (authResultOk) { orderPaymentPreference.set("statusId", "PAYMENT_AUTHORIZED"); } else { @@ -2582,7 +2581,7 @@ public class PaymentGatewayServices { return result; } else { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "AccountingPaymentRefundError", locale)); + "AccountingPaymentRefundError", locale)); } } @@ -2703,7 +2702,6 @@ public class PaymentGatewayServices { .where(EntityCondition.makeCondition("needsNsfRetry", EntityOperator.EQUALS, "Y"), EntityCondition.makeCondition(ModelEntity.STAMP_FIELD, EntityOperator.LESS_THAN_EQUAL_TO, oneWeekAgo)) .orderBy("orderId"); - try (EntityListIterator eli = eq.queryIterator()) { List<String> processList = new LinkedList<>(); if (eli != null) { @@ -3101,7 +3099,7 @@ public class PaymentGatewayServices { orderPaymentPreferenceId, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + - orderPaymentPreferenceId); + orderPaymentPreferenceId); } // Get the OrderHeader GenericValue orderHeader = null; @@ -3667,7 +3665,6 @@ public class PaymentGatewayServices { result.put("refundRefNum", UtilDateTime.nowAsString()); result.put("refundFlag", "R"); result.put("refundMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestRefund", locale)); - return result; } @@ -3681,7 +3678,6 @@ public class PaymentGatewayServices { result.put("refundRefNum", UtilDateTime.nowAsString()); result.put("refundFlag", "R"); result.put("refundMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestRefundFailure", locale)); - return result; } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java index 9cc596b..ed08312 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/tax/TaxAuthorityServices.java @@ -255,16 +255,16 @@ public class TaxAuthorityServices { BigDecimal itemPrice = itemPriceList.get(i); BigDecimal itemQuantity = itemQuantityList != null ? itemQuantityList.get(i) : null; BigDecimal shippingAmount = itemShippingList != null ? itemShippingList.get(i) : null; - + totalPrice = totalPrice.add(itemAmount); - + List<GenericValue> taxList = getTaxAdjustments(delegator, product, productStore, payToPartyId, billToPartyId, taxAuthoritySet, itemPrice, itemQuantity, itemAmount, shippingAmount, ZERO_BASE); // this is an add and not an addAll because we want a List of Lists of // GenericValues, one List of Adjustments per item itemAdjustments.add(taxList); - + //Calculates the TotalPrices for each Product in the Order BigDecimal currentTotalPrice = productWeight.getOrDefault(product, BigDecimal.ZERO); currentTotalPrice = currentTotalPrice.add(itemAmount); @@ -348,11 +348,10 @@ public class TaxAuthorityServices { BigDecimal shippingAmount, BigDecimal orderPromotionsAmount, BigDecimal weight) { Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); List<GenericValue> adjustments = new LinkedList<>(); - if (weight == null) { weight = BigDecimal.ONE; } - + if (payToPartyId == null) { if (productStore != null) { payToPartyId = productStore.getString("payToPartyId"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java index 0b2ed5a..9986c1a 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java @@ -128,14 +128,14 @@ public class AIMPaymentServices { buildGatewayResponeConfig(context, props, request); buildCustomerBillingInfo(context, props, request); buildEmailSettings(context, props, request); - request.put("x_Invoice_Num","Order " + orderPaymentPreference.getString("orderId")); + request.put("x_Invoice_Num", "Order " + orderPaymentPreference.getString("orderId")); // PRIOR_AUTH_CAPTURE is the right one to use, since we already have an authorization from the authTransaction. // CAPTURE_ONLY is a "force" transaction to be used if there is no prior authorization props.put("transType", "PRIOR_AUTH_CAPTURE"); props.put("cardtype", creditCard.get("cardType")); buildCaptureTransaction(context, props, request); Map<String, Object> validateResults = validateRequest(context, props, request); - String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); + String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; @@ -229,7 +229,7 @@ public class AIMPaymentServices { // TODO: Modify the code to (a) do a void of the whole transaction, and (b) // create a new auth-capture of the difference. return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "AccountingAuthorizeNetCannotPerformVoidTransaction", + "AccountingAuthorizeNetCannotPerformVoidTransaction", UtilMisc.toMap("authAmount", authAmount, "refundAmount", refundAmount), locale)); } } @@ -298,7 +298,7 @@ public class AIMPaymentServices { props.put("transType", "AUTH_CAPTURE"); buildAuthTransaction(context, props, request); Map<String, Object> validateResults = validateRequest(context, props, request); - String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); + String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; @@ -325,18 +325,18 @@ public class AIMPaymentServices { Debug.logInfo("TEST Authorize.net request string " + request.toString(), MODULE); Debug.logInfo("TEST Authorize.net properties string " + props.toString(), MODULE); } - + // card present has a different layout from standard AIM; this determines how to parse the response int apiType = UtilValidate.isEmpty(props.get("cpMarketType")) ? AuthorizeResponse.AIM_RESPONSE : AuthorizeResponse.CP_RESPONSE; - + try { HttpClient httpClient = new HttpClient(url, request); String certificateAlias = props.getProperty("certificateAlias"); httpClient.setClientCertificateAlias(certificateAlias); String httpResponse = httpClient.post(); Debug.logInfo("transaction response: " + httpResponse, MODULE); - AuthorizeResponse ar = new AuthorizeResponse(httpResponse, apiType); - if (ar.isApproved()) { + AuthorizeResponse ar = new AuthorizeResponse(httpResponse, apiType); + if (ar.isApproved()) { result.put("authResult", Boolean.TRUE); } //When the transaction is already expired in Authorize.net, then the response is an error message with reason code 16 (i.e. "The transaction cannot be found"); @@ -372,7 +372,7 @@ public class AIMPaymentServices { if (configStr == null) { configStr = "payment.properties"; } - GenericValue cc = (GenericValue)context.get("creditCard"); + GenericValue cc = (GenericValue) context.get("creditCard"); String url = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transactionUrl", configStr, "payment.authorizedotnet.url"); String certificateAlias = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "certificateAlias", configStr, "payment.authorizedotnet.certificateAlias"); String ver = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "apiVersion", configStr, "payment.authorizedotnet.version"); @@ -390,7 +390,7 @@ public class AIMPaymentServices { String login = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "userId", configStr, "payment.authorizedotnet.login"); String password = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", configStr, "payment.authorizedotnet.password"); String transDescription = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transDescription", configStr, "payment.authorizedotnet.transdescription"); - String duplicateWindow = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "duplicateWindow", configStr, "payment.authorizedotnet.duplicateWindow"); + String duplicateWindow = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "duplicateWindow", configStr, "payment.authorizedotnet.duplicateWindow"); if (UtilValidate.isEmpty(ver)) { ver = "3.0"; } @@ -409,7 +409,7 @@ public class AIMPaymentServices { if (UtilValidate.isNotEmpty(cpMarketType) && UtilValidate.isEmpty(cpVersion)) { cpVersion = "1.0"; } - + Properties props = new Properties(); props.put("url", url); props.put("certificateAlias", certificateAlias); @@ -450,13 +450,11 @@ public class AIMPaymentServices { // only send password if no tran key AIMRequest.put("x_Password", props.getProperty("password")); } - // api version (non Card Present) String apiVersion = props.getProperty("ver"); if (UtilValidate.isNotEmpty(apiVersion)) { AIMRequest.put("x_Version", props.getProperty("ver")); } - // CP version String cpVersion = props.getProperty("cpver"); if (UtilValidate.isNotEmpty(cpVersion)) { diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java index 0388ed8..caf1f00 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java @@ -192,8 +192,7 @@ public class CCServicesTest extends OFBizTestCase { * a recurring order expires and a payment is rejected, the order must be * cancelled. If the order is to be resumed, a new recurring order must be * submitted. --> Orders are cancelled by using the Store Administrator Tool. - * - * So cannot by program. + * So cannot by program. */ } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java index 660d5b4..4bcf8cd 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java @@ -668,7 +668,7 @@ public class IcsPaymentServices { } private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { @@ -683,7 +683,7 @@ public class IcsPaymentServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } @@ -692,8 +692,8 @@ public class IcsPaymentServices { } private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/EwayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/EwayServices.java index 6e7e909..d7e6d77 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/EwayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/EwayServices.java @@ -38,7 +38,7 @@ import org.apache.ofbiz.service.ServiceUtil; public class EwayServices { private static final String MODULE = EwayServices.class.getName(); - public final static String RESOURCE = "AccountingUiLabels"; + private static final String RESOURCE = "AccountingUiLabels"; // eway charge (auth w/ capture) public static Map<String, Object> ewayCharge(DispatchContext dctx, Map<String, Object> context) { @@ -233,7 +233,7 @@ public class EwayServices { String customerId = getPaymentGatewayConfigValue(delegator, pgcId, "customerId", cfgStr, "payment.eway.customerId"); String refundPwd = getPaymentGatewayConfigValue(delegator, pgcId, "refundPwd", cfgStr, "payment.eway.refundPwd"); - Boolean testMode = "Y".equalsIgnoreCase(getPaymentGatewayConfigValue(delegator, pgcId, "testMode", cfgStr, "payment.eway.testMode")); + boolean testMode = "Y".equalsIgnoreCase(getPaymentGatewayConfigValue(delegator, pgcId, "testMode", cfgStr, "payment.eway.testMode")); Boolean beagle = "Y".equalsIgnoreCase(getPaymentGatewayConfigValue(delegator, pgcId, "enableBeagle", cfgStr, "payment.eway.enableBeagle")); Boolean cvn = "Y".equalsIgnoreCase(getPaymentGatewayConfigValue(delegator, pgcId, "enableCvn", cfgStr, "payment.eway.enableCvn")); @@ -251,7 +251,7 @@ public class EwayServices { return req; } private static String getPaymentGatewayConfigValue(Delegator delegator, String cfgId, String cfgParamName, - String RESOURCE, String resParamName) { + String resource, String resParamName) { String returnValue = ""; if (UtilValidate.isNotEmpty(cfgId)) { try { @@ -267,7 +267,7 @@ public class EwayServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, resParamName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, resParamName, delegator); if (value != null) { returnValue = value.trim(); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java index 46da5ed..bb3d86f 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java @@ -489,7 +489,7 @@ public class PayPalEvents { } private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { @@ -504,7 +504,7 @@ public class PayPalEvents { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalServices.java index 9046524..8d103a7 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalServices.java @@ -533,7 +533,7 @@ public class PayPalServices { // We want an exact match only EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition(postalMap), - EntityCondition.makeCondition(UtilMisc.toMap("attnName", null, "directions", null, "postalCodeExt", null,"postalCodeGeoId", null)), + EntityCondition.makeCondition(UtilMisc.toMap("attnName", null, "directions", null, "postalCodeExt", null, "postalCodeGeoId", null)), EntityCondition.makeCondition("partyId", partyId) )); try { diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java index df220cb..45c334b 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java @@ -123,7 +123,7 @@ public class SecurePayPaymentServices { } result.put("authCode", resp.getResponseCode()); result.put("authMessage", resp.getResponseText()); - } + } } return result; } @@ -477,7 +477,7 @@ public class SecurePayPaymentServices { return props; } - private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, String RESOURCE, String parameterName) { + private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { @@ -492,7 +492,7 @@ public class SecurePayPaymentServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } @@ -500,8 +500,8 @@ public class SecurePayPaymentServices { return returnValue; } - private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, RESOURCE, parameterName); + private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, String resource, String parameterName, String defaultValue) { + String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java index 23623d0..348f4d7 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java @@ -63,34 +63,34 @@ public class SecurePayServiceTest extends OFBizTestCase { configFile = "paymentTest.properties"; creditAmount = new BigDecimal("234.51"); emailAddr = delegator.makeValue("ContactMech", UtilMisc.toMap( - "infoString","[hidden email]")); + "infoString", "[hidden email]")); orderId = "Demo1002"; creditCard = delegator.makeValue("CreditCard", UtilMisc.toMap( - "cardType","CCT_VISA", - "expireDate","10/2011", // mm/yyyy, gets converted to mm/yy - "cardNumber","4444333322221111")); + "cardType", "CCT_VISA", + "expireDate", "10/2011", // mm/yyyy, gets converted to mm/yy + "cardNumber", "4444333322221111")); billingAddress = delegator.makeValue("PostalAddress", UtilMisc.toMap( - "toName","The customer Name", - "address1","The customer billingAddress1", - "address2","The customer billingAddress2", - "city","The customer city", + "toName", "The customer Name", + "address1", "The customer billingAddress1", + "address2", "The customer billingAddress2", + "city", "The customer city", "stateProvinceGeoId", "NLD")); shippingAddress = delegator.makeValue("PostalAddress", UtilMisc.toMap( - "toName","The customer Name", - "address1","The customer shippingStreet1", - "address2","The customer shippingStreet2", - "city","The customer city", + "toName", "The customer Name", + "address1", "The customer shippingStreet1", + "address2", "The customer shippingStreet2", + "city", "The customer city", "stateProvinceGeoId", "NLD", - "postalCode","12345")); + "postalCode", "12345")); orderItemMap = UtilMisc.<String, Object>toMap( - "orderId", "Demo1002", - "orderItemSeqId", "00001", - "orderItemTypeId", "PRODUCT_ORDER_ITEM", + "orderId", "Demo1002", + "orderItemSeqId", "00001", + "orderItemTypeId", "PRODUCT_ORDER_ITEM", "productId", "GZ-1000", - "prodCatalogId", "DemoCatalog", - "quantity" , new BigDecimal("2.000000"), + "prodCatalogId", "DemoCatalog", + "quantity", new BigDecimal("2.000000"), "unitPrice", new BigDecimal("59.00"), - "statusId" ,"ITEM_COMPLETED" + "statusId", "ITEM_COMPLETED" ); orderItems = UtilMisc.<Object>toList(orderItemMap); billToParty = delegator.makeValue("Party" , UtilMisc.toMap("partyId", "DemoCustomer")); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java index 6fbf4cc..6643fce 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java @@ -1004,7 +1004,7 @@ public class ValueLinkServices { } if (paymentConfig == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, - "AccountingFinAccountSetting", + "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", "GIFT_CARD"), locale)); } @@ -1036,7 +1036,7 @@ public class ValueLinkServices { try { typeFeature = EntityQuery.use(delegator) .from("ProductFeatureAndAppl") - .where("productId", product.get("productId"), + .where("productId", product.get("productId"), "productFeatureTypeId", "TYPE") .orderBy("-fromDate").filterByDate().queryFirst(); } catch (GenericEntityException e) { @@ -1046,7 +1046,7 @@ public class ValueLinkServices { } if (typeFeature == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "AccountingValueLinkFeatureTypeRequested", + "AccountingValueLinkFeatureTypeRequested", UtilMisc.toMap("productId", product.get("productId")), locale)); } @@ -1309,8 +1309,8 @@ public class ValueLinkServices { GenericValue surveyResponse = null; try { surveyResponse = EntityQuery.use(delegator).from("SurveyResponse") - .where("orderId", orderId, - "orderItemSeqId", orderItem.get("orderItemSeqId"), + .where("orderId", orderId, + "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId).orderBy("-responseDate") .queryFirst(); } catch (GenericEntityException e) { @@ -1403,7 +1403,7 @@ public class ValueLinkServices { // process the return try { - Map<String, Object> refundCtx = UtilMisc.<String, Object>toMap("orderItem", orderItem, + Map<String, Object> refundCtx = UtilMisc.<String, Object>toMap("orderItem", orderItem, "partyId", partyId, "userLogin", userLogin); dispatcher.runAsync("refundGcPurchase", refundCtx, null, true, 300, true); } catch (GenericServiceException e) { diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java index b6154a3..84c91be 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/verisign/PayflowPro.java @@ -684,17 +684,19 @@ public class PayflowPro { } return parameters; } - private static void parseAuthResponse(Delegator delegator, String paymentGatewayConfigId, String resp, Map<String, Object> result, String RESOURCE, boolean isReAuth, boolean isPayPal) { + private static void parseAuthResponse(Delegator delegator, String paymentGatewayConfigId, String resp, Map<String, Object> result, + String resource, boolean isReAuth, boolean isPayPal) { Map<String, String> parameters = parseResponse(resp); // txType - boolean isSale = !comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "preAuth", RESOURCE, "payment.verisign.preAuth", "Y"); + boolean isSale = !comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "preAuth", resource, "payment.verisign.preAuth", "Y"); // avs checking - ignore on re-auth boolean avsCheckOkay = true; String avsCode = null; if (!isReAuth) { - boolean checkAvs = comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "checkAvs", RESOURCE, "payment.verisign.checkAvs", "Y"); + boolean checkAvs = comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "checkAvs", resource, + "payment.verisign.checkAvs", "Y"); if (checkAvs && !isSale) { String addAvs = (String) parameters.get("AVSADDR"); String zipAvs = (String) parameters.get("AVSZIP"); @@ -709,7 +711,7 @@ public class PayflowPro { boolean cvv2CheckOkay = true; String cvvCode = null; if (!isReAuth && !isPayPal) { - boolean checkCvv2 = comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "checkCvv2", RESOURCE, "payment.verisign.checkCvv2", "Y"); + boolean checkCvv2 = comparePaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "checkCvv2", resource, "payment.verisign.checkCvv2", "Y"); if (checkCvv2 && !isSale) { cvvCode = (String) parameters.get("CVV2MATCH"); if (cvvCode == null || "N".equals(cvvCode)) { @@ -893,20 +895,20 @@ public class PayflowPro { return buf; } - private static PayflowAPI init(Delegator delegator, String paymentGatewayConfigId, String RESOURCE, Map<String, ? extends Object> context) { + private static PayflowAPI init(Delegator delegator, String paymentGatewayConfigId, String resource, Map<String, ? extends Object> context) { // No more used // String certsPath = FlexibleStringExpander.expandString(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "certsPath", RESOURCE, "payment.verisign.certsPath", "pfcerts"), context); - String hostAddress = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "hostAddress", RESOURCE, "payment.verisign.hostAddress", "pilot-payflowpro.paypal.com"); - Integer hostPort = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "hostPort", RESOURCE, "payment.verisign.hostPort", "443")); - Integer timeout = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "timeout", RESOURCE, "payment.verisign.timeout", "80")); - String proxyAddress = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyAddress", RESOURCE, "payment.verisign.proxyAddress", ""); - Integer proxyPort = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyPort", RESOURCE, "payment.verisign.proxyPort", "80")); - String proxyLogon = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyLogon", RESOURCE, "payment.verisign.proxyLogon", ""); - String proxyPassword = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyPassword", RESOURCE, "payment.verisign.proxyPassword", ""); - String logFileName = FlexibleStringExpander.expandString(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "logFileName", RESOURCE, "payment.verisign.logFileName", ""), context); - Integer loggingLevel = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "loggingLevel", RESOURCE, "payment.verisign.loggingLevel", "6")); - Integer maxLogFileSize = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "maxLogFileSize", RESOURCE, "payment.verisign.maxLogFileSize", "1000000")); - boolean stackTraceOn = "Y".equalsIgnoreCase(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "stackTraceOn", RESOURCE, "payment.verisign.stackTraceOn", "N")); + String hostAddress = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "hostAddress", resource, "payment.verisign.hostAddress", "pilot-payflowpro.paypal.com"); + Integer hostPort = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "hostPort", resource, "payment.verisign.hostPort", "443")); + Integer timeout = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "timeout", resource, "payment.verisign.timeout", "80")); + String proxyAddress = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyAddress", resource, "payment.verisign.proxyAddress", ""); + Integer proxyPort = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyPort", resource, "payment.verisign.proxyPort", "80")); + String proxyLogon = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyLogon", resource, "payment.verisign.proxyLogon", ""); + String proxyPassword = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "proxyPassword", resource, "payment.verisign.proxyPassword", ""); + String logFileName = FlexibleStringExpander.expandString(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "logFileName", resource, "payment.verisign.logFileName", ""), context); + Integer loggingLevel = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "loggingLevel", resource, "payment.verisign.loggingLevel", "6")); + Integer maxLogFileSize = Integer.decode(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "maxLogFileSize", resource, "payment.verisign.maxLogFileSize", "1000000")); + boolean stackTraceOn = "Y".equalsIgnoreCase(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "stackTraceOn", resource, "payment.verisign.stackTraceOn", "N")); PayflowAPI pfp = new PayflowAPI(hostAddress, hostPort, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword); @@ -918,7 +920,7 @@ public class PayflowPro { } private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { @@ -933,7 +935,7 @@ public class PayflowPro { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } @@ -942,8 +944,8 @@ public class PayflowPro { } private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } @@ -951,10 +953,10 @@ public class PayflowPro { } private static boolean comparePaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName, String compareValue) { + String resource, String parameterName, String compareValue) { boolean returnValue = false; - String value = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, RESOURCE, parameterName, compareValue); + String value = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, parameterName, compareValue); if (UtilValidate.isNotEmpty(value)) { returnValue = value.trim().equalsIgnoreCase(compareValue); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java index 56c7837..64f81e4 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java @@ -492,7 +492,7 @@ public class WorldPayEvents { } private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { @@ -507,17 +507,16 @@ public class WorldPayEvents { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } } return returnValue; } - private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java index 0e13585..78ed1ff 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java @@ -36,7 +36,7 @@ import org.apache.ofbiz.entity.util.EntityQuery; public final class UtilAccounting { - + private static final String MODULE = UtilAccounting.class.getName(); private UtilAccounting() { } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java index 9891b23..1c91642 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java @@ -75,7 +75,7 @@ public class ContentManagementServices { String contentId = (String) context.get("contentId"); String subContentId = (String) context.get("subContentId"); String mapKey = (String) context.get("mapKey"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Timestamp fromDate = (Timestamp) context.get("fromDate"); List<String> assocTypes = UtilGenerics.cast(context.get("assocTypes")); String assocTypesString = (String) context.get("assocTypesString"); @@ -166,21 +166,21 @@ public class ContentManagementServices { } context.put("contentPurposeList", contentPurposeList); context.put("contentPurposeString", null); - + if (Debug.infoOn()) { Debug.logInfo("in persist... contentPurposeList(0):" + contentPurposeList, MODULE); Debug.logInfo("in persist... textData(0):" + context.get("textData"), MODULE); } GenericValue content = delegator.makeValue("Content"); - + content.setPKFields(context); content.setNonPKFields(context); String contentId = (String) content.get("contentId"); String contentTypeId = (String) content.get("contentTypeId"); String origContentId = (String) content.get("contentId"); String origDataResourceId = (String) content.get("dataResourceId"); - + if (Debug.infoOn()) { Debug.logInfo("in persist... contentId(0):" + contentId, MODULE); } @@ -397,7 +397,7 @@ public class ContentManagementServices { public static Map<String, Object> updateSiteRoles(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Map<String, Object> results = new HashMap<>(); String siteContentId = (String) context.get("contentId"); String partyId = (String) context.get("partyId"); @@ -800,7 +800,7 @@ public class ContentManagementServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String contentIdTo = (String) context.get("contentIdTo"); - Integer seqInc = (Integer)context.get("seqInc"); + Integer seqInc = (Integer) context.get("seqInc"); if (seqInc == null) { seqInc = 100; } @@ -882,7 +882,7 @@ public class ContentManagementServices { LocalDispatcher dispatcher = dctx.getDispatcher(); Map<String, Object> thisResult = new HashMap<>(); String contentId = (String) context.get("contentId"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String userLoginId = userLogin.getString("userLoginId"); Locale locale = (Locale) context.get("locale"); try { @@ -1179,7 +1179,7 @@ public class ContentManagementServices { public static Map<String, Object> initContentChildCounts(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException { Map<String, Object> result = new HashMap<>(); Locale locale = (Locale) context.get("locale"); - GenericValue content = (GenericValue)context.get("content"); + GenericValue content = (GenericValue) context.get("content"); if (content == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", ""), locale)); } @@ -1463,7 +1463,7 @@ public class ContentManagementServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Security security = dctx.getSecurity(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); if (!security.hasEntityPermission("CONTENTMGR", "_ADMIN", userLogin)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPermissionNotGranted", locale)); @@ -1509,7 +1509,7 @@ public class ContentManagementServices { } } - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); result = dispatcher.runSync(serviceName, UtilMisc.toMap("content", content, "userLogin", userLogin)); if (ServiceUtil.isError(result)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java b/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java index 9b426eb..261b91c 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java @@ -113,7 +113,7 @@ In order to make this service active add the following to the service definition if (ServiceUtil.isError(result)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } - while ((line = input.readLine()) != null) {//start line + while ((line = input.readLine()) != null) { //start line boolean hasFolder = true; String rootContent = null, contentId = null; counterLine++; if (counterLine > 1) { @@ -121,11 +121,11 @@ In order to make this service active add the following to the service definition String check = "\\", checkSubContent = ",", contentName = "", contentNameInprogress = "", data = line.substring(3, size); size = data.length(); - for (int index = 0; index< size; index++) {//start character in line + for (int index = 0; index< size; index++) { //start character in line boolean contentNameMatch = false; int contentAssocSize = 0; List<GenericValue> contentAssocs = null; - if (data.charAt(index) == check.charAt(0) || data.charAt(index) == checkSubContent.charAt(0)) {//store data + if (data.charAt(index) == check.charAt(0) || data.charAt(index) == checkSubContent.charAt(0)) { //store data contentName = contentName + contentNameInprogress; if (contentName.length() > 100) { contentName = contentName.substring(0, 100); @@ -135,7 +135,7 @@ In order to make this service active add the following to the service definition if (content != null) { contentId = content.getString("contentId"); } - if (content != null && hasFolder==true) { + if (content != null && hasFolder == true) { if (rootContent != null) { contentAssocs = EntityQuery.use(delegator).from("ContentAssoc") .where("contentId", contentId, "contentIdTo", rootContent) @@ -146,7 +146,7 @@ In order to make this service active add the following to the service definition while (contentAssChecks.hasNext() && contentNameMatch == false) { GenericValue contentAss = contentAssChecks.next(); GenericValue contentcheck = EntityQuery.use(delegator).from("Content").where("contentId", contentAss.get("contentId")).queryOne(); - if (contentcheck!=null) { + if (contentcheck != null) { if (contentcheck.get("contentName").equals(contentName) && contentNameMatch == false) { contentNameMatch = true; contentId = contentcheck.get("contentId").toString(); @@ -162,7 +162,7 @@ In order to make this service active add the following to the service definition contentAssocSize = contentAssocs.size(); } - if (contentAssocSize == 0 && contentNameMatch == false) {//New Root Content + if (contentAssocSize == 0 && contentNameMatch == false) { //New Root Content contentId = delegator.getNextSeqId("Content"); Entity = delegator.makeValue("Content"); Entity.set("contentId", contentId); @@ -199,12 +199,12 @@ In order to make this service active add the following to the service definition rootContent = contentId; } else { //Debug.logInfo("ContentAssoc [contentId= " + contentId + ", contentIdTo=" + rootContent + "] already exist.");//ShoW log file - rootContent=contentId; + rootContent = contentId; } contentName = ""; - contentNameInprogress =""; + contentNameInprogress = ""; } - if (data.charAt(index)== checkSubContent.charAt(0)) {//Have sub content + if (data.charAt(index) == checkSubContent.charAt(0)) { createSubContent(index, data, rootContent, context, dctx); index = size; continue; @@ -213,12 +213,12 @@ In order to make this service active add the following to the service definition contentNameInprogress = contentNameInprogress.concat(Character.toString(data.charAt(index))); if (contentNameInprogress.length() > 99) { contentName = contentName + contentNameInprogress; - contentNameInprogress =""; + contentNameInprogress = ""; } } - }//end character in line + } //end character in line } - }//end line + } //end line sucMsg = UtilProperties.getMessage("ContentUiLabels", "ContentConvertDocumentsTreeSuccessful", UtilMisc.toMap("counterLine", counterLine), locale); } catch (IOException | GenericServiceException | GenericEntityException e) { errMsg = "Exception " + UtilMisc.toMap("errMessage", e.toString()); @@ -236,14 +236,14 @@ In order to make this service active add the following to the service definition Map<String, Object> result = new HashMap<>(); String subContents = null, check = ",", oldChar = "\"", newChar = "", contentNameInprogress = "", contentName = "", contentId = null; GenericValue Entity = null; - String errMsg = "", sucMsg= ""; + String errMsg = "", sucMsg = ""; subContents = line.substring(index + 1, line.length()); subContents = subContents.replace(oldChar, newChar); int size = subContents.length(); try { - for (index = 0; index < size; index++) {//start character in line + for (index = 0; index < size; index++) { //start character in line boolean contentNameMatch = false; - if (subContents.charAt(index) == check.charAt(0)) {//store data + if (subContents.charAt(index) == check.charAt(0)) { //store data contentName = contentName + contentNameInprogress; if (contentName.length()>100) { contentName = contentName.substring(0,100); @@ -299,11 +299,11 @@ In order to make this service active add the following to the service definition return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } } - contentName =""; - contentNameInprogress=""; + contentName = ""; + contentNameInprogress= ""; } - if ((subContents.charAt(index) )!= check.charAt(0)) { + if ((subContents.charAt(index)) != check.charAt(0)) { contentNameInprogress = contentNameInprogress.concat(Character.toString(subContents.charAt(index))); if (contentNameInprogress.length() > 99) { contentName = contentName + contentNameInprogress; @@ -328,7 +328,7 @@ In order to make this service active add the following to the service definition } } } - if (contentNameMatch == false) { + if (!contentNameMatch) { //create DataResource Map<String, Object> data = new HashMap<>(); data.put("userLogin", userLogin); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java index 6953028..14225c1 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java @@ -300,7 +300,7 @@ public class CmsEvents { // TODO: replace "screen" to support dynamic rendering of different output if (visualTheme == null) { String defaultVisualThemeId = EntityUtilProperties.getPropertyValue("general", "VISUAL_THEME", delegator); - visualTheme = ThemeFactory.getVisualThemeFromId(defaultVisualThemeId); + visualTheme = ThemeFactory.getVisualThemeFromId(defaultVisualThemeId); } FormStringRenderer formStringRenderer = new MacroFormRenderer(visualTheme.getModelTheme().getFormRendererLocation("screen"), request, response); templateMap.put("formStringRenderer", formStringRenderer); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java index 500154b..67b80d0 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java @@ -154,7 +154,7 @@ public class CompDocEvents { String contentId = (String)paramMap.get("contentId"); Locale locale = UtilHttp.getLocale(request); String webSiteId = WebSiteWorker.getWebSiteId(request); - + String rootDir = servletContext.getRealPath("/"); String https = (String) servletContext.getAttribute("https"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java index e12e9ef..514e6b1 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java @@ -61,7 +61,7 @@ import com.lowagie.text.pdf.PdfReader; public class CompDocServices { private static final String MODULE = CompDocServices.class.getName(); private static final String RESOURCE = "ContentUiLabels"; - + /** * * Creates the topmost Content entity of a Composite Document tree. @@ -76,8 +76,8 @@ public class CompDocServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Locale locale = (Locale)context.get("locale"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + Locale locale = (Locale) context.get("locale"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String contentId = (String) context.get("contentId"); if (UtilValidate.isNotEmpty(contentId)) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java index 0d2eb67..3444800 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentEvents.java @@ -64,7 +64,7 @@ public class ContentEvents { // check permissions before moving on... if (!security.hasEntityPermission("CONTENTMGR", "_" + updateMode, request.getSession())) { Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode); - errMsg = UtilProperties.getMessage(RESOURCE,"contentevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -74,7 +74,7 @@ public class ContentEvents { boolean beganTx = false; EntityQuery contentQuery = EntityQuery.use(delegator).from("Content"); - + try { // begin the transaction beganTx = TransactionUtil.begin(7200); @@ -100,7 +100,7 @@ public class ContentEvents { } catch (GenericEntityException gee) { Debug.logWarning(gee, gee.getMessage(), MODULE); Map<String, String> messageMap = UtilMisc.toMap("gee", gee.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"contentevents.error_getting_content_list", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.error_getting_content_list", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); try { TransactionUtil.rollback(beganTx, gee.getMessage(), gee); @@ -119,13 +119,13 @@ public class ContentEvents { if (errConts == 0) { Map<String, String> messageMap = UtilMisc.toMap("numConts", Integer.toString(numConts)); - errMsg = UtilProperties.getMessage(RESOURCE,"contentevents.keyword_creation_complete_for_contents", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.keyword_creation_complete_for_contents", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", errMsg); return "success"; } else { Map<String, String> messageMap = UtilMisc.toMap("numConts", Integer.toString(numConts)); messageMap.put("errConts", Integer.toString(errConts)); - errMsg = UtilProperties.getMessage(RESOURCE,"contentevents.keyword_creation_complete_for_contents_with_errors", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.keyword_creation_complete_for_contents_with_errors", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java index e96ba9a..8ccc9fc 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java @@ -55,7 +55,7 @@ public class ContentKeywordIndex { public static void indexKeywords(GenericValue content, boolean doAll) throws GenericEntityException { if (content == null) return; - + Delegator delegator = content.getDelegator(); String contentId = content.getString("contentId"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java index e0fff6b..85904d6 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java @@ -77,9 +77,9 @@ public class ContentMapFacade implements Map<Object, Object> { protected ContentMapFacade decoratedContent = null; // internal objects - private String sortOrder="-fromDate"; - private String mapKeyFilter=""; - private String statusFilter=""; + private String sortOrder = "-fromDate"; + private String mapKeyFilter = ""; + private String statusFilter = ""; private DataResource dataResource; private SubContent subContent; private MetaData metaData; @@ -260,14 +260,14 @@ public class ContentMapFacade implements Map<Object, Object> { if (rh != null && request != null && response != null) { String webSiteId = WebSiteWorker.getWebSiteId(request); Delegator delegator = (Delegator) request.getAttribute("delegator"); - + String contentUri = this.contentId; // Try and find a WebSitePathAlias record to use, it isn't very feasible to find an alias by (parent)contentId/mapKey // so we're only looking for a direct alias using contentId if (webSiteId != null && delegator != null) { try { GenericValue webSitePathAlias = EntityQuery.use(delegator).from("WebSitePathAlias") - .where("mapKey", null, "webSiteId", webSiteId,"contentId", this.contentId) + .where("mapKey", null, "webSiteId", webSiteId, "contentId", this.contentId) .orderBy("-fromDate") .cache() .filterByDate() @@ -457,7 +457,7 @@ public class ContentMapFacade implements Map<Object, Object> { class SubContent extends AbstractInfo { private String sortOrder="-fromDate"; - private String statusFilter=""; + private String statusFilter= ""; @Override public Object get(Object key) { if (!(key instanceof String)) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java index dfee583..5ec115d 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java @@ -502,7 +502,7 @@ public class ContentSearch { contentSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ContentAssocTypeId", "contentAssocTypeId", null, null, null, null); contentSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); contentSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - contentSearchContext.dynamicViewEntity.addViewLink("CNT", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("contentId","contentIdTo")); + contentSearchContext.dynamicViewEntity.addViewLink("CNT", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("contentId", "contentIdTo")); List<EntityExpr> assocConditionToFrom = new LinkedList<>(); assocConditionToFrom.add(EntityCondition.makeCondition(prefix + "ContentIdFrom", EntityOperator.IN, contentIdSet)); @@ -773,7 +773,7 @@ public class ContentSearch { contentSearchContext.entityConditionList.add(conditions); // add in contentSearchConstraint, don't worry about the contentSearchResultId or constraintSeqId, those will be fill in later - contentSearchContext.contentSearchConstraintList.add(contentSearchContext.getDelegator().makeValue("ContentSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString","fromDate : " + fromDate + " thruDate : " + thruDate))); + contentSearchContext.contentSearchConstraintList.add(contentSearchContext.getDelegator().makeValue("ContentSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", "fromDate : " + fromDate + " thruDate : " + thruDate))); } /** pretty print for log messages and even UI stuff */ diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java index 576f18d..6e26aac 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java @@ -40,7 +40,7 @@ import org.apache.ofbiz.entity.Delegator; public class ContentSearchSession { private static final String MODULE = ContentSearchSession.class.getName(); - + @SuppressWarnings("serial") public static class ContentSearchOptions implements java.io.Serializable { protected List<ContentSearchConstraint> constraintList = null; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java index 6d49d5d..0facaaa 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java @@ -81,7 +81,7 @@ public class ContentServices { List<String> targetOperations = UtilGenerics.cast(context.get("targetOperationList")); List<String> contentTypes = UtilGenerics.cast(context.get("contentTypeList")); List<GenericValue> contentList = null; - + try { contentList = ContentWorker.getAssociatedContent(currentContent, toFrom, assocTypes, contentTypes, fromDate, thruDate); } catch (GenericEntityException e) { @@ -452,7 +452,7 @@ public class ContentServices { } Writer outWriter = new StringWriter(); - GenericValue view = (GenericValue)context.get("subContentDataResourceView"); + GenericValue view = (GenericValue) context.get("subContentDataResourceView"); if (view != null && view.containsKey("contentId")) { contentId = view.getString("contentId"); } @@ -538,8 +538,8 @@ public class ContentServices { public static Map<String, Object> publishContent(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException { Map<String, Object> result = new HashMap<>(); - GenericValue content = (GenericValue)context.get("content"); - + GenericValue content = (GenericValue) context.get("content"); + try { content.put("statusId", "CTNT_PUBLISHED"); content.store(); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java index 59aec4a..a838e65 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java @@ -271,7 +271,7 @@ public class ContentServicesComplex { Debug.logError(e, MODULE); return ServiceUtil.returnError(e.getMessage()); } - + if (UtilValidate.isNotEmpty(orderBy)) { List<String> orderByList = StringUtil.split(orderBy, "|"); contentAssocDataResourceList = EntityUtil.orderBy(contentAssocDataResourceList, orderByList); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java index 902a506..718c7b1 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentUrlFilter.java @@ -55,7 +55,7 @@ public class ContentUrlFilter implements Filter { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; Delegator delegator = (Delegator) httpRequest.getSession().getServletContext().getAttribute("delegator"); - + String urlContentId = null; String pathInfo = UtilHttp.getFullRequestUrl(httpRequest); if (UtilValidate.isNotEmpty(pathInfo)) { @@ -90,7 +90,7 @@ public class ContentUrlFilter implements Filter { dispatch.forward(request, response); return; } - + //Check path alias UrlServletHelper.checkPathAlias(request, httpResponse, delegator, pathInfo); } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java index 49ce5fe..dcfe355 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java @@ -131,7 +131,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor GenericValue relContent = EntityQuery.use(delegator) .from("ContentAssocDataResourceViewTo") .where("contentIdStart", content.get("contentId"), - "statusId","CTNT_PUBLISHED", + "statusId", "CTNT_PUBLISHED", "caContentAssocTypeId", "PUBLISH_LINK") .orderBy("caFromDate") .filterByDate("caFromDate", "caThruDate") @@ -277,7 +277,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor Debug.logError("No content ID found.", MODULE); return; } - + if (UtilValidate.isNotEmpty(webAnalytics)) { DataResourceWorker.renderDataResourceAsText(dispatcher, delegator, dataResourceId, out, templateContext, locale, mimeTypeId, cache, webAnalytics); } else { @@ -884,7 +884,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor EntityExpr thruExpr2 = EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null); exprList.add(thruExpr2); } - + return EntityQuery.use(delegator).from("ContentAssoc").where(exprList).orderBy("-fromDate").queryList(); } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java index c7d7600..196179a 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java @@ -79,7 +79,7 @@ public class UploadContentAndImage { long maxUploadSize = UtilHttp.getMaxUploadSize(delegator); int sizeThreshold = UtilHttp.getSizeThreshold(delegator); File tmpUploadRepository = UtilHttp.getTmpUploadRepository(delegator); - + ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, tmpUploadRepository)); upload.setSizeMax(maxUploadSize); List<FileItem> lst = null; @@ -124,7 +124,7 @@ public class UploadContentAndImage { String passedContentId = (String)passedParams.get("ftlContentId"); List<String> targetOperationList = ContentWorker.prepTargetOperationList(passedParams, entityOperation); passedParams.put("targetOperationList", targetOperationList); - + // Create or update FTL template Map<String, Object> ftlContext = new HashMap<>(); ftlContext.put("userLogin", userLogin); @@ -345,7 +345,6 @@ public class UploadContentAndImage { long maxUploadSize = UtilHttp.getMaxUploadSize(delegator); int sizeThreshold = UtilHttp.getSizeThreshold(delegator); File tmpUploadRepository = UtilHttp.getTmpUploadRepository(delegator); - ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, tmpUploadRepository)); upload.setSizeMax(maxUploadSize); @@ -400,7 +399,7 @@ public class UploadContentAndImage { TransactionUtil.begin(); for (int i = 0; i < rowCount; i++) { String suffix = "_o_" + i; - if (i==0) { + if (i == 0) { suffix = ""; } String returnMsg = processContentUpload(passedParams, suffix, request); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java index 1aace84..1289fb2 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java @@ -511,7 +511,7 @@ public class DataServices { Delegator delegator = dctx.getDelegator(); //Locale locale = (Locale) context.get("locale"); String dataResourceId = (String) context.get("dataResourceId"); - ByteBuffer byteBuffer = (ByteBuffer)context.get("imageData"); + ByteBuffer byteBuffer = (ByteBuffer) context.get("imageData"); if (byteBuffer != null) { byte[] imageBytes = byteBuffer.array(); try { @@ -544,7 +544,7 @@ public class DataServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String dataResourceId = (String) context.get("dataResourceId"); - ByteBuffer byteBuffer = (ByteBuffer)context.get("imageData"); + ByteBuffer byteBuffer = (ByteBuffer) context.get("imageData"); if (byteBuffer != null) { byte[] imageBytes = byteBuffer.array(); try { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java index e7883dc..f7c2ed7 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java @@ -66,7 +66,7 @@ public final class LayoutWorker { long maxUploadSize = UtilHttp.getMaxUploadSize(delegator); int sizeThreshold = UtilHttp.getSizeThreshold(delegator); File tmpUploadRepository = UtilHttp.getTmpUploadRepository(delegator); - + ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, tmpUploadRepository)); upload.setSizeMax(maxUploadSize); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java index 03dec4b..e26698b 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/output/OutputServices.java @@ -92,7 +92,7 @@ public class OutputServices { VisualTheme visualTheme = (VisualTheme) serviceContext.get("visualTheme"); if (visualTheme == null) { visualTheme = ThemeFactory.resolveVisualTheme(null); - } + } String screenLocation = (String) serviceContext.remove("screenLocation"); Map<String, Object> screenContext = UtilGenerics.cast(serviceContext.remove("screenContext")); String contentType = (String) serviceContext.remove("contentType"); @@ -210,7 +210,7 @@ public class OutputServices { VisualTheme visualTheme = (VisualTheme) serviceContext.get("visualTheme"); if (visualTheme == null) { visualTheme = ThemeFactory.resolveVisualTheme(null); - } + } String screenLocation = (String) serviceContext.remove("screenLocation"); Map<String, Object> screenContext = UtilGenerics.cast(serviceContext.remove("screenContext")); String contentType = (String) serviceContext.remove("contentType"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java index 87b5112..7f09825 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java @@ -263,7 +263,7 @@ public class PdfSurveyServices { String surveyQuestionId = (String)surveyQuestionAndAppl.get("surveyQuestionId"); String surveyQuestionTypeId = (String)surveyQuestionAndAppl.get("surveyQuestionTypeId"); GenericValue surveyResponseAnswer = delegator.makeValue("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId, "surveyQuestionId", surveyQuestionId)); - if (surveyQuestionTypeId ==null || "TEXT_SHORT".equals(surveyQuestionTypeId)) { + if (surveyQuestionTypeId == null || "TEXT_SHORT".equals(surveyQuestionTypeId)) { surveyResponseAnswer.set("textResponse", value); } @@ -537,7 +537,7 @@ public class PdfSurveyServices { } public static ByteBuffer getInputByteBuffer(Map<String, ? extends Object> context, Delegator delegator) throws GeneralException { - ByteBuffer inputByteBuffer = (ByteBuffer)context.get("inputByteBuffer"); + ByteBuffer inputByteBuffer = (ByteBuffer) context.get("inputByteBuffer"); if (inputByteBuffer == null) { String pdfFileNameIn = (String) context.get("pdfFileNameIn"); @@ -555,7 +555,7 @@ public class PdfSurveyServices { } } else if (UtilValidate.isNotEmpty(contentId)) { try { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); String https = (String) context.get("https"); String webSiteId = (String) context.get("webSiteId"); String rootDir = (String) context.get("rootDir"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java index 83e2fb3..5583c8e 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java @@ -54,7 +54,7 @@ public class LoopSubContentTransform implements TemplateTransformModel { private static final String MODULE = LoopSubContentTransform.class.getName(); static final String[] saveKeyNames = {"contentId", "subContentId", "mimeType", "subContentDataResourceView", "wrapTemplateId", "contentTemplateId"}; - static final String[] removeKeyNames = {"wrapTemplateId", "entityList", "entityIndex", "textData", "dataResourceId","drDataResourceId", "subContentIdSub", "parentContent", "wrappedFTL"}; + static final String[] removeKeyNames = {"wrapTemplateId", "entityList", "entityIndex", "textData", "dataResourceId", "drDataResourceId", "subContentIdSub", "parentContent", "wrappedFTL"}; /** * @deprecated use FreeMarkerWorker.getWrappedObject() diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java index 92d9ce2..da663fc 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java @@ -172,12 +172,12 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel { templateRoot.put("context", templateCtx); String mimeTypeId = (String) templateCtx.get("mimeTypeId"); - + Locale locale = (Locale) templateCtx.get("locale"); if (locale == null) { locale = Locale.getDefault(); } - + try { ContentWorker.renderContentAsText(dispatcher, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true); } catch (IOException | GeneralException e) { diff --git a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java index 37f884a..126a9d9 100644 --- a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java +++ b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java @@ -67,7 +67,7 @@ public class HumanResEvents { } try { GenericValue partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne(); - if (partyGroup != null) { + if (partyGroup != null) { paramMap.put("partyGroup", partyGroup); /* get the child departments of company or party */ categoryList.addAll(getChildComps(paramMap)); @@ -182,7 +182,7 @@ public class HumanResEvents { josonMap.put("attr", attrMap); josonMap.put("data", dataMap); resultList.add(josonMap); - } + } } } catch (GenericEntityException e) { Debug.logError(e, MODULE); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java index ebe6845..5aaab85 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMHelper.java @@ -68,7 +68,7 @@ public final class BOMHelper { if (inDate == null) inDate = new Date(); int maxDepth = 0; List<GenericValue> productNodesList = EntityQuery.use(delegator).from("ProductAssoc") - .where("productIdTo", productId, + .where("productIdTo", productId, "productAssocTypeId", bomType) .cache().filterByDate(inDate).queryList(); int depth = 0; @@ -112,7 +112,7 @@ public final class BOMHelper { productIdKeys.add(productIdKey); } List<GenericValue> productNodesList = EntityQuery.use(delegator).from("ProductAssoc") - .where("productIdTo", productId, + .where("productIdTo", productId, "productAssocTypeId", bomType) .cache().filterByDate(inDate).queryList(); GenericValue duplicatedNode = null; @@ -152,8 +152,8 @@ public final class BOMHelper { Debug.logError("Production Run for order item (" + orderItem.getString("orderId") + "/" + orderItem.getString("orderItemSeqId") + ") not created.", MODULE); continue; } - Map<String, Object> result = dispatcher.runSync("createProductionRunsForOrder", UtilMisc.<String, Object>toMap("quantity", shipmentPlan.getBigDecimal("quantity"), "orderId", - shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipGroupSeqId", shipmentPlan.getString("shipGroupSeqId"), "shipmentId", + Map<String, Object> result = dispatcher.runSync("createProductionRunsForOrder", UtilMisc.<String, Object>toMap("quantity", shipmentPlan.getBigDecimal("quantity"), "orderId", + shipmentPlan.getString("orderId"), "orderItemSeqId", shipmentPlan.getString("orderItemSeqId"), "shipGroupSeqId", shipmentPlan.getString("shipGroupSeqId"), "shipmentId", shipmentId, "userLogin", userLogin)); if (ServiceUtil.isError(result)) { String errorMessage = ServiceUtil.getErrorMessage(result); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java index f7a75e9..a2e21f5 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java @@ -194,7 +194,7 @@ public class BOMNode { return oneChildNode; } - private BOMNode configurator(GenericValue node, List<GenericValue> productFeatures, + private BOMNode configurator(GenericValue node, List<GenericValue> productFeatures, String productIdForRules, Date inDate) throws GenericEntityException { BOMNode oneChildNode = new BOMNode((String)node.get("productIdTo"), delegator, dispatcher, userLogin); oneChildNode.setTree(tree); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java index a559df3..37b595e 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java @@ -137,7 +137,7 @@ public class BOMServices { Long llc = null; try { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); - Map<String, Object> depthResult = dispatcher.runSync("getMaxDepth", + Map<String, Object> depthResult = dispatcher.runSync("getMaxDepth", UtilMisc.toMap("productId", productId, "bomType", "MANUF_COMPONENT")); if (ServiceUtil.isError(depthResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(depthResult)); @@ -189,7 +189,7 @@ public class BOMServices { } if (alsoVariants) { List<GenericValue> variantProducts = EntityQuery.use(delegator).from("ProductAssoc") - .where("productId", productId, + .where("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT") .filterByDate().queryList(); for (GenericValue oneVariantProductAssoc : variantProducts) { @@ -260,7 +260,7 @@ public class BOMServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); String productId = (String) context.get("productId"); String productIdKey = (String) context.get("productIdTo"); @@ -293,7 +293,7 @@ public class BOMServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String productId = (String) context.get("productId"); String fromDateStr = (String) context.get("fromDate"); String bomType = (String) context.get("bomType"); @@ -344,7 +344,7 @@ public class BOMServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String productId = (String) context.get("productId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); BigDecimal amount = (BigDecimal) context.get("amount"); @@ -438,7 +438,7 @@ public class BOMServices { BigDecimal quantity = (BigDecimal) context.get("quantity"); BigDecimal amount = (BigDecimal) context.get("amount"); String fromDateStr = (String) context.get("fromDate"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); if (quantity == null) { @@ -487,7 +487,7 @@ public class BOMServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String shipmentId = (String) context.get("shipmentId"); try { @@ -512,7 +512,7 @@ public class BOMServices { GenericValue orderShipment = null; try { orderShipment = EntityQuery.use(delegator).from("OrderShipment") - .where("shipmentId", shipmentId, + .where("shipmentId", shipmentId, "shipmentItemSeqId", shipmentItem.get("shipmentItemSeqId")) .queryFirst(); } catch (GenericEntityException e) { @@ -762,7 +762,7 @@ public class BOMServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); String productId = (String) context.get("productId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java index ab09655..f4a626e 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java @@ -102,7 +102,7 @@ public class BOMTree { String productIdForRules = productId; // The selected product features are loaded List<GenericValue> productFeaturesAppl = EntityQuery.use(delegator).from("ProductFeatureAppl") - .where("productId", productId, + .where("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE") .queryList(); List<GenericValue> productFeatures = new LinkedList<>(); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java index 7536b8a..66354df 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java @@ -353,7 +353,7 @@ public class ProductionRun { if (exist()) { if (productionRunRoutingTasks == null) { try { - productionRunRoutingTasks = productionRun.getRelated("ChildWorkEffort", UtilMisc.toMap("workEffortTypeId","PROD_ORDER_TASK"), UtilMisc.toList("priority"), false); + productionRunRoutingTasks = productionRun.getRelated("ChildWorkEffort", UtilMisc.toMap("workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("priority"), false); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); } @@ -371,7 +371,7 @@ public class ProductionRun { if (exist()) { if (productionRunRoutingTasks == null) { try { - productionRunRoutingTasks = productionRun.getRelated("ChildWorkEffort", UtilMisc.toMap("workEffortTypeId","PROD_ORDER_TASK"), UtilMisc.toList("priority"), false); + productionRunRoutingTasks = productionRun.getRelated("ChildWorkEffort", UtilMisc.toMap("workEffortTypeId", "PROD_ORDER_TASK"), UtilMisc.toList("priority"), false); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); } @@ -411,7 +411,7 @@ public class ProductionRun { taskTime = task.getDouble("estimatedMilliSeconds"); } totalTaskTime = (setupTime + taskTime * quantity.doubleValue()); - + if (task.get("estimateCalcMethod") != null) { String serviceName = null; try { diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java index d411b19..cca7911 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java @@ -72,12 +72,12 @@ public class ProductionRunEvents { request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - GenericPK key = delegator.makePK("WorkEffortGoodStandard", - UtilMisc.<String, Object>toMap("workEffortId", (String)componentRow.get("productionRunTaskId"), + GenericPK key = delegator.makePK("WorkEffortGoodStandard", + UtilMisc.<String, Object>toMap("workEffortId", (String)componentRow.get("productionRunTaskId"), "productId", (String)componentRow.get("productId"), "fromDate", fromDate, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED")); - componentsLocationMap.put(key, + componentsLocationMap.put(key, UtilMisc.<String, Object>toMap("locationSeqId", (String)componentRow.get("locationSeqId"), "secondaryLocationSeqId", (String)componentRow.get("secondaryLocationSeqId"), "failIfItemsAreNotAvailable", (String)componentRow.get("failIfItemsAreNotAvailable"))); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java index 62bee49..962a013 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java @@ -46,7 +46,6 @@ public final class ProductionRunHelper { /** * Get a Production Run. * Check if routing - product link exists. - * * @param delegator the delegator * @param productionRunId the production run id * @return Map with the result of the service, the output parameters are @@ -61,7 +60,7 @@ public final class ProductionRunHelper { GenericValue productionRunProduct = EntityUtil.getFirst(productionRunProducts); GenericValue productProduced = productionRunProduct.getRelatedOne("Product", true); List<GenericValue> productionRunComponents = productionRun.getRelated("WorkEffortGoodStandard", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"), null, false); - List<GenericValue> productionRunRoutingTasks = productionRun.getRelated("FromWorkEffortAssoc", UtilMisc.toMap("workEffortTypeId","PROD_ORDER_TASK"), null, false); + List<GenericValue> productionRunRoutingTasks = productionRun.getRelated("FromWorkEffortAssoc", UtilMisc.toMap("workEffortTypeId", "PROD_ORDER_TASK"), null, false); result.put("productionRunProduct", productionRunProduct); result.put("productProduced", productProduced); result.put("productionRunComponents", productionRunComponents); @@ -86,7 +85,7 @@ public final class ProductionRunHelper { public static void getLinkedProductionRuns(Delegator delegator, LocalDispatcher dispatcher, String productionRunId, List<ProductionRun> productionRuns) throws GenericEntityException { productionRuns.add(new ProductionRun(productionRunId, delegator, dispatcher)); List<GenericValue> linkedWorkEfforts = EntityQuery.use(delegator).from("WorkEffortAssoc") - .where("workEffortIdTo", productionRunId, + .where("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY") .filterByDate().queryList(); for (GenericValue link : linkedWorkEfforts) { diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index d55b375..69c6afd 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -118,7 +118,7 @@ public class ProductionRunServices { } // Cancel the product promised List<GenericValue> products = EntityQuery.use(delegator).from("WorkEffortGoodStandard") - .where("workEffortId", productionRunId, + .where("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED") .queryList(); @@ -144,8 +144,8 @@ public class ProductionRunServices { } // cancel all the components List<GenericValue> components = EntityQuery.use(delegator).from("WorkEffortGoodStandard") - .where("workEffortId", taskId, - "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", + .where("workEffortId", taskId, + "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", "statusId", "WEGS_CREATED") .queryList(); if (UtilValidate.isNotEmpty(components)) { @@ -176,7 +176,7 @@ public class ProductionRunServices { * <li> for each valid routingTask of the routing create a workeffort-task</li> * <li> for the first routingTask, create for all the valid productIdTo with no associateRoutingTask a WorkEffortGoodStandard</li> * <li> for each valid routingTask of the routing and valid productIdTo associate with this RoutingTask create a WorkEffortGoodStandard</li> - * </ul> + * </ul> * @param ctx The DispatchContext that this service is operating in. * @param context Map containing the input parameters, productId, routingId, pRQuantity, startDate, workEffortName, description * @return Map with the result of the service, the output parameters. @@ -330,7 +330,7 @@ public class ProductionRunServices { serviceContext.put("description", routingTask.get("description")); serviceContext.put("fixedAssetId", routingTask.get("fixedAssetId")); serviceContext.put("workEffortTypeId", "PROD_ORDER_TASK"); - serviceContext.put("currentStatusId","PRUN_CREATED"); + serviceContext.put("currentStatusId", "PRUN_CREATED"); serviceContext.put("workEffortParentId", productionRunId); serviceContext.put("facilityId", facilityId); serviceContext.put("reservPersons", routingTask.get("reservPersons")); @@ -436,7 +436,7 @@ public class ProductionRunServices { /** * Make a copy of the party assignments that were defined on the template routing task to the new production run task. */ - private static void cloneWorkEffortPartyAssignments(DispatchContext dctx, GenericValue userLogin, + private static void cloneWorkEffortPartyAssignments(DispatchContext dctx, GenericValue userLogin, String routingTaskId, String productionRunTaskId) throws GeneralException { List<GenericValue> workEffortPartyAssignments = null; try { @@ -695,7 +695,7 @@ public class ProductionRunServices { // First check if there are production runs with precedence not still completed try { List<GenericValue> mandatoryWorkEfforts = EntityQuery.use(delegator).from("WorkEffortAssoc") - .where("workEffortIdTo", productionRunId, + .where("workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY") .filterByDate().queryList(); for (GenericValue mandatoryWorkEffortAssoc : mandatoryWorkEfforts) { @@ -992,8 +992,8 @@ public class ProductionRunServices { try { // get the currency GenericValue facility = productionRun.getGenericValue().getRelatedOne("Facility", false); - Map<String, Object> outputMap = dispatcher.runSync("getPartyAccountingPreferences", - UtilMisc.<String, Object>toMap("userLogin", userLogin, + Map<String, Object> outputMap = dispatcher.runSync("getPartyAccountingPreferences", + UtilMisc.<String, Object>toMap("userLogin", userLogin, "organizationPartyId", facility.getString("ownerPartyId"))); if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); @@ -1108,7 +1108,7 @@ public class ProductionRunServices { .orderBy("workEffortId") .queryList(); BigDecimal totalCost = ZERO; - Map<String, Object> outputMap = dispatcher.runSync("getWorkEffortCosts", + Map<String, Object> outputMap = dispatcher.runSync("getWorkEffortCosts", UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", workEffortId)); if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); @@ -1116,7 +1116,7 @@ public class ProductionRunServices { BigDecimal productionRunHeaderCost = (BigDecimal)outputMap.get("totalCost"); totalCost = totalCost.add(productionRunHeaderCost); for (GenericValue task : tasks) { - outputMap = dispatcher.runSync("getWorkEffortCosts", + outputMap = dispatcher.runSync("getWorkEffortCosts", UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", task.getString("workEffortId"))); if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); @@ -1220,7 +1220,7 @@ public class ProductionRunServices { fixedAsset = routingTask.getRelatedOne("FixedAsset", false); } if (fixedAsset != null) { - List<GenericValue> setupCosts = fixedAsset.getRelated("FixedAssetStdCost", + List<GenericValue> setupCosts = fixedAsset.getRelated("FixedAssetStdCost", UtilMisc.toMap("fixedAssetStdCostTypeId", "SETUP_COST"), null, false); GenericValue setupCost = EntityUtil.getFirst(EntityUtil.filterByDate(setupCosts)); List<GenericValue> usageCosts = fixedAsset.getRelated("FixedAssetStdCost", UtilMisc.toMap("fixedAssetStdCostTypeId", "USAGE_COST"), null, false); @@ -1238,7 +1238,7 @@ public class ProductionRunServices { BigDecimal fixedAssetCost = setupCostAmount.add(usageCostAmount).setScale(DECIMALS, ROUNDING); fixedAssetCost = fixedAssetCost.divide(BigDecimal.valueOf(3600000), DECIMALS, ROUNDING); // store the cost - Map<String, Object> inMap = UtilMisc.<String, Object>toMap("userLogin", userLogin, + Map<String, Object> inMap = UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", productionRunTaskId); inMap.put("costComponentTypeId", "ACTUAL_ROUTE_COST"); inMap.put("costUomId", currencyUomId); @@ -1298,7 +1298,7 @@ public class ProductionRunServices { * <li> if estimatedStartDate is not before Production Run estimatedStartDate.</li> * <li> if there is not a another routingTask with the same priority</li> * <li>If priority or estimatedStartDate has changed recalculated data for routingTask after that one.</li> - * </ul> + * </ul> * Update the productionRun * @param ctx The DispatchContext that this service is operating in. * @param context Map containing the input parameters, productId, routingId, priority, estimatedStartDate, estimatedSetupMillis, estimatedMilliSeconds @@ -1538,7 +1538,7 @@ public class ProductionRunServices { // Mandatory input fields String productionRunId = (String) context.get("productionRunId"); String routingTaskId = (String) context.get("routingTaskId"); - Long priority = (Long)context.get("priority"); + Long priority = (Long) context.get("priority"); // Optional input fields String workEffortName = (String) context.get("workEffortName"); @@ -1614,7 +1614,7 @@ public class ProductionRunServices { serviceContext.put("description", description); serviceContext.put("fixedAssetId", routingTask.get("fixedAssetId")); serviceContext.put("workEffortTypeId", "PROD_ORDER_TASK"); - serviceContext.put("currentStatusId","PRUN_CREATED"); + serviceContext.put("currentStatusId", "PRUN_CREATED"); serviceContext.put("workEffortParentId", productionRunId); serviceContext.put("facilityId", productionRun.getGenericValue().getString("facilityId")); serviceContext.put("estimatedStartDate", estimatedStartDate); @@ -2016,7 +2016,7 @@ public class ProductionRunServices { } if (minimumQuantityProducedByTask.compareTo(quantityDeclared) > 0) { try { - Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("productionRunId", productionRunId, + Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("productionRunId", productionRunId, "productionRunTaskId", taskId); serviceContext.put("addQuantityProduced", minimumQuantityProducedByTask.subtract(quantityDeclared)); serviceContext.put("issueRequiredComponents", Boolean.TRUE); @@ -2242,7 +2242,7 @@ public class ProductionRunServices { // TODO: if the task is not running, then return an error message. try { - Map<String, Object> inventoryResult = dispatcher.runSync("productionRunTaskProduce", + Map<String, Object> inventoryResult = dispatcher.runSync("productionRunTaskProduce", UtilMisc.<String, Object>toMap("workEffortId", productionRunTaskId, "productId", productId, "quantity", quantity, "lotId", lotId, "currencyUomId", uomId, "isReturned", "Y", "inventoryItemTypeId", inventoryItemTypeId, "userLogin", userLogin)); @@ -2346,7 +2346,7 @@ public class ProductionRunServices { BigDecimal totalRequiredMaterialQuantity = component.getBigDecimal("estimatedQuantity").multiply(totalQuantityProduced).divide(quantityToProduce, ROUNDING); // now get the units that have been already issued and subtract them List<GenericValue> issuances = EntityQuery.use(delegator).from("WorkEffortAndInventoryAssign") - .where("workEffortId", workEffortId, + .where("workEffortId", workEffortId, "productId", component.get("productId")) .queryList(); BigDecimal totalIssued = BigDecimal.ZERO; @@ -2364,7 +2364,7 @@ public class ProductionRunServices { componentsLocation = UtilGenerics.cast(componentsLocationMap.get(key)); } Map<String, Object> serviceContext = UtilMisc.toMap("workEffortId", workEffortId, - "productId", component.getString("productId"), + "productId", component.getString("productId"), "fromDate", component.getTimestamp("fromDate")); serviceContext.put("quantity", requiredQuantity); if (componentsLocation != null) { @@ -2373,7 +2373,7 @@ public class ProductionRunServices { serviceContext.put("failIfItemsAreNotAvailable", componentsLocation.get("failIfItemsAreNotAvailable")); } serviceContext.put("userLogin", userLogin); - Map<String, Object> serviceResult = dispatcher.runSync("issueProductionRunTaskComponent", + Map<String, Object> serviceResult = dispatcher.runSync("issueProductionRunTaskComponent", serviceContext); if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); @@ -2442,8 +2442,8 @@ public class ProductionRunServices { } try { Map<String, Object> serviceResult = dispatcher.runSync("updateRequirement", - UtilMisc.<String, Object>toMap("requirementId", requirementId, - "statusId", "REQ_APPROVED", "requirementTypeId", requirement.getString("requirementTypeId"), + UtilMisc.<String, Object>toMap("requirementId", requirementId, + "statusId", "REQ_APPROVED", "requirementTypeId", requirement.getString("requirementTypeId"), "userLogin", userLogin)); if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); @@ -2530,7 +2530,7 @@ public class ProductionRunServices { String facilityId = (String) context.get("facilityId"); // Optional input fields String configId = (String) context.get("configId"); - ProductConfigWrapper config = (ProductConfigWrapper)context.get("config"); + ProductConfigWrapper config = (ProductConfigWrapper) context.get("config"); BigDecimal quantity = (BigDecimal) context.get("quantity"); String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); @@ -2731,8 +2731,8 @@ public class ProductionRunServices { try { // first figure out how much of this product we already have in stock (ATP) BigDecimal existingAtp = BigDecimal.ZERO; - Map<String, Object> tmpResults = dispatcher.runSync("getInventoryAvailableByFacility", - UtilMisc.<String, Object>toMap("productId", orderItem.getString("productId"), + Map<String, Object> tmpResults = dispatcher.runSync("getInventoryAvailableByFacility", + UtilMisc.<String, Object>toMap("productId", orderItem.getString("productId"), "facilityId", facilityId, "userLogin", userLogin)); if (ServiceUtil.isError(tmpResults)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResults)); @@ -2849,7 +2849,7 @@ public class ProductionRunServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); String shipmentId = (String) context.get("shipmentId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); @@ -2974,7 +2974,7 @@ public class ProductionRunServices { Map<String, Object> result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin =(GenericValue)context.get("userLogin"); + GenericValue userLogin =(GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); String productId = (String) context.get("productId"); Timestamp startDate = (Timestamp) context.get("startDate"); @@ -3122,7 +3122,7 @@ public class ProductionRunServices { "PRUN_SCHEDULED".equals(oneTask.getString("currentStatusId")) || "PRUN_DOC_PRINTED".equals(oneTask.getString("currentStatusId"))) { try { - Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("productionRunId", productionRunId, + Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("productionRunId", productionRunId, "workEffortId", taskId); serviceContext.put("statusId", "PRUN_RUNNING"); serviceContext.put("issueAllComponents", Boolean.FALSE); @@ -3160,7 +3160,6 @@ public class ProductionRunServices { try { Map<String, Object> serviceContext = new HashMap<>(); // Change the task status to running - if ("PRUN_DOC_PRINTED".equals(statusId) || "PRUN_RUNNING".equals(statusId) || "PRUN_COMPLETED".equals(statusId) || @@ -3444,7 +3443,7 @@ public class ProductionRunServices { try { List<GenericValue> resultList = EntityQuery.use(delegator).from("WorkEffortAndGoods") .where("workEffortGoodStdTypeId", "PRUN_PROD_DELIV", - "statusId", "WEGS_CREATED", + "statusId", "WEGS_CREATED", "workEffortTypeId", "PROD_ORDER_HEADER") .queryList(); for (GenericValue genericResult : resultList) { @@ -3474,7 +3473,7 @@ public class ProductionRunServices { } TreeMap<Timestamp, Object> productMap = products.get(productId); if (!productMap.containsKey(estimatedShipDate)) { - productMap.put(estimatedShipDate, + productMap.put(estimatedShipDate, UtilMisc.toMap("remainingQty", BigDecimal.ZERO, "reservations", new LinkedList<>())); } Map<String, Object> dateMap = UtilGenerics.cast(productMap.get(estimatedShipDate)); @@ -3485,7 +3484,7 @@ public class ProductionRunServices { // Approved purchase orders resultList = EntityQuery.use(delegator).from("OrderHeaderAndItems") - .where("orderTypeId", "PURCHASE_ORDER", + .where("orderTypeId", "PURCHASE_ORDER", "itemStatusId", "ITEM_APPROVED") .orderBy("orderId").queryList(); String orderId = null; diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java index e018d07..5cf831f 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/InventoryEventPlannedServices.java @@ -58,7 +58,7 @@ public class InventoryEventPlannedServices { try { createOrUpdateMrpEvent(parameters, quantity, (String) context.get("facilityId"), (String) context.get("eventName"), false, delegator); } catch (GenericEntityException e) { - Debug.logError(e,"Error : findOne(\"MrpEvent\", parameters =)"+parameters, MODULE); + Debug.logError(e, "Error : findOne(\"MrpEvent\", parameters =)"+parameters, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); } return ServiceUtil.returnSuccess(); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java index 8223ac0..734ec71 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java @@ -66,7 +66,7 @@ public class MrpServices { Timestamp now = UtilDateTime.nowTimestamp(); Locale locale = (Locale) context.get("locale"); String facilityId = (String) context.get("facilityId"); - Integer defaultYearsOffset = (Integer)context.get("defaultYearsOffset"); + Integer defaultYearsOffset = (Integer) context.get("defaultYearsOffset"); String mrpId = (String) context.get("mrpId"); //Erases the old table for the moment and initializes it with the new orders, @@ -76,14 +76,14 @@ public class MrpServices { try { listResult = EntityQuery.use(delegator).from("MrpEvent").queryList(); } catch (GenericEntityException e) { - Debug.logError(e,"Error : findList(\"MrpEvent\", null, null, null, null, false)", MODULE); + Debug.logError(e, "Error : findList(\"MrpEvent\", null, null, null, null, false)", MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } if (listResult != null) { try { delegator.removeAll(listResult); } catch (GenericEntityException e) { - Debug.logError(e,"Error : removeAll(listResult), listResult ="+listResult, MODULE); + Debug.logError(e, "Error : removeAll(listResult), listResult ="+listResult, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventRemoveError", locale)); } } @@ -92,7 +92,7 @@ public class MrpServices { List<GenericValue> listResultRoles = new LinkedList<>(); try { listResult = EntityQuery.use(delegator).from("Requirement") - .where("requirementTypeId", "PRODUCT_REQUIREMENT","facilityId", facilityId, + .where("requirementTypeId", "PRODUCT_REQUIREMENT", "facilityId", facilityId, "statusId", "REQ_PROPOSED") .queryList(); } catch (GenericEntityException e) { @@ -114,7 +114,7 @@ public class MrpServices { } try { listResult = EntityQuery.use(delegator).from("Requirement") - .where("requirementTypeId", "INTERNAL_REQUIREMENT","facilityId", facilityId, + .where("requirementTypeId", "INTERNAL_REQUIREMENT", "facilityId", facilityId, "statusId", "REQ_PROPOSED") .queryList(); } catch (GenericEntityException e) { @@ -267,7 +267,6 @@ public class MrpServices { orderDeliverySchedule = EntityQuery.use(delegator).from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne(); } String productId = genericResult.getString("productId"); - BigDecimal shipGroupQuantity = genericResult.getBigDecimal("quantity"); BigDecimal cancelledQuantity = genericResult.getBigDecimal("cancelQuantity"); if (UtilValidate.isEmpty(shipGroupQuantity)) { @@ -299,7 +298,7 @@ public class MrpServices { if (estimatedShipDate == null) { estimatedShipDate = now; } - + parameters = UtilMisc.toMap("mrpId", mrpId, "productId", productId, "eventDate", estimatedShipDate, "mrpEventTypeId", "PUR_ORDER_RECP"); InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, shipGroupQuantity, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator); } catch (GenericEntityException e) { @@ -598,7 +597,7 @@ public class MrpServices { Timestamp now = UtilDateTime.nowTimestamp(); Locale locale = (Locale) context.get("locale"); String mrpName = (String) context.get("mrpName"); - Integer defaultYearsOffset = (Integer)context.get("defaultYearsOffset"); + Integer defaultYearsOffset = (Integer) context.get("defaultYearsOffset"); String facilityGroupId = (String) context.get("facilityGroupId"); String facilityId = (String) context.get("facilityId"); String manufacturingFacilityId = null; @@ -714,8 +713,8 @@ public class MrpServices { stockTmp = findProductMrpQoh(mrpId, product, facilityId, dispatcher, delegator); try { InventoryEventPlannedServices.createOrUpdateMrpEvent(UtilMisc.<String, Object>toMap("mrpId", mrpId, - "productId", product.getString("productId"), - "mrpEventTypeId", "INITIAL_QOH", "eventDate", now), + "productId", product.getString("productId"), + "mrpEventTypeId", "INITIAL_QOH", "eventDate", now), stockTmp, facilityId, null, false, delegator); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java index 822edf5..4e8a773 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java @@ -114,7 +114,7 @@ public class ProposedOrder { List<GenericValue> listRoutingTaskAssoc = null; if (routing == null) { try { - Map<String, Object> routingInMap = UtilMisc.<String, Object>toMap("productId", product.getString("productId"), + Map<String, Object> routingInMap = UtilMisc.<String, Object>toMap("productId", product.getString("productId"), "ignoreDefaultRouting", "Y", "userLogin", userLogin); Map<String, Object> routingOutMap = dispatcher.runSync("getProductRouting", routingInMap); if (ServiceUtil.isError(routingOutMap)) { @@ -243,7 +243,7 @@ public class ProposedOrder { tree.print(bom); requirementStartDate = tree.getRoot().getStartDate(manufacturingFacilityId, requiredByDate, true); } catch (Exception e) { - Debug.logError(e,"Error : computing the requirement start date. " + e.getMessage(), MODULE); + Debug.logError(e, "Error : computing the requirement start date. " + e.getMessage(), MODULE); } } parameters.put("productId", productId); @@ -267,7 +267,7 @@ public class ProposedOrder { } return (String) result.get("requirementId"); } catch (GenericServiceException e) { - Debug.logError(e,"Error : createRequirement with parameters = "+parameters+"--"+e.getMessage(), MODULE); + Debug.logError(e, "Error : createRequirement with parameters = "+parameters+"--"+e.getMessage(), MODULE); return null; } } diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java index e5309b1..484ea11 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java @@ -94,12 +94,12 @@ public class TechDataServices { } if (listRoutingTask.size() == 0) { //FIXME is it correct ? - // listRoutingTask.add(UtilMisc.toMap("label","no Match","value","NO_MATCH")); + // listRoutingTask.add(UtilMisc.toMap("label", "no Match", "value", "NO_MATCH")); } result.put("lookupResult", listRoutingTask); return result; } - + /** * * Used to check if there is not two routing task with the same SeqId valid at the same period @@ -126,7 +126,7 @@ public class TechDataServices { try { listRoutingTaskAssoc = EntityQuery.use(delegator).from("WorkEffortAssoc") - .where("workEffortIdFrom", workEffortIdFrom,"sequenceNum", sequenceNum) + .where("workEffortIdFrom", workEffortIdFrom, "sequenceNum", sequenceNum) .orderBy("fromDate") .queryList(); } catch (GenericEntityException e) { @@ -220,7 +220,7 @@ public class TechDataServices { int moveDay = 0; Double capacity = null; Time startTime = null; - while (capacity == null || capacity ==0) { + while (capacity == null || capacity == 0) { switch (dayStart) { case Calendar.MONDAY: capacity = techDataCalendarWeek.getDouble("mondayCapacity"); @@ -252,8 +252,8 @@ public class TechDataServices { break; } if (capacity == null || capacity == 0) { - moveDay +=1; - dayStart = (dayStart==7) ? 1 : dayStart +1; + moveDay += 1; + dayStart = (dayStart == 7) ? 1 : dayStart + 1; } } result.put("capacity", capacity); @@ -406,8 +406,8 @@ public class TechDataServices { break; } if (capacity == null || capacity == 0) { - moveDay -=1; - dayEnd = (dayEnd==1) ? 7 : dayEnd - 1; + moveDay -= 1; + dayEnd = (dayEnd == 1) ? 7 : dayEnd - 1; } } result.put("capacity", capacity); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java index dd58496..6fbd717 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java @@ -1372,7 +1372,7 @@ public class OrderReturnServices { // Call the refund service to refund the payment if (electronicTypes.contains(paymentMethodTypeId)) { try { - Map<String, Object> serviceContext = UtilMisc.toMap("orderId", orderId,"userLogin", context.get("userLogin")); + Map<String, Object> serviceContext = UtilMisc.toMap("orderId", orderId, "userLogin", context.get("userLogin")); serviceContext.put("paymentMethodId", orderPaymentPreference.getString("paymentMethodId")); serviceContext.put("paymentMethodTypeId", orderPaymentPreference.getString("paymentMethodTypeId")); serviceContext.put("statusId", orderPaymentPreference.getString("statusId")); @@ -1386,7 +1386,7 @@ public class OrderReturnServices { try { refundOrderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceNewId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderProblemsWithTheRefundSeeLogs", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithTheRefundSeeLogs", locale)); } serviceResult = dispatcher.runSync("refundPayment", UtilMisc.<String, Object>toMap("orderPaymentPreference", refundOrderPaymentPreference, "refundAmount", amountToRefund.setScale(DECIMALS, ROUNDING), "userLogin", userLogin)); if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) { @@ -1397,7 +1397,7 @@ public class OrderReturnServices { paymentId = (String) serviceResult.get("paymentId"); amountRefunded = (BigDecimal) serviceResult.get("refundAmount"); } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderProblemsWithTheRefundSeeLogs", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithTheRefundSeeLogs", locale)); } } else if ("EXT_BILLACT".equals(paymentMethodTypeId)) { try { @@ -1618,7 +1618,7 @@ public class OrderReturnServices { try { GenericValue response = EntityQuery.use(delegator).from("ReturnItemResponse").where("returnItemResponseId", responseId).queryOne(); if (response == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderReturnItemResponseNotFound", UtilMisc.toMap("errorMsg", errorMsg,"responseId", responseId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderReturnItemResponseNotFound", UtilMisc.toMap("errorMsg", errorMsg, "responseId", responseId), locale)); } BigDecimal responseAmount = response.getBigDecimal("responseAmount").setScale(DECIMALS, ROUNDING); String paymentId = response.getString("paymentId"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java index ab721bb..cb2d2bc 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java @@ -390,7 +390,7 @@ public class OrderServices { if (workEffort.getString("workEffortId").equals(orderItem.getString("orderItemSeqId"))) { List<GenericValue> selFixedAssetProduct = null; try { - selFixedAssetProduct = EntityQuery.use(delegator).from("FixedAssetProduct").where("productId", orderItem.getString("productId"),"fixedAssetProductTypeId", "FAPT_USE").filterByDate(nowTimestamp, "fromDate", "thruDate").queryList(); + selFixedAssetProduct = EntityQuery.use(delegator).from("FixedAssetProduct").where("productId", orderItem.getString("productId"), "fixedAssetProductTypeId", "FAPT_USE").filterByDate(nowTimestamp, "fromDate", "thruDate").queryList(); } catch (GenericEntityException e) { String excMsg = "Could not find related Fixed Asset for the product: " + orderItem.getString("productId"); Debug.logError(excMsg, MODULE); @@ -546,16 +546,14 @@ public class OrderServices { if (userLogin != null && userLogin.get("userLoginId") != null) { orderHeader.set("createdBy", userLogin.getString("userLoginId")); } - if (UtilValidate.isNotEmpty(context.get("isRushOrder"))) { orderHeader.set("isRushOrder", context.get("isRushOrder")); } - if (UtilValidate.isNotEmpty(context.get("priority"))) { orderHeader.set("priority", context.get("priority")); } - String invoicePerShipment = EntityUtilProperties.getPropertyValue("accounting","create.invoice.per.shipment", delegator); + String invoicePerShipment = EntityUtilProperties.getPropertyValue("accounting", "create.invoice.per.shipment", delegator); if (UtilValidate.isNotEmpty(invoicePerShipment)) { orderHeader.set("invoicePerShipment", invoicePerShipment); } @@ -1079,7 +1077,7 @@ public class OrderServices { ripCtx.put("productId", productId); ripCtx.put("facilityId", inventoryFacilityId); ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM"); - ripCtx.put("statusId","INV_AVAILABLE"); + ripCtx.put("statusId", "INV_AVAILABLE"); ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity")); ripCtx.put("quantityRejected", 0.0); // do something tricky here: run as the "system" user @@ -1534,7 +1532,7 @@ public class OrderServices { if (resetResult != null && ServiceUtil.isError(resetResult)) { Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderErrorCannotResetOrderTotals", - UtilMisc.toMap("orderId", orderId,"resetResult", ServiceUtil.getErrorMessage(resetResult)), locale), MODULE); + UtilMisc.toMap("orderId", orderId, "resetResult", ServiceUtil.getErrorMessage(resetResult)), locale), MODULE); } else { Debug.logInfo("No orders found for reset processing", MODULE); } @@ -2198,7 +2196,7 @@ public class OrderServices { dispatcher.runSyncIgnore("cancelOrderItemInvResQty", cancelOrderItemInvResCtx); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToUpdateInventoryReservations", UtilMisc.toMap("itemMsgInfo", itemMsgInfo), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToUpdateInventoryReservations", UtilMisc.toMap("itemMsgInfo", itemMsgInfo), locale)); } } // all items are cancelled -- mark the item as cancelled @@ -2299,7 +2297,7 @@ public class OrderServices { if (statusChange == null) { Debug.logWarning(UtilProperties.getMessage(RES_ERROR, - "OrderItemStatusNotChangedIsNotAValidChange", UtilMisc.toMap("orderStatusId", orderItem.getString("statusId"),"statusId", statusId), locale), MODULE); + "OrderItemStatusNotChangedIsNotAValidChange", UtilMisc.toMap("orderStatusId", orderItem.getString("statusId"), "statusId", statusId), locale), MODULE); continue; } } catch (GenericEntityException e) { @@ -2378,7 +2376,7 @@ public class OrderServices { if (orderHeader.getString("statusId").equals(statusId)) { Debug.logWarning(UtilProperties.getMessage(RES_ERROR, - "OrderTriedToSetOrderStatusWithTheSameStatusIdforOrderWithId", UtilMisc.toMap("statusId", statusId,"orderId", orderId), locale), MODULE); + "OrderTriedToSetOrderStatusWithTheSameStatusIdforOrderWithId", UtilMisc.toMap("statusId", statusId, "orderId", orderId), locale), MODULE); return successResult; } try { @@ -3369,7 +3367,7 @@ public class OrderServices { try { content = productContentItem.getRelatedOne("Content", false); } catch (GenericEntityException e) { - Debug.logError(e,"ERROR: Cannot get Content entity: " + e.getMessage(), MODULE); + Debug.logError(e, "ERROR: Cannot get Content entity: " + e.getMessage(), MODULE); continue; } @@ -3382,7 +3380,7 @@ public class OrderServices { try { custMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", content.get("customMethodId")).cache().queryOne(); } catch (GenericEntityException e) { - Debug.logError(e,"ERROR: Cannot get CustomMethod associate to Content entity: " + e.getMessage(), MODULE); + Debug.logError(e, "ERROR: Cannot get CustomMethod associate to Content entity: " + e.getMessage(), MODULE); continue; } } @@ -6191,7 +6189,7 @@ public class OrderServices { String shipGroupSeqId = (String) context.get("shipGroupSeqId"); String shippingInstructions = (String) context.get("shippingInstructions"); try { - GenericValue orderItemShipGroup = EntityQuery.use(delegator).from("OrderItemShipGroup").where("orderId", orderId,"shipGroupSeqId", shipGroupSeqId).queryFirst(); + GenericValue orderItemShipGroup = EntityQuery.use(delegator).from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryFirst(); orderItemShipGroup.set("shippingInstructions", shippingInstructions); orderItemShipGroup.store(); } catch (GenericEntityException e) { @@ -6206,7 +6204,7 @@ public class OrderServices { String shipGroupSeqId = (String) context.get("shipGroupSeqId"); String giftMessage = (String) context.get("giftMessage"); try { - GenericValue orderItemShipGroup = EntityQuery.use(delegator).from("OrderItemShipGroup").where("orderId", orderId,"shipGroupSeqId", shipGroupSeqId).queryFirst(); + GenericValue orderItemShipGroup = EntityQuery.use(delegator).from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryFirst(); orderItemShipGroup.set("giftMessage", giftMessage); orderItemShipGroup.set("isGift", "Y"); orderItemShipGroup.store(); @@ -6386,7 +6384,7 @@ public class OrderServices { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); String contactMechId = (String) context.get("contactMechId"); @@ -6480,11 +6478,11 @@ public class OrderServices { } return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> associateOrderWithAllocationPlans(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); Map<String, String> productPlanMap = new HashMap<>(); Map<String, Object> serviceResult = new HashMap<>(); @@ -6603,7 +6601,7 @@ public class OrderServices { public static Map<String, Object> approveAllocationPlanItems(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String planId = (String) context.get("planId"); Map<String, Object> serviceCtx = new HashMap<>(); Map<String, Object> serviceResult = new HashMap<>(); @@ -6667,7 +6665,7 @@ public class OrderServices { public static Map<String, Object> cancelAllocationPlanItems(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String planId = (String) context.get("planId"); Map<String, Object> serviceCtx = new HashMap<>(); Map<String, Object> serviceResult = new HashMap<>(); @@ -6704,7 +6702,7 @@ public class OrderServices { public static Map<String, Object> changeAllocationPlanStatus(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); String planId = (String) context.get("planId"); String statusId = (String) context.get("statusId"); @@ -6755,7 +6753,7 @@ public class OrderServices { public static Map<String, Object> changeAllocationPlanItemStatus(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); String planId = (String) context.get("planId"); String planItemSeqId = (String) context.get("planItemSeqId"); @@ -6805,7 +6803,7 @@ public class OrderServices { public static Map<String, Object> completeAllocationPlanItemByOrderItem(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); try { @@ -6871,7 +6869,7 @@ public class OrderServices { public static Map<String, Object> cancelAllocationPlanItemByOrderItem(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); try { @@ -6936,7 +6934,7 @@ public class OrderServices { public static Map<String, Object> updateAllocatedQuantityOnOrderItemChange(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); try { OrderReadHelper orderReadHelper = new OrderReadHelper(delegator, orderId); @@ -6983,7 +6981,7 @@ public class OrderServices { public static Map<String, Object> createAllocationPlanAndItems(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - GenericValue userLogin = (GenericValue)context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); String productId = (String) context.get("productId"); Integer itemListSize = (Integer) context.get("itemListSize"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java index c82f577..cc95eae 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java @@ -163,7 +163,7 @@ public class QuoteServices { List<GenericValue> quoteAdjustments = UtilGenerics.cast(context.get("quoteAdjustments")); Locale locale = (Locale) context.get("locale"); Map<String, Object> serviceResult = new HashMap<>(); - + //TODO create Quote Terms still to be implemented //TODO create Quote Term Attributes still to be implemented Map<String, Object> result = new HashMap<>(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java index 9d72c09..f8cc8b5 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java @@ -179,7 +179,7 @@ public class CheckOutEvents { BigDecimal billingAccountAmt = null; billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher); if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), cart.getLocale())); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), cart.getLocale())); return "error"; } selectedPaymentMethods.put("EXT_BILLACT", UtilMisc.<String, Object>toMap("amount", billingAccountAmt, "securityCode", null)); @@ -358,7 +358,7 @@ public class CheckOutEvents { BigDecimal billingAccountAmt = null; billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher); if (billingAccountAmt == null) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault()))); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault()))); return "error"; } selectedPaymentMethods.put("EXT_BILLACT", UtilMisc.<String, Object>toMap("amount", billingAccountAmt, "securityCode", null)); @@ -935,7 +935,7 @@ public class CheckOutEvents { BigDecimal billingAccountAmt = null; billingAccountAmt = determineBillingAccountAmount(billingAccountId, request.getParameter("billingAccountAmount"), dispatcher); if (billingAccountAmt == null) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault()))); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault()))); return "error"; } selectedPaymentMethods.put("EXT_BILLACT", UtilMisc.<String, Object>toMap("amount", billingAccountAmt, "securityCode", null)); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java index 08c6b5b..51a0dad 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java @@ -95,7 +95,7 @@ public class CheckOutHelper { if (UtilValidate.isNotEmpty(this.cart)) { errorMessages.addAll(setCheckOutShippingAddressInternal(shippingContactMechId)); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); } if (errorMessages.size() == 1) { @@ -118,7 +118,7 @@ public class CheckOutHelper { this.cart.setAllShippingContactMechId(shippingContactMechId); } else if (cart.shippingApplies()) { // only return an error if shipping is required for this purchase - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.select_shipping_destination", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.select_shipping_destination", cart.getLocale()); errorMessages.add(errMsg); } @@ -135,7 +135,7 @@ public class CheckOutHelper { errorMessages.addAll(setCheckOutShippingOptionsInternal(shippingMethod, shippingInstructions, orderAdditionalEmails, maySplit, giftMessage, isGift, internalCode, shipBeforeDate, shipAfterDate)); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); } @@ -170,7 +170,7 @@ public class CheckOutHelper { this.cart.setAllCarrierPartyId(carrierPartyId); } else if (cart.shippingApplies()) { // only return an error if shipping is required for this purchase - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.select_shipping_method", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.select_shipping_method", cart.getLocale()); errorMessages.add(errMsg); } @@ -180,7 +180,7 @@ public class CheckOutHelper { if (UtilValidate.isNotEmpty(maySplit)) { cart.setAllMaySplit(Boolean.valueOf(maySplit)); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.select_splitting_preference", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.select_splitting_preference", cart.getLocale()); errorMessages.add(errMsg); } @@ -229,7 +229,7 @@ public class CheckOutHelper { if (UtilValidate.isNotEmpty(this.cart)) { errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId)); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); } @@ -288,7 +288,7 @@ public class CheckOutHelper { // if an amount was entered, check that it doesn't exceed available amount if (amountToUse.compareTo(BigDecimal.ZERO) > 0 && amountToUse.compareTo(accountCredit) > 0) { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.insufficient_credit_available_on_account", + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.insufficient_credit_available_on_account", cart.getLocale()); errorMessages.add(errMsg); } else { @@ -300,7 +300,7 @@ public class CheckOutHelper { BigDecimal grandTotal = cart.getGrandTotal(); if (grandTotal.compareTo(amountToUse) > 0) { cart.setBillingAccount(null, BigDecimal.ZERO); // erase existing billing account data - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.insufficient_credit_available_on_account", + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.insufficient_credit_available_on_account", cart.getLocale()); errorMessages.add(errMsg); } else { @@ -357,7 +357,7 @@ public class CheckOutHelper { } } else if (cart.getGrandTotal().compareTo(BigDecimal.ZERO) != 0) { // only return an error if the order total is not 0.00 - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.select_method_of_payment", + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.select_method_of_payment", cart.getLocale()); errorMessages.add(errMsg); } @@ -374,7 +374,7 @@ public class CheckOutHelper { this.cart.setShipBeforeDate(shipBefore); this.cart.setShipAfterDate(shipAfter); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.no_items_in_cart", + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); } @@ -425,7 +425,7 @@ public class CheckOutHelper { errorMessages.addAll(setCheckOutPaymentInternal(selectedPaymentMethods, singleUsePayments, billingAccountId)); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.no_items_in_cart", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); } @@ -454,14 +454,14 @@ public class CheckOutHelper { boolean gcFieldsOkay = true; if (UtilValidate.isEmpty(gcNum)) { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.enter_gift_card_number", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.enter_gift_card_number", (cart != null ? cart.getLocale() : Locale.getDefault())); errorMessages.add(errMsg); gcFieldsOkay = false; } if (cart.isPinRequiredForGC(delegator)) { // if a PIN is required, make sure the PIN is valid if (UtilValidate.isEmpty(gcPin)) { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.enter_gift_card_pin_number", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.enter_gift_card_pin_number", cart.getLocale()); errorMessages.add(errMsg); gcFieldsOkay = false; } @@ -473,13 +473,13 @@ public class CheckOutHelper { if (!cart.isPinRequiredForGC(delegator)) { GenericValue finAccount = FinAccountHelper.getFinAccountFromCode(gcNum, delegator); if (finAccount == null) { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.gift_card_does_not_exist", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.gift_card_does_not_exist", cart.getLocale()); errorMessages.add(errMsg); gcFieldsOkay = false; } else if ((finAccount.getBigDecimal("availableBalance") == null) || !((finAccount.getBigDecimal("availableBalance")).compareTo(FinAccountHelper.getZero()) > 0)) { // if account's available balance (including authorizations) is not greater than zero, then return an error - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.gift_card_has_no_value", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.gift_card_has_no_value", cart.getLocale()); errorMessages.add(errMsg); gcFieldsOkay = false; } @@ -493,7 +493,7 @@ public class CheckOutHelper { if (UtilValidate.isNotEmpty(selectedPaymentMethods)) { if (UtilValidate.isEmpty(gcAmt)) { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.enter_amount_to_place_on_gift_card", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.enter_amount_to_place_on_gift_card", cart.getLocale()); errorMessages.add(errMsg); gcFieldsOkay = false; } @@ -503,7 +503,7 @@ public class CheckOutHelper { gcAmount = new BigDecimal(gcAmt); } catch (NumberFormatException e) { Debug.logError(e, MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.invalid_amount_for_gift_card", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.invalid_amount_for_gift_card", cart.getLocale()); errorMessages.add(errMsg); gcFieldsOkay = false; } @@ -543,7 +543,7 @@ public class CheckOutHelper { result.put("amount", giftCardAmount); } } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.problem_with_gift_card_information", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problem_with_gift_card_information", cart.getLocale()); errorMessages.add(errMsg); } } @@ -725,7 +725,7 @@ public class CheckOutHelper { try { party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); } catch (GenericEntityException e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderProblemsGettingPartyRecord", cart.getLocale()), MODULE); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemsGettingPartyRecord", cart.getLocale()), MODULE); } // create order contact mechs for the email address(s) @@ -769,7 +769,7 @@ public class CheckOutHelper { this.delegator.storeAll(toBeStored); } catch (GenericEntityException e) { // not a fatal error; so just print a message - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderProblemsStoringOrderEmailContactInformation", cart.getLocale()), MODULE); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemsStoringOrderEmailContactInformation", cart.getLocale()), MODULE); } } @@ -1134,7 +1134,7 @@ public class CheckOutHelper { return ServiceUtil.returnError(messages); } else { // should never happen - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderPleaseContactCustomerServicePaymentReturnCodeUnknown", Locale.getDefault())); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderPleaseContactCustomerServicePaymentReturnCodeUnknown", Locale.getDefault())); } } else { // result returned null == service failed @@ -1257,7 +1257,7 @@ public class CheckOutHelper { } } catch (GenericEntityException e) { Debug.logError(e, "Problems getting credit card from payment method", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.problems_reading_database", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_reading_database", cart.getLocale()); return ServiceUtil.returnError(errMsg); } if (creditCard != null) { @@ -1283,13 +1283,13 @@ public class CheckOutHelper { blacklistFound = EntityQuery.use(this.delegator).from("OrderBlacklist").where(exprs).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problems with OrderBlacklist lookup.", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.problems_reading_database", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_reading_database", cart.getLocale()); return ServiceUtil.returnError(errMsg); } } if (UtilValidate.isNotEmpty(blacklistFound)) { - return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR,"OrderFailed", cart.getLocale())); + return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "OrderFailed", cart.getLocale())); } return ServiceUtil.returnSuccess("success"); } @@ -1315,7 +1315,7 @@ public class CheckOutHelper { } } catch (GenericEntityException e) { Debug.logError(e, MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.database_error", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.database_error", cart.getLocale()); result = ServiceUtil.returnError(errMsg); return result; } @@ -1340,7 +1340,7 @@ public class CheckOutHelper { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problems getting order header", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.problems_getting_order_header", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_getting_order_header", (cart != null ? cart.getLocale() : Locale.getDefault())); result = ServiceUtil.returnError(errMsg); return result; } @@ -1350,7 +1350,7 @@ public class CheckOutHelper { paymentPrefs = orderHeader.getRelated("OrderPaymentPreference", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, "Problems getting order payments", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.problems_getting_payment_preference", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.problems_getting_payment_preference", (cart != null ? cart.getLocale() : Locale.getDefault())); result = ServiceUtil.returnError(errMsg); return result; } @@ -1406,7 +1406,7 @@ public class CheckOutHelper { } result = ServiceUtil.returnSuccess(); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.enter_shipping_address", (cart != null ? cart.getLocale() : Locale.getDefault())); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.enter_shipping_address", (cart != null ? cart.getLocale() : Locale.getDefault())); result = ServiceUtil.returnError(errMsg); } @@ -1457,7 +1457,7 @@ public class CheckOutHelper { this.cart.setShipmentMethodTypeId(shipGroupIndex, shipmentMethodTypeId); this.cart.setCarrierPartyId(shipGroupIndex, carrierPartyId); } else { - errMsg = UtilProperties.getMessage(RES_ERROR,"checkhelper.select_shipping_method", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.select_shipping_method", cart.getLocale()); result = ServiceUtil.returnError(errMsg); } @@ -1494,7 +1494,7 @@ public class CheckOutHelper { } try { - this.cart.setShipAfterDate(shipGroupIndex, (Timestamp) ObjectType.simpleTypeOrObjectConvert(shipAfterDate,"Timestamp", null, null)); + this.cart.setShipAfterDate(shipGroupIndex, (Timestamp) ObjectType.simpleTypeOrObjectConvert(shipAfterDate, "Timestamp", null, null)); } catch (Exception e) { errMsg = "Ship After Date must be a valid date formed "; result = ServiceUtil.returnError(errMsg); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java index 183efd5..bd349da 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java @@ -494,7 +494,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { supplierProduct = productSuppliers.get(0); } } catch (GenericServiceException e) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderRunServiceGetSuppliersForProductError", locale) + e.getMessage(), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetSuppliersForProductError", locale) + e.getMessage(), MODULE); } return supplierProduct; } @@ -1132,7 +1132,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { String checkResult = ProductPromoWorker.checkCanUsePromoCode(promoCode, partyId, this.getDelegator(), locale); if (checkResult != null) { promoCodeIter.remove(); - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderOnUserChangePromoCodeWasRemovedBecause", UtilMisc.toMap("checkResult", checkResult), locale), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderOnUserChangePromoCodeWasRemovedBecause", UtilMisc.toMap("checkResult", checkResult), locale), MODULE); } } @@ -1260,7 +1260,6 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { public Timestamp getDefaultShipAfterDate() { return this.defaultShipAfterDate != null ? (Timestamp) this.defaultShipAfterDate.clone() : null; } - public void setDefaultReserveAfterDate(Timestamp defaultReserveAfterDate) { this.defaultReserveAfterDate = defaultReserveAfterDate != null ? (Timestamp) defaultReserveAfterDate.clone() : null; } @@ -4218,7 +4217,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { facilityId = productStore.getString("inventoryFacilityId"); storeRequirementMethodEnumId = productStore.getString("requirementMethodEnumId"); } catch (GenericEntityException gee) { - Debug.logError(UtilProperties.getMessage(RES_ERROR,"OrderProblemGettingProductStoreRecords", locale) + gee.getMessage(), MODULE); + Debug.logError(UtilProperties.getMessage(RES_ERROR, "OrderProblemGettingProductStoreRecords", locale) + gee.getMessage(), MODULE); return; } } @@ -4301,7 +4300,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { } } catch (GenericServiceException gee) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderRunServiceGetInventoryAvailableByFacilityError", locale) + gee.getMessage(), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetInventoryAvailableByFacilityError", locale) + gee.getMessage(), MODULE); } } else { @@ -4331,7 +4330,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { supplierPartyId = supplierProduct.getString("partyId"); } } catch (GenericServiceException e) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderRunServiceGetSuppliersForProductError", locale) + e.getMessage(), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderRunServiceGetSuppliersForProductError", locale) + e.getMessage(), MODULE); } // Leave the items untouched if we couldn't find a supplier diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java index 93f797f..abe58e4 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java @@ -775,7 +775,7 @@ public class ShoppingCartEvents { if (thisOrder == null) { cart.setOrderId(orderId); } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderIdAlreadyExistsPleaseChooseAnother", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderIdAlreadyExistsPleaseChooseAnother", locale)); return "error"; } } @@ -1091,11 +1091,11 @@ public class ShoppingCartEvents { Locale locale = UtilHttp.getLocale(request); if (UtilValidate.isEmpty(alternateGwpProductId)) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderCouldNotSelectAlternateGiftNoAlternateGwpProductIdPassed", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderCouldNotSelectAlternateGiftNoAlternateGwpProductIdPassed", locale)); return "error"; } if (UtilValidate.isEmpty(alternateGwpLineStr)) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderCouldNotSelectAlternateGiftNoAlternateGwpLinePassed", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderCouldNotSelectAlternateGiftNoAlternateGwpLinePassed", locale)); return "error"; } @@ -1103,7 +1103,7 @@ public class ShoppingCartEvents { try { alternateGwpLine = Integer.parseInt(alternateGwpLineStr); } catch (Exception e) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderCouldNotSelectAlternateGiftAlternateGwpLineIsNotAValidNumber", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderCouldNotSelectAlternateGiftAlternateGwpLineIsNotAValidNumber", locale)); return "error"; } @@ -1145,7 +1145,7 @@ public class ShoppingCartEvents { int i; if (UtilValidate.isEmpty(partyId) || UtilValidate.isEmpty(roleTypeId) || roleTypeId.length < 1) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderPartyIdAndOrRoleTypeIdNotDefined", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderPartyIdAndOrRoleTypeIdNotDefined", locale)); return "error"; } @@ -1177,7 +1177,7 @@ public class ShoppingCartEvents { int i; if (UtilValidate.isEmpty(partyId) || roleTypeId.length < 1) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderPartyIdAndOrRoleTypeIdNotDefined", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderPartyIdAndOrRoleTypeIdNotDefined", locale)); return "error"; } @@ -1620,7 +1620,7 @@ public class ShoppingCartEvents { cart.setOrderType(orderMode); session.setAttribute("orderMode", orderMode); } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderPleaseSelectEitherSaleOrPurchaseOrder", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderPleaseSelectEitherSaleOrPurchaseOrder", locale)); return "error"; } @@ -1658,7 +1658,7 @@ public class ShoppingCartEvents { if (hasPermission) { cart = getCartObject(request, null, productStore.getString("defaultCurrencyUomId")); } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderYouDoNotHavePermissionToTakeOrdersForThisStore", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderYouDoNotHavePermissionToTakeOrdersForThisStore", locale)); cart.clear(); session.removeAttribute("orderMode"); return "error"; @@ -1670,7 +1670,7 @@ public class ShoppingCartEvents { } if ("SALES_ORDER".equals(cart.getOrderType()) && UtilValidate.isEmpty(cart.getProductStoreId())) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderAProductStoreMustBeSelectedForASalesOrder", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderAProductStoreMustBeSelectedForASalesOrder", locale)); cart.clear(); session.removeAttribute("orderMode"); return "error"; @@ -1715,7 +1715,7 @@ public class ShoppingCartEvents { return "error"; } if (thisParty == null) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderCouldNotLocateTheSelectedParty", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderCouldNotLocateTheSelectedParty", locale)); return "error"; } cart.setOrderPartyId(partyId); @@ -1955,7 +1955,7 @@ public class ShoppingCartEvents { if (thisOrder == null) { cart.setOrderId(orderId); } else { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderIdAlreadyExistsPleaseChooseAnother", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderIdAlreadyExistsPleaseChooseAnother", locale)); return "error"; } } @@ -2077,9 +2077,9 @@ public class ShoppingCartEvents { try { itemDesiredDeliveryDate = Timestamp.valueOf(itemDesiredDeliveryDateStr); } catch (Exception e) { - Debug.logWarning(e,"Problems parsing Reservation start string: " + itemDesiredDeliveryDateStr, MODULE); + Debug.logWarning(e, "Problems parsing Reservation start string: " + itemDesiredDeliveryDateStr, MODULE); itemDesiredDeliveryDate = null; - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"shoppingCartEvents.problem_parsing_item_desiredDeliveryDate_string", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "shoppingCartEvents.problem_parsing_item_desiredDeliveryDate_string", locale)); } } if (paramMap.containsKey("itemType" + thisSuffix)) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java index 024a10b..68b90a1 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java @@ -165,7 +165,7 @@ public class ShoppingCartHelper { try { java.sql.Timestamp.valueOf((String) context.get("itemDesiredDeliveryDate")); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderInvalidDesiredDeliveryDateSyntaxError", this.cart.getLocale())); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderInvalidDesiredDeliveryDateSyntaxError", this.cart.getLocale())); } } else { context.remove("itemDesiredDeliveryDate"); @@ -296,7 +296,7 @@ public class ShoppingCartHelper { String errMsg = null; if (UtilValidate.isEmpty(orderId)) { - errMsg = UtilProperties.getMessage(RES_ERROR,"cart.order_not_specified_to_add_from", this.cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "cart.order_not_specified_to_add_from", this.cart.getLocale()); result = ServiceUtil.returnError(errMsg); return result; } @@ -373,7 +373,7 @@ public class ShoppingCartHelper { if (noItems) { result = ServiceUtil.returnSuccess(); - result.put("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderNoItemsFoundToAdd", this.cart.getLocale())); + result.put("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderNoItemsFoundToAdd", this.cart.getLocale())); return result; // don't return error because this is a non-critical error and should go back to the same page } @@ -591,7 +591,7 @@ public class ShoppingCartHelper { String errMsg = null; if (UtilValidate.isEmpty(categoryId)) { - errMsg = UtilProperties.getMessage(RES_ERROR,"cart.category_not_specified_to_add_from", this.cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "cart.category_not_specified_to_add_from", this.cart.getLocale()); result = ServiceUtil.returnError(errMsg); return result; } @@ -604,14 +604,14 @@ public class ShoppingCartHelper { Debug.logWarning(e.toString(), MODULE); Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("categoryId", categoryId); messageMap.put("message", e.getMessage()); - errMsg = UtilProperties.getMessage(RES_ERROR,"cart.could_not_get_products_in_category_cart", messageMap, this.cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "cart.could_not_get_products_in_category_cart", messageMap, this.cart.getLocale()); result = ServiceUtil.returnError(errMsg); return result; } if (prodCatMemberCol == null) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("categoryId", categoryId); - errMsg = UtilProperties.getMessage(RES_ERROR,"cart.could_not_get_products_in_category", messageMap, this.cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "cart.could_not_get_products_in_category", messageMap, this.cart.getLocale()); result = ServiceUtil.returnError(errMsg); return result; } @@ -734,7 +734,7 @@ public class ShoppingCartHelper { } else if (parameterName.toUpperCase(Locale.getDefault()).startsWith("COMMENT")) { itemComment= quantString; // the quantString is actually the comment if the field name starts with COMMENT } else if (parameterName.startsWith("reservStart")) { - if (quantString.length() ==0) { + if (quantString.length() == 0) { // should have format: yyyy-mm-dd hh:mm:ss.fffffffff quantString += " 00:00:00.000000000"; } @@ -1048,12 +1048,12 @@ public class ShoppingCartHelper { GenericValue agreement = null; if ((this.delegator == null) || (this.dispatcher == null) || (this.cart == null)) { - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderDispatcherOrDelegatorOrCartArgumentIsNull", this.cart.getLocale())); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderDispatcherOrDelegatorOrCartArgumentIsNull", this.cart.getLocale())); return result; } if ((agreementId == null) || (agreementId.length() <= 0)) { - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderNoAgreementSpecified", this.cart.getLocale())); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementSpecified", this.cart.getLocale())); return result; } @@ -1061,12 +1061,12 @@ public class ShoppingCartHelper { agreement = EntityQuery.use(this.delegator).from("Agreement").where("agreementId", agreementId).cache(true).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.toString(), MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderCouldNotGetAgreement", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale()) + UtilProperties.getMessage(RES_ERROR,"OrderError", this.cart.getLocale()) + e.getMessage()); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderCouldNotGetAgreement", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale()) + UtilProperties.getMessage(RES_ERROR, "OrderError", this.cart.getLocale()) + e.getMessage()); return result; } if (agreement == null) { - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderCouldNotGetAgreement", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale())); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderCouldNotGetAgreement", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale())); } else { // set the agreement id in the cart cart.setAgreementId(agreementId); @@ -1080,14 +1080,14 @@ public class ShoppingCartHelper { try { cart.setCurrency(dispatcher, currencyUomId); } catch (CartItemModifyException ex) { - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderSetCurrencyError", this.cart.getLocale()) + ex.getMessage()); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderSetCurrencyError", this.cart.getLocale()) + ex.getMessage()); return result; } } } } catch (GenericEntityException e) { Debug.logWarning(e.toString(), MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderCouldNotGetAgreementItemsThrough", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale()) + UtilProperties.getMessage(RES_ERROR,"OrderError", this.cart.getLocale()) + e.getMessage()); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderCouldNotGetAgreementItemsThrough", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale()) + UtilProperties.getMessage(RES_ERROR, "OrderError", this.cart.getLocale()) + e.getMessage()); return result; } @@ -1108,7 +1108,7 @@ public class ShoppingCartHelper { } } catch (GenericEntityException e) { Debug.logWarning(e.toString(), MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderCouldNotGetAgreementTermsThrough", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale()) + UtilProperties.getMessage(RES_ERROR,"OrderError", this.cart.getLocale()) + e.getMessage()); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderCouldNotGetAgreementTermsThrough", UtilMisc.toMap("agreementId", agreementId), this.cart.getLocale()) + UtilProperties.getMessage(RES_ERROR, "OrderError", this.cart.getLocale()) + e.getMessage()); return result; } } @@ -1122,7 +1122,7 @@ public class ShoppingCartHelper { this.cart.setCurrency(this.dispatcher, currencyUomId); result = ServiceUtil.returnSuccess(); } catch (CartItemModifyException ex) { - result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderSetCurrencyError", this.cart.getLocale()) + ex.getMessage()); + result = ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderSetCurrencyError", this.cart.getLocale()) + ex.getMessage()); return result; } return result; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java index 809816b..a0b1b3b 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java @@ -1059,7 +1059,7 @@ public class ShoppingCartItem implements java.io.Serializable { try { ShoppingListEvents.fillAutoSaveList(cart, dispatcher); } catch (GeneralException e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderUnableToStoreAutoSaveCart", locale)); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderUnableToStoreAutoSaveCart", locale)); } } } @@ -1489,7 +1489,7 @@ public class ShoppingCartItem implements java.io.Serializable { try { return Timestamp.valueOf(ddDate); } catch (IllegalArgumentException e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderProblemGettingItemDesiredDeliveryDateFor", UtilMisc.toMap("productId", this.getProductId()), locale)); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemGettingItemDesiredDeliveryDateFor", UtilMisc.toMap("productId", this.getProductId()), locale)); return null; } } @@ -1593,7 +1593,7 @@ public class ShoppingCartItem implements java.io.Serializable { try { orderItemType = this.getDelegator().findOne("OrderItemType", UtilMisc.toMap("orderItemTypeId", this.getItemType()), true); } catch (GenericEntityException e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderProblemsGettingOrderItemTypeFor", UtilMisc.toMap("orderItemTypeId", this.getItemType()), locale)); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemsGettingOrderItemTypeFor", UtilMisc.toMap("orderItemTypeId", this.getItemType()), locale)); } } if (orderItemType != null) { @@ -1885,7 +1885,7 @@ public class ShoppingCartItem implements java.io.Serializable { if (product != null) { try { List<GenericValue> featureAppls = product.getRelated("ProductFeatureAndAppl", null, null, false); - features=EntityUtil.filterByAnd(featureAppls, UtilMisc.toMap("productFeatureApplTypeId","STANDARD_FEATURE")); + features=EntityUtil.filterByAnd(featureAppls, UtilMisc.toMap("productFeatureApplTypeId", "STANDARD_FEATURE")); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get features from product : " + product.get("productId"), MODULE); } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java index 5fc4ab9..ae6139a 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java @@ -131,7 +131,7 @@ public class ShoppingCartServices { cart.setIsGift(idx, isGift); } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderCartShipGroupNotFound", UtilMisc.toMap("groupIndex", groupIndex), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderCartShipGroupNotFound", UtilMisc.toMap("groupIndex", groupIndex), locale)); } return ServiceUtil.returnSuccess(); } @@ -139,7 +139,7 @@ public class ShoppingCartServices { public static Map<String, Object>setPaymentOptions(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderServiceNotYetImplemented", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderServiceNotYetImplemented", locale)); } public static Map<String, Object>setOtherOptions(DispatchContext dctx, Map<String, Object> context) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java index 3e1951b..9fe56f0 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java @@ -106,7 +106,7 @@ public final class ProductPromoWorker { Debug.logError(e, "Error looking up store with id " + productStoreId, MODULE); } if (productStore == null) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE); return productPromos; } @@ -172,7 +172,7 @@ public final class ProductPromoWorker { Debug.logError(e, "Error looking up store with id " + productStoreId, MODULE); } if (productStore == null) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE); return promoCodes; } try { @@ -212,7 +212,7 @@ public final class ProductPromoWorker { Debug.logError(e, "Error looking up store with id " + productStoreId, MODULE); } if (productStore == null) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE); return productPromoList; } @@ -257,7 +257,7 @@ public final class ProductPromoWorker { Debug.logError(e, "Error looking up agreement with id " + agreementId, MODULE); } if (agreement == null) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderNoAgreementFoundWithIdNotDoingPromotions", UtilMisc.toMap("agreementId", agreementId), cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementFoundWithIdNotDoingPromotions", UtilMisc.toMap("agreementId", agreementId), cart.getLocale()), MODULE); return productPromoList; } GenericValue agreementItem = null; @@ -267,7 +267,7 @@ public final class ProductPromoWorker { Debug.logError(e, "Error looking up agreement items for agreement with id " + agreementId, MODULE); } if (agreementItem == null) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderNoAgreementItemFoundForAgreementWithIdNotDoingPromotions", UtilMisc.toMap("agreementId", agreementId), cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementItemFoundForAgreementWithIdNotDoingPromotions", UtilMisc.toMap("agreementId", agreementId), cart.getLocale()), MODULE); return productPromoList; } @@ -963,7 +963,7 @@ public final class ProductPromoWorker { } } } - + if (serviceName != null) { Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("productPromoCond", productPromoCond, "shoppingCart", cart, "nowTimestamp", nowTimestamp); Map<String, Object> condResult = null; @@ -977,7 +977,6 @@ public final class ProductPromoWorker { if (condResult.containsKey("operatorEnumId")) { operatorEnumId = (String) condResult.get("operatorEnumId"); } - if (Debug.verboseOn()) Debug.logVerbose("Condition compare done, compareBase=" + compareBase, MODULE); if (compareBase != null) { int compare = compareBase; @@ -994,7 +993,7 @@ public final class ProductPromoWorker { } else if ("PPC_GTE".equals(operatorEnumId)) { if (compare >= 0) return true; } else { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderAnUnSupportedProductPromoCondCondition", UtilMisc.toMap("operatorEnumId", operatorEnumId) , cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderAnUnSupportedProductPromoCondCondition", UtilMisc.toMap("operatorEnumId", operatorEnumId) , cart.getLocale()), MODULE); return false; } } @@ -1061,7 +1060,7 @@ public final class ProductPromoWorker { || ("PPC_GT".equals(operatorEnumId) && compare > 0) || ("PPC_GTE".equals(operatorEnumId) && compare >= 0); if (!res) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderAnUnSupportedProductPromoCondCondition", + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderAnUnSupportedProductPromoCondCondition", UtilMisc.toMap("operatorEnumId", operatorEnumId) , cart.getLocale()), MODULE); } return res; @@ -1098,7 +1097,6 @@ public final class ProductPromoWorker { String productPromoActionEnumId = productPromoAction.getString("productPromoActionEnumId"); String serviceName = null; GenericValue customMethod = productPromoAction.getRelatedOne("CustomMethod", true); - if (customMethod != null) { serviceName = customMethod.getString("customMethodName"); } else { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java index 86c77b5..f0de811 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java @@ -299,7 +299,6 @@ public class ShippingEvents { } return genericShipAmt; } - public static String getShipmentCustomMethod(Delegator delegator, String shipmentCustomMethodId) { String serviceName = null; GenericValue customMethod = null; @@ -346,7 +345,7 @@ public class ShippingEvents { context.put("serviceConfigProps", configProps); context.put("shipmentCustomMethodId", shipmentCustomMethodId); context.put("shipmentGatewayConfigId", shipmentGatewayConfigId); - + // invoke the service Map<String, Object> serviceResp = null; try { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java index 89a3e19..fb0984b 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java @@ -114,7 +114,7 @@ public class ShoppingListEvents { } } catch (GenericServiceException e) { Debug.logError(e, "Problems creating new ShoppingList", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.cannot_create_new_shopping_list", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.cannot_create_new_shopping_list", cart.getLocale()); throw new IllegalArgumentException(errMsg); } // get the new list id @@ -124,7 +124,7 @@ public class ShoppingListEvents { // if no list was created throw an error if (shoppingListId == null || shoppingListId.equals("")) { - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.shoppingListId_is_required_parameter", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.shoppingListId_is_required_parameter", cart.getLocale()); throw new IllegalArgumentException(errMsg); } } else if (!append) { @@ -141,7 +141,7 @@ public class ShoppingListEvents { try { cartIdInt = Integer.valueOf(item2); } catch (Exception e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderIllegalCharacterInSelectedItemField", cart.getLocale()), MODULE); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderIllegalCharacterInSelectedItemField", cart.getLocale()), MODULE); } if (cartIdInt != null) { ShoppingCartItem item = cart.findCartItem(cartIdInt); @@ -164,7 +164,7 @@ public class ShoppingListEvents { } } catch (GenericServiceException e) { Debug.logError(e, "Problems creating ShoppingList item entity", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.error_adding_item_to_shopping_list", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.error_adding_item_to_shopping_list", cart.getLocale()); throw new IllegalArgumentException(errMsg); } } @@ -200,7 +200,7 @@ public class ShoppingListEvents { // no list; no add if (shoppingListId == null) { - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.choose_shopping_list", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.choose_shopping_list", cart.getLocale()); throw new IllegalArgumentException(errMsg); } @@ -210,7 +210,7 @@ public class ShoppingListEvents { try { shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); if (shoppingList == null) { - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale()); throw new IllegalArgumentException(errMsg); } @@ -230,13 +230,13 @@ public class ShoppingListEvents { } catch (GenericEntityException e) { Debug.logError(e, "Problems getting ShoppingList and ShoppingListItem records", MODULE); - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale()); throw new IllegalArgumentException(errMsg); } // no items; not an error; just mention that nothing was added if (UtilValidate.isEmpty(shoppingListItems)) { - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.no_items_added", cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.no_items_added", cart.getLocale()); return errMsg; } @@ -288,17 +288,17 @@ public class ShoppingListEvents { cart.addOrIncreaseItem(productId, null, quantity, reservStart, reservLength, reservPersons, null, null, null, null, null, attributes, prodCatalogId, configWrapper, null, null, null, dispatcher); } Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.added_product_to_cart", messageMap, cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.added_product_to_cart", messageMap, cart.getLocale()); eventMessage.append(errMsg).append("\n"); } catch (CartItemModifyException e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderProblemsAddingItemFromListToCart", cart.getLocale())); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProblemsAddingItemFromListToCart", cart.getLocale())); Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.problem_adding_product_to_cart", messageMap, cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.problem_adding_product_to_cart", messageMap, cart.getLocale()); eventMessage.append(errMsg).append("\n"); } catch (ItemNotFoundException e) { - Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR,"OrderProductNotFound", cart.getLocale())); + Debug.logWarning(e, UtilProperties.getMessage(RES_ERROR, "OrderProductNotFound", cart.getLocale())); Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - errMsg = UtilProperties.getMessage(RES_ERROR,"shoppinglistevents.problem_adding_product_to_cart", messageMap, cart.getLocale()); + errMsg = UtilProperties.getMessage(RES_ERROR, "shoppinglistevents.problem_adding_product_to_cart", messageMap, cart.getLocale()); eventMessage.append(errMsg).append("\n"); } } @@ -343,7 +343,7 @@ public class ShoppingListEvents { return "error"; } } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(RES_ERROR,"shoppingListEvents.error_calling_update", locale) + ": " + e.toString(); + String errMsg = UtilProperties.getMessage(RES_ERROR, "shoppingListEvents.error_calling_update", locale) + ": " + e.toString(); request.setAttribute("_ERROR_MESSAGE_", errMsg); String errorMsg = "Error calling the updateShoppingListItem in handleShoppingListItemVariant: " + e.toString(); Debug.logError(e, errorMsg, MODULE); @@ -454,7 +454,7 @@ public class ShoppingListEvents { if (userLogin == null) { userLogin = (GenericValue) session.getAttribute("autoUserLogin"); } - + if (!ProductStoreWorker.autoSaveCart(productStore) || userLogin == null) { // if auto-save is disabled or there is still no userLogin just return here return "success"; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java index 4832a3e..e6836aa 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java @@ -77,7 +77,7 @@ public class ShoppingListServices { Locale locale = (Locale) context.get("locale"); if (frequency == null || interval == null) { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR,"OrderFrequencyOrIntervalWasNotSpecified", locale), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderFrequencyOrIntervalWasNotSpecified", locale), MODULE); return ServiceUtil.returnSuccess(); } @@ -93,7 +93,7 @@ public class ShoppingListServices { startDate = UtilDateTime.getYearStart(UtilDateTime.nowTimestamp(), 0, interval); break; default: - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderInvalidFrequencyForShoppingListRecurrence", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderInvalidFrequencyForShoppingListRecurrence", locale)); } } @@ -108,7 +108,7 @@ public class ShoppingListServices { recInfo = RecurrenceInfo.makeInfo(delegator, startTime, frequency, interval, -1, endTime); } catch (RecurrenceInfoException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToCreateShoppingListRecurrenceInformation", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToCreateShoppingListRecurrenceInformation", locale)); } Debug.logInfo("Next Recurrence - " + UtilDateTime.getTimestamp(recInfo.next()), MODULE); @@ -271,7 +271,7 @@ public class ShoppingListServices { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToLocateOrder", UtilMisc.toMap("orderId", orderId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToLocateOrder", UtilMisc.toMap("orderId", orderId), locale)); } String productStoreId = orderHeader.getString("productStoreId"); @@ -294,7 +294,7 @@ public class ShoppingListServices { newListResult = dispatcher.runSync("createShoppingList", serviceCtx, 90, true); } catch (GenericServiceException e) { Debug.logError(e, "Problems creating new ShoppingList", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToCreateNewShoppingList", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToCreateNewShoppingList", locale)); } // check for errors @@ -312,7 +312,7 @@ public class ShoppingListServices { shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); if (shoppingList == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderNoShoppingListAvailable", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderNoShoppingListAvailable", locale)); } shoppingListTypeId = shoppingList.getString("shoppingListTypeId"); @@ -321,7 +321,7 @@ public class ShoppingListServices { orh = new OrderReadHelper(orderHeader); } catch (IllegalArgumentException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToLoadOrderReadHelper", UtilMisc.toMap("orderId", orderId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToLoadOrderReadHelper", UtilMisc.toMap("orderId", orderId), locale)); } List<GenericValue> orderItems = orh.getOrderItems(); @@ -349,7 +349,7 @@ public class ShoppingListServices { Debug.logError(e, MODULE); } if (serviceResult == null || ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToAddItemToShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToAddItemToShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId), locale)); } } } @@ -381,7 +381,7 @@ public class ShoppingListServices { } if (slUpResp == null || ServiceUtil.isError(slUpResp)) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToUpdateShoppingListInformation", UtilMisc.toMap("shoppingListId", shoppingListId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToUpdateShoppingListInformation", UtilMisc.toMap("shoppingListId", shoppingListId), locale)); } } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java index 1cd4c54..9273e01 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/task/TaskEvents.java @@ -63,7 +63,7 @@ public class TaskEvents { try { fromDate = (java.sql.Timestamp) ObjectType.simpleTypeOrObjectConvert(fromDateStr, "java.sql.Timestamp", null, null); } catch (GeneralException e) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderInvalidDateFormatForFromDate", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderInvalidDateFormatForFromDate", locale)); return "error"; } @@ -79,7 +79,7 @@ public class TaskEvents { return "error"; } } catch (GenericServiceException e) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderProblemsInvokingTheCompleteAssignmentService", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsInvokingTheCompleteAssignmentService", locale)); return "error"; } @@ -97,7 +97,7 @@ public class TaskEvents { eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response); } catch (EventHandlerException e) { Debug.logError(e, "Invocation error", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderFailedToInvokeTheWfAcceptRoleAssignmentService", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderFailedToInvokeTheWfAcceptRoleAssignmentService", locale)); return "error"; } return "success"; @@ -116,7 +116,7 @@ public class TaskEvents { eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response); } catch (EventHandlerException e) { Debug.logError(e, "Invocation error", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR,"OrderFailedToInvokeTheWfDelegateAndAcceptAssignmentService", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderFailedToInvokeTheWfDelegateAndAcceptAssignmentService", locale)); return "error"; } return "success"; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java index 028dbc0..842c41d 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java @@ -72,7 +72,7 @@ public class PurchaseOrderTest extends OFBizTestCase { ctx.put("orderItemContactMechs", orderItemContactMechs); GenericValue orderItemShipGroup = delegator.makeValue("OrderItemShipGroup", UtilMisc.toMap("carrierPartyId", "UPS", "contactMechId", "9000", "isGift", "N", "maySplit", "N", "shipGroupSeqId", "00001", "shipmentMethodTypeId", "NEXT_DAY")); - orderItemShipGroup.set("carrierRoleTypeId","CARRIER"); + orderItemShipGroup.set("carrierRoleTypeId", "CARRIER"); List <GenericValue> orderItemShipGroupInfo = new LinkedList<>(); orderItemShipGroupInfo.add(orderItemShipGroup); ctx.put("orderItemShipGroupInfo", orderItemShipGroupInfo); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareServices.java index 0d972e7..15c01ae 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/taxware/TaxwareServices.java @@ -34,7 +34,7 @@ import com.ibm.icu.math.BigDecimal; * TaxwareServices */ public class TaxwareServices { - + private static final String MODULE = TaxwareServices.class.getName(); public static Map calcTax(DispatchContext dctx, Map context) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java index d2a41f9..6a24bf3 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java @@ -75,7 +75,7 @@ public class ZipSalesServices { // do security check if (!security.hasPermission("SERVICE_INVOKE_ANY", userLogin)) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderYouDoNotHavePermissionToLoadTaxTables", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderYouDoNotHavePermissionToLoadTaxTables", locale)); } // get a now stamp (we'll use 2000-01-01) @@ -87,13 +87,13 @@ public class ZipSalesServices { tdf = DataFile.makeDataFile(UtilURL.fromResource(dataFile), flatTable); } catch (DataFileException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToReadZipSalesDataFile", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToReadZipSalesDataFile", locale)); } // locate the file to be imported URL tUrl = UtilURL.fromResource(taxFileLocation); if (tUrl == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToLocateTaxFileAtLocation", UtilMisc.toMap("taxFileLocation", taxFileLocation), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToLocateTaxFileAtLocation", UtilMisc.toMap("taxFileLocation", taxFileLocation), locale)); } RecordIterator tri = null; @@ -101,7 +101,7 @@ public class ZipSalesServices { tri = tdf.makeRecordIterator(tUrl); } catch (DataFileException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderProblemGettingTheRecordIterator", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemGettingTheRecordIterator", locale)); } if (tri != null) { while (tri.hasNext()) { @@ -142,7 +142,7 @@ public class ZipSalesServices { delegator.createOrStore(newValue); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderErrorWritingRecordsToTheDatabase", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorWritingRecordsToTheDatabase", locale)); } // console log @@ -156,13 +156,13 @@ public class ZipSalesServices { rdf = DataFile.makeDataFile(UtilURL.fromResource(dataFile), ruleTable); } catch (DataFileException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToReadZipSalesDataFile", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToReadZipSalesDataFile", locale)); } // locate the file to be imported URL rUrl = UtilURL.fromResource(ruleFileLocation); if (rUrl == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderUnableToLocateRuleFileFromLocation", UtilMisc.toMap("ruleFileLocation", ruleFileLocation), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderUnableToLocateRuleFileFromLocation", UtilMisc.toMap("ruleFileLocation", ruleFileLocation), locale)); } RecordIterator rri = null; @@ -170,7 +170,7 @@ public class ZipSalesServices { rri = rdf.makeRecordIterator(rUrl); } catch (DataFileException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderProblemGettingTheRecordIterator", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemGettingTheRecordIterator", locale)); } if (rri != null) { while (rri.hasNext()) { @@ -198,7 +198,7 @@ public class ZipSalesServices { delegator.storeAll(UtilMisc.toList(newValue)); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderErrorWritingRecordsToTheDatabase", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorWritingRecordsToTheDatabase", locale)); } // console log diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java index 1d7cea0..aca3ce4 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java @@ -89,12 +89,12 @@ public class CommunicationEventServices { // find the communication event and make sure that it is actually an email GenericValue communicationEvent = EntityQuery.use(delegator).from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne(); if (communicationEvent == null) { - String errMsg = UtilProperties.getMessage(RESOURCE,"commeventservices.communication_event_not_found_failure", locale); + String errMsg = UtilProperties.getMessage(RESOURCE, "commeventservices.communication_event_not_found_failure", locale); return ServiceUtil.returnError(errMsg + " " + communicationEventId); } String communicationEventType = communicationEvent.getString("communicationEventTypeId"); if (communicationEventType == null || !("EMAIL_COMMUNICATION".equals(communicationEventType) || "AUTO_EMAIL_COMM".equals(communicationEventType))) { - String errMsg = UtilProperties.getMessage(RESOURCE,"commeventservices.communication_event_must_be_email_for_email", locale); + String errMsg = UtilProperties.getMessage(RESOURCE, "commeventservices.communication_event_must_be_email_for_email", locale); return ServiceUtil.returnError(errMsg + " " + communicationEventId); } @@ -102,7 +102,7 @@ public class CommunicationEventServices { if ((communicationEvent.getRelatedOne("FromContactMech", false) == null) || (!("EMAIL_ADDRESS".equals(communicationEvent.getRelatedOne("FromContactMech", false).getString("contactMechTypeId"))) || (communicationEvent.getRelatedOne("FromContactMech", false).getString("infoString") == null))) { - String errMsg = UtilProperties.getMessage(RESOURCE,"commeventservices.communication_event_from_contact_mech_must_be_email", locale); + String errMsg = UtilProperties.getMessage(RESOURCE, "commeventservices.communication_event_from_contact_mech_must_be_email", locale); return ServiceUtil.returnError(errMsg + " " + communicationEventId); } @@ -155,7 +155,7 @@ public class CommunicationEventServices { } } if (UtilValidate.isEmpty(sendTo)) { - String errMsg = UtilProperties.getMessage(RESOURCE,"commeventservices.communication_event_to_contact_mech_must_be_email", locale); + String errMsg = UtilProperties.getMessage(RESOURCE, "commeventservices.communication_event_to_contact_mech_must_be_email", locale); return ServiceUtil.returnError(errMsg + " " + communicationEventId); } diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java b/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java index 6123541..58eb9a5 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java @@ -135,7 +135,7 @@ public class PartyContentWrapper implements ContentWrapper { if (party == null) { return null; } - + UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder(encoderType); String candidateFieldName = ModelUtil.dbNameToVarName(partyContentTypeId); String cacheKey; @@ -211,7 +211,7 @@ public class PartyContentWrapper implements ContentWrapper { ContentWorker.renderContentAsText(dispatcher, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, cache); return; } - + if (partyContentTypeId != null) { String candidateFieldName = ModelUtil.dbNameToVarName(partyContentTypeId); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java index d736502..bf1f835 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java @@ -50,7 +50,7 @@ public final class CatalogWorker { private CatalogWorker() { } - + /** * @deprecated - Use WebSiteWorker.getWebSiteId(ServletRequest) instead */ diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java index a6d70d9..20ab211 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java @@ -50,14 +50,11 @@ import org.apache.ofbiz.webapp.WebAppUtil; public class CatalogUrlFilter implements Filter { public final static String MODULE = CatalogUrlFilter.class.getName(); - public static final String PRODUCT_REQUEST = "product"; public static final String CATEGORY_REQUEST = "category"; - private static String defaultLocaleString; private static String redirectUrl; - protected FilterConfig config; @Override @@ -70,18 +67,17 @@ public class CatalogUrlFilter implements Filter { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletResponse httpResponse = (HttpServletResponse) response; Delegator delegator = (Delegator) httpRequest.getSession().getServletContext().getAttribute("delegator"); - + // set initial parameters String initDefaultLocalesString = config.getInitParameter("defaultLocaleString"); String initRedirectUrl = config.getInitParameter("redirectUrl"); setDefaultLocaleString(UtilValidate.isNotEmpty(initDefaultLocalesString) ? initDefaultLocalesString : ""); setRedirectUrl(UtilValidate.isNotEmpty(initRedirectUrl) ? initRedirectUrl : ""); - String pathInfo = httpRequest.getServletPath(); if (UtilValidate.isNotEmpty(pathInfo)) { List<String> pathElements = StringUtil.split(pathInfo, "/"); String alternativeUrl = pathElements.get(0); - + String productId = null; String productCategoryId = null; String urlContentId = null; @@ -140,7 +136,7 @@ public class CatalogUrlFilter implements Filter { } } } - + // look for productCategoryId if (alternativeUrl.endsWith("-c")) { List<EntityCondition> productCategoryContentConds = new LinkedList<>(); @@ -201,11 +197,10 @@ public class CatalogUrlFilter implements Filter { } catch (GenericEntityException e) { Debug.logWarning("Cannot look for product and product category", MODULE); } - + // generate forward URL StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("/" + WebAppUtil.CONTROL_MOUNT_POINT); - if (UtilValidate.isNotEmpty(productId)) { try { List<EntityCondition> conds = new LinkedList<>(); @@ -220,7 +215,6 @@ public class CatalogUrlFilter implements Filter { Debug.logError(e, "Cannot find product category for product: " + productId, MODULE); } urlBuilder.append("/" + PRODUCT_REQUEST); - } else { urlBuilder.append("/" + CATEGORY_REQUEST); } @@ -229,7 +223,7 @@ public class CatalogUrlFilter implements Filter { String topCategoryId = CategoryWorker.getCatalogTopCategory(httpRequest, null); List<GenericValue> trailCategories = CategoryWorker.getRelatedCategoriesRet(httpRequest, "trailCategories", topCategoryId, false, false, true); List<String> trailCategoryIds = EntityUtil.getFieldListFromEntityList(trailCategories, "productCategoryId", true); - + // look for productCategoryId from productId if (UtilValidate.isNotEmpty(productId)) { try { @@ -279,7 +273,7 @@ public class CatalogUrlFilter implements Filter { } } Collections.reverse(trailElements); - + List<String> trail = CategoryWorker.getTrail(httpRequest); if (trail == null) { trail = new LinkedList<>(); @@ -291,7 +285,7 @@ public class CatalogUrlFilter implements Filter { previousCategoryId = trail.get(trail.size() - 1); } trail = CategoryWorker.adjustTrail(trail, productCategoryId, previousCategoryId); - + if (trailElements.size() == 1) { CategoryWorker.setTrail(request, trailElements.get(0), null); } else if (trailElements.size() == 2) { @@ -313,13 +307,12 @@ public class CatalogUrlFilter implements Filter { } request.setAttribute("productCategoryId", productCategoryId); - + if (productId != null) { request.setAttribute("product_id", productId); request.setAttribute("productId", productId); } } - //Set view query parameters UrlServletHelper.setViewQueryParameters(request, urlBuilder); if (UtilValidate.isNotEmpty(productId) || UtilValidate.isNotEmpty(productCategoryId) || UtilValidate.isNotEmpty(urlContentId)) { @@ -328,11 +321,9 @@ public class CatalogUrlFilter implements Filter { dispatch.forward(request, response); return; } - //Check path alias UrlServletHelper.checkPathAlias(request, httpResponse, delegator, pathInfo); } - // we're done checking; continue on chain.doFilter(request, response); } @@ -360,7 +351,7 @@ public class CatalogUrlFilter implements Filter { public static String makeCategoryUrl(Delegator delegator, CategoryContentWrapper wrapper, List<String> trail, String contextPath, String previousCategoryId, String productCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString) { String url = ""; StringWrapper alternativeUrl = wrapper.get("ALTERNATIVE_URL", "url"); - + if (UtilValidate.isNotEmpty(alternativeUrl) && UtilValidate.isNotEmpty(alternativeUrl.toString())) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(contextPath); @@ -406,7 +397,7 @@ public class CatalogUrlFilter implements Filter { if (urlBuilder.toString().endsWith("&")) { return urlBuilder.toString().substring(0, urlBuilder.toString().length()-1); } - + url = urlBuilder.toString(); } else { if (UtilValidate.isEmpty(trail)) { @@ -414,10 +405,8 @@ public class CatalogUrlFilter implements Filter { } url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId); } - return url; } - public static String makeProductUrl(HttpServletRequest request, String previousCategoryId, String productCategoryId, String productId) { Delegator delegator = (Delegator) request.getAttribute("delegator"); String url = null; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java index 435ebd5..7b3dcb6 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java @@ -150,7 +150,7 @@ public class CategoryContentWrapper implements ContentWrapper { ContentWorker.renderContentAsText(dispatcher, categoryContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, cache); return; } - + String candidateFieldName = ModelUtil.dbNameToVarName(prodCatContentTypeId); ModelEntity categoryModel = delegator.getModelEntity("ProductCategory"); if (categoryModel.isField(candidateFieldName)) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java index 1e618fa..5cbf51b 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java @@ -90,7 +90,7 @@ public class CategoryServices { Timestamp introductionDateLimit = (Timestamp) context.get("introductionDateLimit"); Timestamp releaseDateLimit = (Timestamp) context.get("releaseDateLimit"); Locale locale = (Locale) context.get("locale"); - + if (index == null && productId == null) { return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "categoryservices.problems_getting_next_products", locale)); } @@ -275,7 +275,6 @@ public class CategoryServices { lowIndex = 0; highIndex = 0; } - boolean filterOutOfStock = false; try { String productStoreId = (String) context.get("productStoreId"); @@ -309,7 +308,6 @@ public class CategoryServices { if (!filterConditions.isEmpty()) { productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND)); } - // filter out of stock products if (filterOutOfStock) { try { @@ -324,7 +322,7 @@ public class CategoryServices { } // set the index and size - listSize = productCategoryMembers.size(); + listSize = productCategoryMembers.size(); if (limitView) { // limit high index to (filtered) listSize if (highIndex > listSize) { @@ -366,7 +364,6 @@ public class CategoryServices { .orderBy(orderByFields) .cursorScrollInsensitive() .maxRows(highIndex); - try (EntityListIterator pli = eq.queryIterator()) { // get the partial list for this page if (limitView) { @@ -376,7 +373,7 @@ public class CategoryServices { GenericValue nextValue; int chunkSize = 0; listSize = 0; - + while ((nextValue = pli.next()) != null) { String productId = nextValue.getString("productId"); if (CategoryWorker.isProductInCategory(delegator, productId, viewProductCategoryId)) { @@ -397,7 +394,6 @@ public class CategoryServices { // filter out the view allow productCategoryMembers = CategoryWorker.filterProductsInCategory(delegator, productCategoryMembers, viewProductCategoryId); } - listSize = productCategoryMembers.size(); lowIndex = 1; highIndex = listSize; @@ -470,19 +466,17 @@ public class CategoryServices { if ("true".equals(isCatalog) && "false".equals(isCategoryType)) { CategoryWorker.getRelatedCategories(request, "ChildCatalogList", CatalogWorker.getCatalogTopCategoryId(request, productCategoryId), true); childOfCats = EntityUtil.filterByDate((List<GenericValue>) request.getAttribute("ChildCatalogList")); - + } else if ("false".equals(isCatalog) && "false".equals(isCategoryType)) { childOfCats = EntityQuery.use(delegator).from("ProductCategoryRollupAndChild").where("parentProductCategoryId", productCategoryId).filterByDate().queryList(); } else { childOfCats = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", productCategoryId).filterByDate().queryList(); } if (UtilValidate.isNotEmpty(childOfCats)) { - for (GenericValue childOfCat : childOfCats ) { - Object catId = null; String catNameField = null; - + catId = childOfCat.get("productCategoryId"); catNameField = "CATEGORY_NAME"; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java index ea30a9e..6d09934 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java @@ -386,17 +386,14 @@ public final class CategoryWorker { getCategoryContentWrappers(catContentWrappers, subCat, request); } } - /** - * Returns a complete category trail - can be used for exporting proper category trees. - * This is mostly useful when used in combination with bread-crumbs, for building a + * Returns a complete category trail - can be used for exporting proper category trees. + * This is mostly useful when used in combination with bread-crumbs, for building a * faceted index tree, or to export a category tree for migration to another system. * Will create the tree from root point to categoryId. - * * This method is not meant to be run on every request. - * Its best use is to generate the trail every so often and store somewhere - * (a lucene/solr tree, entities, cache or so). - * + * Its best use is to generate the trail every so often and store somewhere + * (a lucene/solr tree, entities, cache or so). * @param dctx The DispatchContext that this service is operating in * @param context Map containing the input parameters * @return Map organized trail from root point to categoryId. diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java index 17fc761..758fed0 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java @@ -132,7 +132,7 @@ public final class SeoConfigUtil { } else { categoryUrlEnabled = false; } - + if (categoryUrlEnabled) { String allowedContextValue = UtilXml.childElementValue(categoryUrlElement, ELEMENT_ALLOWED_CONTEXT_PATHS, null); allowedContextPaths = new HashSet<>(); @@ -148,7 +148,7 @@ public final class SeoConfigUtil { } } } - + String categoryNameValue = UtilXml.childElementValue(categoryUrlElement, ELEMENT_CATEGORY_NAME, DEFAULT_CATEGORY_NAME_VALUE); if (DEFAULT_CATEGORY_NAME_VALUE.equalsIgnoreCase(categoryNameValue)) { categoryNameEnabled = false; @@ -189,7 +189,6 @@ public final class SeoConfigUtil { jSessionIdAnonEnabled = Boolean.valueOf(DEFAULT_ANONYMOUS_VALUE); } Debug.logInfo(" " + ELEMENT_ANONYMOUS + ": " + jSessionIdAnonEnabled, MODULE); - Element user = UtilXml.firstChildElement(jSessionId, ELEMENT_USER); if (user != null) { String userValue = UtilXml.childElementValue(user, ELEMENT_VALUE, DEFAULT_USER_VALUE); @@ -225,7 +224,6 @@ public final class SeoConfigUtil { } catch (NullPointerException e) { Debug.logWarning("No jsessionid element found in " + seoConfigFilename.toString(), MODULE); } - // parse url-config elements try { NodeList configs = rootElement.getElementsByTagName(ELEMENT_URL_CONFIG); @@ -246,7 +244,6 @@ public final class SeoConfigUtil { Debug.logWarning("Error while creating parttern for seo url-pattern: " + urlpattern, MODULE); continue; } - // construct seo patterns Element seo = UtilXml.firstChildElement(config, ELEMENT_SEO); if (UtilValidate.isNotEmpty(seo)) { @@ -324,37 +321,30 @@ public final class SeoConfigUtil { isInitialed = true; } } - /** * Check whether the configuration file has been read. - * * @return a boolean value to indicate whether the configuration file has been read. */ public static boolean isInitialed() { return isInitialed; } - /** * Check whether url regexp should be used. - * * @return a boolean value to indicate whether url regexp should be used. */ public static boolean checkUseUrlRegexp() { return useUrlRegexp; } - /** * Get the general regexp pattern. - * * @return the general regexp pattern. */ public static Pattern getGeneralRegexpPattern() { return regexpIfMatch; } - + /** * Check whether category url is enabled. - * * @return a boolean value to indicate whether category url is enabled. */ public static boolean checkCategoryUrl() { @@ -363,7 +353,6 @@ public final class SeoConfigUtil { /** * Check whether the context path is enabled. - * * @return a boolean value to indicate whether the context path is enabled. */ public static boolean isCategoryUrlEnabled(String contextPath) { @@ -381,7 +370,6 @@ public final class SeoConfigUtil { /** * Check whether category name is enabled. - * * @return a boolean value to indicate whether category name is enabled. */ public static boolean isCategoryNameEnabled() { @@ -390,7 +378,6 @@ public final class SeoConfigUtil { /** * Get category url suffix. - * * @return String category url suffix. */ public static String getCategoryUrlSuffix() { @@ -399,7 +386,6 @@ public final class SeoConfigUtil { /** * Check whether jsessionid is enabled for anonymous. - * * @return a boolean value to indicate whether jsessionid is enabled for anonymous. */ public static boolean isJSessionIdAnonEnabled() { @@ -408,7 +394,6 @@ public final class SeoConfigUtil { /** * Check whether jsessionid is enabled for user. - * * @return a boolean value to indicate whether jsessionid is enabled for user. */ public static boolean isJSessionIdUserEnabled() { @@ -417,7 +402,6 @@ public final class SeoConfigUtil { /** * Get user exception url pattern configures. - * * @return user exception url pattern configures (java.util.List<Pattern>) */ public static List<Pattern> getUserExceptionPatterns() { @@ -426,7 +410,6 @@ public final class SeoConfigUtil { /** * Get char filters. - * * @return char filters (java.util.Map<String, String>) */ public static Map<String, String> getCharFilters() { @@ -435,7 +418,6 @@ public final class SeoConfigUtil { /** * Get seo url pattern configures. - * * @return seo url pattern configures (java.util.Map<String, Pattern>) */ public static Map<String, Pattern> getSeoPatterns() { @@ -444,7 +426,6 @@ public final class SeoConfigUtil { /** * Get seo replacement configures. - * * @return seo replacement configures (java.util.Map<String, String>) */ public static Map<String, String> getSeoReplacements() { @@ -453,7 +434,6 @@ public final class SeoConfigUtil { /** * Get forward replacement configures. - * * @return forward replacement configures (java.util.Map<String, String>) */ public static Map<String, String> getForwardReplacements() { @@ -462,7 +442,6 @@ public final class SeoConfigUtil { /** * Get forward response codes. - * * @return forward response code configures (java.util.Map<String, Integer>) */ public static Map<String, Integer> getForwardResponseCodes() { @@ -472,7 +451,6 @@ public final class SeoConfigUtil { /** * Check whether a product id is in the special list. If we cannot get a product from a lower cased * or upper cased product id, then it's special. - * * @return boolean to indicate whether the product id is special. */ @Deprecated @@ -482,7 +460,6 @@ public final class SeoConfigUtil { /** * Add a special product id to the special list. - * * @param productId a product id get from database. * @return true to indicate it has been added to special product id; false to indicate it's not special. * @throws Exception to indicate there's already same lower cased product id in the list but value is a different product id. @@ -502,10 +479,9 @@ public final class SeoConfigUtil { specialProductIds.put(productId.toLowerCase(Locale.getDefault()), productId); return true; } - + /** * Get a product id is in the special list. - * * @return String of the original product id */ @Deprecated diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java index a30a353..cf83fa2 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoControlServlet.java @@ -43,7 +43,6 @@ public class SeoControlServlet extends ControlServlet { private static String defaultPage = null; private static String controlServlet = null; - public static final String REQUEST_IN_ALLOW_LIST = "_REQUEST_IN_ALLOW_LIST_"; public SeoControlServlet() { @@ -69,7 +68,7 @@ public class SeoControlServlet extends ControlServlet { SeoConfigUtil.init(); } - + @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String uri = URLEncoder.encode(request.getRequestURI(), "UTF-8"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java index 8e50d10..36022f9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java @@ -218,7 +218,7 @@ public final class ProductConfigWorker { configItemId = ci.getConfigItemAssoc().getString("configItemId"); sequenceNum = ci.getConfigItemAssoc().getLong("sequenceNum"); try { - List<GenericValue> configs = EntityQuery.use(delegator).from("ProductConfigConfig").where("configItemId", configItemId,"sequenceNum", sequenceNum).queryList(); + List<GenericValue> configs = EntityQuery.use(delegator).from("ProductConfigConfig").where("configItemId", configItemId, "sequenceNum", sequenceNum).queryList(); for (GenericValue productConfigConfig: configs) { for (ConfigOption oneOption: selectedOptions) { String configOptionId = oneOption.configOption.getString("configOptionId"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java index 60ee81c..63f66c8 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java @@ -111,7 +111,7 @@ public class ParametricSearch { // now before returning, order the features in each list by description Map<String, List<GenericValue>> productFeaturesByTypeMapSorted = new HashMap<>(); for (Map.Entry<String, Map<String, GenericValue>> entry: productFeaturesByTypeMap.entrySet()) { - List<GenericValue> sortedFeatures = EntityUtil.orderBy(entry.getValue().values(), UtilMisc.toList("description","defaultSequenceNum")); + List<GenericValue> sortedFeatures = EntityUtil.orderBy(entry.getValue().values(), UtilMisc.toList("description", "defaultSequenceNum")); productFeaturesByTypeMapSorted.put(entry.getKey(), sortedFeatures); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java index 0273f80..776270e 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java @@ -216,7 +216,7 @@ public class ProductFeatureServices { // product feature and add it to the id code and product feature applications // of the next variant. just a matter of whether we're starting with an // existing list of features and id code or from scratch. - if (combinations.size()==0) { + if (combinations.size() == 0) { for (GenericValue currentFeature: currentFeatures) { if ("SELECTABLE_FEATURE".equals(currentFeature.getString("productFeatureApplTypeId"))) { Map<String, Object> newCombination = new HashMap<>(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java index 2ca46a5..692ade2 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java @@ -111,9 +111,9 @@ public class ScaleImage { Map<String, Object> imageContext = new HashMap<>(); imageContext.putAll(context); - imageContext.put("tenantId", ((Delegator)context.get("delegator")).getDelegatorTenantId()); - String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", (Delegator)context.get("delegator")), imageContext); - String imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix", (Delegator)context.get("delegator")), imageContext); + imageContext.put("tenantId", ((Delegator) context.get("delegator")).getDelegatorTenantId()); + String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", (Delegator) context.get("delegator")), imageContext); + String imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix", (Delegator) context.get("delegator")), imageContext); imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath; imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix; FlexibleStringExpander filenameExpander; @@ -289,11 +289,11 @@ public class ScaleImage { // paths Map<String, Object> imageContext = new HashMap<>(); imageContext.putAll(context); - imageContext.put("tenantId", ((Delegator)context.get("delegator")).getDelegatorTenantId()); + imageContext.put("tenantId", ((Delegator) context.get("delegator")).getDelegatorTenantId()); String mainFilenameFormat = EntityUtilProperties.getPropertyValue("catalog", "image.filename.format", (Delegator) context.get("delegator")); - String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", (Delegator)context.get("delegator")), imageContext); - String imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix", (Delegator)context.get("delegator")), imageContext); + String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.server.path", (Delegator) context.get("delegator")), imageContext); + String imageUrlPrefix = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.url.prefix", (Delegator) context.get("delegator")), imageContext); imageServerPath = imageServerPath.endsWith("/") ? imageServerPath.substring(0, imageServerPath.length()-1) : imageServerPath; imageUrlPrefix = imageUrlPrefix.endsWith("/") ? imageUrlPrefix.substring(0, imageUrlPrefix.length()-1) : imageUrlPrefix; String id = null; @@ -354,7 +354,7 @@ public class ScaleImage { if (viewType.toLowerCase(Locale.getDefault()).contains("main")) { newFileLocation = mainFilenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "type", sizeType)); } else if (viewType.toLowerCase(Locale.getDefault()).contains("additional")) { - newFileLocation = addFilenameExpander.expandString(UtilMisc.toMap("location", "products","id", id, "viewtype", viewType, "sizetype", sizeType)); + newFileLocation = addFilenameExpander.expandString(UtilMisc.toMap("location", "products", "id", id, "viewtype", viewType, "sizetype", sizeType)); } String newFilePathPrefix = ""; if (newFileLocation != null && newFileLocation.lastIndexOf('/') != -1) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java index 333d8d8..68df917 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/CropImage.java @@ -52,7 +52,7 @@ public class CropImage { throws IOException { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dispatcher.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String nameOfThumb = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.nameofthumbnail", delegator), context); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java index c887c09..e4a5edd 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java @@ -391,7 +391,7 @@ public class FrameImage { request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; } - + if (UtilValidate.isNotEmpty(imageName)) { File file = new File(imageServerPath + "/preview/" +"/previewImage.jpg"); if (!file.delete()) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java index 81ebc20..95798d0 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java @@ -668,7 +668,7 @@ public class ImageManagementServices { public static Map<String, Object> createNewImageThumbnail(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dispatcher.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context); String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context); @@ -739,7 +739,7 @@ public class ImageManagementServices { public static Map<String, Object> resizeImageOfProduct(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context); String productId = (String) context.get("productId"); String dataResourceName = (String) context.get("dataResourceName"); @@ -766,7 +766,7 @@ public class ImageManagementServices { public static Map<String, Object> renameImage(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context); String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", delegator), context); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java index 6127335..8516077 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java @@ -51,7 +51,7 @@ public class ReplaceImage { public static Map<String, Object> replaceImageToExistImage(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context); String productId = (String) context.get("productId"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java index ccde800..b5c03bd 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/RotateImage.java @@ -51,7 +51,7 @@ public class RotateImage { public static Map<String, Object> imageRotate(DispatchContext dctx, Map<String, ? extends Object> context) throws IOException { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java index ff9c7fa..b2e54b1 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java @@ -916,9 +916,9 @@ public class InventoryServices { for (GenericValue onePrice: productPrices) { if ("DEFAULT_PRICE".equals(onePrice.getString("productPriceTypeId"))) { //defaultPrice result.put("defaultPrice", onePrice.getBigDecimal("price")); - } else if ("WHOLESALE_PRICE".equals(onePrice.getString("productPriceTypeId"))) {// + } else if ("WHOLESALE_PRICE".equals(onePrice.getString("productPriceTypeId"))) { // result.put("wholeSalePrice", onePrice.getBigDecimal("price")); - } else if ("LIST_PRICE".equals(onePrice.getString("productPriceTypeId"))) {//listPrice + } else if ("LIST_PRICE".equals(onePrice.getString("productPriceTypeId"))) { //listPrice result.put("listPrice", onePrice.getBigDecimal("price")); } else { result.put("defaultPrice", onePrice.getBigDecimal("price")); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java index 722b2fa..ead991c 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java @@ -102,7 +102,7 @@ public class PriceServices { String productStoreId = (String) context.get("productStoreId"); String productStoreGroupId = (String) context.get("productStoreGroupId"); Locale locale = (Locale) context.get("locale"); - + GenericValue productStore = null; try { // we have a productStoreId, if the corresponding ProductStore.primaryStoreGroupId is not empty, use that @@ -533,7 +533,7 @@ public class PriceServices { default: tempPrice = BigDecimal.ZERO; } - + if (tempPrice != null && tempPrice != BigDecimal.ZERO) { Map<String, Object> priceResults = new HashMap<>(); try { @@ -557,7 +557,6 @@ public class PriceServices { } } } - return result; } @@ -940,7 +939,7 @@ public class PriceServices { // add a orderItemPriceInfo element too, without orderId or orderItemId StringBuilder priceInfoDescription = new StringBuilder(); - + priceInfoDescription.append(condsDescription.toString()); priceInfoDescription.append("["); priceInfoDescription.append(UtilProperties.getMessage(RESOURCE, "ProductPriceConditionType", locale)); @@ -1195,7 +1194,6 @@ public class PriceServices { return 0; } } - return 1; } @@ -1211,13 +1209,13 @@ public class PriceServices { boolean validPriceFound = false; BigDecimal price = BigDecimal.ZERO; - GenericValue product = (GenericValue)context.get("product"); + GenericValue product = (GenericValue) context.get("product"); String productId = product.getString("productId"); String agreementId = (String) context.get("agreementId"); String currencyUomId = (String) context.get("currencyUomId"); String partyId = (String) context.get("partyId"); BigDecimal quantity = (BigDecimal) context.get("quantity"); - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); // a) Get the Price from the Agreement* data model if (Debug.infoOn()) Debug.logInfo("Try to resolve purchase price from agreement " + agreementId, MODULE); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java index d972c21..c34cc97 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java @@ -91,7 +91,7 @@ public class ProductEvents { // check permissions before moving on... if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) { Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode); - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -131,7 +131,7 @@ public class ProductEvents { } catch (GenericEntityException gee) { Debug.logWarning(gee, gee.getMessage(), MODULE); Map<String, String> messageMap = UtilMisc.toMap("gee", gee.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.error_getting_product_list", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.error_getting_product_list", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -175,13 +175,13 @@ public class ProductEvents { if (errProds == 0) { Map<String, String> messageMap = UtilMisc.toMap("numProds", Integer.toString(numProds)); - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.keyword_creation_complete_for_products", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.keyword_creation_complete_for_products", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", errMsg); return "success"; } else { Map<String, String> messageMap = UtilMisc.toMap("numProds", Integer.toString(numProds)); messageMap.put("errProds", Integer.toString(errProds)); - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.keyword_creation_complete_for_products_with_errors", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.keyword_creation_complete_for_products_with_errors", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -203,7 +203,7 @@ public class ProductEvents { String updateMode = request.getParameter("UPDATE_MODE"); if (UtilValidate.isEmpty(updateMode)) { - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.updatemode_not_specified", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.updatemode_not_specified", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("[ProductEvents.updateProductAssoc] Update Mode was not specified, but is required", MODULE); return "error"; @@ -212,7 +212,7 @@ public class ProductEvents { // check permissions before moving on... if (!security.hasEntityPermission("CATALOG", "_" + updateMode, request.getSession())) { Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode); - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -226,11 +226,11 @@ public class ProductEvents { try { if (EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne() == null) { Map<String, String> messageMap = UtilMisc.toMap("productId", productId); - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.product_with_id_not_found", messageMap, UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.product_with_id_not_found", messageMap, UtilHttp.getLocale(request))); } if (EntityQuery.use(delegator).from("Product").where("productId", productIdTo).queryOne() == null) { Map<String, String> messageMap = UtilMisc.toMap("productIdTo", productIdTo); - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.product_To_with_id_not_found", messageMap, UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.product_To_with_id_not_found", messageMap, UtilHttp.getLocale(request))); } } catch (GenericEntityException e) { // if there is an exception for either, the other probably wont work @@ -245,17 +245,17 @@ public class ProductEvents { } } if (UtilValidate.isEmpty(productId)) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.product_ID_missing", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.product_ID_missing", UtilHttp.getLocale(request))); } if (UtilValidate.isEmpty(productIdTo)) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.product_ID_To_missing", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.product_ID_To_missing", UtilHttp.getLocale(request))); } if (UtilValidate.isEmpty(productAssocTypeId)) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.association_type_ID_missing", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.association_type_ID_missing", UtilHttp.getLocale(request))); } // from date is only required if update mode is not CREATE if (!"CREATE".equals(updateMode) && UtilValidate.isEmpty(fromDateStr)) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.from_date_missing", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.from_date_missing", UtilHttp.getLocale(request))); } if (errMsgList.size() > 0) { request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList); @@ -283,14 +283,14 @@ public class ProductEvents { Debug.logWarning(e.getMessage(), MODULE); } if (productAssoc == null) { - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.could_not_remove_product_association_exist", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.could_not_remove_product_association_exist", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } try { productAssoc.remove(); } catch (GenericEntityException e) { - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.could_not_remove_product_association_write", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.could_not_remove_product_association_write", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("[ProductEvents.updateProductAssoc] Could not remove product association (write error); message: " + e.getMessage(), MODULE); return "error"; @@ -311,21 +311,21 @@ public class ProductEvents { try { thruDate = (Timestamp) ObjectType.simpleTypeOrObjectConvert(thruDateStr, "Timestamp", null, UtilHttp.getTimeZone(request), UtilHttp.getLocale(request), false); } catch (Exception e) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.thru_date_not_formatted_correctly", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.thru_date_not_formatted_correctly", UtilHttp.getLocale(request))); } } if (UtilValidate.isNotEmpty(quantityStr)) { try { quantity = new BigDecimal(quantityStr); } catch (NumberFormatException e) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.quantity_not_formatted_correctly", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.quantity_not_formatted_correctly", UtilHttp.getLocale(request))); } } if (UtilValidate.isNotEmpty(sequenceNumStr)) { try { sequenceNum = Long.valueOf(sequenceNumStr); } catch (Exception e) { - errMsgList.add(UtilProperties.getMessage(RESOURCE,"productevents.sequenceNum_not_formatted_correctly", UtilHttp.getLocale(request))); + errMsgList.add(UtilProperties.getMessage(RESOURCE, "productevents.sequenceNum_not_formatted_correctly", UtilHttp.getLocale(request))); } } if (errMsgList.size() > 0) { @@ -355,14 +355,14 @@ public class ProductEvents { productAssoc = null; } if (productAssoc != null) { - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.could_not_create_product_association_exists", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.could_not_create_product_association_exists", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } try { productAssoc = tempProductAssoc.create(); } catch (GenericEntityException e) { - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.could_not_create_product_association_write", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.could_not_create_product_association_write", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("[ProductEvents.updateProductAssoc] Could not create product association (write error); message: " + e.getMessage(), MODULE); return "error"; @@ -371,14 +371,14 @@ public class ProductEvents { try { tempProductAssoc.store(); } catch (GenericEntityException e) { - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.could_not_update_product_association_write", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.could_not_update_product_association_write", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("[ProductEvents.updateProductAssoc] Could not update product association (write error); message: " + e.getMessage(), MODULE); return "error"; } } else { Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode); - errMsg = UtilProperties.getMessage(RESOURCE,"productevents.specified_update_mode_not_supported", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productevents.specified_update_mode_not_supported", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java index c4d8d52..c827f53 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchEvents.java @@ -69,7 +69,7 @@ public class ProductSearchEvents { boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT); try (EntityListIterator eli = getProductSearchResults(request)) { if (eli == null) { - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -81,11 +81,11 @@ public class ProductSearchEvents { numRemoved += delegator.removeByAnd("ProductCategoryMember", UtilMisc.toMap("productCategoryId", productCategoryId, "productId", productId)); } Map<String, String> messageMap = UtilMisc.toMap("numRemoved", Integer.toString(numRemoved)); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.removed_x_items", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.removed_x_items", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", errMsg); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); TransactionUtil.rollback(beganTransaction, errMsg, e); @@ -95,7 +95,7 @@ public class ProductSearchEvents { } } catch (GenericTransactionException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -119,7 +119,7 @@ public class ProductSearchEvents { thruDate = Timestamp.valueOf(thruDateStr); } catch (RuntimeException e) { Map<String, String> messageMap = UtilMisc.toMap("errDateFormat", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.thruDate_not_formatted_properly", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.thruDate_not_formatted_properly", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -129,7 +129,7 @@ public class ProductSearchEvents { boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT); try (EntityListIterator eli = getProductSearchResults(request)) { if (eli == null) { - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -151,11 +151,11 @@ public class ProductSearchEvents { } } Map<String, String> messageMap = UtilMisc.toMap("numExpired", Integer.toString(numExpired)); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.expired_x_items", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.expired_x_items", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", errMsg); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); TransactionUtil.rollback(beganTransaction, errMsg, e); @@ -165,7 +165,7 @@ public class ProductSearchEvents { } } catch (GenericTransactionException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -190,7 +190,7 @@ public class ProductSearchEvents { fromDate = Timestamp.valueOf(fromDateStr); } catch (RuntimeException e) { Map<String, String> messageMap = UtilMisc.toMap("errDateFormat", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.fromDate_not_formatted_properly", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.fromDate_not_formatted_properly", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -199,7 +199,7 @@ public class ProductSearchEvents { boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT); try (EntityListIterator eli = getProductSearchResults(request)) { if (eli == null) { - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -218,11 +218,11 @@ public class ProductSearchEvents { numAdded++; } Map<String, String> messageMap = UtilMisc.toMap("numAdded", Integer.toString(numAdded)); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.added_x_product_category_members", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.added_x_product_category_members", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", errMsg); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); TransactionUtil.rollback(beganTransaction, errMsg, e); @@ -232,7 +232,7 @@ public class ProductSearchEvents { } } catch (GenericTransactionException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -286,7 +286,7 @@ public class ProductSearchEvents { boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT); try (EntityListIterator eli = getProductSearchResults(request)) { if (eli == null) { - String errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); + String errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -343,7 +343,7 @@ public class ProductSearchEvents { boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT); try (EntityListIterator eli = getProductSearchResults(request)) { if (eli == null) { - String errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); + String errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -390,7 +390,7 @@ public class ProductSearchEvents { boolean beganTransaction = TransactionUtil.begin(DEFAULT_TX_TIMEOUT); try (EntityListIterator eli = getProductSearchResults(request)) { if (eli == null) { - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.no_results_found_probably_error_constraints", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -411,7 +411,7 @@ public class ProductSearchEvents { } } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); TransactionUtil.rollback(beganTransaction, errMsg, e); @@ -421,7 +421,7 @@ public class ProductSearchEvents { } } catch (GenericTransactionException e) { Map<String, String> messageMap = UtilMisc.toMap("errSearchResult", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "productsearchevents.error_getting_search_results", messageMap, UtilHttp.getLocale(request)); Debug.logError(e, errMsg, MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java index dc42429..61b9382 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java @@ -121,7 +121,7 @@ public class ProductServices { products.add(EntityQuery.use(delegator).from("Product").where("productId", oneVariant.getString("productIdTo")).queryOne()); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errProductFeatures", e.toString()); - String errMsg = UtilProperties.getMessage(RES_ERROR,"productservices.problem_reading_product_features_errors", messageMap, locale); + String errMsg = UtilProperties.getMessage(RES_ERROR, "productservices.problem_reading_product_features_errors", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -154,13 +154,13 @@ public class ProductServices { } } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errProductFeatures", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productservices.problem_reading_product_features_errors", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productservices.problem_reading_product_features_errors", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } if (featureSet.size() == 0) { - errMsg = UtilProperties.getMessage(RES_ERROR,"productservices.problem_reading_product_features", locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productservices.problem_reading_product_features", locale); // ToDo DO 2004-02-23 Where should the errMsg go? Debug.logWarning(errMsg + " for product " + productId, MODULE); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java index 770f99e..1f89da9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java @@ -122,13 +122,13 @@ public final class ProductUtilServices { } } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_discVirtualsWithDiscVariants", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_discVirtualsWithDiscVariants", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_discVirtualsWithDiscVariants", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_discVirtualsWithDiscVariants", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -167,7 +167,7 @@ public final class ProductUtilServices { Debug.logInfo("Completed - Removed category members for " + numSoFar + " sales discontinued products.", MODULE); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_removeCategoryMembersOfDiscProducts", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_removeCategoryMembersOfDiscProducts", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -214,7 +214,7 @@ public final class ProductUtilServices { Debug.logInfo("Completed - Removed category members for " + numSoFar + " products with duplicate category members.", MODULE); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_removeDuplicateOpenEndedCategoryMembers", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_removeDuplicateOpenEndedCategoryMembers", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -316,13 +316,13 @@ public final class ProductUtilServices { Debug.logInfo("Found virtual products with one valid variant: " + numWithOneValid + ", with one variant only: " + numWithOneOnly, MODULE); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_makeStandAloneFromSingleVariantVirtuals", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_makeStandAloneFromSingleVariantVirtuals", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } } catch (GenericEntityException | GenericServiceException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_makeStandAloneFromSingleVariantVirtuals", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_makeStandAloneFromSingleVariantVirtuals", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -353,14 +353,14 @@ public final class ProductUtilServices { List<GenericValue> paList = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT").filterByDate().queryList(); if (paList.size() > 1) { Map<String, String> messageMap = UtilMisc.toMap("productId", productId); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.found_more_than_one_valid_variant_for_virtual_ID", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.found_more_than_one_valid_variant_for_virtual_ID", messageMap, locale); Debug.logInfo(errMsg, MODULE); return ServiceUtil.returnError(errMsg); } if (paList.size() == 0) { Map<String, String> messageMap = UtilMisc.toMap("productId", productId); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.did_not_find_any_valid_variants_for_virtual_ID", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.did_not_find_any_valid_variants_for_virtual_ID", messageMap, locale); Debug.logInfo(errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -437,7 +437,7 @@ public final class ProductUtilServices { } } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_makeStandAloneFromSingleVariantVirtuals", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_makeStandAloneFromSingleVariantVirtuals", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -545,7 +545,7 @@ public final class ProductUtilServices { Debug.logInfo("Completed - Image URLs set for " + numSoFar + " products.", MODULE); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_setAllProductImageNames", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_setAllProductImageNames", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -575,7 +575,7 @@ public final class ProductUtilServices { Debug.logInfo("Completed - Image URLs set for " + numSoFar + " products.", MODULE); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.entity_error_running_clearAllVirtualProductImageNames", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.entity_error_running_clearAllVirtualProductImageNames", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } @@ -615,7 +615,7 @@ public final class ProductUtilServices { attachProductFeaturesToCategory(productCategoryId, productFeatureTypeIdsToInclude, productFeatureTypeIdsToExclude, delegator, doSubCategories, nowTimestamp); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RES_ERROR,"productutilservices.error_in_attachProductFeaturesToCategory", messageMap, locale); + errMsg = UtilProperties.getMessage(RES_ERROR, "productutilservices.error_in_attachProductFeaturesToCategory", messageMap, locale); Debug.logError(e, errMsg, MODULE); return ServiceUtil.returnError(errMsg); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java index 1055c07..fa313d8 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java @@ -1016,7 +1016,7 @@ public final class ProductWorker { for (String paramValue: selectedFeatures) { // find incompatibilities.. List<GenericValue> incompatibilityVariants = EntityQuery.use(delegator).from("ProductFeatureIactn") - .where("productId", productId, "productFeatureIactnTypeId","FEATURE_IACTN_INCOMP").cache(true).queryList(); + .where("productId", productId, "productFeatureIactnTypeId", "FEATURE_IACTN_INCOMP").cache(true).queryList(); for (GenericValue incompatibilityVariant: incompatibilityVariants) { String featur = incompatibilityVariant.getString("productFeatureId"); if (paramValue.equals(featur)) { @@ -1032,7 +1032,7 @@ public final class ProductWorker { } // find dependencies.. List<GenericValue> dependenciesVariants = EntityQuery.use(delegator).from("ProductFeatureIactn") - .where("productId", productId, "productFeatureIactnTypeId","FEATURE_IACTN_DEPEND").cache(true).queryList(); + .where("productId", productId, "productFeatureIactnTypeId", "FEATURE_IACTN_DEPEND").cache(true).queryList(); for (GenericValue dpVariant: dependenciesVariants) { String featur = dpVariant.getString("productFeatureId"); if (paramValue.equals(featur)) { @@ -1052,12 +1052,12 @@ public final class ProductWorker { } } // find variant - List<GenericValue> productAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId","PRODUCT_VARIANT").filterByDate().queryList(); + List<GenericValue> productAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId", "PRODUCT_VARIANT").filterByDate().queryList(); boolean productFound = false; nextProd: for (GenericValue productAssoc: productAssocs) { for (String featureId: selectedFeatures) { - List<GenericValue> pAppls = EntityQuery.use(delegator).from("ProductFeatureAppl").where("productId", productAssoc.getString("productIdTo"), "productFeatureId", featureId, "productFeatureApplTypeId","STANDARD_FEATURE").cache(true).queryList(); + List<GenericValue> pAppls = EntityQuery.use(delegator).from("ProductFeatureAppl").where("productId", productAssoc.getString("productIdTo"), "productFeatureId", featureId, "productFeatureApplTypeId", "STANDARD_FEATURE").cache(true).queryList(); if (UtilValidate.isEmpty(pAppls)) { continue nextProd; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/VariantEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/VariantEvents.java index 12f5772..c736566 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/VariantEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/VariantEvents.java @@ -58,13 +58,13 @@ public class VariantEvents { String featureTypeSizeStr = request.getParameter("featureTypeSize"); if (UtilValidate.isEmpty(productId)) { - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.productId_required_but_missing", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.productId_required_but_missing", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } if (UtilValidate.isEmpty(variantProductId)) { - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.variantProductId_required_but_missing_enter_an_id", UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.variantProductId_required_but_missing_enter_an_id", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -75,7 +75,7 @@ public class VariantEvents { featureTypeSize = Integer.parseInt(featureTypeSizeStr); } catch (NumberFormatException e) { Map<String, String> messageMap = UtilMisc.toMap("featureTypeSizeStr", featureTypeSizeStr); - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.featureTypeSize_not_number", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.featureTypeSize_not_number", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -88,7 +88,7 @@ public class VariantEvents { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (product == null) { Map<String, String> messageMap = UtilMisc.toMap("productId", productId); - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.product_not_found_with_ID", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.product_not_found_with_ID", messageMap, UtilHttp.getLocale(request)); TransactionUtil.rollback(beganTransacton, errMsg, null); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -125,7 +125,7 @@ public class VariantEvents { String productFeatureId = request.getParameter("feature_" + i); if (productFeatureId == null) { Map<String, String> messageMap = UtilMisc.toMap("i", Integer.toString(i)); - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.productFeatureId_for_feature_type_number_not_found", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.productFeatureId_for_feature_type_number_not_found", messageMap, UtilHttp.getLocale(request)); TransactionUtil.rollback(beganTransacton, errMsg, null); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; @@ -148,7 +148,7 @@ public class VariantEvents { TransactionUtil.commit(beganTransacton); } catch (GenericEntityException e) { Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.entity_error_quick_add_variant_data", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.entity_error_quick_add_variant_data", messageMap, UtilHttp.getLocale(request)); TransactionUtil.rollback(beganTransacton, errMsg, null); Debug.logError(e, "Entity error creating quick add variant data", MODULE); request.setAttribute("_ERROR_MESSAGE_", errMsg); @@ -157,13 +157,13 @@ public class VariantEvents { } catch (GenericTransactionException e) { Debug.logError(e, "Transaction error creating quick add variant data", MODULE); Map<String, String> messageMap = UtilMisc.toMap("errMessage", e.toString()); - errMsg = UtilProperties.getMessage(RESOURCE,"variantevents.transaction_error_quick_add_variant_data", messageMap, UtilHttp.getLocale(request)); + errMsg = UtilProperties.getMessage(RESOURCE, "variantevents.transaction_error_quick_add_variant_data", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } Map<String, String> messageMap = UtilMisc.toMap("variantProductId", variantProductId); - String sucMsg = UtilProperties.getMessage(RESOURCE,"variantevents.successfully_created_variant_product_with_id", messageMap, UtilHttp.getLocale(request)); + String sucMsg = UtilProperties.getMessage(RESOURCE, "variantevents.successfully_created_variant_product_with_id", messageMap, UtilHttp.getLocale(request)); request.setAttribute("_EVENT_MESSAGE_", sucMsg); return "success"; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java index b277b5e..2f9de2c 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java @@ -139,7 +139,7 @@ public final class ProductStoreWorker { return UtilHttp.getLocale(request, request.getSession(), productStore.getString("defaultLocaleString")); } } - + public static TimeZone getStoreTimeZone(HttpServletRequest request) { GenericValue productStore = getProductStore(request); if (UtilValidate.isEmpty(productStore)) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/subscription/SubscriptionServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/subscription/SubscriptionServices.java index 9aa00bd..55a4eed 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/subscription/SubscriptionServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/subscription/SubscriptionServices.java @@ -308,7 +308,7 @@ public class SubscriptionServices { public static Map<String, Object> runServiceOnSubscriptionExpiry( DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); - Locale locale =(Locale)context.get("locale"); + Locale locale =(Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); Map<String, Object> result = new HashMap<>(); Map<String, Object> expiryMap = new HashMap<>(); @@ -395,7 +395,7 @@ public class SubscriptionServices { public static Map<String, Object> runSubscriptionExpired( DispatchContext dctx, Map<String, ? extends Object> context) { - Locale locale = (Locale)context.get("locale"); + Locale locale = (Locale) context.get("locale"); String subscriptionId = (String) context.get("subscriptionId"); Map<String, Object> result = new HashMap<>(); if (subscriptionId != null) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java b/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java index 960ea75..7e68cf6 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java @@ -65,7 +65,7 @@ public class StockMovesTest extends OFBizTestCase { Map<String, Object> ppsmCtx = new HashMap<>(); ppsmCtx.put("productId", "GZ-2644"); ppsmCtx.put("facilityId", "WebStoreWarehouse"); - ppsmCtx.put("locationSeqId","TLTLTLUL01"); + ppsmCtx.put("locationSeqId", "TLTLTLUL01"); ppsmCtx.put("targetLocationSeqId", "TLTLTLLL01"); ppsmCtx.put("quantityMoved", new BigDecimal("5")); ppsmCtx.put("userLogin", userLogin); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java index b06bfb5..1089d78 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java @@ -278,7 +278,6 @@ public class PackingServices { public static Map<String, Object> completePack(DispatchContext dctx, Map<String, ? extends Object> context) { PackingSession session = (PackingSession) context.get("packingSession"); Locale locale = (Locale) context.get("locale"); - // set the instructions -- will clear out previous if now null String instructions = (String) context.get("handlingInstructions"); String pickerPartyId = (String) context.get("pickerPartyId"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java index 5c3d64a..14540bf 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java @@ -297,7 +297,7 @@ public class ShipmentServices { for (GenericValue thisEstimate: estimates) { try { String toGeo = thisEstimate.getString("geoIdTo"); - if (UtilValidate.isNotEmpty(toGeo) && shipAddress ==null) { + if (UtilValidate.isNotEmpty(toGeo) && shipAddress == null) { // This estimate requires shipping address details. We don't have it so we cannot use this estimate. continue; } @@ -672,7 +672,7 @@ public class ShipmentServices { EntityQuery eq = EntityQuery.use(delegator) .from("OdbcPackageIn") .orderBy("shipmentId", "shipmentPackageSeqId", "voidIndicator"); - + try (EntityListIterator eli = eq.queryIterator()) { GenericValue pkgInfo; while ((pkgInfo = eli.next()) != null) { @@ -1042,7 +1042,6 @@ public class ShipmentServices { String sendTo = (String) context.get("sendTo"); String screenUri = (String) context.get("screenUri"); Locale localePar = (Locale) context.get("locale"); - // prepare the shipment information Map<String, Object> sendMap = new HashMap<>(); GenericValue shipment = null; @@ -1100,7 +1099,7 @@ public class ShipmentServices { sendMap.put("sendFrom", productStoreEmail.get("fromAddress")); sendMap.put("sendCc", productStoreEmail.get("ccAddress")); sendMap.put("sendBcc", productStoreEmail.get("bccAddress")); - + if ((sendTo != null) && UtilValidate.isEmail(sendTo)) { sendMap.put("sendTo", sendTo); } else { @@ -1121,7 +1120,6 @@ public class ShipmentServices { } return sendResp; } - public static Map<String, Object> getShipmentGatewayConfigFromShipment(Delegator delegator, String shipmentId, Locale locale) { Map<String, Object> shipmentGatewayConfig = ServiceUtil.returnSuccess(); try { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java index 0a8e50b..668180d 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java @@ -69,7 +69,7 @@ public class IssuanceTest extends OFBizTestCase { assertEquals(shipmentId, orderShipment.getString("shipmentId")); assertEquals(shipmentItemSeqId, orderShipment.getString("shipmentItemSeqId")); BigDecimal actual = orderShipment.getBigDecimal("quantity"); - assertTrue("Incorrect quantity in OrderShipment. Expected 6.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(6L))==0); + assertTrue("Incorrect quantity in OrderShipment. Expected 6.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(6L)) == 0); // Test the ItemIssuances are correct List<GenericValue> itemIssuances = orderHeader.getRelated("ItemIssuance", null, UtilMisc.toList("inventoryItemId"), false); @@ -83,7 +83,7 @@ public class IssuanceTest extends OFBizTestCase { assertEquals(shipmentItemSeqId, itemIssuance.getString("shipmentItemSeqId")); assertEquals("9001", itemIssuance.getString("inventoryItemId")); actual = itemIssuance.getBigDecimal("quantity"); - assertTrue("Incorrect quantity in ItemIssuance. Expected 5.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(5L))==0); + assertTrue("Incorrect quantity in ItemIssuance. Expected 5.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(5L)) == 0); itemIssuance = itemIssuances.get(1); assertEquals(orderItemSeqId, itemIssuance.getString("orderItemSeqId")); @@ -92,7 +92,7 @@ public class IssuanceTest extends OFBizTestCase { assertEquals(shipmentItemSeqId, itemIssuance.getString("shipmentItemSeqId")); assertEquals("9025", itemIssuance.getString("inventoryItemId")); actual = itemIssuance.getBigDecimal("quantity"); - assertTrue("Incorrect quantity in ItemIssuance. Expected 1.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(1L))==0); + assertTrue("Incorrect quantity in ItemIssuance. Expected 1.00000 actual " + actual, actual.compareTo(BigDecimal.valueOf(1L)) == 0); // Test reservations have been removed List<GenericValue> reservations = orderHeader.getRelated("OrderItemShipGrpInvRes", null, null, false); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java index 8dc6385..20a0308 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java @@ -88,14 +88,14 @@ public class DhlServices { * @param xmlString Name of the DHL service to invoke * @param delegator the delegator * @param shipmentGatewayConfigId the shipment gateway config id - * @param RESOURCE the RESOURCE file (i.e. shipment.properties) + * @param resource the RESOURCE file (i.e. shipment.properties) * @param locale locale in use * @return XML string response from DHL * @throws DhlConnectException */ - public static String sendDhlRequest(String xmlString, Delegator delegator, String shipmentGatewayConfigId, - String RESOURCE, Locale locale) throws DhlConnectException { - String conStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", RESOURCE, "shipment.dhl.connect.url"); + public static String sendDhlRequest(String xmlString, Delegator delegator, String shipmentGatewayConfigId, + String resource, Locale locale) throws DhlConnectException { + String conStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", resource, "shipment.dhl.connect.url"); if (conStr.isEmpty()) { throw new DhlConnectException(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentDhlConnectUrlIncomplete", locale)); @@ -111,8 +111,8 @@ public class DhlServices { // prepare the connect string conStr = conStr.trim(); - String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", - RESOURCE, "shipment.dhl.connect.timeout", "60"); + String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", + resource, "shipment.dhl.connect.timeout", "60"); int timeout = 60; try { timeout = Integer.parseInt(timeOutStr); @@ -187,7 +187,7 @@ public class DhlServices { String RESOURCE = (String) context.get("serviceConfigProps"); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - + // shipping credentials (configured in properties) String userid = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessUserId", RESOURCE, "shipment.dhl.access.userid"); String password = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessPassword", RESOURCE, "shipment.dhl.access.password"); @@ -321,7 +321,7 @@ public class DhlServices { if (UtilValidate.isNotEmpty(errorList)) { return ServiceUtil.returnError(errorList); } - + String dateGenerated = UtilXml.childElementValue( responseEstimateDetailElement, "DateGenerated"); @@ -458,7 +458,7 @@ public class DhlServices { if (UtilValidate.isNotEmpty(errorList)) { return ServiceUtil.returnError(errorList); } - String responseShippingKey = UtilXml.childElementValue(responseElement,"ShippingKey"); + String responseShippingKey = UtilXml.childElementValue(responseElement, "ShippingKey"); Map<String, Object> result = ServiceUtil.returnSuccess(); result.put("shippingKey", responseShippingKey); return result; @@ -476,7 +476,7 @@ public class DhlServices { GenericValue userLogin = (GenericValue) context.get("userLogin"); String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); - + Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); @@ -484,7 +484,7 @@ public class DhlServices { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentDhlGatewayNotAvailable", locale)); } - + try { GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); if (shipment == null) { @@ -722,7 +722,7 @@ public class DhlServices { inContext.put("streetLine2", destPostalAddress.getString("address2")); inContext.put("city", destPostalAddress.getString("city")); inContext.put("state", destPostalAddress.getString("stateProvinceGeoId")); - + // DHL ShipIT API does not accept ZIP+4 if ((destPostalAddress.getString("postalCode") != null) && (destPostalAddress.getString("postalCode").length() > 5)) { inContext.put("postalCode", destPostalAddress.getString("postalCode").substring(0,5)); @@ -846,7 +846,7 @@ public class DhlServices { eCommerceRequestDocument); return eCommerceRequestDocument; } - + public static void handleErrors(Element responseElement, List<Object> errorList, Locale locale) { Element faultsElement = UtilXml.firstChildElement(responseElement, "Faults"); @@ -872,9 +872,9 @@ public class DhlServices { } } } - + private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { @@ -889,25 +889,22 @@ public class DhlServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } } return returnValue; } - private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } return returnValue; } } - - @SuppressWarnings("serial") class DhlConnectException extends GeneralException { DhlConnectException() { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java index 53b3a24..8ffb1fc 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java @@ -80,20 +80,20 @@ public class FedexServices { public final static String MODULE = FedexServices.class.getName(); public final static String shipmentPropertiesFile = "shipment.properties"; private static final String RES_ERROR = "ProductUiLabels"; - + /** * Opens a URL to Fedex and makes a request. * * @param xmlString XML message to send * @param delegator the delegator * @param shipmentGatewayConfigId the shipmentGatewayConfigId - * @param RESOURCE RESOURCE file name + * @param resource RESOURCE file name * @return XML string response from FedEx * @throws FedexConnectException */ public static String sendFedexRequest(String xmlString, Delegator delegator, String shipmentGatewayConfigId, - String RESOURCE, Locale locale) throws FedexConnectException { - String url = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", RESOURCE, "shipment.fedex.connect.url"); + String resource, Locale locale) throws FedexConnectException { + String url = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", resource, "shipment.fedex.connect.url"); if (UtilValidate.isEmpty(url)) { throw new FedexConnectException(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexConnectUrlIncomplete", locale)); @@ -109,7 +109,7 @@ public class FedexServices { // prepare the connect string url = url.trim(); - String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", RESOURCE, "shipment.fedex.connect.timeout", "60"); + String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", resource, "shipment.fedex.connect.timeout", "60"); int timeout = 60; try { timeout = Integer.parseInt(timeOutStr); @@ -150,14 +150,14 @@ public class FedexServices { public static Map<String, Object> fedexSubscriptionRequest(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); List<Object> errorList = new LinkedList<> (); Boolean replaceMeterNumber = (Boolean) context.get("replaceMeterNumber"); if (!replaceMeterNumber) { - String meterNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessMeterNumber", RESOURCE, "shipment.fedex.access.meterNumber"); + String meterNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessMeterNumber", resource, "shipment.fedex.access.meterNumber"); if (UtilValidate.isNotEmpty(meterNumber)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexMeterNumberAlreadyExists", @@ -170,7 +170,7 @@ public class FedexServices { Map<String, Object> result = new HashMap<>(); - String accountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessAccountNbr", RESOURCE, "shipment.fedex.access.accountNbr"); + String accountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessAccountNbr", resource, "shipment.fedex.access.accountNbr"); if (UtilValidate.isEmpty(accountNumber)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexAccountNumberNotFound", locale)); @@ -287,7 +287,7 @@ public class FedexServices { faxNumberConditions.add(EntityCondition.makeCondition("contactNumber", EntityOperator.NOT_EQUAL, "")); List<GenericValue> faxNumbers = EntityUtil.filterByCondition(partyContactDetails, EntityCondition.makeCondition(faxNumberConditions, EntityOperator.AND)); GenericValue faxNumberValue = EntityUtil.getFirst(faxNumbers); - if (! UtilValidate.isEmpty(faxNumberValue)) { + if (!UtilValidate.isEmpty(faxNumberValue)) { faxNumber = faxNumberValue.getString("areaCode") + faxNumberValue.getString("contactNumber"); // Fedex doesn't want the North American country code if (UtilValidate.isNotEmpty(faxNumberValue.getString("countryCode")) && !("CA".equals(countryCode) || "US".equals(countryCode))) { @@ -303,12 +303,12 @@ public class FedexServices { emailConditions.add(EntityCondition.makeCondition("infoString", EntityOperator.NOT_EQUAL, "")); List<GenericValue> emailAddresses = EntityUtil.filterByCondition(partyContactDetails, EntityCondition.makeCondition(emailConditions, EntityOperator.AND)); GenericValue emailAddressValue = EntityUtil.getFirst(emailAddresses); - if (! UtilValidate.isEmpty(emailAddressValue)) { + if (!UtilValidate.isEmpty(emailAddressValue)) { emailAddress = emailAddressValue.getString("infoString"); } // Get the location of the Freemarker (XML) template for the FDXSubscriptionRequest - String templateLocation = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "templateSubscription", RESOURCE, "shipment.fedex.template.subscription.location"); + String templateLocation = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "templateSubscription", resource, "shipment.fedex.template.subscription.location"); if (UtilValidate.isEmpty(templateLocation)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexSubscriptionTemplateLocationNotFound", @@ -353,7 +353,7 @@ public class FedexServices { // Send the request String fDXSubscriptionReplyString = null; try { - fDXSubscriptionReplyString = sendFedexRequest(fDXSubscriptionRequestString, delegator, shipmentGatewayConfigId, RESOURCE, locale); + fDXSubscriptionReplyString = sendFedexRequest(fDXSubscriptionRequestString, delegator, shipmentGatewayConfigId, resource, locale); Debug.logInfo("Fedex response for FDXSubscriptionRequest:" + fDXSubscriptionReplyString, MODULE); } catch (FedexConnectException e) { String errorMessage = "Error sending Fedex request for FDXSubscriptionRequest: " + e.toString(); @@ -407,14 +407,14 @@ public class FedexServices { Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexGatewayNotAvailable", locale)); } - + // Get the location of the Freemarker (XML) template for the FDXShipRequest - String templateLocation = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "templateShipment", RESOURCE, "shipment.fedex.template.ship.location"); + String templateLocation = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "templateShipment", resource, "shipment.fedex.template.ship.location"); if (UtilValidate.isEmpty(templateLocation)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexShipmentTemplateLocationNotFound", @@ -422,14 +422,14 @@ public class FedexServices { } // Get the Fedex account number - String accountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessAccountNbr", RESOURCE, "shipment.fedex.access.accountNbr"); + String accountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessAccountNbr", resource, "shipment.fedex.access.accountNbr"); if (UtilValidate.isEmpty(accountNumber)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexAccountNumberNotFound", locale)); } // Get the Fedex meter number - String meterNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessMeterNumber", RESOURCE, "shipment.fedex.access.meterNumber"); + String meterNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessMeterNumber", resource, "shipment.fedex.access.meterNumber"); if (UtilValidate.isEmpty(meterNumber)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexMeterNumberNotFound", @@ -441,7 +441,7 @@ public class FedexServices { if (UtilValidate.isEmpty(weightUomId)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentDefaultWeightUomIdNotFound", locale)); - } else if (! ("WT_lb".equals(weightUomId) || "WT_kg".equals(weightUomId))) { + } else if (!("WT_lb".equals(weightUomId) || "WT_kg".equals(weightUomId))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentDefaultWeightUomIdNotValid", locale)); } @@ -451,23 +451,23 @@ public class FedexServices { if (UtilValidate.isEmpty(dimensionsUomId)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentDefaultDimensionUomIdNotFound", locale)); - } else if (! ("LEN_in".equals(dimensionsUomId) || "LEN_cm".equals(dimensionsUomId))) { + } else if (!("LEN_in".equals(dimensionsUomId) || "LEN_cm".equals(dimensionsUomId))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentDefaultDimensionUomIdNotValid", locale)); } // Get the label image type to be returned - String labelImageType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "labelImageType", RESOURCE, "shipment.fedex.labelImageType"); + String labelImageType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "labelImageType", resource, "shipment.fedex.labelImageType"); if (UtilValidate.isEmpty(labelImageType)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexLabelImageTypeNotFound", locale)); - } else if (! ("PDF".equals(labelImageType) || "PNG".equals(labelImageType))) { + } else if (!("PDF".equals(labelImageType) || "PNG".equals(labelImageType))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexLabelImageTypeNotValid", locale)); } // Get the default dropoff type - String dropoffType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultDropoffType", RESOURCE, "shipment.fedex.default.dropoffType"); + String dropoffType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultDropoffType", resource, "shipment.fedex.default.dropoffType"); if (UtilValidate.isEmpty(dropoffType)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexDropoffTypeNotFound", locale)); @@ -491,7 +491,7 @@ public class FedexServices { // Determine the Fedex carrier String carrierPartyId = shipmentRouteSegment.getString("carrierPartyId"); - if (! "FEDEX".equals(carrierPartyId)) { + if (!"FEDEX".equals(carrierPartyId)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexNotRouteSegmentCarrier", UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", shipmentId), locale)); @@ -553,7 +553,7 @@ public class FedexServices { "FacilityShipmentRouteSegmentOriginCountryGeoNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - + String originAddressCountryCode = originCountryGeo.getString("geoCode"); String originAddressStateOrProvinceCode = null; @@ -682,7 +682,7 @@ public class FedexServices { // Determine the home-delivery instructions homeDeliveryType = shipmentRouteSegment.getString("homeDeliveryType"); if (UtilValidate.isNotEmpty(homeDeliveryType)) { - if (! ("DATECERTAIN".equals(homeDeliveryType) || "EVENING".equals(homeDeliveryType) || "APPOINTMENT".equals(homeDeliveryType))) { + if (!("DATECERTAIN".equals(homeDeliveryType) || "EVENING".equals(homeDeliveryType) || "APPOINTMENT".equals(homeDeliveryType))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexHomeDeliveryTypeInvalid", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); @@ -768,7 +768,7 @@ public class FedexServices { } // Convert the weight if necessary - if (! billingWeightUomId.equals(weightUomId)) { + 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); @@ -789,7 +789,7 @@ public class FedexServices { // FedEx requires the packaging type String packaging = null; if (UtilValidate.isEmpty(shipmentBoxType)) { - packaging = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultPackagingType", RESOURCE, "shipment.fedex.default.packagingType"); + packaging = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultPackagingType", resource, "shipment.fedex.default.packagingType"); if (UtilValidate.isEmpty(packaging)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexPackingTypeNotConfigured", @@ -827,14 +827,14 @@ public class FedexServices { String boxDimensionsUomId = null; GenericValue boxDimensionsUom = shipmentBoxType.getRelatedOne("DimensionUom", false); - if (! UtilValidate.isEmpty(boxDimensionsUom)) { + if (!UtilValidate.isEmpty(boxDimensionsUom)) { boxDimensionsUomId = boxDimensionsUom.getString("uomId"); } else { Debug.logWarning("Packaging type for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId + " is missing dimensionUomId, assuming default shipment.default.dimension.uom of " + dimensionsUomId + " from " + shipmentPropertiesFile, MODULE); boxDimensionsUomId = dimensionsUomId; } if (dimensionsLength != null && dimensionsLength.compareTo(BigDecimal.ZERO) > 0) { - if (! boxDimensionsUomId.equals(dimensionsUomId)) { + if (!boxDimensionsUomId.equals(dimensionsUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", boxDimensionsUomId, "uomIdTo", dimensionsUomId, "originalValue", dimensionsLength)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { Debug.logWarning("Unable to convert length for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId , MODULE); @@ -846,7 +846,7 @@ public class FedexServices { } if (dimensionsWidth != null && dimensionsWidth.compareTo(BigDecimal.ZERO) > 0) { - if (! boxDimensionsUomId.equals(dimensionsUomId)) { + if (!boxDimensionsUomId.equals(dimensionsUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", boxDimensionsUomId, "uomIdTo", dimensionsUomId, "originalValue", dimensionsWidth)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { Debug.logWarning("Unable to convert width for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId , MODULE); @@ -858,7 +858,7 @@ public class FedexServices { } if (dimensionsHeight != null && dimensionsHeight.compareTo(BigDecimal.ZERO) > 0) { - if (! boxDimensionsUomId.equals(dimensionsUomId)) { + if (!boxDimensionsUomId.equals(dimensionsUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", boxDimensionsUomId, "uomIdTo", dimensionsUomId, "originalValue", dimensionsHeight)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { Debug.logWarning("Unable to convert height for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId , MODULE); @@ -873,7 +873,7 @@ public class FedexServices { // Determine the package weight (possibly overriden by route segment billing weight) BigDecimal packageWeight = null; - if (! hasBillingWeight) { + if (!hasBillingWeight) { if (UtilValidate.isNotEmpty(shipmentPackage.getString("weight"))) { packageWeight = shipmentPackage.getBigDecimal("weight"); } else { @@ -893,7 +893,7 @@ public class FedexServices { Debug.logWarning("Shipment Route Segment missing weightUomId in shipmentId " + shipmentId + ", assuming shipment.default.weight.uom of " + weightUomId + " from " + shipmentPropertiesFile, MODULE); packageWeightUomId = weightUomId; } - if (! packageWeightUomId.equals(weightUomId)) { + if (!packageWeightUomId.equals(weightUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", packageWeightUomId, "uomIdTo", weightUomId, "originalValue", packageWeight)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -944,7 +944,7 @@ public class FedexServices { String fDXShipRequestString = outWriter.toString(); String fDXShipReplyString = null; try { - fDXShipReplyString = sendFedexRequest(fDXShipRequestString, delegator, shipmentGatewayConfigId, RESOURCE, locale); + fDXShipReplyString = sendFedexRequest(fDXShipRequestString, delegator, shipmentGatewayConfigId, resource, locale); if (Debug.verboseOn()) { Debug.logVerbose(fDXShipReplyString, MODULE); } @@ -974,7 +974,7 @@ public class FedexServices { * @param shipmentPackageRouteSegs * @throws GenericEntityException */ - public static Map<String, Object> handleFedexShipReply(String fDXShipReplyString, GenericValue shipmentRouteSegment, + public static Map<String, Object> handleFedexShipReply(String fDXShipReplyString, GenericValue shipmentRouteSegment, List<GenericValue> shipmentPackageRouteSegs, Locale locale) throws GenericEntityException { List<Object> errorList = new LinkedList<>(); GenericValue shipmentPackageRouteSeg = shipmentPackageRouteSegs.get(0); @@ -1034,7 +1034,7 @@ public class FedexServices { shipmentRouteSegment.set("trackingIdNumber", trackingNumber); shipmentRouteSegment.put("carrierServiceStatusId", "SHRSCS_CONFIRMED"); shipmentRouteSegment.store(); - + return ServiceUtil.returnSuccess(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexShipmentConfirmed", locale)); } @@ -1059,9 +1059,9 @@ public class FedexServices { } } } - - private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + + private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { @@ -1076,17 +1076,17 @@ public class FedexServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } } return returnValue; } - + private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java index e4619e6..bf77176 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java @@ -107,12 +107,12 @@ public class UpsServices { Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsGatewayNotAvailable", locale)); } - boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", RESOURCE, "shipment.ups.save.certification.info", "true")); - String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", RESOURCE, "shipment.ups.save.certification.path", ""), context); + boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", resource, "shipment.ups.save.certification.info", "true")); + String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", resource, "shipment.ups.save.certification.path", ""), context); File shipmentUpsSaveCertificationFile = null; if (shipmentUpsSaveCertificationInfo) { shipmentUpsSaveCertificationFile = new File(shipmentUpsSaveCertificationPath); @@ -138,7 +138,7 @@ public class UpsServices { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsNotRouteSegmentCarrier", UtilMisc.toMap("shipmentRouteSegmentId", shipmentRouteSegmentId, "shipmentId", shipmentId), locale)); } - + // add ShipmentRouteSegment carrierServiceStatusId, check before all UPS services if (UtilValidate.isNotEmpty(shipmentRouteSegment.getString("carrierServiceStatusId")) && !"SHRSCS_NOT_STARTED".equals(shipmentRouteSegment.getString("carrierServiceStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsRouteSegmentStatusNotStarted", @@ -220,7 +220,7 @@ public class UpsServices { } String ordersDescription = ""; if (orderIdSet.size() > 1) { - + StringBuilder odBuf = new StringBuilder(UtilProperties.getMessage(RES_ORDER, "OrderOrders", locale) + " "); for (String orderId: orderIdSet) { if (odBuf.length() > 0) { @@ -234,7 +234,7 @@ public class UpsServices { } // COD Support - boolean allowCOD = "true".equalsIgnoreCase(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codAllowCod", RESOURCE, "shipment.ups.cod.allowCOD", "true")); + boolean allowCOD = "true".equalsIgnoreCase(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codAllowCod", resource, "shipment.ups.cod.allowCOD", "true")); // COD only applies if all orders involved with the shipment were paid only with EXT_COD - anything else becomes too complicated if (allowCOD) { @@ -261,19 +261,19 @@ public class UpsServices { BigDecimal codSurchargePackageAmount = null; if (allowCOD) { - codSurchargeAmount = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codSurchargeAmount", RESOURCE, "shipment.ups.cod.surcharge.amount", ""); + codSurchargeAmount = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codSurchargeAmount", resource, "shipment.ups.cod.surcharge.amount", ""); if (UtilValidate.isEmpty(codSurchargeAmount)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsSurchargeAmountIsNotConfigurated", locale)); } - codSurchargeCurrencyUomId = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codSurchargeCurrencyUomId", RESOURCE, "shipment.ups.cod.surcharge.currencyUomId", ""); + codSurchargeCurrencyUomId = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codSurchargeCurrencyUomId", resource, "shipment.ups.cod.surcharge.currencyUomId", ""); if (UtilValidate.isEmpty(codSurchargeCurrencyUomId)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsSurchargeCurrencyIsNotConfigurated", locale)); } - String codSurchargeApplyToPackages = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codSurchargeApplyToPackage", RESOURCE, "shipment.ups.cod.surcharge.applyToPackages", ""); + String codSurchargeApplyToPackages = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codSurchargeApplyToPackage", resource, "shipment.ups.cod.surcharge.applyToPackages", ""); if (UtilValidate.isEmpty(codSurchargeApplyToPackages)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsApplyToPackagesIsNotConfigured", locale)); } - codFundsCode = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codFundsCode", RESOURCE, "shipment.ups.cod.codFundsCode", ""); + codFundsCode = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "codFundsCode", resource, "shipment.ups.cod.codFundsCode", ""); if (UtilValidate.isEmpty(codFundsCode)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsCodFundsCodeIsNotConfigured", locale)); } @@ -340,7 +340,7 @@ public class UpsServices { UtilXml.addChildElementValue(shipmentElement, "Description", "Goods for Shipment " + shipment.get("shipmentId") + " from " + ordersDescription, shipmentConfirmRequestDoc); // Child of Shipment: Shipper - String shipperNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperNumber", RESOURCE, "shipment.ups.shipper.number", ""); + String shipperNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperNumber", resource, "shipment.ups.shipper.number", ""); Element shipperElement = UtilXml.addChildElement(shipmentElement, "Shipper", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(shipperElement, "Name", UtilValidate.isNotEmpty(originPostalAddress.getString("toName")) ? originPostalAddress.getString("toName") : "", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(shipperElement, "AttentionName", UtilValidate.isNotEmpty(originPostalAddress.getString("attnName")) ? originPostalAddress.getString("attnName") : "", shipmentConfirmRequestDoc); @@ -422,7 +422,7 @@ public class UpsServices { Element billShipperElement = UtilXml.addChildElement(prepaidElement, "BillShipper", shipmentConfirmRequestDoc); // fill in BillShipper AccountNumber element - String billShipperAccountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "billShipperAccountNumber", RESOURCE, "shipment.ups.bill.shipper.account.number", ""); + String billShipperAccountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "billShipperAccountNumber", resource, "shipment.ups.bill.shipper.account.number", ""); UtilXml.addChildElementValue(billShipperElement, "AccountNumber", billShipperAccountNumber, shipmentConfirmRequestDoc); } else { @@ -477,7 +477,7 @@ public class UpsServices { SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT); String invoiceDate = formatter.format(shipment.getTimestamp("createdDate")); UtilXml.addChildElementValue(internationalFormsElement, "InvoiceDate", invoiceDate, shipmentConfirmRequestDoc); - UtilXml.addChildElementValue(internationalFormsElement, "ReasonForExport","SALE", shipmentConfirmRequestDoc); + UtilXml.addChildElementValue(internationalFormsElement, "ReasonForExport", "SALE", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(internationalFormsElement, "CurrencyCode", currencyCode, shipmentConfirmRequestDoc); } @@ -600,7 +600,7 @@ public class UpsServices { UtilXml.addChildElementValue(codAmountElement, "MonetaryValue", packageValue.setScale(DECIMALS, ROUNDING).toString(), shipmentConfirmRequestDoc); } } - + String shipmentConfirmRequestString = null; try { shipmentConfirmRequestString = UtilXml.writeXmlDocument(shipmentConfirmRequestDoc); @@ -612,7 +612,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument); @@ -641,7 +641,7 @@ public class UpsServices { } try { - shipmentConfirmResponseString = sendUpsRequest("ShipConfirm", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + shipmentConfirmResponseString = sendUpsRequest("ShipConfirm", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service ShipConfirm: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -779,7 +779,7 @@ public class UpsServices { // -=-=-=- Okay, now done with that, just return any extra info... StringBuilder successString = new StringBuilder(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsShipmentConfirmSucceeded", locale)); - + if (errorList.size() > 0) { // this shouldn't happen much, but handle it anyway successString.append(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsShipmentConfirmError", locale)); @@ -806,12 +806,12 @@ public class UpsServices { Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsGatewayNotAvailable", locale)); } - boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", RESOURCE, "shipment.ups.save.certification.info", "true")); - String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", RESOURCE, "shipment.ups.save.certification.path", ""), context); + boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", resource, "shipment.ups.save.certification.info", "true")); + String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", resource, "shipment.ups.save.certification.path", ""), context); File shipmentUpsSaveCertificationFile = null; if (shipmentUpsSaveCertificationInfo) { shipmentUpsSaveCertificationFile = new File(shipmentUpsSaveCertificationPath); @@ -875,7 +875,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument); @@ -904,7 +904,7 @@ public class UpsServices { } try { - shipmentAcceptResponseString = sendUpsRequest("ShipAccept", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + shipmentAcceptResponseString = sendUpsRequest("ShipAccept", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service ShipAccept: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -933,7 +933,7 @@ public class UpsServices { } return handleUpsShipmentAcceptResponse(shipmentAcceptResponseDocument, shipmentRouteSegment, shipmentPackageRouteSegs, delegator, - shipmentGatewayConfigId, RESOURCE, context, locale); + shipmentGatewayConfigId, resource, context, locale); } catch (GenericEntityException e) { Debug.logError(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorDataShipmentAccept", @@ -942,9 +942,9 @@ public class UpsServices { } public static Map<String, Object> handleUpsShipmentAcceptResponse(Document shipmentAcceptResponseDocument, GenericValue shipmentRouteSegment, List<GenericValue> shipmentPackageRouteSegs, - Delegator delegator, String shipmentGatewayConfigId, String RESOURCE, Map<String, ? extends Object> context, Locale locale) throws GenericEntityException { - boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", RESOURCE, "shipment.ups.save.certification.info", "true")); - String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", RESOURCE, "shipment.ups.save.certification.path", ""), context); + Delegator delegator, String shipmentGatewayConfigId, String resource, Map<String, ? extends Object> context, Locale locale) throws GenericEntityException { + boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", resource, "shipment.ups.save.certification.info", "true")); + String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", resource, "shipment.ups.save.certification.path", ""), context); File shipmentUpsSaveCertificationFile = null; if (shipmentUpsSaveCertificationInfo) { shipmentUpsSaveCertificationFile = new File(shipmentUpsSaveCertificationPath); @@ -1185,12 +1185,12 @@ public class UpsServices { Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsGatewayNotAvailable", locale)); } - boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", RESOURCE, "shipment.ups.save.certification.info", "true")); - String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", RESOURCE, "shipment.ups.save.certification.path", ""), context); + boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", resource, "shipment.ups.save.certification.info", "true")); + String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", resource, "shipment.ups.save.certification.path", ""), context); File shipmentUpsSaveCertificationFile = null; if (shipmentUpsSaveCertificationInfo) { shipmentUpsSaveCertificationFile = new File(shipmentUpsSaveCertificationPath); @@ -1247,7 +1247,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument); @@ -1276,7 +1276,7 @@ public class UpsServices { } try { - voidShipmentResponseString = sendUpsRequest("Void", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + voidShipmentResponseString = sendUpsRequest("Void", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service Void: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -1370,12 +1370,12 @@ public class UpsServices { Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsGatewayNotAvailable", locale)); } - boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", RESOURCE, "shipment.ups.save.certification.info", "true")); - String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", RESOURCE, "shipment.ups.save.certification.path", ""), context); + boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", resource, "shipment.ups.save.certification.info", "true")); + String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", resource, "shipment.ups.save.certification.path", ""), context); File shipmentUpsSaveCertificationFile = null; if (shipmentUpsSaveCertificationInfo) { shipmentUpsSaveCertificationFile = new File(shipmentUpsSaveCertificationPath); @@ -1433,7 +1433,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument); @@ -1462,7 +1462,7 @@ public class UpsServices { } try { - trackResponseString = sendUpsRequest("Track", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + trackResponseString = sendUpsRequest("Track", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service Track: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -1546,11 +1546,8 @@ public class UpsServices { </Package> * */ - - // -=-=-=- Okay, now done with that, just return any extra info... StringBuilder successString = new StringBuilder(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsShipmentTrackSucceeded", locale)); - if (errorList.size() > 0) { // this shouldn't happen much, but handle it anyway successString.append(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsShipmentTrackError", locale)); @@ -1669,7 +1666,7 @@ public class UpsServices { Element packageWeightElement = UtilXml.addChildElement(packageElement, "PackageWeight", requestDoc); UtilXml.addChildElementValue(packageWeightElement, "Weight", packageWeight.toPlainString(), requestDoc); //If product is in shippable Package then it we should have one product per packagemap - if (packageMap.size() ==1) { + if (packageMap.size() == 1) { Iterator<String> i = packageMap.keySet().iterator(); String productId = i.next(); Map<String, Object> productInfo = ShipmentWorker.getProductItemInfo(shippableItemInfo, productId); @@ -1767,7 +1764,7 @@ public class UpsServices { String errorCode = UtilXml.childElementValue(errorElement, "ErrorCode"); String errorDescription = UtilXml.childElementValue(errorElement, "ErrorDescription"); String minimumRetrySeconds = UtilXml.childElementValue(errorElement, "MinimumRetrySeconds"); - + errorMessageBuf.append(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorMessage", UtilMisc.toMap("errorCode", errorCode, "errorSeverity", errorSeverity, "errorDescription", errorDescription), locale)); if (UtilValidate.isNotEmpty(minimumRetrySeconds)) { @@ -1784,7 +1781,7 @@ public class UpsServices { errorMessageBuf.append(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorWasAtElement", UtilMisc.toMap("errorLocationElementName", errorLocationElementName), locale)); - + if (UtilValidate.isNotEmpty(errorLocationAttributeName)) { errorMessageBuf.append(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorWasAtElementAttribute", UtilMisc.toMap("errorLocationAttributeName", errorLocationAttributeName), locale)); @@ -1809,7 +1806,7 @@ public class UpsServices { * @throws UpsConnectException */ public static String sendUpsRequest(String upsService, String xmlString, String shipmentGatewayConfigId, - String RESOURCE, Delegator delegator, Locale locale) throws UpsConnectException { + String resource, Delegator delegator, Locale locale) throws UpsConnectException { // need a ups service to call if (upsService == null) { @@ -1822,7 +1819,7 @@ public class UpsServices { throw new UpsConnectException(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsXmlMessageCannotBeNull", locale)); } - String conStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", RESOURCE, "shipment.ups.connect.url"); + String conStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", resource, "shipment.ups.connect.url"); if (UtilValidate.isEmpty(conStr)) { throw new UpsConnectException(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsIncompleteConnectionURL", locale)); } @@ -1834,7 +1831,7 @@ public class UpsServices { } conStr = conStr + upsService; - String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", RESOURCE, "shipment.ups.connect.timeout", "60"); + String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", resource, "shipment.ups.connect.timeout", "60"); int timeout = 60; try { timeout = Integer.parseInt(timeOutStr); @@ -1895,7 +1892,7 @@ public class UpsServices { // grab the pickup type; if none is defined we will assume daily pickup String pickupType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperPickupType", serviceConfigProps, "shipment.ups.shipper.pickup.type", "01"); - + // if we're drop shipping from a supplier, then the address is given to us GenericValue shipFromAddress = (GenericValue) context.get("shipFromAddress"); if (shipFromAddress == null) { @@ -2039,7 +2036,7 @@ public class UpsServices { return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsErrorAccessRequestXmlToString", UtilMisc.toMap("errorString", e.toString()), locale)); } - + // prepare the access/inquire request string StringBuilder xmlString = new StringBuilder(); xmlString.append(accessRequestString); @@ -2076,8 +2073,8 @@ public class UpsServices { String postalCode = (String) context.get("postalCode"); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("serviceConfigProps"); - + String resource = (String) context.get("serviceConfigProps"); + if (UtilValidate.isEmpty(city) && UtilValidate.isEmpty(postalCode)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsAddressValidationRequireCityOrPostalCode", locale)); @@ -2119,7 +2116,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { @@ -2141,7 +2138,7 @@ public class UpsServices { // send the request String avResponseString = null; try { - avResponseString = sendUpsRequest("AV", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + avResponseString = sendUpsRequest("AV", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -2218,12 +2215,12 @@ public class UpsServices { Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsGatewayNotAvailable", locale)); } - boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", RESOURCE, "shipment.ups.save.certification.info", "true")); - String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", RESOURCE, "shipment.ups.save.certification.path", ""), context); + boolean shipmentUpsSaveCertificationInfo = "true".equals(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertInfo", resource, "shipment.ups.save.certification.info", "true")); + String shipmentUpsSaveCertificationPath = FlexibleStringExpander.expandString(getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "saveCertPath", resource, "shipment.ups.save.certification.path", ""), context); File shipmentUpsSaveCertificationFile = null; if (shipmentUpsSaveCertificationInfo) { shipmentUpsSaveCertificationFile = new File(shipmentUpsSaveCertificationPath); @@ -2356,7 +2353,7 @@ public class UpsServices { UtilXml.addChildElementValue(returnServiceElement, "Code", String.valueOf(RET_SERVICE_CODE), shipmentConfirmRequestDoc); // Child of Shipment: Shipper - String shipperNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperNumber", RESOURCE, "shipment.ups.shipper.number", ""); + String shipperNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperNumber", resource, "shipment.ups.shipper.number", ""); Element shipperElement = UtilXml.addChildElement(shipmentElement, "Shipper", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(shipperElement, "Name", UtilValidate.isNotEmpty(originPostalAddress.getString("toName")) ? originPostalAddress.getString("toName"): "", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(shipperElement, "AttentionName", UtilValidate.isNotEmpty(originPostalAddress.getString("attnName")) ? originPostalAddress.getString("attnName") : "", shipmentConfirmRequestDoc); @@ -2419,7 +2416,7 @@ public class UpsServices { Element billShipperElement = UtilXml.addChildElement(prepaidElement, "BillShipper", shipmentConfirmRequestDoc); // fill in BillShipper AccountNumber element from properties file - String billShipperAccountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "billShipperAccountNumber", RESOURCE, "shipment.ups.bill.shipper.account.number", ""); + String billShipperAccountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "billShipperAccountNumber", resource, "shipment.ups.bill.shipper.account.number", ""); UtilXml.addChildElementValue(billShipperElement, "AccountNumber", billShipperAccountNumber, shipmentConfirmRequestDoc); } @@ -2428,8 +2425,8 @@ public class UpsServices { UtilXml.addChildElementValue(serviceElement, "Code", carrierShipmentMethod.getString("carrierServiceCode"), shipmentConfirmRequestDoc); // Child of Shipment: ShipmentServiceOptions - String defaultReturnLabelMemo = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultReturnLabelMemo", RESOURCE, "shipment.ups.default.returnLabel.memo", ""); - String defaultReturnLabelSubject = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultReturnLabelSubject", RESOURCE, "shipment.ups.default.returnLabel.subject", ""); + String defaultReturnLabelMemo = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultReturnLabelMemo", resource, "shipment.ups.default.returnLabel.memo", ""); + String defaultReturnLabelSubject = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "defaultReturnLabelSubject", resource, "shipment.ups.default.returnLabel.subject", ""); Element shipmentServiceOptionsElement = UtilXml.addChildElement(shipmentElement, "ShipmentServiceOptions", shipmentConfirmRequestDoc); Element labelDeliveryElement = UtilXml.addChildElement(shipmentServiceOptionsElement, "LabelDelivery", shipmentConfirmRequestDoc); Element emailMessageElement = UtilXml.addChildElement(labelDeliveryElement, "EMailMessage", shipmentConfirmRequestDoc); @@ -2438,7 +2435,7 @@ public class UpsServices { UtilXml.addChildElementValue(emailMessageElement, "FromName", UtilValidate.isNotEmpty(originPostalAddress.getString("attnName")) ? originPostalAddress.getString("attnName") : "", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(emailMessageElement, "Memo", defaultReturnLabelMemo, shipmentConfirmRequestDoc); UtilXml.addChildElementValue(emailMessageElement, "Subject", defaultReturnLabelSubject, shipmentConfirmRequestDoc); - + // Child of Shipment: Package Element packageElement = UtilXml.addChildElement(shipmentElement, "Package", shipmentConfirmRequestDoc); Element packagingTypeElement = UtilXml.addChildElement(packageElement, "PackagingType", shipmentConfirmRequestDoc); @@ -2460,7 +2457,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument); @@ -2478,7 +2475,7 @@ public class UpsServices { xmlString.append(accessRequestString); xmlString.append(shipmentConfirmRequestString); try { - shipmentConfirmResponseString = sendUpsRequest("ShipConfirm", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + shipmentConfirmResponseString = sendUpsRequest("ShipConfirm", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service ShipConfirm: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -2550,7 +2547,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document acceptAccessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document acceptAccessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String acceptAccessRequestString = null; try { acceptAccessRequestString = UtilXml.writeXmlDocument(acceptAccessRequestDocument); @@ -2577,7 +2574,7 @@ public class UpsServices { } } try { - sendUpsRequest("ShipAccept", acceptXmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + sendUpsRequest("ShipAccept", acceptXmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service ShipAccept: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -2610,8 +2607,8 @@ public class UpsServices { GenericValue shipmentRouteSegment = null; Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUpsGatewayNotAvailable", locale)); } @@ -2689,11 +2686,11 @@ public class UpsServices { } // grab the pickup type; if none is defined we will assume daily pickup - String pickupType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperPickupType", RESOURCE, "shipment.ups.shipper.pickup.type", "01"); - + String pickupType = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "shipperPickupType", resource, "shipment.ups.shipper.pickup.type", "01"); + // grab the customer classification; if none is defined we will assume daily pickup - String customerClassification = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "customerClassification", RESOURCE, "shipment.ups.customerclassification", "01"); - + String customerClassification = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "customerClassification", resource, "shipment.ups.customerclassification", "01"); + // should be shop to get estimates for all the possible shipping method of UPS upsRateInquireMode = "Shop"; @@ -2859,7 +2856,7 @@ public class UpsServices { } // create AccessRequest XML doc - Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, RESOURCE); + Document accessRequestDocument = createAccessRequestDocument(delegator, shipmentGatewayConfigId, resource); String accessRequestString = null; try { accessRequestString = UtilXml.writeXmlDocument(accessRequestDocument); @@ -2878,7 +2875,7 @@ public class UpsServices { if (Debug.verboseOn()) Debug.logVerbose(xmlString.toString(), MODULE); // send the request try { - rateResponseString = sendUpsRequest("Rate", xmlString.toString(), shipmentGatewayConfigId, RESOURCE, delegator, locale); + rateResponseString = sendUpsRequest("Rate", xmlString.toString(), shipmentGatewayConfigId, resource, delegator, locale); } catch (UpsConnectException e) { String uceErrMsg = "Error sending UPS request for UPS Service Rate: " + e.toString(); Debug.logError(e, uceErrMsg, MODULE); @@ -2977,7 +2974,7 @@ public class UpsServices { } private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { @@ -2992,17 +2989,17 @@ public class UpsServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } } return returnValue; } - + private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java index b8cbeb4..38c3a1a 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java @@ -88,7 +88,7 @@ public class UspsServices { public static Map<String, Object> uspsRateInquire(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); // check for 0 weight BigDecimal shippableWeight = (BigDecimal) context.get("shippableWeight"); @@ -161,12 +161,12 @@ public class UspsServices { } // create the request document - Document requestDocument = createUspsRequestDocument("RateV2Request", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("RateV2Request", true, delegator, shipmentGatewayConfigId, resource); // TODO: 70 lb max is valid for Express, Priority and Parcel only - handle other methods BigDecimal maxWeight; - String maxWeightStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "maxEstimateWeight", - RESOURCE, "shipment.usps.max.estimate.weight", "70"); + String maxWeightStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "maxEstimateWeight", + resource, "shipment.usps.max.estimate.weight", "70"); try { maxWeight = new BigDecimal(maxWeightStr); } catch (NumberFormatException e) { @@ -201,7 +201,7 @@ public class UspsServices { } // (packageWeight % 1) * 16 (Rounded up to 0 dp) BigDecimal weightOunces = packageWeight.remainder(BigDecimal.ONE).multiply(new BigDecimal("16")).setScale(0, RoundingMode.CEILING); - + UtilXml.addChildElementValue(packageElement, "Pounds", weightPounds.toPlainString(), requestDocument); UtilXml.addChildElementValue(packageElement, "Ounces", weightOunces.toPlainString(), requestDocument); @@ -222,7 +222,7 @@ public class UspsServices { // send the request Document responseDocument = null; try { - responseDocument = sendUspsRequest("RateV2", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("RateV2", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -278,7 +278,7 @@ public class UspsServices { public static Map<String, Object> uspsInternationalRateInquire(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); // check for 0 weight @@ -332,8 +332,8 @@ public class UspsServices { } BigDecimal maxWeight; - String maxWeightStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "maxEstimateWeight", - RESOURCE, "shipment.usps.max.estimate.weight", "70"); + String maxWeightStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "maxEstimateWeight", + resource, "shipment.usps.max.estimate.weight", "70"); try { maxWeight = new BigDecimal(maxWeightStr); } catch (NumberFormatException e) { @@ -346,7 +346,7 @@ public class UspsServices { boolean isOnePackage = packages.size() == 1; // use shippableWeight if there's only one package // create the request document - Document requestDocument = createUspsRequestDocument("IntlRateRequest", false, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("IntlRateRequest", false, delegator, shipmentGatewayConfigId, resource); // TODO: Up to 25 packages can be included per request - handle more than 25 for (ListIterator<Map<String, BigDecimal>> li = packages.listIterator(); li.hasNext();) { @@ -379,7 +379,7 @@ public class UspsServices { // send the request Document responseDocument = null; try { - responseDocument = sendUspsRequest("IntlRate", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("IntlRate", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -453,17 +453,17 @@ public class UspsServices { public static Map<String, Object> uspsTrackConfirm(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); - Document requestDocument = createUspsRequestDocument("TrackRequest", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("TrackRequest", true, delegator, shipmentGatewayConfigId, resource); Element trackingElement = UtilXml.addChildElement(requestDocument.getDocumentElement(), "TrackID", requestDocument); trackingElement.setAttribute("ID", (String) context.get("trackingId")); Document responseDocument = null; try { - responseDocument = sendUspsRequest("TrackV2", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("TrackV2", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -529,7 +529,7 @@ public class UspsServices { public static Map<String, Object> uspsAddressValidation(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); String state = (String) context.get("state"); String city = (String) context.get("city"); String zip5 = (String) context.get("zip5"); @@ -541,7 +541,7 @@ public class UspsServices { "FacilityShipmentUspsAddressValidationStateAndCityOrZipRqd", locale)); } - Document requestDocument = createUspsRequestDocument("AddressValidateRequest", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("AddressValidateRequest", true, delegator, shipmentGatewayConfigId, resource); Element addressElement = UtilXml.addChildElement(requestDocument.getDocumentElement(), "Address", requestDocument); addressElement.setAttribute("ID", "0"); @@ -561,7 +561,7 @@ public class UspsServices { Document responseDocument = null; try { - responseDocument = sendUspsRequest("Verify", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("Verify", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -632,10 +632,10 @@ public class UspsServices { public static Map<String, Object> uspsCityStateLookup(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); - Document requestDocument = createUspsRequestDocument("CityStateLookupRequest", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("CityStateLookupRequest", true, delegator, shipmentGatewayConfigId, resource); Element zipCodeElement = UtilXml.addChildElement(requestDocument.getDocumentElement(), "ZipCode", requestDocument); zipCodeElement.setAttribute("ID", "0"); @@ -647,7 +647,7 @@ public class UspsServices { Document responseDocument = null; try { - responseDocument = sendUspsRequest("CityStateLookup", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("CityStateLookup", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -743,7 +743,7 @@ public class UspsServices { private static Map<String, Object> uspsServiceStandards(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); String type = (String) context.get("serviceType"); Locale locale = (Locale) context.get("locale"); if (!type.matches("PriorityMail|StandardB")) { @@ -752,7 +752,7 @@ public class UspsServices { UtilMisc.toMap("serviceType", type), locale)); } - Document requestDocument = createUspsRequestDocument(type + "Request", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument(type + "Request", true, delegator, shipmentGatewayConfigId, resource); UtilXml.addChildElementValue(requestDocument.getDocumentElement(), "OriginZip", (String) context.get("originZip"), requestDocument); @@ -761,7 +761,7 @@ public class UspsServices { Document responseDocument = null; try { - responseDocument = sendUspsRequest(type, requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest(type, requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -832,10 +832,10 @@ public class UspsServices { public static Map<String, Object> uspsDomesticRate(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); - Document requestDocument = createUspsRequestDocument("RateRequest", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("RateRequest", true, delegator, shipmentGatewayConfigId, resource); Element packageElement = UtilXml.addChildElement(requestDocument.getDocumentElement(), "Package", requestDocument); packageElement.setAttribute("ID", "0"); @@ -866,7 +866,7 @@ public class UspsServices { Document responseDocument = null; try { - responseDocument = sendUspsRequest("Rate", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("Rate", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -926,11 +926,11 @@ public class UspsServices { String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); Locale locale = (Locale) context.get("locale"); - + Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUspsGatewayNotAvailable", locale)); } @@ -991,7 +991,7 @@ public class UspsServices { // get the service type from the CarrierShipmentMethod String shipmentMethodTypeId = shipmentRouteSegment.getString("shipmentMethodTypeId"); String partyId = shipmentRouteSegment.getString("carrierPartyId"); - + GenericValue carrierShipmentMethod = EntityQuery.use(delegator).from("CarrierShipmentMethod").where("partyId", partyId, "roleTypeId", "CARRIER", "shipmentMethodTypeId", shipmentMethodTypeId).queryOne(); if (carrierShipmentMethod == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -1023,7 +1023,7 @@ public class UspsServices { for (Iterator<GenericValue> i = shipmentPackageRouteSegList.iterator(); i.hasNext();) { GenericValue shipmentPackageRouteSeg = i.next(); - Document requestDocument = createUspsRequestDocument("RateRequest", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("RateRequest", true, delegator, shipmentGatewayConfigId, resource); Element packageElement = UtilXml.addChildElement(requestDocument.getDocumentElement(), "Package", requestDocument); packageElement.setAttribute("ID", "0"); @@ -1120,7 +1120,7 @@ public class UspsServices { Document responseDocument = null; try { - responseDocument = sendUspsRequest("Rate", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("Rate", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -1224,11 +1224,11 @@ public class UspsServices { String shipmentId = (String) context.get("shipmentId"); String shipmentRouteSegmentId = (String) context.get("shipmentRouteSegmentId"); Locale locale = (Locale) context.get("locale"); - + Map<String, Object> shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); - String RESOURCE = (String) shipmentGatewayConfig.get("configProps"); - if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(RESOURCE)) { + String resource = (String) shipmentGatewayConfig.get("configProps"); + if (UtilValidate.isEmpty(shipmentGatewayConfigId) && UtilValidate.isEmpty(resource)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUspsGatewayNotAvailable", locale)); } @@ -1266,7 +1266,7 @@ public class UspsServices { "FacilityShipmentUspsRouteSegmentOriginCountryGeoNotInUsa", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); } - + // get the destination address GenericValue destinationAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false); if (destinationAddress == null) { @@ -1305,7 +1305,7 @@ public class UspsServices { } for (GenericValue shipmentPackageRouteSeg: shipmentPackageRouteSegList) { - Document requestDocument = createUspsRequestDocument("DeliveryConfirmationV2.0Request", true, delegator, shipmentGatewayConfigId, RESOURCE); + Document requestDocument = createUspsRequestDocument("DeliveryConfirmationV2.0Request", true, delegator, shipmentGatewayConfigId, resource); Element requestElement = requestDocument.getDocumentElement(); UtilXml.addChildElementValue(requestElement, "Option", "3", requestDocument); @@ -1342,13 +1342,13 @@ public class UspsServices { UtilXml.addChildElement(requestElement, "ToZip4", requestDocument); GenericValue shipmentPackage = shipmentPackageRouteSeg.getRelatedOne("ShipmentPackage", false); - + // WeightInOunces String weightStr = shipmentPackage.getString("weight"); if (UtilValidate.isEmpty(weightStr)) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentUspsWeightNotFound", - UtilMisc.toMap("shipmentId", shipmentPackage.getString("shipmentId"), + UtilMisc.toMap("shipmentId", shipmentPackage.getString("shipmentId"), "shipmentPackageSeqId", shipmentPackage.getString("shipmentPackageSeqId")), locale)); } @@ -1386,7 +1386,7 @@ public class UspsServices { Document responseDocument = null; try { - responseDocument = sendUspsRequest("DeliveryConfirmationV2", requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest("DeliveryConfirmationV2", requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -1469,18 +1469,18 @@ public class UspsServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); - String RESOURCE = (String) context.get("configProps"); + String resource = (String) context.get("configProps"); GenericValue shipmentRouteSegment = (GenericValue) context.get("shipmentRouteSegment"); Locale locale = (Locale) context.get("locale"); // Start the document Document requestDocument; boolean certify = false; - String test = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "test", RESOURCE, "shipment.usps.test"); + String test = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "test", resource, "shipment.usps.test"); if (!"Y".equalsIgnoreCase(test)) { - requestDocument = createUspsRequestDocument("PriorityMailIntlRequest", false, delegator, shipmentGatewayConfigId, RESOURCE); + requestDocument = createUspsRequestDocument("PriorityMailIntlRequest", false, delegator, shipmentGatewayConfigId, resource); } else { - requestDocument = createUspsRequestDocument("PriorityMailIntlCertifyRequest", false, delegator, shipmentGatewayConfigId, RESOURCE); + requestDocument = createUspsRequestDocument("PriorityMailIntlCertifyRequest", false, delegator, shipmentGatewayConfigId, resource); certify = true; } Element rootElement = requestDocument.getDocumentElement(); @@ -1633,7 +1633,7 @@ public class UspsServices { Document responseDocument = null; String api = certify ? "PriorityMailIntlCertify" : "PriorityMailIntl"; try { - responseDocument = sendUspsRequest(api, requestDocument, delegator, shipmentGatewayConfigId, RESOURCE, locale); + responseDocument = sendUspsRequest(api, requestDocument, delegator, shipmentGatewayConfigId, resource, locale); } catch (UspsRequestException e) { Debug.logInfo(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, @@ -1666,26 +1666,26 @@ public class UspsServices { return ServiceUtil.returnSuccess(); } - private static Document createUspsRequestDocument(String rootElement, boolean passwordRequired, Delegator delegator, String shipmentGatewayConfigId, String RESOURCE) { + private static Document createUspsRequestDocument(String rootElement, boolean passwordRequired, Delegator delegator, String shipmentGatewayConfigId, String resource) { Document requestDocument = UtilXml.makeEmptyXmlDocument(rootElement); Element requestElement = requestDocument.getDocumentElement(); requestElement.setAttribute("USERID", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, - "accessUserId", RESOURCE, "shipment.usps.access.userid", "")); + "accessUserId", resource, "shipment.usps.access.userid", "")); if (passwordRequired) { requestElement.setAttribute("PASSWORD", getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, - "accessPassword", RESOURCE, "shipment.usps.access.password", "")); + "accessPassword", resource, "shipment.usps.access.password", "")); } return requestDocument; } private static Document sendUspsRequest(String requestType, Document requestDocument, Delegator delegator, - String shipmentGatewayConfigId, String RESOURCE, Locale locale) throws UspsRequestException { + String shipmentGatewayConfigId, String resource, Locale locale) throws UspsRequestException { String conUrl = null; List<String> labelRequestTypes = UtilMisc.toList("PriorityMailIntl", "PriorityMailIntlCertify"); if (labelRequestTypes.contains(requestType)) { - conUrl = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrlLabels", RESOURCE, "shipment.usps.connect.url.labels"); + conUrl = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrlLabels", resource, "shipment.usps.connect.url.labels"); } else { - conUrl = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", RESOURCE, "shipment.usps.connect.url"); + conUrl = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectUrl", resource, "shipment.usps.connect.url"); } if (UtilValidate.isEmpty(conUrl)) { throw new UspsRequestException(UtilProperties.getMessage(RES_ERROR, @@ -1707,8 +1707,8 @@ public class UspsServices { Debug.logInfo("USPS XML request string: " + xmlString, MODULE); - String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", - RESOURCE, "shipment.usps.connect.timeout", "60"); + String timeOutStr = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "connectTimeout", + resource, "shipment.usps.connect.timeout", "60"); int timeout = 60; try { timeout = Integer.parseInt(timeOutStr); @@ -1764,9 +1764,9 @@ public class UspsServices { poundsOunces[1] = Integer.valueOf(decimalPounds.remainder(BigDecimal.ONE).multiply(new BigDecimal("16")).setScale(0, RoundingMode.CEILING).toPlainString()); return poundsOunces; } - - private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName) { + + private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, + String resource, String parameterName) { String returnValue = ""; if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { @@ -1781,17 +1781,17 @@ public class UspsServices { Debug.logError(e, MODULE); } } else { - String value = EntityUtilProperties.getPropertyValue(RESOURCE, parameterName, delegator); + String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator); if (value != null) { returnValue = value.trim(); } } return returnValue; } - + private static String getShipmentGatewayConfigValue(Delegator delegator, String shipmentGatewayConfigId, String shipmentGatewayConfigParameterName, - String RESOURCE, String parameterName, String defaultValue) { - String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, RESOURCE, parameterName); + String resource, String parameterName, String defaultValue) { + String returnValue = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, shipmentGatewayConfigParameterName, resource, parameterName); if (UtilValidate.isEmpty(returnValue)) { returnValue = defaultValue; } diff --git a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java index fe7ef89..2109eb0 100644 --- a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java +++ b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java @@ -149,7 +149,6 @@ public class LoginEvents { } catch (GenericEntityException gee) { Debug.logWarning(gee, "", MODULE); } - if (supposedUserLogin != null) { passwordHint = supposedUserLogin.getString("passwordHint"); } diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java index 0f23a9c..51f85aa 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java @@ -507,7 +507,7 @@ public class WorkEffortSearch { workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "WorkEffortAssocTypeId", "workEffortAssocTypeId", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("workEffortId","workEffortIdFrom")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("workEffortId", "workEffortIdFrom")); List<EntityExpr> assocConditionFromTo = new LinkedList<>(); assocConditionFromTo.add(EntityCondition.makeCondition(prefix + "WorkEffortIdTo", EntityOperator.IN, workEffortIdSet)); @@ -528,7 +528,7 @@ public class WorkEffortSearch { workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "WorkEffortAssocTypeId", "workEffortAssocTypeId", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "FromDate", "fromDate", null, null, null, null); workEffortSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); - workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("workEffortId","workEffortIdTo")); + workEffortSearchContext.dynamicViewEntity.addViewLink("WEFF", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("workEffortId", "workEffortIdTo")); List<EntityExpr> assocConditionToFrom = new LinkedList<>(); assocConditionToFrom.add(EntityCondition.makeCondition(prefix + "WorkEffortIdFrom", EntityOperator.IN, workEffortIdSet)); @@ -1087,7 +1087,7 @@ public class WorkEffortSearch { workEffortSearchContext.entityConditionList.add(conditions); // add in workEffortSearchConstraint, don't worry about the workEffortSearchResultId or constraintSeqId, those will be fill in later - workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString","fromDate : " + fromDate + " thruDate : " + thruDate))); + workEffortSearchContext.workEffortSearchConstraintList.add(workEffortSearchContext.getDelegator().makeValue("WorkEffortSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", "fromDate : " + fromDate + " thruDate : " + thruDate))); } /** pretty print for log messages and even UI stuff */ |
Free forum by Nabble | Edit this page |