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 5e7193f Improved: Changed resources with proper naming convention in all application components. (OFBIZ-11739) Also, made MODULE as private data member of class instead of public. This will reduce checkstlye issues. Thanks Jacques for review. 5e7193f is described below commit 5e7193f5a87ff39ade3e1aa90f5a571556f8d4ab Author: Suraj Khurana <[hidden email]> AuthorDate: Fri May 29 13:19:05 2020 +0530 Improved: Changed resources with proper naming convention in all application components. (OFBIZ-11739) Also, made MODULE as private data member of class instead of public. This will reduce checkstlye issues. Thanks Jacques for review. --- .../java/org/apache/ofbiz/accounting/GlEvents.java | 2 +- .../accounting/agreement/AgreementServices.java | 3 +- .../finaccount/FinAccountPaymentServices.java | 56 +-- .../finaccount/FinAccountProductServices.java | 10 +- .../accounting/finaccount/FinAccountServices.java | 18 +- .../ofbiz/accounting/invoice/InvoiceServices.java | 264 ++++++------ .../ofbiz/accounting/invoice/InvoiceWorker.java | 2 +- .../accounting/ledger/GeneralLedgerServices.java | 2 +- .../accounting/payment/BillingAccountWorker.java | 8 +- .../payment/GiftCertificateServices.java | 114 ++--- .../accounting/payment/PaymentGatewayServices.java | 194 ++++----- .../accounting/payment/PaymentMethodServices.java | 84 ++-- .../ofbiz/accounting/payment/PaymentWorker.java | 2 +- .../ofbiz/accounting/period/PeriodServices.java | 6 +- .../ofbiz/accounting/tax/TaxAuthorityServices.java | 16 +- .../authorizedotnet/AIMPaymentServices.java | 34 +- .../clearcommerce/CCPaymentServices.java | 14 +- .../thirdparty/clearcommerce/CCServicesTest.java | 2 +- .../thirdparty/cybersource/IcsPaymentServices.java | 48 +-- .../accounting/thirdparty/eway/EwayServices.java | 16 +- .../thirdparty/gosoftware/PcChargeApi.java | 2 +- .../thirdparty/gosoftware/PcChargeServices.java | 20 +- .../accounting/thirdparty/gosoftware/RitaApi.java | 2 +- .../thirdparty/gosoftware/RitaServices.java | 28 +- .../thirdparty/orbital/OrbitalPaymentServices.java | 14 +- .../accounting/thirdparty/paypal/PayPalEvents.java | 38 +- .../thirdparty/paypal/PayPalServices.java | 28 +- .../thirdparty/sagepay/SagePayPaymentServices.java | 22 +- .../thirdparty/sagepay/SagePayServices.java | 70 +-- .../accounting/thirdparty/sagepay/SagePayUtil.java | 2 +- .../securepay/SecurePayPaymentServices.java | 38 +- .../thirdparty/securepay/SecurePayServiceTest.java | 2 +- .../thirdparty/valuelink/ValueLinkApi.java | 2 +- .../thirdparty/valuelink/ValueLinkServices.java | 102 ++--- .../accounting/thirdparty/verisign/PayflowPro.java | 68 +-- .../thirdparty/worldpay/WorldPayEvents.java | 38 +- .../ofbiz/accounting/util/UtilAccounting.java | 2 +- .../ofbiz/content/ContentManagementEvents.java | 2 +- .../ofbiz/content/ContentManagementServices.java | 30 +- .../ofbiz/content/ContentManagementWorker.java | 2 +- .../java/org/apache/ofbiz/content/ConvertTree.java | 2 +- .../apache/ofbiz/content/blog/BlogRssServices.java | 6 +- .../org/apache/ofbiz/content/cms/CmsEvents.java | 2 +- .../ofbiz/content/compdoc/CompDocEvents.java | 2 +- .../ofbiz/content/compdoc/CompDocServices.java | 22 +- .../ofbiz/content/content/ContentEvents.java | 12 +- .../ofbiz/content/content/ContentKeywordIndex.java | 2 +- .../ofbiz/content/content/ContentMapFacade.java | 6 +- .../content/content/ContentPermissionServices.java | 8 +- .../ofbiz/content/content/ContentSearch.java | 28 +- .../ofbiz/content/content/ContentSearchEvents.java | 2 +- .../content/content/ContentSearchSession.java | 2 +- .../ofbiz/content/content/ContentServices.java | 18 +- .../content/content/ContentServicesComplex.java | 2 +- .../ofbiz/content/content/ContentWorker.java | 6 +- .../ofbiz/content/content/PermissionRecorder.java | 2 +- .../content/content/UploadContentAndImage.java | 2 +- .../org/apache/ofbiz/content/data/DataEvents.java | 12 +- .../ofbiz/content/data/DataResourceWorker.java | 20 +- .../apache/ofbiz/content/data/DataServices.java | 38 +- .../org/apache/ofbiz/content/ftp/FtpServices.java | 6 +- .../apache/ofbiz/content/ftp/SecureFtpClient.java | 2 +- .../apache/ofbiz/content/ftp/SimpleFtpClient.java | 2 +- .../org/apache/ofbiz/content/ftp/SshFtpClient.java | 2 +- .../apache/ofbiz/content/layout/LayoutEvents.java | 2 +- .../apache/ofbiz/content/layout/LayoutWorker.java | 2 +- .../ofbiz/content/output/OutputServices.java | 12 +- .../ofbiz/content/survey/PdfSurveyServices.java | 10 +- .../apache/ofbiz/content/survey/SurveyEvents.java | 2 +- .../apache/ofbiz/content/survey/SurveyWrapper.java | 2 +- .../content/view/SimpleContentViewHandler.java | 4 +- .../webapp/ftl/CheckPermissionTransform.java | 2 +- .../ftl/EditRenderSubContentCacheTransform.java | 2 +- .../webapp/ftl/EditRenderSubContentTransform.java | 2 +- .../webapp/ftl/InjectNodeTrailCsvTransform.java | 2 +- .../ftl/LimitedSubContentCacheTransform.java | 2 +- .../webapp/ftl/LoopSubContentTransform.java | 2 +- .../webapp/ftl/RenderContentAndSubContent.java | 2 +- .../content/webapp/ftl/RenderContentAsText.java | 2 +- .../content/webapp/ftl/RenderContentTransform.java | 2 +- .../content/webapp/ftl/RenderSubContentAsText.java | 2 +- .../webapp/ftl/RenderSubContentCacheTransform.java | 2 +- .../webapp/ftl/RenderSubContentTransform.java | 2 +- .../ftl/TraverseSubContentCacheTransform.java | 2 +- .../webapp/ftl/TraverseSubContentTransform.java | 2 +- .../webapp/ftl/WrapSubContentCacheTransform.java | 2 +- .../org/apache/ofbiz/humanres/HumanResEvents.java | 4 +- .../apache/ofbiz/manufacturing/bom/BOMHelper.java | 2 +- .../apache/ofbiz/manufacturing/bom/BOMNode.java | 2 +- .../ofbiz/manufacturing/bom/BOMServices.java | 52 +-- .../manufacturing/jobshopmgt/ProductionRun.java | 4 +- .../jobshopmgt/ProductionRunEvents.java | 2 +- .../jobshopmgt/ProductionRunHelper.java | 2 +- .../jobshopmgt/ProductionRunServices.java | 340 +++++++-------- .../mrp/InventoryEventPlannedServices.java | 6 +- .../ofbiz/manufacturing/mrp/MrpServices.java | 78 ++-- .../ofbiz/manufacturing/mrp/ProposedOrder.java | 4 +- .../manufacturing/routing/RoutingServices.java | 6 +- .../manufacturing/techdata/TechDataServices.java | 8 +- .../marketing/marketing/MarketingServices.java | 6 +- .../ofbiz/marketing/report/ReportHelper.java | 2 +- .../marketing/tracking/TrackingCodeEvents.java | 2 +- .../java/org/apache/ofbiz/sfa/vcard/VCard.java | 16 +- .../org/apache/ofbiz/order/OrderManagerEvents.java | 24 +- .../ofbiz/order/finaccount/FinAccountHelper.java | 2 +- .../ofbiz/order/order/OrderChangeHelper.java | 2 +- .../ofbiz/order/order/OrderContentWrapper.java | 2 +- .../org/apache/ofbiz/order/order/OrderEvents.java | 2 +- .../apache/ofbiz/order/order/OrderListState.java | 2 +- .../ofbiz/order/order/OrderLookupServices.java | 2 +- .../apache/ofbiz/order/order/OrderReadHelper.java | 4 +- .../ofbiz/order/order/OrderReturnServices.java | 168 ++++---- .../apache/ofbiz/order/order/OrderServices.java | 336 +++++++-------- .../apache/ofbiz/order/quote/QuoteServices.java | 22 +- .../order/requirement/RequirementServices.java | 8 +- .../order/shoppingcart/CartEventListener.java | 2 +- .../ofbiz/order/shoppingcart/CheckOutEvents.java | 18 +- .../ofbiz/order/shoppingcart/CheckOutHelper.java | 92 ++-- .../ofbiz/order/shoppingcart/ShoppingCart.java | 18 +- .../order/shoppingcart/ShoppingCartEvents.java | 70 +-- .../order/shoppingcart/ShoppingCartHelper.java | 66 +-- .../ofbiz/order/shoppingcart/ShoppingCartItem.java | 58 +-- .../order/shoppingcart/ShoppingCartServices.java | 8 +- .../shoppingcart/product/ProductDisplayWorker.java | 2 +- .../shoppingcart/product/ProductPromoWorker.java | 42 +- .../product/ProductStoreCartAwareEvents.java | 2 +- .../shipping/ShippingEstimateWrapper.java | 2 +- .../shoppingcart/shipping/ShippingEvents.java | 2 +- .../order/shoppinglist/ShoppingListEvents.java | 34 +- .../order/shoppinglist/ShoppingListServices.java | 26 +- .../org/apache/ofbiz/order/task/TaskEvents.java | 12 +- .../org/apache/ofbiz/order/task/TaskWorker.java | 2 +- .../apache/ofbiz/order/test/FinAccountTest.java | 2 +- .../org/apache/ofbiz/order/test/OrderTest.java | 2 +- .../apache/ofbiz/order/test/OrderTestServices.java | 2 +- .../apache/ofbiz/order/test/PurchaseOrderTest.java | 2 +- .../apache/ofbiz/order/test/SalesOrderTest.java | 2 +- .../thirdparty/paypal/ExpressCheckoutEvents.java | 8 +- .../order/thirdparty/taxware/TaxwareServices.java | 2 +- .../ofbiz/order/thirdparty/taxware/TaxwareUTL.java | 2 +- .../thirdparty/zipsales/ZipSalesServices.java | 22 +- .../communication/CommunicationEventServices.java | 36 +- .../apache/ofbiz/party/contact/ContactHelper.java | 2 +- .../ofbiz/party/contact/ContactMechServices.java | 80 ++-- .../ofbiz/party/contact/ContactMechWorker.java | 2 +- .../ofbiz/party/content/PartyContentWrapper.java | 2 +- .../org/apache/ofbiz/party/party/PartyHelper.java | 2 +- .../ofbiz/party/party/PartyRelationshipHelper.java | 2 +- .../party/party/PartyRelationshipServices.java | 16 +- .../apache/ofbiz/party/party/PartyServices.java | 132 +++--- .../apache/ofbiz/party/party/PartyTypeHelper.java | 2 +- .../org/apache/ofbiz/party/party/PartyWorker.java | 2 +- .../apache/ofbiz/party/party/UpgradeServices.java | 2 +- .../ofbiz/product/catalog/CatalogWorker.java | 2 +- .../ofbiz/product/category/CatalogUrlServlet.java | 2 +- .../product/category/CategoryContentWrapper.java | 2 +- .../ofbiz/product/category/CategoryServices.java | 12 +- .../ofbiz/product/category/CategoryWorker.java | 2 +- .../ofbiz/product/category/ControlServlet.java | 2 +- .../product/category/SeoCatalogUrlServlet.java | 2 +- .../ofbiz/product/category/SeoControlServlet.java | 2 +- .../category/ftl/CatalogAltUrlSeoTransform.java | 2 +- .../category/ftl/CatalogUrlSeoTransform.java | 2 +- .../config/ProductConfigItemContentWrapper.java | 2 +- .../ofbiz/product/config/ProductConfigWorker.java | 2 +- .../ofbiz/product/config/ProductConfigWrapper.java | 2 +- .../ofbiz/product/feature/ParametricSearch.java | 2 +- .../product/feature/ProductFeatureServices.java | 8 +- .../org/apache/ofbiz/product/image/ScaleImage.java | 32 +- .../ofbiz/product/imagemanagement/CropImage.java | 10 +- .../ofbiz/product/imagemanagement/FrameImage.java | 14 +- .../imagemanagement/ImageManagementServices.java | 42 +- .../product/imagemanagement/ImageUrlServlet.java | 2 +- .../product/imagemanagement/ReplaceImage.java | 16 +- .../ofbiz/product/imagemanagement/RotateImage.java | 10 +- .../ofbiz/product/inventory/InventoryServices.java | 66 +-- .../ofbiz/product/migrate/MigrationServices.java | 2 +- .../apache/ofbiz/product/price/PriceServices.java | 28 +- .../apache/ofbiz/product/product/KeywordIndex.java | 2 +- .../product/product/ProductContentWrapper.java | 2 +- .../ofbiz/product/product/ProductEvents.java | 50 +-- .../product/ProductPromoContentWrapper.java | 2 +- .../ofbiz/product/product/ProductSearch.java | 74 ++-- .../ofbiz/product/product/ProductSearchEvents.java | 56 +-- .../product/product/ProductSearchSession.java | 2 +- .../ofbiz/product/product/ProductServices.java | 62 +-- .../ofbiz/product/product/ProductUtilServices.java | 32 +- .../ofbiz/product/product/ProductWorker.java | 2 +- .../ofbiz/product/product/VariantEvents.java | 20 +- .../apache/ofbiz/product/promo/PromoServices.java | 20 +- .../spreadsheetimport/ImportProductHelper.java | 2 +- .../spreadsheetimport/ImportProductServices.java | 16 +- .../ofbiz/product/store/ProductStoreEvents.java | 2 +- .../product/store/ProductStoreSurveyWrapper.java | 2 +- .../ofbiz/product/store/ProductStoreWorker.java | 2 +- .../product/subscription/SubscriptionServices.java | 28 +- .../product/supplier/SupplierProductServices.java | 4 +- .../ofbiz/shipment/packing/PackingServices.java | 14 +- .../ofbiz/shipment/packing/PackingSession.java | 2 +- .../ofbiz/shipment/picklist/PickListServices.java | 2 +- .../ofbiz/shipment/shipment/ShipmentEvents.java | 2 +- .../ofbiz/shipment/shipment/ShipmentServices.java | 54 +-- .../ofbiz/shipment/shipment/ShipmentWorker.java | 2 +- .../ofbiz/shipment/thirdparty/dhl/DhlServices.java | 158 +++---- .../shipment/thirdparty/fedex/FedexServices.java | 176 ++++---- .../ofbiz/shipment/thirdparty/ups/UpsServices.java | 470 ++++++++++----------- .../thirdparty/usps/UspsMockApiServlet.java | 2 +- .../shipment/thirdparty/usps/UspsServices.java | 260 ++++++------ .../thirdparty/usps/UspsServicesTests.java | 2 +- .../ofbiz/shipment/verify/VerifyPickSession.java | 2 +- .../weightPackage/WeightPackageSession.java | 2 +- .../securityext/cert/CertificateServices.java | 2 +- .../ofbiz/securityext/login/LoginEvents.java | 26 +- .../content/WorkEffortContentWrapper.java | 2 +- .../workeffort/workeffort/ICalHandlerFactory.java | 2 +- .../ofbiz/workeffort/workeffort/ICalWorker.java | 2 +- .../workeffort/WorkEffortKeywordIndex.java | 2 +- .../WorkEffortPartyAssignmentServices.java | 2 +- .../workeffort/workeffort/WorkEffortSearch.java | 32 +- .../workeffort/WorkEffortSearchEvents.java | 2 +- .../workeffort/WorkEffortSearchSession.java | 2 +- .../workeffort/workeffort/WorkEffortServices.java | 22 +- .../workeffort/workeffort/WorkEffortWorker.java | 2 +- 223 files changed, 2730 insertions(+), 2731 deletions(-) diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java index c3ba688..78360fd 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java @@ -38,7 +38,7 @@ import org.apache.ofbiz.service.ServiceUtil; public class GlEvents { -public static final String MODULE = GlEvents.class.getName(); +private static final String MODULE = GlEvents.class.getName(); public static String createReconcileAccount(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); final Delegator delegator = (Delegator)request.getAttribute("delegator"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java index 7fe5ed6..4375f30 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java @@ -44,12 +44,11 @@ import org.apache.ofbiz.service.ServiceUtil; public class AgreementServices { - public static final String MODULE = AgreementServices.class.getName(); + private static final String MODULE = AgreementServices.class.getName(); // set some BigDecimal properties public static final int decimals = UtilNumber.getBigDecimalScale("finaccount.decimals"); public static final RoundingMode rounding = UtilNumber.getRoundingMode("finaccount.rounding"); public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); - public static final String resource = "AccountingUiLabels"; /** * Determines commission receiving parties and amounts for the provided product, price, and quantity diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java index 3ecc32b..3557bf2 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java @@ -52,8 +52,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class FinAccountPaymentServices { - public static final String MODULE = FinAccountPaymentServices.class.getName(); - public static final String resourceError = "AccountingErrorUiLabels"; + private static final String MODULE = FinAccountPaymentServices.class.getName(); + private static final String RES_ERROR = "AccountingErrorUiLabels"; // base payment integration services public static Map<String, Object> finAccountPreAuth(DispatchContext dctx, Map<String, Object> context) { @@ -119,16 +119,16 @@ public class FinAccountPaymentServices { finAccount = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotLocateItFromAccountCode", locale)); } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountIdAndFinAccountCodeAreNull", locale)); } } if (finAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountIdInvalid", locale)); } @@ -166,7 +166,7 @@ public class FinAccountPaymentServices { if ("Y".equals(finAccountSettings.getString("requirePinCode"))) { if (!FinAccountHelper.validatePin(delegator, finAccountCode, finAccountPin)) { Map<String, Object> result = ServiceUtil.returnSuccess(); - result.put("authMessage", UtilProperties.getMessage(resourceError, + result.put("authMessage", UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountPinCodeCombinatorNotFound", locale)); result.put("authResult", Boolean.FALSE); result.put("processAmount", amount); @@ -183,7 +183,7 @@ public class FinAccountPaymentServices { if ((finAccount.getTimestamp("thruDate") != null) && (finAccount.getTimestamp("thruDate").before( UtilDateTime.nowTimestamp()))) { Map<String, Object> result = ServiceUtil.returnSuccess(); - result.put("authMessage", UtilProperties.getMessage(resourceError, + result.put("authMessage", UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountExpired", UtilMisc.toMap("thruDate", finAccount.getTimestamp("thruDate")), locale)); result.put("authResult", Boolean.FALSE); @@ -206,13 +206,13 @@ public class FinAccountPaymentServices { .equals(statusId)) { Map<String, Object> result = ServiceUtil.returnSuccess(); if ("FNACT_NEGPENDREPL".equals(statusId)) { - result.put("authMessage", UtilProperties.getMessage(resourceError, + result.put("authMessage", UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNegative", locale)); } else if ("FNACT_MANFROZEN".equals(statusId)) { - result.put("authMessage", UtilProperties.getMessage(resourceError, + result.put("authMessage", UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountFrozen", locale)); } else if ("FNACT_CANCELLED".equals(statusId)) { - result.put("authMessage", UtilProperties.getMessage(resourceError, + result.put("authMessage", UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCancelled", locale)); } result.put("authResult", Boolean.FALSE); @@ -292,7 +292,7 @@ public class FinAccountPaymentServices { return result; } catch (GenericEntityException | GenericServiceException ex) { Debug.logError(ex, "Cannot authorize financial account", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotBeAuthorized", UtilMisc.toMap("errorString", ex.getMessage()), locale)); } @@ -304,13 +304,13 @@ public class FinAccountPaymentServices { GenericValue paymentPref = (GenericValue) context.get("orderPaymentPreference"); Locale locale = (Locale) context.get("locale"); - String err = UtilProperties.getMessage(resourceError, "AccountingFinAccountCannotBeExpired", locale); + String err = UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotBeExpired", locale); try { // expire the related financial authorization transaction GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(paymentPref); if (authTransaction == null) { - return ServiceUtil.returnError(err + UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(err + UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotFindAuthorization", locale)); } @@ -349,7 +349,7 @@ public class FinAccountPaymentServices { authTrans = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); } if (authTrans == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotCapture", locale)); } @@ -378,7 +378,7 @@ public class FinAccountPaymentServices { // make sure authorization has not expired Timestamp authExpiration = finAccountAuth.getTimestamp("thruDate"); if ((authExpiration != null) && (authExpiration.before(UtilDateTime.nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountAuthorizationExpired", UtilMisc.toMap("paymentGatewayResponseId", authTrans.getString("paymentGatewayResponseId"), "authExpiration", authExpiration), locale)); @@ -387,7 +387,7 @@ public class FinAccountPaymentServices { // make sure the fin account itself has not expired if ((finAccount.getTimestamp("thruDate") != null) && (finAccount.getTimestamp("thruDate").before(UtilDateTime .nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountExpired", UtilMisc.toMap("thruDate", finAccount.getTimestamp("thruDate")), locale)); } @@ -492,7 +492,7 @@ public class FinAccountPaymentServices { } if (finAccountId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale)); } @@ -564,7 +564,7 @@ public class FinAccountPaymentServices { // validate the amount if (amount.compareTo(BigDecimal.ZERO) < 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountMustBePositive", locale)); } @@ -578,14 +578,14 @@ public class FinAccountPaymentServices { // verify we have a financial account if (finAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale)); } // make sure the fin account itself has not expired if ((finAccount.getTimestamp("thruDate") != null) && (finAccount.getTimestamp("thruDate").before(UtilDateTime .nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountExpired", UtilMisc.toMap("thruDate", finAccount.getTimestamp("thruDate")), locale)); } @@ -664,20 +664,20 @@ public class FinAccountPaymentServices { finAccount = EntityQuery.use(delegator).from("FinAccount").where("finAccountId", finAccountId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", finAccountId), locale)); } // verify we have a financial account if (finAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale)); } // make sure the fin account itself has not expired if ((finAccount.getTimestamp("thruDate") != null) && (finAccount.getTimestamp("thruDate").before(UtilDateTime .nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountExpired", UtilMisc.toMap("thruDate", finAccount.getTimestamp("thruDate")), locale)); } @@ -748,7 +748,7 @@ public class FinAccountPaymentServices { return ServiceUtil.returnError(e.getMessage()); } if (finAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", finAccountId), locale)); } String currency = finAccount.getString("currencyUomId"); @@ -772,7 +772,7 @@ public class FinAccountPaymentServices { if (productStoreId == null) { productStoreId = getLastProductStoreId(delegator, finAccountId); if (productStoreId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotBeReplenish", locale)); } } @@ -844,7 +844,7 @@ public class FinAccountPaymentServices { // the deposit is replenish-level itself depositAmount = replenishLevel; } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountUnknownReplenishMethod", locale)); } @@ -863,7 +863,7 @@ public class FinAccountPaymentServices { Debug.logWarning( "finAccountReplenish Warning: No payment method (replenishPaymentId) attached to financial account [" + finAccountId + "] cannot auto-replenish", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNoPaymentMethodAssociatedWithReplenishAccount", locale)); } @@ -879,7 +879,7 @@ public class FinAccountPaymentServices { // no payment methods on file; cannot replenish Debug.logWarning("finAccountReplenish Warning: No payment method found for ID [" + paymentMethodId + "] for party [" + ownerPartyId + "] cannot auto-replenish", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNoPaymentMethodAssociatedWithReplenishAccount", locale)); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java index 0ca4df2..63ec943 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java @@ -50,9 +50,9 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class FinAccountProductServices { - public static final String MODULE = FinAccountProductServices.class.getName(); - public static final String resourceOrderError = "OrderErrorUiLabels"; - public static final String resourceError = "AccountingErrorUiLabels"; + private static final String MODULE = FinAccountProductServices.class.getName(); + private static final String RES_ORDERError = "OrderErrorUiLabels"; + private static final String RES_ERROR = "AccountingErrorUiLabels"; public static Map<String, Object> createPartyFinAccountFromPurchase(DispatchContext dctx, Map<String, Object> context) { // this service should always be called via FULFILLMENT_EXTASYNC @@ -72,7 +72,7 @@ public class FinAccountProductServices { orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderCannotGetOrderHeader", UtilMisc.toMap("orderId", orderId), locale)); } @@ -129,7 +129,7 @@ public class FinAccountProductServices { } if (productStoreId == null) { Debug.logFatal("Unable to create financial accout; no productStoreId on OrderHeader : " + orderId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotCreate", UtilMisc.toMap("orderId", orderId), locale)); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java index 64b9fa1..80b37e6 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java @@ -50,8 +50,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class FinAccountServices { - public static final String MODULE = FinAccountServices.class.getName(); - public static final String resourceError = "AccountingErrorUiLabels"; + private static final String MODULE = FinAccountServices.class.getName(); + private static final String RES_ERROR = "AccountingErrorUiLabels"; public static Map<String, Object> createAccountAndCredit(DispatchContext dctx, Map<String, Object> context) { Delegator delegator = dctx.getDelegator(); @@ -151,7 +151,7 @@ public class FinAccountServices { } } if (creditAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotCreditAccount", locale)); } } @@ -193,7 +193,7 @@ public class FinAccountServices { GenericValue productStoreFinAccountSetting = EntityQuery.use(delegator).from("ProductStoreFinActSetting") .where("productStoreId", productStoreId, "finAccountTypeId", finAccountTypeId).cache().queryOne(); if (productStoreFinAccountSetting == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", finAccountTypeId), locale)); @@ -271,7 +271,7 @@ public class FinAccountServices { } } if (finAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", finAccountId), locale)); } @@ -302,7 +302,7 @@ public class FinAccountServices { Locale locale = (Locale) context.get("locale"); if (finAccountId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale)); } @@ -363,7 +363,7 @@ public class FinAccountServices { if (finAccount != null) { // check to make sure the account is refundable if (!"Y".equals(finAccount.getString("isRefundable"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountIsNotRefundable", locale)); } @@ -374,7 +374,7 @@ public class FinAccountServices { // if they do not match, then there are outstanding authorizations which need to // be settled first if (actualBalance.compareTo(availableBalance) != 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotBeRefunded", locale)); } @@ -498,7 +498,7 @@ public class FinAccountServices { // check to make sure we balanced out if (remainingBalance.compareTo(FinAccountHelper.ZERO) == 1) { - result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resourceError, + result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountPartiallyRefunded", locale)); } } 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 5594a07..dbeb4ea 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 @@ -105,7 +105,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class InvoiceServices { - public static final String MODULE = InvoiceServices.class.getName(); + private static final String MODULE = InvoiceServices.class.getName(); // set some BigDecimal properties private static final int DECIMALS = UtilNumber.getBigDecimalScale("invoice.decimals"); @@ -114,7 +114,7 @@ public class InvoiceServices { private static final RoundingMode TAX_ROUNDING = UtilNumber.getRoundingMode("salestax.rounding"); private static final int INVOICE_ITEM_SEQUENCE_ID_DIGITS = 5; // this is the number of digits used for invoiceItemSeqId: 00001, 00002... - public static final String resource = "AccountingUiLabels"; + private static final String RESOURCE = "AccountingUiLabels"; // service to create an invoice for a complete order by the system userid public static Map<String, Object> createInvoiceForOrderAllItems(DispatchContext dctx, Map<String, Object> context) { @@ -142,7 +142,7 @@ public class InvoiceServices { } catch (GenericServiceException | GenericEntityException e) { Debug.logError (e, "Entity/data problem creating invoice from order items: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingEntityDataProblemCreatingInvoiceFromOrderItems", UtilMisc.toMap("reason", e.toString()), locale)); } @@ -156,7 +156,7 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); if (DECIMALS == -1 || ROUNDING == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingAritmeticPropertiesNotConfigured", locale)); } @@ -166,14 +166,14 @@ public class InvoiceServices { if (UtilValidate.isEmpty(billItems)) { if (Debug.verboseOn()) Debug.logVerbose("No order items to invoice; not creating invoice; returning success", MODULE); - return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + return ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingNoOrderItemsToInvoice", locale)); } try { GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingNoOrderHeader", locale)); } @@ -253,7 +253,7 @@ public class InvoiceServices { // store the invoice first Map<String, Object> createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceContext); if (ServiceUtil.isError(createInvoiceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createInvoiceResult); } @@ -271,7 +271,7 @@ public class InvoiceServices { createInvoiceRoleContext.put("roleTypeId", orderRole.getString("roleTypeId")); Map<String, Object> createInvoiceRoleResult = dispatcher.runSync("createInvoiceRole", createInvoiceRoleContext); if (ServiceUtil.isError(createInvoiceRoleResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createInvoiceRoleResult); } } @@ -302,7 +302,7 @@ public class InvoiceServices { "roleTypeId", "BILL_TO_CUSTOMER", "userLogin", userLogin); Map<String, Object> createInvoiceRoleResult = dispatcher.runSync("createInvoiceRole", createInvoiceRoleContext); if (ServiceUtil.isError(createInvoiceRoleResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceRoleFromOrder", locale), null, null, createInvoiceRoleResult); } } @@ -314,7 +314,7 @@ public class InvoiceServices { "contactMechPurposeTypeId", "BILLING_LOCATION", "userLogin", userLogin); Map<String, Object> createBillToContactMechResult = dispatcher.runSync("createInvoiceContactMech", createBillToContactMechContext); if (ServiceUtil.isError(createBillToContactMechResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createBillToContactMechResult); } } @@ -326,7 +326,7 @@ public class InvoiceServices { "contactMechPurposeTypeId", "BILLING_LOCATION", "userLogin", userLogin); Map<String, Object> createBillToContactMechResult = dispatcher.runSync("createInvoiceContactMech", createBillToContactMechContext); if (ServiceUtil.isError(createBillToContactMechResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createBillToContactMechResult); } } @@ -358,7 +358,7 @@ public class InvoiceServices { "contactMechPurposeTypeId", "PAYMENT_LOCATION", "userLogin", userLogin); Map<String, Object> createPayToContactMechResult = dispatcher.runSync("createInvoiceContactMech", createPayToContactMechContext); if (ServiceUtil.isError(createPayToContactMechResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createPayToContactMechResult); } } @@ -390,7 +390,7 @@ public class InvoiceServices { if (orderItem == null) { Debug.logError("Cannot create invoice when orderItem, itemIssuance, and shipmentReceipt are all null", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingIllegalValuesPassedToCreateInvoiceService", locale)); } @@ -465,7 +465,7 @@ public class InvoiceServices { Map<String, Object> createInvoiceItemResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemContext); if (ServiceUtil.isError(createInvoiceItemResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemResult); } @@ -500,7 +500,7 @@ public class InvoiceServices { Map<String, Object> createOrderItemBillingResult = dispatcher.runSync("createOrderItemBilling", createOrderItemBillingContext); if (ServiceUtil.isError(createOrderItemBillingResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingOrderItemBillingFromOrder", locale), null, null, createOrderItemBillingResult); } @@ -546,13 +546,13 @@ public class InvoiceServices { Map<String, Object> checkResult = dispatcher.runSync("calculateInvoicedAdjustmentTotal", UtilMisc.toMap("orderAdjustment", adj)); if (ServiceUtil.isError(checkResult)) { Debug.logError("Accounting trouble calling calculateInvoicedAdjustmentTotal service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale)); } adjAlreadyInvoicedAmount = (BigDecimal) checkResult.get("invoicedTotal"); } catch (GenericServiceException e) { Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale)); } @@ -677,7 +677,7 @@ public class InvoiceServices { Map<String, Object> createInvoiceItemAdjResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemAdjContext); if (ServiceUtil.isError(createInvoiceItemAdjResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemAdjResult); } @@ -691,7 +691,7 @@ public class InvoiceServices { Map<String, Object> createOrderAdjustmentBillingResult = dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext); if (ServiceUtil.isError(createOrderAdjustmentBillingResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingOrderAdjustmentBillingFromOrder", locale), null, null, createOrderAdjustmentBillingContext); } @@ -729,13 +729,13 @@ public class InvoiceServices { try { Map<String, Object> checkResult = dispatcher.runSync("calculateInvoicedAdjustmentTotal", UtilMisc.toMap("orderAdjustment", adj)); if (ServiceUtil.isError(checkResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale)); } adjAlreadyInvoicedAmount = ((BigDecimal) checkResult.get("invoicedTotal")).setScale(invoiceTypeDecimals, ROUNDING); } catch (GenericServiceException e) { Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale)); } @@ -876,7 +876,7 @@ public class InvoiceServices { appl.put("userLogin", userLogin); Map<String, Object> createPayApplResult = dispatcher.runSync("createPaymentApplication", appl); if (ServiceUtil.isError(createPayApplResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createPayApplResult); } } @@ -888,7 +888,7 @@ public class InvoiceServices { String nextStatusId = "PURCHASE_INVOICE".equals(invoiceType) ? "INVOICE_IN_PROCESS" : "INVOICE_READY"; Map<String, Object> setInvoiceStatusResult = dispatcher.runSync("setInvoiceStatus", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "statusId", nextStatusId, "userLogin", userLogin)); if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, setInvoiceStatusResult); } } @@ -899,12 +899,12 @@ public class InvoiceServices { return resp; } catch (GenericEntityException e) { Debug.logError(e, "Entity/data problem creating invoice from order items: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingEntityDataProblemCreatingInvoiceFromOrderItems", UtilMisc.toMap("reason", e.toString()), locale)); } catch (GenericServiceException e) { Debug.logError(e, "Service/other problem creating invoice from order items: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingServiceOtherProblemCreatingInvoiceFromOrderItems", UtilMisc.toMap("reason", e.toString()), locale)); } @@ -924,7 +924,7 @@ public class InvoiceServices { BigDecimal amountTotal = InvoiceWorker.getInvoiceTotal(delegator, salesInvoiceId); if (amountTotal.signum() == 0) { Debug.logWarning("Invoice [" + salesInvoiceId + "] has an amount total of [" + amountTotal + "], so no commission invoice will be created", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionZeroInvoiceAmount", locale)); } BigDecimal appliedFraction = amountTotal.divide(amountTotal, 12, ROUNDING); @@ -946,7 +946,7 @@ public class InvoiceServices { if (UtilValidate.isEmpty(salesRepPartyIds)) { salesRepPartyIds = EntityUtil.getFieldListFromEntityList(roleQuery.where(invoiceRoleConds).queryList(), "partyId", true); if (UtilValidate.isEmpty(salesRepPartyIds)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "No party found with role sales representative for sales invoice "+ salesInvoiceId, locale)); } } else { @@ -961,7 +961,7 @@ public class InvoiceServices { isReturn = true; } else if (!"SALES_INVOICE".equals(invoiceTypeId)) { Debug.logWarning("This type of invoice has no commission; returning success", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionInvalid", locale)); } invoiceItems = EntityQuery.use(delegator).from("InvoiceItem").where("invoiceId", salesInvoiceId).queryList(); @@ -1052,11 +1052,11 @@ public class InvoiceServices { try { createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceMap); if (ServiceUtil.isError(createInvoiceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionError", locale), null, null, null); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionError", locale), null, null, null); } String invoiceId = (String) createInvoiceResult.get("invoiceId"); @@ -1104,7 +1104,7 @@ public class InvoiceServices { "amount", elemAmount, "userLogin", userLogin)); if (ServiceUtil.isError(resMap)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionErrorItem", locale), null, null, resMap); } resMap = dispatcher.runSync("createInvoiceItemAssoc", UtilMisc.toMap("invoiceIdFrom", invoiceIdFrom, @@ -1129,14 +1129,14 @@ public class InvoiceServices { delegator.storeAll(toStore); } catch (GenericEntityException e) { Debug.logError(e, "Entity/data problem creating commission invoice: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionEntityDataProblem", UtilMisc.toMap("reason", e.toString()), locale)); } invoicesCreated.add(UtilMisc.<String, String>toMap("commissionInvoiceId",invoiceId, "salesRepresentative ",partyIdBillFrom)); } String invCreated = Integer.toString(invoicesCreated.size()); - Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingCommissionInvoicesCreated", UtilMisc.toMap("invoicesCreated", invCreated), locale)); Debug.logInfo("Created Commission invoices for each commission receiving parties " + @@ -1156,13 +1156,13 @@ public class InvoiceServices { for (String invoiceId : invoicesCreated) { Map<String, Object> setInvoiceStatusResult = dispatcher.runSync("setInvoiceStatus", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "statusId", nextStatusId, "userLogin", userLogin)); if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionError", locale), null, null, setInvoiceStatusResult); } } } catch (GenericServiceException e) { Debug.logError(e, "Entity/data problem creating commission invoice: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCommissionError", UtilMisc.toMap("reason", e.toString()), locale)); } @@ -1207,14 +1207,14 @@ public class InvoiceServices { try { Map<String, Object> result = dispatcher.runSync("createInvoicesFromShipments", serviceContext); if (ServiceUtil.isError(result)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoicesFromShipmentService", UtilMisc.toMap("shipmentId", shipmentId), locale)); } invoicesCreated = UtilGenerics.cast(result.get("invoicesCreated")); } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment [" + shipmentId + "]", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoicesFromShipmentService", UtilMisc.toMap("shipmentId", shipmentId), locale)); } @@ -1239,13 +1239,13 @@ public class InvoiceServices { shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting Shipment entity for shipment " + shipmentId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleGettingShipmentEntity", UtilMisc.toMap("shipmentId", shipmentId), locale)); } if (shipment == null) { - Debug.logError(UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale)); + Debug.logError(UtilProperties.getMessage(RESOURCE, "AccountingShipmentNotFound", locale), MODULE); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingShipmentNotFound", locale)); } List<GenericValue> itemIssuances; @@ -1254,7 +1254,7 @@ public class InvoiceServices { .from("ItemIssuance").where("shipmentId", shipmentId).orderBy("orderId").distinct().queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting issued items from shipments", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingItemsFromShipments", locale)); } if (itemIssuances.size() == 0) { @@ -1276,7 +1276,7 @@ public class InvoiceServices { orderItemBilling = EntityQuery.use(delegator).from("OrderItemBilling").where(billFields).queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, "Problem looking up OrderItemBilling records for " + billFields, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemLookingUpOrderItemBilling", UtilMisc.toMap("billFields", billFields), locale)); } @@ -1309,7 +1309,7 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, setInvoiceStatusResult); } } @@ -1327,13 +1327,13 @@ public class InvoiceServices { try { serviceResult = dispatcher.runSync("createInvoicesFromShipments", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoicesFromShipmentService", UtilMisc.toMap("shipmentId", shipmentId), locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment " + shipmentId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoicesFromShipmentService", UtilMisc.toMap("shipmentId", shipmentId), locale)); } @@ -1369,14 +1369,14 @@ public class InvoiceServices { salesShipmentFound = true; } if (purchaseShipmentFound && salesShipmentFound && dropShipmentFound) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingShipmentsOfDifferentTypes", UtilMisc.toMap("tmpShipmentId", tmpShipmentId, "shipmentTypeId", shipment.getString("shipmentTypeId")), locale)); } } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting Shipment entity for shipment " + tmpShipmentId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleGettingShipmentEntity", UtilMisc.toMap("tmpShipmentId", tmpShipmentId), locale)); } @@ -1429,7 +1429,7 @@ public class InvoiceServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problem getting issued items from shipments", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingItemsFromShipments", locale)); } if (items.size() == 0) { @@ -1469,7 +1469,7 @@ public class InvoiceServices { itemBillings = EntityQuery.use(delegator).from("OrderItemBillingAndInvoiceAndItem").where(billFields).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problem looking up OrderItemBilling records for " + billFields, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemLookingUpOrderItemBilling", UtilMisc.toMap("billFields", billFields), locale)); } @@ -1531,7 +1531,7 @@ public class InvoiceServices { billed = EntityQuery.use(delegator).from("OrderItemBillingAndInvoiceAndItem").where(lookup).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting OrderItem/OrderItemBilling records " + lookup, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderItemOrderItemBilling", UtilMisc.toMap("lookup", lookup), locale)); } @@ -1628,7 +1628,7 @@ public class InvoiceServices { } } catch (GenericEntityException e) { Debug.logError(e, "Trouble calling createInvoicesFromShipments service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoicesFromShipmentsService", locale)); } @@ -1659,7 +1659,7 @@ public class InvoiceServices { createOrderAdjustmentContext.put("orderAdjustmentTypeId", "SHIPPING_CHARGES"); String addtlChargeDescription = shipment.getString("addtlShippingChargeDesc"); if (UtilValidate.isEmpty(addtlChargeDescription)) { - addtlChargeDescription = UtilProperties.getMessage(resource, "AccountingAdditionalShippingChargeForShipment", UtilMisc.toMap("shipmentId", shipmentId), locale); + addtlChargeDescription = UtilProperties.getMessage(RESOURCE, "AccountingAdditionalShippingChargeForShipment", UtilMisc.toMap("shipmentId", shipmentId), locale); } createOrderAdjustmentContext.put("description", addtlChargeDescription); createOrderAdjustmentContext.put("sourceReferenceId", shipmentId); @@ -1674,7 +1674,7 @@ public class InvoiceServices { shippingOrderAdjustmentId = (String) createOrderAdjustmentResult.get("orderAdjustmentId"); } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling createOrderAdjustment service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateOrderAdjustmentService", locale)); } @@ -1686,7 +1686,7 @@ public class InvoiceServices { destinationContactMech = shipment.getRelatedOne("DestinationPostalAddress", false); } catch (GenericEntityException e) { Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment " + shipmentId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoicesFromShipmentService", locale)); } @@ -1709,12 +1709,12 @@ public class InvoiceServices { try { calcTaxResult = dispatcher.runSync("calcTax", calcTaxContext); if (ServiceUtil.isError(calcTaxResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalcTaxService", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling calcTaxService", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalcTaxService", locale)); } List<GenericValue> orderAdjustments = UtilGenerics.cast(calcTaxResult.get("orderAdjustments")); @@ -1733,7 +1733,7 @@ public class InvoiceServices { delegator.storeAll(orderAdjustments); } catch (GenericEntityException e) { Debug.logError(e, "Problem storing OrderAdjustments: " + orderAdjustments, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemStoringOrderAdjustments", UtilMisc.toMap("orderAdjustments", orderAdjustments), locale)); } @@ -1746,7 +1746,7 @@ public class InvoiceServices { .where("orderId", orderId, "paymentMethodTypeId", "CREDIT_CARD").queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting OrderPaymentPreference records", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale)); } @@ -1777,7 +1777,7 @@ public class InvoiceServices { prefReleaseResult = dispatcher.runSync("releaseOrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId"), "userLogin", context.get("userLogin"))); } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling releaseOrderPaymentPreference service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale)); } if (ServiceUtil.isError(prefReleaseResult) || ServiceUtil.isFailure(prefReleaseResult)) { @@ -1796,13 +1796,13 @@ public class InvoiceServices { try { Map<String, Object> result = dispatcher.runSync("createOrderPaymentPreference", serviceContext); if (ServiceUtil.isError(result)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale)); } orderPaymentPreferenceId = (String) result.get("orderPaymentPreferenceId"); } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling createOrderPaymentPreference service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale)); } @@ -1812,12 +1812,12 @@ public class InvoiceServices { // Use an overrideAmount because the maxAmount wasn't set on the OrderPaymentPreference authResult = dispatcher.runSync("authOrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId, "overrideAmount", totalNewAuthAmount, "userLogin", context.get("userLogin"))); if (ServiceUtil.isError(authResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling authOrderPaymentPreference service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale)); } @@ -1825,7 +1825,7 @@ public class InvoiceServices { boolean authFinished = (Boolean) authResult.get("finished"); boolean authErrors = (Boolean) authResult.get("errors"); if (authErrors || ! authFinished) { - String errMsg = UtilProperties.getMessage(resource, "AccountingUnableToAuthAdditionalShipCharges", UtilMisc.toMap("shipmentId", shipmentId, "paymentMethodId", paymentMethodId, "orderPaymentPreferenceId", orderPaymentPreferenceId), locale); + String errMsg = UtilProperties.getMessage(RESOURCE, "AccountingUnableToAuthAdditionalShipCharges", UtilMisc.toMap("shipmentId", shipmentId, "paymentMethodId", paymentMethodId, "orderPaymentPreferenceId", orderPaymentPreferenceId), locale); Debug.logError(errMsg, MODULE); } @@ -1833,7 +1833,7 @@ public class InvoiceServices { } } } else { - Debug.logInfo(UtilProperties.getMessage(resource, "AccountingIgnoringAdditionalShipCharges", UtilMisc.toMap("productStoreId", orh.getProductStoreId()), locale), MODULE); + Debug.logInfo(UtilProperties.getMessage(RESOURCE, "AccountingIgnoringAdditionalShipCharges", UtilMisc.toMap("productStoreId", orh.getProductStoreId()), locale), MODULE); } String invoiceId = null; @@ -1842,7 +1842,7 @@ public class InvoiceServices { try { shipmentItemBilling = EntityQuery.use(delegator).from("ShipmentItemBilling").where("shipmentId", shipmentId).queryFirst(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingShipmentItemBilling", locale)); } if (shipmentItemBilling != null) { @@ -1854,13 +1854,13 @@ public class InvoiceServices { try { Map<String, Object> result = dispatcher.runSync("createInvoiceForOrder", serviceContext); if (ServiceUtil.isError(result)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoiceForOrderService", locale)); } invoicesCreated.add((String) result.get("invoiceId")); } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling createInvoiceForOrder service; invoice not created for shipment", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreateInvoiceForOrderService", locale)); } } @@ -1895,7 +1895,7 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); String shipmentId = (String) context.get("shipmentId"); - String errorMsg = UtilProperties.getMessage(resource, "AccountingErrorCreatingInvoiceForShipment", + String errorMsg = UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceForShipment", UtilMisc.toMap("shipmentId", shipmentId), locale); boolean salesReturnFound = false; boolean purchaseReturnFound = false; @@ -1906,7 +1906,7 @@ public class InvoiceServices { // get the shipment and validate that it is a sales return GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); if (shipment == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(RESOURCE, "AccountingShipmentNotFound", locale)); } if ("SALES_RETURN".equals(shipment.getString("shipmentTypeId"))) { @@ -1915,7 +1915,7 @@ public class InvoiceServices { purchaseReturnFound = true; } if (!(salesReturnFound || purchaseReturnFound)) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(RESOURCE, "AccountingShipmentNotSalesReturnAndPurchaseReturn", locale)); } // get the items of the shipment. They can come from ItemIssuance if the shipment were from a purchase return, ShipmentReceipt if it were from a sales return @@ -2007,7 +2007,7 @@ public class InvoiceServices { String returnId= (String) context.get("returnId"); List<GenericValue> billItems = UtilGenerics.cast(context.get("billItems")); - String errorMsg = UtilProperties.getMessage(resource, "AccountingErrorCreatingInvoiceForReturn",UtilMisc.toMap("returnId",returnId),locale); + String errorMsg = UtilProperties.getMessage(RESOURCE, "AccountingErrorCreatingInvoiceForReturn",UtilMisc.toMap("returnId",returnId),locale); // List invoicesCreated = new ArrayList(); try { String invoiceTypeId; @@ -2015,7 +2015,7 @@ public class InvoiceServices { // get the return header GenericValue returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader == null || returnHeader.get("returnHeaderTypeId") == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingReturnTypeCannotBeNull", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingReturnTypeCannotBeNull", locale)); } if (returnHeader.getString("returnHeaderTypeId").startsWith("CUSTOMER_")) { @@ -2119,7 +2119,7 @@ public class InvoiceServices { // determine invoice item type from the return item type String invoiceItemTypeId = getInvoiceItemType(delegator, returnItem.getString("returnItemTypeId"), null, invoiceTypeId, null); if (invoiceItemTypeId == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(RESOURCE, "AccountingNoKnownInvoiceItemTypeReturnItemType", UtilMisc.toMap("returnItemTypeId", returnItem.getString("returnItemTypeId")), locale)); } @@ -2194,7 +2194,7 @@ public class InvoiceServices { // determine invoice item type from the return item type invoiceItemTypeId = getInvoiceItemType(delegator, adjustment.getString("returnAdjustmentTypeId"), null, invoiceTypeId, null); if (invoiceItemTypeId == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(RESOURCE, "AccountingNoKnownInvoiceItemTypeReturnAdjustmentType", UtilMisc.toMap("returnAdjustmentTypeId", adjustment.getString("returnAdjustmentTypeId")), locale)); } @@ -2256,7 +2256,7 @@ public class InvoiceServices { // determine invoice item type from the return item type String invoiceItemTypeId = getInvoiceItemType(delegator, adjustment.getString("returnAdjustmentTypeId"), null, invoiceTypeId, null); if (invoiceItemTypeId == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(RESOURCE, "AccountingNoKnownInvoiceItemTypeReturnAdjustmentType", UtilMisc.toMap("returnAdjustmentTypeId", adjustment.getString("returnAdjustmentTypeId")), locale)); } @@ -2315,7 +2315,7 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); if (DECIMALS == -1 || ROUNDING == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingAritmeticPropertiesNotConfigured", locale)); } @@ -2325,7 +2325,7 @@ public class InvoiceServices { invoice = EntityQuery.use(delegator).from("Invoice").where("invoiceId", invoiceId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting Invoice for Invoice ID" + invoiceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } @@ -2352,7 +2352,7 @@ public class InvoiceServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problem getting PaymentApplication(s) for Invoice ID " + invoiceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingPaymentApplication", UtilMisc.toMap("invoiceId", invoiceId), locale)); } @@ -2392,13 +2392,13 @@ public class InvoiceServices { try { Map<String, Object> serviceResults = dispatcher.runSync("setInvoiceStatus", svcCtx); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemChangingInvoiceStatusTo", UtilMisc.toMap("newStatus", "INVOICE_PAID"), locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem changing invoice status to INVOICE_PAID" + svcCtx, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemChangingInvoiceStatusTo", UtilMisc.toMap("newStatus", "INVOICE_PAID"), locale)); } @@ -2602,7 +2602,7 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); if (DECIMALS == -1 || ROUNDING == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingAritmeticPropertiesNotConfigured", locale)); } @@ -2679,7 +2679,7 @@ public class InvoiceServices { count--; } if (count != 1) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingSpecifyInvoiceToPaymentBillingAccountTaxGeoId", locale)); + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingSpecifyInvoiceToPaymentBillingAccountTaxGeoId", locale)); } } @@ -2700,7 +2700,7 @@ public class InvoiceServices { GenericValue payment = null; String currencyUomId = null; if (paymentId == null || paymentId.equals("")) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentIdBlankNotSupplied", locale)); + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentIdBlankNotSupplied", locale)); } else { try { payment = EntityQuery.use(delegator).from("Payment").where("paymentId", paymentId).queryOne(); @@ -2708,18 +2708,18 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (payment == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRecordNotFound", UtilMisc.toMap("paymentId", paymentId), locale)); return ServiceUtil.returnError(errorMessageList); } paymentApplyAvailable = payment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentApplied(payment)).setScale(DECIMALS,ROUNDING); if ("PMNT_CANCELLED".equals(payment.getString("statusId"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCancelled", UtilMisc.toMap("paymentId", paymentId), locale)); } if ("PMNT_CONFIRMED".equals(payment.getString("statusId"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId", paymentId), locale)); } @@ -2737,31 +2737,31 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (toPayment == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRecordNotFound", UtilMisc.toMap("paymentId", toPaymentId), locale)); return ServiceUtil.returnError(errorMessageList); } toPaymentApplyAvailable = toPayment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentApplied(toPayment)).setScale(DECIMALS,ROUNDING); if ("PMNT_CANCELLED".equals(toPayment.getString("statusId"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCancelled", UtilMisc.toMap("paymentId", paymentId), locale)); } if ("PMNT_CONFIRMED".equals(toPayment.getString("statusId"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId", paymentId), locale)); } if (paymentApplicationId == null) { // only check for new application records, update on existing records is checked in the paymentApplication section if (toPaymentApplyAvailable.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentAlreadyApplied", UtilMisc.toMap("paymentId", toPaymentId), locale)); } else { // check here for too much application if a new record is // added (paymentApplicationId == null) if (amountApplied.compareTo(toPaymentApplyAvailable) > 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentLessRequested", UtilMisc.<String, Object>toMap("paymentId",toPaymentId, "paymentApplyAvailable", toPaymentApplyAvailable, @@ -2773,7 +2773,7 @@ public class InvoiceServices { // check if at least one send is the same as one receiver on the other payment if (!payment.getString("partyIdFrom").equals(toPayment.getString("partyIdTo")) && !payment.getString("partyIdTo").equals(toPayment.getString("partyIdFrom"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingFromPartySameToParty", locale)); } @@ -2792,7 +2792,7 @@ public class InvoiceServices { } if (invoice == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else { if (invoice.getString("billingAccountId") != null) { @@ -2810,14 +2810,14 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (billingAccount == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingBillingAccountNotFound", UtilMisc.toMap("billingAccountId", billingAccountId), locale)); return ServiceUtil.returnError(errorMessageList); } // check the currency if (billingAccount.get("accountCurrencyUomId") != null && currencyUomId != null && !billingAccount.getString("accountCurrencyUomId").equals(currencyUomId)) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingBillingAccountCurrencyProblem", + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingBillingAccountCurrencyProblem", UtilMisc.toMap("billingAccountId", billingAccountId, "accountCurrencyUomId", billingAccount.getString("accountCurrencyUomId"), "paymentId", paymentId, "paymentCurrencyUomId", currencyUomId), locale)); @@ -2843,19 +2843,19 @@ public class InvoiceServices { } if (invoice == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else { // check the invoice and when supplied the invoice item... if ("INVOICE_CANCELLED".equals(invoice.getString("statusId"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCancelledCannotApplyTo", UtilMisc.toMap("invoiceId", invoiceId), locale)); } // check the currency if (currencyUomId != null && invoice.get("currencyUomId") != null && !currencyUomId.equals(invoice.getString("currencyUomId"))) { - Debug.logInfo(UtilProperties.getMessage(resource, "AccountingInvoicePaymentCurrencyProblem", + Debug.logInfo(UtilProperties.getMessage(RESOURCE, "AccountingInvoicePaymentCurrencyProblem", UtilMisc.toMap("invoiceCurrency", invoice.getString("currencyUomId"), "paymentCurrency", payment.getString("currencyUomId")),locale), MODULE); Debug.logInfo("will try to apply payment on the actualCurrency amount on payment", MODULE); @@ -2875,18 +2875,18 @@ public class InvoiceServices { invoiceApplyAvailable = InvoiceWorker.getInvoiceNotApplied(invoice); if (invoiceTotal.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceTotalZero", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else if (paymentApplicationId == null) { // only check for new records here...updates are checked in the paymentApplication section if (invoiceApplyAvailable.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCompletelyApplied", UtilMisc.toMap("invoiceId", invoiceId), locale)); } // check here for too much application if a new record(s) are // added (paymentApplicationId == null) else if (amountApplied.compareTo(invoiceApplyAvailable) > 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceLessRequested", + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceLessRequested", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "invoiceApplyAvailable", invoiceApplyAvailable, "amountApplied", amountApplied, @@ -2897,7 +2897,7 @@ public class InvoiceServices { // check if at least one sender is the same as one receiver on the invoice if (!payment.getString("partyIdFrom").equals(invoice.getString("partyId")) && !payment.getString("partyIdTo").equals(invoice.getString("partyIdFrom"))) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingFromPartySameToParty", locale)); } @@ -2916,12 +2916,12 @@ public class InvoiceServices { } if (invoiceItem == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceItemNotFound", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId), locale)); } else { if (invoice.get("currencyUomId") != null && currencyUomId != null && !invoice.getString("currencyUomId").equals(currencyUomId)) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoicePaymentCurrencyProblem", UtilMisc.toMap("paymentCurrencyId", currencyUomId, "itemCurrency", invoice.getString("currencyUomId")), locale)); @@ -2940,7 +2940,7 @@ public class InvoiceServices { // new record errorMessageList.add("Invoice(" + invoiceId + ") item(" + invoiceItemSeqId + ") has " + invoiceItemApplyAvailable + " to apply but " + amountApplied + " is requested\n"); String uomId = invoice.getString("currencyUomId"); - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceItemLessRequested", + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceItemLessRequested", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId, "invoiceItemApplyAvailable", invoiceItemApplyAvailable, "amountApplied", amountApplied, "isoCode", uomId), locale)); @@ -2956,13 +2956,13 @@ public class InvoiceServices { if (paymentApplicationId == null) { // only check for new application records, update on existing records is checked in the paymentApplication section if (paymentApplyAvailable.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentAlreadyApplied", UtilMisc.toMap("paymentId", paymentId), locale)); } else { // check here for too much application if a new record is // added (paymentApplicationId == null) if (amountApplied.compareTo(paymentApplyAvailable) > 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentLessRequested", + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentLessRequested", UtilMisc.<String, Object>toMap("paymentId", paymentId, "paymentApplyAvailable", paymentApplyAvailable, "amountApplied", amountApplied,"isoCode", currencyUomId), locale)); @@ -2991,7 +2991,7 @@ public class InvoiceServices { } if (paymentApplication == null) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentApplicationNotFound", UtilMisc.toMap("paymentApplicationId", paymentApplicationId), locale)); paymentApplicationId = null; @@ -3029,7 +3029,7 @@ public class InvoiceServices { newPaymentApplyAvailable = paymentApplyAvailable.add(paymentApplyAvailable).subtract(amountApplied).setScale(DECIMALS, ROUNDING); } if (newPaymentApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId", paymentId, "paymentApplyAvailable", paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")), @@ -3045,7 +3045,7 @@ public class InvoiceServices { if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") == null) { newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (invoiceApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotEnough", UtilMisc.<String, Object>toMap("tooMuch", newInvoiceApplyAvailable.negate(), "invoiceId", invoiceId), locale)); @@ -3054,7 +3054,7 @@ public class InvoiceServices { // check if the item number changed from a real Item number to a null value newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (invoiceApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotEnough", UtilMisc.<String, Object>toMap("tooMuch", newInvoiceApplyAvailable.negate(), "invoiceId", invoiceId), locale)); @@ -3064,7 +3064,7 @@ public class InvoiceServices { // a real Item number newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (newInvoiceItemApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingItemInvoiceNotEnough", UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(), "invoiceId", invoiceId, @@ -3075,7 +3075,7 @@ public class InvoiceServices { // item number the same numeric value newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (newInvoiceItemApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingItemInvoiceNotEnough", UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(), "invoiceId", invoiceId, @@ -3085,7 +3085,7 @@ public class InvoiceServices { // item number changed only check new item newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(amountApplied).setScale(DECIMALS, ROUNDING); if (newInvoiceItemApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingItemInvoiceNotEnough", UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(), "invoiceId", invoiceId, @@ -3108,7 +3108,7 @@ public class InvoiceServices { // check the invoice newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied").subtract(amountApplied)).setScale(DECIMALS, ROUNDING); if (newInvoiceApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotEnough", UtilMisc.<String, Object>toMap("tooMuch", invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied), "invoiceId", invoiceId), locale)); @@ -3121,7 +3121,7 @@ public class InvoiceServices { if (toPaymentId != null && toPaymentId.equals(paymentApplication.getString("toPaymentId"))) { newToPaymentApplyAvailable = toPaymentApplyAvailable.subtract(paymentApplication.getBigDecimal("amountApplied")).add(amountApplied).setScale(DECIMALS, ROUNDING); if (newToPaymentApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId", toPaymentId, "paymentApplyAvailable", newToPaymentApplyAvailable, @@ -3132,7 +3132,7 @@ public class InvoiceServices { // check the new billing account number. newToPaymentApplyAvailable = toPaymentApplyAvailable.add(amountApplied).setScale(DECIMALS, ROUNDING); if (newToPaymentApplyAvailable.compareTo(BigDecimal.ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId", toPaymentId, "paymentApplyAvailable", newToPaymentApplyAvailable, @@ -3156,24 +3156,24 @@ public class InvoiceServices { Debug.logInfo("checking finished, start processing with the following data... ", MODULE); if (invoiceId != null) { Debug.logInfo(" Invoice(" + invoiceId + ") amount not yet applied: " + newInvoiceApplyAvailable + extra + " Payment(" + paymentId + ") amount not yet applied: " + newPaymentApplyAvailable + " Requested amount to apply:" + amountApplied, MODULE); - toMessage = UtilProperties.getMessage(resource, + toMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationToInvoice", UtilMisc.toMap("invoiceId", invoiceId), locale); if (extra.length() > 0) { - toMessage = UtilProperties.getMessage(resource, + toMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationToInvoiceItem", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId), locale); } } if (toPaymentId != null) { Debug.logInfo(" toPayment(" + toPaymentId + ") amount not yet applied: " + newToPaymentApplyAvailable + " Payment(" + paymentId + ") amount not yet applied: " + newPaymentApplyAvailable + " Requested amount to apply:" + amountApplied, MODULE); - toMessage = UtilProperties.getMessage(resource, + toMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationToPayment", UtilMisc.toMap("paymentId", toPaymentId), locale); } if (taxAuthGeoId != null) { Debug.logInfo(" taxAuthGeoId(" + taxAuthGeoId + ") Payment(" + paymentId + ") amount not yet applied: " + newPaymentApplyAvailable + " Requested amount to apply:" + amountApplied, MODULE); - toMessage = UtilProperties.getMessage(resource, + toMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationToTax", UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId), locale); } @@ -3183,13 +3183,13 @@ public class InvoiceServices { amountApplied = newPaymentApplyAvailable; if (invoiceId != null && newInvoiceApplyAvailable.compareTo(amountApplied) < 0) { amountApplied = newInvoiceApplyAvailable; - toMessage = UtilProperties.getMessage(resource, + toMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationToInvoice", UtilMisc.toMap("invoiceId", invoiceId), locale); } if (toPaymentId != null && newToPaymentApplyAvailable.compareTo(amountApplied) < 0) { amountApplied = newToPaymentApplyAvailable; - toMessage = UtilProperties.getMessage(resource, + toMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationToPayment", UtilMisc.toMap("paymentId", toPaymentId), locale); } @@ -3197,9 +3197,9 @@ public class InvoiceServices { String successMessage = null; if (amountApplied.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingNoAmount", locale)); + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingNoAmount", locale)); } else { - successMessage = UtilProperties.getMessage(resource, + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingApplicationSuccess", UtilMisc.<String, Object>toMap("amountApplied", amountApplied, "paymentId", paymentId, @@ -3262,7 +3262,7 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (invoiceItems.size() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingNoInvoiceItemsFoundForInvoice", UtilMisc.toMap("invoiceId", invoiceId), locale)); + errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingNoInvoiceItemsFoundForInvoice", UtilMisc.toMap("invoiceId", invoiceId), locale)); return ServiceUtil.returnError(errorMessageList); } // check if the user want to apply a smaller amount than the maximum possible on the payment @@ -3376,7 +3376,7 @@ public class InvoiceServices { invoicedAdjustments = EntityQuery.use(delegator).from("OrderAdjustmentBilling").where("orderAdjustmentId", orderAdjustment.get("orderAdjustmentId")).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService" + ": " + e.getMessage(), locale)); } for (GenericValue invoicedAdjustment : invoicedAdjustments) { @@ -3395,7 +3395,7 @@ public class InvoiceServices { * @return map results */ private static Map<String, Object> storePaymentApplication(Delegator delegator, GenericValue paymentApplication,Locale locale) { - Map<String, Object> results = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + Map<String, Object> results = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingSuccessful", locale)); boolean debug = true; if (debug) { @@ -3403,7 +3403,7 @@ public class InvoiceServices { } if (DECIMALS == -1 || ROUNDING == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingAritmeticPropertiesNotConfigured", locale)); } @@ -3546,7 +3546,7 @@ public class InvoiceServices { ByteBuffer fileBytes = (ByteBuffer) context.get("uploadedFile"); if (fileBytes == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingUploadedFileDataNotFound", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingUploadedFileDataNotFound", locale)); } String organizationPartyId = (String) context.get("organizationPartyId"); @@ -3705,7 +3705,7 @@ public class InvoiceServices { return ServiceUtil.returnError(errMsgs); } - Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "AccountingNewInvoicesCreated", UtilMisc.toMap("invoicesCreated", invoicesCreated), locale)); + Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingNewInvoicesCreated", UtilMisc.toMap("invoicesCreated", invoicesCreated), locale)); result.put("organizationPartyId", organizationPartyId); return result; } 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 270cafa..c276f61 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 @@ -54,7 +54,7 @@ import org.apache.ofbiz.service.LocalDispatcher; */ public final class InvoiceWorker { - public static final String MODULE = InvoiceWorker.class.getName(); + private static final String MODULE = InvoiceWorker.class.getName(); private static final int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static final RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); private static final int taxDecimals = UtilNumber.getBigDecimalScale("salestax.calc.decimals"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java index 35f29b7..9d33d69 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java @@ -33,7 +33,7 @@ import org.apache.ofbiz.service.ServiceUtil; public class GeneralLedgerServices { - public static final String MODULE = GeneralLedgerServices.class.getName(); + private static final String MODULE = GeneralLedgerServices.class.getName(); public static Map<String, Object> createUpdateCostCenter(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); 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 44d7f26..13977a7 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 @@ -52,8 +52,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class BillingAccountWorker { - public static final String MODULE = BillingAccountWorker.class.getName(); - public static final String resourceError = "AccountingUiLabels"; + private static final String MODULE = BillingAccountWorker.class.getName(); + private static final String RES_ERROR = "AccountingUiLabels"; public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals"); public static final RoundingMode rounding = UtilNumber.getRoundingMode("order.rounding"); public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); @@ -187,7 +187,7 @@ public class BillingAccountWorker { try { GenericValue billingAccount = EntityQuery.use(delegator).from("BillingAccount").where("billingAccountId", billingAccountId).queryOne(); if (billingAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingBillingAccountNotFound", UtilMisc.toMap("billingAccountId", billingAccountId), locale)); } @@ -201,7 +201,7 @@ public class BillingAccountWorker { return result; } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingBillingAccountNotFound", UtilMisc.toMap("billingAccountId", billingAccountId), locale)); } 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 6b7507a..9d22ec6 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 @@ -49,9 +49,9 @@ import org.apache.ofbiz.service.ServiceUtil; public class GiftCertificateServices { - public static final String MODULE = GiftCertificateServices.class.getName(); - public static final String resourceError = "AccountingErrorUiLabels"; - public static final String resourceOrderError = "OrderErrorUiLabels"; + private static final String MODULE = GiftCertificateServices.class.getName(); + private static final String RES_ERROR = "AccountingErrorUiLabels"; + private static final String RES_ORDERError = "OrderErrorUiLabels"; // These are default settings, in case ProductStoreFinActSetting does not have them public static final int CARD_NUMBER_LENGTH = 14; public static final int PIN_NUMBER_LENGTH = 6; @@ -144,7 +144,7 @@ public class GiftCertificateServices { } catch (GenericEntityException | GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCreationError", locale)); } catch (GeneralException e) { Debug.logError(e, MODULE); @@ -192,7 +192,7 @@ public class GiftCertificateServices { .cache().queryOne(); if ("Y".equals(giftCertSettings.getString("requirePinCode"))) { if (!validatePin(delegator, cardNumber, pinNumber)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberPinNotValid", locale)); } finAccountId = cardNumber; @@ -203,14 +203,14 @@ public class GiftCertificateServices { } } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), locale)); } if (finAccountId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale)); } @@ -218,7 +218,7 @@ public class GiftCertificateServices { try { finAccount = EntityQuery.use(delegator).from("FinAccount").where("finAccountId", finAccountId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", finAccountId), locale)); } } @@ -276,7 +276,7 @@ public class GiftCertificateServices { // validate the amount if (amount.compareTo(BigDecimal.ZERO) < 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountMustBePositive", locale)); } @@ -286,11 +286,11 @@ public class GiftCertificateServices { .where("productStoreId", productStoreId, "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId) .cache().queryOne(); if ("Y".equals(giftCertSettings.getString("requirePinCode")) && !validatePin(delegator, cardNumber, pinNumber)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberPinNotValid", locale)); } } catch (GenericEntityException ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), locale)); @@ -301,7 +301,7 @@ public class GiftCertificateServices { try { finAccount = EntityQuery.use(delegator).from("FinAccount").where("finAccountId", cardNumber).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", cardNumber), locale)); } @@ -347,7 +347,7 @@ public class GiftCertificateServices { // validate the pin if (!validatePin(delegator, cardNumber, pinNumber)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberPinNotValid", locale)); } @@ -355,7 +355,7 @@ public class GiftCertificateServices { try { finAccount = EntityQuery.use(delegator).from("FinAccount").where("finAccountId", cardNumber).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", cardNumber), locale)); } @@ -390,7 +390,7 @@ public class GiftCertificateServices { authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotCapture", locale)); } @@ -402,14 +402,14 @@ public class GiftCertificateServices { // make sure authorization has not expired Timestamp authExpiration = finAccountAuth.getTimestamp("thruDate"); if ((authExpiration != null) && (authExpiration.before(UtilDateTime.nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountAuthorizationExpired", UtilMisc.toMap("paymentGatewayResponseId", authTransaction.getString("paymentGatewayResponseId"), "authExpiration", authExpiration), locale)); } // make sure the fin account itself has not expired if ((giftCard.getTimestamp("thruDate") != null) && (giftCard.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberExpired", UtilMisc.toMap("thruDate", giftCard.getTimestamp("thruDate")), locale)); } @@ -457,7 +457,7 @@ public class GiftCertificateServices { return result; } catch (GenericEntityException | GenericServiceException ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotProcess", UtilMisc.toMap("errorString", ex.getMessage()), locale)); } @@ -499,27 +499,27 @@ public class GiftCertificateServices { } else { finAccount = FinAccountHelper.getFinAccountFromCode(giftCard.getString("cardNumber"), delegator); if (finAccount == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberNotFound", UtilMisc.toMap("finAccountId", ""), locale)); } finAccountId = finAccount.getString("finAccountId"); } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), locale)); } if (finAccountId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberPinNotValid", locale)); } // check for expiration date if ((finAccount.getTimestamp("thruDate") != null) && (finAccount.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp()))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberExpired", UtilMisc.toMap("thruDate", finAccount.getTimestamp("thruDate")), locale)); } @@ -566,7 +566,7 @@ public class GiftCertificateServices { return result; } catch (GenericEntityException | GenericServiceException ex) { Debug.logError(ex, "Cannot authorize gift certificate", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotAuthorize", UtilMisc.toMap("errorString", ex.getMessage()), locale)); } @@ -587,13 +587,13 @@ public class GiftCertificateServices { GenericValue paymentPref = (GenericValue) context.get("orderPaymentPreference"); Locale locale = (Locale) context.get("locale"); - String err = UtilProperties.getMessage(resourceError, + String err = UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotBeExpired", locale); try { // expire the related financial authorization transaction GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(paymentPref); if (authTransaction == null) { - return ServiceUtil.returnError(err + UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(err + UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotFindAuthorization", locale)); } Map<String, Object> input = UtilMisc.<String, Object>toMap("userLogin", userLogin, @@ -638,12 +638,12 @@ public class GiftCertificateServices { giftCard = paymentPref.getRelatedOne("GiftCard", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get GiftCard from OrderPaymentPreference", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotLocateItFromOrderPaymentPreference", locale)); } if (giftCard == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotRelease", locale)); } @@ -666,7 +666,7 @@ public class GiftCertificateServices { restoreGcResult = dispatcher.runSync("addFundsToGiftCertificate", refundCtx); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberRefundCallError", locale)); } if (ServiceUtil.isError(restoreGcResult)) { @@ -703,7 +703,7 @@ public class GiftCertificateServices { orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem",MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderCannotGetOrderHeader", UtilMisc.toMap("orderId", orderId), locale)); } @@ -724,7 +724,7 @@ public class GiftCertificateServices { productStoreId = orh.getProductStoreId(); } if (productStoreId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotProcess", UtilMisc.toMap("orderId", orderId), locale)); } @@ -748,7 +748,7 @@ public class GiftCertificateServices { Debug.logError(e, "Unable to get Product from OrderItem", MODULE); } if (product == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfill", locale)); } @@ -760,7 +760,7 @@ public class GiftCertificateServices { .cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get Product Store FinAccount settings for " + FinAccountHelper.giftCertFinAccountTypeId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), locale) + ": " + e.getMessage()); @@ -778,11 +778,11 @@ public class GiftCertificateServices { .orderBy("-responseDate").queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurvey", locale)); } if (surveyResponse == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurvey", locale)); } @@ -792,7 +792,7 @@ public class GiftCertificateServices { responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurveyAnswers", locale)); } @@ -805,7 +805,7 @@ public class GiftCertificateServices { question = answer.getRelatedOne("SurveyQuestion", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurveyAnswers", locale)); } if (question != null) { @@ -843,11 +843,11 @@ public class GiftCertificateServices { createGcResult = dispatcher.runSync("createGiftCertificate", createGcCtx); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCreationError", locale) + e.getMessage()); } if (ServiceUtil.isError(createGcResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCreationError", locale) + ServiceUtil.getErrorMessage(createGcResult)); } @@ -869,7 +869,7 @@ public class GiftCertificateServices { dispatcher.runAsync("createGcFulFillmentRecord", gcFulFill, true); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotStoreFulfillmentInfo", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -920,7 +920,7 @@ public class GiftCertificateServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem sending mail", MODULE); // this is fatal; we will rollback and try again later - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotSendEmailNotice", UtilMisc.toMap("errorString", e.toString()), locale)); } @@ -946,7 +946,7 @@ public class GiftCertificateServices { orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem",MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderCannotGetOrderHeader", UtilMisc.toMap("orderId", orderId), locale)); } @@ -967,7 +967,7 @@ public class GiftCertificateServices { productStoreId = orh.getProductStoreId(); } if (productStoreId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "AccountingGiftCertificateNumberCannotReload", UtilMisc.toMap("orderId", orderId), locale)); } @@ -978,7 +978,7 @@ public class GiftCertificateServices { paymentConfig = paymentSetting.getString("paymentPropertiesPath"); } if (paymentConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "AccountingGiftCertificateNumberCannotGetPaymentConfiguration", locale)); } @@ -1004,7 +1004,7 @@ public class GiftCertificateServices { .orderBy("-responseDate").queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "AccountingGiftCertificateNumberCannotReload", locale)); } @@ -1014,7 +1014,7 @@ public class GiftCertificateServices { responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "AccountingGiftCertificateNumberCannotReloadFromSurveyAnswers", locale)); } @@ -1027,7 +1027,7 @@ public class GiftCertificateServices { question = answer.getRelatedOne("SurveyQuestion", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "AccountingGiftCertificateNumberCannotReloadFromSurveyAnswers", locale)); } if (question != null) { @@ -1084,7 +1084,7 @@ public class GiftCertificateServices { dispatcher.runAsync("createGcFulFillmentRecord", gcFulFill, true); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotStoreFulfillmentInfo", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -1145,7 +1145,7 @@ public class GiftCertificateServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem sending mail", MODULE); // this is fatal; we will rollback and try again later - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotSendEmailNotice", UtilMisc.toMap("errorString", e.toString()), locale)); } @@ -1179,7 +1179,7 @@ public class GiftCertificateServices { delegator.create(gcFulFill); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotStoreFulfillmentInfo", UtilMisc.toMap("errorString", e.toString()), locale)); } @@ -1211,7 +1211,7 @@ public class GiftCertificateServices { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorUnableToGetReturnItemInformation", locale)); } @@ -1229,7 +1229,7 @@ public class GiftCertificateServices { returnHeaderResp = dispatcher.runSync("createReturnHeader", returnHeaderInfo); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorUnableToCreateReturnHeader", locale)); } @@ -1240,7 +1240,7 @@ public class GiftCertificateServices { String returnId = (String) returnHeaderResp.get("returnId"); if (UtilValidate.isEmpty(returnId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorCreateReturnHeaderWithoutId", locale)); } @@ -1261,7 +1261,7 @@ public class GiftCertificateServices { returnItemResp = dispatcher.runSync("createReturnItem", returnItemInfo); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorUnableToCreateReturnItem", locale)); } @@ -1272,7 +1272,7 @@ public class GiftCertificateServices { String returnItemSeqId = (String) returnItemResp.get("returnItemSeqId"); if (returnItemSeqId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorCreateReturnItemWithoutId", locale)); } if (Debug.verboseOn()) { @@ -1285,7 +1285,7 @@ public class GiftCertificateServices { admin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorUnableToUpdateReturnHeaderStatusWithoutUserLogin", locale)); } @@ -1300,7 +1300,7 @@ public class GiftCertificateServices { updateReturnResp = dispatcher.runSync("updateReturnHeader", updateReturnInfo); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDERError, "OrderErrorUnableToUpdateReturnHeaderStatus", locale)); } @@ -1362,7 +1362,7 @@ public class GiftCertificateServices { partyIdFrom = coParty; partyIdTo = partyId; } else { - throw new GeneralException(UtilProperties.getMessage(resourceError, + throw new GeneralException(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountCannotCreateTransaction", 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 6b8183a..b88b7e8 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 @@ -75,7 +75,7 @@ import com.ibm.icu.util.Calendar; */ public class PaymentGatewayServices { - public static final String MODULE = PaymentGatewayServices.class.getName(); + private static final String MODULE = PaymentGatewayServices.class.getName(); public static final String AUTH_SERVICE_TYPE = "PRDS_PAY_AUTH"; private static final String REAUTH_SERVICE_TYPE = "PRDS_PAY_REAUTH"; private static final String RELEASE_SERVICE_TYPE = "PRDS_PAY_RELEASE"; @@ -86,9 +86,9 @@ public class PaymentGatewayServices { public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals"); public static final RoundingMode rounding = UtilNumber.getRoundingMode("order.rounding"); public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); - public static final String resource = "AccountingUiLabels"; - public static final String resourceError = "AccountingErrorUiLabels"; - public static final String resourceOrder = "OrderUiLabels"; + private static final String RESOURCE = "AccountingUiLabels"; + private static final String RES_ERROR = "AccountingErrorUiLabels"; + private static final String RES_ORDER = "OrderUiLabels"; /** * Authorizes a single order preference with an option to specify an amount. The result map has the Booleans @@ -109,12 +109,12 @@ public class PaymentGatewayServices { // validate overrideAmount if its available if (overrideAmount != null) { if (overrideAmount.compareTo(BigDecimal.ZERO) < 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentAmountIsNegative", UtilMisc.toMap("overrideAmount", overrideAmount), locale)); } if (overrideAmount.compareTo(BigDecimal.ZERO) == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentAmountIsZero", UtilMisc.toMap("overrideAmount", overrideAmount), locale)); } @@ -127,7 +127,7 @@ public class PaymentGatewayServices { orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -149,7 +149,7 @@ public class PaymentGatewayServices { orderPaymentPreference.refresh(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale)); } @@ -300,7 +300,7 @@ public class PaymentGatewayServices { } } catch (GeneralException e) { Debug.logError(e, "Error processing payment authorization", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentCannotBeAuthorized", UtilMisc.toMap("errroString", e.toString()), locale)); } @@ -346,7 +346,7 @@ public class PaymentGatewayServices { // make sure we have a OrderHeader if (orderHeader == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -731,7 +731,7 @@ public class PaymentGatewayServices { orderId = (String) context.get("orderId"); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -776,7 +776,7 @@ public class PaymentGatewayServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem calling releaseOrderPaymentPreference service for orderPaymentPreferenceId" + paymentPref.getString("orderPaymentPreferenceId"), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " + paymentPref.getString("orderPaymentPreferenceId")); } @@ -870,7 +870,7 @@ public class PaymentGatewayServices { } } else { Debug.logError("Credit failed for pref : " + paymentPref, MODULE); - return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, + return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "AccountingTroubleCallingCreditOrderPaymentPreferenceService", UtilMisc.toMap("paymentPref", paymentPref), locale)); } @@ -896,7 +896,7 @@ public class PaymentGatewayServices { } catch (GenericEntityException e) { Debug.logWarning(e, "Problem getting OrderPaymentPreference for orderPaymentPreferenceId " + orderPaymentPreferenceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -904,7 +904,7 @@ public class PaymentGatewayServices { if (paymentPref == null) { Debug.logWarning("Could not find OrderPaymentPreference with orderPaymentPreferenceId: " + orderPaymentPreferenceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -915,14 +915,14 @@ public class PaymentGatewayServices { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "Problem getting OrderHeader for orderId " + orderId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } // Error if no OrderHeader was found if (orderHeader == null) { Debug.logWarning("Could not find OrderHeader with orderId: " + orderId + "; not processing payments.", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } OrderReadHelper orh = new OrderReadHelper(orderHeader); @@ -945,13 +945,13 @@ public class PaymentGatewayServices { paymentGatewayConfigId = paymentSettings.getString("paymentGatewayConfigId"); if (serviceName == null) { Debug.logWarning("No payment release service for - " + paymentPref.getString("paymentMethodTypeId"), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " + paymentPref.getString("paymentMethodTypeId")); } } else { Debug.logWarning("No payment release settings found for - " + paymentPref.getString("paymentMethodTypeId"), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " + paymentPref.getString("paymentMethodTypeId")); } @@ -972,7 +972,7 @@ public class PaymentGatewayServices { releaseResult = dispatcher.runSync(serviceName, releaseContext, TX_TIME, true); } catch (GenericServiceException e) { Debug.logError(e,"Problem releasing payment", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale)); } // get the release result code @@ -986,7 +986,7 @@ public class PaymentGatewayServices { releaseResRes = dispatcher.runSync(model.name, resCtx); } catch (GenericServiceException e) { Debug.logError(e, "Trouble processing the release results", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " + e.getMessage()); } @@ -1074,7 +1074,7 @@ public class PaymentGatewayServices { } } else { Debug.logError("Release failed for pref : " + paymentPref, MODULE); - return ServiceUtil.returnFailure(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_ORDER, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale) + " " + paymentPref); } @@ -1098,13 +1098,13 @@ public class PaymentGatewayServices { invoice = EntityQuery.use(delegator).from("Invoice").where("invoiceId", invoiceId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Trouble looking up Invoice #" + invoiceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } if (invoice == null) { Debug.logError("Could not locate invoice #" + invoiceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } @@ -1114,7 +1114,7 @@ public class PaymentGatewayServices { orderItemBillings = invoice.getRelated("OrderItemBilling", null, null, false); } catch (GenericEntityException e) { Debug.logError("Trouble getting OrderItemBilling(s) from Invoice #" + invoiceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemLookingUpOrderItemBilling", UtilMisc.toMap("billFields", invoiceId), locale)); } @@ -1143,7 +1143,7 @@ public class PaymentGatewayServices { if (testOrderId == null || !allSameOrder) { Debug.logWarning("Attempt to settle Invoice #" + invoiceId + " which contained none/multiple orders", MODULE); - return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, + return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceCannotBeSettle", UtilMisc.toMap("invoiceId", invoiceId), locale)); } @@ -1167,7 +1167,7 @@ public class PaymentGatewayServices { return result; } catch (GenericServiceException e) { Debug.logError(e, "Trouble running captureOrderPayments service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCannotBeCaptured", locale)); } } @@ -1206,13 +1206,13 @@ public class PaymentGatewayServices { } } catch (GenericEntityException gee) { Debug.logError(gee, "Problems getting entity record(s), see stack trace", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale) + " " + gee.toString()); } // error if no order was found if (orderHeader == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -1278,7 +1278,7 @@ public class PaymentGatewayServices { amountCaptured = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(captureResult.get("captureAmount"), "BigDecimal", null, locale); } catch (GeneralException e) { Debug.logError(e, "Trouble processing the result; captureResult: " + captureResult, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingPaymentCannotBeCaptured", locale) + " " + captureResult); } if (Debug.infoOn()) { @@ -1306,7 +1306,7 @@ public class PaymentGatewayServices { processResult(dctx, captureResult, userLogin, paymentPref, locale); } catch (GeneralException e) { Debug.logError(e, "Trouble processing the result; captureResult: " + captureResult, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingPaymentCannotBeCaptured", locale) + " " + captureResult); } @@ -1408,7 +1408,7 @@ public class PaymentGatewayServices { processResult(dctx, captureResult, userLogin, paymentPref, locale); } catch (GeneralException e) { Debug.logError(e, "Trouble processing the result; captureResult: " + captureResult, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingPaymentCannotBeCaptured", locale) + " " + captureResult); } @@ -1436,7 +1436,7 @@ public class PaymentGatewayServices { if (UtilValidate.isNotEmpty(productStore)) { boolean shipIfCaptureFails = UtilValidate.isEmpty(productStore.get("shipIfCaptureFails")) || "Y".equalsIgnoreCase(productStore.getString("shipIfCaptureFails")); if (! shipIfCaptureFails) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingPaymentCannotBeCaptured", locale)); } else { Debug.logWarning("Payment capture failed, shipping order anyway as per ProductStore setting (shipIfCaptureFails)", MODULE); @@ -1653,7 +1653,7 @@ public class PaymentGatewayServices { authTrans = getAuthTransaction(paymentPref); } catch (GeneralException e) { Debug.logError(e, "Error re-authorizing payment", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPaymentReauthorizingError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentReauthorizingError", locale)); } } @@ -1674,12 +1674,12 @@ public class PaymentGatewayServices { } else if (inParams.contains("processAmount")) { captureContext.put("processAmount", amount); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentServiceMissingAmount", UtilMisc.toMap("serviceName", serviceName, "inParams", inParams), locale)); } } catch (GenericServiceException ex) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentServiceCannotGetModel", UtilMisc.toMap("serviceName", serviceName), locale)); } @@ -1778,7 +1778,7 @@ public class PaymentGatewayServices { delegator.create(response); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingNoPaymentGatewayResponseCreatedForFailedService", locale)); } @@ -1843,7 +1843,7 @@ public class PaymentGatewayServices { if(authResult == null) { Debug.logError("No authentification result available. Payment preference can't be checked.", MODULE); return ServiceUtil - .returnError(UtilProperties.getMessage(resource, "AccountingProcessingAuthResultEmpty", locale)); + .returnError(UtilProperties.getMessage(RESOURCE, "AccountingProcessingAuthResultEmpty", locale)); } // refresh the payment preference @@ -1987,7 +1987,7 @@ public class PaymentGatewayServices { } } catch (GenericEntityException e) { Debug.logError(e, "Error updating payment status information", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPaymentStatusUpdatingError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentStatusUpdatingError", UtilMisc.toMap("errorString", e.toString()), locale)); } return ServiceUtil.returnSuccess(); @@ -2243,7 +2243,7 @@ public class PaymentGatewayServices { try { invoice = EntityQuery.use(delegator).from("Invoice").where("invoiceId", invoiceId).queryOne(); } catch (GenericEntityException e) { - String message = UtilProperties.getMessage(resourceError, "AccountingFailedToProcessCaptureResult", UtilMisc.toMap("invoiceId", invoiceId, "errorString", e.getMessage()), locale); + String message = UtilProperties.getMessage(RES_ERROR, "AccountingFailedToProcessCaptureResult", UtilMisc.toMap("invoiceId", invoiceId, "errorString", e.getMessage()), locale); Debug.logError(e, message, MODULE); return ServiceUtil.returnError(message); } @@ -2302,7 +2302,7 @@ public class PaymentGatewayServices { payRes = dispatcher.runSync("createPayment", paymentCtx); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreationError", locale)); } if (ServiceUtil.isError(payRes)) { @@ -2322,7 +2322,7 @@ public class PaymentGatewayServices { paRes = dispatcher.runSync("createPaymentApplication", paCtx); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingInvoiceApplicationCreationError", locale)); } if (paRes != null && ServiceUtil.isError(paRes)) { @@ -2345,7 +2345,7 @@ public class PaymentGatewayServices { orderPaymentPreference = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderPaymentPreferenceId", orderPaymentPreferenceId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -2362,10 +2362,10 @@ public class PaymentGatewayServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem refunding payment through processor", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRefundError", locale)); } - refundResponse.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(resourceError, "AccountingPaymentRefundedSuccessfully", UtilMisc.toMap("paymentId", refundResponse.get("paymentId"), "refundAmount", refundResponse.get("refundAmount")), locale))); + refundResponse.putAll(ServiceUtil.returnSuccess(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentRefundedSuccessfully", UtilMisc.toMap("paymentId", refundResponse.get("paymentId"), "refundAmount", refundResponse.get("refundAmount")), locale))); return refundResponse; } @@ -2381,7 +2381,7 @@ public class PaymentGatewayServices { orderHeader = paymentPref.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get OrderHeader from OrderPaymentPreference", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + e.toString()); } @@ -2427,7 +2427,7 @@ public class PaymentGatewayServices { refundResponse = dispatcher.runSync(serviceName, serviceContext, TX_TIME, true); } catch (GenericServiceException e) { Debug.logError(e, "Problem refunding payment through processor", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRefundError", locale)); } if (ServiceUtil.isError(refundResponse)) { @@ -2463,16 +2463,16 @@ public class PaymentGatewayServices { } } catch (GeneralException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRefundError", locale) + " " + e.getMessage()); } return refundResRes; } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRefundServiceNotDefined", locale)); } } else { - return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, + return ServiceUtil.returnFailure(UtilProperties.getMessage(RESOURCE, "AccountingPaymentSettingNotFound", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId"), "transactionType", REFUND_SERVICE_TYPE), locale)); @@ -2565,12 +2565,12 @@ public class PaymentGatewayServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem creating Payment", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreationError", locale)); } if (paymentId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreationError", locale)); } @@ -2579,7 +2579,7 @@ public class PaymentGatewayServices { result.put("refundAmount", context.get("refundAmount")); return result; } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentRefundError", locale)); } } @@ -2602,7 +2602,7 @@ public class PaymentGatewayServices { // make sure we have a valid order record if (orderHeader == null || orderHeader.get("statusId") == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -2940,7 +2940,7 @@ public class PaymentGatewayServices { // security check if (!security.hasEntityPermission("MANUAL", "_PAYMENT", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_CREATE", userLogin)) { Debug.logWarning("**** Security [" + (new Date()).toString() + "]: " + userLogin.get("userLoginId") + " attempt to run manual payment transaction!", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionNotAuthorized", locale)); } @@ -2958,7 +2958,7 @@ public class PaymentGatewayServices { return ServiceUtil.returnError(e.getMessage()); } if (paymentMethod == null || !"CREDIT_CARD".equals(paymentMethod.getString("paymentMethodTypeId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentManualAuthOnlyForCreditCard", locale)); } @@ -2980,7 +2980,7 @@ public class PaymentGatewayServices { return ServiceUtil.returnError(e.getMessage()); } if (UtilValidate.isEmpty(creditCard)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreditCardNotFound", UtilMisc.toMap("paymentMethodId", paymentMethodId), locale)); } @@ -2992,7 +2992,7 @@ public class PaymentGatewayServices { GenericValue paymentSettings = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "CREDIT_CARD", "PRDS_PAY_AUTH", false); if (paymentSettings == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentSettingNotFound", UtilMisc.toMap("productStoreId", productStoreId, "transactionType", ""), locale)); } else { @@ -3046,7 +3046,7 @@ public class PaymentGatewayServices { response = dispatcher.runSync(paymentService, authContext, TX_TIME, true); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentServiceError", UtilMisc.toMap("paymentService", paymentService, "authContext", authContext), locale)); @@ -3060,7 +3060,7 @@ public class PaymentGatewayServices { if (authResult != null && authResult) { return ServiceUtil.returnSuccess(); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentAuthorizationFailed", locale)); } } @@ -3075,7 +3075,7 @@ public class PaymentGatewayServices { // security check if (!security.hasEntityPermission("MANUAL", "_PAYMENT", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_CREATE", userLogin)) { Debug.logWarning("**** Security [" + (new Date()).toString() + "]: " + userLogin.get("userLoginId") + " attempt to run manual payment transaction!", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionNotAuthorized", locale)); } String orderPaymentPreferenceId = (String) context.get("orderPaymentPreferenceId"); @@ -3093,7 +3093,7 @@ public class PaymentGatewayServices { } catch (GenericEntityException e) { Debug.logWarning(e, "Problem getting OrderPaymentPreference for orderPaymentPreferenceId " + orderPaymentPreferenceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -3101,7 +3101,7 @@ public class PaymentGatewayServices { if (paymentPref == null) { Debug.logWarning("Could not find OrderPaymentPreference with orderPaymentPreferenceId: " + orderPaymentPreferenceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingProblemGettingOrderPaymentPreferences", locale) + " " + orderPaymentPreferenceId); } @@ -3112,19 +3112,19 @@ public class PaymentGatewayServices { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, "Problem getting OrderHeader for orderId " + orderId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } // Error if no OrderHeader was found if (orderHeader == null) { Debug.logWarning("Could not find OrderHeader with orderId: " + orderId + "; not processing payments.", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } OrderReadHelper orh = new OrderReadHelper(orderHeader); // check valid implemented types if (!transactionType.equals(CREDIT_SERVICE_TYPE)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionNotYetSupported", locale)); } // transaction request context @@ -3135,7 +3135,7 @@ public class PaymentGatewayServices { // get the transaction settings GenericValue paymentSettings = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, paymentMethodTypeId, transactionType, false); if (paymentSettings == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentSettingNotFound", UtilMisc.toMap("productStoreId", productStoreId, "transactionType", transactionType), locale)); } else { @@ -3156,7 +3156,7 @@ public class PaymentGatewayServices { } // check the service name if (paymentService == null || paymentGatewayConfigId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentSettingNotValid", locale)); } @@ -3164,7 +3164,7 @@ public class PaymentGatewayServices { GenericValue creditCard = delegator.makeValue("CreditCard"); creditCard.setAllFields(context, true, null, null); if (creditCard.get("firstNameOnCard") == null || creditCard.get("lastNameOnCard") == null || creditCard.get("cardType") == null || creditCard.get("cardNumber") == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreditCardMissingMandatoryFields", locale)); } String expMonth = (String) context.get("expMonth"); @@ -3176,14 +3176,14 @@ public class PaymentGatewayServices { GenericValue billingAddress = delegator.makeValue("PostalAddress"); billingAddress.setAllFields(context, true, null, null); if (billingAddress.get("address1") == null || billingAddress.get("city") == null || billingAddress.get("postalCode") == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreditCardBillingAddressMssingMandatoryFields", locale)); } requestContext.put("billingAddress", billingAddress); GenericValue billToEmail = delegator.makeValue("ContactMech"); billToEmail.set("infoString", context.get("infoString")); if (billToEmail.get("infoString") == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreditCardEmailAddressCannotBeEmpty", locale)); } requestContext.put("billToParty", orh.getBillToParty()); @@ -3193,7 +3193,7 @@ public class PaymentGatewayServices { requestContext.put("currency", currency); requestContext.put("creditAmount", context.get("amount")); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionNotYetSupported", locale) + " " + paymentMethodTypeId); } // process the transaction @@ -3205,7 +3205,7 @@ public class PaymentGatewayServices { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentServiceError", UtilMisc.toMap("paymentService", paymentService, "authContext", requestContext), locale)); @@ -3221,7 +3221,7 @@ public class PaymentGatewayServices { responseRes = dispatcher.runSync(model.name, resCtx); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCreditError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -3240,7 +3240,7 @@ public class PaymentGatewayServices { String refNum = (String) response.get("creditRefNum"); String code = (String) response.get("creditCode"); String msg = (String) response.get("creditMessage"); - Map<String, Object> returnResults = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + Map<String, Object> returnResults = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionManualResult", UtilMisc.toMap("msg", msg, "code", code, "refNum", refNum), locale)); returnResults.put("referenceNum", refNum); @@ -3296,7 +3296,7 @@ public class PaymentGatewayServices { } if (ServiceUtil.isError(results)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingCreditCardManualAuthFailedError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardManualAuthFailedError", locale)); } } } @@ -3323,7 +3323,7 @@ public class PaymentGatewayServices { if (processAmount != null && processAmount.compareTo(new BigDecimal("100.00")) < 0) { result.put("authResult", Boolean.FALSE); } - result.put("customerRespMsgs", UtilMisc.toList(UtilProperties.getMessage(resource, + result.put("customerRespMsgs", UtilMisc.toList(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessorMinimumPurchase", locale))); if (processAmount == null) { result.put("authResult", null); @@ -3335,8 +3335,8 @@ public class PaymentGatewayServices { result.put("authRefNum", refNum); result.put("authAltRefNum", refNum); result.put("authFlag", "X"); - result.put("authMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestProcessor", locale)); - result.put("internalRespMsgs", UtilMisc.toList(UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessor", locale)); + result.put("internalRespMsgs", UtilMisc.toList(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessor", locale))); return result; } @@ -3358,7 +3358,7 @@ public class PaymentGatewayServices { result.put("authResult", Boolean.FALSE); } result.put("captureResult", Boolean.FALSE); - result.put("customerRespMsgs", UtilMisc.toList(UtilProperties.getMessage(resource, + result.put("customerRespMsgs", UtilMisc.toList(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessorMinimumPurchase", locale))); if (processAmount == null) { result.put("authResult", null); @@ -3374,9 +3374,9 @@ public class PaymentGatewayServices { result.put("authCode", "100"); result.put("captureCode", "200"); result.put("authFlag", "X"); - result.put("authMessage", UtilMisc.toList(UtilProperties.getMessage(resource, + result.put("authMessage", UtilMisc.toList(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCapture", locale))); - result.put("internalRespMsgs", UtilMisc.toList(UtilProperties.getMessage(resource, + result.put("internalRespMsgs", UtilMisc.toList(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCapture", locale))); return result; } @@ -3402,7 +3402,7 @@ public class PaymentGatewayServices { result.put("authRefNum", refNum); result.put("authAltRefNum", refNum); result.put("authCode", "100"); - result.put("authMessage", UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCapture", locale)); return result; @@ -3424,7 +3424,7 @@ public class PaymentGatewayServices { result.put("authAltRefNum", refNum); result.put("authCode", "100"); result.put("authFlag", "A"); - result.put("authMessage", UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessor", locale)); return result; } @@ -3445,7 +3445,7 @@ public class PaymentGatewayServices { result.put("authCode", "100"); result.put("captureCode", "200"); result.put("authFlag", "A"); - result.put("authMessage", UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCapture", locale)); return result; } @@ -3467,7 +3467,7 @@ public class PaymentGatewayServices { result.put("authRefNum", refNum); result.put("authAltRefNum", refNum); result.put("authFlag", "D"); - result.put("authMessage", UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessorDeclined", locale)); return result; } @@ -3489,7 +3489,7 @@ public class PaymentGatewayServices { result.put("authRefNum", refNum); result.put("authAltRefNum", refNum); result.put("authFlag", "N"); - result.put("authMessage", UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessor", locale)); return result; } @@ -3511,7 +3511,7 @@ public class PaymentGatewayServices { result.put("authRefNum", refNum); result.put("authAltRefNum", refNum); result.put("authFlag", "E"); - result.put("authMessage", UtilProperties.getMessage(resource, + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestProcessor", locale)); return result; } @@ -3549,7 +3549,7 @@ public class PaymentGatewayServices { result.put("authRefNum", refNum); result.put("authAltRefNum", refNum); result.put("authFlag", "N"); - result.put("authMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestBadCardNumber", locale)); + result.put("authMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestBadCardNumber", locale)); return result; } @@ -3558,7 +3558,7 @@ public class PaymentGatewayServices { */ public static Map<String, Object> alwaysFailProcessor(DispatchContext dctx, Map<String, ? extends Object> context) { Locale locale = (Locale) context.get("locale"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestAuthorizationAlwaysFailed", locale)); } @@ -3573,7 +3573,7 @@ public class PaymentGatewayServices { result.put("releaseRefNum", refNum); result.put("releaseAltRefNum", refNum); result.put("releaseFlag", "U"); - result.put("releaseMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestRelease", locale)); + result.put("releaseMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestRelease", locale)); return result; } @@ -3592,7 +3592,7 @@ public class PaymentGatewayServices { result.put("captureRefNum", refNum); result.put("captureAltRefNum", refNum); result.put("captureFlag", "C"); - result.put("captureMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestCapture", locale)); + result.put("captureMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCapture", locale)); return result; } @@ -3612,7 +3612,7 @@ public class PaymentGatewayServices { result.put("captureRefNum", refNum); result.put("captureAltRefNum", refNum); result.put("captureFlag", "D"); - result.put("captureMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestCaptureDeclined", locale)); + result.put("captureMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCaptureDeclined", locale)); return result; } @@ -3627,7 +3627,7 @@ public class PaymentGatewayServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentCannotBeCaptured", locale)); } Timestamp txStamp = authTransaction.getTimestamp("transactionDate"); @@ -3650,7 +3650,7 @@ public class PaymentGatewayServices { } else { result.put("captureResult", Boolean.TRUE); result.put("captureFlag", "C"); - result.put("captureMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestCaptureWithReauth", locale)); + result.put("captureMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestCaptureWithReauth", locale)); } return result; @@ -3668,7 +3668,7 @@ public class PaymentGatewayServices { result.put("refundAmount", context.get("refundAmount")); result.put("refundRefNum", UtilDateTime.nowAsString()); result.put("refundFlag", "R"); - result.put("refundMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestRefund", locale)); + result.put("refundMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestRefund", locale)); return result; } @@ -3682,7 +3682,7 @@ public class PaymentGatewayServices { result.put("refundAmount", context.get("refundAmount")); result.put("refundRefNum", UtilDateTime.nowAsString()); result.put("refundFlag", "R"); - result.put("refundMessage", UtilProperties.getMessage(resource, "AccountingPaymentTestRefundFailure", locale)); + result.put("refundMessage", UtilProperties.getMessage(RESOURCE, "AccountingPaymentTestRefundFailure", locale)); return result; } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java index f4e7d2e..49fa5b2 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java @@ -49,8 +49,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class PaymentMethodServices { public final static String MODULE = PaymentMethodServices.class.getName(); - public final static String resource = "AccountingUiLabels"; - public static final String resourceError = "AccountingUiLabels"; + public final static String RESOURCE = "AccountingUiLabels"; + private static final String RES_ERROR = "AccountingUiLabels"; /** * Deletes a PaymentMethod entity according to the parameters passed in the context @@ -76,13 +76,13 @@ public class PaymentMethodServices { paymentMethod = EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentMethodCannotBeDeleted", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (paymentMethod == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentMethodCannotBeDeleted", UtilMisc.toMap("errorString", ""), locale)); } @@ -90,7 +90,7 @@ public class PaymentMethodServices { // <b>security check</b>: userLogin partyId must equal paymentMethod partyId, or must have PAY_INFO_DELETE permission if (paymentMethod.get("partyId") == null || !paymentMethod.getString("partyId").equals(userLogin.getString("partyId"))) { if (!security.hasEntityPermission("PAY_INFO", "_DELETE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_DELETE", userLogin)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentMethodNoPermissionToDelete", locale)); } } @@ -100,7 +100,7 @@ public class PaymentMethodServices { paymentMethod.store(); } catch (GenericEntityException e) { Debug.logWarning(e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingPaymentMethodCannotBeDeletedWriteFailure", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -152,14 +152,14 @@ public class PaymentMethodServices { context.put("cardNumber", StringUtil.removeSpaces((String) context.get("cardNumber"))); if (!UtilValidate.isCardMatch((String) context.get("cardType"), (String) context.get("cardNumber"))) { messages.add( - UtilProperties.getMessage(resource, "AccountingCreditCardNumberInvalid", + UtilProperties.getMessage(RESOURCE, "AccountingCreditCardNumberInvalid", UtilMisc.toMap("cardType", (String) context.get("cardType"), "validCardType", UtilValidate.getCardType((String) context.get("cardNumber"))), locale)); } if (!UtilValidate.isDateAfterToday((String) context.get("expireDate"))) { messages.add( - UtilProperties.getMessage(resource, "AccountingCreditCardExpireDateBeforeToday", + UtilProperties.getMessage(RESOURCE, "AccountingCreditCardExpireDateBeforeToday", UtilMisc.toMap("expireDate", (String) context.get("expireDate")), locale)); } @@ -180,7 +180,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardCreateIdGenerationFailure", locale)); } } @@ -239,7 +239,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardCreateWriteFailure", locale) + e.getMessage()); } @@ -284,16 +284,16 @@ public class PaymentMethodServices { paymentMethod = EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardUpdateReadFailure", locale) + e.getMessage()); } if (creditCard == null || paymentMethod == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardUpdateWithPaymentMethodId", locale) + paymentMethodId); } if (!paymentMethod.getString("partyId").equals(partyId) && !security.hasEntityPermission("PAY_INFO", "_UPDATE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_UPDATE", userLogin)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardUpdateWithoutPermission", UtilMisc.toMap("partyId", partyId, "paymentMethodId", paymentMethodId), locale)); } @@ -324,14 +324,14 @@ public class PaymentMethodServices { if (!UtilValidate.isCardMatch((String) context.get("cardType"), (String) context.get("cardNumber"))) { messages.add( - UtilProperties.getMessage(resource, "AccountingCreditCardNumberInvalid", + UtilProperties.getMessage(RESOURCE, "AccountingCreditCardNumberInvalid", UtilMisc.toMap("cardType", (String) context.get("cardType"), "validCardType", UtilValidate.getCardType((String) context.get("cardNumber"))), locale)); } if (!UtilValidate.isDateAfterToday((String) context.get("expireDate"))) { messages.add( - UtilProperties.getMessage(resource, "AccountingCreditCardExpireDateBeforeToday", + UtilProperties.getMessage(RESOURCE, "AccountingCreditCardExpireDateBeforeToday", UtilMisc.toMap("expireDate", (String) context.get("expireDate")), locale)); } @@ -348,7 +348,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardUpdateIdGenerationFailure", locale)); } @@ -425,7 +425,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCreditCardUpdateWriteFailure", locale) + e.getMessage()); } } else { @@ -433,7 +433,7 @@ public class PaymentMethodServices { result.put("oldPaymentMethodId", paymentMethodId); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); if (contactMechId == null || !"_NEW_".equals(contactMechId)) { - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingNoChangesMadeNotUpdatingCreditCard", locale)); } @@ -515,7 +515,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCardCannotBeCreated", locale)); } } @@ -537,7 +537,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCardCannotBeCreatedWriteFailure", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -576,18 +576,18 @@ public class PaymentMethodServices { paymentMethod = EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCardCannotBeUpdated", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (giftCard == null || paymentMethod == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCardCannotBeUpdated", UtilMisc.toMap("errorString", paymentMethodId), locale)); } if (!paymentMethod.getString("partyId").equals(partyId) && !security.hasEntityPermission("PAY_INFO", "_UPDATE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_UPDATE", userLogin)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCardPartyNotAuthorized", UtilMisc.toMap("partyId", partyId, "paymentMethodId", paymentMethodId), locale)); } @@ -625,7 +625,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCardCannotBeCreated", locale)); } @@ -655,7 +655,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeUpdated", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -663,7 +663,7 @@ public class PaymentMethodServices { result.put("paymentMethodId", paymentMethodId); result.put("oldPaymentMethodId", paymentMethodId); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingNoChangesMadeNotUpdatingEftAccount", locale)); return result; @@ -710,7 +710,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeCreated", locale)); } } @@ -767,7 +767,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeCreatedWriteFailure", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -814,18 +814,18 @@ public class PaymentMethodServices { EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeUpdatedReadFailure", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (eftAccount == null || paymentMethod == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeUpdated", UtilMisc.toMap("errorString", paymentMethodId), locale)); } if (!paymentMethod.getString("partyId").equals(partyId) && !security.hasEntityPermission("PAY_INFO", "_UPDATE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_UPDATE", userLogin)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeUpdated", UtilMisc.toMap("partyId", partyId, "paymentMethodId", paymentMethodId), locale)); } @@ -839,7 +839,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeCreated", locale)); } @@ -903,7 +903,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingEftAccountCannotBeUpdated", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -911,7 +911,7 @@ public class PaymentMethodServices { result.put("paymentMethodId", paymentMethodId); result.put("oldPaymentMethodId", paymentMethodId); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingNoChangesMadeNotUpdatingEftAccount", locale)); return result; @@ -947,7 +947,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "AccountingCheckNotAdded", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckNotAdded", locale)); } } @@ -1002,7 +1002,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "AccountingCheckNotAdded", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckNotAdded", UtilMisc.toMap("errorString", e.getMessage()), locale)); } result.put("paymentMethodId", newPm.getString("paymentMethodId")); @@ -1040,18 +1040,18 @@ public class PaymentMethodServices { EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckAccountCannotBeUpdated", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (checkAccount == null || paymentMethod == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckAccountCannotBeUpdated", UtilMisc.toMap("errorString", paymentMethodId), locale)); } if (!paymentMethod.getString("partyId").equals(partyId) && !security.hasEntityPermission("PAY_INFO", "_UPDATE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_UPDATE", userLogin)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckAccountCannotBeUpdated", UtilMisc.toMap("partyId", partyId, "paymentMethodId", paymentMethodId), locale)); } @@ -1065,7 +1065,7 @@ public class PaymentMethodServices { try { newPmId = delegator.getNextSeqId("PaymentMethod"); } catch (IllegalArgumentException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckAccountCannotBeUpdated", locale)); } @@ -1129,7 +1129,7 @@ public class PaymentMethodServices { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingCheckAccountCannotBeUpdated", UtilMisc.toMap("errorString", e.getMessage()), locale)); } @@ -1138,7 +1138,7 @@ public class PaymentMethodServices { result.put("oldPaymentMethodId", paymentMethodId); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); result.put(ModelService.SUCCESS_MESSAGE, - UtilProperties.getMessage(resource, "AccountingCheckAccountCannotBeUpdated", locale)); + UtilProperties.getMessage(RESOURCE, "AccountingCheckAccountCannotBeUpdated", locale)); return result; } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java index 5f14d24..f5657ad 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentWorker.java @@ -48,7 +48,7 @@ import org.apache.ofbiz.entity.util.EntityUtil; */ public final class PaymentWorker { - public static final String MODULE = PaymentWorker.class.getName(); + private static final String MODULE = PaymentWorker.class.getName(); private static final int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static final RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java index 52daca6..62b8b98 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java @@ -39,8 +39,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class PeriodServices { - public static final String MODULE = PeriodServices.class.getName(); - public static final String resource = "AccountingUiLabels"; + private static final String MODULE = PeriodServices.class.getName(); + private static final String RESOURCE = "AccountingUiLabels"; /* * find the date of the last closed CustomTimePeriod, or, if none available, the @@ -91,7 +91,7 @@ public class PeriodServices { if (timePeriod != null && UtilValidate.isNotEmpty(timePeriod.get("fromDate"))) { lastClosedDate = timePeriod.getTimestamp("fromDate"); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPeriodCannotGet", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPeriodCannotGet", locale)); } } 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 0228789..d0ee210 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 @@ -54,14 +54,14 @@ import org.apache.ofbiz.service.ServiceUtil; public class TaxAuthorityServices { - public static final String MODULE = TaxAuthorityServices.class.getName(); + private static final String MODULE = TaxAuthorityServices.class.getName(); public static final BigDecimal ZERO_BASE = BigDecimal.ZERO; public static final BigDecimal ONE_BASE = BigDecimal.ONE; public static final BigDecimal PERCENT_SCALE = new BigDecimal("100.000"); public static final int salestaxFinalDecimals = UtilNumber.getBigDecimalScale("salestax.final.decimals"); public static final int salestaxCalcDecimals = UtilNumber.getBigDecimalScale("salestax.calc.decimals"); public static final RoundingMode salestaxRounding = UtilNumber.getRoundingMode("salestax.rounding"); - public static final String resource = "AccountingUiLabels"; + private static final String RESOURCE = "AccountingUiLabels"; public static Map<String, Object> rateProductTaxCalcForDisplay(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); @@ -148,7 +148,7 @@ public class TaxAuthorityServices { } } catch (GenericEntityException e) { Debug.logError(e, "Data error getting tax settings: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingTaxSettingError", UtilMisc + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTaxSettingError", UtilMisc .toMap("errorString", e.toString()), locale)); } @@ -192,7 +192,7 @@ public class TaxAuthorityServices { } } catch (GenericEntityException e) { Debug.logError(e, "Data error getting tax settings: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingTaxSettingError", UtilMisc + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTaxSettingError", UtilMisc .toMap("errorString", e.toString()), locale)); } @@ -212,15 +212,15 @@ public class TaxAuthorityServices { } } catch (GenericEntityException e) { Debug.logError(e, "Data error getting tax settings: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingTaxSettingError", UtilMisc + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTaxSettingError", UtilMisc .toMap("errorString", e.toString()), locale)); } } if (shippingAddress == null || (shippingAddress.get("countryGeoId") == null && shippingAddress.get( "stateProvinceGeoId") == null && shippingAddress.get("postalCodeGeoId") == null)) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTaxNoAddressSpecified", locale); + String errMsg = UtilProperties.getMessage(RESOURCE, "AccountingTaxNoAddressSpecified", locale); if (shippingAddress != null) { - errMsg += UtilProperties.getMessage(resource, "AccountingTaxNoAddressSpecifiedDetails", UtilMisc.toMap( + errMsg += UtilProperties.getMessage(RESOURCE, "AccountingTaxNoAddressSpecifiedDetails", UtilMisc.toMap( "contactMechId", shippingAddress.getString("contactMechId"), "address1", shippingAddress.get( "address1"), "postalCodeGeoId", shippingAddress.get("postalCodeGeoId"), "stateProvinceGeoId", shippingAddress.get("stateProvinceGeoId"), "countryGeoId", shippingAddress @@ -237,7 +237,7 @@ public class TaxAuthorityServices { getTaxAuthorities(delegator, shippingAddress, taxAuthoritySet); } catch (GenericEntityException e) { Debug.logError(e, "Data error getting tax settings: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingTaxSettingError", UtilMisc + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingTaxSettingError", UtilMisc .toMap("errorString", e.toString()), locale)); } 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 e0b125f..95ef05a 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 @@ -49,8 +49,8 @@ import com.ibm.icu.util.Calendar; public class AIMPaymentServices { - public static final String MODULE = AIMPaymentServices.class.getName(); - public final static String resource = "AccountingUiLabels"; + private static final String MODULE = AIMPaymentServices.class.getName(); + public final static String RESOURCE = "AccountingUiLabels"; // The list of refund failure response codes that would cause the ccRefund service // to attempt to void the refund's associated authorization transaction. This list @@ -93,7 +93,7 @@ public class AIMPaymentServices { Map<String, Object> validateResults = validateRequest(context, props, request); String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { - results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingValidationFailedInvalidValues", locale)); + results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; } Map<String, Object> reply = processCard(request, props, locale); @@ -111,12 +111,12 @@ public class AIMPaymentServices { creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } context.put("creditCard", creditCard); @@ -137,7 +137,7 @@ public class AIMPaymentServices { Map<String, Object> validateResults = validateRequest(context, props, request); String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { - results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingValidationFailedInvalidValues", locale)); + results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; } Map<String, Object> reply = processCard(request, props, locale); @@ -158,12 +158,12 @@ public class AIMPaymentServices { creditCard = delegator.getRelatedOne("CreditCard", orderPaymentPreference, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } context.put("creditCard",creditCard); @@ -182,7 +182,7 @@ public class AIMPaymentServices { Map<String, Object> validateResults = validateRequest(context, props, request); String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { - results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingValidationFailedInvalidValues", locale)); + results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; } Map<String, Object> reply = processCard(request, props, locale); @@ -228,7 +228,7 @@ public class AIMPaymentServices { } else { // 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, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingAuthorizeNetCannotPerformVoidTransaction", UtilMisc.toMap("authAmount", authAmount, "refundAmount", refundAmount), locale)); } @@ -243,7 +243,7 @@ public class AIMPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } Map<String, Object> reply = voidTransaction(authTransaction, context, delegator); @@ -270,7 +270,7 @@ public class AIMPaymentServices { Map<String, Object> validateResults = validateRequest(context, props, request); String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { - results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingValidationFailedInvalidValues", locale)); + results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; } return processCard(request, props, locale); @@ -280,7 +280,7 @@ public class AIMPaymentServices { Locale locale = (Locale) context.get("locale"); Map<String, Object> results = new HashMap<>(); results.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); - results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingAuthorizeNetccCreditUnsupported", locale)); + results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingAuthorizeNetccCreditUnsupported", locale)); return results; } @@ -300,7 +300,7 @@ public class AIMPaymentServices { Map<String, Object> validateResults = validateRequest(context, props, request); String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { - results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingValidationFailedInvalidValues", locale)); + results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; } Map<String, Object> reply = processCard(request, props, locale); @@ -317,7 +317,7 @@ public class AIMPaymentServices { Map<String, Object> result = new HashMap<>(); String url = props.getProperty("url"); if (UtilValidate.isEmpty(url)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingAuthorizeNetTransactionUrlNotFound", locale)); } if (isTestMode()) { @@ -793,7 +793,7 @@ public class AIMPaymentServices { } 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 { @@ -808,7 +808,7 @@ public class AIMPaymentServices { 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/clearcommerce/CCPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java index 16ca7d4..e373dbf 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java @@ -56,7 +56,7 @@ public class CCPaymentServices { public final static String MODULE = CCPaymentServices.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); - public final static String resource = "AccountingUiLabels"; + public final static String RESOURCE = "AccountingUiLabels"; private final static int maxSevComp = 4; public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, Object> context) { @@ -127,7 +127,7 @@ public class CCPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } @@ -162,7 +162,7 @@ public class CCPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } @@ -196,7 +196,7 @@ public class CCPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } @@ -217,7 +217,7 @@ public class CCPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } @@ -254,7 +254,7 @@ public class CCPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotReauth", locale)); } @@ -296,7 +296,7 @@ public class CCPaymentServices { // orderId String orderId = (String) context.get("orderId"); if (UtilValidate.isEmpty(orderId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingClearCommerceCannotExecuteReport", locale)); } 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 1ee9ee9..0388ed8 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 @@ -33,7 +33,7 @@ import junit.framework.TestCase; public class CCServicesTest extends OFBizTestCase { - public static final String MODULE = CCServicesTest.class.getName(); + private static final String MODULE = CCServicesTest.class.getName(); // test data protected GenericValue emailAddr = null; 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 2402eed..51700f9 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 @@ -51,10 +51,10 @@ import com.cybersource.ws.client.FaultException; */ public class IcsPaymentServices { - public static final String MODULE = IcsPaymentServices.class.getName(); + private static final String MODULE = IcsPaymentServices.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); - public final static String resource = "AccountingUiLabels"; + public final static String RESOURCE = "AccountingUiLabels"; // load the JSSE properties static { @@ -67,7 +67,7 @@ public class IcsPaymentServices { // generate the request/properties Properties props = buildCsProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorGettingPaymentGatewayConfig", locale)); } @@ -81,11 +81,11 @@ public class IcsPaymentServices { } catch (FaultException e) { Debug.logError(e, "ERROR: Fault from CyberSource", MODULE); Debug.logError(e, "Fault : " + e.getFaultString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } catch (ClientException e) { Debug.logError(e, "ERROR: CyberSource Client exception : " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } // process the reply @@ -108,13 +108,13 @@ public class IcsPaymentServices { authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } // generate the request/properties Properties props = buildCsProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorGettingPaymentGatewayConfig", locale)); } @@ -127,11 +127,11 @@ public class IcsPaymentServices { reply = UtilGenerics.cast(Client.runTransaction(request, props)); } catch (FaultException e) { Debug.logError(e, "ERROR: Fault from CyberSource", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } catch (ClientException e) { Debug.logError(e, "ERROR: CyberSource Client exception : " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } // process the reply @@ -146,14 +146,14 @@ public class IcsPaymentServices { Locale locale = (Locale) context.get("locale"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } // generate the request/properties Properties props = buildCsProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorGettingPaymentGatewayConfig", locale)); } @@ -166,11 +166,11 @@ public class IcsPaymentServices { reply = UtilGenerics.cast(Client.runTransaction(request, props)); } catch (FaultException e) { Debug.logError(e, "ERROR: Fault from CyberSource", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } catch (ClientException e) { Debug.logError(e, "ERROR: CyberSource Client exception : " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } // process the reply @@ -185,14 +185,14 @@ public class IcsPaymentServices { Locale locale = (Locale) context.get("locale"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } // generate the request/properties Properties props = buildCsProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorGettingPaymentGatewayConfig", locale)); } @@ -205,11 +205,11 @@ public class IcsPaymentServices { reply = UtilGenerics.cast(Client.runTransaction(request, props)); } catch (FaultException e) { Debug.logError(e, "ERROR: Fault from CyberSource", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } catch (ClientException e) { Debug.logError(e, "ERROR: CyberSource Client exception : " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } @@ -225,7 +225,7 @@ public class IcsPaymentServices { // generate the request/properties Properties props = buildCsProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorGettingPaymentGatewayConfig", locale)); } @@ -238,11 +238,11 @@ public class IcsPaymentServices { reply = UtilGenerics.cast(Client.runTransaction(request, props)); } catch (FaultException e) { Debug.logError(e, "ERROR: Fault from CyberSource", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } catch (ClientException e) { Debug.logError(e, "ERROR: CyberSource Client exception : " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingCyberSourceErrorCommunicateWithCyberSource", locale)); } @@ -667,7 +667,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 { @@ -682,7 +682,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(); } @@ -691,8 +691,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 6123415..c355694 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 @@ -37,8 +37,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class EwayServices { - public static final String MODULE = EwayServices.class.getName(); - public final static String resource = "AccountingUiLabels"; + private static final String MODULE = EwayServices.class.getName(); + public final static String RESOURCE = "AccountingUiLabels"; // eway charge (auth w/ capture) public static Map<String, Object> ewayCharge(DispatchContext dctx, Map<String, Object> context) { @@ -121,7 +121,7 @@ public class EwayServices { // original charge transaction GenericValue chargeTrans = PaymentGatewayServices.getCaptureTransaction(paymentPref); if (chargeTrans == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } @@ -131,7 +131,7 @@ public class EwayServices { cc = delegator.getRelatedOne("CreditCard", paymentPref, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } @@ -186,7 +186,7 @@ public class EwayServices { } if (chargeTrans == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } @@ -196,7 +196,7 @@ public class EwayServices { cc = delegator.getRelatedOne("CreditCard", paymentPref, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } @@ -265,7 +265,7 @@ public class EwayServices { } 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 { @@ -281,7 +281,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/gosoftware/PcChargeApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java index b27aa80..e615ab5 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java @@ -35,7 +35,7 @@ import org.xml.sax.SAXException; public class PcChargeApi { - public static final String MODULE = PcChargeApi.class.getName(); + private static final String MODULE = PcChargeApi.class.getName(); public static final String xschema = "x-schema:..\\dtd\\stnd.xdr"; public static final String rootElement = "XML_FILE"; public static final String reqElement = "XML_REQUEST"; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java index b1642dd..bb60f69 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java @@ -42,10 +42,10 @@ import org.apache.ofbiz.service.ServiceUtil; public class PcChargeServices { - public static final String MODULE = PcChargeServices.class.getName(); + private static final String MODULE = PcChargeServices.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); - public final static String resource = "AccountingUiLabels"; + public final static String RESOURCE = "AccountingUiLabels"; public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, ? extends Object> context) { Locale locale = (Locale) context.get("locale"); @@ -54,7 +54,7 @@ public class PcChargeServices { Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPcChargeErrorGettingPaymentGatewayConfig", locale)); } @@ -142,7 +142,7 @@ public class PcChargeServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } @@ -150,7 +150,7 @@ public class PcChargeServices { Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPcChargeErrorGettingPaymentGatewayConfig", locale)); } @@ -194,7 +194,7 @@ public class PcChargeServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } @@ -202,7 +202,7 @@ public class PcChargeServices { Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPcChargeErrorGettingPaymentGatewayConfig", locale)); } @@ -211,7 +211,7 @@ public class PcChargeServices { // check to make sure we are configured for SALE mode if (!"true".equalsIgnoreCase(props.getProperty("autoBill"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPcChargeCannotSupportReleasingPreAuth", locale)); } @@ -252,7 +252,7 @@ public class PcChargeServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } @@ -260,7 +260,7 @@ public class PcChargeServices { Properties props = buildPccProperties(context, delegator); PcChargeApi api = getApi(props); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPcChargeErrorGettingPaymentGatewayConfig", locale)); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java index ca6d0ef..fa1cd52 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java @@ -30,7 +30,7 @@ import org.apache.ofbiz.base.util.ObjectType; public class RitaApi { - public static final String MODULE = RitaApi.class.getName(); + private static final String MODULE = RitaApi.class.getName(); public static final String xschema = "x-schema:..\\dtd\\stnd.xdr"; public static final String rootElement = "XML_FILE"; public static final String reqElement = "XML_REQUEST"; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java index 0b571bc..4451092 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java @@ -47,11 +47,11 @@ import org.apache.ofbiz.service.ServiceUtil; public class RitaServices { - public static final String MODULE = RitaServices.class.getName(); + private static final String MODULE = RitaServices.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); - public final static String resource = "AccountingUiLabels"; - public static final String resourceOrder = "OrderUiLabels"; + public final static String RESOURCE = "AccountingUiLabels"; + private static final String RES_ORDER = "OrderUiLabels"; public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, ? extends Object> context) { Locale locale = (Locale) context.get("locale"); @@ -59,7 +59,7 @@ public class RitaServices { Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingRitaErrorGettingPaymentGatewayConfig", locale)); } @@ -145,7 +145,7 @@ public class RitaServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } @@ -153,7 +153,7 @@ public class RitaServices { Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingRitaErrorGettingPaymentGatewayConfig", locale)); } @@ -206,7 +206,7 @@ public class RitaServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } @@ -214,7 +214,7 @@ public class RitaServices { Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingRitaErrorGettingPaymentGatewayConfig", locale)); } @@ -224,7 +224,7 @@ public class RitaServices { // check to make sure we are configured for SALE mode if (!"1".equals(props.getProperty("autoBill"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingRitaCannotSupportReleasingPreAuth", locale)); } @@ -268,7 +268,7 @@ public class RitaServices { } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } @@ -276,7 +276,7 @@ public class RitaServices { Properties props = buildPccProperties(context, delegator); RitaApi api = getApi(props, "CREDIT"); if (api == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingRitaErrorGettingPaymentGatewayConfig", locale)); } @@ -326,7 +326,7 @@ public class RitaServices { orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderPaymentPreference.getString("orderId")), locale)); } @@ -363,12 +363,12 @@ public class RitaServices { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingRitaErrorServiceException", locale)); } return refundResp; } - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderPaymentPreference.getString("orderId")), locale)); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java index b805555..1fa3f73 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java @@ -54,7 +54,7 @@ public class OrbitalPaymentServices { public static String MODULE = OrbitalPaymentServices.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static RoundingMode rounding = UtilNumber.getRoundingMode("invoice.rounding"); - public final static String resource = "AccountingUiLabels"; + public final static String RESOURCE = "AccountingUiLabels"; public static String ERROR = "Error"; @@ -126,12 +126,12 @@ public class OrbitalPaymentServices { creditCard = orderPaymentPreference.getRelatedOne("CreditCard", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } context.put("creditCard", creditCard); @@ -171,12 +171,12 @@ public class OrbitalPaymentServices { creditCard = orderPaymentPreference.getRelatedOne("CreditCard", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } context.put("creditCard", creditCard); @@ -215,12 +215,12 @@ public class OrbitalPaymentServices { orderPaymentPreference.getRelatedOne("CreditCard", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } context.put("authTransaction", authTransaction); 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 cd91b1b..27ae059 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 @@ -61,10 +61,10 @@ import org.apache.ofbiz.service.ServiceUtil; public class PayPalEvents { - public static final String resource = "AccountingUiLabels"; - public static final String resourceErr = "AccountingErrorUiLabels"; + private static final String RESOURCE = "AccountingUiLabels"; + private static final String RES_ERROR = "AccountingErrorUiLabels"; public static final String commonResource = "CommonUiLabels"; - public static final String MODULE = PayPalEvents.class.getName(); + private static final String MODULE = PayPalEvents.class.getName(); /** Initiate PayPal Request */ public static String callPayPal(HttpServletRequest request, HttpServletResponse response) { @@ -81,7 +81,7 @@ public class PayPalEvents { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get the order header for order: " + orderId, MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingOrderHeader", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingOrderHeader", locale)); return "error"; } @@ -94,7 +94,7 @@ public class PayPalEvents { if (productStore == null) { Debug.logError("ProductStore is null", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } @@ -115,7 +115,7 @@ public class PayPalEvents { String company = UtilFormatOut.checkEmpty(productStore.getString("companyName"), ""); // create the item name - String itemName = UtilProperties.getMessage(resource, "AccountingOrderNr", locale) + orderId + " " + + String itemName = UtilProperties.getMessage(RESOURCE, "AccountingOrderNr", locale) + orderId + " " + (company != null ? UtilProperties.getMessage(commonResource, "CommonFrom", locale) + " "+ company : ""); String itemNumber = "0"; @@ -143,7 +143,7 @@ public class PayPalEvents { || UtilValidate.isEmpty(imageUrl) || UtilValidate.isEmpty(payPalAccount)) { Debug.logError("Payment properties is not configured properly, some notify URL from PayPal is not correctly defined!", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } @@ -175,7 +175,7 @@ public class PayPalEvents { response.sendRedirect(redirectString); } catch (IOException e) { Debug.logError(e, "Problems redirecting to PayPal", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsConnectingWithPayPal", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsConnectingWithPayPal", locale)); return "error"; } @@ -193,7 +193,7 @@ public class PayPalEvents { GenericValue productStore = ProductStoreWorker.getProductStore(request); if (productStore == null) { Debug.logError("ProductStore is null", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } @@ -219,7 +219,7 @@ public class PayPalEvents { if (UtilValidate.isEmpty(confirmUrl) || UtilValidate.isEmpty(redirectUrl)) { Debug.logError("Payment properties is not configured properly, no confirm URL defined!", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } @@ -265,7 +265,7 @@ public class PayPalEvents { userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get UserLogin for: system; cannot continue", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingAuthenticationUser", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingAuthenticationUser", locale)); return "error"; } @@ -279,18 +279,18 @@ public class PayPalEvents { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get the order header for order: " + orderId, MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingOrderHeader", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingOrderHeader", locale)); return "error"; } } else { Debug.logError("PayPal did not callback with a valid orderId!", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.noValidOrderIdReturned", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.noValidOrderIdReturned", locale)); return "error"; } if (orderHeader == null) { Debug.logError("Cannot get the order header for order: " + orderId, MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingOrderHeader", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.problemsGettingOrderHeader", locale)); return "error"; } @@ -385,7 +385,7 @@ public class PayPalEvents { } } - request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.previousPayPalOrderHasBeenCancelled", locale)); + request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.previousPayPalOrderHasBeenCancelled", locale)); return "success"; } @@ -473,12 +473,12 @@ public class PayPalEvents { // create a payment record too Map <String, Object> results = null; try { - String comment = UtilProperties.getMessage(resource, "AccountingPaymentReceiveViaPayPal", locale); + String comment = UtilProperties.getMessage(RESOURCE, "AccountingPaymentReceiveViaPayPal", locale); results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, "orderPaymentPreferenceId", paymentPreference.get("orderPaymentPreferenceId"), "comments", comment)); } catch (GenericServiceException e) { Debug.logError(e, "Failed to execute service createPaymentFromPreference", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.failedToExecuteServiceCreatePaymentFromPreference", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "payPalEvents.failedToExecuteServiceCreatePaymentFromPreference", locale)); return false; } @@ -492,7 +492,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 { @@ -507,7 +507,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 dd8d3fe..51f3ac6 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 @@ -82,8 +82,8 @@ import com.paypal.sdk.services.NVPCallerServices; */ public class PayPalServices { - public static final String MODULE = PayPalServices.class.getName(); - public final static String resource = "AccountingErrorUiLabels"; + private static final String MODULE = PayPalServices.class.getName(); + public final static String RESOURCE = "AccountingErrorUiLabels"; // Used to maintain a weak reference to the ShoppingCart for customers who have gone to PayPal to checkout // so that we can quickly grab the cart, perform shipment estimates and send the info back to PayPal. @@ -96,13 +96,13 @@ public class PayPalServices { ShoppingCart cart = (ShoppingCart) context.get("cart"); Locale locale = cart.getLocale(); if (cart == null || cart.items().size() <= 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalShoppingCartIsEmpty", locale)); } GenericValue payPalConfig = getPaymentMethodGatewayPayPal(dctx, context, null); if (payPalConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalPaymentGatewayConfigCannotFind", locale)); } @@ -140,7 +140,7 @@ public class PayPalServices { addCartDetails(encoder, cart); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalErrorDuringRetrievingCartDetails", locale)); } @@ -353,7 +353,7 @@ public class PayPalServices { ShoppingCart cart = (ShoppingCart) context.get("cart"); GenericValue payPalConfig = getPaymentMethodGatewayPayPal(dctx, context, null); if (payPalConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalPaymentGatewayConfigCannotFind", locale)); } @@ -363,7 +363,7 @@ public class PayPalServices { if (UtilValidate.isNotEmpty(token)) { encoder.add("TOKEN", token); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalTokenNotFound", locale)); } @@ -710,7 +710,7 @@ public class PayPalServices { return ServiceUtil.returnError(e.getMessage()); } if (decoder == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalUnknownError", locale)); } @@ -776,7 +776,7 @@ public class PayPalServices { } if (decoder == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalUnknownError", locale)); } @@ -829,7 +829,7 @@ public class PayPalServices { } if (decoder == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalUnknownError", locale)); } @@ -860,7 +860,7 @@ public class PayPalServices { GenericValue payPalConfig = getPaymentMethodGatewayPayPal(dctx, context, null); Locale locale = (Locale) context.get("locale"); if (payPalConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalPaymentGatewayConfigCannotFind", locale)); } GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); @@ -877,7 +877,7 @@ public class PayPalServices { } if (decoder == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalUnknownError", locale)); } @@ -909,7 +909,7 @@ public class PayPalServices { Locale locale = (Locale) context.get("locale"); GenericValue payPalConfig = getPaymentMethodGatewayPayPal(dctx, context, null); if (payPalConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalPaymentGatewayConfigCannotFind", locale)); } GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); @@ -931,7 +931,7 @@ public class PayPalServices { } if (decoder == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayPalUnknownError", locale)); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java index 6aa1c48..5351583 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java @@ -44,8 +44,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class SagePayPaymentServices { - public static final String MODULE = SagePayPaymentServices.class.getName(); - public final static String resource = "AccountingUiLabels"; + private static final String MODULE = SagePayPaymentServices.class.getName(); + public final static String RESOURCE = "AccountingUiLabels"; private static Map<String, String> buildCustomerBillingInfo(Map<String, Object> context) { Debug.logInfo("SagePay - Entered buildCustomerBillingInfo", MODULE); @@ -160,7 +160,7 @@ public class SagePayPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); if (orderPaymentPreference == null) { - response = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayOrderPaymenPreferenceIsNull", UtilMisc.toMap("orderId", orderId, "orderPaymentPreference", null), locale)); + response = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayOrderPaymenPreferenceIsNull", UtilMisc.toMap("orderId", orderId, "orderPaymentPreference", null), locale)); } else { response = processCardAuthorisationPayment(dctx, context); } @@ -232,7 +232,7 @@ public class SagePayPaymentServices { } } catch(GenericServiceException e) { Debug.logError(e, "Error in calling SagePayPaymentAuthentication", MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayPaymentAuthorisationException", UtilMisc.toMap("errorString", e.getMessage()), locale)); + result = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentAuthorisationException", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; } @@ -287,7 +287,7 @@ public class SagePayPaymentServices { } } catch(GenericServiceException e) { Debug.logError(e, "Error in calling SagePayPaymentAuthorisation", MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayPaymentAuthorisationException", UtilMisc.toMap("errorString", e.getMessage()), locale)); + result = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentAuthorisationException", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; } @@ -299,7 +299,7 @@ public class SagePayPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue captureTransaction = PaymentGatewayServices.getCaptureTransaction(orderPaymentPreference); if (captureTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } Debug.logInfo("SagePay ccRefund captureTransaction : " + captureTransaction, MODULE); GenericValue creditCard = null; @@ -307,7 +307,7 @@ public class SagePayPaymentServices { creditCard = orderPaymentPreference.getRelatedOne("CreditCard", false); } catch (GenericEntityException e) { Debug.logError(e, "Error getting CreditCard for OrderPaymentPreference : " + orderPaymentPreference, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPaymentUnableToGetCCInfo", locale) + " " + orderPaymentPreference); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentUnableToGetCCInfo", locale) + " " + orderPaymentPreference); } context.put("creditCard",creditCard); context.put("captureTransaction", captureTransaction); @@ -397,7 +397,7 @@ public class SagePayPaymentServices { } catch(GenericServiceException e) { Debug.logError(e, "Error in calling SagePayPaymentRefund", MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayPaymentRefundException", UtilMisc.toMap("errorString", e.getMessage()), locale)); + result = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentRefundException", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; @@ -444,7 +444,7 @@ public class SagePayPaymentServices { } catch(GenericServiceException e) { Debug.logError(e, "Error in calling SagePayPaymentVoid", MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayPaymentVoidException", UtilMisc.toMap("errorString", e.getMessage()), locale)); + result = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentVoidException", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; } @@ -457,7 +457,7 @@ public class SagePayPaymentServices { GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } context.put("authTransaction", authTransaction); @@ -505,7 +505,7 @@ public class SagePayPaymentServices { } catch(GenericServiceException e) { Debug.logError(e, "Error in calling SagePayPaymentRelease", MODULE); - result = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayPaymentReleaseException", UtilMisc.toMap("errorString", e.getMessage()), locale)); + result = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentReleaseException", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java index 4f8fb5c..ba706d0 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java @@ -44,8 +44,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class SagePayServices { - public static final String MODULE = SagePayServices.class.getName(); - public static final String resource = "AccountingUiLabels"; + private static final String MODULE = SagePayServices.class.getName(); + private static final String RESOURCE = "AccountingUiLabels"; private static Map<String, String> buildSagePayProperties(Map<String, Object> context, Delegator delegator) { @@ -142,7 +142,7 @@ public class SagePayServices errorRequiredParameters.append("Required transaction parameter 'authenticationsTransType' is missing. "); } if(errorRequiredParameters.length() > 0){ - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayPaymentAuthorisationException", UtilMisc.toMap("errorString", errorRequiredParameters), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentAuthorisationException", UtilMisc.toMap("errorString", errorRequiredParameters), locale)); } parameters.put("VPSProtocol", vpsProtocol); @@ -281,15 +281,15 @@ public class SagePayServices } catch(UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost Debug.logError(uee, "Error occurred in encoding parameters for HttpPost (" + uee.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); } catch(ClientProtocolException cpe) { //from httpClient execute Debug.logError(cpe, "Error occurred in HttpClient execute(" + cpe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); } catch(IOException ioe) { //from httpClient execute or getResponsedata Debug.logError(ioe, "Error occurred in HttpClient execute or getting response (" + ioe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); } return resultMap; } @@ -345,25 +345,25 @@ public class SagePayServices //start - payment refunded if ("OK".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentReleased", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentReleased", locale); } //end - payment refunded //start - refund request not formed properly or parameters missing if ("MALFORMED".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentReleaseRequestMalformed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentReleaseRequestMalformed", locale); } //end - refund request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentInvalidInformationPassed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentInvalidInformationPassed", locale); } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentError", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentError", locale); } //end - problem at Sagepay @@ -373,15 +373,15 @@ public class SagePayServices } catch(UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost Debug.logError(uee, "Error occurred in encoding parameters for HttpPost (" + uee.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); } catch(ClientProtocolException cpe) { //from httpClient execute Debug.logError(cpe, "Error occurred in HttpClient execute(" + cpe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); } catch(IOException ioe) { //from httpClient execute or getResponsedata Debug.logError(ioe, "Error occurred in HttpClient execute or getting response (" + ioe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); } return resultMap; } @@ -434,25 +434,25 @@ public class SagePayServices //start - payment released if ("OK".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentReleased", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentReleased", locale); } //end - payment released //start - release request not formed properly or parameters missing if ("MALFORMED".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentReleaseRequestMalformed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentReleaseRequestMalformed", locale); } //end - release request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentInvalidInformationPassed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentInvalidInformationPassed", locale); } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentError", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentError", locale); } //end - problem at Sagepay @@ -462,15 +462,15 @@ public class SagePayServices } catch(UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost Debug.logError(uee, "Error occurred in encoding parameters for HttpPost (" + uee.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); } catch(ClientProtocolException cpe) { //from httpClient execute Debug.logError(cpe, "Error occurred in HttpClient execute(" + cpe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); } catch(IOException ioe) { //from httpClient execute or getResponsedata Debug.logError(ioe, "Error occurred in HttpClient execute or getting response (" + ioe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); } return resultMap; } @@ -521,25 +521,25 @@ public class SagePayServices //start - payment void if ("OK".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentVoided", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentVoided", locale); } //end - payment void //start - void request not formed properly or parameters missing if ("MALFORMED".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentVoidRequestMalformed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentVoidRequestMalformed", locale); } //end - void request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentInvalidInformationPassed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentInvalidInformationPassed", locale); } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentError", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentError", locale); } //end - problem at Sagepay @@ -549,15 +549,15 @@ public class SagePayServices } catch(UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost Debug.logError(uee, "Error occurred in encoding parameters for HttpPost (" + uee.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); } catch(ClientProtocolException cpe) { //from httpClient execute Debug.logError(cpe, "Error occurred in HttpClient execute(" + cpe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); } catch(IOException ioe) { //from httpClient execute or getResponsedata Debug.logError(ioe, "Error occurred in HttpClient execute or getting response (" + ioe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); } return resultMap; } @@ -622,31 +622,31 @@ public class SagePayServices if ("OK".equals(status)) { resultMap.put("vpsTxId", responseData.get("VPSTxId")); resultMap.put("txAuthNo", responseData.get("TxAuthNo")); - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentRefunded", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentRefunded", locale); } //end - payment refunded //start - refund not authorized by the acquiring bank if ("NOTAUTHED".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentRefundNotAuthorized", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentRefundNotAuthorized", locale); } //end - refund not authorized by the acquiring bank //start - refund request not formed properly or parameters missing if ("MALFORMED".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentRefundRequestMalformed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentRefundRequestMalformed", locale); } //end - refund request not formed properly or parameters missing //start - invalid information passed in parameters if ("INVALID".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentInvalidInformationPassed", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentInvalidInformationPassed", locale); } //end - invalid information passed in parameters //start - problem at Sagepay if ("ERROR".equals(status)) { - successMessage = UtilProperties.getMessage(resource, "AccountingSagePayPaymentError", locale); + successMessage = UtilProperties.getMessage(RESOURCE, "AccountingSagePayPaymentError", locale); } //end - problem at Sagepay @@ -656,15 +656,15 @@ public class SagePayServices } catch(UnsupportedEncodingException uee) { //exception in encoding parameters in httpPost Debug.logError(uee, "Error occurred in encoding parameters for HttpPost (" + uee.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorEncodingParameters", UtilMisc.toMap("errorString", uee.getMessage()), locale)); } catch(ClientProtocolException cpe) { //from httpClient execute Debug.logError(cpe, "Error occurred in HttpClient execute(" + cpe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecute", UtilMisc.toMap("errorString", cpe.getMessage()), locale)); } catch(IOException ioe) { //from httpClient execute or getResponsedata Debug.logError(ioe, "Error occurred in HttpClient execute or getting response (" + ioe.getMessage() + ")", MODULE); - resultMap = ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); + resultMap = ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSagePayErrorHttpClientExecuteOrGettingResponse", UtilMisc.toMap("errorString", ioe.getMessage()), locale)); } return resultMap; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java index 967efa4..bf2ea19 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java @@ -45,7 +45,7 @@ import org.apache.ofbiz.base.util.Debug; public final class SagePayUtil { - public static final String MODULE = SagePayUtil.class.getName(); + private static final String MODULE = SagePayUtil.class.getName(); private SagePayUtil() {} public static Map<String, Object> buildCardAuthorisationPaymentResponse 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 02a7a55..7c8b9e3 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 @@ -42,8 +42,8 @@ import securepay.jxa.api.Txn; public class SecurePayPaymentServices { - public static final String MODULE = SecurePayPaymentServices.class.getName(); - public final static String resource = "AccountingUiLabels"; + private static final String MODULE = SecurePayPaymentServices.class.getName(); + public final static String RESOURCE = "AccountingUiLabels"; public static Map<String, Object> doAuth(DispatchContext dctx, Map<String, Object> context) { Locale locale = (Locale) context.get("locale"); @@ -53,7 +53,7 @@ public class SecurePayPaymentServices { // generate the request/properties Properties props = buildScProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayNotProperlyConfigurated", locale)); } @@ -106,7 +106,7 @@ public class SecurePayPaymentServices { Map<String, Object> result = ServiceUtil.returnSuccess(); if (UtilValidate.isEmpty(processed)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayPaymentWasNotSent", locale)); } else { if (payment.getCount() == 1) { @@ -141,13 +141,13 @@ public class SecurePayPaymentServices { authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } Properties props = buildScProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayNotProperlyConfigurated", locale)); } @@ -188,7 +188,7 @@ public class SecurePayPaymentServices { Map<String, Object> result = ServiceUtil.returnSuccess(); if (UtilValidate.isEmpty(processed)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayPaymentWasNotSent", locale)); } else { if (payment.getCount() == 1){ @@ -220,13 +220,13 @@ public class SecurePayPaymentServices { authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); } if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } Properties props = buildScProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayNotProperlyConfigurated", locale)); } @@ -267,7 +267,7 @@ public class SecurePayPaymentServices { Map<String, Object> result = ServiceUtil.returnSuccess(); if (UtilValidate.isEmpty(processed)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayPaymentWasNotSent", locale)); } else { if (payment.getCount() == 1){ @@ -296,7 +296,7 @@ public class SecurePayPaymentServices { GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } @@ -313,7 +313,7 @@ public class SecurePayPaymentServices { Properties props = buildScProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayNotProperlyConfigurated", locale)); } @@ -354,7 +354,7 @@ public class SecurePayPaymentServices { Map<String, Object> result = ServiceUtil.returnSuccess(); if (UtilValidate.isEmpty(processed)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayPaymentWasNotSent", locale)); } else { if (payment.getCount() == 1){ @@ -383,7 +383,7 @@ public class SecurePayPaymentServices { // generate the request/properties Properties props = buildScProperties(context, delegator); if (props == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayNotProperlyConfigurated", locale)); } @@ -433,7 +433,7 @@ public class SecurePayPaymentServices { Map<String, Object> result = ServiceUtil.returnSuccess(); if (UtilValidate.isEmpty(processed)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingSecurityPayPaymentWasNotSent", locale)); } else { if (payment.getCount() == 1) { @@ -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 49b18ea..0877481 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 @@ -39,7 +39,7 @@ public class SecurePayServiceTest extends OFBizTestCase{ super(name); } - public static final String MODULE = SecurePayServiceTest.class.getName(); + private static final String MODULE = SecurePayServiceTest.class.getName(); // test data protected GenericValue emailAddr = null; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java index e61557a..c1e7adf 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java @@ -74,7 +74,7 @@ import org.apache.ofbiz.entity.util.EntityQuery; */ public class ValueLinkApi { - public static final String MODULE = ValueLinkApi.class.getName(); + private static final String MODULE = ValueLinkApi.class.getName(); // static object cache private static Map<String, Object> objectCache = new HashMap<>(); 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 2c02cee..e0f14a3 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 @@ -50,10 +50,10 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ValueLinkServices { - public static final String MODULE = ValueLinkServices.class.getName(); - public final static String resource = "AccountingUiLabels"; - public final static String resourceError = "AccountingErrorUiLabels"; - public final static String resourceOrder = "OrderUiLabels"; + private static final String MODULE = ValueLinkServices.class.getName(); + public final static String RESOURCE = "AccountingUiLabels"; + public final static String RES_ERROR = "AccountingErrorUiLabels"; + public final static String RES_ORDER = "OrderUiLabels"; // generate/display new public/private/kek keys public static Map<String, Object> createKeys(DispatchContext dctx, Map<String, Object> context) { @@ -162,7 +162,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkCannotUpdateWorkingKey", locale)); } Debug.logInfo("Response : " + response, MODULE); @@ -170,7 +170,7 @@ public class ValueLinkServices { // on success update the database / reload the cached api String responseCode = (String) response.get("responsecode"); if (!"00".equals(responseCode)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkTransactionFailed", UtilMisc.toMap("responseCode", responseCode), locale)); } @@ -184,7 +184,7 @@ public class ValueLinkServices { vlKeys.store(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to store updated keys; the keys were changed with ValueLink : " + vlKeys, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkCannotStoreWorkingKey", locale)); } vl.reload(); @@ -242,7 +242,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToActivateGiftCard", locale)); } @@ -297,12 +297,12 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToLinkGiftCard", locale)); } String responseCode = (String) response.get("responsecode"); - Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkGiftCardActivated", locale)); result.put("processResult", "00".equals(responseCode)); @@ -350,12 +350,12 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToDisablePin", locale)); } String responseCode = (String) response.get("responsecode"); - Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkPinDisabled", locale)); result.put("processResult","00".equals(responseCode)); @@ -410,7 +410,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToRedeemGiftCard", locale)); } @@ -473,7 +473,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToReloadGiftCard", locale)); } @@ -527,7 +527,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToCallBalanceInquiry", locale)); } @@ -577,7 +577,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToCallHistoryInquiry", locale)); } @@ -638,7 +638,7 @@ public class ValueLinkServices { response = vl.send(request); } catch (HttpClientException e) { Debug.logError(e, "Problem communicating with VL"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToRefundGiftCard", locale)); } @@ -685,7 +685,7 @@ public class ValueLinkServices { if (vlInterface != null) { if (vlInterface.startsWith("Activate")) { if ("Activate/Rollback".equals(vlInterface)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkThisTransactionIsNotSupported", locale)); } return activate(dctx, context); @@ -698,7 +698,7 @@ public class ValueLinkServices { } } - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkTransactionNotValid", locale)); } @@ -778,7 +778,7 @@ public class ValueLinkServices { redeemResult = dispatcher.runSync("redeemGiftCard", redeemCtx); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the redeem service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToRedeemGiftCardFailure", locale)); } @@ -841,12 +841,12 @@ public class ValueLinkServices { giftCard = paymentPref.getRelatedOne("GiftCard", false); } catch (GenericEntityException e) { Debug.logError("Unable to get GiftCard from OrderPaymentPreference", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotLocateItFromOrderPaymentPreference", locale)); } if (giftCard == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToReleaseGiftCard", locale)); } @@ -870,7 +870,7 @@ public class ValueLinkServices { redeemResult = dispatcher.runSync("voidRedeemGiftCard", redeemCtx); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the redeem service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToRedeemGiftCardFailure", locale)); } @@ -906,12 +906,12 @@ public class ValueLinkServices { giftCard = paymentPref.getRelatedOne("GiftCard", false); } catch (GenericEntityException e) { Debug.logError("Unable to get GiftCard from OrderPaymentPreference", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotLocateItFromOrderPaymentPreference", locale)); } if (giftCard == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToReleaseGiftCard", locale)); } @@ -935,7 +935,7 @@ public class ValueLinkServices { redeemResult = dispatcher.runSync("refundGiftCard", refundCtx); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the refund service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToRefundGiftCardFailure", locale)); } @@ -971,7 +971,7 @@ public class ValueLinkServices { orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem",MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -992,7 +992,7 @@ public class ValueLinkServices { productStoreId = orh.getProductStoreId(); } if (productStoreId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotProcess", locale)); } @@ -1003,7 +1003,7 @@ public class ValueLinkServices { paymentConfig = paymentSetting.getString("paymentPropertiesPath"); } if (paymentConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingFinAccountSetting", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", "GIFT_CARD"), locale)); } @@ -1027,7 +1027,7 @@ public class ValueLinkServices { Debug.logError("Unable to get Product from OrderItem", MODULE); } if (product == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfill", locale)); } @@ -1041,11 +1041,11 @@ public class ValueLinkServices { .orderBy("-fromDate").filterByDate().queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToGetFeatureType", locale)); } if (typeFeature == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkFeatureTypeRequested", UtilMisc.toMap("productId", product.get("productId")), locale)); } @@ -1053,7 +1053,7 @@ public class ValueLinkServices { // get the VL promo code String promoCode = typeFeature.getString("idCode"); if (UtilValidate.isEmpty(promoCode)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkPromoCodeInvalid", locale)); } @@ -1070,7 +1070,7 @@ public class ValueLinkServices { .queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurvey", locale)); } @@ -1080,7 +1080,7 @@ public class ValueLinkServices { responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurveyAnswers", locale)); } @@ -1093,7 +1093,7 @@ public class ValueLinkServices { question = answer.getRelatedOne("SurveyQuestion", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurveyAnswers", locale)); } if (question != null) { @@ -1132,7 +1132,7 @@ public class ValueLinkServices { activateResult = dispatcher.runSync("activateGiftCard", activateCtx); } catch (GenericServiceException e) { Debug.logError(e, "Unable to activate gift card(s)", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToActivateGiftCard", locale)); } @@ -1169,13 +1169,13 @@ public class ValueLinkServices { dispatcher.runAsync("createGcFulFillmentRecord", vlFulFill, true); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotStoreFulfillmentInfo", UtilMisc.toMap("errorString", e.toString() ), locale)); } if (failure) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToActivateGiftCard", locale)); } @@ -1228,7 +1228,7 @@ public class ValueLinkServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem sending mail", MODULE); // this is fatal; we will rollback and try again later - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotSendEmailNotice", UtilMisc.toMap("errorString", e.toString()), locale)); } @@ -1255,7 +1255,7 @@ public class ValueLinkServices { orderHeader = orderItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, "Unable to get OrderHeader from OrderItem",MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderOrderNotFound", UtilMisc.toMap("orderId", orderId), locale)); } @@ -1276,7 +1276,7 @@ public class ValueLinkServices { productStoreId = orh.getProductStoreId(); } if (productStoreId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotProcess", UtilMisc.toMap("orderId", orderId), locale)); } @@ -1288,7 +1288,7 @@ public class ValueLinkServices { paymentConfig = paymentSetting.getString("paymentPropertiesPath"); } if (paymentConfig == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotGetPaymentConfiguration", locale)); } @@ -1315,7 +1315,7 @@ public class ValueLinkServices { .queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurvey", locale)); } @@ -1325,7 +1325,7 @@ public class ValueLinkServices { responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurveyAnswers", locale)); } @@ -1338,7 +1338,7 @@ public class ValueLinkServices { question = answer.getRelatedOne("SurveyQuestion", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotFulfillFromSurveyAnswers", locale)); } if (question != null) { @@ -1370,7 +1370,7 @@ public class ValueLinkServices { reloadResult = dispatcher.runSync("reloadGiftCard", reloadCtx); } catch (GenericServiceException e) { Debug.logError(e, "Unable to reload gift card", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToReloadGiftCard", locale)); } @@ -1393,7 +1393,7 @@ public class ValueLinkServices { dispatcher.runAsync("createGcFulFillmentRecord", vlFulFill, true); } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "AccountingGiftCertificateNumberCannotStoreFulfillmentInfo", locale)); } @@ -1416,11 +1416,11 @@ public class ValueLinkServices { } if ("17".equals(responseCode)) { Debug.logError("Error code : " + responseCode + " : Max Balance Exceeded", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToRefundGiftCardMaxBalanceExceeded", locale)); } else { Debug.logError("Error code : " + responseCode + " : Processing Error", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingValueLinkUnableToReloadGiftCardFailed", locale)); } } @@ -1465,7 +1465,7 @@ public class ValueLinkServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem sending mail", MODULE); // this is fatal; we will rollback and try again later - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingGiftCertificateNumberCannotSendEmailNotice", UtilMisc.toMap("errorString", e.toString()), locale)); } 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 1da0edc..ac789f8 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 @@ -57,8 +57,8 @@ import paypal.payflow.SDKProperties; */ public class PayflowPro { - public static final String MODULE = PayflowPro.class.getName(); - public final static String resource = "AccountingUiLabels"; + private static final String MODULE = PayflowPro.class.getName(); + public final static String RESOURCE = "AccountingUiLabels"; /** * Authorize credit card payment service. Service wrapper around PayFlow Pro API. @@ -210,7 +210,7 @@ public class PayflowPro { } if (authTrans == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } @@ -281,7 +281,7 @@ public class PayflowPro { } if (authTrans == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale)); } @@ -356,7 +356,7 @@ public class PayflowPro { GenericValue captureTrans = PaymentGatewayServices.getCaptureTransaction(paymentPref); if (captureTrans == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale)); } @@ -449,7 +449,7 @@ public class PayflowPro { addCartDetails(data, cart); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "AccountingPayflowErrorRetreivingCartDetails", locale)); } @@ -684,17 +684,17 @@ 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 +709,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)) { @@ -871,21 +871,21 @@ public class PayflowPro { return buf.toString(); } - private static StringBuilder makeBaseParams(Delegator delegator, String paymentGatewayConfigId, String resource) { + private static StringBuilder makeBaseParams(Delegator delegator, String paymentGatewayConfigId, String RESOURCE) { StringBuilder buf = new StringBuilder(); try { buf.append("PARTNER="); - buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "partner", resource, "payment.verisign.partner", "VeriSign")); + buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "partner", RESOURCE, "payment.verisign.partner", "VeriSign")); buf.append("&"); buf.append("VENDOR="); - buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "vendor", resource, "payment.verisign.vendor", "nobody")); + buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "vendor", RESOURCE, "payment.verisign.vendor", "nobody")); buf.append("&"); buf.append("USER="); - buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "userId", resource, "payment.verisign.user", "nobody")); + buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "userId", RESOURCE, "payment.verisign.user", "nobody")); buf.append("&"); buf.append("PWD="); - buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", resource, "payment.verisign.pwd", "password")); + buf.append(getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", RESOURCE, "payment.verisign.pwd", "password")); } catch (Exception e) { Debug.logError(e, MODULE); return null; @@ -893,20 +893,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 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")); PayflowAPI pfp = new PayflowAPI(hostAddress, hostPort, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword); @@ -918,7 +918,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 +933,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 +942,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 +951,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 e9889a8..56c7837 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 @@ -55,10 +55,10 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class WorldPayEvents { - public static final String resource = "AccountingUiLabels"; - public static final String resourceErr = "AccountingErrorUiLabels"; + private static final String RESOURCE = "AccountingUiLabels"; + private static final String RES_ERROR = "AccountingErrorUiLabels"; public static final String commonResource = "CommonUiLabels"; - public static final String MODULE = WorldPayEvents.class.getName(); + private static final String MODULE = WorldPayEvents.class.getName(); public static String worldPayRequest(HttpServletRequest request, HttpServletResponse response) { Locale locale = UtilHttp.getLocale(request); @@ -71,7 +71,7 @@ public class WorldPayEvents { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get the order header for order: " + orderId, MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingOrderHeader", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingOrderHeader", locale)); return "error"; } // get the order total @@ -80,7 +80,7 @@ public class WorldPayEvents { GenericValue productStore = ProductStoreWorker.getProductStore(request); if (productStore == null) { Debug.logError("ProductStore is null", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingMerchantConfiguration", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } // get the payment properties file @@ -226,19 +226,19 @@ public class WorldPayEvents { // get the currency String defCur = UtilFormatOut.checkEmpty(productStore.getString("defaultCurrencyUomId"), "USD"); // order description - String description = UtilProperties.getMessage(resource, "AccountingOrderNr", locale) + orderId + " " + + String description = UtilProperties.getMessage(RESOURCE, "AccountingOrderNr", locale) + orderId + " " + (company != null ? UtilProperties.getMessage(commonResource, "CommonFrom", locale) + " "+ company : ""); // check the instId - very important if (instId == null || "NONE".equals(instId)) { Debug.logError("Worldpay InstId not found, cannot continue", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingInstId", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingInstId", locale)); return "error"; } try { Integer.parseInt(instId); } catch (NumberFormatException nfe) { Debug.logError(nfe, "Problem converting instId string to integer", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingInstIdToInteger", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingInstIdToInteger", locale)); return "error"; } // check the testMode @@ -298,7 +298,7 @@ public class WorldPayEvents { response.sendRedirect(redirectString); } catch (IOException e) { Debug.logError(e, "Problems redirecting to WorldPay", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsConnectingWithWorldPay", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsConnectingWithWorldPay", locale)); return "error"; } return "success"; @@ -323,7 +323,7 @@ public class WorldPayEvents { userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get UserLogin for: " + userLoginId + "; cannot continue", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingAuthenticationUser", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingAuthenticationUser", locale)); return "error"; } } @@ -334,17 +334,17 @@ public class WorldPayEvents { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get the order header for order: " + orderId, MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingOrderHeader", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingOrderHeader", locale)); return "error"; } } else { Debug.logError("WorldPay did not callback with a valid orderId!", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.noValidOrderIdReturned", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.noValidOrderIdReturned", locale)); return "error"; } if (orderHeader == null) { Debug.logError("Cannot get the order header for order: " + orderId, MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingOrderHeader", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.problemsGettingOrderHeader", locale)); return "error"; } // get the transaction status @@ -474,12 +474,12 @@ public class WorldPayEvents { // create a payment record too Map<String, Object> results = null; try { - String comment = UtilProperties.getMessage(resource, "AccountingPaymentReceiveViaWorldPay", locale); + String comment = UtilProperties.getMessage(RESOURCE, "AccountingPaymentReceiveViaWorldPay", locale); results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, "orderPaymentPreferenceId", paymentPreference.get("orderPaymentPreferenceId"), "comments", comment)); } catch (GenericServiceException e) { Debug.logError(e, "Failed to execute service createPaymentFromPreference", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.failedToExecuteServiceCreatePaymentFromPreference", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "worldPayEvents.failedToExecuteServiceCreatePaymentFromPreference", locale)); return false; } @@ -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,7 +507,7 @@ 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(); } @@ -516,8 +516,8 @@ public class WorldPayEvents { } 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 1fba736..5555b19 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 @@ -37,7 +37,7 @@ import org.apache.ofbiz.entity.util.EntityQuery; public final class UtilAccounting { - public static final String MODULE = UtilAccounting.class.getName(); + private static final String MODULE = UtilAccounting.class.getName(); private UtilAccounting() {} diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java index e923884..2b1d6d4 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java @@ -51,7 +51,7 @@ import org.apache.ofbiz.webapp.website.WebSiteWorker; */ public class ContentManagementEvents { - public static final String MODULE = ContentManagementEvents.class.getName(); + private static final String MODULE = ContentManagementEvents.class.getName(); public static String updateStaticValues(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); 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 b19d5f9..477c199 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 @@ -62,8 +62,8 @@ import com.ibm.icu.util.Calendar; */ public class ContentManagementServices { - public static final String MODULE = ContentManagementServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = ContentManagementServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; /** * getSubContent @@ -285,7 +285,7 @@ public class ContentManagementServices { Debug.logInfo("In persistContentAndAssoc calling updateContent with content: " + contentContext, MODULE); Map<String, Object> thisResult = dispatcher.runSync("updateContent", contentContext); if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentUpdatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentUpdatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); } } else { Map<String, Object> contentContext = new HashMap<>(); @@ -297,7 +297,7 @@ public class ContentManagementServices { Debug.logInfo("In persistContentAndAssoc calling createContent with content: " + contentContext, MODULE); Map<String, Object> thisResult = dispatcher.runSync("createContent", contentContext); if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); } contentId = (String) thisResult.get("contentId"); } @@ -511,7 +511,7 @@ public class ContentManagementServices { result = persistDataResourceAndDataMethod(dctx, context); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentNoAccessToUploadImage", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentNoAccessToUploadImage", locale)); } } catch (GenericServiceException e) { Debug.logError(e, e.toString(), MODULE); @@ -913,7 +913,7 @@ public class ContentManagementServices { GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (content == null) { Debug.logError("content was null", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", ""), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", ""), locale)); } String dataResourceId = content.getString("dataResourceId"); @@ -1004,7 +1004,7 @@ public class ContentManagementServices { try { thisContent = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (thisContent == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } thisContent.set("contentTypeId", contentTypeId); thisContent.store(); @@ -1044,7 +1044,7 @@ public class ContentManagementServices { try { thisContent = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (thisContent == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } thisContent.set("contentTypeId", "OUTLINE_NODE"); @@ -1205,7 +1205,7 @@ public class ContentManagementServices { Locale locale = (Locale) context.get("locale"); GenericValue content = (GenericValue)context.get("content"); if (content == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", ""), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", ""), locale)); } Long leafCount = (Long)content.get("childLeafCount"); if (leafCount == null) { @@ -1229,7 +1229,7 @@ public class ContentManagementServices { try { GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); if (content == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } Long leafCount = (Long)content.get("childLeafCount"); if (leafCount == null) { @@ -1255,7 +1255,7 @@ public class ContentManagementServices { try { GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); if (content == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } Long leafCount = (Long)content.get("childLeafCount"); if (leafCount == null) { @@ -1405,7 +1405,7 @@ public class ContentManagementServices { return ServiceUtil.returnError(e.toString()); } if (productContent == null) { - String msg = UtilProperties.getMessage(resource, "ContentNoProductContentFound", UtilMisc.toMap("productId", productId), locale); + String msg = UtilProperties.getMessage(RESOURCE, "ContentNoProductContentFound", UtilMisc.toMap("productId", productId), locale); Debug.logError(msg, MODULE); return ServiceUtil.returnError(msg); } @@ -1452,7 +1452,7 @@ public class ContentManagementServices { } orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader == null) { - String msg = UtilProperties.getMessage(resource, "ContentNoOrderHeaderFound", UtilMisc.toMap("orderId", orderId), locale); + String msg = UtilProperties.getMessage(RESOURCE, "ContentNoOrderHeaderFound", UtilMisc.toMap("orderId", orderId), locale); return ServiceUtil.returnError(msg); } Timestamp orderCreatedDate = (Timestamp) orderHeader.get("orderDate"); @@ -1490,7 +1490,7 @@ public class ContentManagementServices { 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)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPermissionNotGranted", locale)); } String contentId = (String)context.get("contentId"); String serviceName = (String)context.get("serviceName"); @@ -1527,7 +1527,7 @@ public class ContentManagementServices { } else { if (visitedSet.contains(contentId)) { Debug.logWarning("visitedSet already contains:" + contentId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentVisitedSet", locale) + contentId); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentVisitedSet", locale) + contentId); } else { visitedSet.add(contentId); } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java index 654d3d3..cb0705e 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java @@ -60,7 +60,7 @@ import org.apache.ofbiz.security.Security; */ public final class ContentManagementWorker { - public static final String MODULE = ContentManagementWorker.class.getName(); + private static final String MODULE = ContentManagementWorker.class.getName(); private static Map<String, GenericValue> cachedWebSitePublishPoints = new HashMap<>(); private static Map<String, Map<String, Object>> cachedStaticValues = new HashMap<>(); 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 b97282f..8f23960 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 @@ -42,7 +42,7 @@ import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ServiceUtil; public class ConvertTree{ - public static final String MODULE = ConvertTree.class.getName(); + private static final String MODULE = ConvertTree.class.getName(); /* diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java index d004f74..0e1bd6a 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java @@ -51,8 +51,8 @@ import com.sun.syndication.feed.synd.SyndFeedImpl; */ public class BlogRssServices { - public static final String MODULE = BlogRssServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = BlogRssServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; public static final String mimeTypeId = "text/html"; public static final String mapKey = "SUMMARY"; @@ -79,7 +79,7 @@ public class BlogRssServices { } if (content == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentCannotGenerateBlogRssFeed", UtilMisc.toMap("contentId", contentId), locale)); } 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 291874d..6953028 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 @@ -59,7 +59,7 @@ import freemarker.template.TemplateException; */ public class CmsEvents { - public static final String MODULE = CmsEvents.class.getName(); + private static final String MODULE = CmsEvents.class.getName(); public static String cms(HttpServletRequest request, HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); 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 3e68a7f..500154b 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 @@ -52,7 +52,7 @@ import org.apache.ofbiz.webapp.website.WebSiteWorker; * CompDocEvents Class */ public class CompDocEvents { - public static final String MODULE = CompDocEvents.class.getName(); + private static final String MODULE = CompDocEvents.class.getName(); /** * 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 333b545..8ac48a6 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 @@ -59,8 +59,8 @@ import com.lowagie.text.pdf.PdfReader; */ public class CompDocServices { - public static final String MODULE = CompDocServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = CompDocServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; /** * @@ -101,7 +101,7 @@ public class CompDocServices { try { Map<String, Object> persistContentResult = dispatcher.runSync("persistContentAndAssoc", persistMap); if (ServiceUtil.isError(persistContentResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, persistContentResult); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, persistContentResult); } contentId = (String) persistContentResult.get("contentId"); @@ -114,14 +114,14 @@ public class CompDocServices { Map<String, Object> persistRevResult = dispatcher.runSync("persistContentRevisionAndItem", contentRevisionMap); if (ServiceUtil.isError(persistRevResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentRevisionAndItem"), locale), null, null, persistRevResult); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentRevisionAndItem"), locale), null, null, persistRevResult); } result.putAll(persistRevResult); return result; } catch (GenericServiceException e) { Debug.logError(e, "Error running serviceName, 'persistContentAndAssoc'. " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale) + e.toString()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale) + e.toString()); } } @@ -202,7 +202,7 @@ public class CompDocServices { // Create AcroForm PDF Map<String, Object> survey2PdfResults = dispatcher.runSync("buildPdfFromSurveyResponse", UtilMisc.toMap("surveyResponseId", surveyId)); if (ServiceUtil.isError(survey2PdfResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentSurveyErrorBuildingPDF", locale), null, null, survey2PdfResults); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentSurveyErrorBuildingPDF", locale), null, null, survey2PdfResults); } ByteBuffer outByteBuffer = (ByteBuffer) survey2PdfResults.get("outByteBuffer"); @@ -212,7 +212,7 @@ public class CompDocServices { // Fill in acroForm Map<String, Object> survey2AcroFieldResults = dispatcher.runSync("setAcroFieldsFromSurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId)); if (ServiceUtil.isError(survey2AcroFieldResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentSurveyErrorSettingAcroFields", locale), null, null, survey2AcroFieldResults); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentSurveyErrorSettingAcroFields", locale), null, null, survey2AcroFieldResults); } ByteBuffer outByteBuffer = (ByteBuffer) survey2AcroFieldResults.get("outByteBuffer"); @@ -221,7 +221,7 @@ public class CompDocServices { } } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentMimeTypeNotSupported", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentMimeTypeNotSupported", locale)); } if (reader != null) { int n = reader.getNumberOfPages(); @@ -323,7 +323,7 @@ public class CompDocServices { // Create AcroForm PDF Map<String, Object> survey2PdfResults = dispatcher.runSync("buildPdfFromSurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId)); if (ServiceUtil.isError(survey2PdfResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentSurveyErrorBuildingPDF", locale), null, null, survey2PdfResults); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentSurveyErrorBuildingPDF", locale), null, null, survey2PdfResults); } ByteBuffer outByteBuffer = (ByteBuffer)survey2PdfResults.get("outByteBuffer"); @@ -332,7 +332,7 @@ public class CompDocServices { // Fill in acroForm Map<String, Object> survey2AcroFieldResults = dispatcher.runSync("setAcroFieldsFromSurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId)); if (ServiceUtil.isError(survey2AcroFieldResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentSurveyErrorSettingAcroFields", locale), null, null, survey2AcroFieldResults); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentSurveyErrorSettingAcroFields", locale), null, null, survey2AcroFieldResults); } ByteBuffer outByteBuffer = (ByteBuffer) survey2AcroFieldResults.get("outByteBuffer"); @@ -340,7 +340,7 @@ public class CompDocServices { } } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentMimeTypeNotSupported", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentMimeTypeNotSupported", locale)); } if (inputByteArray == null) { 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 8ca51dc..0d2eb67 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 @@ -42,8 +42,8 @@ import org.apache.ofbiz.security.Security; */ public class ContentEvents { - public static final String MODULE = ContentEvents.class.getName(); - public static final String resource = "ContentErrorUiLabels"; + private static final String MODULE = ContentEvents.class.getName(); + private static final String RESOURCE = "ContentErrorUiLabels"; /** * Updates/adds keywords for all contents @@ -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"; } @@ -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 280be22..7bdb160 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 @@ -43,7 +43,7 @@ import org.apache.ofbiz.entity.util.EntityUtilProperties; */ public class ContentKeywordIndex { - public static final String MODULE = ContentKeywordIndex.class.getName(); + private static final String MODULE = ContentKeywordIndex.class.getName(); public static void forceIndexKeywords(GenericValue content) throws GenericEntityException { ContentKeywordIndex.indexKeywords(content, true); 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 ba51e1b..5e9cde4 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 @@ -49,7 +49,7 @@ import org.apache.ofbiz.webapp.website.WebSiteWorker; */ public class ContentMapFacade implements Map<Object, Object> { - public static final String MODULE = ContentMapFacade.class.getName(); + private static final String MODULE = ContentMapFacade.class.getName(); private static final Set<String> mapKeySet = new HashSet<>(); static { @@ -285,7 +285,7 @@ public class ContentMapFacade implements Map<Object, Object> { return this.contentId; } } else if ("data".equalsIgnoreCase(name) || "dataresource".equalsIgnoreCase(name)) { - // data (resource) object + // data (RESOURCE) object return dataResource; } else if ("subcontent_all".equalsIgnoreCase(name)) { // subcontent list of ordered subcontent @@ -541,7 +541,7 @@ public class ContentMapFacade implements Map<Object, Object> { String name = (String) key; if ("fields".equalsIgnoreCase(name)) { - // get the data resource value object + // get the data RESOURCE value object GenericValue dr = null; try { dr = value.getRelatedOne("DataResource", cache); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java index 3a58ed9..59ea9d2 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java @@ -50,8 +50,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ContentPermissionServices { - public static final String MODULE = ContentPermissionServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = ContentPermissionServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; public ContentPermissionServices() {} @@ -269,11 +269,11 @@ public class ContentPermissionServices { contentTo = EntityQuery.use(delegator).from("Content").where("contentId", contentIdTo).cache().queryOne(); contentFrom = EntityQuery.use(delegator).from("Content").where("contentId", contentIdFrom).cache().queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentToOrFromErrorRetriving", locale)); } if (contentTo == null || contentFrom == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentToOrFromIsNull", UtilMisc.toMap("contentTo", contentTo, "contentFrom", contentFrom), locale)); } 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 6b2056a..dfee583 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 @@ -54,8 +54,8 @@ import org.apache.ofbiz.entity.util.EntityUtil; public class ContentSearch { - public static final String MODULE = ContentSearch.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = ContentSearch.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; public static ArrayList<String> searchContents(List<? extends ContentSearchConstraint> contentSearchConstraintList, ResultSortOrder resultSortOrder, Delegator delegator, String visitId) { ContentSearchContext contentSearchContext = new ContentSearchContext(delegator, visitId); @@ -534,7 +534,7 @@ public class ContentSearch { } StringBuilder ppBuf = new StringBuilder(); - ppBuf.append(UtilProperties.getMessage(resource, "ContentAssoc", locale) + ": "); + ppBuf.append(UtilProperties.getMessage(RESOURCE, "ContentAssoc", locale) + ": "); if (content != null) { ppBuf.append(content.getString("contentName")); } @@ -554,7 +554,7 @@ public class ContentSearch { } } if (this.includeSubContents) { - ppBuf.append(" (").append(UtilProperties.getMessage(resource, "ContentIncludeAllSubContents", locale)).append(")"); + ppBuf.append(" (").append(UtilProperties.getMessage(RESOURCE, "ContentIncludeAllSubContents", locale)).append(")"); } return ppBuf.toString(); } @@ -685,9 +685,9 @@ public class ContentSearch { @Override public String prettyPrintConstraint(Delegator delegator, boolean detailed, Locale locale) { StringBuilder ppBuf = new StringBuilder(); - ppBuf.append(UtilProperties.getMessage(resource, "ContentKeywords", locale)).append(": \""); - ppBuf.append(this.keywordsString).append("\", ").append(UtilProperties.getMessage(resource, "ContentKeywordWhere", locale)).append(" "); - ppBuf.append(isAnd ? UtilProperties.getMessage(resource, "ContentKeywordAllWordsMatch", locale) : UtilProperties.getMessage(resource, "ContentKeywordAnyWordMatches", locale)); + ppBuf.append(UtilProperties.getMessage(RESOURCE, "ContentKeywords", locale)).append(": \""); + ppBuf.append(this.keywordsString).append("\", ").append(UtilProperties.getMessage(RESOURCE, "ContentKeywordWhere", locale)).append(" "); + ppBuf.append(isAnd ? UtilProperties.getMessage(RESOURCE, "ContentKeywordAllWordsMatch", locale) : UtilProperties.getMessage(RESOURCE, "ContentKeywordAnyWordMatches", locale)); return ppBuf.toString(); } @@ -780,8 +780,8 @@ public class ContentSearch { @Override public String prettyPrintConstraint(Delegator delegator, boolean detailed, Locale locale) { StringBuilder ppBuf = new StringBuilder(); - ppBuf.append(UtilProperties.getMessage(resource, "ContentLastModified", locale)).append(": \""); - ppBuf.append(fromDate).append("-").append(thruDate).append("\", ").append(UtilProperties.getMessage(resource, "ContentLastModified", locale)).append(" "); + ppBuf.append(UtilProperties.getMessage(RESOURCE, "ContentLastModified", locale)).append(": \""); + ppBuf.append(fromDate).append("-").append(thruDate).append("\", ").append(UtilProperties.getMessage(RESOURCE, "ContentLastModified", locale)).append(" "); return ppBuf.toString(); } @@ -861,7 +861,7 @@ public class ContentSearch { @Override public String prettyPrintSortOrder(boolean detailed, Locale locale) { - return UtilProperties.getMessage(resource, "ContentKeywordRelevancy", locale); + return UtilProperties.getMessage(RESOURCE, "ContentKeywordRelevancy", locale); } @Override @@ -908,13 +908,13 @@ public class ContentSearch { @Override public String prettyPrintSortOrder(boolean detailed, Locale locale) { if ("contentName".equals(this.fieldName)) { - return UtilProperties.getMessage(resource, "ContentName", locale); + return UtilProperties.getMessage(RESOURCE, "ContentName", locale); } else if ("totalQuantityOrdered".equals(this.fieldName)) { - return UtilProperties.getMessage(resource, "ContentPopularityByOrders", locale); + return UtilProperties.getMessage(RESOURCE, "ContentPopularityByOrders", locale); } else if ("totalTimesViewed".equals(this.fieldName)) { - return UtilProperties.getMessage(resource, "ContentPopularityByViews", locale); + return UtilProperties.getMessage(RESOURCE, "ContentPopularityByViews", locale); } else if ("averageCustomerRating".equals(this.fieldName)) { - return UtilProperties.getMessage(resource, "ContentCustomerRating", locale); + return UtilProperties.getMessage(RESOURCE, "ContentCustomerRating", locale); } return this.fieldName; } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java index 7f38683..dec4245 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java @@ -37,7 +37,7 @@ import org.apache.ofbiz.webapp.stats.VisitHandler; public class ContentSearchEvents { - public static final String MODULE = ContentSearchEvents.class.getName(); + private static final String MODULE = ContentSearchEvents.class.getName(); public static Map<String, Object> getContentSearchResult(HttpServletRequest request, Delegator delegator) { 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 f88bf51..1608f88 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 @@ -39,7 +39,7 @@ import org.apache.ofbiz.entity.Delegator; public class ContentSearchSession { - public static final String MODULE = ContentSearchSession.class.getName(); + private static final String MODULE = ContentSearchSession.class.getName(); @SuppressWarnings("serial") public static class ContentSearchOptions implements java.io.Serializable { 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 9c2f98e..a8b8de1 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 @@ -56,8 +56,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ContentServices { - public static final String MODULE = ContentServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = ContentServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; /** * findRelatedContent Finds the related @@ -85,7 +85,7 @@ public class ContentServices { try { contentList = ContentWorker.getAssociatedContent(currentContent, toFrom, assocTypes, contentTypes, fromDate, thruDate); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.toString()), locale)); } if (UtilValidate.isEmpty(targetOperations)) { @@ -109,7 +109,7 @@ public class ContentServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem checking permissions", "ContentServices"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPermissionNotGranted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPermissionNotGranted", locale)); } String permissionStatus = (String) permResults.get("permissionStatus"); @@ -188,7 +188,7 @@ public class ContentServices { content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Entity Error:" + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } String fromDateStr = (String) context.get("fromDateStr"); @@ -267,11 +267,11 @@ public class ContentServices { contentAssoc = EntityQuery.use(delegator).from("ContentAssoc").where(pk).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Entity Error:" + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (contentAssoc == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocDeactivatingError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentAssocDeactivatingError", locale)); } GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -299,7 +299,7 @@ public class ContentServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem checking permissions", "ContentServices"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPermissionNotGranted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPermissionNotGranted", locale)); } permissionStatus = (String) permResults.get("permissionStatus"); @@ -338,7 +338,7 @@ public class ContentServices { if (fromDate != null) { activeAssoc = EntityQuery.use(delegator).from("ContentAssoc").where("contentId", activeContentId, "contentIdTo", contentIdTo, "fromDate", fromDate, "contentAssocTypeId", contentAssocTypeId).queryOne(); if (activeAssoc == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocNotFound", UtilMisc.toMap("activeContentId", activeContentId, "contentIdTo", contentIdTo, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentAssocNotFound", UtilMisc.toMap("activeContentId", activeContentId, "contentIdTo", contentIdTo, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), locale)); } sequenceNum = (String) activeAssoc.get("sequenceNum"); } 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 73f88a8..cd5a321 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 @@ -52,7 +52,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ContentServicesComplex { - public static final String MODULE = ContentServicesComplex.class.getName(); + private static final String MODULE = ContentServicesComplex.class.getName(); /* 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 e6d27f6..f3838a4 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 @@ -72,7 +72,7 @@ import freemarker.ext.dom.NodeModel; */ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWorkerInterface { - public static final String MODULE = ContentWorker.class.getName(); + private static final String MODULE = ContentWorker.class.getName(); static final UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder("html"); public ContentWorker() { } @@ -126,7 +126,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor throw new GeneralException("No content found for content ID [" + contentId + "]"); } - // if the content is a PUBLISH_POINT and the data resource is not defined; get the related content + // if the content is a PUBLISH_POINT and the data RESOURCE is not defined; get the related content if ("WEB_SITE_PUB_PT".equals(content.get("contentTypeId")) && content.get("dataResourceId") == null) { GenericValue relContent = EntityQuery.use(delegator) .from("ContentAssocDataResourceViewTo") @@ -259,7 +259,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor templateContext.put("thisContent", decFacade); // decorator content ContentWorker.renderContentAsText(dispatcher, contentDecoratorId, out, templateContext, locale, mimeTypeId, null, null, cache); } else { - // get the data resource info + // get the data RESOURCE info String templateDataResourceId = content.getString("templateDataResourceId"); String dataResourceId = content.getString("dataResourceId"); if (UtilValidate.isEmpty(dataResourceId)) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java index ba8040f..6783e0a 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java @@ -49,7 +49,7 @@ public class PermissionRecorder { protected String [] statusTargets; protected String [] targetOperations; - public static final String MODULE = PermissionRecorder.class.getName(); + private static final String MODULE = PermissionRecorder.class.getName(); private static final String [] opFields = { "contentPurposeTypeId", "contentOperationId", "roleTypeId", "statusId", "privilegeEnumId"}; private static final String [] fieldTitles = { "Purpose", "Operation", "Role", "Status", "Privilege"}; 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 8d40d4c..6380e56 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 @@ -63,7 +63,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class UploadContentAndImage { - public static final String MODULE = UploadContentAndImage.class.getName(); + private static final String MODULE = UploadContentAndImage.class.getName(); public static final String err_resource = "ContentErrorUiLabels"; public UploadContentAndImage() {} diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataEvents.java index e9420f7..dbb8073 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataEvents.java @@ -50,7 +50,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class DataEvents { - public static final String MODULE = DataEvents.class.getName(); + private static final String MODULE = DataEvents.class.getName(); public static final String err_resource = "ContentErrorUiLabels"; public static String uploadImage(HttpServletRequest request, HttpServletResponse response) { @@ -109,7 +109,7 @@ public class DataEvents { return "error"; } - // get the data resource + // get the data RESOURCE GenericValue dataResource; try { dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne(); @@ -119,7 +119,7 @@ public class DataEvents { return "error"; } - // make sure the data resource exists + // make sure the data RESOURCE exists if (dataResource == null) { String errorMsg = "No Data Resource found for ID: " + dataResourceId; Debug.logError(errorMsg, MODULE); @@ -127,7 +127,7 @@ public class DataEvents { return "error"; } - // see if data resource is public or not + // see if data RESOURCE is public or not String isPublic = dataResource.getString("isPublic"); if (UtilValidate.isEmpty(isPublic)) { isPublic = "N"; @@ -183,7 +183,7 @@ public class DataEvents { https = "true"; } - // get the data resource stream and content length + // get the data RESOURCE stream and content length Map<String, Object> resourceData; try { resourceData = DataResourceWorker.getDataResourceStream(dataResource, https, webSiteId, locale, contextRoot, false); @@ -201,7 +201,7 @@ public class DataEvents { stream = (InputStream) resourceData.get("stream"); length = (Long) resourceData.get("length"); } - Debug.logInfo("Got resource data stream: " + length + " bytes", MODULE); + Debug.logInfo("Got RESOURCE data stream: " + length + " bytes", MODULE); // stream the content to the browser if (stream != null && length != null) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java index e4ac7ab..530c951 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java @@ -105,7 +105,7 @@ import freemarker.template.TemplateException; */ public class DataResourceWorker implements org.apache.ofbiz.widget.content.DataResourceWorkerInterface { - public static final String MODULE = DataResourceWorker.class.getName(); + private static final String MODULE = DataResourceWorker.class.getName(); public static final String err_resource = "ContentErrorUiLabels"; /** @@ -646,7 +646,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data delegator = dispatcher.getDelegator(); } if (dataResourceId == null) { - throw new GeneralException("Cannot lookup data resource with for a null dataResourceId"); + throw new GeneralException("Cannot lookup data RESOURCE with for a null dataResourceId"); } if (templateContext == null) { templateContext = new HashMap<>(); @@ -666,16 +666,16 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data throw new GeneralException("The desired mime-type is not a text type, cannot render as text: " + targetMimeTypeId); } - // get the data resource object + // get the data RESOURCE object GenericValue dataResource = EntityQuery.use(delegator).from("DataResource") .where("dataResourceId", dataResourceId) .cache(cache).queryOne(); if (dataResource == null) { - throw new GeneralException("No data resource object found for dataResourceId: [" + dataResourceId + "]"); + throw new GeneralException("No data RESOURCE object found for dataResourceId: [" + dataResourceId + "]"); } - // a data template attached to the data resource + // a data template attached to the data RESOURCE String dataTemplateTypeId = dataResource.getString("dataTemplateTypeId"); // no template; or template is NONE; render the data @@ -882,7 +882,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data String text = (String) dataResource.get("dataResourceId"); writeText(dataResource, text, templateContext, mimeTypeId, locale, out); - // resource type + // RESOURCE type } else if ("URL_RESOURCE".equals(dataResourceTypeId)) { String text = null; URL url = FlexibleLocation.resolveLocation(dataResource.getString("objectInfo")); @@ -928,7 +928,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data String dataResourceMimeTypeId = dataResource.getString("mimeTypeId"); Delegator delegator = dataResource.getDelegator(); - // assume HTML as data resource data + // assume HTML as data RESOURCE data if (UtilValidate.isEmpty(dataResourceMimeTypeId)) { dataResourceMimeTypeId = "text/html"; } @@ -979,7 +979,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data } public static void renderFile(String dataResourceTypeId, String objectInfo, String rootDir, Appendable out) throws GeneralException, IOException { - // TODO: this method assumes the file is a text file, if it is an image we should respond differently, see the comment above for IMAGE_OBJECT type data resource + // TODO: this method assumes the file is a text file, if it is an image we should respond differently, see the comment above for IMAGE_OBJECT type data RESOURCE if ("LOCAL_FILE".equals(dataResourceTypeId) && UtilValidate.isNotEmpty(objectInfo)) { File file = FileUtil.getFile(objectInfo); @@ -1039,7 +1039,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data */ public static Map<String, Object> getDataResourceStream(GenericValue dataResource, String https, String webSiteId, Locale locale, String contextRoot, boolean cache) throws IOException, GeneralException { if (dataResource == null) { - throw new GeneralException("Cannot stream null data resource!"); + throw new GeneralException("Cannot stream null data RESOURCE!"); } String dataResourceTypeId = dataResource.getString("dataResourceTypeId"); @@ -1107,7 +1107,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data } throw new GeneralException("No objectInfo found for FILE type [" + dataResourceTypeId + "]; cannot stream"); - // URL resource data + // URL RESOURCE data } else if ("URL_RESOURCE".equals(dataResourceTypeId)) { String objectInfo = dataResource.getString("objectInfo"); if (UtilValidate.isNotEmpty(objectInfo)) { 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 3d62a46..ecbabe8 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 @@ -55,8 +55,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class DataServices { - public static final String MODULE = DataServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = DataServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; public static Map<String, Object> clearAssociatedRenderCache(DispatchContext dctx, Map<String, Object> context) { Delegator delegator = dctx.getDelegator(); @@ -66,7 +66,7 @@ public class DataServices { DataResourceWorker.clearAssociatedRenderCache(delegator, dataResourceId); } catch (GeneralException e) { Debug.logError(e, "Unable to clear associated render cache with dataResourceId=" + dataResourceId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentClearAssociatedRenderCacheError", UtilMisc.toMap("dataResourceId", dataResourceId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentClearAssociatedRenderCacheError", UtilMisc.toMap("dataResourceId", dataResourceId), locale)); } return ServiceUtil.returnSuccess(); } @@ -208,18 +208,18 @@ public class DataServices { // extended validation for binary/character data if (UtilValidate.isNotEmpty(textData) && binData != null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentCannotProcessBothCharacterAndBinaryFile", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentCannotProcessBothCharacterAndBinaryFile", locale)); } // obtain a reference to the file File file = null; if (UtilValidate.isEmpty(objectInfo)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableObtainReferenceToFile", UtilMisc.toMap("objectInfo", ""), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableObtainReferenceToFile", UtilMisc.toMap("objectInfo", ""), locale)); } if (UtilValidate.isEmpty(dataResourceTypeId) || "LOCAL_FILE".equals(dataResourceTypeId) || "LOCAL_FILE_BIN".equals(dataResourceTypeId)) { file = new File(objectInfo); if (!file.isAbsolute()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentLocalFileDoesNotPointToAbsoluteLocation", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentLocalFileDoesNotPointToAbsoluteLocation", locale)); } } else if ("OFBIZ_FILE".equals(dataResourceTypeId) || "OFBIZ_FILE_BIN".equals(dataResourceTypeId)) { prefix = System.getProperty("ofbiz.home"); @@ -230,7 +230,7 @@ public class DataServices { } else if ("CONTEXT_FILE".equals(dataResourceTypeId) || "CONTEXT_FILE_BIN".equals(dataResourceTypeId)) { prefix = (String) context.get("rootDir"); if (UtilValidate.isEmpty(prefix)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentCannotFindContextFileWithEmptyContextRoot", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentCannotFindContextFileWithEmptyContextRoot", locale)); } if (objectInfo.indexOf('/') != 0 && prefix.lastIndexOf('/') != (prefix.length() - 1)) { sep = "/"; @@ -238,7 +238,7 @@ public class DataServices { file = new File(prefix + sep + objectInfo); } if (file == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableObtainReferenceToFile", UtilMisc.toMap("objectInfo", objectInfo), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableObtainReferenceToFile", UtilMisc.toMap("objectInfo", objectInfo), locale)); } // write the data to the file @@ -249,7 +249,7 @@ public class DataServices { out.write(textData); } catch (IOException e) { Debug.logWarning(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteCharacterDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteCharacterDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } } else if (binData != null) { try { @@ -258,13 +258,13 @@ public class DataServices { out.close(); } catch (FileNotFoundException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } catch (IOException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteBinaryDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteBinaryDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFilePassed", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFilePassed", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } Map<String, Object> result = ServiceUtil.returnSuccess(); @@ -313,7 +313,7 @@ public class DataServices { dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentDataResourceNotFound", UtilMisc.toMap("parameters.dataResourceId", dataResourceId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentDataResourceNotFound", UtilMisc.toMap("parameters.dataResourceId", dataResourceId), locale)); } dataResource.setNonPKFields(context); @@ -357,7 +357,7 @@ public class DataServices { result.put("contentId", contentId); if (UtilValidate.isEmpty(dataResourceId)) { Debug.logError("dataResourceId is null.", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentDataResourceIsNull", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentDataResourceIsNull", locale)); } String textData = (String) context.get("textData"); if (Debug.verboseOn()) { @@ -376,7 +376,7 @@ public class DataServices { } } catch (GenericEntityException e) { Debug.logWarning(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentElectronicTextNotFound", locale) + " " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentElectronicTextNotFound", locale) + " " + e.getMessage()); } return result; @@ -438,7 +438,7 @@ public class DataServices { out.write(textData); } catch (IOException e) { Debug.logWarning(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteCharacterDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteCharacterDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } } else if (binData != null) { try { @@ -448,13 +448,13 @@ public class DataServices { out.close(); } catch (FileNotFoundException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableToOpenFileForWriting", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } catch (IOException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentUnableWriteBinaryDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentUnableWriteBinaryDataToFile", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFilePassed", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFilePassed", UtilMisc.toMap("fileName", file.getAbsolutePath()), locale)); } } catch (IOException e) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java index 3473488..a2dcf31 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java @@ -46,8 +46,8 @@ import java.util.Map; */ public class FtpServices { - public static final String MODULE = FtpServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = FtpServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; private static FtpClientInterface createFtpClient(String serverType) throws GeneralException { @@ -95,7 +95,7 @@ public class FtpServices { //Validate content GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); if (null == content) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } //ftp redirection diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SecureFtpClient.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SecureFtpClient.java index 46b8b76..505cbc2 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SecureFtpClient.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SecureFtpClient.java @@ -24,7 +24,7 @@ import java.util.List; public class SecureFtpClient implements FtpClientInterface { - public static final String MODULE = SecureFtpClient.class.getName(); + private static final String MODULE = SecureFtpClient.class.getName(); /** * TODO : to implements diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SimpleFtpClient.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SimpleFtpClient.java index afd51d1..c064c1e 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SimpleFtpClient.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SimpleFtpClient.java @@ -34,7 +34,7 @@ import org.apache.ofbiz.base.util.UtilProperties; public class SimpleFtpClient implements FtpClientInterface { - public static final String MODULE = SimpleFtpClient.class.getName(); + private static final String MODULE = SimpleFtpClient.class.getName(); private FTPClient client; public SimpleFtpClient() { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SshFtpClient.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SshFtpClient.java index 0db2c15..e9dd076 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SshFtpClient.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/SshFtpClient.java @@ -35,7 +35,7 @@ import org.apache.sshd.client.subsystem.sftp.SftpClient; */ public class SshFtpClient implements FtpClientInterface { - public static final String MODULE = SshFtpClient.class.getName(); + private static final String MODULE = SshFtpClient.class.getName(); private SshClient client; private SftpClient sftp; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java index 7a90ccb..6a11a6f 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java @@ -55,7 +55,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class LayoutEvents { - public static final String MODULE = LayoutEvents.class.getName(); + private static final String MODULE = LayoutEvents.class.getName(); public static final String err_resource = "ContentErrorUiLabels"; public static String createLayoutImage(HttpServletRequest request, HttpServletResponse response) { 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 a3302bc..1fb4c85 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 @@ -44,7 +44,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public final class LayoutWorker { - public static final String MODULE = LayoutWorker.class.getName(); + private static final String MODULE = LayoutWorker.class.getName(); private static final String err_resource = "ContentErrorUiLabels"; private LayoutWorker() {} 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 15437fe..03dec4b 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 @@ -85,7 +85,7 @@ public class OutputServices { public final static String MODULE = OutputServices.class.getName(); protected static final FoFormRenderer foFormRenderer = new FoFormRenderer(); - public static final String resource = "ContentUiLabels"; + private static final String RESOURCE = "ContentUiLabels"; public static Map<String, Object> sendPrintFromScreen(DispatchContext dctx, Map<String, ? extends Object> serviceContext) { Locale locale = (Locale) serviceContext.get("locale"); @@ -166,11 +166,11 @@ public class OutputServices { printer = printServices[0]; Debug.logInfo("Using printer: " + printer.getName(), MODULE); if (!printer.isDocFlavorSupported(psInFormat)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPrinterNotSupportDocFlavorFormat", UtilMisc.toMap("psInFormat", psInFormat, "printerName", printer.getName()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPrinterNotSupportDocFlavorFormat", UtilMisc.toMap("psInFormat", psInFormat, "printerName", printer.getName()), locale)); } } if (printer == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPrinterNotFound", UtilMisc.toMap("printerName", printerName), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPrinterNotFound", UtilMisc.toMap("printerName", printerName), locale)); } } else { @@ -183,7 +183,7 @@ public class OutputServices { } if (printer == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPrinterNotAvailable", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPrinterNotAvailable", locale)); } PrintRequestAttributeSet praset = new HashPrintRequestAttributeSet(); @@ -198,7 +198,7 @@ public class OutputServices { job.print(myDoc, praset); } catch (PrintException | IOException | TemplateException | GeneralException | SAXException | ParserConfigurationException e) { Debug.logError(e, "Error rendering [" + contentType + "]: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale)); } return ServiceUtil.returnSuccess(); @@ -270,7 +270,7 @@ public class OutputServices { } catch (IOException | TemplateException | GeneralException | SAXException | ParserConfigurationException e) { Debug.logError(e, "Error rendering [" + contentType + "]: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentRenderingError", UtilMisc.toMap("contentType", contentType, "errorString", e.toString()), locale)); } return ServiceUtil.returnSuccess(); 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 2e7bdb6..a729d29 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 @@ -69,8 +69,8 @@ import com.lowagie.text.pdf.PdfWriter; public class PdfSurveyServices { - public static final String MODULE = PdfSurveyServices.class.getName(); - public static final String resource = "ContentUiLabels"; + private static final String MODULE = PdfSurveyServices.class.getName(); + private static final String RESOURCE = "ContentUiLabels"; /** * @@ -209,7 +209,7 @@ public class PdfSurveyServices { } } catch (GeneralException | DocumentException | IOException e) { Debug.logError(e, "Error generating PDF: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } Map<String, Object> results = ServiceUtil.returnSuccess(); @@ -272,7 +272,7 @@ public class PdfSurveyServices { s.close(); } catch (GeneralException | DocumentException | IOException e) { Debug.logError(e, "Error generating PDF: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } Map<String, Object> results = ServiceUtil.returnSuccess(); @@ -530,7 +530,7 @@ public class PdfSurveyServices { } } catch (IOException | GenericServiceException e) { Debug.logError(e, "Error generating PDF: " + e.toString(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } return results; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyEvents.java index a91d177..26b8bcd 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyEvents.java @@ -32,7 +32,7 @@ import org.apache.ofbiz.service.*; */ public class SurveyEvents { - public static final String MODULE = SurveyEvents.class.getName(); + private static final String MODULE = SurveyEvents.class.getName(); public static String createSurveyResponseAndRestoreParameters(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java b/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java index f7e0d1a..a515d78 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java @@ -60,7 +60,7 @@ import freemarker.template.TemplateException; */ public class SurveyWrapper { - public static final String MODULE = SurveyWrapper.class.getName(); + private static final String MODULE = SurveyWrapper.class.getName(); protected Delegator delegator = null; protected String responseId = null; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java b/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java index e63a7c0..74a2f89 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/view/SimpleContentViewHandler.java @@ -53,7 +53,7 @@ import org.apache.ofbiz.webapp.website.WebSiteWorker; public class SimpleContentViewHandler extends AbstractViewHandler { - public static final String MODULE = SimpleContentViewHandler.class.getName(); + private static final String MODULE = SimpleContentViewHandler.class.getName(); private String rootDir = null; private String https = null; @@ -149,7 +149,7 @@ public class SimpleContentViewHandler extends AbstractViewHandler { fileName = dataResource.getString("dataResourceName").replace(" ", "_"); // spaces in filenames can be a problem } - // see if data resource is public or not + // see if data RESOURCE is public or not String isPublic = dataResource.getString("isPublic"); if (UtilValidate.isEmpty(isPublic)) { isPublic = "N"; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java index 8c5e6af..c15392f 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java @@ -51,7 +51,7 @@ import freemarker.template.TransformControl; */ public class CheckPermissionTransform implements TemplateTransformModel { - public static final String MODULE = CheckPermissionTransform.class.getName(); + private static final String MODULE = CheckPermissionTransform.class.getName(); static final String [] saveKeyNames = {"globalNodeTrail", "nodeTrail", "mode", "purposeTypeId", "statusId", "entityOperation", "targetOperation" }; public static final String [] removeKeyNames = {}; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java index 09c75dc..6d117d5 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java @@ -49,7 +49,7 @@ import freemarker.template.TemplateTransformModel; */ public class EditRenderSubContentCacheTransform implements TemplateTransformModel { - public static final String MODULE = EditRenderSubContentCacheTransform.class.getName(); + private static final String MODULE = EditRenderSubContentCacheTransform.class.getName(); static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly"}; /** diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java index b054c2b..0a45d14 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java @@ -48,7 +48,7 @@ import freemarker.template.TemplateTransformModel; */ public class EditRenderSubContentTransform implements TemplateTransformModel { - public static final String MODULE = EditRenderSubContentTransform.class.getName(); + private static final String MODULE = EditRenderSubContentTransform.class.getName(); /** * @deprecated use FreeMarkerWorker.getWrappedObject() diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java index faba2e1..7d8a190 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java @@ -44,7 +44,7 @@ import freemarker.template.TransformControl; */ public class InjectNodeTrailCsvTransform implements TemplateTransformModel { - public static final String MODULE = InjectNodeTrailCsvTransform.class.getName(); + private static final String MODULE = InjectNodeTrailCsvTransform.class.getName(); static final String[] saveKeyNames = { "nodeTrailCsv", "globalNodeTrail", "nodeTrail" }; static final String[] removeKeyNames = { "nodeTrailCsv" }; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java index be0f512..6567ce1 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java @@ -54,7 +54,7 @@ import freemarker.template.TransformControl; */ public class LimitedSubContentCacheTransform implements TemplateTransformModel { - public static final String MODULE = LimitedSubContentCacheTransform.class.getName(); + private static final String MODULE = LimitedSubContentCacheTransform.class.getName(); static final String[] upSaveKeyNames = { "globalNodeTrail" }; static final String[] saveKeyNames = { "contentId", "subContentId", "entityList", "entityIndex", 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 801081f..83e2fb3 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 @@ -51,7 +51,7 @@ import freemarker.template.TransformControl; */ public class LoopSubContentTransform implements TemplateTransformModel { - public static final String MODULE = LoopSubContentTransform.class.getName(); + 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"}; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java index 6ebbce2..2036bba 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java @@ -44,7 +44,7 @@ import freemarker.template.TemplateTransformModel; */ public class RenderContentAndSubContent implements TemplateTransformModel { - public static final String MODULE = RenderContentAndSubContent.class.getName(); + private static final String MODULE = RenderContentAndSubContent.class.getName(); @Override @SuppressWarnings("unchecked") diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java index d6b07e0..4412525 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java @@ -51,7 +51,7 @@ import freemarker.template.TemplateTransformModel; */ public class RenderContentAsText implements TemplateTransformModel { - public static final String MODULE = RenderContentAsText.class.getName(); + private static final String MODULE = RenderContentAsText.class.getName(); static final String [] upSaveKeyNames = {"globalNodeTrail"}; static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"}; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java index fa5cc98..4c44f1f 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentTransform.java @@ -49,7 +49,7 @@ import freemarker.template.TemplateTransformModel; */ public class RenderContentTransform implements TemplateTransformModel { - public static final String MODULE = RenderContentTransform.class.getName(); + private static final String MODULE = RenderContentTransform.class.getName(); @Override @SuppressWarnings("unchecked") diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java index 21507e0..843553c 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java @@ -47,7 +47,7 @@ import freemarker.template.TemplateTransformModel; */ public class RenderSubContentAsText implements TemplateTransformModel { - public static final String MODULE = RenderSubContentAsText.class.getName(); + private static final String MODULE = RenderSubContentAsText.class.getName(); public static final String [] upSaveKeyNames = {"globalNodeTrail"}; public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"}; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java index 58357b3..e95cd65 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java @@ -51,7 +51,7 @@ import freemarker.template.TemplateTransformModel; */ public class RenderSubContentCacheTransform implements TemplateTransformModel { - public static final String MODULE = RenderSubContentCacheTransform.class.getName(); + private static final String MODULE = RenderSubContentCacheTransform.class.getName(); static final String[] upSaveKeyNames = { "globalNodeTrail" }; @Override diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java index 330d6cd..3bc14cc 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java @@ -49,7 +49,7 @@ import freemarker.template.TemplateTransformModel; */ public class RenderSubContentTransform implements TemplateTransformModel { - public static final String MODULE = RenderSubContentTransform.class.getName(); + private static final String MODULE = RenderSubContentTransform.class.getName(); /** * @deprecated use FreeMarkerWorker.getArg() diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java index b074639..3d3e15e 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java @@ -48,7 +48,7 @@ import freemarker.template.TransformControl; */ public class TraverseSubContentCacheTransform implements TemplateTransformModel { - public static final String MODULE = TraverseSubContentCacheTransform.class.getName(); + private static final String MODULE = TraverseSubContentCacheTransform.class.getName(); static final String [] upSaveKeyNames = {"globalNodeTrail"}; static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"}; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java index 822753d..388b3c6 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java @@ -51,7 +51,7 @@ import freemarker.template.TransformControl; */ public class TraverseSubContentTransform implements TemplateTransformModel { - public static final String MODULE = TraverseSubContentTransform.class.getName(); + private static final String MODULE = TraverseSubContentTransform.class.getName(); public static final String [] saveKeyNames = {"contentId", "subContentId", "mimeType", "subContentDataResourceView", "wrapTemplateId", "templateContentId", "pickWhen", "followWhen", "returnAfterPickWhen", "returnBeforePickWhen", "indent"}; public static final String [] removeKeyNames = {"templateContentId", "subDataResourceTypeId", "mapKey", "wrappedFTL", "nodeTrail"}; 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 2517951..8f920e9 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 @@ -48,7 +48,7 @@ import freemarker.template.TemplateTransformModel; */ public class WrapSubContentCacheTransform implements TemplateTransformModel { - public static final String MODULE = WrapSubContentCacheTransform.class.getName(); + private static final String MODULE = WrapSubContentCacheTransform.class.getName(); static final String [] upSaveKeyNames = {"globalNodeTrail"}; static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly"}; 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 3d58a87..7ea8f9a 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 @@ -38,8 +38,8 @@ import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.party.party.PartyHelper; public class HumanResEvents { - public static final String MODULE = HumanResEvents.class.getName(); - public static final String resourceError = "HumanResErrorUiLabels"; + private static final String MODULE = HumanResEvents.class.getName(); + private static final String RES_ERROR = "HumanResErrorUiLabels"; // Please note : the structure of map in this function is according to the JSON data map of the jsTree public static String getChildHRCategoryTree(HttpServletRequest request, HttpServletResponse response){ 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 ceec3c4..4dc5d91 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 @@ -40,7 +40,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public final class BOMHelper { - public static final String MODULE = BOMHelper.class.getName(); + private static final String MODULE = BOMHelper.class.getName(); /** Creates a new instance of BOMHelper */ private BOMHelper() { 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 6b38c70..04f900e 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 @@ -46,7 +46,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class BOMNode { - public static final String MODULE = BOMNode.class.getName(); + private static final String MODULE = BOMNode.class.getName(); protected LocalDispatcher dispatcher = null; protected Delegator delegator = null; 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 b19ef96..cdca7c2 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 @@ -50,8 +50,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class BOMServices { - public static final String MODULE = BOMServices.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = BOMServices.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; /** Returns the product's low level code (llc) i.e. the maximum depth * in which the productId can be found in any of the @@ -88,7 +88,7 @@ public class BOMServices { bomTypes.add(bomTypesValue.getString("productAssocTypeId")); } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } else { bomTypes.add(bomType); @@ -104,7 +104,7 @@ public class BOMServices { } } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningMaxDethAlgorithm", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } result.put("depth", (long) maxDepth); @@ -200,9 +200,9 @@ public class BOMServices { } } } catch (GenericEntityException|GenericServiceException ge) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", ge.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", ge.getMessage()), locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningUpdateLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); } result.put("lowLevelCode", llc); return result; @@ -244,9 +244,9 @@ public class BOMServices { } // FIXME: also all the variants llc should be updated? } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningInitLowLevelCode", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return result; } @@ -276,7 +276,7 @@ public class BOMServices { try { duplicatedProductAssoc = BOMHelper.searchDuplicatedAncestor(productId, productIdKey, bomType, fromDate, delegator, dispatcher, userLogin); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorRunningDuplicatedAncestorSearch", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorRunningDuplicatedAncestorSearch", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } result.put("duplicatedProductAssoc", duplicatedProductAssoc); return result; @@ -323,7 +323,7 @@ public class BOMServices { try { tree = new BOMTree(productId, bomType, fromDate, type, delegator, dispatcher, userLogin); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } if (quantity != null) { tree.setRootQuantity(quantity); @@ -388,7 +388,7 @@ public class BOMServices { tree.print(components, excludeWIPs); if (components.size() > 0) components.remove(0); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } // // Product routing @@ -471,7 +471,7 @@ public class BOMServices { tree.setRootAmount(amount); tree.print(components); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } for (BOMNode oneComponent : components) { if (!oneComponent.isManufactured()) { @@ -496,17 +496,17 @@ public class BOMServices { try { List<GenericValue> packages = EntityQuery.use(delegator).from("ShipmentPackage").where("shipmentId", shipmentId).queryList(); if (UtilValidate.isNotEmpty(packages)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomPackageAlreadyFound", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomPackageAlreadyFound", locale)); } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorLoadingShipmentPackages", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorLoadingShipmentPackages", locale)); } // ShipmentItems are loaded List<GenericValue> shipmentItems = null; try { shipmentItems = EntityQuery.use(delegator).from("ShipmentItem").where("shipmentId", shipmentId).queryList(); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorLoadingShipmentItems", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorLoadingShipmentItems", locale)); } Map<String, Object> orderReadHelpers = new HashMap<>(); Map<String, Object> partyOrderShipments = new HashMap<>(); @@ -519,7 +519,7 @@ public class BOMServices { "shipmentItemSeqId", shipmentItem.get("shipmentItemSeqId")) .queryFirst(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } if (orderShipment != null && !orderReadHelpers.containsKey(orderShipment.getString("orderId"))) { orderReadHelpers.put(orderShipment.getString("orderId"), new OrderReadHelper(delegator, orderShipment.getString("orderId"))); @@ -555,10 +555,10 @@ public class BOMServices { try { serviceResult = dispatcher.runSync("getProductsInPackages", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } List<BOMNode> productsInPackages = UtilGenerics.cast(serviceResult.get("productsInPackages")); if (productsInPackages.size() == 1) { @@ -603,7 +603,7 @@ public class BOMServices { try { boxType = EntityQuery.use(delegator).from("ShipmentBoxType").where("shipmentBoxTypeId", boxTypeId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } boxTypes.put(boxTypeId, boxType); List<Map<String, Object>> box = new LinkedList<>(); @@ -623,7 +623,7 @@ public class BOMServices { try { product = orderItem.getRelatedOne("Product", false); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } String boxTypeId = product.getString("shipmentBoxTypeId"); if (boxTypeId != null) { @@ -632,7 +632,7 @@ public class BOMServices { try { boxType = EntityQuery.use(delegator).from("ShipmentBoxType").where("shipmentBoxTypeId", boxTypeId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } boxTypes.put(boxTypeId, boxType); @@ -677,7 +677,7 @@ public class BOMServices { try { product = orderItem.getRelatedOne("Product", false); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } quantity = orderShipment.getBigDecimal("quantity"); } @@ -716,7 +716,7 @@ public class BOMServices { } shipmentPackageSeqId = (String)serviceResult.get("shipmentPackageSeqId"); } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } totalWidth = BigDecimal.ZERO; } @@ -738,10 +738,10 @@ public class BOMServices { } Map<String, Object> serviceResult = dispatcher.runSync("createShipmentPackageContent", inputMap); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingPackageConfiguratorError", locale)); } totalWidth = totalWidth.add(qty.multiply(productDepth)); if (qty.compareTo(maxQuantity) == 0) shipmentPackageSeqId = null; @@ -794,7 +794,7 @@ public class BOMServices { tree.setRootQuantity(quantity); tree.getProductsInPackages(components); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } result.put("productsInPackages", components); 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 f197c6c..9cccfee 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 @@ -47,8 +47,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ProductionRun { - public static final String MODULE = ProductionRun.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = ProductionRun.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; protected GenericValue productionRun; // WorkEffort (PROD_ORDER_HEADER) protected GenericValue productionRunProduct; // WorkEffortGoodStandard (type: PRUN_PROD_DELIV) 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 619b7d4..d411b19 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 @@ -40,7 +40,7 @@ import org.apache.ofbiz.service.ServiceUtil; public class ProductionRunEvents { - public static final String MODULE = ProductionRunEvents.class.getName(); + private static final String MODULE = ProductionRunEvents.class.getName(); public static String productionRunDeclareAndProduce(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); 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 20141ce..9b9bbb7 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 @@ -39,7 +39,7 @@ import org.apache.ofbiz.service.LocalDispatcher; */ public final class ProductionRunHelper { - public static final String MODULE = ProductionRunHelper.class.getName(); + private static final String MODULE = ProductionRunHelper.class.getName(); private ProductionRunHelper() {} 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 df2e74c..1a10c4a 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 @@ -65,10 +65,10 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ProductionRunServices { - public static final String MODULE = ProductionRunServices.class.getName(); - public static final String resource = "ManufacturingUiLabels"; - public static final String resourceOrder = "OrderErrorUiLabels"; - public static final String resourceProduct = "ProductUiLabels"; + private static final String MODULE = ProductionRunServices.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; + private static final String RES_ORDER = "OrderErrorUiLabels"; + private static final String RES_PRODUCT = "ProductUiLabels"; public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals"); public static final RoundingMode rounding = UtilNumber.getRoundingMode("finaccount.rounding"); @@ -91,7 +91,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotExists", locale)); } String currentStatusId = productionRun.getGenericValue().getString("currentStatusId"); @@ -104,7 +104,7 @@ public class ProductionRunServices { for (int i = 1; i < mandatoryWorkEfforts.size(); i++) { GenericValue mandatoryWorkEffort = (mandatoryWorkEfforts.get(i)).getGenericValue(); if (!("PRUN_CANCELLED".equals(mandatoryWorkEffort.getString("currentStatusId")))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunFound", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunFound", locale)); } } Map<String, Object> serviceContext = new HashMap<>(); @@ -157,18 +157,18 @@ public class ProductionRunServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problem accessing WorkEffortGoodStandard entity", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } catch (Exception e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotBeCancelled", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCannotBeCancelled", locale)); } /** @@ -212,7 +212,7 @@ public class ProductionRunServices { // Find the product product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (product == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductNotExist", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductNotExist", locale)); } } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); @@ -238,10 +238,10 @@ public class ProductionRunServices { Debug.logWarning(gse.getMessage(), MODULE); } if (routing == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductRoutingNotExist", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductRoutingNotExist", locale)); } if (UtilValidate.isEmpty(routingTaskAssocs)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingHasNoRoutingTask", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingHasNoRoutingTask", locale)); } // ------------------- @@ -436,7 +436,7 @@ public class ProductionRunServices { } result.put("productionRunId", productionRunId); result.put("estimatedCompletionDate", startDate); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } @@ -542,7 +542,7 @@ public class ProductionRunServices { if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } BigDecimal quantity = (BigDecimal) context.get("quantity"); @@ -581,20 +581,20 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the setEstimatedDeliveryDates service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } } return ServiceUtil.returnSuccess(); } else { Debug.logError("productionRun.store() fail for productionRunId ="+productionRunId,MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } } Debug.logError("no productionRun for productionRunId ="+productionRunId,MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } Debug.logError("service updateProductionRun call with productionRunId empty",MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } public static Map<String, Object> changeProductionRunStatus(DispatchContext ctx, Map<String, ? extends Object> context) { @@ -609,13 +609,13 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotExists", locale)); } String currentStatusId = productionRun.getGenericValue().getString("currentStatusId"); if (currentStatusId.equals(statusId)) { result.put("newStatusId", currentStatusId); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); return result; } @@ -630,11 +630,11 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } // change the production run tasks status to PRUN_SCHEDULED for (GenericValue task : productionRun.getProductionRunRoutingTasks()) { @@ -645,15 +645,15 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } result.put("newStatusId", statusId); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_CLOSED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_CLOSED"), locale)); return result; } @@ -668,11 +668,11 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } // change the production run tasks status to PRUN_DOC_PRINTED for (GenericValue task : productionRun.getProductionRunRoutingTasks()) { @@ -683,15 +683,15 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } result.put("newStatusId", "PRUN_DOC_PRINTED"); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } @@ -711,11 +711,11 @@ public class ProductionRunServices { if (!("PRUN_COMPLETED".equals(mandatoryWorkEffort.getString("currentStatusId")) || "PRUN_RUNNING".equals(mandatoryWorkEffort.getString("currentStatusId")) || "PRUN_CLOSED".equals(mandatoryWorkEffort.getString("currentStatusId")))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunNotCompleted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunNotCompleted", locale)); } } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } Map<String, Object> serviceContext = new HashMap<>(); @@ -727,14 +727,14 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } result.put("newStatusId", "PRUN_RUNNING"); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } @@ -751,14 +751,14 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } result.put("newStatusId", "PRUN_COMPLETED"); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } @@ -773,11 +773,11 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } // change the production run tasks status to PRUN_CLOSED for (GenericValue task : productionRun.getProductionRunRoutingTasks()) { @@ -788,19 +788,19 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } result.put("newStatusId", "PRUN_CLOSED"); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_CLOSED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_CLOSED"), locale)); return result; } result.put("newStatusId", currentStatusId); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); return result; } @@ -821,7 +821,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotExists", locale)); } List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); GenericValue theTask = null; @@ -842,7 +842,7 @@ public class ProductionRunServices { } } if (theTask == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } String currentStatusId = theTask.getString("currentStatusId"); @@ -851,7 +851,7 @@ public class ProductionRunServices { if (statusId != null && currentStatusId.equals(statusId)) { result.put("oldStatusId", oldStatusId); result.put("newStatusId", currentStatusId); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); return result; } @@ -861,10 +861,10 @@ public class ProductionRunServices { // change the production run task status to PRUN_RUNNING // if necessary change the production run (header) status to PRUN_RUNNING if (!allPrecTaskCompletedOrRunning) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotStartPrevTasksNotCompleted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskCannotStartPrevTasksNotCompleted", locale)); } if ("PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotStartDocsNotPrinted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskCannotStartDocsNotPrinted", locale)); } Map<String, Object> serviceContext = new HashMap<>(); serviceContext.clear(); @@ -875,11 +875,11 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } if (!"PRUN_RUNNING".equals(productionRun.getGenericValue().getString("currentStatusId"))) { serviceContext.clear(); @@ -889,16 +889,16 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("changeProductionRunStatus", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } result.put("oldStatusId", oldStatusId); result.put("newStatusId", "PRUN_RUNNING"); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } @@ -918,15 +918,15 @@ public class ProductionRunServices { serviceContext.put("userLogin", userLogin); serviceResult = dispatcher.runSync("issueProductionRunTask", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } // change only the production run task status to PRUN_COMPLETED @@ -966,11 +966,11 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("updateWorkEffort", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } // Calculate and store the production run task actual costs serviceContext.clear(); @@ -979,11 +979,11 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("createProductionRunTaskCosts", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the createProductionRunTaskCosts service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } // If this is the last task, then the production run is marked as 'completed' if (allTaskCompleted) { @@ -998,7 +998,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } // and compute the overhead costs associated to the finished product try { @@ -1012,7 +1012,7 @@ public class ProductionRunServices { } GenericValue partyAccountingPreference = (GenericValue)outputMap.get("partyAccountingPreference"); if (partyAccountingPreference == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale)); } outputMap = dispatcher.runSync("getProductionRunCost", UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", productionRunId)); if (ServiceUtil.isError(outputMap)) { @@ -1058,20 +1058,20 @@ public class ProductionRunServices { } } } catch(GenericServiceException gse) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", gse.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", gse.getMessage()), locale)); } catch(Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindOverheadCosts", UtilMisc.toMap("errorString", e.getMessage()), locale)); } } result.put("oldStatusId", oldStatusId); result.put("newStatusId", "PRUN_COMPLETED"); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusChanged",UtilMisc.toMap("newStatusId", "PRUN_DOC_PRINTED"), locale)); return result; } result.put("oldStatusId", oldStatusId); result.put("newStatusId", currentStatusId); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskStatusChanged",UtilMisc.toMap("newStatusId", currentStatusId), locale)); return result; } @@ -1083,7 +1083,7 @@ public class ProductionRunServices { try { GenericValue workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", workEffortId).queryOne(); if (workEffort == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingWorkEffortNotExist", locale) + " " + workEffortId); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingWorkEffortNotExist", locale) + " " + workEffortId); } // Get all the valid CostComponents entries List<GenericValue> costComponents = EntityQuery.use(delegator).from("CostComponent") @@ -1104,7 +1104,7 @@ public class ProductionRunServices { result.put("totalCost", totalCost); result.put("totalCostNoMaterials", totalCostNoMaterials); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCostsForWorkEffort", UtilMisc.toMap("workEffortId", workEffortId, "errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCostsForWorkEffort", UtilMisc.toMap("workEffortId", workEffortId, "errorString", gee.getMessage()), locale)); } return result; } @@ -1140,11 +1140,11 @@ public class ProductionRunServices { } result.put("totalCost", totalCost); } catch (GenericEntityException exc) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); } catch (GenericServiceException exc) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); } catch (Exception exc) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale) + " " + workEffortId + " " + exc.getMessage()); } return result; } @@ -1160,7 +1160,7 @@ public class ProductionRunServices { try { GenericValue workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", productionRunTaskId).queryOne(); if (UtilValidate.isEmpty(workEffort)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotFound", UtilMisc.toMap("productionRunTaskId", productionRunTaskId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotFound", UtilMisc.toMap("productionRunTaskId", productionRunTaskId), locale)); } double actualTotalMilliSeconds = 0.0; Double actualSetupMillis = workEffort.getDouble("actualSetupMillis"); @@ -1269,9 +1269,9 @@ public class ProductionRunServices { } } } catch (GenericEntityException|GenericServiceException ge) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateRoutingCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); } // materials costs: these are the costs derived from the materials used by the production run task try { @@ -1304,9 +1304,9 @@ public class ProductionRunServices { } } } catch (GenericEntityException|GenericServiceException ge) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", ge.getMessage()), locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToCreateMaterialsCosts", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "errorString", e.getMessage()), locale)); } return ServiceUtil.returnSuccess(); } @@ -1338,7 +1338,7 @@ public class ProductionRunServices { if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate"); @@ -1350,7 +1350,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); } } @@ -1360,7 +1360,7 @@ public class ProductionRunServices { for (Iterator<GenericValue> iter = pRRoutingTasks.iterator(); iter.hasNext();) { GenericValue routingTask = iter.next(); if (priority.equals(routingTask.get("priority")) && ! routingTaskId.equals(routingTask.get("workEffortId"))) - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskSeqIdAlreadyExist", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingTaskSeqIdAlreadyExist", locale)); if (routingTaskId.equals(routingTask.get("workEffortId"))) { routingTask.set("estimatedSetupMillis", ((BigDecimal) context.get("estimatedSetupMillis")).doubleValue()); routingTask.set("estimatedMilliSeconds", ( (BigDecimal) context.get("estimatedMilliSeconds")).doubleValue()); @@ -1375,7 +1375,7 @@ public class ProductionRunServices { // update the routingTask List and re-read it to be able to have it sorted with the new value if (! productionRun.store()) { Debug.logError("productionRun.store(), in routingTask.priority update, fail for productionRunId ="+productionRunId,MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } productionRun.clearRoutingTasksList(); } @@ -1388,14 +1388,14 @@ public class ProductionRunServices { return ServiceUtil.returnSuccess(); } else { Debug.logError("productionRun.store() fail for productionRunId ="+productionRunId,MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } } Debug.logError("no productionRun for productionRunId ="+productionRunId,MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } Debug.logError("service updateProductionRun call with productionRunId empty",MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotUpdated", locale)); } public static Map<String, Object> addProductionRunComponent(DispatchContext ctx, Map<String, ? extends Object> context) { @@ -1415,12 +1415,12 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); if (UtilValidate.isEmpty(tasks)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } if (workEffortId != null) { @@ -1433,7 +1433,7 @@ public class ProductionRunServices { } } if (!found) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } } else { workEffortId = EntityUtil.getFirst(tasks).getString("workEffortId"); @@ -1443,7 +1443,7 @@ public class ProductionRunServices { // Find the product GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (product == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductNotExist", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductNotExist", locale)); } } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); @@ -1465,9 +1465,9 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the createWorkEffortGoodStandard service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotAdded", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunComponentNotAdded", locale)); } - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunComponentAdded",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } @@ -1488,12 +1488,12 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); List<GenericValue> components = productionRun.getProductionRunComponents(); if (UtilValidate.isEmpty(components)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunComponentNotExists", locale)); } if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } boolean found = false; @@ -1513,14 +1513,14 @@ public class ProductionRunServices { } } if (!found) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } try { // Find the product GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); if (product == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductNotExist", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductNotExist", locale)); } } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); @@ -1543,9 +1543,9 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffortGoodStandard service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentNotAdded", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunComponentNotAdded", locale)); } - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunComponentUpdated",UtilMisc.toMap("productionRunId", productionRunId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunComponentUpdated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } @@ -1578,18 +1578,18 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); BigDecimal pRQuantity = productionRun.getQuantity(); if (pRQuantity == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunPrinted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } if (estimatedStartDate != null) { Timestamp pRestimatedStartDate = productionRun.getEstimatedStartDate(); if (pRestimatedStartDate.after(estimatedStartDate)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingTaskStartDateBeforePRun", locale)); } } @@ -1599,11 +1599,11 @@ public class ProductionRunServices { routingTask = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", routingTaskId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingTaskNotExists", locale)); } if (routingTask == null) { Debug.logError("Routing task: " + routingTaskId + " is null.", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingTaskNotExists", locale)); } if (workEffortName == null) { @@ -1651,7 +1651,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the createWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale)); } String productionRunTaskId = (String) serviceResult.get("workEffortId"); if (Debug.infoOn()) Debug.logInfo("ProductionRunTaskId created: " + productionRunTaskId, MODULE); @@ -1659,7 +1659,7 @@ public class ProductionRunServices { productionRun.setEstimatedCompletionDate(productionRun.recalculateEstimatedCompletionDate()); if (!productionRun.store()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingAddProductionRunRoutingTaskNotCreated", locale)); } // copy date valid WorkEffortPartyAssignments from the routing task to the run task @@ -1736,10 +1736,10 @@ public class ProductionRunServices { // The last task is loaded GenericValue lastTask = productionRun.getLastProductionRunRoutingTask(); if (lastTask == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } if ("WIP".equals(productionRun.getProductProduced().getString("productTypeId"))) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductIsWIP", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductIsWIP", locale)); } BigDecimal quantityProduced = productionRun.getGenericValue().getBigDecimal("quantityProduced"); @@ -1764,7 +1764,7 @@ public class ProductionRunServices { } // if (quantity.compareTo(maxQuantity) > 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunProductProducedNotStillAvailable", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunProductProducedNotStillAvailable", locale)); } if (lotId == null && autoCreateLot) { @@ -1784,7 +1784,7 @@ public class ProductionRunServices { } lotId = (String) serviceResults.get("lotId"); } else if (UtilValidate.isNotEmpty(lotId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingLotNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingLotNotExists", locale)); } } } catch (GenericEntityException e) { @@ -1816,7 +1816,7 @@ public class ProductionRunServices { } GenericValue partyAccountingPreference = (GenericValue)outputMap.get("partyAccountingPreference"); if (partyAccountingPreference == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToFindCosts", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale)); } outputMap = dispatcher.runSync("getProductCost", UtilMisc.<String, Object>toMap("userLogin", userLogin, "productId", productionRun.getProductProduced().getString("productId"), "currencyUomId", (String)partyAccountingPreference.get("baseCurrencyUomId"), "costComponentTypePrefix", "EST_STD")); if (ServiceUtil.isError(outputMap)) { @@ -2001,7 +2001,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the updateWorkEffort service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } result.put("quantity", quantity); @@ -2034,7 +2034,7 @@ public class ProductionRunServices { } BigDecimal minimumQuantityProducedByTask = quantityProduced.add(quantity); if (minimumQuantityProducedByTask.compareTo(quantityToProduce) > 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingQuantityProducedIsHigherThanQuantityDeclared", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingQuantityProducedIsHigherThanQuantityDeclared", locale)); } List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); @@ -2060,7 +2060,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } } @@ -2075,7 +2075,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } return result; } @@ -2268,7 +2268,7 @@ public class ProductionRunServices { } } if (quantity.compareTo(totalIssued.subtract(totalReturned)) > 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotReturnMoreItems", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "quantity", quantity, "quantityAllocated", totalIssued.subtract(totalReturned)), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskCannotReturnMoreItems", UtilMisc.toMap("productionRunTaskId", productionRunTaskId, "quantity", quantity, "quantityAllocated", totalIssued.subtract(totalReturned)), locale)); } } catch (GenericEntityException gee) { return ServiceUtil.returnError(gee.getMessage()); @@ -2283,7 +2283,7 @@ public class ProductionRunServices { "productId", productId, "quantity", quantity, "lotId", lotId, "currencyUomId", uomId, "isReturned", "Y", "inventoryItemTypeId", inventoryItemTypeId, "userLogin", userLogin)); if (ServiceUtil.isError(inventoryResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskProduceError" + ServiceUtil.getErrorMessage(inventoryResult), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskProduceError" + ServiceUtil.getErrorMessage(inventoryResult), locale)); } } catch (GenericServiceException exc) { return ServiceUtil.returnError(exc.getMessage()); @@ -2337,7 +2337,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotExists", locale)); } List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); GenericValue theTask = null; @@ -2350,13 +2350,13 @@ public class ProductionRunServices { } } if (theTask == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } String currentStatusId = theTask.getString("currentStatusId"); if (!"PRUN_RUNNING".equals(currentStatusId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskNotRunning", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotRunning", locale)); } BigDecimal quantityProduced = theTask.getBigDecimal("quantityProduced"); @@ -2476,7 +2476,7 @@ public class ProductionRunServices { } if (requirement == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRequirementNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRequirementNotExists", locale)); } try { Map<String, Object> serviceResult = dispatcher.runSync("updateRequirement", @@ -2487,7 +2487,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRequirementNotUpdated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRequirementNotUpdated", locale)); } return ServiceUtil.returnSuccess(); } @@ -2512,7 +2512,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(errMsg); } if (requirement == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRequirementNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRequirementNotExists", locale)); } if (!"INTERNAL_REQUIREMENT".equals(requirement.getString("requirementTypeId"))) { return ServiceUtil.returnSuccess(); @@ -2542,10 +2542,10 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("createProductionRunsForProductBom", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale) + ": " + ServiceUtil.getErrorMessage(serviceResult)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale) + ": " + ServiceUtil.getErrorMessage(serviceResult)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale) + ": " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale) + ": " + e.getMessage()); } if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); @@ -2554,7 +2554,7 @@ public class ProductionRunServices { String productionRunId = (String)serviceResult.get("productionRunId"); result.put("productionRunId", productionRunId); - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } @@ -2574,14 +2574,14 @@ public class ProductionRunServices { String orderItemSeqId = (String)context.get("orderItemSeqId"); if (config == null && configId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingConfigurationNotAvailable", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingConfigurationNotAvailable", locale)); } if (config == null && configId != null) { // TODO: load the configuration - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunFromConfigurationNotYetImplemented", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunFromConfigurationNotYetImplemented", locale)); } if (!config.isCompleted()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunFromConfigurationNotValid", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunFromConfigurationNotValid", locale)); } if (quantity == null) { quantity = BigDecimal.ONE; @@ -2604,10 +2604,10 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("createProductionRun", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } String productionRunId = (String)serviceResult.get("productionRunId"); result.put("productionRunId", productionRunId); @@ -2643,7 +2643,7 @@ public class ProductionRunServices { "productAssocTypeId", "MANUF_COMPONENT") .filterByDate().queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTryToGetBomListError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTryToGetBomListError", locale)); } // if so create a mandatory predecessor to this production run if (UtilValidate.isNotEmpty(bomList)) { @@ -2664,9 +2664,9 @@ public class ProductionRunServices { "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", "fromDate", UtilDateTime.nowTimestamp())); workEffortPreDecessor.create(); } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTryToCreateWorkEffortAssoc", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTryToCreateWorkEffortAssoc", locale)); } } else { @@ -2712,10 +2712,10 @@ public class ProductionRunServices { try { serviceResult = dispatcher.runSync("addProductionRunComponent", serviceContext); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } } try { @@ -2723,10 +2723,10 @@ public class ProductionRunServices { delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId)); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRequirementNotDeleted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRequirementNotDeleted", locale)); } - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCreated",UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } @@ -2749,17 +2749,17 @@ public class ProductionRunServices { GenericValue productStore = delegator.getRelatedOne("ProductStore", order, false); isImmediatelyFulfilled = "Y".equals(productStore.getString("isImmediatelyFulfilled")); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); } GenericValue orderItem = null; try { orderItem = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); } if (orderItem == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunForMarketingPackagesOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), locale)); } if (orderItem.get("quantity") == null) { Debug.logWarning("No quantity found for orderItem [" + orderItem +"], skipping production run of this marketing package", MODULE); @@ -2823,7 +2823,7 @@ public class ProductionRunServices { UtilMisc.toMap("workEffortId", productionRunIdForRemainingQty, "orderId", orderId, "orderItemSeqId", orderItemSeqId)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); @@ -2845,7 +2845,7 @@ public class ProductionRunServices { try { delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunForMarketingPackagesCreationError", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "errorString", e.getMessage()), locale)); } try { @@ -2865,10 +2865,10 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } - result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "ManufacturingProductionRunCreated", UtilMisc.toMap("productionRunId", productionRunId), locale)); + result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCreated", UtilMisc.toMap("productionRunId", productionRunId), locale)); return result; } else { if (Debug.verboseOn()) { Debug.logVerbose("There are not enough components available to produce any marketing packages [" + orderItem.getString("productId") + "]", MODULE); } @@ -2879,7 +2879,7 @@ public class ProductionRunServices { return ServiceUtil.returnSuccess(); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotCreated", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } } @@ -2918,23 +2918,23 @@ public class ProductionRunServices { orderItem = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); } if (orderItem == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderErrorOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", ""), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderErrorOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", ""), locale)); } if (quantity != null) { orderItem.set("quantity", quantity); } orderItems = UtilMisc.toList(orderItem); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } else { try { orderItems = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderId).queryList(); if (orderItems == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderErrorOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", ""), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderErrorOrderItemNotFound", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", ""), locale)); } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } List<String> productionRuns = new LinkedList<>(); @@ -2992,7 +2992,7 @@ public class ProductionRunServices { continue; } } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturinWorkOrderItemFulfillmentError", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturinWorkOrderItemFulfillmentError", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } try { List<BOMNode> components = new LinkedList<>(); @@ -3002,7 +3002,7 @@ public class ProductionRunServices { tree.print(components); productionRuns.add(tree.createManufacturingOrders(null, fromDate, null, null, null, orderId, orderItem.getString("orderItemSeqId"), shipGroupSeqId, shipmentId, userLogin)); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } result.put("productionRuns" , productionRuns); @@ -3034,10 +3034,10 @@ public class ProductionRunServices { tree.print(components); workEffortId = tree.createManufacturingOrders(facilityId, startDate, workEffortName, description, routingId, null, null, null, null, userLogin); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } if (workEffortId == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunIsNotRequiredForProductId", UtilMisc.toMap("productId", productId, "startDate", startDate), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunIsNotRequiredForProductId", UtilMisc.toMap("productId", productId, "startDate", startDate), locale)); } List<String> productionRuns = new LinkedList<>(); result.put("productionRuns" , productionRuns); @@ -3079,7 +3079,7 @@ public class ProductionRunServices { } currentStatusId = (String)serviceResult.get("newStatusId"); if (currentStatusId.equals(prevStatusId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunUnableToProgressTaskStatus", UtilMisc.toMap("prevStatusId", prevStatusId, "taskId", taskId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToProgressTaskStatus", UtilMisc.toMap("prevStatusId", prevStatusId, "taskId", taskId), locale)); } else { prevStatusId = currentStatusId; } @@ -3087,13 +3087,13 @@ public class ProductionRunServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problem accessing the WorkEffort entity", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } catch (Exception e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } return result; } @@ -3116,7 +3116,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotExists", locale)); } List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); GenericValue oneTask = null; @@ -3135,7 +3135,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the quickRunProductionRunTask service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } return result; @@ -3152,7 +3152,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (!productionRun.exist()) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunNotExists", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotExists", locale)); } List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); GenericValue oneTask = null; @@ -3175,7 +3175,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunTaskStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } } } @@ -3262,7 +3262,7 @@ public class ProductionRunServices { } } catch (GenericServiceException e) { Debug.logError(e, "Problem calling the changeProductionRunStatus service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunStatusNotChanged", locale)); } return result; } @@ -3313,7 +3313,7 @@ public class ProductionRunServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problem calling the getProductionRunTotResQty service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionResQtyCalc", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionResQtyCalc", locale)); } result.put("reservedQuantity", totQty); return result; @@ -3329,14 +3329,14 @@ public class ProductionRunServices { try { GenericValue inventoryItem = EntityQuery.use(delegator).from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne(); if (inventoryItem == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductInventoryItemNotFound", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_PRODUCT, "ProductInventoryItemNotFound", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale)); } if (inventoryItem.get("availableToPromiseTotal") != null && inventoryItem.getBigDecimal("availableToPromiseTotal").compareTo(ZERO) <= 0) { return ServiceUtil.returnSuccess(); } GenericValue product = inventoryItem.getRelatedOne("Product", false); if (product == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceProduct, "ProductProductNotFound", locale) + " " + inventoryItem.get("productId")); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_PRODUCT, "ProductProductNotFound", locale) + " " + inventoryItem.get("productId")); } if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_AUTO")) { Map<String, Object> serviceContext = UtilMisc.toMap("inventoryItemId", inventoryItemId, @@ -3374,7 +3374,7 @@ public class ProductionRunServices { GenericValue inventoryItem = EntityQuery.use(delegator).from("InventoryItem") .where("inventoryItemId", inventoryItemId).queryOne(); if (inventoryItem == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCannotDecomposingInventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId), locale)); } // the work effort (disassemble order) is created Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("workEffortTypeId", "TASK", @@ -3402,7 +3402,7 @@ public class ProductionRunServices { } BigDecimal issuedQuantity = (BigDecimal)serviceResult.get("quantityIssued"); if (issuedQuantity.compareTo(ZERO) == 0) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoMarketingPackagesFound", UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCannotDecomposingInventoryItemNoMarketingPackagesFound", UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")), locale)); } // get the package's unit cost to compute a cost coefficient ratio which is the marketing package's actual unit cost divided by its standard cost // this ratio will be used to determine the cost of the marketing package components when they are returned to inventory @@ -3440,7 +3440,7 @@ public class ProductionRunServices { } List<Map<String, Object>> components = UtilGenerics.cast(serviceResult.get("componentsMap")); if (UtilValidate.isEmpty(components)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound", UtilMisc.toMap("productId", inventoryItem.getString("productId")), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound", UtilMisc.toMap("productId", inventoryItem.getString("productId")), locale)); } for (Map<String, Object> component : components) { // get the component's standard cost @@ -3631,7 +3631,7 @@ public class ProductionRunServices { } } catch (GenericEntityException e) { Debug.logError(e, "Error", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunErrorRunningSetEstimatedDeliveryDates", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunErrorRunningSetEstimatedDeliveryDates", locale)); } return ServiceUtil.returnSuccess(); } 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 21dc530..7c7470e 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 @@ -35,8 +35,8 @@ import org.apache.ofbiz.service.ServiceUtil; public class InventoryEventPlannedServices { - public static final String MODULE = InventoryEventPlannedServices.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = InventoryEventPlannedServices.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; /** * @@ -59,7 +59,7 @@ public class InventoryEventPlannedServices { 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); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); + 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 9a7f4e5..5b4ae31 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 @@ -57,8 +57,8 @@ import com.ibm.icu.util.Calendar; */ public class MrpServices { - public static final String MODULE = MrpServices.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = MrpServices.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; public static Map<String, Object> initMrpEvents(DispatchContext ctx, Map<String, ? extends Object> context) { Delegator delegator = ctx.getDelegator(); @@ -77,14 +77,14 @@ public class MrpServices { listResult = EntityQuery.use(delegator).from("MrpEvent").queryList(); } catch (GenericEntityException e) { Debug.logError(e,"Error : findList(\"MrpEvent\", null, null, null, null, false)", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + 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); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventRemoveError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventRemoveError", locale)); } } @@ -96,7 +96,7 @@ public class MrpServices { "statusId", "REQ_PROPOSED") .queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } List<GenericValue> requirementStatus = new ArrayList<>(); if (listResult != null) { @@ -109,7 +109,7 @@ public class MrpServices { delegator.removeAll(requirementStatus); delegator.removeAll(listResult); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventRemoveError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventRemoveError", locale)); } } try { @@ -118,7 +118,7 @@ public class MrpServices { "statusId", "REQ_PROPOSED") .queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } if (listResult != null) { try { @@ -128,7 +128,7 @@ public class MrpServices { delegator.removeAll(requirementStatus); delegator.removeAll(listResult); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventRemoveError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventRemoveError", locale)); } } @@ -154,7 +154,7 @@ public class MrpServices { "facilityId", facilityId) .orderBy("orderId").queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } for (GenericValue genericResult : resultList) { String productId = genericResult.getString("productId"); @@ -201,7 +201,7 @@ public class MrpServices { try { InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("orderId") + "-" + genericResult.getString("orderItemSeqId"), false, delegator); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "SALES_ORDER_SHIP"), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "SALES_ORDER_SHIP"), locale)); } } // ---------------------------------------- @@ -214,7 +214,7 @@ public class MrpServices { "facilityId", facilityId) .queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } for (GenericValue genericResult : resultList) { String productId = genericResult.getString("productId"); @@ -231,7 +231,7 @@ public class MrpServices { try { InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("requirementId"), false, delegator); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "PROD_REQ_RECP"), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "PROD_REQ_RECP"), locale)); } } @@ -256,7 +256,7 @@ public class MrpServices { .queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } for (GenericValue genericResult : resultList) { try { @@ -304,7 +304,7 @@ public class MrpServices { 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) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "PUR_ORDER_RECP"), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "PUR_ORDER_RECP"), locale)); } } @@ -343,7 +343,7 @@ public class MrpServices { InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, eventName, false, delegator); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "MANUF_ORDER_REQ"), locale) + " " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "MANUF_ORDER_REQ"), locale) + " " + e.getMessage()); } // ---------------------------------------- @@ -385,7 +385,7 @@ public class MrpServices { InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, genericResult.getString("workEffortId"), false, delegator); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "MANUF_ORDER_RECP"), locale) + " " + e.getMessage()); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "MANUF_ORDER_RECP"), locale) + " " + e.getMessage()); } // ---------------------------------------- @@ -397,7 +397,7 @@ public class MrpServices { .queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Unable to retrieve ProductFacility records.", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindProductFacility", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindProductFacility", locale)); } for (GenericValue genericResult : resultList) { String productId = genericResult.getString("productId"); @@ -414,7 +414,7 @@ public class MrpServices { } } catch (GenericEntityException e) { Debug.logError(e, "Unable to count MrpEvent records.", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotCountRecords", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotCountRecords", locale)); } BigDecimal qoh = findProductMrpQoh(mrpId, productId, facilityId, dispatcher, delegator); if (qoh.compareTo(minimumStock) >= 0) { @@ -424,7 +424,7 @@ public class MrpServices { try { InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, BigDecimal.ZERO, null, null, false, delegator); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "REQUIRED_MRP"), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "REQUIRED_MRP"), locale)); } } @@ -435,7 +435,7 @@ public class MrpServices { try { facility = EntityQuery.use(delegator).from("Facility").where("facilityId", facilityId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } String partyId = (String)facility.get("ownerPartyId"); try { @@ -443,7 +443,7 @@ public class MrpServices { .where("organizationPartyId", partyId) .queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindSalesForecasts", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindSalesForecasts", locale)); } for (GenericValue genericResult : resultList) { String customTimePeriodId = genericResult.getString("customTimePeriodId"); @@ -451,7 +451,7 @@ public class MrpServices { try { customTimePeriod = EntityQuery.use(delegator).from("CustomTimePeriod").where("customTimePeriodId", customTimePeriodId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindCustomTimePeriod", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindCustomTimePeriod", locale)); } if (customTimePeriod != null) { if (UtilValidate.isNotEmpty(customTimePeriod.getTimestamp("thruDate")) && customTimePeriod.getTimestamp("thruDate").before(UtilDateTime.nowTimestamp())) { @@ -463,7 +463,7 @@ public class MrpServices { .where("salesForecastId", genericResult.get("salesForecastId")) .queryList(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindSalesForecastDetails", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindSalesForecastDetails", locale)); } for (GenericValue sfd : salesForecastDetails) { String productId = sfd.getString("productId"); @@ -476,7 +476,7 @@ public class MrpServices { try { InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, eventQuantityTmp, null, sfd.getString("salesForecastDetailId"), false, delegator); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "SALES_FORECAST"), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventProblemInitializing", UtilMisc.toMap("mrpEventTypeId", "SALES_FORECAST"), locale)); } } } @@ -604,17 +604,17 @@ public class MrpServices { String facilityId = (String)context.get("facilityId"); String manufacturingFacilityId = null; if (UtilValidate.isEmpty(facilityId) && UtilValidate.isEmpty(facilityGroupId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpFacilityNotAvailable", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpFacilityNotAvailable", locale)); } if (UtilValidate.isEmpty(facilityId)) { try { GenericValue facilityGroup = EntityQuery.use(delegator).from("FacilityGroup").where("facilityGroupId", facilityGroupId).queryOne(); if (UtilValidate.isEmpty(facilityGroup)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpFacilityGroupIsNotValid", UtilMisc.toMap("facilityGroupId", facilityGroupId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpFacilityGroupIsNotValid", UtilMisc.toMap("facilityGroupId", facilityGroupId), locale)); } List<GenericValue> facilities = facilityGroup.getRelated("FacilityGroupMember", null, UtilMisc.toList("sequenceNum"), false); if (UtilValidate.isEmpty(facilities)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpFacilityGroupIsNotAssociatedToFacility", UtilMisc.toMap("facilityGroupId", facilityGroupId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpFacilityGroupIsNotAssociatedToFacility", UtilMisc.toMap("facilityGroupId", facilityGroupId), locale)); } for (GenericValue facilityMember : facilities) { GenericValue facility = facilityMember.getRelatedOne("Facility", false); @@ -626,14 +626,14 @@ public class MrpServices { } } } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpFacilityGroupCannotBeLoad", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpFacilityGroupCannotBeLoad", UtilMisc.toMap("errorString", e.getMessage()), locale)); } } else { manufacturingFacilityId = facilityId; } if (UtilValidate.isEmpty(facilityId) || UtilValidate.isEmpty(manufacturingFacilityId)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpFacilityOrManufacturingFacilityNotAvailable", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpFacilityOrManufacturingFacilityNotAvailable", locale)); } int bomLevelWithNoEvent = 0; @@ -668,7 +668,7 @@ public class MrpServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorRunningInitMrpEvents", UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorRunningInitMrpEvents", UtilMisc.toMap("errorString", e.getMessage()), locale)); } long bomLevel = 0; do { @@ -688,7 +688,7 @@ public class MrpServices { .queryList(); } catch (GenericEntityException e) { Long bomLevelToString = bomLevel; - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorForBomLevel", UtilMisc.toMap("bomLevel", bomLevelToString.toString(), "errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorForBomLevel", UtilMisc.toMap("bomLevel", bomLevelToString.toString(), "errorString", e.getMessage()), locale)); } if (UtilValidate.isNotEmpty(listInventoryEventForMRP)) { @@ -710,7 +710,7 @@ public class MrpServices { product = inventoryEventForMRP.getRelatedOne("Product", true); productFacility = EntityUtil.getFirst(product.getRelated("ProductFacility", UtilMisc.toMap("facilityId", facilityId), null, true)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindProductForEvent", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindProductForEvent", locale)); } stockTmp = findProductMrpQoh(mrpId, product, facilityId, dispatcher, delegator); try { @@ -719,7 +719,7 @@ public class MrpServices { "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)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); } // days to ship is only relevant for sales order to plan for preparatory days to ship. Otherwise MRP will push event dates for manufacturing parts // as well and cause problems @@ -743,9 +743,9 @@ public class MrpServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResponse)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); } components = UtilGenerics.cast(serviceResponse.get("components")); if (UtilValidate.isNotEmpty(components)) { @@ -780,9 +780,9 @@ public class MrpServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResponse)); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); } catch (Exception e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpErrorExplodingProduct", UtilMisc.toMap("productId", product.getString("productId")), locale)); } components = UtilGenerics.cast(serviceResponse.get("components")); String routingId = (String)serviceResponse.get("workEffortId"); @@ -790,7 +790,7 @@ public class MrpServices { try { routing = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", routingId).queryOne(); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindProductForEvent", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCannotFindProductForEvent", locale)); } } else { routing = null; @@ -828,7 +828,7 @@ public class MrpServices { try { InventoryEventPlannedServices.createOrUpdateMrpEvent(eventMap, proposedOrder.getQuantity(), null, eventName, (proposedOrder.getRequirementStartDate().compareTo(now) < 0), delegator); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpCreateOrUpdateEvent", UtilMisc.toMap("parameters", parameters), locale)); } // stockTmp = stockTmp.add(proposedOrder.getQuantity()); 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 8b436ba..9e467bc 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 @@ -49,8 +49,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class ProposedOrder { - public static final String MODULE = ProposedOrder.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = ProposedOrder.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; protected GenericValue product; protected boolean isBuilt; diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java index f59ccb8..0a948bb 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java @@ -40,8 +40,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class RoutingServices { - public static final String MODULE = RoutingServices.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = RoutingServices.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; /** * Computes the estimated time needed to perform the task. @@ -70,7 +70,7 @@ public class RoutingServices { try { task = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", taskId).queryOne(); } catch (GenericEntityException gee) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingRoutingErrorFindingTask", UtilMisc.toMap("taskId", taskId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingRoutingErrorFindingTask", UtilMisc.toMap("taskId", taskId), locale)); } // FIXME: the ProductionRun.getEstimatedTaskTime(...) method will be removed and // its logic will be implemented inside this method. 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 845b694..2503f68 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 @@ -50,8 +50,8 @@ import com.ibm.icu.util.Calendar; */ public class TechDataServices { - public static final String MODULE = TechDataServices.class.getName(); - public static final String resource = "ManufacturingUiLabels"; + private static final String MODULE = TechDataServices.class.getName(); + private static final String RESOURCE = "ManufacturingUiLabels"; /** * @@ -87,7 +87,7 @@ public class TechDataServices { .queryList(); } catch (GenericEntityException e) { Debug.logWarning(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingTechDataWorkEffortNotExist", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingTechDataWorkEffortNotExist", UtilMisc.toMap("errorString", e.toString()), locale)); } if (listRoutingTask == null) { listRoutingTask = new LinkedList<>(); @@ -131,7 +131,7 @@ public class TechDataServices { .queryList(); } catch (GenericEntityException e) { Debug.logWarning(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingTechDataWorkEffortAssocNotExist", UtilMisc.toMap("errorString", e.toString()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingTechDataWorkEffortAssocNotExist", UtilMisc.toMap("errorString", e.toString()), locale)); } if (listRoutingTaskAssoc != null) { diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/marketing/MarketingServices.java b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/marketing/MarketingServices.java index 0f665b9..83818b8 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/marketing/MarketingServices.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/marketing/MarketingServices.java @@ -43,9 +43,9 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class MarketingServices { - public static final String MODULE = MarketingServices.class.getName(); + private static final String MODULE = MarketingServices.class.getName(); public static final String resourceMarketing = "MarketingUiLabels"; - public static final String resourceOrder = "OrderUiLabels"; + private static final String RES_ORDER = "OrderUiLabels"; public static Map<String, Object> signUpForContactList(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -103,7 +103,7 @@ public class MarketingServices { throw new GenericServiceException(ServiceUtil.getErrorMessage(serviceResults)); } } catch (GenericEntityException e) { - String error = UtilProperties.getMessage(resourceOrder, "checkhelper.problems_reading_database", locale); + String error = UtilProperties.getMessage(RES_ORDER, "checkhelper.problems_reading_database", locale); Debug.logInfo(e, error + e.getMessage(), MODULE); return ServiceUtil.returnError(error); } catch (GenericServiceException e) { diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java index e8f3b1c..d82c66d 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java @@ -32,7 +32,7 @@ import org.apache.ofbiz.entity.util.EntityUtil; */ public final class ReportHelper { - public static final String MODULE = ReportHelper.class.getName(); + private static final String MODULE = ReportHelper.class.getName(); private ReportHelper() {} diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java index 85d004c..f935381 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java @@ -47,7 +47,7 @@ import org.apache.ofbiz.webapp.website.WebSiteWorker; */ public class TrackingCodeEvents { - public static final String MODULE = TrackingCodeEvents.class.getName(); + private static final String MODULE = TrackingCodeEvents.class.getName(); /** If TrackingCode monitoring is desired this event should be added to the list * of events that run on every request. This event looks for the parameter diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java index 4ecd723..45017fe 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java @@ -65,8 +65,8 @@ import ezvcard.property.StructuredName; import ezvcard.property.Telephone; public class VCard { - public static final String MODULE = VCard.class.getName(); - public static final String resourceError = "MarketingUiLabels"; + private static final String MODULE = VCard.class.getName(); + private static final String RES_ERROR = "MarketingUiLabels"; /** * import a vcard from byteBuffer. the reader use is ez-vcard, see official site https://github.com/mangstadt/ez-vcard/ @@ -161,8 +161,8 @@ public class VCard { serviceCtx.put("emailAddress", emailAddr); } else { //TODO change uncorrect labellisation - String emailFormatErrMsg = UtilProperties.getMessage(resourceError, "SfaImportVCardEmailFormatError", locale); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "MarketingEmailFormatError", UtilMisc.toMap("firstName", structuredName.getGiven(), "lastName", structuredName.getFamily(), "emailFOrmatErrMsg", emailFormatErrMsg), locale)); + String emailFormatErrMsg = UtilProperties.getMessage(RES_ERROR, "SfaImportVCardEmailFormatError", locale); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "MarketingEmailFormatError", UtilMisc.toMap("firstName", structuredName.getGiven(), "lastName", structuredName.getFamily(), "emailFOrmatErrMsg", emailFormatErrMsg), locale)); } } @@ -223,7 +223,7 @@ public class VCard { } } catch (IOException | GenericEntityException | GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "SfaImportVCardError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } result.put("partiesCreated", partiesCreated); @@ -293,14 +293,14 @@ public class VCard { Ezvcard.write(vcard).go(file); } catch (FileNotFoundException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "SfaExportVCardErrorOpeningFile", UtilMisc.toMap("errorString", file.getAbsolutePath()), locale)); } catch (IOException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "SfaExportVCardErrorWritingFile", UtilMisc.toMap("errorString", file.getAbsolutePath()), locale)); } catch (GenericEntityException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "SfaExportVCardError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } return ServiceUtil.returnSuccess(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java index e5ca4c5..a9b2680 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java @@ -53,8 +53,8 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class OrderManagerEvents { - public static final String MODULE = OrderManagerEvents.class.getName(); - public static final String resource_error = "OrderErrorUiLabels"; + private static final String MODULE = OrderManagerEvents.class.getName(); + private static final String RES_ERROR = "OrderErrorUiLabels"; // FIXME: this event doesn't seem to be used; we may want to remove it public static String processOfflinePayments(HttpServletRequest request, HttpServletResponse response) { @@ -74,7 +74,7 @@ public class OrderManagerEvents { placingCustomer = EntityQuery.use(delegator).from("OrderRole").where("orderId", orderId, "roleTypeId", "PLACING_CUSTOMER").queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up order payment preferences", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderErrorProcessingOfflinePayments", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderErrorProcessingOfflinePayments", locale)); return "error"; } if (paymentPrefs != null) { @@ -107,7 +107,7 @@ public class OrderManagerEvents { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logError(e, "Problems storing payment information", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemStoringReceivedPaymentInformation", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemStoringReceivedPaymentInformation", locale)); return "error"; } @@ -134,7 +134,7 @@ public class OrderManagerEvents { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Problems reading order header from datasource.", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsReadingOrderHeaderInformation", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsReadingOrderHeaderInformation", locale)); return "error"; } @@ -150,12 +150,12 @@ public class OrderManagerEvents { paymentMethodTypes = EntityQuery.use(delegator).from("PaymentMethodType").where(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE")).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problems getting payment types", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsWithPaymentTypeLookup", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithPaymentTypeLookup", locale)); return "error"; } if (paymentMethodTypes == null) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsWithPaymentTypeLookup", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithPaymentTypeLookup", locale)); return "error"; } @@ -165,7 +165,7 @@ public class OrderManagerEvents { paymentMethods = EntityQuery.use(delegator).from("PaymentMethod").where("partyId", partyId).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problems getting payment methods", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsWithPaymentMethodLookup", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithPaymentMethodLookup", locale)); return "error"; } @@ -174,7 +174,7 @@ public class OrderManagerEvents { placingCustomer = EntityQuery.use(delegator).from("OrderRole").where("orderId", orderId, "roleTypeId", "PLACING_CUSTOMER").queryFirst(); } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up order payment preferences", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderErrorProcessingOfflinePayments", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderErrorProcessingOfflinePayments", locale)); return "error"; } @@ -187,7 +187,7 @@ public class OrderManagerEvents { try { paymentMethodAmount = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(paymentMethodAmountStr, "BigDecimal", null, locale); } catch (GeneralException e) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsPaymentParsingAmount", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsPaymentParsingAmount", locale)); return "error"; } if (paymentMethodAmount.compareTo(BigDecimal.ZERO) > 0) { @@ -227,7 +227,7 @@ public class OrderManagerEvents { try { paymentTypeAmount = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(amountStr, "BigDecimal", null, locale); } catch (GeneralException e) { - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemsPaymentParsingAmount", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemsPaymentParsingAmount", locale)); return "error"; } if (paymentTypeAmount.compareTo(BigDecimal.ZERO) > 0) { @@ -317,7 +317,7 @@ public class OrderManagerEvents { delegator.storeAll(toBeStored); } catch (GenericEntityException e) { Debug.logError(e, "Problems storing payment information", MODULE); - request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error, "OrderProblemStoringReceivedPaymentInformation", locale)); + request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "OrderProblemStoringReceivedPaymentInformation", locale)); return "error"; } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java index 8acef4b..8f18868 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java @@ -44,7 +44,7 @@ import org.apache.ofbiz.entity.util.EntityQuery; */ public class FinAccountHelper { - public static final String MODULE = FinAccountHelper.class.getName(); + private static final String MODULE = FinAccountHelper.class.getName(); /** * A word on precision: since we're just adding and subtracting, the interim figures should have one more decimal place of precision than the final numbers. */ diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderChangeHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderChangeHelper.java index 1b43ec4..f38a12c 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderChangeHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderChangeHelper.java @@ -38,7 +38,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public final class OrderChangeHelper { - public static final String MODULE = OrderChangeHelper.class.getName(); + private static final String MODULE = OrderChangeHelper.class.getName(); private OrderChangeHelper() {} diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderContentWrapper.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderContentWrapper.java index ebe2baa..54495d3 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderContentWrapper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderContentWrapper.java @@ -48,7 +48,7 @@ import org.apache.ofbiz.service.LocalDispatcher; */ public class OrderContentWrapper implements ContentWrapper { - public static final String MODULE = OrderContentWrapper.class.getName(); + private static final String MODULE = OrderContentWrapper.class.getName(); public static final String SEPARATOR = "::"; // cache key separator private static final UtilCache<String, String> orderContentCache = UtilCache.createUtilCache("order.content", true); // use soft reference to free up memory if needed diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java index 9583294..36bbc41 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderEvents.java @@ -48,7 +48,7 @@ import org.apache.ofbiz.service.ServiceUtil; */ public class OrderEvents { - public static final String MODULE = OrderEvents.class.getName(); + private static final String MODULE = OrderEvents.class.getName(); public static String downloadDigitalProduct(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderListState.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderListState.java index 927f341..0b7d7f2 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderListState.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderListState.java @@ -56,7 +56,7 @@ import org.apache.ofbiz.entity.util.EntityQuery; @SuppressWarnings("serial") public class OrderListState implements Serializable { - public static final String MODULE = OrderListState.class.getName(); + private static final String MODULE = OrderListState.class.getName(); public static final String SESSION_KEY = "__ORDER_LIST_STATUS__"; public static final String VIEW_SIZE_PARAM = "viewSize"; public static final String VIEW_INDEX_PARAM = "viewIndex"; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java index 8f14252..a7793b1 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderLookupServices.java @@ -59,7 +59,7 @@ import org.apache.ofbiz.widget.renderer.Paginator; */ public class OrderLookupServices { - public static final String MODULE = OrderLookupServices.class.getName(); + private static final String MODULE = OrderLookupServices.class.getName(); public static Map<String, Object> findOrders(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java index c944656..1e3b8a7 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java @@ -63,7 +63,7 @@ import org.apache.ofbiz.security.Security; */ public class OrderReadHelper { - public static final String MODULE = OrderReadHelper.class.getName(); + private static final String MODULE = OrderReadHelper.class.getName(); // scales and rounding modes for BigDecimal math public static final int scale = UtilNumber.getBigDecimalScale("order.decimals"); @@ -2802,7 +2802,7 @@ public class OrderReadHelper { } } } catch (GenericEntityException e) { - Debug.logError(e, OrderReturnServices.MODULE); + Debug.logError(e, MODULE); } return total; } 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 8f0a87b..330069e 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 @@ -69,10 +69,10 @@ import com.ibm.icu.util.Calendar; */ public class OrderReturnServices { - public static final String MODULE = OrderReturnServices.class.getName(); - public static final String resource = "OrderUiLabels"; - public static final String resource_error = "OrderErrorUiLabels"; - public static final String resourceProduct = "ProductUiLabels"; + private static final String MODULE = OrderReturnServices.class.getName(); + private static final String RESOURCE = "OrderUiLabels"; + private static final String RES_ERROR = "OrderErrorUiLabels"; + private static final String RES_PRODUCT = "ProductUiLabels"; // set some BigDecimal properties public static final int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); @@ -198,7 +198,7 @@ public class OrderReturnServices { returnHeader = EntityQuery.use(delegator).from("ReturnHeader").where("returnId", returnId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetReturnHeaderForID", UtilMisc.toMap("returnId",returnId), locale)); } @@ -214,7 +214,7 @@ public class OrderReturnServices { .queryList(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetReturnItemRecordsFromReturnHeader", locale)); } @@ -228,7 +228,7 @@ public class OrderReturnServices { orderHeader = firstItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetOrderHeaderFromReturnItem", locale)); } @@ -278,19 +278,19 @@ public class OrderReturnServices { sendResp = dispatcher.runSync("sendMailFromScreen", sendMap); if (ServiceUtil.isError(sendResp)) { sendResp.put("emailType", emailType); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemSendingEmail", locale), null, null, sendResp); } } catch (GenericServiceException e) { Debug.logError(e, "Problem sending mail", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemSendingEmail", locale)); } return ServiceUtil.returnSuccess(); } } - return ServiceUtil.returnFailure(UtilProperties.getMessage(resourceProduct, + return ServiceUtil.returnFailure(UtilProperties.getMessage(RES_PRODUCT, "ProductProductStoreEmailSettingsNotValid", UtilMisc.toMap("productStoreId", productStoreId, "emailType", emailType), locale)); @@ -417,7 +417,7 @@ public class OrderReturnServices { returnedItems = orderItem.getRelated("ReturnItem", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetReturnItemInformation", locale)); } if (UtilValidate.isEmpty(returnedItems)) { @@ -430,7 +430,7 @@ public class OrderReturnServices { returnHeader = returnItem.getRelatedOne("ReturnHeader", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetReturnHeaderFromItem", locale)); } String returnStatus = returnHeader.getString("statusId"); @@ -466,7 +466,7 @@ public class OrderReturnServices { orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetReturnItemInformation", locale)); } @@ -482,7 +482,7 @@ public class OrderReturnServices { orderItemQuantitiesIssued = EntityQuery.use(delegator).select("orderId", "orderItemSeqId", "quantityIssued").from("OrderItemQuantityReportGroupByItem").where(whereConditions).orderBy("orderItemSeqId").queryList(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetReturnHeaderFromItem", locale)); } @@ -493,7 +493,7 @@ public class OrderReturnServices { item = orderItemQuantityIssued.getRelatedOne("OrderItem", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetOrderItemInformation", locale)); } // items not issued/shipped are considered as returnable only if they are @@ -508,7 +508,7 @@ public class OrderReturnServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up returnable product type information", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetTheItemReturnableProduct", locale)); } } @@ -521,7 +521,7 @@ public class OrderReturnServices { } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetTheItemReturnableQuantity", locale)); } // Don't add the OrderItem to the map of returnable OrderItems if there isn't any returnable quantity. @@ -541,7 +541,7 @@ public class OrderReturnServices { product = item.getRelatedOne("Product", false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetOrderItemInformation", locale)); } } @@ -560,7 +560,7 @@ public class OrderReturnServices { itemAdjustments = item.getRelated("OrderAdjustment", null, null, false); } catch (GenericEntityException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToGetOrderAdjustmentsFromItem", locale)); } if (UtilValidate.isNotEmpty(itemAdjustments)) { @@ -575,11 +575,11 @@ public class OrderReturnServices { } } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorNoOrderItemsFound", locale)); } } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToFindOrderHeader", locale)); } @@ -606,7 +606,7 @@ public class OrderReturnServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up return information", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorGettingReturnHeaderItemInformation", locale)); } @@ -638,7 +638,7 @@ public class OrderReturnServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up returned product type information", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorGettingReturnHeaderItemInformation", locale)); } } @@ -658,12 +658,12 @@ public class OrderReturnServices { "statusId", "RETURN_RECEIVED", "userLogin", userLogin)); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToCreateReturnStatusHistory", locale)); } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToCreateReturnStatusHistory", locale)); } } else if (currentStatus != null && "RETURN_RECEIVED".equals(currentStatus)) { @@ -672,12 +672,12 @@ public class OrderReturnServices { "statusId", "RETURN_COMPLETED", "userLogin", userLogin)); if (ServiceUtil.isError(serviceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToCreateReturnStatusHistory", locale)); } } catch (GenericServiceException e) { Debug.logError(e, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorUnableToCreateReturnStatusHistory", locale)); } } @@ -709,7 +709,7 @@ public class OrderReturnServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up return information", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorGettingReturnHeaderItemInformation", locale)); } @@ -727,7 +727,7 @@ public class OrderReturnServices { serviceResult = dispatcher.runSync("checkPaymentAmountForRefund", UtilMisc.toMap("returnId", returnId)); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the checkPaymentAmountForRefund service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithCheckPaymentAmountForRefund", locale)); } if (ServiceUtil.isError(serviceResult)) { @@ -804,7 +804,7 @@ public class OrderReturnServices { Map<String, Object> results = createBillingAccountFromReturn(returnHeader, returnItems, dctx, context); if (ServiceUtil.isError(results)) { Debug.logError("Error creating BillingAccount: " + results.get(ModelService.ERROR_MESSAGE), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorWithCreateBillingAccount", locale) + results.get(ModelService.ERROR_MESSAGE)); } billingAccountId = (String) results.get("billingAccountId"); @@ -812,7 +812,7 @@ public class OrderReturnServices { // double check; make sure we have a billingAccount if (billingAccountId == null) { Debug.logError("No available billing account, none was created", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderNoAvailableBillingAccount", locale)); } } @@ -844,7 +844,7 @@ public class OrderReturnServices { createAccountResult = dispatcher.runSync("createFinAccountForStore", createAccountCtx); } catch (GenericServiceException e) { Debug.logError(e, "Problems running the createFinAccountForStore service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsCreatingFinAccountForStore", locale)); } if (ServiceUtil.isError(createAccountResult)) { @@ -855,7 +855,7 @@ public class OrderReturnServices { // double check; make sure we have a FinAccount if (finAccountId == null) { Debug.logError("No available fin account, none was created", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderNoAvailableFinAccount", locale)); } @@ -864,7 +864,7 @@ public class OrderReturnServices { finAccountRoleResult = dispatcher.runSync("createFinAccountRole", UtilMisc.toMap("finAccountId", finAccountId, "partyId", fromPartyId, "roleTypeId", "OWNER", "userLogin", userLogin)); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the createFinAccountRole service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingFinAccountRoleRecord", locale)); } if (ServiceUtil.isError(finAccountRoleResult)) { @@ -903,7 +903,7 @@ public class OrderReturnServices { finAccountTransResult = dispatcher.runSync("createFinAccountTrans", UtilMisc.toMap("finAccountId", finAccountId, "finAccountTransTypeId", "DEPOSIT", "partyId", toPartyId, "amount", creditTotal, "reasonEnumId", "FATR_REFUND", "userLogin", userLogin)); } catch (GenericServiceException e) { Debug.logError(e, "Problem creating FinAccountTrans record", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingFinAccountTransRecord", locale)); } if (ServiceUtil.isError(finAccountTransResult)) { @@ -933,7 +933,7 @@ public class OrderReturnServices { delegator.create(payment); } catch (GenericEntityException e) { Debug.logError(e, "Problem creating Payment record", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingPaymentRecord", locale)); } @@ -951,12 +951,12 @@ public class OrderReturnServices { try { serviceResults = dispatcher.runSync("createReturnItemResponse", itemResponse); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingReturnItemResponseRecord", locale), null, null, serviceResults); } } catch (GenericServiceException e) { Debug.logError(e, "Problem creating ReturnItemResponse record", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingReturnItemResponseRecord", locale)); } @@ -970,12 +970,12 @@ public class OrderReturnServices { try { serviceResults = dispatcher.runSync("updateReturnItem", returnItemMap); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemStoringReturnItemUpdates", locale), null, null, serviceResults); } } catch (GenericServiceException e) { Debug.logError(e, "Problem storing ReturnItem updates", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemStoringReturnItemUpdates", locale)); } } @@ -991,7 +991,7 @@ public class OrderReturnServices { delegator.create(pa); } catch (GenericEntityException e) { Debug.logError(e, "Problem creating PaymentApplication record for billing account", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingPaymentApplicationRecord", locale)); } @@ -1000,12 +1000,12 @@ public class OrderReturnServices { serviceResults = dispatcher.runSync("createPaymentApplicationsFromReturnItemResponse", UtilMisc.<String, Object>toMap("returnItemResponseId", itemResponseId, "userLogin", userLogin)); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingPaymentApplicationRecord", locale), null, null, serviceResults); } } catch (GenericServiceException e) { Debug.logError(e, "Problem creating PaymentApplication records for return invoice", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemCreatingPaymentApplicationRecord", locale)); } } @@ -1076,18 +1076,18 @@ public class OrderReturnServices { Map<String, Object> roleResults = dispatcher.runSync("createBillingAccountRole", input); if (ServiceUtil.isError(roleResults)) { Debug.logError("Error with createBillingAccountRole: " + roleResults.get(ModelService.ERROR_MESSAGE), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorWithCreateBillingAccountRole", locale) + roleResults.get(ModelService.ERROR_MESSAGE)); } return results; } catch (GenericEntityException e) { Debug.logError(e, "Entity error when creating BillingAccount: " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsCreatingBillingAccount", locale)); } catch (GenericServiceException e) { Debug.logError(e, "Service error when creating BillingAccount: " + e.getMessage(), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsCreatingBillingAccount", locale)); } } @@ -1107,7 +1107,7 @@ public class OrderReturnServices { orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false); } catch (GenericEntityException e) { Debug.logError("Problem looking up order information for orderId #" + orderId, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderCannotGetOrderHeader", locale)); } @@ -1139,7 +1139,7 @@ public class OrderReturnServices { serviceResult = dispatcher.runSync("processRefundReturn", UtilMisc.toMap("returnId", returnId, "returnTypeId", returnTypeId, "userLogin", userLogin)); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the processRefundReturn service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithTheRefundSeeLogs", locale)); } if (ServiceUtil.isError(serviceResult)) { @@ -1169,7 +1169,7 @@ public class OrderReturnServices { } } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up return information", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderErrorGettingReturnHeaderItemInformation", locale)); } @@ -1185,7 +1185,7 @@ public class OrderReturnServices { serviceResult = dispatcher.runSync("checkPaymentAmountForRefund", UtilMisc.toMap("returnId", returnId)); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the checkPaymentAmountForRefund service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithCheckPaymentAmountForRefund", locale)); } if (ServiceUtil.isError(serviceResult)) { @@ -1244,7 +1244,7 @@ public class OrderReturnServices { } } catch (GenericServiceException e) { Debug.logError(e, "Error retrieving PartyAcctgPreference for partyId " + productStore.get("payToPartyId"), MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithGetPartyAcctgPreferences", locale)); } orgAcctgPref = (GenericValue) acctgPreferencesResult.get("partyAccountingPreference"); @@ -1339,7 +1339,7 @@ public class OrderReturnServices { .cache(true).queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Cannot get PaymentMethodTypes", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "OrderOrderPaymentPreferencesCannotGetPaymentMethodTypes", UtilMisc.toMap("errorString", e.toString()), locale)); } @@ -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(resource_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(resource_error,"OrderProblemsWithTheRefundSeeLogs", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,"OrderProblemsWithTheRefundSeeLogs", locale)); } } else if ("EXT_BILLACT".equals(paymentMethodTypeId)) { try { @@ -1412,7 +1412,7 @@ public class OrderReturnServices { paymentId = (String) serviceResult.get("paymentId"); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the refundPayment service", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsWithTheRefundSeeLogs", locale)); } } else { @@ -1457,12 +1457,12 @@ public class OrderReturnServices { try { serviceResults = dispatcher.runSync("createReturnItemResponse", response); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsCreatingReturnItemResponseEntity", locale), null, null, serviceResults); } } catch (GenericServiceException e) { Debug.logError(e, "Problems creating new ReturnItemResponse entity", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemsCreatingReturnItemResponseEntity", locale)); } String responseId = (String) serviceResults.get("returnItemResponseId"); @@ -1473,12 +1473,12 @@ public class OrderReturnServices { try { serviceResults = dispatcher.runSync("updateReturnItem", returnItemMap); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemUpdatingReturnItemReturnItemResponseId", locale), null, null, serviceResults); } } catch (GenericServiceException e) { Debug.logError("Problem updating the ReturnItem entity", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemUpdatingReturnItemReturnItemResponseId", locale)); } @@ -1489,12 +1489,12 @@ public class OrderReturnServices { serviceResults = dispatcher.runSync("createPaymentApplicationsFromReturnItemResponse", UtilMisc.<String, Object>toMap("returnItemResponseId", responseId, "userLogin", userLogin)); if (ServiceUtil.isError(serviceResults)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemUpdatingReturnItemReturnItemResponseId", locale), null, null, serviceResults); } } catch (GenericServiceException e) { Debug.logError(e, "Problem creating PaymentApplication records for return invoice", MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, + return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderProblemUpdatingReturnItemReturnItemResponseId", locale)); ... 12207 lines suppressed ... |
Free forum by Nabble | Edit this page |