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 0524945 Improved: Corrected all checkstyle formatting issues: 'typecast' is not followed by whitespace in applications component. (OFBIZ-11887) 0524945 is described below commit 0524945bda30dd3603ee3202bf02bbead3d8bfdd Author: Suraj Khurana <[hidden email]> AuthorDate: Sat Jul 18 12:15:16 2020 +0530 Improved: Corrected all checkstyle formatting issues: 'typecast' is not followed by whitespace in applications component. (OFBIZ-11887) --- .../java/org/apache/ofbiz/accounting/GlEvents.java | 8 +- .../ofbiz/accounting/invoice/InvoiceServices.java | 26 ++--- .../ofbiz/accounting/invoice/InvoiceWorker.java | 4 +- .../accounting/ledger/GeneralLedgerServices.java | 4 +- .../accounting/payment/PaymentGatewayServices.java | 10 +- .../ofbiz/accounting/payment/PaymentWorker.java | 2 +- .../ofbiz/accounting/tax/TaxAuthorityServices.java | 6 +- .../authorizedotnet/AIMPaymentServices.java | 23 ++-- .../thirdparty/orbital/OrbitalPaymentServices.java | 14 +-- .../accounting/thirdparty/paypal/PayPalEvents.java | 15 ++- .../thirdparty/paypal/PayPalServices.java | 4 +- .../thirdparty/securepay/SecurePayServiceTest.java | 6 +- .../thirdparty/worldpay/WorldPayEvents.java | 2 +- .../ofbiz/accounting/util/UtilAccounting.java | 8 +- .../ofbiz/content/ContentManagementEvents.java | 42 ++++---- .../ofbiz/content/ContentManagementServices.java | 36 +++---- .../ofbiz/content/ContentManagementWorker.java | 96 ++++++++--------- .../ofbiz/content/compdoc/CompDocEvents.java | 22 ++-- .../ofbiz/content/compdoc/CompDocServices.java | 2 +- .../ofbiz/content/content/ContentMapFacade.java | 2 +- .../content/content/ContentPermissionServices.java | 10 +- .../ofbiz/content/content/ContentSearch.java | 2 +- .../content/content/ContentServicesComplex.java | 2 +- .../ofbiz/content/content/ContentWorker.java | 56 +++++----- .../ofbiz/content/content/PermissionRecorder.java | 20 ++-- .../content/content/UploadContentAndImage.java | 50 ++++----- .../org/apache/ofbiz/content/data/DataEvents.java | 8 +- .../ofbiz/content/data/DataResourceWorker.java | 2 +- .../apache/ofbiz/content/data/DataServices.java | 4 +- .../apache/ofbiz/content/layout/LayoutEvents.java | 2 +- .../apache/ofbiz/content/layout/LayoutWorker.java | 2 +- .../ofbiz/content/survey/PdfSurveyServices.java | 18 ++-- .../apache/ofbiz/content/survey/SurveyWrapper.java | 4 +- .../content/view/SimpleContentViewHandler.java | 2 +- .../webapp/ftl/CheckPermissionTransform.java | 26 ++--- .../ftl/EditRenderSubContentCacheTransform.java | 10 +- .../webapp/ftl/InjectNodeTrailCsvTransform.java | 12 +-- .../ftl/LimitedSubContentCacheTransform.java | 4 +- .../webapp/ftl/LoopSubContentTransform.java | 6 +- .../webapp/ftl/RenderContentAndSubContent.java | 8 +- .../content/webapp/ftl/RenderContentAsText.java | 18 ++-- .../content/webapp/ftl/RenderContentTransform.java | 10 +- .../content/webapp/ftl/RenderSubContentAsText.java | 20 ++-- .../webapp/ftl/RenderSubContentCacheTransform.java | 34 +++--- .../ftl/TraverseSubContentCacheTransform.java | 36 +++---- .../webapp/ftl/TraverseSubContentTransform.java | 38 +++---- .../webapp/ftl/WrapSubContentCacheTransform.java | 12 +-- .../org/apache/ofbiz/humanres/HumanResEvents.java | 10 +- .../apache/ofbiz/manufacturing/bom/BOMHelper.java | 2 +- .../apache/ofbiz/manufacturing/bom/BOMNode.java | 12 +-- .../ofbiz/manufacturing/bom/BOMServices.java | 16 +-- .../apache/ofbiz/manufacturing/bom/BOMTree.java | 2 +- .../manufacturing/jobshopmgt/ProductionRun.java | 8 +- .../jobshopmgt/ProductionRunEvents.java | 14 +-- .../jobshopmgt/ProductionRunServices.java | 119 ++++++++++----------- .../ofbiz/manufacturing/mrp/MrpServices.java | 26 ++--- .../ofbiz/manufacturing/mrp/ProposedOrder.java | 6 +- .../manufacturing/techdata/TechDataServices.java | 10 +- .../ofbiz/marketing/report/ReportHelper.java | 4 +- .../java/org/apache/ofbiz/sfa/vcard/VCard.java | 8 +- .../org/apache/ofbiz/order/order/OrderEvents.java | 2 +- .../apache/ofbiz/order/order/OrderReadHelper.java | 10 +- .../ofbiz/order/order/OrderReturnServices.java | 10 +- .../apache/ofbiz/order/order/OrderServices.java | 68 ++++++------ .../apache/ofbiz/order/quote/QuoteServices.java | 2 +- .../order/requirement/RequirementServices.java | 12 +-- .../ofbiz/order/shoppingcart/CheckOutEvents.java | 6 +- .../ofbiz/order/shoppingcart/CheckOutHelper.java | 10 +- .../ofbiz/order/shoppingcart/ShoppingCart.java | 34 +++--- .../order/shoppingcart/ShoppingCartEvents.java | 36 +++---- .../order/shoppingcart/ShoppingCartHelper.java | 4 +- .../ofbiz/order/shoppingcart/ShoppingCartItem.java | 58 +++++----- .../order/shoppingcart/ShoppingCartServices.java | 14 +-- .../ofbiz/order/shoppingcart/WebShoppingCart.java | 2 +- .../shoppingcart/product/ProductDisplayWorker.java | 2 +- .../shoppingcart/product/ProductPromoWorker.java | 28 ++--- .../shoppingcart/shipping/ShippingEvents.java | 2 +- .../apache/ofbiz/order/test/OrderTestServices.java | 2 +- .../apache/ofbiz/order/test/PurchaseOrderTest.java | 18 ++-- .../communication/CommunicationEventServices.java | 20 ++-- .../party/party/PartyRelationshipServices.java | 4 +- .../apache/ofbiz/party/party/PartyServices.java | 80 +++++++------- .../org/apache/ofbiz/party/party/PartyWorker.java | 4 +- .../ofbiz/product/catalog/CatalogWorker.java | 3 +- .../ofbiz/product/category/CategoryServices.java | 2 +- .../ofbiz/product/category/CategoryWorker.java | 4 +- .../ofbiz/product/category/ftl/SeoTransform.java | 4 +- .../ofbiz/product/config/ProductConfigWorker.java | 16 +-- .../ofbiz/product/config/ProductConfigWrapper.java | 8 +- .../product/feature/ProductFeatureServices.java | 2 +- .../org/apache/ofbiz/product/image/ScaleImage.java | 2 +- .../ofbiz/product/imagemanagement/FrameImage.java | 12 +-- .../imagemanagement/ImageManagementServices.java | 2 +- .../apache/ofbiz/product/price/PriceServices.java | 20 ++-- .../apache/ofbiz/product/product/KeywordIndex.java | 14 +-- .../ofbiz/product/product/ProductSearch.java | 26 +++-- .../product/product/ProductSearchSession.java | 8 +- .../ofbiz/product/product/ProductServices.java | 2 +- .../ofbiz/product/product/ProductWorker.java | 22 ++-- .../ofbiz/product/store/ProductStoreEvents.java | 2 +- .../ofbiz/product/store/ProductStoreWorker.java | 12 +-- .../ofbiz/shipment/packing/PackingServices.java | 2 +- .../ofbiz/shipment/packing/PackingSession.java | 24 ++--- .../ofbiz/shipment/shipment/ShipmentEvents.java | 2 +- .../ofbiz/shipment/shipment/ShipmentServices.java | 10 +- .../ofbiz/shipment/thirdparty/dhl/DhlServices.java | 4 +- .../shipment/thirdparty/fedex/FedexServices.java | 36 +++---- .../ofbiz/shipment/thirdparty/ups/UpsServices.java | 6 +- .../workeffort/WorkEffortKeywordIndex.java | 4 +- .../workeffort/workeffort/WorkEffortSearch.java | 2 +- .../workeffort/workeffort/WorkEffortServices.java | 8 +- 111 files changed, 828 insertions(+), 844 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 78360fd..e8ce54b 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 @@ -41,7 +41,7 @@ public class GlEvents { 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"); + final Delegator delegator = (Delegator) request.getAttribute("delegator"); GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); Map<String, Object> ctx = UtilHttp.getParameterMap(request); String acctgTransId; @@ -55,7 +55,7 @@ public static String createReconcileAccount(HttpServletRequest request, HttpServ int rowCount = UtilHttp.getMultiFormRowCount(ctx); for (int i = 0; i < rowCount; i++) { //for calculating amount per glAccountId String suffix = UtilHttp.getMultiRowDelimiter() + i; - isSelected = (ctx.containsKey("_rowSubmit" + suffix) && "Y".equalsIgnoreCase((String)ctx.get("_rowSubmit" + suffix))); + isSelected = (ctx.containsKey("_rowSubmit" + suffix) && "Y".equalsIgnoreCase((String) ctx.get("_rowSubmit" + suffix))); if (!isSelected) { continue; } @@ -95,7 +95,7 @@ public static String createReconcileAccount(HttpServletRequest request, HttpServ String reconciledAmount; for (int i = 0; i < rowCount; i++) { String suffix = UtilHttp.getMultiRowDelimiter() + i; - isSelected = (ctx.containsKey("_rowSubmit" + suffix) && "Y".equalsIgnoreCase((String)ctx.get("_rowSubmit" + suffix))); + isSelected = (ctx.containsKey("_rowSubmit" + suffix) && "Y".equalsIgnoreCase((String) ctx.get("_rowSubmit" + suffix))); if (!isSelected) { continue; } @@ -103,7 +103,7 @@ public static String createReconcileAccount(HttpServletRequest request, HttpServ acctgTransEntrySeqId = (String) ctx.get("acctgTransEntrySeqId" + suffix); try { GenericValue acctgTransEntry = EntityQuery.use(delegator).from("AcctgTransEntry").where("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId).queryOne(); - if (acctgTransEntry != null ) { + if (acctgTransEntry != null) { reconciledAmount = acctgTransEntry.getString("amount"); acctgTransId = acctgTransEntry.getString("acctgTransId"); acctgTransEntrySeqId = acctgTransEntry.getString("acctgTransEntrySeqId"); 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 344de9a..a9638ee 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 @@ -134,7 +134,7 @@ public class InvoiceServices { } Map<String, Object> result = dispatcher.runSync("createInvoiceForOrder", context); - if (ServiceUtil.isError(result )) { + if (ServiceUtil.isError(result)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } result.remove("invoiceTypeId"); //remove extra parameter @@ -1090,10 +1090,10 @@ public class InvoiceServices { } // create the item records for (Map<String, Object> commissionMap : commList) { - BigDecimal elemAmount = ((BigDecimal)commissionMap.get("commission")).multiply(appliedFraction); - BigDecimal quantity = (BigDecimal)commissionMap.get("quantity"); - String invoiceIdFrom = (String)commissionMap.get("invoiceId"); - String invoiceItemSeqIdFrom = (String)commissionMap.get("invoiceItemSeqId"); + BigDecimal elemAmount = ((BigDecimal) commissionMap.get("commission")).multiply(appliedFraction); + BigDecimal quantity = (BigDecimal) commissionMap.get("quantity"); + String invoiceIdFrom = (String) commissionMap.get("invoiceId"); + String invoiceItemSeqIdFrom = (String) commissionMap.get("invoiceItemSeqId"); elemAmount = elemAmount.setScale(DECIMALS, ROUNDING); Map<String, Object> resMap = null; try { @@ -1613,7 +1613,7 @@ public class InvoiceServices { } // Get the list of shipments which are associated with the filtered purchase orders - if (! UtilValidate.isEmpty(invoiceablePrimaryOrderIds)) { + if (!UtilValidate.isEmpty(invoiceablePrimaryOrderIds)) { invoiceableShipments = EntityQuery.use(delegator).from("Shipment").where( UtilMisc.toList( EntityCondition.makeCondition("primaryOrderId", EntityOperator.IN, invoiceablePrimaryOrderIds), @@ -1764,7 +1764,7 @@ public class InvoiceServices { // all at once. BigDecimal totalNewAuthAmount = totalAdditionalShippingCharges.setScale(DECIMALS, ROUNDING); for (GenericValue orderPaymentPreference : orderPaymentPreferences) { - if (! ("PAYMENT_SETTLED".equals(orderPaymentPreference.getString("statusId")) || "PAYMENT_CANCELLED".equals(orderPaymentPreference.getString("statusId")))) { + if (!("PAYMENT_SETTLED".equals(orderPaymentPreference.getString("statusId")) || "PAYMENT_CANCELLED".equals(orderPaymentPreference.getString("statusId")))) { GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction != null && authTransaction.get("amount") != null) { @@ -1824,7 +1824,7 @@ public class InvoiceServices { // If the authorization fails, create the invoice anyway, but make a note of it boolean authFinished = (Boolean) authResult.get("finished"); boolean authErrors = (Boolean) authResult.get("errors"); - if (authErrors || ! authFinished) { + if (authErrors || !authFinished) { String errMsg = UtilProperties.getMessage(RESOURCE, "AccountingUnableToAuthAdditionalShipCharges", UtilMisc.toMap("shipmentId", shipmentId, "paymentMethodId", paymentMethodId, "orderPaymentPreferenceId", orderPaymentPreferenceId), locale); Debug.logError(errMsg, MODULE); } @@ -2330,7 +2330,7 @@ public class InvoiceServices { } // Ignore invoices that aren't ready yet - if (! "INVOICE_READY".equals(invoice.getString("statusId"))) { + if (!"INVOICE_READY".equals(invoice.getString("statusId"))) { return ServiceUtil.returnSuccess(); } @@ -2771,8 +2771,8 @@ 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"))) { + if (!payment.getString("partyIdFrom").equals(toPayment.getString("partyIdTo")) + && !payment.getString("partyIdTo").equals(toPayment.getString("partyIdFrom"))) { errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingFromPartySameToParty", locale)); } @@ -2895,8 +2895,8 @@ 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"))) { + if (!payment.getString("partyIdFrom").equals(invoice.getString("partyId")) + && !payment.getString("partyIdTo").equals(invoice.getString("partyIdFrom"))) { errorMessageList.add(UtilProperties.getMessage(RESOURCE, "AccountingFromPartySameToParty", locale)); } 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 a5e9353..3a5b250 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 @@ -636,7 +636,7 @@ public final class InvoiceWorker { } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting database records....", MODULE); } - return(conversionRate); + return (conversionRate); } public static BigDecimal getInvoiceCurrencyConversionRate(Delegator delegator, String invoiceId) { @@ -692,7 +692,7 @@ public final class InvoiceWorker { // get the list of all distinct taxAuthGeoId and taxAuthPartyId. It is for getting the number of taxAuthGeoId and taxAuthPartyId in invoiceItems. List<String> distinctTaxAuthGeoIdList = EntityUtil.getFieldListFromEntityList(invoiceItems, "taxAuthGeoId", true); List<String> distinctTaxAuthPartyIdList = EntityUtil.getFieldListFromEntityList(invoiceItems, "taxAuthPartyId", true); - for (String taxAuthGeoId : distinctTaxAuthGeoIdList ) { + for (String taxAuthGeoId : distinctTaxAuthGeoIdList) { for (String taxAuthPartyId : distinctTaxAuthPartyIdList) { //get all records for invoices filtered by taxAuthGeoId and taxAurhPartyId List<GenericValue> invoiceItemsByTaxAuthGeoAndPartyIds = EntityUtil.filterByAnd(invoiceItems, UtilMisc.toMap("taxAuthGeoId", taxAuthGeoId, "taxAuthPartyId", taxAuthPartyId)); 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 9d33d69..5e1ed51 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 @@ -56,8 +56,8 @@ public class GeneralLedgerServices { } try { result = dispatcher.runSync("createGlAcctCatMemFromCostCenters", createGlAcctCatMemFromCostCentersMap); - if (ServiceUtil.isError(result )) { - return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result )); + if (ServiceUtil.isError(result)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } } catch (GenericServiceException e) { Debug.logError(e, MODULE); 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 8287bd4..1db542b 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 @@ -785,7 +785,7 @@ public class PaymentGatewayServices { if (ServiceUtil.isError(releaseResult)) { Debug.logError(ServiceUtil.getErrorMessage(releaseResult), MODULE); return ServiceUtil.returnError(ServiceUtil.getErrorMessage(releaseResult)); - } else if (! ServiceUtil.isFailure(releaseResult)) { + } else if (!ServiceUtil.isFailure(releaseResult)) { finished.add(paymentPref); } } @@ -1437,7 +1437,7 @@ public class PaymentGatewayServices { GenericValue productStore = orh.getProductStore(); if (UtilValidate.isNotEmpty(productStore)) { boolean shipIfCaptureFails = UtilValidate.isEmpty(productStore.get("shipIfCaptureFails")) || "Y".equalsIgnoreCase(productStore.getString("shipIfCaptureFails")); - if (! shipIfCaptureFails) { + if (!shipIfCaptureFails) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ORDER, "AccountingPaymentCannotBeCaptured", locale)); } else { @@ -2732,7 +2732,7 @@ public class PaymentGatewayServices { List<String> order = UtilMisc.toList("-transactionDate"); List<GenericValue> transactions = orderPaymentPreference.getRelated("PaymentGatewayResponse", null, order, false); List<EntityExpr> exprs = UtilMisc.toList( - EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, CAPTURE_SERVICE_TYPE) , + EntityCondition.makeCondition("paymentServiceTypeEnumId", EntityOperator.EQUALS, CAPTURE_SERVICE_TYPE), EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("referenceNum"), EntityComparisonOperator.NOT_EQUAL, EntityFunction.UPPER("ERROR"))); List<GenericValue> capTransactions = EntityUtil.filterByAnd(transactions, exprs); capTrans = EntityUtil.getFirst(capTransactions); @@ -3057,7 +3057,7 @@ public class PaymentGatewayServices { return ServiceUtil.returnSuccess(); } else { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "AccountingPaymentAuthorizationFailed", locale)); + "AccountingPaymentAuthorizationFailed", locale)); } } @@ -3121,7 +3121,7 @@ public class PaymentGatewayServices { // check valid implemented types if (!transactionType.equals(CREDIT_SERVICE_TYPE)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "AccountingPaymentTransactionNotYetSupported", locale)); + "AccountingPaymentTransactionNotYetSupported", locale)); } // transaction request context Map<String, Object> requestContext = new HashMap<>(); 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 3022646..9d41246 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 @@ -56,7 +56,7 @@ public final class PaymentWorker { // to be able to use in minilanguage where Boolean cannot be used public static List<Map<String, GenericValue>> getPartyPaymentMethodValueMaps(Delegator delegator, String partyId) { - return(getPartyPaymentMethodValueMaps(delegator, partyId, false)); + return (getPartyPaymentMethodValueMaps(delegator, partyId, false)); } public static List<Map<String, GenericValue>> getPartyPaymentMethodValueMaps(Delegator delegator, String partyId, Boolean showOld) { 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 ed08312..ac88d28 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 @@ -587,9 +587,9 @@ public class TaxAuthorityServices { } adjustments.add(taxAdjValue); - if (productPrice != null && itemQuantity != null && - productPrice.getBigDecimal("priceWithTax") != null && - !"Y".equals(productPrice.getString("taxInPrice"))) { + if (productPrice != null && itemQuantity != null + && productPrice.getBigDecimal("priceWithTax") != null + && !"Y".equals(productPrice.getString("taxInPrice"))) { BigDecimal priceWithTax = productPrice.getBigDecimal("priceWithTax"); BigDecimal price = productPrice.getBigDecimal("price"); BigDecimal baseSubtotal = price.multiply(itemQuantity); 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 9986c1a..80eec2a 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 @@ -73,8 +73,7 @@ public class AIMPaymentServices { // ccRefund service to attempt to void the refund's associated authorization transaction private static boolean isVoidableResponse(String responseCode) { return - VOIDABLE_RESPONSES_NO_TIME_LIMIT.contains(responseCode) || - VOIDABLE_RESPONSES_TIME_LIMIT.contains(responseCode); + VOIDABLE_RESPONSES_NO_TIME_LIMIT.contains(responseCode) || VOIDABLE_RESPONSES_TIME_LIMIT.contains(responseCode); } public static Map<String, Object> ccAuth(DispatchContext ctx, Map<String, Object> context) { @@ -91,7 +90,7 @@ public class AIMPaymentServices { props.put("transType", "AUTH_ONLY"); buildAuthTransaction(context, props, request); Map<String, Object> validateResults = validateRequest(context, props, request); - String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); + String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; @@ -180,7 +179,7 @@ public class AIMPaymentServices { props.put("cardtype", creditCard.get("cardType")); buildRefundTransaction(context, props, request); Map<String, Object> validateResults = validateRequest(context, props, request); - String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); + String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; @@ -188,7 +187,7 @@ public class AIMPaymentServices { Map<String, Object> reply = processCard(request, props, locale); results.putAll(processRefundTransResult(request, reply)); boolean refundResult = (Boolean) results.get("refundResult"); - String refundFlag = (String)results.get("refundFlag"); + String refundFlag = (String) results.get("refundFlag"); // Since the refund failed, we are going to void the previous authorization against // which ccRefunds attempted to issue the refund. This happens because Authorize.NET requires // that settled transactions need to be voided the same day. unfortunately they provide no method for @@ -268,7 +267,7 @@ public class AIMPaymentServices { props.put("transType", "VOID"); buildVoidTransaction(context, props, request); Map<String, Object> validateResults = validateRequest(context, props, request); - String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE); + String respMsg = (String) validateResults.get(ModelService.RESPONSE_MESSAGE); if (ModelService.RESPOND_ERROR.equals(respMsg)) { results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(RESOURCE, "AccountingValidationFailedInvalidValues", locale)); return results; @@ -500,7 +499,7 @@ public class AIMPaymentServices { if ("CREDIT_CARD".equals(opp.getString("paymentMethodTypeId"))) { // sometimes the ccAuthCapture interface is used, in which case the creditCard is passed directly GenericValue creditCard = (GenericValue) params.get("creditCard"); - if (creditCard == null || ! (opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) { + if (creditCard == null || !(opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) { creditCard = opp.getRelatedOne("CreditCard", false); } AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard"))); @@ -521,8 +520,8 @@ public class AIMPaymentServices { } } else { // this would be the case for an authorization - GenericValue cp = (GenericValue)params.get("billToParty"); - GenericValue ba = (GenericValue)params.get("billingAddress"); + GenericValue cp = (GenericValue) params.get("billToParty"); + GenericValue ba = (GenericValue) params.get("billingAddress"); AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(cp.getString("firstName"))); AIMRequest.put("x_Last_Name", UtilFormatOut.checkNull(cp.getString("lastName"))); AIMRequest.put("x_Address", UtilFormatOut.checkNull(ba.getString("address1"))); @@ -539,7 +538,7 @@ public class AIMPaymentServices { } private static void buildEmailSettings(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { - GenericValue ea = (GenericValue)params.get("billToEmail"); + GenericValue ea = (GenericValue) params.get("billToEmail"); AIMRequest.put("x_Email_Customer", props.getProperty("emailCustomer")); AIMRequest.put("x_Email_Merchant", props.getProperty("emailMerchant")); if (ea != null) { @@ -549,7 +548,7 @@ public class AIMPaymentServices { private static void buildInvoiceInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { String description = UtilFormatOut.checkNull(props.getProperty("transDescription")); - String orderId = UtilFormatOut.checkNull((String)params.get("orderId")); + String orderId = UtilFormatOut.checkNull((String) params.get("orderId")); if (UtilValidate.isEmpty(orderId)) { GenericValue orderPaymentPreference = (GenericValue) params.get("orderPaymentPreference"); if (orderPaymentPreference != null) { @@ -563,7 +562,7 @@ public class AIMPaymentServices { private static void buildAuthTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { GenericValue cc = (GenericValue) params.get("creditCard"); String currency = (String) params.get("currency"); - String amount = ((BigDecimal)params.get("processAmount")).toString(); + String amount = ((BigDecimal) params.get("processAmount")).toString(); String number = UtilFormatOut.checkNull(cc.getString("cardNumber")); String expDate = UtilFormatOut.checkNull(cc.getString("expireDate")); String cardSecurityCode = (String) params.get("cardSecurityCode"); 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 35b5a01..59da857 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 @@ -305,7 +305,7 @@ public class OrbitalPaymentServices { String expDate = UtilFormatOut.checkNull(cc.getString("expireDate")); expDate = formatExpDateForOrbital(expDate); String cardSecurityCode = (String) params.get("cardSecurityCode"); - String orderId = UtilFormatOut.checkNull((String)params.get("orderId")); + String orderId = UtilFormatOut.checkNull((String) params.get("orderId")); String transType = props.get("transType").toString(); String messageType = null; if ("AUTH_ONLY".equals(transType)) { @@ -330,7 +330,7 @@ public class OrbitalPaymentServices { if ("CREDIT_CARD".equals(opp.getString("paymentMethodTypeId"))) { // sometimes the ccAuthCapture interface is used, in which case the creditCard is passed directly creditCard = (GenericValue) params.get("creditCard"); - if (creditCard == null || ! (opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) { + if (creditCard == null || !(opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) { creditCard = opp.getRelatedOne("CreditCard", false); } } @@ -347,8 +347,8 @@ public class OrbitalPaymentServices { } } else { // this would be the case for an authorization - GenericValue cp = (GenericValue)params.get("billToParty"); - GenericValue ba = (GenericValue)params.get("billingAddress"); + GenericValue cp = (GenericValue) params.get("billToParty"); + GenericValue ba = (GenericValue) params.get("billingAddress"); request.setFieldValue("AVSname", UtilFormatOut.checkNull(cp.getString("firstName")) + UtilFormatOut.checkNull(cp.getString("lastName"))); request.setFieldValue("AVSaddress1", UtilFormatOut.checkNull(ba.getString("address1"))); request.setFieldValue("AVScity", UtilFormatOut.checkNull(ba.getString("city"))); @@ -383,7 +383,7 @@ public class OrbitalPaymentServices { GenericValue creditCard = (GenericValue) params.get("creditCard"); BigDecimal amount = (BigDecimal) params.get("captureAmount"); String amountValue = amount.setScale(DECIMALS, ROUNDING).movePointRight(2).toPlainString(); - String orderId = UtilFormatOut.checkNull((String)params.get("orderId")); + String orderId = UtilFormatOut.checkNull((String) params.get("orderId")); try { //If there were no errors preparing the template, we can now specify the data //Basic Auth Fields @@ -424,7 +424,7 @@ public class OrbitalPaymentServices { String number = UtilFormatOut.checkNull(cc.getString("cardNumber")); String expDate = UtilFormatOut.checkNull(cc.getString("expireDate")); expDate = formatExpDateForOrbital(expDate); - String orderId = UtilFormatOut.checkNull((String)params.get("orderId")); + String orderId = UtilFormatOut.checkNull((String) params.get("orderId")); try { //If there were no errors preparing the template, we can now specify the data //Basic Auth Fields @@ -452,7 +452,7 @@ public class OrbitalPaymentServices { private static void buildReleaseTransaction(Map<String, Object> params, Delegator delegator, Map<String, Object> props, RequestIF request, Map<String, Object> results) { BigDecimal amount = (BigDecimal) params.get("releaseAmount"); GenericValue authTransaction = (GenericValue) params.get("authTransaction"); - String orderId = UtilFormatOut.checkNull((String)params.get("orderId")); + String orderId = UtilFormatOut.checkNull((String) params.get("orderId")); try { //If there were no errors preparing the template, we can now specify the data //Basic Auth Fields 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 bb3d86f..33e3bc2 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 @@ -224,7 +224,7 @@ public class PayPalEvents { } // first verify this is valid from PayPal - Map <String, Object> parametersMap = UtilHttp.getParameterMap(request); + Map<String, Object> parametersMap = UtilHttp.getParameterMap(request); parametersMap.put("cmd", "_notify-validate"); // send off the confirm request @@ -250,8 +250,8 @@ public class PayPalEvents { for (String name : parametersMap.keySet()) { String value = request.getParameter(name); Debug.logError("### Param: " + name + " => " + value, MODULE); - if (UtilValidate.isNotEmpty(name) && "payer_status".equalsIgnoreCase(name) && - UtilValidate.isNotEmpty(value) && "verified".equalsIgnoreCase(value)) { + if (UtilValidate.isNotEmpty(name) && "payer_status".equalsIgnoreCase(name) + && UtilValidate.isNotEmpty(value) && "verified".equalsIgnoreCase(value)) { verified = true; } } @@ -336,18 +336,15 @@ public class PayPalEvents { } } } - - if (okay) { // call the email confirm service - Map <String, String> emailContext = UtilMisc.toMap("orderId", orderId); + Map<String, String> emailContext = UtilMisc.toMap("orderId", orderId); try { dispatcher.runSync("sendOrderConfirmation", emailContext); } catch (GenericServiceException e) { Debug.logError(e, "Problems sending email confirmation", MODULE); } } - return "success"; } @@ -391,7 +388,7 @@ public class PayPalEvents { private static boolean setPaymentPreferences(Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, String orderId, HttpServletRequest request) { Debug.logVerbose("Setting payment prefrences..", MODULE); - List <GenericValue> paymentPrefs = null; + List<GenericValue> paymentPrefs = null; try { paymentPrefs = EntityQuery.use(delegator).from("OrderPaymentPreference").where("orderId", orderId, "statusId", "PAYMENT_NOT_RECEIVED").queryList(); } catch (GenericEntityException e) { @@ -468,7 +465,7 @@ public class PayPalEvents { } // create a payment record too - Map <String, Object> results = null; + Map<String, Object> results = null; try { String comment = UtilProperties.getMessage(RESOURCE, "AccountingPaymentReceiveViaPayPal", locale); results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, 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 8d103a7..465f6d8 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 @@ -178,7 +178,7 @@ public class PayPalServices { Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - String token = (String)paramMap.get("TOKEN"); + String token = (String) paramMap.get("TOKEN"); WeakReference<ShoppingCart> weakCart = tokenCartMap.get(new TokenWrapper(token)); ShoppingCart cart = null; if (weakCart != null) { @@ -201,7 +201,7 @@ public class PayPalServices { return ServiceUtil.returnSuccess(); } inMap.put("countryGeoId", countryGeoId); - inMap.put("stateProvinceGeoId", parseStateProvinceGeoId((String)paramMap.get("SHIPTOSTATE"), countryGeoId, delegator)); + inMap.put("stateProvinceGeoId", parseStateProvinceGeoId((String) paramMap.get("SHIPTOSTATE"), countryGeoId, delegator)); inMap.put("postalCode", paramMap.get("SHIPTOZIP")); try { 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 348f4d7..1c1f16c 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 @@ -93,7 +93,7 @@ public class SecurePayServiceTest extends OFBizTestCase { "statusId", "ITEM_COMPLETED" ); orderItems = UtilMisc.<Object>toList(orderItemMap); - billToParty = delegator.makeValue("Party" , UtilMisc.toMap("partyId", "DemoCustomer")); + billToParty = delegator.makeValue("Party", UtilMisc.toMap("partyId", "DemoCustomer")); paymentGatewayConfigId = "SECUREPAY_CONFIG"; refundAmount = new BigDecimal("100.08"); orderPaymentPreference = delegator.makeValue("OrderPaymentPreference", UtilMisc.toMap( @@ -140,10 +140,10 @@ public class SecurePayServiceTest extends OFBizTestCase { Debug.logInfo("[testAuth] Result from SecurePay: " + result, MODULE); String authRefNum = (String) result.get("authRefNum"); BigDecimal processAmount = (BigDecimal) result.get("processAmount"); - paymentGatewayResponse = delegator.makeValue("PaymentGatewayResponse" , UtilMisc.toMap( + paymentGatewayResponse = delegator.makeValue("PaymentGatewayResponse", UtilMisc.toMap( "paymentGatewayResponseId", "testOrder1000_01", "orderPaymentPreferenceId", "testOrder1000_01", - "amount" , processAmount, + "amount", processAmount, "referenceNum", authRefNum, "paymentMethodTypeId", "CREDIT_CARD", "paymentServiceTypeEnumId", "PRDS_PAY_AUTH", 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 64f81e4..da5392f 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 @@ -310,7 +310,7 @@ public class WorldPayEvents { Delegator delegator = (Delegator) request.getAttribute("delegator"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); - Map <String, Object> parametersMap = UtilHttp.getParameterMap(request); + Map<String, Object> parametersMap = UtilHttp.getParameterMap(request); String orderId = request.getParameter("cartId"); for (String name : parametersMap.keySet()) { String value = request.getParameter(name); 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 78ed1ff..6c47977 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 @@ -173,8 +173,8 @@ public final class UtilAccounting { String parentClassId = glAccountClass.getString("parentClassId"); // otherwise, we have to go to the grandparent (recurse) - return !(parentClassId == null) && - (parentClassId.equals(parentGlAccountClassId) || isAccountClassClass(glAccountClass.getRelatedOne("ParentGlAccountClass", true), parentGlAccountClassId)); + return !(parentClassId == null) + && (parentClassId.equals(parentGlAccountClassId) || isAccountClassClass(glAccountClass.getRelatedOne("ParentGlAccountClass", true), parentGlAccountClassId)); } /** @@ -237,8 +237,8 @@ public final class UtilAccounting { String parentTypeId = invoiceType.getString("parentTypeId"); // otherwise, we have to go to the grandparent (recurse) - return !(parentTypeId == null || invoiceTypeId.equals(parentTypeId)) && - (parentTypeId.equals(inputTypeId) || isInvoiceTypeRecurse(invoiceType.getRelatedOne("ParentInvoiceType", false), inputTypeId)); + return !(parentTypeId == null || invoiceTypeId.equals(parentTypeId)) + && (parentTypeId.equals(inputTypeId) || isInvoiceTypeRecurse(invoiceType.getRelatedOne("ParentInvoiceType", false), inputTypeId)); } /** 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 9ef3d4d..0a3151d 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 @@ -55,20 +55,20 @@ public class ContentManagementEvents { public static String updateStaticValues(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); - Security security = (Security)request.getAttribute("security"); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + Security security = (Security) request.getAttribute("security"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String webSiteId = WebSiteWorker.getWebSiteId(request); - Delegator delegator = (Delegator)request.getAttribute("delegator"); - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map<String, Object> paramMap = UtilHttp.getParameterMap(request); Map<String, Object> result = new HashMap<>(); - String parentPlaceholderId = (String)paramMap.get("ph"); + String parentPlaceholderId = (String) paramMap.get("ph"); if (UtilValidate.isEmpty(parentPlaceholderId)) { request.setAttribute("_ERROR_MESSAGE_", "ParentPlaceholder is empty."); return "error"; } List<GenericValue> allPublishPointList = null; - List<String []> permittedPublishPointList = null; + List<String[]> permittedPublishPointList = null; List<Map<String, Object>> valueList = null; try { allPublishPointList = ContentManagementWorker.getAllPublishPoints(delegator, webSiteId); @@ -82,12 +82,12 @@ public class ContentManagementEvents { int counter = 0; for (Map<String, Object> map : valueList) { - String contentId = (String)map.get("contentId"); - for (String [] pubArr : permittedPublishPointList) { + String contentId = (String) map.get("contentId"); + for (String[] pubArr : permittedPublishPointList) { String pubContentId = pubArr[0]; - String pubValue = (String)map.get(pubContentId); + String pubValue = (String) map.get(pubContentId); String paramName = Integer.toString(counter) + "_" + pubContentId; - String paramValue = (String)paramMap.get(paramName); + String paramValue = (String) paramMap.get(paramName); Map<String, Object> serviceIn = new HashMap<>(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentIdTo", contentId); @@ -107,7 +107,7 @@ public class ContentManagementEvents { } } else if ("N".equalsIgnoreCase(paramValue) && "Y".equalsIgnoreCase(pubValue)) { serviceIn.put("thruDate", UtilDateTime.nowTimestamp()); - Timestamp fromDate = (Timestamp)map.get(pubContentId + "FromDate"); + Timestamp fromDate = (Timestamp) map.get(pubContentId + "FromDate"); serviceIn.put("fromDate", fromDate); result = dispatcher.runSync("updateContentAssoc", serviceIn); if (ServiceUtil.isError(result)) { @@ -121,7 +121,7 @@ public class ContentManagementEvents { } else if (UtilValidate.isNotEmpty(pubValue)) { if ("Y".equalsIgnoreCase(pubValue)) { serviceIn.put("thruDate", UtilDateTime.nowTimestamp()); - Timestamp fromDate = (Timestamp)map.get(pubContentId + "FromDate"); + Timestamp fromDate = (Timestamp) map.get(pubContentId + "FromDate"); serviceIn.put("fromDate", fromDate); result = dispatcher.runSync("updateContentAssoc", serviceIn); if (ServiceUtil.isError(result)) { @@ -150,13 +150,13 @@ public class ContentManagementEvents { public static String updatePublishLinks(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); - Security security = (Security)request.getAttribute("security"); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + Security security = (Security) request.getAttribute("security"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String webSiteId = WebSiteWorker.getWebSiteId(request); - Delegator delegator = (Delegator)request.getAttribute("delegator"); - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - String targContentId = (String)paramMap.get("contentId"); // The content to be linked to one or more sites + String targContentId = (String) paramMap.get("contentId"); // The content to be linked to one or more sites String roles = null; String authorId = null; GenericValue authorContent = ContentManagementWorker.getAuthorContent(delegator, targContentId); @@ -177,15 +177,15 @@ public class ContentManagementEvents { List<String> targetOperationList = UtilMisc.<String>toList("CONTENT_PUBLISH"); // TODO check the purpose of this list and if we want to make use of it. Else remove List<String> contentPurposeList = null; //UtilMisc.toList("ARTICLE"); - String permittedAction = (String)paramMap.get("permittedAction"); // The content to be linked to one or more sites - String permittedOperations = (String)paramMap.get("permittedOperations"); // The content to be linked to one or more sites + String permittedAction = (String) paramMap.get("permittedAction"); // The content to be linked to one or more sites + String permittedOperations = (String) paramMap.get("permittedOperations"); // The content to be linked to one or more sites if (UtilValidate.isEmpty(targContentId)) { request.setAttribute("_ERROR_MESSAGE_", "targContentId is empty."); return "error"; } // Get all the subSites that the user is permitted to link to - List<Object []> origPublishedLinkList = null; + List<Object[]> origPublishedLinkList = null; try { // TODO: this needs to be given author userLogin EntityQuery.use(delegator).from("UserLogin").where("userLoginId", authorId).cache().queryOne(); @@ -203,7 +203,7 @@ public class ContentManagementEvents { int pos = param.indexOf("select_"); if (pos >= 0) { String siteId = param.substring(7); - String subSiteVal = (String)paramMap.get(param); + String subSiteVal = (String) paramMap.get(param); siteIdLookup.put(siteId, subSiteVal); } } 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 1c91642..10ce323 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 @@ -243,7 +243,7 @@ public class ContentManagementServices { if (UtilValidate.isNotEmpty(errorMsg)) { return ServiceUtil.returnError(errorMsg); } - dataResourceId = (String)dataResourceResult.get("dataResourceId"); + dataResourceId = (String) dataResourceResult.get("dataResourceId"); results.put("dataResourceId", dataResourceId); results.put("drDataResourceId", dataResourceId); context.put("dataResourceId", dataResourceId); @@ -323,7 +323,7 @@ public class ContentManagementServices { Map<String, Object> r = dispatcher.runSync("updateContent", map); boolean isError = ModelService.RESPOND_ERROR.equals(r.get(ModelService.RESPONSE_MESSAGE)); if (isError) - return ServiceUtil.returnError((String)r.get(ModelService.ERROR_MESSAGE)); + return ServiceUtil.returnError((String) r.get(ModelService.ERROR_MESSAGE)); } } @@ -418,7 +418,7 @@ public class ContentManagementServices { serviceContext.put("contentId", siteContentId); serviceContext.put("userLogin", userLogin); Debug.logInfo("updateSiteRoles, serviceContext(0):" + serviceContext, MODULE); - String siteRole = (String)roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc. + String siteRole = (String) roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc. String cappedSiteRole = ModelUtil.dbNameToVarName(siteRole); if (Debug.infoOn()) { Debug.logInfo("updateSiteRoles, cappediteRole(1):" + cappedSiteRole, MODULE); @@ -492,7 +492,7 @@ public class ContentManagementServices { if (ServiceUtil.isError(thisResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult)); } - String permissionStatus = (String)thisResult.get("permissionStatus"); + String permissionStatus = (String) thisResult.get("permissionStatus"); if (UtilValidate.isNotEmpty(permissionStatus) && "granted".equalsIgnoreCase(permissionStatus)) { result = persistDataResourceAndDataMethod(dctx, context); } @@ -525,11 +525,11 @@ public class ContentManagementServices { GenericValue electronicText = delegator.makeValue("ElectronicText"); electronicText.setPKFields(context); electronicText.setNonPKFields(context); - String textData = (String)electronicText.get("textData"); + String textData = (String) electronicText.get("textData"); - String dataResourceId = (String)dataResource.get("dataResourceId"); - String dataResourceTypeId = (String)dataResource.get("dataResourceTypeId"); + String dataResourceId = (String) dataResource.get("dataResourceId"); + String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId"); if (Debug.infoOn()) { Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, MODULE); } @@ -569,11 +569,11 @@ public class ContentManagementServices { if (ServiceUtil.isError(thisResult)) { throw(new GenericServiceException(ServiceUtil.getErrorMessage(thisResult))); } - dataResourceId = (String)thisResult.get("dataResourceId"); + dataResourceId = (String) thisResult.get("dataResourceId"); if (Debug.infoOn()) { Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, MODULE); } - dataResource = (GenericValue)thisResult.get("dataResource"); + dataResource = (GenericValue) thisResult.get("dataResource"); Map<String, Object> fileContext = new HashMap<>(); fileContext.put("userLogin", userLogin); if ("IMAGE_OBJECT".equals(dataResourceTypeId)) { @@ -696,7 +696,7 @@ public class ContentManagementServices { return ServiceUtil.returnError(e.toString()); } for (GenericValue roleType : siteRoles) { - String siteRole = (String)roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc. + String siteRole = (String) roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc. String cappedSiteRole = ModelUtil.dbNameToVarName(siteRole); String siteRoleVal = (String) context.get(cappedSiteRole); @@ -838,7 +838,7 @@ public class ContentManagementServices { // Swap with previous entry try { GenericValue prevValue = listAll.get(i-1); - Long prevSeqNum = (Long)prevValue.get("sequenceNum"); + Long prevSeqNum = (Long) prevValue.get("sequenceNum"); prevValue.put("sequenceNum", (long) seqNum); prevValue.store(); contentAssoc.put("sequenceNum", prevSeqNum); @@ -900,7 +900,7 @@ public class ContentManagementServices { if (UtilValidate.isNotEmpty(dataResourceId)) { // add previous DataResource as part of new subcontent - GenericValue contentClone = (GenericValue)content.clone(); + GenericValue contentClone = (GenericValue) content.clone(); contentClone.set("dataResourceId", dataResourceId); content.set("lastModifiedDate", UtilDateTime.nowTimestamp()); content.set("lastModifiedByUserLogin", userLoginId); @@ -1117,7 +1117,7 @@ public class ContentManagementServices { String contentTypeId = content.getString("contentTypeId"); String newContentTypeId = contentTypeId; String dataResourceId = content.getString("dataResourceId"); - Long branchCount = (Long)content.get("childBranchCount"); + Long branchCount = (Long) content.get("childBranchCount"); if (forceOutline) { newContentTypeId = "OUTLINE_NODE"; } else if (contentTypeId == null || "DOCUMENT".equals(contentTypeId)) { @@ -1183,11 +1183,11 @@ public class ContentManagementServices { if (content == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", ""), locale)); } - Long leafCount = (Long)content.get("childLeafCount"); + Long leafCount = (Long) content.get("childLeafCount"); if (leafCount == null) { content.set("childLeafCount", 0L); } - Long branchCount = (Long)content.get("childBranchCount"); + Long branchCount = (Long) content.get("childBranchCount"); if (branchCount == null) { content.set("childBranchCount", 0L); } @@ -1207,7 +1207,7 @@ public class ContentManagementServices { if (content == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } - Long leafCount = (Long)content.get("childLeafCount"); + Long leafCount = (Long) content.get("childLeafCount"); if (leafCount == null) { leafCount = 0L; } @@ -1233,7 +1233,7 @@ public class ContentManagementServices { if (content == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } - Long leafCount = (Long)content.get("childLeafCount"); + Long leafCount = (Long) content.get("childLeafCount"); if (leafCount == null) { leafCount = 0L; } @@ -1552,7 +1552,7 @@ public class ContentManagementServices { if (ServiceUtil.isError(result)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } - String contentId = (String)result.get("contentId"); + String contentId = (String) result.get("contentId"); List<String> parentList = new LinkedList<>(); if (UtilValidate.isEmpty(masterRevisionContentId)) { Map<String, Object> traversMap = new HashMap<>(); 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 cdbe659..2c0cb81 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 @@ -134,7 +134,7 @@ public final class ContentManagementWorker { List<String> keyList = UtilMisc.makeListWritable(keyColl); keyList.sort(null); for (String ky : keyList) { - String val = (String)pk.get(ky); + String val = (String) pk.get(ky); if (UtilValidate.isNotEmpty(val)) { if (sig.length() > 0) sig.append("_"); sig.append(val); @@ -165,7 +165,7 @@ public final class ContentManagementWorker { public static String getFromSomewhere(String name, Map<String, Object> paramMap, HttpServletRequest request, Map<String, Object> context) { String ret = null; if (paramMap != null) { - ret = (String)paramMap.get(name); + ret = (String) paramMap.get(name); } if (UtilValidate.isEmpty(ret)) { Object obj = request.getAttribute(name); @@ -189,16 +189,16 @@ public final class ContentManagementWorker { session.setAttribute("currentEntityMap", currentEntityMap); } Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - String entityName = (String)paramMap.get("entityName"); + String entityName = (String) paramMap.get("entityName"); if (UtilValidate.isEmpty(entityName)) { - entityName = (String)request.getAttribute("entityName"); + entityName = (String) request.getAttribute("entityName"); } GenericPK cachedPK = null; if (UtilValidate.isNotEmpty(entityName)) { cachedPK = currentEntityMap.get(entityName); } getCurrentValueWithCachedPK(request, delegator, cachedPK, entityName); - GenericPK currentPK = (GenericPK)request.getAttribute("currentPK"); + GenericPK currentPK = (GenericPK) request.getAttribute("currentPK"); currentEntityMap.put(entityName, currentPK); } @@ -209,9 +209,9 @@ public final class ContentManagementWorker { GenericPK passedPK = v.getPrimaryKey(); Collection<String> keyColl = passedPK.getAllKeys(); for (String attrName : keyColl) { - String attrVal = (String)request.getAttribute(attrName); + String attrVal = (String) request.getAttribute(attrName); if (UtilValidate.isEmpty(attrVal)) { - attrVal = (String)paramMap.get(attrName); + attrVal = (String) paramMap.get(attrName); } if (UtilValidate.isNotEmpty(attrVal)) { passedPK.put(attrName, attrVal); @@ -277,13 +277,13 @@ public final class ContentManagementWorker { } - public static List<String []> getPermittedPublishPoints(Delegator delegator, List<GenericValue> allPublishPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { - List<String []> permittedPublishPointList = new LinkedList<>(); + public static List<String[]> getPermittedPublishPoints(Delegator delegator, List<GenericValue> allPublishPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { + List<String[]> permittedPublishPointList = new LinkedList<>(); // Check that user has permission to admin sites for (GenericValue webSitePP : allPublishPoints) { - String contentId = (String)webSitePP.get("contentId"); - String templateTitle = (String)webSitePP.get("templateTitle"); + String contentId = (String) webSitePP.get("contentId"); + String templateTitle = (String) webSitePP.get("templateTitle"); GenericValue content = delegator.makeValue("Content", UtilMisc.toMap("contentId", contentId)); // TODO check if we want statusId to be filled/used, else this should be removed String statusId = null; @@ -301,9 +301,9 @@ public final class ContentManagementWorker { } Map<String, Object> results = null; results = EntityPermissionChecker.checkPermission(content, statusId, userLogin, passedPurposes, targetOperationList, roles, delegator, security, entityAction); - String permissionStatus = (String)results.get("permissionStatus"); + String permissionStatus = (String) results.get("permissionStatus"); if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) { - String [] arr = {contentId, templateTitle}; + String[] arr = {contentId, templateTitle}; permittedPublishPointList.add(arr); } } @@ -328,7 +328,7 @@ public final class ContentManagementWorker { List<GenericValue> allPublishPoints = new LinkedList<>(); GenericValue webSitePublishPoint = null; for (GenericValue contentAssoc : relatedPubPts) { - String pub = (String)contentAssoc.get("contentId"); + String pub = (String) contentAssoc.get("contentId"); webSitePublishPoint = getWebSitePublishPoint(delegator, pub, false); allPublishPoints.add(webSitePublishPoint); } @@ -339,7 +339,7 @@ public final class ContentManagementWorker { List<GenericValue> publishPointList = getAllPublishPoints(delegator, pubPtId); Map<String, GenericValue> publishPointMap = new HashMap<>(); for (GenericValue webSitePublishPoint : publishPointList) { - String pub = (String)webSitePublishPoint.get("contentId"); + String pub = (String) webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); } return publishPointMap; @@ -349,7 +349,7 @@ public final class ContentManagementWorker { public static void getAllPublishPointMap(Delegator delegator, String pubPtId, Map<String, GenericValue> publishPointMap) throws GeneralException { List<GenericValue> publishPointList = getAllPublishPoints(delegator, pubPtId); for (GenericValue webSitePublishPoint : publishPointList) { - String pub = (String)webSitePublishPoint.get("contentId"); + String pub = (String) webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); getAllPublishPointMap(delegator, pub, publishPointMap); } @@ -358,13 +358,13 @@ public final class ContentManagementWorker { public static Map<String, GenericValue> getPublishPointMap(Delegator delegator, List<GenericValue> publishPointList) { Map<String, GenericValue> publishPointMap = new HashMap<>(); for (GenericValue webSitePublishPoint : publishPointList) { - String pub = (String)webSitePublishPoint.get("contentId"); + String pub = (String) webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); } return publishPointMap; } - public static List<Map<String, Object>> getStaticValues(Delegator delegator, String parentPlaceholderId, List<String []> permittedPublishPointList) throws GeneralException { + public static List<Map<String, Object>> getStaticValues(Delegator delegator, String parentPlaceholderId, List<String[]> permittedPublishPointList) throws GeneralException { List<GenericValue> assocValueList = null; try { assocValueList = EntityQuery.use(delegator).from("Content").where("contentTypeId", parentPlaceholderId).cache().queryList(); @@ -374,14 +374,14 @@ public final class ContentManagementWorker { List<Map<String, Object>> staticValueList = new LinkedList<>(); for (GenericValue content : assocValueList) { - String contentId = (String)content.get("contentId"); - String contentName = (String)content.get("contentName"); - String description = (String)content.get("description"); + String contentId = (String) content.get("contentId"); + String contentName = (String) content.get("contentName"); + String description = (String) content.get("description"); Map<String, Object> map = new HashMap<>(); map.put("contentId", contentId); map.put("contentName", contentName); map.put("description", description); - for (String [] publishPointArray : permittedPublishPointList) { + for (String[] publishPointArray : permittedPublishPointList) { String publishPointId = publishPointArray[0]; List<GenericValue> contentAssocList = content.getRelated("ToContentAssoc", UtilMisc.toMap("contentId", publishPointId), null, false); List<GenericValue> filteredList = EntityUtil.filterByDate(contentAssocList); @@ -468,26 +468,26 @@ public final class ContentManagementWorker { return webSitePublishPoint; } - public static List<Object []> getPublishedLinks(Delegator delegator, String targContentId, String rootPubId, GenericValue userLogin, Security security, String permittedAction, String permittedOperations , String passedRoles) throws GeneralException { + public static List<Object[]> getPublishedLinks(Delegator delegator, String targContentId, String rootPubId, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { // Set up one map with all the top-level publish points (to which only one sub point can be attached to) // and another map (publishPointMapAll) that points to one of the top-level points. List<GenericValue> allPublishPointList = getAllPublishPoints(delegator, rootPubId); - List<String []> publishPointList = getPermittedPublishPoints(delegator, allPublishPointList, userLogin, security , permittedAction, permittedOperations, passedRoles); + List<String[]> publishPointList = getPermittedPublishPoints(delegator, allPublishPointList, userLogin, security, permittedAction, permittedOperations, passedRoles); Map<String, Object> publishPointMap = new HashMap<>(); Map<String, Object> publishPointMapAll = new HashMap<>(); - for (String [] arr : publishPointList) { + for (String[] arr : publishPointList) { String contentId = arr[0]; String description = arr[1]; - List<Object []> subPointList = new LinkedList<>(); - Object [] subArr = {contentId, subPointList, description, null}; + List<Object[]> subPointList = new LinkedList<>(); + Object[] subArr = {contentId, subPointList, description, null}; publishPointMap.put(contentId, subArr); publishPointMapAll.put(contentId, contentId); List<GenericValue> subPublishPointList = getAllPublishPoints(delegator, contentId); for (GenericValue webSitePublishPoint2 : subPublishPointList) { - String contentId2 = (String)webSitePublishPoint2.get("contentId"); - String description2 = (String)webSitePublishPoint2.get("templateTitle"); + String contentId2 = (String) webSitePublishPoint2.get("contentId"); + String description2 = (String) webSitePublishPoint2.get("templateTitle"); publishPointMapAll.put(contentId2, contentId); - Object [] subArr2 = {contentId2, description2, null}; + Object[] subArr2 = {contentId2, description2, null}; subPointList.add(subArr2); } } @@ -501,18 +501,18 @@ public final class ContentManagementWorker { } for (GenericValue contentAssoc : assocValueList) { String contentIdTo = contentAssoc.getString("contentIdTo"); - String topContentId = (String)publishPointMapAll.get(contentIdTo); - Object [] subArr = (Object [])publishPointMap.get(topContentId); + String topContentId = (String) publishPointMapAll.get(contentIdTo); + Object[] subArr = (Object[]) publishPointMap.get(topContentId); if (contentIdTo.equals(topContentId)) { subArr[3] = contentAssoc.get("fromDate"); } else { if (subArr != null) { - List<Object []> subPointList = UtilGenerics.cast(subArr[1]); - Iterator<Object []> it5 = subPointList.iterator(); - Object [] subArr2 = null; + List<Object[]> subPointList = UtilGenerics.cast(subArr[1]); + Iterator<Object[]> it5 = subPointList.iterator(); + Object[] subArr2 = null; while (it5.hasNext()) { subArr2 = it5.next(); - String contentId5 = (String)subArr2[0]; + String contentId5 = (String) subArr2[0]; if (contentId5.equals(contentIdTo)) break; } @@ -521,10 +521,10 @@ public final class ContentManagementWorker { } } - List<Object []> publishedLinkList = new LinkedList<>(); + List<Object[]> publishedLinkList = new LinkedList<>(); for (Entry<String, Object> entry : publishPointMap.entrySet()) { String contentId = entry.getKey(); - Object [] subPointArr = (Object [])publishPointMap.get(contentId); + Object[] subPointArr = (Object[]) publishPointMap.get(contentId); publishedLinkList.add(subPointArr); } return publishedLinkList; @@ -551,13 +551,13 @@ public final class ContentManagementWorker { return authorContent; } - public static List<String []> getPermittedDepartmentPoints(Delegator delegator, List<GenericValue> allDepartmentPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { - List<String []> permittedDepartmentPointList = new LinkedList<>(); + public static List<String[]> getPermittedDepartmentPoints(Delegator delegator, List<GenericValue> allDepartmentPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { + List<String[]> permittedDepartmentPointList = new LinkedList<>(); // Check that user has permission to admin sites for (GenericValue content : allDepartmentPoints) { - String contentId = (String)content.get("contentId"); - String contentName = (String)content.get("contentName"); + String contentId = (String) content.get("contentId"); + String contentName = (String) content.get("contentName"); // TODO check if we want statusId to be filled/used, else this should be removed String statusId = null; String entityAction = permittedAction; @@ -573,9 +573,9 @@ public final class ContentManagementWorker { } Map<String, Object> results = null; results = EntityPermissionChecker.checkPermission(content, statusId, userLogin, passedPurposes, targetOperationList, roles, delegator, security, entityAction); - String permissionStatus = (String)results.get("permissionStatus"); + String permissionStatus = (String) results.get("permissionStatus"); if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) { - String [] arr = {contentId, contentName}; + String[] arr = {contentId, contentName}; permittedDepartmentPointList.add(arr); } } @@ -601,7 +601,7 @@ public final class ContentManagementWorker { List<GenericValue> allDepartmentPoints = new LinkedList<>(); GenericValue departmentContent = null; for (GenericValue contentAssoc : relatedPubPts) { - String pub = (String)contentAssoc.get("contentId"); + String pub = (String) contentAssoc.get("contentId"); departmentContent = EntityQuery.use(delegator).from("Content").where("contentId", pub).cache().queryOne(); allDepartmentPoints.add(departmentContent); } @@ -610,7 +610,7 @@ public final class ContentManagementWorker { public static String getUserName(HttpServletRequest request, String userLoginId) throws GenericEntityException { String userName = null; - Delegator delegator = (Delegator)request.getAttribute("delegator"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).cache().queryOne(); GenericValue person = userLogin.getRelatedOne("Person", true); userName = person.getString("firstName") + " " + person.getString("lastName"); @@ -658,7 +658,7 @@ public final class ContentManagementWorker { String contentIdTo = contentAssoc.getString("contentIdTo"); GenericValue contentTo = EntityQuery.use(delegator).from("Content").where("contentId", contentIdTo).queryOne(); int intLeafCount = 0; - Long leafCount = (Long)contentTo.get("childLeafCount"); + Long leafCount = (Long) contentTo.get("childLeafCount"); if (leafCount != null) { intLeafCount = leafCount.intValue(); } @@ -666,7 +666,7 @@ public final class ContentManagementWorker { if (branchChangeAmount != 0) { int intBranchCount = 0; - Long branchCount = (Long)contentTo.get("childBranchCount"); + Long branchCount = (Long) contentTo.get("childBranchCount"); if (branchCount != null) { intBranchCount = branchCount.intValue(); } 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 67b80d0..455c355 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 @@ -67,13 +67,13 @@ public class CompDocEvents { public static String persistRootCompDoc(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - Delegator delegator = (Delegator)request.getAttribute("delegator"); - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Locale locale = UtilHttp.getLocale(request); HttpSession session = request.getSession(); //Security security = (Security)request.getAttribute("security"); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); - String contentId = (String)paramMap.get("contentId"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + String contentId = (String) paramMap.get("contentId"); //String instanceContentId = null; if (UtilValidate.isNotEmpty(contentId)) { @@ -106,7 +106,7 @@ public class CompDocEvents { Debug.logError(errMsg, MODULE); return "error"; } - contentId = (String)persistResult.get("contentId"); + contentId = (String) persistResult.get("contentId"); //request.setAttribute("contentId", contentId); for (Entry<String, Object> entry : persistResult.entrySet()) { Object obj = entry.getValue(); @@ -147,11 +147,11 @@ public class CompDocEvents { public static String genCompDocPdf(HttpServletRequest request, HttpServletResponse response) { String responseStr = "success"; HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); ServletContext servletContext = session.getServletContext(); - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - String contentId = (String)paramMap.get("contentId"); + String contentId = (String) paramMap.get("contentId"); Locale locale = UtilHttp.getLocale(request); String webSiteId = WebSiteWorker.getWebSiteId(request); @@ -196,11 +196,11 @@ public class CompDocEvents { public static String genContentPdf(HttpServletRequest request, HttpServletResponse response) { String responseStr = "success"; HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); ServletContext servletContext = session.getServletContext(); - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Map<String, Object> paramMap = UtilHttp.getParameterMap(request); - String contentId = (String)paramMap.get("contentId"); + String contentId = (String) paramMap.get("contentId"); Locale locale = UtilHttp.getLocale(request); String webSiteId = WebSiteWorker.getWebSiteId(request); 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 514e6b1..8e36748 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 @@ -288,7 +288,7 @@ public class CompDocServices { if (dataResource != null) { inputMimeType = dataResource.getString("mimeTypeId"); } - byte [] inputByteArray = null; + byte[] inputByteArray = null; if (inputMimeType != null && "application/pdf".equals(inputMimeType)) { ByteBuffer byteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https, webSiteId, locale, rootDir); inputByteArray = byteBuffer.array(); 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 85904d6..a5a29a4 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 @@ -262,7 +262,7 @@ public class ContentMapFacade implements Map<Object, Object> { Delegator delegator = (Delegator) request.getAttribute("delegator"); String contentUri = this.contentId; - // Try and find a WebSitePathAlias record to use, it isn't very feasible to find an alias by (parent)contentId/mapKey + // Try and find a WebSitePathAlias record to use, it isn't very feasible to find an alias by (parent) contentId/mapKey // so we're only looking for a direct alias using contentId if (webSiteId != null && delegator != null) { try { 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 dfda01a..fa5464b 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 @@ -214,7 +214,7 @@ public class ContentPermissionServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); } - permissionStatus = (String)results.get("permissionStatus"); + permissionStatus = (String) results.get("permissionStatus"); errBuf.append("\n permissionStatus:"); errBuf.append(permissionStatus); } @@ -297,10 +297,10 @@ public class ContentPermissionServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem checking permissions", "ContentServices"); } - permissionStatus = (String)permResults.get("permissionStatus"); + permissionStatus = (String) permResults.get("permissionStatus"); if (permissionStatus == null || !"granted".equals(permissionStatus)) { if (bDisplayFailCond != null && bDisplayFailCond) { - String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); + String errMsg = (String) permResults.get(ModelService.ERROR_MESSAGE); results.put(ModelService.ERROR_MESSAGE, errMsg); } return results; @@ -316,12 +316,12 @@ public class ContentPermissionServices { } catch (GenericServiceException e) { Debug.logError(e, "Problem checking permissions", "ContentServices"); } - permissionStatus = (String)permResults.get("permissionStatus"); + permissionStatus = (String) permResults.get("permissionStatus"); if (permissionStatus != null && "granted".equals(permissionStatus)) { results.put("permissionStatus", "granted"); } else { if (bDisplayFailCond != null && bDisplayFailCond) { - String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); + String errMsg = (String) permResults.get(ModelService.ERROR_MESSAGE); results.put(ModelService.ERROR_MESSAGE, errMsg); } } 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 5ec115d..abaa4fa 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 @@ -176,7 +176,7 @@ public class ContentSearch { } long endMillis = System.currentTimeMillis(); - double totalSeconds = ((double)endMillis - (double)startMillis)/1000.0; + double totalSeconds = ((double) endMillis - (double) startMillis) / 1000.0; // store info about results in the database, attached to the user's visitId, if specified this.saveSearchResultInfo((long) contentIds.size(), totalSeconds); 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 a838e65..8cd4a5e 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 @@ -249,7 +249,7 @@ public class ContentServicesComplex { "fromDate", contentAssocView.getTimestamp("caFromDate"))).queryOne(); content = contentAssoc.getRelatedOne(assocRelationName, true); if (UtilValidate.isNotEmpty(contentTypes)) { - String contentTypeId = (String)content.get("contentTypeId"); + String contentTypeId = (String) content.get("contentTypeId"); if (contentTypes.contains(contentTypeId)) { contentAssocDataResourceView = delegator.makeValue(viewName); contentAssocDataResourceView.setAllFields(content, true, null, null); 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 dcfe355..549b566 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 @@ -566,7 +566,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } Map<String, Object> currentNode = nodeTrail.get(sz - 1); - Boolean isReturnAfter = (Boolean)currentNode.get("isReturnAfter"); + Boolean isReturnAfter = (Boolean) currentNode.get("isReturnAfter"); if (isReturnAfter != null && isReturnAfter) { return false; } @@ -577,7 +577,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor while (idx < kids.size()) { currentNode = kids.get(idx); ContentWorker.traceNodeTrail("12", nodeTrail); - Boolean isPick = (Boolean)currentNode.get("isPick"); + Boolean isPick = (Boolean) currentNode.get("isPick"); if (isPick != null && isPick) { nodeTrail.add(currentNode); @@ -586,7 +586,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor ContentWorker.traceNodeTrail("14", nodeTrail); break; } else { - Boolean isFollow = (Boolean)currentNode.get("isFollow"); + Boolean isFollow = (Boolean) currentNode.get("isFollow"); if (isFollow != null && isFollow) { nodeTrail.add(currentNode); boolean foundPick = traverseSubContent(ctx); @@ -614,14 +614,14 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor int idx = kids.indexOf(currentNode); while (idx < (kids.size() - 1)) { currentNode = kids.get(idx + 1); - Boolean isFollow = (Boolean)currentNode.get("isFollow"); + Boolean isFollow = (Boolean) currentNode.get("isFollow"); if (isFollow == null || !isFollow) { idx++; continue; } nodeTrail.add(currentNode); ContentWorker.traceNodeTrail("16", nodeTrail); - Boolean isPick = (Boolean)currentNode.get("isPick"); + Boolean isPick = (Boolean) currentNode.get("isPick"); if (isPick == null || !isPick) { // If not a "pick" node, look at kids inProgress = traverseSubContent(ctx); @@ -791,7 +791,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } } if (Debug.infoOn()) { - Debug.logInfo("contentList:" + contentList.size() , ""); + Debug.logInfo("contentList:" + contentList.size(), ""); } return contentList; } @@ -1130,9 +1130,9 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static GenericValue getCurrentContent(Delegator delegator, List<Map<String, ? extends Object>> trail, GenericValue userLogin, Map<String, Object> ctx, Boolean nullThruDatesOnly, String contentAssocPredicateId) throws GeneralException { - String contentId = (String)ctx.get("contentId"); - String subContentId = (String)ctx.get("subContentId"); - String mapKey = (String)ctx.get("mapKey"); + String contentId = (String) ctx.get("contentId"); + String subContentId = (String) ctx.get("subContentId"); + String mapKey = (String) ctx.get("mapKey"); Timestamp fromDate = UtilDateTime.nowTimestamp(); List<String> assocTypes = null; List<Map<String, Object>> passedGlobalNodeTrail = null; @@ -1147,9 +1147,9 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor if (sz > 0) { Map<String, Object> nd = passedGlobalNodeTrail.get(sz - 1); if (nd != null) - currentContent = (GenericValue)nd.get("value"); + currentContent = (GenericValue) nd.get("value"); if (currentContent != null) - viewContentId = (String)currentContent.get("contentId"); + viewContentId = (String) currentContent.get("contentId"); } if (UtilValidate.isNotEmpty(subContentId)) { @@ -1226,7 +1226,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor public static void checkConditions(Delegator delegator, Map<String, Object> trailNode, Map<String, Object> contentAssoc, Map<String, Object> whenMap) { Map<String, Object> context = new HashMap<>(); - GenericValue content = (GenericValue)trailNode.get("value"); + GenericValue content = (GenericValue) trailNode.get("value"); if (content != null) { context.put("content", content); List<Object> purposes = getPurposes(content); @@ -1235,7 +1235,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor context.put("sections", sections); List<Object> topics = getTopics(content); context.put("topics", topics); - String contentTypeId = (String)content.get("contentTypeId"); + String contentTypeId = (String) content.get("contentTypeId"); List<String> contentTypeAncestry = new LinkedList<>(); try { getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); @@ -1260,13 +1260,13 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor context.put("mapKey", null); } } - boolean isReturnBefore = checkWhen(context, (String)whenMap.get("returnBeforePickWhen"), false); + boolean isReturnBefore = checkWhen(context, (String) whenMap.get("returnBeforePickWhen"), false); trailNode.put("isReturnBefore", isReturnBefore); - boolean isPick = checkWhen(context, (String)whenMap.get("pickWhen"), true); + boolean isPick = checkWhen(context, (String) whenMap.get("pickWhen"), true); trailNode.put("isPick", isPick); - boolean isFollow = checkWhen(context, (String)whenMap.get("followWhen"), true); + boolean isFollow = checkWhen(context, (String) whenMap.get("followWhen"), true); trailNode.put("isFollow", isFollow); - boolean isReturnAfter = checkWhen(context, (String)whenMap.get("returnAfterPickWhen"), false); + boolean isReturnAfter = checkWhen(context, (String) whenMap.get("returnAfterPickWhen"), false); trailNode.put("isReturnAfter", isReturnAfter); trailNode.put("checked", Boolean.TRUE); } @@ -1334,10 +1334,10 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static String prepPermissionErrorMsg(Map<String, Object> permResults) { - String permissionStatus = (String)permResults.get("permissionStatus"); + String permissionStatus = (String) permResults.get("permissionStatus"); String errorMessage = "Permission is denied." + permissionStatus; errorMessage += ServiceUtil.getErrorMessage(permResults); - PermissionRecorder recorder = (PermissionRecorder)permResults.get("permissionRecorder"); + PermissionRecorder recorder = (PermissionRecorder) permResults.get("permissionRecorder"); Debug.logInfo("recorder(0):" + recorder, ""); if (recorder != null && recorder.isOn()) { String permissionMessage = recorder.toHtml(); @@ -1398,7 +1398,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor thisNode = new HashMap<>(); thisNode.put("value", thisContent); - String contentId = (String)thisContent.get("contentId"); + String contentId = (String) thisContent.get("contentId"); thisNode.put("contentId", contentId); thisNode.put("contentTypeId", thisContent.get("contentTypeId")); thisNode.put("isReturnBeforePick", Boolean.FALSE); @@ -1425,7 +1425,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor if (node == null) { break; } - String contentId = (String)node.get("contentId"); + String contentId = (String) node.get("contentId"); csv.append(contentId); } return csv.toString(); @@ -1443,7 +1443,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor Debug.logError(e.getMessage(), MODULE); return new LinkedList<>(); } - contentName = (String)content.get("contentName"); + contentName = (String) content.get("contentName"); outList.add(UtilMisc.toList(contentId, contentName)); } return outList; @@ -1483,10 +1483,10 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor public static String getMimeTypeId(Delegator delegator, GenericValue view, Map<String, Object> ctx) { // This order is taken so that the mimeType can be overridden in the transform arguments. - String mimeTypeId = (String)ctx.get("mimeTypeId"); + String mimeTypeId = (String) ctx.get("mimeTypeId"); if (UtilValidate.isEmpty(mimeTypeId) && view != null) { mimeTypeId = (String) view.get("mimeTypeId"); - String parentContentId = (String)ctx.get("contentId"); + String parentContentId = (String) ctx.get("contentId"); if (UtilValidate.isEmpty(mimeTypeId) && UtilValidate.isNotEmpty(parentContentId)) { // will need these below try { GenericValue parentContent = EntityQuery.use(delegator).from("Content").where("contentId", parentContentId).queryOne(); @@ -1574,14 +1574,14 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor Object obj = map.get(key); s.append(spc).append(key).append(sep); if (obj instanceof GenericValue) { - GenericValue gv = (GenericValue)obj; + GenericValue gv = (GenericValue) obj; GenericPK pk = gv.getPrimaryKey(); indent.append(' '); logMap(s, "GMAP[" + key + " name:" + pk.getEntityName()+ "]", pk, indent); indent.setLength(indent.length() - 1); } else if (obj instanceof List<?>) { indent.append(' '); - logList(s, "LIST[" + ((List<?>)obj).size() + "]", UtilGenerics.cast(obj), indent); + logList(s, "LIST[" + ((List<?>) obj).size() + "]", UtilGenerics.cast(obj), indent); indent.setLength(indent.length() - 1); } else if (obj instanceof Map<?, ?>) { indent.append(' '); @@ -1618,14 +1618,14 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor for (Object obj : lst) { s.append(spc); if (obj instanceof GenericValue) { - GenericValue gv = (GenericValue)obj; + GenericValue gv = (GenericValue) obj; GenericPK pk = gv.getPrimaryKey(); indent.append(' '); logMap(s, "MAP[name:" + pk.getEntityName() + "]", pk, indent); indent.setLength(indent.length() - 1); } else if (obj instanceof List<?>) { indent.append(' '); - logList(s, "LIST[" + ((List<?>)obj).size() + "]", UtilGenerics.cast(obj), indent); + logList(s, "LIST[" + ((List<?>) obj).size() + "]", UtilGenerics.cast(obj), indent); indent.setLength(indent.length() - 1); } else if (obj instanceof Map<?, ?>) { indent.append(' '); 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 b9a8ccf..7aa24c6 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 @@ -45,14 +45,14 @@ public class PermissionRecorder { protected Map<String, Object> currentContentMap; protected String privilegeEnumId; protected int currentCheckMode; - protected GenericValue [] contentPurposeOperations; - protected String [] statusTargets; - protected String [] targetOperations; + protected GenericValue[] contentPurposeOperations; + protected String[] statusTargets; + protected String[] targetOperations; 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"}; + private static final String[] opFields = { "contentPurposeTypeId", "contentOperationId", "roleTypeId", "statusId", "privilegeEnumId"}; + private static final String[] fieldTitles = { "Purpose", "Operation", "Role", "Status", "Privilege"}; public PermissionRecorder() { isOn = UtilProperties.propertyValueEqualsIgnoreCase("content", "permissionRecorderOn", "true"); @@ -90,7 +90,7 @@ public class PermissionRecorder { entityPermCheckResult = b; } - public GenericValue [] getContentPurposeOperations() { + public GenericValue[] getContentPurposeOperations() { return contentPurposeOperations != null ? contentPurposeOperations.clone() : null; } @@ -106,7 +106,7 @@ public class PermissionRecorder { return privilegeEnumId; } - public String [] getStatusTargets() { + public String[] getStatusTargets() { return statusTargets != null ? statusTargets.clone() : null; } @@ -114,7 +114,7 @@ public class PermissionRecorder { statusTargets = opList.toArray(new String[opList.size()]); } - public String [] getTargetOperations() { + public String[] getTargetOperations() { return targetOperations != null ? targetOperations.clone() : null; } @@ -244,7 +244,7 @@ public class PermissionRecorder { sb.append("<tr>"); sb.append("<td class=\"target\">"); - sb.append((String)rMap.get("contentId")); + sb.append((String) rMap.get("contentId")); sb.append("</td>"); //if (Debug.infoOn()) Debug.logInfo("renderResultRowHtml, (1):" + sb.toString(), MODULE); @@ -267,7 +267,7 @@ public class PermissionRecorder { sb.append("<tr>"); sb.append("<td class=\"target\">"); - sb.append((String)currentContentResultMap.get("contentId")); + sb.append((String) currentContentResultMap.get("contentId")); sb.append("</td>"); boolean isPass = true; 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 196179a..9dd687b 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 @@ -71,10 +71,10 @@ public class UploadContentAndImage { public static String uploadContentAndImage(HttpServletRequest request, HttpServletResponse response) { try { Locale locale = UtilHttp.getLocale(request); - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Delegator delegator = (Delegator) request.getAttribute("delegator"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); long maxUploadSize = UtilHttp.getMaxUploadSize(delegator); int sizeThreshold = UtilHttp.getSizeThreshold(delegator); @@ -120,8 +120,8 @@ public class UploadContentAndImage { TransactionUtil.begin(); List<String> contentPurposeList = ContentWorker.prepContentPurposeList(passedParams); passedParams.put("contentPurposeList", contentPurposeList); - String entityOperation = (String)passedParams.get("entityOperation"); - String passedContentId = (String)passedParams.get("ftlContentId"); + String entityOperation = (String) passedParams.get("entityOperation"); + String passedContentId = (String) passedParams.get("ftlContentId"); List<String> targetOperationList = ContentWorker.prepTargetOperationList(passedParams, entityOperation); passedParams.put("targetOperationList", targetOperationList); @@ -130,7 +130,7 @@ public class UploadContentAndImage { ftlContext.put("userLogin", userLogin); ftlContext.put("contentId", passedParams.get("ftlContentId")); ftlContext.put("ownerContentId", passedParams.get("ownerContentId")); - String contentTypeId = (String)passedParams.get("contentTypeId"); + String contentTypeId = (String) passedParams.get("contentTypeId"); ftlContext.put("contentTypeId", contentTypeId); ftlContext.put("statusId", passedParams.get("statusId")); ftlContext.put("contentPurposeList", UtilMisc.toList(passedParams.get("contentPurposeList"))); @@ -140,12 +140,12 @@ public class UploadContentAndImage { ftlContext.put("dataTemplateTypeId", passedParams.get("dataTemplateTypeId")); ftlContext.put("description", passedParams.get("description")); ftlContext.put("privilegeEnumId", passedParams.get("privilegeEnumId")); - String drid = (String)passedParams.get("dataResourceId"); + String drid = (String) passedParams.get("dataResourceId"); ftlContext.put("dataResourceId", drid); ftlContext.put("dataResourceTypeId", null); // inhibits persistence of DataResource, because it already exists - String contentIdTo = (String)passedParams.get("contentIdTo"); + String contentIdTo = (String) passedParams.get("contentIdTo"); ftlContext.put("contentIdTo", contentIdTo); - String contentAssocTypeId = (String)passedParams.get("contentAssocTypeId"); + String contentAssocTypeId = (String) passedParams.get("contentAssocTypeId"); ftlContext.put("contentAssocTypeId", null); // Don't post assoc at this time Map<String, Object> ftlResults = dispatcher.runSync("persistContentAndAssoc", ftlContext); if (ServiceUtil.isError(ftlResults)) { @@ -155,7 +155,7 @@ public class UploadContentAndImage { TransactionUtil.rollback(); return "error"; } - String ftlContentId = (String)ftlResults.get("contentId"); + String ftlContentId = (String) ftlResults.get("contentId"); if (UtilValidate.isNotEmpty(contentIdTo)) { Map<String, Object> map = new HashMap<>(); map.put("fromDate", UtilDateTime.nowTimestamp()); @@ -170,7 +170,7 @@ public class UploadContentAndImage { map.put("contentAssocTypeId", "PUBLISH_RELEASE"); } else if ("PUBLISH_LINK".equals(contentAssocTypeId)) { map.put("contentAssocTypeId", "PUBLISH_LINK"); - String publishOperation = (String)passedParams.get("publishOperation"); + String publishOperation = (String) passedParams.get("publishOperation"); if (UtilValidate.isEmpty(publishOperation)) { publishOperation = "CONTENT_PUBLISH"; } @@ -323,7 +323,7 @@ public class UploadContentAndImage { request.setAttribute("passedParams", passedParams); TransactionUtil.commit(); } catch (GenericEntityException | GenericServiceException e) { - Debug.logError(e, "[UploadContentAndImage] " , MODULE); + Debug.logError(e, "[UploadContentAndImage]", MODULE); request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); try { TransactionUtil.rollback(); @@ -339,8 +339,8 @@ public class UploadContentAndImage { public static String uploadContentStuff(HttpServletRequest request, HttpServletResponse response) { try { HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); - Delegator delegator = (Delegator)request.getAttribute("delegator"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); long maxUploadSize = UtilHttp.getMaxUploadSize(delegator); int sizeThreshold = UtilHttp.getSizeThreshold(delegator); @@ -415,7 +415,7 @@ public class UploadContentAndImage { } TransactionUtil.commit(); } catch (GenericTransactionException | GenericServiceException e) { - Debug.logError(e, "[UploadContentAndImage] " , MODULE); + Debug.logError(e, "[UploadContentAndImage]", MODULE); request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); try { TransactionUtil.rollback(); @@ -429,22 +429,22 @@ public class UploadContentAndImage { } public static String processContentUpload(Map<String, Object> passedParams, String suffix, HttpServletRequest request) throws GenericServiceException { - LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); - Delegator delegator = (Delegator)request.getAttribute("delegator"); + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); Map<String, Object> ftlContext = new HashMap<>(); - String contentPurposeString = (String)passedParams.get("contentPurposeString" + suffix); + String contentPurposeString = (String) passedParams.get("contentPurposeString" + suffix); if (UtilValidate.isEmpty(contentPurposeString)) { - contentPurposeString = (String)passedParams.get("contentPurposeString"); + contentPurposeString = (String) passedParams.get("contentPurposeString"); } List<String> contentPurposeList = StringUtil.split(contentPurposeString,"|"); ftlContext.put("contentPurposeList", contentPurposeList); - String targetOperationString = (String)passedParams.get("targetOperationString" + suffix); + String targetOperationString = (String) passedParams.get("targetOperationString" + suffix); if (UtilValidate.isEmpty(targetOperationString)) { - targetOperationString = (String)passedParams.get("targetOperationString"); + targetOperationString = (String) passedParams.get("targetOperationString"); } List<String> targetOperationList = StringUtil.split(targetOperationString,"|"); ftlContext.put("targetOperationList", targetOperationList); @@ -455,7 +455,7 @@ public class UploadContentAndImage { if (objSequenceNum instanceof String) { Long sequenceNum = null; try { - sequenceNum = Long.valueOf((String)objSequenceNum); + sequenceNum = Long.valueOf((String) objSequenceNum); } catch (NumberFormatException e) { String msg = "Caught an exception : " + e.toString(); Debug.logError(e, msg); @@ -501,7 +501,7 @@ public class UploadContentAndImage { } ftlContext.put("textData", passedParams.get("textData" + suffix)); - byte[] bytes = (byte[])passedParams.get("imageData" + suffix); + byte[] bytes = (byte[]) passedParams.get("imageData" + suffix); ftlContext.put("imageData", bytes); if (Debug.infoOn()) { Debug.logInfo("[UploadContentStuff]ftlContext:" + ftlContext, MODULE); @@ -537,7 +537,7 @@ public class UploadContentAndImage { errorMsgList.add(msg); return "error"; } - String returnedContentId = (String)ftlResults.get("contentId"); + String returnedContentId = (String) ftlResults.get("contentId"); if (Debug.infoOn()) { Debug.logInfo("returnedContentId:" + returnedContentId, MODULE); } @@ -549,7 +549,7 @@ public class UploadContentAndImage { request.setAttribute("drDataResourceId" + suffix, ftlResults.get("dataResourceId")); request.setAttribute("caContentId" + suffix, ftlResults.get("contentId")); - String caContentIdTo = (String)passedParams.get("caContentIdTo"); + String caContentIdTo = (String) passedParams.get("caContentIdTo"); if (UtilValidate.isNotEmpty(caContentIdTo)) { Map<String, Object> resequenceContext = new HashMap<>(); resequenceContext.put("contentIdTo", caContentIdTo); 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 dbb8073..8278b02 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 @@ -286,7 +286,7 @@ public class DataEvents { } OutputStream os = response.getOutputStream(); Map<String, Object> resourceData = DataResourceWorker.getDataResourceStream(dataResource, "", application.getInitParameter("webSiteId"), UtilHttp.getLocale(request), application.getRealPath("/"), false); - os.write(IOUtils.toByteArray((InputStream)resourceData.get("stream"))); + os.write(IOUtils.toByteArray((InputStream) resourceData.get("stream"))); os.flush(); } catch (GeneralException | IOException e) { String errMsg = "Error downloading digital product content: " + e.toString(); @@ -314,7 +314,7 @@ public class DataEvents { dataResource.setNonPKFields(paramMap); Map<String, Object> serviceInMap = UtilMisc.makeMapWritable(dataResource); serviceInMap.put("userLogin", userLogin); - String mode = (String)paramMap.get("mode"); + String mode = (String) paramMap.get("mode"); Locale locale = UtilHttp.getLocale(request); try { @@ -337,7 +337,7 @@ public class DataEvents { request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - dataResourceId = (String)result.get("dataResourceId"); + dataResourceId = (String) result.get("dataResourceId"); dataResource.set("dataResourceId", dataResourceId); } } catch (GenericServiceException e) { @@ -350,7 +350,7 @@ public class DataEvents { if ("CREATE".equals(mode)) { // Set up return message to guide selection of follow on view request.setAttribute("dataResourceId", result.get("dataResourceId")); - String dataResourceTypeId = (String)serviceInMap.get("dataResourceTypeId"); + String dataResourceTypeId = (String) serviceInMap.get("dataResourceTypeId"); if (dataResourceTypeId != null) { if ("ELECTRONIC_TEXT".equals(dataResourceTypeId) || "IMAGE_OBJECT".equals(dataResourceTypeId)) { 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 3f1925d..f14142b 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 @@ -229,7 +229,7 @@ public class DataResourceWorker implements org.apache.ofbiz.widget.content.Data String imageFileName = null; Map<String, Object> passedParams = new HashMap<>(); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); passedParams.put("userLogin", userLogin); byte[] imageBytes = null; for (FileItem fileItem : lst) { 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 1289fb2..8efb19c 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 @@ -580,7 +580,7 @@ public class DataServices { GenericValue dataResource = (GenericValue) context.get("dataResource"); String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId"); String objectInfo = (String) dataResource.get("objectInfo"); - byte [] imageData = (byte []) context.get("imageData"); + byte[] imageData = (byte[]) context.get("imageData"); String rootDir = (String) context.get("rootDir"); File file = null; if (Debug.infoOn()) { @@ -633,7 +633,7 @@ public class DataServices { GenericValue dataResource = (GenericValue) context.get("dataResource"); String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId"); String objectInfo = (String) dataResource.get("objectInfo"); - byte [] imageData = (byte []) context.get("imageData"); + byte[] imageData = (byte[]) context.get("imageData"); String rootDir = (String) context.get("rootDir"); File file = null; if (Debug.infoOn()) { 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 4697cd1..2beca77 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 @@ -588,7 +588,7 @@ public class LayoutEvents { GenericPK passedPK = v.getPrimaryKey(); Collection<String> keyColl = passedPK.getAllKeys(); for (String attrName : keyColl) { - String attrVal = (String)request.getAttribute(attrName); + String attrVal = (String) request.getAttribute(attrName); if (attrVal == null) { attrVal = (String) paramMap.get(attrName); } 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 f7c2ed7..9c862ec 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 @@ -61,7 +61,7 @@ public final class LayoutWorker { Map<String, String> formInput = new HashMap<>(); results.put("formInput", formInput); - Delegator delegator = (Delegator)request.getAttribute("delegator"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); long maxUploadSize = UtilHttp.getMaxUploadSize(delegator); int sizeThreshold = UtilHttp.getSizeThreshold(delegator); 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 7f09825..63e6a76 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 @@ -260,8 +260,8 @@ public class PdfSurveyServices { continue; } - String surveyQuestionId = (String)surveyQuestionAndAppl.get("surveyQuestionId"); - String surveyQuestionTypeId = (String)surveyQuestionAndAppl.get("surveyQuestionTypeId"); + String surveyQuestionId = (String) surveyQuestionAndAppl.get("surveyQuestionId"); + String surveyQuestionTypeId = (String) surveyQuestionAndAppl.get("surveyQuestionTypeId"); GenericValue surveyResponseAnswer = delegator.makeValue("SurveyResponseAnswer", UtilMisc.toMap("surveyResponseId", surveyResponseId, "surveyQuestionId", surveyQuestionId)); if (surveyQuestionTypeId == null || "TEXT_SHORT".equals(surveyQuestionTypeId)) { surveyResponseAnswer.set("textResponse", value); @@ -328,16 +328,16 @@ public class PdfSurveyServices { String fieldValue = fs.getField(fieldName); Object obj = acroFieldMap.get(fieldName); if (obj instanceof Date) { - Date d=(Date)obj; - fieldValue=UtilDateTime.toDateString(d); + Date d = (Date) obj; + fieldValue = UtilDateTime.toDateString(d); } else if (obj instanceof Long) { - Long lg=(Long)obj; - fieldValue=lg.toString(); + Long lg = (Long) obj; + fieldValue = lg.toString(); } else if (obj instanceof Integer) { - Integer ii=(Integer)obj; - fieldValue=ii.toString(); + Integer ii = (Integer) obj; + fieldValue = ii.toString(); } else { - fieldValue=(String)obj; + fieldValue = (String) obj; } if (UtilValidate.isNotEmpty(fieldValue)) { 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 4df51ca..8ab454e 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 @@ -484,8 +484,8 @@ public class SurveyWrapper { resultMap.put("_a_type", "option"); } else if ("BOOLEAN".equals(questionType)) { long[] thisResult = getBooleanResult(question); - long yesPercent = thisResult[1] > 0 ? (long)(((double)thisResult[1] / (double)thisResult[0]) * 100) : 0; - long noPercent = thisResult[2] > 0 ? (long)(((double)thisResult[2] / (double)thisResult[0]) * 100) : 0; + long yesPercent = thisResult[1] > 0 ? (long) (((double) thisResult[1] / (double) thisResult[0]) * 100) : 0; + long noPercent = thisResult[2] > 0 ? (long) (((double) thisResult[2] / (double) thisResult[0]) * 100) : 0; resultMap.put("_total", thisResult[0]); resultMap.put("_yes_total", thisResult[1]); 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 74a2f89..8299103 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 @@ -84,7 +84,7 @@ public class SimpleContentViewHandler extends AbstractViewHandler { try { if (Debug.verboseOn()) Debug.logVerbose("dataResourceId:" + dataResourceId, MODULE); - Delegator delegator = (Delegator)request.getAttribute("delegator"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); if (UtilValidate.isEmpty(dataResourceId)) { if (UtilValidate.isEmpty(contentRevisionSeqId)) { if (UtilValidate.isEmpty(mapKey) && UtilValidate.isEmpty(contentAssocTypeId)) { 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 c15392f..56cf917 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 @@ -53,8 +53,8 @@ public class CheckPermissionTransform implements TemplateTransformModel { private static final String MODULE = CheckPermissionTransform.class.getName(); - static final String [] saveKeyNames = {"globalNodeTrail", "nodeTrail", "mode", "purposeTypeId", "statusId", "entityOperation", "targetOperation" }; - public static final String [] removeKeyNames = {}; + static final String[] saveKeyNames = {"globalNodeTrail", "nodeTrail", "mode", "purposeTypeId", "statusId", "entityOperation", "targetOperation" }; + public static final String[] removeKeyNames = {}; /** * @deprecated use FreeMarkerWorker.getWrappedObject() @@ -93,8 +93,8 @@ public class CheckPermissionTransform implements TemplateTransformModel { final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); FreeMarkerWorker.getSiteParameters(request, templateCtx); FreeMarkerWorker.overrideWithArgs(templateCtx, args); - final String mode = (String)templateCtx.get("mode"); - final String quickCheckContentId = (String)templateCtx.get("quickCheckContentId"); + final String mode = (String) templateCtx.get("mode"); + final String quickCheckContentId = (String) templateCtx.get("quickCheckContentId"); final Map<String, Object> savedValues = new HashMap<>(); return new LoopWriter(out) { @@ -113,8 +113,8 @@ public class CheckPermissionTransform implements TemplateTransformModel { public int onStart() throws TemplateModelException, IOException { List<Map<String, ? extends Object>> trail = UtilGenerics.cast(templateCtx.get("globalNodeTrail")); GenericValue currentContent = null; - String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId"); - String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly"); + String contentAssocPredicateId = (String) templateCtx.get("contentAssocPredicateId"); + String strNullThruDatesOnly = (String) templateCtx.get("nullThruDatesOnly"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE : Boolean.FALSE; GenericValue val = null; try { @@ -134,8 +134,8 @@ public class CheckPermissionTransform implements TemplateTransformModel { security = (Security) request.getAttribute("security"); } - String statusId = (String)currentContent.get("statusId"); - String passedStatusId = (String)templateCtx.get("statusId"); + String statusId = (String) currentContent.get("statusId"); + String passedStatusId = (String) templateCtx.get("statusId"); List<String> statusList = StringUtil.split(passedStatusId, "|"); if (statusList == null) { statusList = new LinkedList<>(); @@ -143,10 +143,10 @@ public class CheckPermissionTransform implements TemplateTransformModel { if (UtilValidate.isNotEmpty(statusId) && !statusList.contains(statusId)) { statusList.add(statusId); } - String targetPurpose = (String)templateCtx.get("contentPurposeList"); + String targetPurpose = (String) templateCtx.get("contentPurposeList"); List<String> purposeList = StringUtil.split(targetPurpose, "|"); - String entityOperation = (String)templateCtx.get("entityOperation"); - String targetOperation = (String)templateCtx.get("targetOperation"); + String entityOperation = (String) templateCtx.get("entityOperation"); + String targetOperation = (String) templateCtx.get("targetOperation"); if (UtilValidate.isEmpty(targetOperation)) { if (UtilValidate.isNotEmpty(entityOperation)) { targetOperation = "CONTENT" + entityOperation; @@ -158,7 +158,7 @@ public class CheckPermissionTransform implements TemplateTransformModel { } List<String> roleList = new LinkedList<>(); - String privilegeEnumId = (String)currentContent.get("privilegeEnumId"); + String privilegeEnumId = (String) currentContent.get("privilegeEnumId"); Map<String, Object> results = EntityPermissionChecker.checkPermission(currentContent, statusList, userLogin, purposeList, targetOperationList, roleList, delegator, security, entityOperation, privilegeEnumId, quickCheckContentId); boolean isError = ModelService.RESPOND_ERROR.equals(results.get(ModelService.RESPONSE_MESSAGE)); @@ -170,7 +170,7 @@ public class CheckPermissionTransform implements TemplateTransformModel { if (UtilValidate.isEmpty(permissionStatus) || !"granted".equals(permissionStatus)) { String errorMessage = "Permission to add response is denied (2)"; - PermissionRecorder recorder = (PermissionRecorder)results.get("permissionRecorder"); + PermissionRecorder recorder = (PermissionRecorder) results.get("permissionRecorder"); if (recorder != null) { String permissionMessage = recorder.toHtml(); errorMessage += " \n " + permissionMessage; 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 6d117d5..83695d0 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 @@ -50,7 +50,7 @@ import freemarker.template.TemplateTransformModel; public class EditRenderSubContentCacheTransform implements TemplateTransformModel { private static final String MODULE = EditRenderSubContentCacheTransform.class.getName(); - static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly"}; + static final String[] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly"}; /** * @deprecated use FreeMarkerWorker.getWrappedObject() @@ -90,8 +90,8 @@ public class EditRenderSubContentCacheTransform implements TemplateTransformMode FreeMarkerWorker.overrideWithArgs(templateCtx, args); final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); List<Map<String, ? extends Object>> trail = UtilGenerics.cast(templateCtx.get("globalNodeTrail")); - String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId"); - String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly"); + String contentAssocPredicateId = (String) templateCtx.get("contentAssocPredicateId"); + String strNullThruDatesOnly = (String) templateCtx.get("nullThruDatesOnly"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; GenericValue val = null; try { @@ -109,7 +109,7 @@ public class EditRenderSubContentCacheTransform implements TemplateTransformMode } String subContentIdSub = (String) view.get("contentId"); // This order is taken so that the dataResourceType can be overridden in the transform arguments. - String subDataResourceTypeId = (String)templateCtx.get("subDataResourceTypeId"); + String subDataResourceTypeId = (String) templateCtx.get("subDataResourceTypeId"); if (UtilValidate.isEmpty(subDataResourceTypeId)) { try { subDataResourceTypeId = (String) view.get("drDataResourceTypeId"); @@ -146,7 +146,7 @@ public class EditRenderSubContentCacheTransform implements TemplateTransformMode public void close() throws IOException { FreeMarkerWorker.reloadValues(templateCtx, savedValues, env); String wrappedContent = buf.toString(); - String wrapTemplateId = (String)templateCtx.get("wrapTemplateId"); + String wrapTemplateId = (String) templateCtx.get("wrapTemplateId"); if (UtilValidate.isNotEmpty(wrapTemplateId)) { templateCtx.put("wrappedContent", wrappedContent); Map<String, Object> templateRoot = null; 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 d6bc00d..c079498 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 @@ -87,7 +87,7 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel { return new LoopWriter(out) { - final String passedCsv = (String)templateCtx.get("nodeTrailCsv"); + final String passedCsv = (String) templateCtx.get("nodeTrailCsv"); @Override public void write(char cbuf[], int off, int len) { @@ -110,18 +110,18 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel { } // This will build a nodeTrail if none exists // Maybe only contentId or subContentId are passed in - String redo = (String)templateCtx.get("redo"); + String redo = (String) templateCtx.get("redo"); if (UtilValidate.isEmpty(trail) || (redo != null && "true".equalsIgnoreCase(redo))) { - String subContentId = (String)templateCtx.get("subContentId"); + String subContentId = (String) templateCtx.get("subContentId"); if (Debug.infoOn()) { Debug.logInfo("in InjectNodeTrailCsv(0), subContentId:"+subContentId, MODULE); } - String contentId = (String)templateCtx.get("contentId"); + String contentId = (String) templateCtx.get("contentId"); if (Debug.infoOn()) { Debug.logInfo("in InjectNodeTrailCsv(0), contentId:"+contentId, MODULE); } - String contentAssocTypeId = (String)templateCtx.get("contentAssocTypeId"); + String contentAssocTypeId = (String) templateCtx.get("contentAssocTypeId"); if (Debug.infoOn()) { Debug.logInfo("in InjectNodeTrailCsv(0), contentAssocTypeId:"+contentAssocTypeId, MODULE); } @@ -160,7 +160,7 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel { if (UtilValidate.isNotEmpty(lastPassedContentId)) { if (UtilValidate.isNotEmpty(trail)) { Map<String, ? extends Object> nd = trail.get(0); - String firstTrailContentId = (String)nd.get("contentId"); + String firstTrailContentId = (String) nd.get("contentId"); if (UtilValidate.isNotEmpty(firstTrailContentId) && UtilValidate.isNotEmpty(lastPassedContentId) && firstTrailContentId.equals(lastPassedContentId)) { 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 6567ce1..67dbf40 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 @@ -225,8 +225,8 @@ public class LimitedSubContentCacheTransform implements TemplateTransformModel { Boolean isReturnBeforeObj = (Boolean) trailNode.get("isReturnBefore"); Boolean isPickObj = (Boolean) trailNode.get("isPick"); Boolean isFollowObj = (Boolean) trailNode.get("isFollow"); - if ((isReturnBeforeObj == null || !isReturnBeforeObj) && ((isPickObj != null && - isPickObj) || (isFollowObj != null && isFollowObj))) { + if ((isReturnBeforeObj == null || !isReturnBeforeObj) && ((isPickObj != null + && isPickObj) || (isFollowObj != null && isFollowObj))) { List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.cast(ctx.get("globalNodeTrail")); if (globalNodeTrail == null) { globalNodeTrail = new LinkedList<>(); 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 5583c8e..0b5af2a 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 @@ -114,7 +114,7 @@ public class LoopSubContentTransform implements TemplateTransformModel { String mimeTypeId = (String) ctx.get("mimeTypeId"); if (UtilValidate.isEmpty(mimeTypeId)) { mimeTypeId = (String) subContentDataResourceView.get("mimeTypeId"); - String parentContentId = (String)ctx.get("contentId"); + String parentContentId = (String) ctx.get("contentId"); if (UtilValidate.isEmpty(mimeTypeId) && UtilValidate.isNotEmpty(parentContentId)) { // will need these below try { GenericValue parentContent = EntityQuery.use(delegator).from("Content").where("contentId", parentContentId).queryOne(); @@ -184,7 +184,7 @@ public class LoopSubContentTransform implements TemplateTransformModel { String thisContentId = (String) templateCtx.get("contentId"); //DEJ20080730 Should always use contentId, not subContentId since we're searching for that and it is confusing - String thisMapKey = (String)templateCtx.get("mapKey"); + String thisMapKey = (String) templateCtx.get("mapKey"); Map<String, Object> results = ContentServicesComplex.getAssocAndContentAndDataResourceMethod(delegator, thisContentId, thisMapKey, null, fromDate, null, null, null, assocTypes, null); List<GenericValue> entityList = UtilGenerics.cast(results.get("entityList")); templateCtx.put("entityList", entityList); @@ -228,7 +228,7 @@ public class LoopSubContentTransform implements TemplateTransformModel { out.write(wrappedFTL); wrappedFTL = ""; // So it won't get written again below. } - String wrapTemplateId = (String)templateCtx.get("wrapTemplateId"); + String wrapTemplateId = (String) templateCtx.get("wrapTemplateId"); if (UtilValidate.isNotEmpty(wrapTemplateId)) { templateCtx.put("wrappedFTL", 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 2036bba..1238bfe 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 @@ -94,9 +94,9 @@ public class RenderContentAndSubContent implements TemplateTransformModel { Debug.logVerbose("in RenderContentAndSubContent, subContentId(2):" + templateRoot.get("subContentId"), MODULE); } try { - String contentId = (String)templateRoot.get("contentId"); - String mapKey = (String)templateRoot.get("mapKey"); - String contentAssocTypeId = (String)templateRoot.get("contentAssocTypeId"); + String contentId = (String) templateRoot.get("contentId"); + String mapKey = (String) templateRoot.get("mapKey"); + String contentAssocTypeId = (String) templateRoot.get("contentAssocTypeId"); if (UtilValidate.isNotEmpty(mapKey) || UtilValidate.isNotEmpty(contentAssocTypeId)) { String txt = ContentWorker.renderSubContentAsText(dispatcher, contentId, mapKey, templateRoot, locale, mimeTypeId, true); out.write(txt); @@ -104,7 +104,7 @@ public class RenderContentAndSubContent implements TemplateTransformModel { ContentWorker.renderContentAsText(dispatcher, contentId, out, templateRoot, locale, mimeTypeId, null, null, true); } } catch (GeneralException e) { - String errMsg = "Error rendering thisContentId:" + (String)templateRoot.get("contentId") + " msg:" + e.toString(); + String errMsg = "Error rendering thisContentId:" + (String) templateRoot.get("contentId") + " msg:" + e.toString(); Debug.logError(e, errMsg, MODULE); // just log a message and don't return anything: throw new IOException(); } 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 4412525..4b7480b 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 @@ -52,8 +52,8 @@ import freemarker.template.TemplateTransformModel; public class RenderContentAsText implements TemplateTransformModel { 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"}; + static final String[] upSaveKeyNames = {"globalNodeTrail"}; + static final String[] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"}; @Override @SuppressWarnings("unchecked") @@ -73,11 +73,11 @@ public class RenderContentAsText implements TemplateTransformModel { if (Debug.verboseOn()) { Debug.logVerbose("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), MODULE); } - final String thisContentId = (String)templateRoot.get("contentId"); - final String xmlEscape = (String)templateRoot.get("xmlEscape"); + final String thisContentId = (String) templateRoot.get("contentId"); + final String xmlEscape = (String) templateRoot.get("xmlEscape"); final boolean directAssocMode = UtilValidate.isNotEmpty(thisContentId) ? true : false; if (Debug.verboseOn()) { - Debug.logVerbose("in Render(0), directAssocMode ." + directAssocMode , MODULE); + Debug.logVerbose("in Render(0), directAssocMode ." + directAssocMode, MODULE); } final Map<String, Object> savedValues = new HashMap<>(); @@ -112,9 +112,9 @@ public class RenderContentAsText implements TemplateTransformModel { locale = UtilMisc.ensureLocale(localeObject); } - String editRequestName = (String)templateRoot.get("editRequestName"); + String editRequestName = (String) templateRoot.get("editRequestName"); if (Debug.verboseOn()) { - Debug.logVerbose("in Render(3), editRequestName ." + editRequestName , MODULE); + Debug.logVerbose("in Render(3), editRequestName ." + editRequestName, MODULE); } if (UtilValidate.isNotEmpty(editRequestName)) { @@ -161,7 +161,7 @@ public class RenderContentAsText implements TemplateTransformModel { } String fullRequest = editRequestName; String contentId = null; - contentId = (String)templateRoot.get("subContentId"); + contentId = (String) templateRoot.get("subContentId"); String delim = "?"; if (UtilValidate.isNotEmpty(contentId)) { fullRequest += delim + "contentId=" + contentId; @@ -177,7 +177,7 @@ public class RenderContentAsText implements TemplateTransformModel { } public String getEditStyle() { - String editStyle = (String)templateRoot.get("editStyle"); + String editStyle = (String) templateRoot.get("editStyle"); if (UtilValidate.isEmpty(editStyle)) { editStyle = UtilProperties.getPropertyValue("content", "defaultEditStyle"); } 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 4c44f1f..f156c21 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 @@ -61,8 +61,8 @@ public class RenderContentTransform implements TemplateTransformModel { final MapStack<String> templateRoot = MapStack.create(FreeMarkerWorker.createEnvironmentMap(env)); templateRoot.push(args); - final String xmlEscape = (String)templateRoot.get("xmlEscape"); - final String thisContentId = (String)templateRoot.get("contentId"); + final String xmlEscape = (String) templateRoot.get("xmlEscape"); + final String thisContentId = (String) templateRoot.get("contentId"); return new Writer(out) { @@ -90,7 +90,7 @@ public class RenderContentTransform implements TemplateTransformModel { locale = UtilMisc.ensureLocale(localeObject); } - String editRequestName = (String)templateRoot.get("editRequestName"); + String editRequestName = (String) templateRoot.get("editRequestName"); if (UtilValidate.isNotEmpty(editRequestName)) { String editStyle = getEditStyle(); @@ -100,7 +100,7 @@ public class RenderContentTransform implements TemplateTransformModel { try { String txt = null; - String mapKey = (String)templateRoot.get("mapKey"); + String mapKey = (String) templateRoot.get("mapKey"); if (UtilValidate.isEmpty(mapKey)) { txt = ContentWorker.renderContentAsText(dispatcher, thisContentId, templateRoot, locale, mimeTypeId, true); } else { @@ -145,7 +145,7 @@ public class RenderContentTransform implements TemplateTransformModel { } public String getEditStyle() { - String editStyle = (String)templateRoot.get("editStyle"); + String editStyle = (String) templateRoot.get("editStyle"); if (UtilValidate.isEmpty(editStyle)) { editStyle = UtilProperties.getPropertyValue("content", "defaultEditStyle"); } 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 843553c..94384f5 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 @@ -48,8 +48,8 @@ import freemarker.template.TemplateTransformModel; public class RenderSubContentAsText implements TemplateTransformModel { 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"}; + public static final String[] upSaveKeyNames = {"globalNodeTrail"}; + public static final String[] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"}; @Override @SuppressWarnings("unchecked") @@ -68,15 +68,15 @@ public class RenderSubContentAsText implements TemplateTransformModel { if (Debug.infoOn()) { Debug.logInfo("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), MODULE); } - final String thisContentId = (String)templateRoot.get("contentId"); - final String thisMapKey = (String)templateRoot.get("mapKey"); - final String xmlEscape = (String)templateRoot.get("xmlEscape"); + final String thisContentId = (String) templateRoot.get("contentId"); + final String thisMapKey = (String) templateRoot.get("mapKey"); + final String xmlEscape = (String) templateRoot.get("xmlEscape"); if (Debug.infoOn()) { - Debug.logInfo("in Render(0), thisSubContentId ." + thisContentId , MODULE); + Debug.logInfo("in Render(0), thisSubContentId ." + thisContentId, MODULE); } final boolean directAssocMode = UtilValidate.isNotEmpty(thisContentId) ? true : false; if (Debug.infoOn()) { - Debug.logInfo("in Render(0), directAssocMode ." + directAssocMode , MODULE); + Debug.logInfo("in Render(0), directAssocMode ." + directAssocMode, MODULE); } final Map<String, Object> savedValues = new HashMap<>(); @@ -111,8 +111,8 @@ public class RenderSubContentAsText implements TemplateTransformModel { locale = UtilMisc.ensureLocale(localeObject); } - String editRequestName = (String)templateRoot.get("editRequestName"); - if (Debug.infoOn()) Debug.logInfo("in Render(3), editRequestName ." + editRequestName , MODULE); + String editRequestName = (String) templateRoot.get("editRequestName"); + if (Debug.infoOn()) Debug.logInfo("in Render(3), editRequestName ." + editRequestName, MODULE); if (UtilValidate.isNotEmpty(editRequestName)) { String editStyle = getEditStyle(); @@ -152,7 +152,7 @@ public class RenderSubContentAsText implements TemplateTransformModel { } public String getEditStyle() { - String editStyle = (String)templateRoot.get("editStyle"); + String editStyle = (String) templateRoot.get("editStyle"); if (UtilValidate.isEmpty(editStyle)) { editStyle = UtilProperties.getPropertyValue("content", "defaultEditStyle"); } 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 e95cd65..1953f7c 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 @@ -69,10 +69,10 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { FreeMarkerWorker.overrideWithArgs(templateRoot, args); final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); List<Map<String, ? extends Object>> trail = UtilGenerics.cast(templateRoot.get("globalNodeTrail")); - String contentAssocPredicateId = (String)templateRoot.get("contentAssocPredicateId"); - String strNullThruDatesOnly = (String)templateRoot.get("nullThruDatesOnly"); + String contentAssocPredicateId = (String) templateRoot.get("contentAssocPredicateId"); + String strNullThruDatesOnly = (String) templateRoot.get("nullThruDatesOnly"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; - String thisSubContentId = (String)templateRoot.get("subContentId"); + String thisSubContentId = (String) templateRoot.get("subContentId"); final boolean directAssocMode = UtilValidate.isNotEmpty(thisSubContentId) ? true : false; GenericValue val = null; try { @@ -93,9 +93,9 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { subContentIdSub = (String) view.get("contentId"); } // This order is taken so that the dataResourceType can be overridden in the transform arguments. - String subDataResourceTypeId = (String)templateRoot.get("subDataResourceTypeId"); + String subDataResourceTypeId = (String) templateRoot.get("subDataResourceTypeId"); - if (UtilValidate.isEmpty(subDataResourceTypeId) && view != null ) { + if (UtilValidate.isEmpty(subDataResourceTypeId) && view != null) { try { subDataResourceTypeId = (String) view.get("drDataResourceTypeId"); } catch (IllegalArgumentException e) { @@ -135,17 +135,17 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { public void renderSubContent() throws IOException { List<Map<String, ? extends Object>> passedGlobalNodeTrail = UtilGenerics.cast(templateRoot.get("globalNodeTrail")); - String editRequestName = (String)templateRoot.get("editRequestName"); + String editRequestName = (String) templateRoot.get("editRequestName"); GenericValue thisView = null; if (view != null) { thisView = view; } else if (passedGlobalNodeTrail.size() > 0) { Map<String, ? extends Object> map = UtilGenerics.cast(passedGlobalNodeTrail.get(passedGlobalNodeTrail.size() - 1)); if (Debug.infoOn()) { - Debug.logInfo("in Render(3), map ." + map , MODULE); + Debug.logInfo("in Render(3), map ." + map, MODULE); } if (map != null) { - thisView = (GenericValue)map.get("value"); + thisView = (GenericValue) map.get("value"); } } @@ -190,11 +190,11 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { String fromDate = null; if (!directAssocMode) { - contentIdTo = (String)templateRoot.get("contentId"); - contentAssocTypeId = (String)templateRoot.get("contentAssocTypeId"); - mapKey = (String)templateRoot.get("mapKey"); - fromDate = (String)templateRoot.get("fromDate"); - if (Debug.infoOn()) Debug.logInfo("in Render(0), view ." + view , MODULE); + contentIdTo = (String) templateRoot.get("contentId"); + contentAssocTypeId = (String) templateRoot.get("contentAssocTypeId"); + mapKey = (String) templateRoot.get("mapKey"); + fromDate = (String) templateRoot.get("fromDate"); + if (Debug.infoOn()) Debug.logInfo("in Render(0), view ." + view, MODULE); if (view != null) { ModelEntity modelEntity = view.getModelEntity(); if (UtilValidate.isEmpty(contentId) && modelEntity.getField("caContentId") != null) @@ -219,9 +219,9 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { fromDate = view.getString("fromDate"); } } else { - contentId = (String)templateRoot.get("subContentId"); + contentId = (String) templateRoot.get("subContentId"); } - if (Debug.infoOn()) Debug.logInfo("in Render(0), contentIdTo ." + contentIdTo , MODULE); + if (Debug.infoOn()) Debug.logInfo("in Render(0), contentIdTo ." + contentIdTo, MODULE); String delim = "?"; if (UtilValidate.isNotEmpty(contentId)) { fullRequest += delim + "contentId=" + contentId; @@ -244,7 +244,7 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { delim = "&"; } - if (Debug.infoOn()) Debug.logInfo("in Render(2), contentIdTo ." + contentIdTo , MODULE); + if (Debug.infoOn()) Debug.logInfo("in Render(2), contentIdTo ." + contentIdTo, MODULE); out.write("<a href=\""); ServletContext servletContext = request.getSession().getServletContext(); RequestHandler rh = (RequestHandler) servletContext.getAttribute("_REQUEST_HANDLER_"); @@ -254,7 +254,7 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { } public String getEditStyle() { - String editStyle = (String)templateRoot.get("editStyle"); + String editStyle = (String) templateRoot.get("editStyle"); if (UtilValidate.isEmpty(editStyle)) { editStyle = UtilProperties.getPropertyValue("content", "defaultEditStyle"); } 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 daa20a3..7d673e8 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 @@ -49,8 +49,8 @@ import freemarker.template.TransformControl; public class TraverseSubContentCacheTransform implements TemplateTransformModel { 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"}; + static final String[] upSaveKeyNames = {"globalNodeTrail"}; + static final String[] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"}; /** * @deprecated use FreeMarkerWorker.getWrappedObject() @@ -87,14 +87,14 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp); final Map<String, Object> savedValues = new HashMap<>(); FreeMarkerWorker.overrideWithArgs(templateRoot, args); - String startContentAssocTypeId = (String)templateRoot.get("contentAssocTypeId"); + String startContentAssocTypeId = (String) templateRoot.get("contentAssocTypeId"); final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env); final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env); FreeMarkerWorker.getSiteParameters(request, templateRoot); final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.cast(templateRoot.get("globalNodeTrail")); - String strNullThruDatesOnly = (String)templateRoot.get("nullThruDatesOnly"); - String contentAssocPredicateId = (String)templateRoot.get("contentAssocPredicateId"); + String strNullThruDatesOnly = (String) templateRoot.get("nullThruDatesOnly"); + String contentAssocPredicateId = (String) templateRoot.get("contentAssocPredicateId"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; try { // getCurrentContent puts the "current" node on the end of globalNodeTrail. @@ -114,8 +114,8 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel whenMap.put("returnAfterPickWhen", templateRoot.get("returnAfterPickWhen")); traverseContext.put("whenMap", whenMap); env.setVariable("whenMap", FreeMarkerWorker.autoWrap(whenMap, env)); - String fromDateStr = (String)templateRoot.get("fromDateStr"); - String thruDateStr = (String)templateRoot.get("thruDateStr"); + String fromDateStr = (String) templateRoot.get("fromDateStr"); + String thruDateStr = (String) templateRoot.get("thruDateStr"); Timestamp fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { fromDate = UtilDateTime.toTimestamp(fromDateStr); @@ -127,7 +127,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel } traverseContext.put("thruDate", thruDate); traverseContext.put("contentAssocTypeId", startContentAssocTypeId); - String direction = (String)templateRoot.get("direction"); + String direction = (String) templateRoot.get("direction"); if (UtilValidate.isEmpty(direction)) { direction = "From"; } @@ -154,7 +154,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel int sz = globalNodeTrail.size(); nodeTrail = new LinkedList<>(); node = UtilGenerics.cast(globalNodeTrail.get(sz - 1)); - Boolean checkedObj = (Boolean)node.get("checked"); + Boolean checkedObj = (Boolean) node.get("checked"); Map<String, Object> whenMap = UtilGenerics.cast(templateRoot.get("whenMap")); if (checkedObj == null || !checkedObj) { ContentWorker.checkConditions(delegator, node, null, whenMap); @@ -163,7 +163,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel throw new IOException("Empty node trail entries"); } - Boolean isReturnBeforePickBool = (Boolean)node.get("isReturnBeforePick"); + Boolean isReturnBeforePickBool = (Boolean) node.get("isReturnBeforePick"); if (isReturnBeforePickBool != null && isReturnBeforePickBool) { return TransformControl.SKIP_BODY; } @@ -171,8 +171,8 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel ContentWorker.selectKids(node, traverseContext); nodeTrail.add(node); traverseContext.put("nodeTrail", nodeTrail); - Boolean isPickBool = (Boolean)node.get("isPick"); - Boolean isFollowBool = (Boolean)node.get("isFollow"); + Boolean isPickBool = (Boolean) node.get("isPick"); + Boolean isFollowBool = (Boolean) node.get("isFollow"); boolean isPick = true; if ((isPickBool == null || !isPickBool) && (isFollowBool != null && isFollowBool)) { @@ -211,13 +211,13 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel List<Map<String, ? extends Object>> nodeTrail = UtilGenerics.cast(traverseContext.get("nodeTrail")); int sz = nodeTrail.size(); Map<String, ? extends Object> node = nodeTrail.get(sz - 1); - GenericValue content = (GenericValue)node.get("value"); - String contentId = (String)node.get("contentId"); - String contentAssocTypeId = (String)node.get("contentAssocTypeId"); + GenericValue content = (GenericValue) node.get("value"); + String contentId = (String) node.get("contentId"); + String contentAssocTypeId = (String) node.get("contentAssocTypeId"); envWrap("contentAssocTypeId", contentAssocTypeId); envWrap("contentId", contentId); envWrap("content", content); - String mapKey = (String)node.get("mapKey"); + String mapKey = (String) node.get("mapKey"); envWrap("mapKey", mapKey); envWrap("subContentDataResourceView", null); List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.cast(templateContext.get("nodeTrail")); @@ -225,9 +225,9 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel String contentIdStart = null; if (globalNodeTrail != null) { Map<String, ? extends Object> ndEnd = globalNodeTrail.get(globalNodeTrail.size() - 1); - contentIdEnd = (String)ndEnd.get("contentId"); + contentIdEnd = (String) ndEnd.get("contentId"); Map<String, ? extends Object> ndStart = nodeTrail.get(0); - contentIdStart = (String)ndStart.get("contentId"); + contentIdStart = (String) ndStart.get("contentId"); } else { globalNodeTrail = new LinkedList<>(); contentIdStart = ""; 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 0975631..834188d 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 @@ -52,8 +52,8 @@ import freemarker.template.TransformControl; public class TraverseSubContentTransform implements TemplateTransformModel { 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"}; + 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"}; /** * @deprecated use FreeMarkerWorker.getWrappedObject() @@ -91,10 +91,10 @@ public class TraverseSubContentTransform implements TemplateTransformModel { final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env); final LocalDispatcher dispatcher = FreeMarkerWorker.getWrappedObject("dispatcher", env); GenericValue view = FreeMarkerWorker.getWrappedObject("subContentDataResourceView", env); - final Integer indent = (templateCtx.get("indent") == null) ? Integer.valueOf(0) : (Integer)templateCtx.get("indent"); + final Integer indent = (templateCtx.get("indent") == null) ? Integer.valueOf(0) : (Integer) templateCtx.get("indent"); - String contentId = (String)templateCtx.get("contentId"); - String subContentId = (String)templateCtx.get("subContentId"); + String contentId = (String) templateCtx.get("contentId"); + String subContentId = (String) templateCtx.get("subContentId"); if (view == null) { String thisContentId = subContentId; if (UtilValidate.isEmpty(thisContentId)) { @@ -119,8 +119,8 @@ public class TraverseSubContentTransform implements TemplateTransformModel { whenMap.put("returnBeforePickWhen", templateCtx.get("returnBeforePickWhen")); whenMap.put("returnAfterPickWhen", templateCtx.get("returnAfterPickWhen")); traverseContext.put("whenMap", whenMap); - String fromDateStr = (String)templateCtx.get("fromDateStr"); - String thruDateStr = (String)templateCtx.get("thruDateStr"); + String fromDateStr = (String) templateCtx.get("fromDateStr"); + String thruDateStr = (String) templateCtx.get("thruDateStr"); Timestamp fromDate = null; if (UtilValidate.isNotEmpty(fromDateStr)) { fromDate = UtilDateTime.toTimestamp(fromDateStr); @@ -131,11 +131,11 @@ public class TraverseSubContentTransform implements TemplateTransformModel { thruDate = UtilDateTime.toTimestamp(thruDateStr); } traverseContext.put("thruDate", thruDate); - String startContentAssocTypeId = (String)templateCtx.get("contentAssocTypeId"); + String startContentAssocTypeId = (String) templateCtx.get("contentAssocTypeId"); if (startContentAssocTypeId != null) startContentAssocTypeId = "SUB_CONTENT"; traverseContext.put("contentAssocTypeId", startContentAssocTypeId); - String direction = (String)templateCtx.get("direction"); + String direction = (String) templateCtx.get("direction"); if (UtilValidate.isEmpty(direction)) direction = "From"; traverseContext.put("direction", direction); @@ -162,7 +162,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel { ContentWorker.selectKids(rootNode, traverseContext); ContentWorker.traceNodeTrail("2", nodeTrail); nodeTrail.add(rootNode); - boolean isPick = checkWhen(subContentDataResourceView, (String)traverseContext.get("contentAssocTypeId")); + boolean isPick = checkWhen(subContentDataResourceView, (String) traverseContext.get("contentAssocTypeId")); rootNode.put("isPick", isPick); if (!isPick) { ContentWorker.traceNodeTrail("3", nodeTrail); @@ -195,12 +195,12 @@ public class TraverseSubContentTransform implements TemplateTransformModel { @Override public void close() throws IOException { String wrappedFTL = buf.toString(); - String encloseWrappedText = (String)templateCtx.get("encloseWrappedText"); + String encloseWrappedText = (String) templateCtx.get("encloseWrappedText"); if (UtilValidate.isEmpty(encloseWrappedText) || "false".equalsIgnoreCase(encloseWrappedText)) { out.write(wrappedFTL); wrappedFTL = null; // So it won't get written again below. } - String wrapTemplateId = (String)templateCtx.get("wrapTemplateId"); + String wrapTemplateId = (String) templateCtx.get("wrapTemplateId"); if (UtilValidate.isNotEmpty(wrapTemplateId)) { templateCtx.put("wrappedFTL", wrappedFTL); Map<String, Object> templateRoot = FreeMarkerWorker.createEnvironmentMap(env); @@ -230,8 +230,8 @@ public class TraverseSubContentTransform implements TemplateTransformModel { contentAssocTypeId = ""; } assocContext.put("contentAssocTypeId", contentAssocTypeId); - String thisDirection = (String)templateCtx.get("direction"); - String thisContentId = (String)templateCtx.get("thisContentId"); + String thisDirection = (String) templateCtx.get("direction"); + String thisContentId = (String) templateCtx.get("thisContentId"); if (thisDirection != null && "From".equalsIgnoreCase(thisDirection)) { assocContext.put("contentIdFrom", thisContentId); } else { @@ -241,7 +241,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel { List<Object> purposes = ContentWorker.getPurposes(thisContent); assocContext.put("purposes", purposes); List<String> contentTypeAncestry = new LinkedList<>(); - String contentTypeId = (String)thisContent.get("contentTypeId"); + String contentTypeId = (String) thisContent.get("contentTypeId"); try { ContentWorker.getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); } catch (GenericEntityException e) { @@ -252,7 +252,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel { List<Map<String, ? extends Object>> nodeTrail = UtilGenerics.cast(traverseContext.get("nodeTrail")); int indentSz = indent + nodeTrail.size(); assocContext.put("indentObj", indentSz); - isPick = ContentWorker.checkWhen(assocContext, (String)whenMap.get("pickWhen"), true); + isPick = ContentWorker.checkWhen(assocContext, (String) whenMap.get("pickWhen"), true); return isPick; } @@ -260,15 +260,15 @@ public class TraverseSubContentTransform implements TemplateTransformModel { List<Map<String, Object>> nodeTrail = UtilGenerics.cast(traverseContext.get("nodeTrail")); int sz = nodeTrail.size(); Map<String, Object> node = nodeTrail.get(sz - 1); - String contentId = (String)node.get("contentId"); + String contentId = (String) node.get("contentId"); templateContext.put("subContentId", contentId); templateContext.put("subContentDataResourceView", null); int indentSz = indent + nodeTrail.size(); templateContext.put("indent", indentSz); if (sz >= 2) { Map<String, Object> parentNode = nodeTrail.get(sz - 2); - GenericValue parentContent = (GenericValue)parentNode.get("value"); - String parentContentId = (String)parentNode.get("contentId"); + GenericValue parentContent = (GenericValue) parentNode.get("value"); + String parentContentId = (String) parentNode.get("contentId"); templateContext.put("parentContentId", parentContentId); templateContext.put("parentContent", parentContent); templateContext.put("nodeTrail", 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 da663fc..da68697 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 @@ -49,8 +49,8 @@ import freemarker.template.TemplateTransformModel; public class WrapSubContentCacheTransform implements TemplateTransformModel { 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"}; + static final String[] upSaveKeyNames = {"globalNodeTrail"}; + static final String[] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly"}; /** * @deprecated use FreeMarkerWorker.getWrappedObject() @@ -96,11 +96,11 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel { final Map<String, Object> savedValuesUp = new HashMap<>(); FreeMarkerWorker.saveContextValues(templateCtx, upSaveKeyNames, savedValuesUp); FreeMarkerWorker.overrideWithArgs(templateCtx, args); - final String wrapTemplateId = (String)templateCtx.get("wrapTemplateId"); + final String wrapTemplateId = (String) templateCtx.get("wrapTemplateId"); final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); List<Map<String, ? extends Object>> trail = UtilGenerics.cast(templateCtx.get("globalNodeTrail")); - String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId"); - String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly"); + String contentAssocPredicateId = (String) templateCtx.get("contentAssocPredicateId"); + String strNullThruDatesOnly = (String) templateCtx.get("nullThruDatesOnly"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; GenericValue val = null; try { @@ -118,7 +118,7 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel { } String subContentIdSub = (String) view.get("contentId"); // This order is taken so that the dataResourceType can be overridden in the transform arguments. - String subDataResourceTypeId = (String)templateCtx.get("subDataResourceTypeId"); + String subDataResourceTypeId = (String) templateCtx.get("subDataResourceTypeId"); if (UtilValidate.isEmpty(subDataResourceTypeId)) { try { subDataResourceTypeId = (String) view.get("drDataResourceTypeId"); 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 126a9d9..da4b915 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 @@ -102,7 +102,7 @@ public class HumanResEvents { .where("emplPositionId", emplId) .filterByDate().queryList(); if (UtilValidate.isNotEmpty(emlpfillCtxs)) { - for (GenericValue emlpfillCtx : emlpfillCtxs ) { + for (GenericValue emlpfillCtx : emlpfillCtxs) { String memberId = emlpfillCtx.getString("partyId"); title = PartyHelper.getPartyName(delegator, memberId, false); Map<String, Object> josonMap = new HashMap<>(); @@ -134,7 +134,7 @@ public class HumanResEvents { private static List<Map<String, Object>> getChildComps(Map<String, Object> params) throws GenericEntityException { Delegator delegator = (Delegator) params.get("delegator"); - Map<String , Object> partyGroup = UtilGenerics.cast(params.get("partyGroup")); + Map<String, Object> partyGroup = UtilGenerics.cast(params.get("partyGroup")); List<Map<String, Object>> resultList = new ArrayList<>(); List<GenericValue> childOfComs = null; String onclickFunction = (String) params.get("onclickFunction"); @@ -143,11 +143,11 @@ public class HumanResEvents { String hrefString2 = (String) params.get("hrefString2"); try { childOfComs = EntityQuery.use(delegator).from("PartyRelationship") - .where("partyIdFrom", partyGroup.get("partyId"), + .where("partyIdFrom", partyGroup.get("partyId"), "partyRelationshipTypeId", "GROUP_ROLLUP") .filterByDate().queryList(); if (UtilValidate.isNotEmpty(childOfComs)) { - for (GenericValue childOfCom : childOfComs ) { + for (GenericValue childOfCom : childOfComs) { String catId = null; String childPartyId = null; String catNameField = null; @@ -203,7 +203,7 @@ public class HumanResEvents { .filterByDate("actualFromDate", "actualThruDate") .queryList(); if (UtilValidate.isNotEmpty(isEmpls)) { - for (GenericValue childOfEmpl : isEmpls ) { + for (GenericValue childOfEmpl : isEmpls) { Map<String, Object> emplMap = new HashMap<>(); Map<String, Object> emplAttrMap = new HashMap<>(); Map<String, Object> empldataMap = new HashMap<>(); 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 5aaab85..fa41944 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 @@ -133,7 +133,7 @@ public final class BOMHelper { public static String createProductionRunsForShipment(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) { Delegator delegator = (Delegator) request.getAttribute("delegator"); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String shipmentId = request.getParameter("shipmentId"); 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 a2e21f5..c70d35d 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 @@ -196,7 +196,7 @@ public class BOMNode { private BOMNode configurator(GenericValue node, List<GenericValue> productFeatures, String productIdForRules, Date inDate) throws GenericEntityException { - BOMNode oneChildNode = new BOMNode((String)node.get("productIdTo"), delegator, dispatcher, userLogin); + BOMNode oneChildNode = new BOMNode((String) node.get("productIdTo"), delegator, dispatcher, userLogin); oneChildNode.setTree(tree); oneChildNode.setProductAssoc(node); try { @@ -436,7 +436,7 @@ public class BOMNode { String errorMessage = ServiceUtil.getErrorMessage(resultContext); Debug.logError(errorMessage, MODULE); } - BigDecimal calcQuantity = (BigDecimal)resultContext.get("quantity"); + BigDecimal calcQuantity = (BigDecimal) resultContext.get("quantity"); if (calcQuantity != null) { this.quantity = calcQuantity; } @@ -570,8 +570,8 @@ public class BOMNode { String errorMessage = ServiceUtil.getErrorMessage(serviceResult); Debug.logError(errorMessage, MODULE); } - productionRunId = (String)serviceResult.get("productionRunId"); - endDate = (Timestamp)serviceResult.get("estimatedCompletionDate"); + productionRunId = (String) serviceResult.get("productionRunId"); + endDate = (Timestamp) serviceResult.get("estimatedCompletionDate"); } catch (GenericServiceException e) { Debug.logError("Problem calling the createProductionRun service", MODULE); } @@ -581,8 +581,8 @@ public class BOMNode { delegator.create("WorkOrderItemFulfillment", UtilMisc.toMap("workEffortId", productionRunId, "orderId", orderId, "orderItemSeqId", orderItemSeqId, "shipGroupSeqId", shipGroupSeqId)); } for (String childProductionRun : childProductionRuns) { - delegator.create("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", childProductionRun - , "workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", "fromDate", startDate)); + delegator.create("WorkEffortAssoc", UtilMisc.toMap("workEffortIdFrom", childProductionRun, + "workEffortIdTo", productionRunId, "workEffortAssocTypeId", "WORK_EFF_PRECEDENCY", "fromDate", startDate)); } } } catch (GenericEntityException e) { 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 37b595e..fcef0b3 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 @@ -142,7 +142,7 @@ public class BOMServices { if (ServiceUtil.isError(depthResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(depthResult)); } - llc = (Long)depthResult.get("depth"); + llc = (Long) depthResult.get("depth"); // If the product is a variant of a virtual, then the billOfMaterialLevel cannot be // lower than the billOfMaterialLevel of the virtual product. List<GenericValue> virtualProducts = EntityQuery.use(delegator).from("ProductAssoc") @@ -172,7 +172,7 @@ public class BOMServices { if (ServiceUtil.isError(treeResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(treeResult)); } - BOMTree tree = (BOMTree)treeResult.get("tree"); + BOMTree tree = (BOMTree) treeResult.get("tree"); List<BOMNode> products = new LinkedList<>(); tree.print(products, llc.intValue()); for (BOMNode oneNode : products) { @@ -199,8 +199,8 @@ 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)); } result.put("lowLevelCode", llc); return result; @@ -397,7 +397,7 @@ public class BOMServices { if (ServiceUtil.isError(routingOutMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(routingOutMap)); } - GenericValue routing = (GenericValue)routingOutMap.get("routing"); + GenericValue routing = (GenericValue) routingOutMap.get("routing"); if (routing == null) { // try to find a routing linked to the virtual product routingInMap = UtilMisc.toMap("productId", tree.getRoot().getProduct().getString("productId"), "userLogin", userLogin); @@ -405,7 +405,7 @@ public class BOMServices { if (ServiceUtil.isError(routingOutMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(routingOutMap)); } - routing = (GenericValue)routingOutMap.get("routing"); + routing = (GenericValue) routingOutMap.get("routing"); } if (routing != null) { workEffortId = routing.getString("workEffortId"); @@ -475,7 +475,7 @@ public class BOMServices { notAssembledComponents.add(oneComponent); } } - result.put("notAssembledComponents" , notAssembledComponents); + result.put("notAssembledComponents", notAssembledComponents); return result; } @@ -521,7 +521,7 @@ public class BOMServices { if (orderShipment != null && !orderReadHelpers.containsKey(orderShipment.getString("orderId"))) { orderReadHelpers.put(orderShipment.getString("orderId"), new OrderReadHelper(delegator, orderShipment.getString("orderId"))); } - OrderReadHelper orderReadHelper = (OrderReadHelper)orderReadHelpers.get(orderShipment.getString("orderId")); + OrderReadHelper orderReadHelper = (OrderReadHelper) orderReadHelpers.get(orderShipment.getString("orderId")); if (orderReadHelper != null) { Map<String, Object> orderShipmentReadMap = UtilMisc.toMap("orderShipment", orderShipment, "orderReadHelper", orderReadHelper); String partyId = (orderReadHelper.getPlacingParty() != null? orderReadHelper.getPlacingParty().getString("partyId"): null); // FIXME: is it the customer? diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java index f4a626e..1a5a78f 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java @@ -346,7 +346,7 @@ public class BOMTree { } } Map<String, Object> tmpMap = root.createManufacturingOrder(facilityId, date, workEffortName, description, routingId, orderId, orderItemSeqId, shipGroupSeqId, shipmentId, true, true); - workEffortId = (String)tmpMap.get("productionRunId"); + workEffortId = (String) tmpMap.get("productionRunId"); } return workEffortId; } 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 66354df..4f056fc 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 @@ -76,7 +76,7 @@ public class ProductionRun { public ProductionRun(String productionRunId, Delegator delegator, LocalDispatcher dispatcher) { try { - if (! UtilValidate.isEmpty(productionRunId)) { + if (!UtilValidate.isEmpty(productionRunId)) { this.dispatcher = dispatcher; GenericValue workEffort = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", productionRunId).queryOne(); if (workEffort != null) { @@ -333,8 +333,8 @@ public class ProductionRun { GenericValue routingTask; for (GenericValue productionRunRoutingTask : productionRunRoutingTasks) { routingTask = productionRunRoutingTask; - productionRunComponents.addAll(routingTask.getRelated("WorkEffortGoodStandard" - , UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"), null, false)); + productionRunComponents.addAll(routingTask.getRelated("WorkEffortGoodStandard", + UtilMisc.toMap("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"), null, false)); } } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), MODULE); @@ -427,7 +427,7 @@ public class ProductionRun { String errorMessage = ServiceUtil.getErrorMessage(serviceResult); Debug.logError(errorMessage, MODULE); } - totalTaskTime = ((BigDecimal)serviceResult.get("totalTime")).doubleValue(); + totalTaskTime = ((BigDecimal) serviceResult.get("totalTime")).doubleValue(); } } catch (GenericEntityException | GenericServiceException exc) { Debug.logError(exc, "Problem calling the customMethod service " + serviceName); 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 cca7911..42b00cb 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 @@ -52,7 +52,7 @@ public class ProductionRunEvents { BigDecimal quantity = null; try { - quantity = new BigDecimal((String)parameters.get("quantity")); + quantity = new BigDecimal((String) parameters.get("quantity")); } catch (NumberFormatException nfe) { String errMsg = "Invalid format for quantity field: " + nfe.toString(); Debug.logError(nfe, errMsg, MODULE); @@ -65,7 +65,7 @@ public class ProductionRunEvents { for (Map<String, Object>componentRow : componentRows) { Timestamp fromDate = null; try { - fromDate = Timestamp.valueOf((String)componentRow.get("fromDate")); + fromDate = Timestamp.valueOf((String) componentRow.get("fromDate")); } catch (IllegalArgumentException iae) { String errMsg = "Invalid format for date field: " + iae.toString(); Debug.logError(iae, errMsg, MODULE); @@ -73,14 +73,14 @@ public class ProductionRunEvents { return "error"; } GenericPK key = delegator.makePK("WorkEffortGoodStandard", - UtilMisc.<String, Object>toMap("workEffortId", (String)componentRow.get("productionRunTaskId"), - "productId", (String)componentRow.get("productId"), + UtilMisc.<String, Object>toMap("workEffortId", (String) componentRow.get("productionRunTaskId"), + "productId", (String) componentRow.get("productId"), "fromDate", fromDate, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED")); componentsLocationMap.put(key, - UtilMisc.<String, Object>toMap("locationSeqId", (String)componentRow.get("locationSeqId"), - "secondaryLocationSeqId", (String)componentRow.get("secondaryLocationSeqId"), - "failIfItemsAreNotAvailable", (String)componentRow.get("failIfItemsAreNotAvailable"))); + UtilMisc.<String, Object>toMap("locationSeqId", (String) componentRow.get("locationSeqId"), + "secondaryLocationSeqId", (String) componentRow.get("secondaryLocationSeqId"), + "failIfItemsAreNotAvailable", (String) componentRow.get("failIfItemsAreNotAvailable"))); } try { 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 69c6afd..58d18ca 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 @@ -225,7 +225,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(routingOutMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(routingOutMap)); } - routing = (GenericValue)routingOutMap.get("routing"); + routing = (GenericValue) routingOutMap.get("routing"); routingTaskAssocs = UtilGenerics.cast(routingOutMap.get("tasks")); } catch (GenericServiceException gse) { Debug.logWarning(gse.getMessage(), MODULE); @@ -544,7 +544,7 @@ public class ProductionRunServices { } Timestamp estimatedStartDate = (Timestamp) context.get("estimatedStartDate"); - if (estimatedStartDate != null && ! estimatedStartDate.equals(productionRun.getEstimatedStartDate())) { + if (estimatedStartDate != null && !estimatedStartDate.equals(productionRun.getEstimatedStartDate())) { productionRun.setEstimatedStartDate(estimatedStartDate); } @@ -700,9 +700,9 @@ public class ProductionRunServices { .filterByDate().queryList(); for (GenericValue mandatoryWorkEffortAssoc : mandatoryWorkEfforts) { GenericValue mandatoryWorkEffort = mandatoryWorkEffortAssoc.getRelatedOne("FromWorkEffort", false); - if (!("PRUN_COMPLETED".equals(mandatoryWorkEffort.getString("currentStatusId")) || - "PRUN_RUNNING".equals(mandatoryWorkEffort.getString("currentStatusId")) || - "PRUN_CLOSED".equals(mandatoryWorkEffort.getString("currentStatusId")))) { + 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)); } } @@ -998,7 +998,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - GenericValue partyAccountingPreference = (GenericValue)outputMap.get("partyAccountingPreference"); + GenericValue partyAccountingPreference = (GenericValue) outputMap.get("partyAccountingPreference"); if (partyAccountingPreference == null) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToFindCosts", locale)); } @@ -1006,7 +1006,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - BigDecimal totalCost = (BigDecimal)outputMap.get("totalCost"); + BigDecimal totalCost = (BigDecimal) outputMap.get("totalCost"); if (totalCost == null) { totalCost = ZERO; } @@ -1045,8 +1045,8 @@ public class ProductionRunServices { } } } catch (GenericEntityException | 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)); } } @@ -1113,7 +1113,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - BigDecimal productionRunHeaderCost = (BigDecimal)outputMap.get("totalCost"); + BigDecimal productionRunHeaderCost = (BigDecimal) outputMap.get("totalCost"); totalCost = totalCost.add(productionRunHeaderCost); for (GenericValue task : tasks) { outputMap = dispatcher.runSync("getWorkEffortCosts", @@ -1121,7 +1121,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - BigDecimal taskCost = (BigDecimal)outputMap.get("totalCost"); + BigDecimal taskCost = (BigDecimal) outputMap.get("totalCost"); totalCost = totalCost.add(taskCost); } result.put("totalCost", totalCost); @@ -1251,8 +1251,8 @@ 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)); } // materials costs: these are the costs derived from the materials used by the production run task try { @@ -1285,8 +1285,8 @@ 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)); } return ServiceUtil.returnSuccess(); } @@ -1312,7 +1312,7 @@ public class ProductionRunServices { Map<String, Object> serviceResult = new HashMap<>(); String productionRunId = (String) context.get("productionRunId"); String routingTaskId = (String) context.get("routingTaskId"); - if (! UtilValidate.isEmpty(productionRunId) && ! UtilValidate.isEmpty(routingTaskId)) { + if (!UtilValidate.isEmpty(productionRunId) && !UtilValidate.isEmpty(routingTaskId)) { ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); if (productionRun.exist()) { @@ -1398,8 +1398,8 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } - if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && - !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) + && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } @@ -1471,8 +1471,8 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunComponentNotExists", locale)); } - if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && - !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) + && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } @@ -1561,8 +1561,8 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunTaskNotExists", locale)); } - if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) && - !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { + if (!"PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId")) + && !"PRUN_SCHEDULED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunPrinted", locale)); } @@ -1587,16 +1587,16 @@ public class ProductionRunServices { } if (workEffortName == null) { - workEffortName = (String)routingTask.get("workEffortName"); + workEffortName = (String) routingTask.get("workEffortName"); } if (description == null) { - description = (String)routingTask.get("description"); + description = (String) routingTask.get("description"); } if (estimatedSetupMillis == null) { - estimatedSetupMillis = (Double)routingTask.get("estimatedSetupMillis"); + estimatedSetupMillis = (Double) routingTask.get("estimatedSetupMillis"); } if (estimatedMilliSeconds == null) { - estimatedMilliSeconds = (Double)routingTask.get("estimatedMilliSeconds"); + estimatedMilliSeconds = (Double) routingTask.get("estimatedMilliSeconds"); } if (estimatedStartDate == null) { estimatedStartDate = productionRun.getEstimatedStartDate(); @@ -1791,15 +1791,15 @@ public class ProductionRunServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - GenericValue partyAccountingPreference = (GenericValue)outputMap.get("partyAccountingPreference"); + GenericValue partyAccountingPreference = (GenericValue) outputMap.get("partyAccountingPreference"); if (partyAccountingPreference == null) { 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")); + 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)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - unitCost = (BigDecimal)outputMap.get("productCost"); + unitCost = (BigDecimal) outputMap.get("productCost"); if (unitCost != null && unitCost.compareTo(BigDecimal.ZERO) == 0) { BigDecimal totalCost = ZERO; List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); @@ -1869,7 +1869,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String inventoryItemId = (String)serviceResult.get("inventoryItemId"); + String inventoryItemId = (String) serviceResult.get("inventoryItemId"); inventoryItemIds.add(inventoryItemId); serviceContext.clear(); serviceContext.put("inventoryItemId", inventoryItemId); @@ -1920,7 +1920,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String inventoryItemId = (String)serviceResult.get("inventoryItemId"); + String inventoryItemId = (String) serviceResult.get("inventoryItemId"); inventoryItemIds.add(inventoryItemId); serviceContext.clear(); serviceContext.put("inventoryItemId", inventoryItemId); @@ -2101,7 +2101,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String inventoryItemId = (String)serviceResult.get("inventoryItemId"); + String inventoryItemId = (String) serviceResult.get("inventoryItemId"); serviceContext.clear(); serviceContext.put("inventoryItemId", inventoryItemId); serviceContext.put("workEffortId", productionRunTaskId); @@ -2153,7 +2153,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String inventoryItemId = (String)serviceResult.get("inventoryItemId"); + String inventoryItemId = (String) serviceResult.get("inventoryItemId"); serviceContext.clear(); serviceContext.put("inventoryItemId", inventoryItemId); @@ -2513,7 +2513,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String productionRunId = (String)serviceResult.get("productionRunId"); + String productionRunId = (String) serviceResult.get("productionRunId"); result.put("productionRunId", productionRunId); result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunCreated", UtilMisc.toMap("productionRunId", productionRunId), locale)); @@ -2571,7 +2571,7 @@ public class ProductionRunServices { } catch (GenericServiceException e) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunNotCreated", locale)); } - String productionRunId = (String)serviceResult.get("productionRunId"); + String productionRunId = (String) serviceResult.get("productionRunId"); result.put("productionRunId", productionRunId); Map<String, BigDecimal> components = new HashMap<>(); @@ -2801,7 +2801,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String productionRunId = (String)serviceResult.get("productionRunId"); + String productionRunId = (String) serviceResult.get("productionRunId"); result.put("productionRunId", productionRunId); try { @@ -2966,7 +2966,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingBomErrorCreatingBillOfMaterialsTree", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } - result.put("productionRuns" , productionRuns); + result.put("productionRuns", productionRuns); return result; } @@ -3001,8 +3001,8 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunIsNotRequiredForProductId", UtilMisc.toMap("productId", productId, "startDate", startDate), locale)); } List<String> productionRuns = new LinkedList<>(); - result.put("productionRuns" , productionRuns); - result.put("productionRunId" , workEffortId); + result.put("productionRuns", productionRuns); + result.put("productionRunId", workEffortId); return result; } @@ -3038,7 +3038,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - currentStatusId = (String)serviceResult.get("newStatusId"); + currentStatusId = (String) serviceResult.get("newStatusId"); if (currentStatusId.equals(prevStatusId)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingProductionRunUnableToProgressTaskStatus", UtilMisc.toMap("prevStatusId", prevStatusId, "taskId", taskId), locale)); } else { @@ -3118,9 +3118,9 @@ public class ProductionRunServices { for (int i = 0; i < tasks.size(); i++) { oneTask = tasks.get(i); taskId = oneTask.getString("workEffortId"); - if ("PRUN_CREATED".equals(oneTask.getString("currentStatusId")) || - "PRUN_SCHEDULED".equals(oneTask.getString("currentStatusId")) || - "PRUN_DOC_PRINTED".equals(oneTask.getString("currentStatusId"))) { + if ("PRUN_CREATED".equals(oneTask.getString("currentStatusId")) + || "PRUN_SCHEDULED".equals(oneTask.getString("currentStatusId")) + || "PRUN_DOC_PRINTED".equals(oneTask.getString("currentStatusId"))) { try { Map<String, Object> serviceContext = UtilMisc.<String, Object>toMap("productionRunId", productionRunId, "workEffortId", taskId); @@ -3160,10 +3160,10 @@ public class ProductionRunServices { try { Map<String, Object> serviceContext = new HashMap<>(); // Change the task status to running - if ("PRUN_DOC_PRINTED".equals(statusId) || - "PRUN_RUNNING".equals(statusId) || - "PRUN_COMPLETED".equals(statusId) || - "PRUN_CLOSED".equals(statusId)) { + if ("PRUN_DOC_PRINTED".equals(statusId) + || "PRUN_RUNNING".equals(statusId) + || "PRUN_COMPLETED".equals(statusId) + || "PRUN_CLOSED".equals(statusId)) { serviceContext.put("productionRunId", productionRunId); serviceContext.put("statusId", "PRUN_DOC_PRINTED"); serviceContext.put("userLogin", userLogin); @@ -3181,8 +3181,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } } - if ("PRUN_COMPLETED".equals(statusId) || - "PRUN_CLOSED".equals(statusId)) { + if ("PRUN_COMPLETED".equals(statusId) || "PRUN_CLOSED".equals(statusId)) { serviceContext.clear(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("userLogin", userLogin); @@ -3342,7 +3341,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - String workEffortId = (String)serviceResult.get("workEffortId"); + String workEffortId = (String) serviceResult.get("workEffortId"); // the inventory (marketing package) is issued serviceContext.clear(); serviceContext = UtilMisc.toMap("inventoryItem", inventoryItem, @@ -3354,7 +3353,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - BigDecimal issuedQuantity = (BigDecimal)serviceResult.get("quantityIssued"); + 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)); } @@ -3369,7 +3368,7 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - BigDecimal packageCost = (BigDecimal)serviceResult.get("productCost"); + BigDecimal packageCost = (BigDecimal) serviceResult.get("productCost"); BigDecimal inventoryItemCost = inventoryItem.getBigDecimal("unitCost"); BigDecimal costCoefficient = null; if (packageCost == null || packageCost.compareTo(ZERO) == 0 || inventoryItemCost == null) { @@ -3399,7 +3398,7 @@ public class ProductionRunServices { for (Map<String, Object> component : components) { // get the component's standard cost serviceContext.clear(); - serviceContext = UtilMisc.toMap("productId", ((GenericValue)component.get("product")).getString("productId"), + serviceContext = UtilMisc.toMap("productId", ((GenericValue) component.get("product")).getString("productId"), "currencyUomId", inventoryItem.getString("currencyUomId"), "costComponentTypePrefix", "EST_STD", "userLogin", userLogin); @@ -3407,12 +3406,12 @@ public class ProductionRunServices { if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } - BigDecimal componentCost = (BigDecimal)serviceResult.get("productCost"); + BigDecimal componentCost = (BigDecimal) serviceResult.get("productCost"); // return the component to inventory at its standard cost multiplied by the cost coefficient from above BigDecimal componentInventoryItemCost = costCoefficient.multiply(componentCost); serviceContext.clear(); - serviceContext = UtilMisc.toMap("productId", ((GenericValue)component.get("product")).getString("productId"), + serviceContext = UtilMisc.toMap("productId", ((GenericValue) component.get("product")).getString("productId"), "quantity", component.get("quantity"), "facilityId", inventoryItem.getString("facilityId"), "unitCost", componentInventoryItemCost, @@ -3447,8 +3446,8 @@ public class ProductionRunServices { "workEffortTypeId", "PROD_ORDER_HEADER") .queryList(); for (GenericValue genericResult : resultList) { - if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || - "PRUN_CREATED".equals(genericResult.getString("currentStatusId"))) { + if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) + || "PRUN_CREATED".equals(genericResult.getString("currentStatusId"))) { continue; } BigDecimal qtyToProduce = genericResult.getBigDecimal("quantityToProduce"); @@ -3477,7 +3476,7 @@ public class ProductionRunServices { UtilMisc.toMap("remainingQty", BigDecimal.ZERO, "reservations", new LinkedList<>())); } Map<String, Object> dateMap = UtilGenerics.cast(productMap.get(estimatedShipDate)); - BigDecimal remainingQty = (BigDecimal)dateMap.get("remainingQty"); + BigDecimal remainingQty = (BigDecimal) dateMap.get("remainingQty"); remainingQty = remainingQty.add(qtyDiff); dateMap.put("remainingQty", remainingQty); } @@ -3520,7 +3519,7 @@ public class ProductionRunServices { UtilMisc.toMap("remainingQty", BigDecimal.ZERO, "reservations", new LinkedList<>())); } Map<String, Object> dateMap = UtilGenerics.cast(productMap.get(estimatedShipDate)); - BigDecimal remainingQty = (BigDecimal)dateMap.get("remainingQty"); + BigDecimal remainingQty = (BigDecimal) dateMap.get("remainingQty"); remainingQty = remainingQty.add(orderQuantity); dateMap.put("remainingQty", remainingQty); } @@ -3556,7 +3555,7 @@ public class ProductionRunServices { // iterate and 'reserve' for (Timestamp currentDate : subsetMap.keySet()) { Map<String, Object> currentDateMap = UtilGenerics.cast(subsetMap.get(currentDate)); - BigDecimal remainingQty = (BigDecimal)currentDateMap.get("remainingQty"); + BigDecimal remainingQty = (BigDecimal) currentDateMap.get("remainingQty"); if (remainingQty.compareTo(ZERO) == 0) { continue; } 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 734ec71..bc5c806 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 @@ -316,9 +316,9 @@ public class MrpServices { "facilityId", facilityId) .queryList(); for (GenericValue genericResult : resultList) { - if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || - "PRUN_COMPLETED".equals(genericResult.getString("currentStatusId")) || - "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { + if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) + || "PRUN_COMPLETED".equals(genericResult.getString("currentStatusId")) + || "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { continue; } String productId = genericResult.getString("productId"); @@ -355,9 +355,9 @@ public class MrpServices { "facilityId", facilityId) .queryList(); for (GenericValue genericResult : resultList) { - if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || - "PRUN_COMPLETED".equals(genericResult.getString("currentStatusId")) || - "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { + if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) + || "PRUN_COMPLETED".equals(genericResult.getString("currentStatusId")) + || "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { continue; } BigDecimal qtyToProduce = genericResult.getBigDecimal("quantityToProduce"); @@ -435,7 +435,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ManufacturingMrpEventFindError", locale)); } - String partyId = (String)facility.get("ownerPartyId"); + String partyId = (String) facility.get("ownerPartyId"); try { resultList = EntityQuery.use(delegator).from("SalesForecast") .where("organizationPartyId", partyId) @@ -516,7 +516,7 @@ public class MrpServices { logMrpError(mrpId, productId, "Unable to count inventory", delegator); return BigDecimal.ZERO; } - return ((BigDecimal)resultMap.get("quantityOnHandTotal")); + return ((BigDecimal) resultMap.get("quantityOnHandTotal")); } public static void logMrpError(String mrpId, String productId, String errorMessage, Delegator delegator) { @@ -741,8 +741,8 @@ 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)); } components = UtilGenerics.cast(serviceResponse.get("components")); if (UtilValidate.isNotEmpty(components)) { @@ -777,11 +777,11 @@ 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)); } components = UtilGenerics.cast(serviceResponse.get("components")); - String routingId = (String)serviceResponse.get("workEffortId"); + String routingId = (String) serviceResponse.get("workEffortId"); if (routingId != null) { try { routing = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", routingId).queryOne(); 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 4e8a773..3be0f17 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 @@ -107,7 +107,7 @@ public class ProposedOrder { **/ public Map<String, Object> calculateStartDate(int daysToShip, GenericValue routing, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) { Map<String, Object> result = null; - Timestamp endDate = (Timestamp)requiredByDate.clone(); + Timestamp endDate = (Timestamp) requiredByDate.clone(); Timestamp startDate = endDate; long timeToShip = daysToShip * 8 * 60 * 60 * 1000; if (isBuilt) { @@ -121,7 +121,7 @@ public class ProposedOrder { String errorMessage = ServiceUtil.getErrorMessage(routingOutMap); Debug.logError(errorMessage, MODULE); } - routing = (GenericValue)routingOutMap.get("routing"); + routing = (GenericValue) routingOutMap.get("routing"); listRoutingTaskAssoc = UtilGenerics.cast(routingOutMap.get("tasks")); if (routing == null) { // try to find a routing linked to the virtual product @@ -143,7 +143,7 @@ public class ProposedOrder { String errorMessage = ServiceUtil.getErrorMessage(routingOutMap); Debug.logError(errorMessage, MODULE); } - routing = (GenericValue)routingOutMap.get("routing"); + routing = (GenericValue) routingOutMap.get("routing"); } } } catch (GenericServiceException gse) { 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 484ea11..b605174 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 @@ -74,7 +74,7 @@ public class TechDataServices { if (UtilValidate.isNotEmpty(workEffortName)) { constraints.add(EntityCondition.makeCondition("workEffortName", EntityOperator.GREATER_THAN_EQUAL_TO, workEffortName)); } - if (UtilValidate.isNotEmpty(fixedAssetId) && ! "ANY".equals(fixedAssetId)) { + if (UtilValidate.isNotEmpty(fixedAssetId) && !"ANY".equals(fixedAssetId)) { constraints.add(EntityCondition.makeCondition("fixedAssetId", EntityOperator.EQUALS, fixedAssetId)); } constraints.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "ROU_ACTIVE")); @@ -136,10 +136,10 @@ public class TechDataServices { if (listRoutingTaskAssoc != null) { for (GenericValue routingTaskAssoc : listRoutingTaskAssoc) { - if (! workEffortIdFrom.equals(routingTaskAssoc.getString("workEffortIdFrom")) || - ! workEffortIdTo.equals(routingTaskAssoc.getString("workEffortIdTo")) || - ! workEffortAssocTypeId.equals(routingTaskAssoc.getString("workEffortAssocTypeId")) || - ! sequenceNum.equals(routingTaskAssoc.getLong("sequenceNum")) + if (!workEffortIdFrom.equals(routingTaskAssoc.getString("workEffortIdFrom")) + || !workEffortIdTo.equals(routingTaskAssoc.getString("workEffortIdTo")) + || !workEffortAssocTypeId.equals(routingTaskAssoc.getString("workEffortAssocTypeId")) + || !sequenceNum.equals(routingTaskAssoc.getLong("sequenceNum")) ) { if (routingTaskAssoc.getTimestamp("thruDate") == null && routingTaskAssoc.getTimestamp("fromDate") == null) sequenceNumNotOk = "Y"; else if (routingTaskAssoc.getTimestamp("thruDate") == null) { 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 63525c9..29823f9 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 @@ -68,8 +68,8 @@ public final class ReportHelper { } else { reportValue.put("orderAmount", orderValue.getDouble("grandTotal")); } - if ((orderValue.getLong("orderId") == null) || (visit.getLong("visitId") == null) || - (visit.getLong("visitId").intValue() == 0)) { + if ((orderValue.getLong("orderId") == null) || (visit.getLong("visitId") == null) + || (visit.getLong("visitId").intValue() == 0)) { reportValue.put("conversionRate", (double) 0); } else { reportValue.put("conversionRate", orderValue.getLong("orderId").doubleValue() / visit.getLong("visitId").doubleValue()); 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 45017fe..8b4e69b 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 @@ -98,7 +98,7 @@ public class VCard { String refCardId = formattedName.getValue(); GenericValue partyIdentification = EntityQuery.use(delegator).from("PartyIdentification").where("partyIdentificationTypeId", "VCARD_FN_ORIGIN", "idValue", refCardId).queryFirst(); if (partyIdentification != null) { - partiesExist.add(UtilMisc.toMap("partyId", (String)partyIdentification.get("partyId"))); + partiesExist.add(UtilMisc.toMap("partyId", (String) partyIdentification.get("partyId"))); continue; } //TODO manage update @@ -123,7 +123,7 @@ public class VCard { break; } } - if (! workAddress) continue; + if (!workAddress) continue; serviceCtx.put("address1", address.getStreetAddressFull()); serviceCtx.put("city", address.getLocality()); @@ -154,7 +154,7 @@ public class VCard { break; } } - if (! workEmail) continue; + if (!workEmail) continue; } String emailAddr = email.getValue(); if (UtilValidate.isEmail(emailAddr)) { @@ -176,7 +176,7 @@ public class VCard { break; } } - if (! workPhone) continue; + if (!workPhone) continue; } String phoneAddr = phone.getText(); boolean internationalPhone = phoneAddr.startsWith("+") || phoneAddr.startsWith("00"); 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 36bbc41..830d944 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 @@ -104,7 +104,7 @@ public class OrderEvents { if (selectedItems != null) { for (String selectedItem : selectedItems) { - String [] orderItemSeqIdAndOrderItemShipGrpId = selectedItem.split(":"); + String[] orderItemSeqIdAndOrderItemShipGrpId = selectedItem.split(":"); String orderItemSeqId = orderItemSeqIdAndOrderItemShipGrpId[0]; String shipGroupSeqId = orderItemSeqIdAndOrderItemShipGrpId[1]; BigDecimal cancelQuantity = new BigDecimal(request.getParameter("iqm_"+orderItemSeqId+":"+shipGroupSeqId)); 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 b6ba442..01fee2e 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 @@ -2663,9 +2663,9 @@ public class OrderReadHelper { for (GenericValue orderAdjustment : adjustments) { boolean includeAdjustment = false; - if ("SALES_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) || - "VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) || - "VAT_PRICE_CORRECT".equals(orderAdjustment.getString("orderAdjustmentTypeId"))) { + if ("SALES_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) + || "VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) + || "VAT_PRICE_CORRECT".equals(orderAdjustment.getString("orderAdjustmentTypeId"))) { if (includeTax) { includeAdjustment = true; } @@ -3006,8 +3006,8 @@ public class OrderReadHelper { if (amount != null) { totalAmount = totalAmount.add(amount); } - if ("VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) && - orderAdjustment.get("amountAlreadyIncluded") != null) { + if ("VAT_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) + && orderAdjustment.get("amountAlreadyIncluded") != null) { // this is the only case where the VAT_TAX amountAlreadyIncluded should be added in, and should just be for display and not to calculate the order grandTotal totalAmount = totalAmount.add(orderAdjustment.getBigDecimal("amountAlreadyIncluded")); } 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 6fbd717..873c0c1 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 @@ -1858,7 +1858,7 @@ public class OrderReturnServices { if (orderItemShipGroupAssoc != null) { if (!orderItemShipGroupIds.contains(orderItemShipGroupAssoc.getString("shipGroupSeqId"))) { GenericValue orderItemShipGroup = orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup", false); - GenericValue newOrderItemShipGroup = (GenericValue)orderItemShipGroup.clone(); + GenericValue newOrderItemShipGroup = (GenericValue) orderItemShipGroup.clone(); newOrderItemShipGroup.set("orderId", null); orderItemShipGroupInfo.add(newOrderItemShipGroup); orderItemShipGroupIds.add(orderItemShipGroupAssoc.getString("shipGroupSeqId")); @@ -1941,7 +1941,7 @@ public class OrderReturnServices { BigDecimal repairUnitPrice = null; if (priceResult.get("basePrice") != null) { - repairUnitPrice = (BigDecimal)priceResult.get("basePrice"); + repairUnitPrice = (BigDecimal) priceResult.get("basePrice"); } else { repairUnitPrice = BigDecimal.ZERO; } @@ -2571,10 +2571,8 @@ public class OrderReturnServices { * @return returns if the returnn adjustment need to be recalculated */ public static boolean needRecalculate(String returnAdjustmentTypeId) { - return "RET_PROMOTION_ADJ".equals(returnAdjustmentTypeId) || - "RET_DISCOUNT_ADJ".equals(returnAdjustmentTypeId) || - "RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId); - + return "RET_PROMOTION_ADJ".equals(returnAdjustmentTypeId) + || "RET_DISCOUNT_ADJ".equals(returnAdjustmentTypeId) || "RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId); } /** diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java index cb2d2bc..f339a99 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java @@ -693,7 +693,7 @@ public class OrderServices { try { techDataCalendar = fixedAsset.getRelatedOne("TechDataCalendar", false); } catch (GenericEntityException e) { - Debug.logInfo("TechData calendar does not exist yet so create for fixedAsset: " + fixedAsset.get("fixedAssetId") , MODULE); + Debug.logInfo("TechData calendar does not exist yet so create for fixedAsset: " + fixedAsset.get("fixedAssetId"), MODULE); } if (techDataCalendar == null) { for (GenericValue currentValue : tempList) { @@ -740,7 +740,7 @@ public class OrderServices { while (--dayCount >= 0) { GenericValue techDataCalendarExcDay = null; // find an existing Day exception record - Timestamp exceptionDateStartTime = UtilDateTime.getDayStart(new Timestamp(estimatedStartDate.getTime()), (int)dayCount); + Timestamp exceptionDateStartTime = UtilDateTime.getDayStart(new Timestamp(estimatedStartDate.getTime()), (int) dayCount); try { techDataCalendarExcDay = EntityQuery.use(delegator).from("TechDataCalendarExcDay").where("calendarId", fixedAsset.get("calendarId"), "exceptionDateStartTime", exceptionDateStartTime).queryOne(); } @@ -1330,7 +1330,7 @@ public class OrderServices { if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG_PICK")) { Map<String, Object> componentsRes = dispatcher.runSync("getAssociatedProducts", UtilMisc.toMap("productId", orderItem.getString("productId"), "type", "PRODUCT_COMPONENT")); if (ServiceUtil.isError(componentsRes)) { - resErrorMessages.add((String)componentsRes.get(ModelService.ERROR_MESSAGE)); + resErrorMessages.add((String) componentsRes.get(ModelService.ERROR_MESSAGE)); continue; } List<GenericValue> assocProducts = UtilGenerics.cast(componentsRes.get("assocProducts")); @@ -1478,8 +1478,8 @@ public class OrderServices { remainingSubTotal = updatedTotal.subtract(orh.getOrderReturnedTotal()).subtract(orh.getOrderNonReturnedTaxAndShipping()); } - if (currentTotal == null || currentSubTotal == null || updatedTotal.compareTo(currentTotal) != 0 || - remainingSubTotal.compareTo(currentSubTotal) != 0) { + if (currentTotal == null || currentSubTotal == null || updatedTotal.compareTo(currentTotal) != 0 + || remainingSubTotal.compareTo(currentSubTotal) != 0) { orderHeader.set("grandTotal", updatedTotal); orderHeader.set("remainingSubTotal", remainingSubTotal); try { @@ -1819,7 +1819,7 @@ public class OrderServices { shippingTotal = ZERO; Debug.logInfo("No valid order items found - " + shippingTotal, MODULE); } else { - shippingTotal = UtilValidate.isEmpty(shippingEstMap.get("shippingTotal")) ? ZERO : (BigDecimal)shippingEstMap.get("shippingTotal"); + shippingTotal = UtilValidate.isEmpty(shippingEstMap.get("shippingTotal")) ? ZERO : (BigDecimal) shippingEstMap.get("shippingTotal"); shippingTotal = shippingTotal.setScale(DECIMALS, ROUNDING); Debug.logInfo("Got new shipping estimate - " + shippingTotal, MODULE); } @@ -3267,8 +3267,8 @@ public class OrderServices { String isDigital = productType.getString("isDigital"); // we were set as a digital good; one more check and change status - if ((isDigital != null && "Y".equalsIgnoreCase(isDigital)) && - (isPhysical == null || !"Y".equalsIgnoreCase(isPhysical))) { + if ((isDigital != null && "Y".equalsIgnoreCase(isDigital)) + && (isPhysical == null || !"Y".equalsIgnoreCase(isPhysical))) { markComplete = true; } } @@ -3301,7 +3301,7 @@ public class OrderServices { // this service cannot return error at this point or we will roll back the invoice // since payments are already captured; errors should have been logged already. // the response message here will be passed as an error to the user. - return ServiceUtil.returnSuccess((String)fulfillResult.get(ModelService.ERROR_MESSAGE)); + return ServiceUtil.returnSuccess((String) fulfillResult.get(ModelService.ERROR_MESSAGE)); } } @@ -3561,7 +3561,7 @@ public class OrderServices { try { //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { BigDecimal remainder = quantity.remainder(BigDecimal.ONE); if (remainder.compareTo(BigDecimal.ZERO) != 0) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "cart.addToCart.quantityInDecimalNotAllowed", locale)); @@ -3733,7 +3733,7 @@ public class OrderServices { try { //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, cartItem.getProductId(), cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, cartItem.getProductId(), cart.getProductStoreId())) { BigDecimal remainder = qty.remainder(BigDecimal.ONE); if (remainder.compareTo(BigDecimal.ZERO) != 0) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "cart.addToCart.quantityInDecimalNotAllowed", locale)); @@ -3896,7 +3896,7 @@ public class OrderServices { try { //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, cartItem.getProductId(), cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, cartItem.getProductId(), cart.getProductStoreId())) { BigDecimal remainder = groupQty.remainder(BigDecimal.ONE); if (remainder.compareTo(BigDecimal.ZERO) != 0) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "cart.addToCart.quantityInDecimalNotAllowed", locale)); @@ -4258,9 +4258,9 @@ public class OrderServices { List<GenericValue> removeList = new ArrayList<>(); for (GenericValue stored: toStore) { if ("OrderAdjustment".equals(stored.getEntityName())) { - if (("SHIPPING_CHARGES".equals(stored.get("orderAdjustmentTypeId")) || - "SALES_TAX".equals(stored.get("orderAdjustmentTypeId"))) && - stored.get("orderId").equals(orderId)) { + if (("SHIPPING_CHARGES".equals(stored.get("orderAdjustmentTypeId")) + || "SALES_TAX".equals(stored.get("orderAdjustmentTypeId"))) + && stored.get("orderId").equals(orderId)) { // Removing objects from toStore list for old Shipping and Handling Charges Adjustment and Sales Tax Adjustment. removeList.add(stored); } @@ -4274,8 +4274,8 @@ public class OrderServices { } for (GenericValue toAdd: toAddList) { if ("OrderAdjustment".equals(toAdd.getEntityName())) { - if ("Y".equals(toAdd.getString("isManual")) && (("PROMOTION_ADJUSTMENT".equals(toAdd.get("orderAdjustmentTypeId"))) || - ("SHIPPING_CHARGES".equals(toAdd.get("orderAdjustmentTypeId"))) || ("SALES_TAX".equals(toAdd.get("orderAdjustmentTypeId"))))) { + if ("Y".equals(toAdd.getString("isManual")) && (("PROMOTION_ADJUSTMENT".equals(toAdd.get("orderAdjustmentTypeId"))) + || ("SHIPPING_CHARGES".equals(toAdd.get("orderAdjustmentTypeId"))) || ("SALES_TAX".equals(toAdd.get("orderAdjustmentTypeId"))))) { toStore.add(toAdd); } } @@ -4691,7 +4691,7 @@ public class OrderServices { } catch (GenericEntityException | GenericServiceException ex) { Debug.logError(ex, "Unable to create payment using payment preference.", MODULE); - return(ServiceUtil.returnError(ex.getMessage())); + return (ServiceUtil.returnError(ex.getMessage())); } } @@ -5152,7 +5152,7 @@ public class OrderServices { return ServiceUtil.returnError(errorMessage); } - if (! "PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"))) { + if (!"PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"))) { String errorMessage = UtilProperties.getMessage(RES_ERROR, "ProductErrorOrderNotPurchaseOrder", UtilMisc.toMap("orderId", orderId), locale); Debug.logError(errorMessage, MODULE); @@ -5163,13 +5163,13 @@ public class OrderServices { Map<String, Object> productRequirementQuantities = new HashMap<>(); List<GenericValue> orderItems = orderHeader.getRelated("OrderItem", null, null, false); for (GenericValue orderItem : orderItems) { - if (! "PRODUCT_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { + if (!"PRODUCT_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { continue; } // Get the cancelled quantity for the item BigDecimal orderItemCancelQuantity = BigDecimal.ZERO; - if (! UtilValidate.isEmpty(orderItem.get("cancelQuantity"))) { + if (!UtilValidate.isEmpty(orderItem.get("cancelQuantity"))) { orderItemCancelQuantity = orderItem.getBigDecimal("cancelQuantity"); } @@ -5227,7 +5227,7 @@ public class OrderServices { return ServiceUtil.returnError(errorMessage); } - if (! "PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"))) { + if (!"PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"))) { String errorMessage = UtilProperties.getMessage(RES_ERROR, "OrderErrorOrderNotPurchaseOrder", UtilMisc.toMap("orderId", orderId), locale); Debug.logError(errorMessage, MODULE); @@ -5236,17 +5236,17 @@ public class OrderServices { List<GenericValue> orderItems = orderHeader.getRelated("OrderItem", null, null, false); for (GenericValue orderItem : orderItems) { - if (! "PRODUCT_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { + if (!"PRODUCT_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId"))) { continue; } // Get the ordered quantity for the item BigDecimal orderItemQuantity = BigDecimal.ZERO; - if (! UtilValidate.isEmpty(orderItem.get("quantity"))) { + if (!UtilValidate.isEmpty(orderItem.get("quantity"))) { orderItemQuantity = orderItem.getBigDecimal("quantity"); } BigDecimal orderItemCancelQuantity = BigDecimal.ZERO; - if (! UtilValidate.isEmpty(orderItem.get("cancelQuantity"))) { + if (!UtilValidate.isEmpty(orderItem.get("cancelQuantity"))) { orderItemCancelQuantity = orderItem.getBigDecimal("cancelQuantity"); } @@ -5254,7 +5254,7 @@ public class OrderServices { List<GenericValue> shipmentReceipts = orderItem.getRelated("ShipmentReceipt", null, null, false); BigDecimal receivedQuantity = BigDecimal.ZERO; for (GenericValue shipmentReceipt : shipmentReceipts) { - if (! UtilValidate.isEmpty(shipmentReceipt.get("quantityAccepted"))) { + if (!UtilValidate.isEmpty(shipmentReceipt.get("quantityAccepted"))) { receivedQuantity = receivedQuantity.add(shipmentReceipt.getBigDecimal("quantityAccepted")); } } @@ -5751,7 +5751,7 @@ public class OrderServices { public static Map<String, Object> addOrderItemShipGroup(DispatchContext dctx, Map<String, Object> context) { Map<String, Object> result; Delegator delegator = dctx.getDelegator(); - Locale locale = (Locale) context.get("locale" ); + Locale locale = (Locale) context.get("locale"); String orderId = (String) context.get("orderId"); //main message error @@ -5777,7 +5777,7 @@ public class OrderServices { String shipmentMethodTypeId = (String) context.get("shipmentMethodTypeId"); if (UtilValidate.isNotEmpty(shipmentMethodTypeId)) { // carrierPartyId is not in shipmentMethodTypeId - if (shipmentMethodTypeId.indexOf("_o_" ) == -1) { + if (shipmentMethodTypeId.indexOf("_o_") == -1) { GenericValue shipmentMethod = EntityQuery.use(delegator).from("CarrierShipmentMethod").where("partyId", carrierPartyId, "roleTypeId", "CARRIER", "shipmentMethodTypeId", shipmentMethodTypeId).cache().queryOne(); if (UtilValidate.isEmpty(shipmentMethod)) { String errMsg = mainErrorMessage + UtilProperties.getMessage(RES_ERROR, "OrderCartShipGroupShipmentMethodNotFound", UtilMisc.toMap("shipmentMethodTypeId", shipmentMethodTypeId), locale); @@ -5841,7 +5841,7 @@ public class OrderServices { */ public static Map<String, Object> deleteOrderItemShipGroup(DispatchContext ctx, Map<?, ?> context) throws GenericEntityException { Delegator delegator = ctx.getDelegator(); - Locale locale = (Locale) context.get("locale" ); + Locale locale = (Locale) context.get("locale"); Map<String, Object> result = new HashMap<>(); GenericValue orderItemShipGroup = (GenericValue) context.get("orderItemShipGroup"); @@ -5874,7 +5874,7 @@ public class OrderServices { throws GenericEntityException { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Locale locale = (Locale) context.get("locale" ); + Locale locale = (Locale) context.get("locale"); String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); String shipGroupSeqId = (String) context.get("shipGroupSeqId"); @@ -5963,8 +5963,8 @@ public class OrderServices { String message = null; Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Locale locale = (Locale) context.get("locale" ); - GenericValue userLogin = (GenericValue) context.get("userLogin" ); + Locale locale = (Locale) context.get("locale"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String orderId = (String) context.get("orderId"); String orderItemSeqId = (String) context.get("orderItemSeqId"); @@ -6062,7 +6062,7 @@ public class OrderServices { cancelQty = BigDecimal.ZERO; } BigDecimal orderItemQuantity = qty.subtract(cancelQty); - if (actualQuantity.compareTo(orderItemQuantity ) > 0) { + if (actualQuantity.compareTo(orderItemQuantity) > 0) { String errMsg = mainErrorMessage + UtilProperties.getMessage(RES_ERROR, "OrderQuantityAssociatedIsBiggerThanOrderItemQuantity", locale); Debug.logError(errMsg, MODULE); return ServiceUtil.returnError(errMsg); @@ -6408,7 +6408,7 @@ public class OrderServices { // get shipment method from OrderItemShipGroup, if not available in parameters if (UtilValidate.isNotEmpty(shipmentMethod)) { - String[] arr = shipmentMethod.split( "@" ); + String[] arr = shipmentMethod.split("@"); shipmentMethodTypeId = arr[0]; carrierPartyId = arr[1]; } else { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java index cc95eae..7c0d57f 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java @@ -188,7 +188,7 @@ public class QuoteServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(quoteOut)); } if (UtilValidate.isNotEmpty(quoteOut) && UtilValidate.isNotEmpty(quoteOut.get("quoteId"))) { - String quoteId = (String)quoteOut.get("quoteId"); + String quoteId = (String) quoteOut.get("quoteId"); result.put("quoteId", quoteId); // create Quote Items diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java index b0b169f..ba8a2a2 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java @@ -227,10 +227,10 @@ public class RequirementServices { GenericValue item = EntityQuery.use(delegator).from("OrderItem").where("orderId", orderItemAndShipGroup.getString("orderId"), "orderItemSeqId", orderItemAndShipGroup.getString("orderItemSeqId")).queryOne(); GenericValue product = item.getRelatedOne("Product", false); if (product == null) continue; - if ((!"PRODRQM_AUTO".equals(product.get("requirementMethodEnumId")) && - !"PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId"))) || - (product.get("requirementMethodEnumId") == null && - !"PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId")))) continue; + if ((!"PRODRQM_AUTO".equals(product.get("requirementMethodEnumId")) + && !"PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId"))) + || (product.get("requirementMethodEnumId") == null + && !"PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId")))) continue; BigDecimal quantity = item.getBigDecimal("quantity"); BigDecimal cancelQuantity = item.getBigDecimal("cancelQuantity"); BigDecimal required = quantity.subtract(cancelQuantity == null ? BigDecimal.ZERO : cancelQuantity); @@ -289,8 +289,8 @@ public class RequirementServices { GenericValue product = item.getRelatedOne("Product", false); if (product == null) continue; - if (!("PRODRQM_ATP".equals(product.get("requirementMethodEnumId")) || - ("PRODRQM_ATP".equals(productStore.get("requirementMethodEnumId")) && product.get("requirementMethodEnumId") == null))) continue; + if (!("PRODRQM_ATP".equals(product.get("requirementMethodEnumId")) + || ("PRODRQM_ATP".equals(productStore.get("requirementMethodEnumId")) && product.get("requirementMethodEnumId") == null))) continue; BigDecimal quantity = item.getBigDecimal("quantity"); BigDecimal cancelQuantity = item.getBigDecimal("cancelQuantity"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java index f8cc8b5..580e5b4 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java @@ -944,7 +944,7 @@ public class CheckOutEvents { // If the user has just created a new payment method, add it to the map with a null amount, so that // it becomes the sole payment method for the order. String newPaymentMethodId = (String) request.getAttribute("paymentMethodId"); - if (! UtilValidate.isEmpty(newPaymentMethodId)) { + if (!UtilValidate.isEmpty(newPaymentMethodId)) { selectedPaymentMethods.put(newPaymentMethodId, null); if (!selectedPaymentMethods.containsKey(newPaymentMethodId)) { selectedPaymentMethods.put(newPaymentMethodId, UtilMisc.toMap("amount", null, "securityCode", null)); @@ -1176,8 +1176,8 @@ public class CheckOutEvents { String originalOrderId = request.getParameter("orderId"); // create the replacement order adjustment - List <GenericValue>orderAdjustments = UtilGenerics.cast(context.get("orderAdjustments")); - List <GenericValue>orderItems = UtilGenerics.cast(context.get("orderItems")); + List<GenericValue>orderAdjustments = UtilGenerics.cast(context.get("orderAdjustments")); + List<GenericValue>orderItems = UtilGenerics.cast(context.get("orderItems")); OrderReadHelper orderReadHelper = new OrderReadHelper(orderAdjustments, orderItems); BigDecimal grandTotal = orderReadHelper.getOrderGrandTotal(); if (grandTotal.compareTo(new BigDecimal(0)) != 0) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java index 51a0dad..3d170f1 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutHelper.java @@ -476,8 +476,8 @@ public class CheckOutHelper { errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.gift_card_does_not_exist", cart.getLocale()); errorMessages.add(errMsg); gcFieldsOkay = false; - } else if ((finAccount.getBigDecimal("availableBalance") == null) || - !((finAccount.getBigDecimal("availableBalance")).compareTo(FinAccountHelper.getZero()) > 0)) { + } else if ((finAccount.getBigDecimal("availableBalance") == null) + || !((finAccount.getBigDecimal("availableBalance")).compareTo(FinAccountHelper.getZero()) > 0)) { // if account's available balance (including authorizations) is not greater than zero, then return an error errMsg = UtilProperties.getMessage(RES_ERROR, "checkhelper.gift_card_has_no_value", cart.getLocale()); errorMessages.add(errMsg); @@ -1159,9 +1159,9 @@ public class CheckOutHelper { EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, "EXT_BILLACT")); List<GenericValue> cashCodPcBaPaymentPreferences = EntityUtil.filterByOr(allPaymentPreferences, cashCodPcBaExpr); - if (UtilValidate.isNotEmpty(cashCodPcBaPaymentPreferences) && - UtilValidate.isNotEmpty(allPaymentPreferences) && - cashCodPcBaPaymentPreferences.size() == allPaymentPreferences.size()) { + if (UtilValidate.isNotEmpty(cashCodPcBaPaymentPreferences) + && UtilValidate.isNotEmpty(allPaymentPreferences) + && cashCodPcBaPaymentPreferences.size() == allPaymentPreferences.size()) { //if there are Check type, approve the order only if it is face to face List<GenericValue> checkPreferences = EntityUtil.filterByAnd(cashCodPcBaPaymentPreferences, UtilMisc.toMap("paymentMethodTypeId", "PERSONAL_CHECK")); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java index bd349da..2c5dd91 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java @@ -3292,9 +3292,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { List<GenericValue> cartAdjustments = this.getAdjustments(); if (cartAdjustments != null) { for (GenericValue checkOrderAdjustment : cartAdjustments) { - if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) { + if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) { if (checkOrderAdjustment.get("amount") != null) { totalDiscount = totalDiscount.add(checkOrderAdjustment.getBigDecimal("amount")); } @@ -3307,9 +3307,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { Iterator<GenericValue> checkOrderAdjustments = UtilMisc.toIterator(checkItem.getAdjustments()); while (checkOrderAdjustments != null && checkOrderAdjustments.hasNext()) { GenericValue checkOrderAdjustment = checkOrderAdjustments.next(); - if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) { + if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) { if (checkOrderAdjustment.get("amount") != null) { totalDiscount = totalDiscount.add(checkOrderAdjustment.getBigDecimal("amount")); } @@ -3372,9 +3372,9 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { // remove cart adjustments from promo actions List<GenericValue> cartAdjustments = this.getAdjustments(); if (cartAdjustments != null) { - cartAdjustments.removeIf(checkOrderAdjustment -> UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))); + cartAdjustments.removeIf(checkOrderAdjustment -> UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))); } // remove cart lines that are promos (ie GWPs) and cart line adjustments from promo actions @@ -3389,8 +3389,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { List<GenericValue> checkOrderAdjustments = checkItem.getAdjustments(); if (!checkOrderAdjustments.isEmpty()) { checkOrderAdjustments.removeIf(checkOrderAdjustment -> UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) - && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))); + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))); } } } @@ -4193,8 +4193,8 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { TreeMap<Integer, CartShipInfo> shipGroups = new TreeMap<>(); for (int i = 0; i < this.shipInfo.size(); i++) { CartShipInfo csi = shipInfo.get(i); - if ((csi.supplierPartyId == null && supplierPartyId == null) || - (UtilValidate.isNotEmpty(csi.supplierPartyId) && csi.supplierPartyId.equals(supplierPartyId))) { + if ((csi.supplierPartyId == null && supplierPartyId == null) + || (UtilValidate.isNotEmpty(csi.supplierPartyId) && csi.supplierPartyId.equals(supplierPartyId))) { shipGroups.put(i, csi); } } @@ -4326,7 +4326,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { // Order suppliers by supplierPrefOrderId so that preferred suppliers are used first supplierProducts = EntityUtil.orderBy(supplierProducts, UtilMisc.toList("supplierPrefOrderId")); GenericValue supplierProduct = EntityUtil.getFirst(supplierProducts); - if (! UtilValidate.isEmpty(supplierProduct)) { + if (!UtilValidate.isEmpty(supplierProduct)) { supplierPartyId = supplierProduct.getString("partyId"); } } catch (GenericServiceException e) { @@ -4338,12 +4338,12 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { continue; } - if (! dropShipItems.containsKey(supplierPartyId)) { + if (!dropShipItems.containsKey(supplierPartyId)) { dropShipItems.put(supplierPartyId, new HashMap<ShoppingCartItem, Map<Integer, BigDecimal>>()); } Map<ShoppingCartItem, Map<Integer, BigDecimal>> supplierCartItems = UtilGenerics.cast(dropShipItems.get(supplierPartyId)); - if (! supplierCartItems.containsKey(cartItem)) { + if (!supplierCartItems.containsKey(cartItem)) { supplierCartItems.put(cartItem, new HashMap<>()); } Map<Integer, BigDecimal> cartItemGroupQuantities = UtilGenerics.cast(supplierCartItems.get(cartItem)); @@ -4360,7 +4360,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable { // Attempt to get the first ship group for the supplierPartyId TreeMap<Integer, CartShipInfo> supplierShipGroups = this.getShipGroupsBySupplier(supplierPartyId); - if (! UtilValidate.isEmpty(supplierShipGroups)) { + if (!UtilValidate.isEmpty(supplierShipGroups)) { newShipGroupIndex = supplierShipGroups.firstKey(); shipInfo = supplierShipGroups.get(supplierShipGroups.firstKey()); } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java index abe58e4..4f0b7ce 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java @@ -126,7 +126,7 @@ public class ShoppingCartEvents { List<GenericValue> itemAdjustments = checkItem.getAdjustments(); if (!itemAdjustments.isEmpty()) { index = 0; - for (GenericValue adjustment : itemAdjustments ) { + for (GenericValue adjustment : itemAdjustments) { if (adjustment.get("productPromoId").equals(productPromoId)) { checkItem.getAdjustments().remove(index); result = "success"; @@ -466,7 +466,7 @@ public class ShoppingCartEvents { quantity = (BigDecimal) ObjectType.simpleTypeOrObjectConvert(quantityStr, "BigDecimal", null, locale); //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { BigDecimal remainder = quantity.remainder(BigDecimal.ONE); if (remainder.compareTo(BigDecimal.ZERO) != 0) { request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "cart.addToCart.quantityInDecimalNotAllowed", locale)); @@ -640,7 +640,7 @@ public class ShoppingCartEvents { } // check for alternative packing - if (ProductWorker.isAlternativePacking(delegator, productId , parentProductId)) { + if (ProductWorker.isAlternativePacking(delegator, productId, parentProductId)) { GenericValue parentProduct = null; try { parentProduct = EntityQuery.use(delegator).from("Product").where("productId", parentProductId).queryOne(); @@ -661,7 +661,7 @@ public class ShoppingCartEvents { shipBeforeDate, shipAfterDate, reserveAfterDate, configWrapper, itemGroupNumber, paramMap, parentProductId); controlDirective = processResult(result, request); - Integer itemId = (Integer)result.get("itemId"); + Integer itemId = (Integer) result.get("itemId"); if (UtilValidate.isNotEmpty(itemId)) { request.setAttribute("itemId", itemId); } @@ -1118,9 +1118,9 @@ public class ShoppingCartEvents { Iterator<GenericValue> checkOrderAdjustments = UtilMisc.toIterator(cartLine.getAdjustments()); while (checkOrderAdjustments != null && checkOrderAdjustments.hasNext()) { GenericValue checkOrderAdjustment = checkOrderAdjustments.next(); - if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) && - UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) { + if (UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoRuleId")) + && UtilValidate.isNotEmpty(checkOrderAdjustment.getString("productPromoActionSeqId"))) { GenericPK productPromoActionPk = delegator.makeValidValue("ProductPromoAction", checkOrderAdjustment).getPrimaryKey(); cart.setDesiredAlternateGiftByAction(productPromoActionPk, alternateGwpProductId); if ("SALES_ORDER".equals(cart.getOrderType())) { @@ -1385,7 +1385,7 @@ public class ShoppingCartEvents { public static String loadCartFromShoppingList(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String shoppingListId = request.getParameter("shoppingListId"); @@ -1400,7 +1400,7 @@ public class ShoppingCartEvents { Debug.logError(errorMessage, MODULE); return "error"; } - cart = (ShoppingCart)outMap.get("shoppingCart"); + cart = (ShoppingCart) outMap.get("shoppingCart"); } catch (GenericServiceException exc) { request.setAttribute("_ERROR_MESSAGE_", exc.getMessage()); return "error"; @@ -1418,7 +1418,7 @@ public class ShoppingCartEvents { public static String loadCartFromQuote(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String quoteId = request.getParameter("quoteId"); @@ -1457,7 +1457,7 @@ public class ShoppingCartEvents { public static String loadCartFromOrder(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); Delegator delegator = (Delegator) request.getAttribute("delegator"); String orderId = request.getParameter("orderId"); @@ -1509,9 +1509,9 @@ public class ShoppingCartEvents { } for (GenericValue orderAdjustment: orderAdjustments) { if ("OrderAdjustment".equals(orderAdjustment.getEntityName())) { - if (("SHIPPING_CHARGES".equals(orderAdjustment.get("orderAdjustmentTypeId"))) && - orderAdjustment.get("orderId").equals(orderId) && - orderAdjustment.get("shipGroupSeqId").equals(shipGroupSeqId) && orderAdjustment.get("comments") == null) { + if (("SHIPPING_CHARGES".equals(orderAdjustment.get("orderAdjustmentTypeId"))) + && orderAdjustment.get("orderId").equals(orderId) + && orderAdjustment.get("shipGroupSeqId").equals(shipGroupSeqId) && orderAdjustment.get("comments") == null) { // Removing objects from list for old Shipping and Handling Charges Adjustment and Sales Tax Adjustment. duplicateAdjustmentList.add(orderAdjustment); } @@ -1538,7 +1538,7 @@ public class ShoppingCartEvents { public static String createQuoteFromCart(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String destroyCart = request.getParameter("destroyCart"); ShoppingCart cart = getCartObject(request); @@ -1570,7 +1570,7 @@ public class ShoppingCartEvents { public static String createCustRequestFromCart(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String destroyCart = request.getParameter("destroyCart"); ShoppingCart cart = getCartObject(request); @@ -1604,7 +1604,7 @@ public class ShoppingCartEvents { Delegator delegator = (Delegator) request.getAttribute("delegator"); HttpSession session = request.getSession(); Security security = (Security) request.getAttribute("security"); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); Locale locale = UtilHttp.getLocale(request); String productStoreId = request.getParameter("productStoreId"); @@ -1840,7 +1840,7 @@ public class ShoppingCartEvents { try { //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { BigDecimal remainder = quantity.remainder(BigDecimal.ONE); if (remainder.compareTo(BigDecimal.ZERO) != 0) { request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(RES_ERROR, "cart.addToCart.quantityInDecimalNotAllowed", cart.getLocale())); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java index 68b90a1..60c6dc0 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java @@ -438,7 +438,7 @@ public class ShoppingCartHelper { } if (quantity.compareTo(BigDecimal.ZERO) > 0) { // check for alternative packing - if (ProductWorker.isAlternativePacking(delegator, null , productId)) { + if (ProductWorker.isAlternativePacking(delegator, null, productId)) { GenericValue originalProduct = null; originalProductId = productId; productId = ProductWorker.getOriginalProductId(delegator, productId); @@ -456,7 +456,7 @@ public class ShoppingCartHelper { try { //For quantity we should test if we allow to add decimal quantity for this product an productStore : // if not and if quantity is in decimal format then return error. - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, productId, cart.getProductStoreId())) { BigDecimal remainder = quantity.remainder(BigDecimal.ONE); if (remainder.compareTo(BigDecimal.ZERO) != 0) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "cart.addToCart.quantityInDecimalNotAllowed", this.cart.getLocale())); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java index a0b1b3b..4833b95 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java @@ -190,7 +190,7 @@ public class ShoppingCartItem implements java.io.Serializable { if (product == null) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - String excMsg = UtilProperties.getMessage(RES_ERROR, "item.product_not_found", messageMap , cart.getLocale()); + String excMsg = UtilProperties.getMessage(RES_ERROR, "item.product_not_found", messageMap, cart.getLocale()); Debug.logWarning(excMsg, MODULE); throw new ItemNotFoundException(excMsg); @@ -201,7 +201,7 @@ public class ShoppingCartItem implements java.io.Serializable { if ("Y".equals(product.getString("isVirtual"))) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId")); - String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_virtual", messageMap , cart.getLocale()); + String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_virtual", messageMap, cart.getLocale()); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); @@ -212,7 +212,7 @@ public class ShoppingCartItem implements java.io.Serializable { if (configWrapper == null || !configWrapper.isCompleted()) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId")); - String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_configured_correctly", messageMap , cart.getLocale()); + String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_configured_correctly", messageMap, cart.getLocale()); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); @@ -415,7 +415,7 @@ public class ShoppingCartItem implements java.io.Serializable { if ("Y".equals(product.getString("isVirtual"))) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId")); - String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_virtual", messageMap , cart.getLocale()); + String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_virtual", messageMap, cart.getLocale()); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); @@ -539,7 +539,7 @@ public class ShoppingCartItem implements java.io.Serializable { if (product == null) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - String excMsg = UtilProperties.getMessage(RES_ERROR, "item.product_not_found", messageMap , locale); + String excMsg = UtilProperties.getMessage(RES_ERROR, "item.product_not_found", messageMap, locale); Debug.logWarning(excMsg, MODULE); throw new ItemNotFoundException(excMsg); @@ -554,7 +554,7 @@ public class ShoppingCartItem implements java.io.Serializable { "productId", product.getString("productId")); String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_yet_available", - messageMap , locale); + messageMap, locale); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); @@ -566,19 +566,19 @@ public class ShoppingCartItem implements java.io.Serializable { "productId", product.getString("productId")); String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_no_longer_available", - messageMap , locale); + messageMap, locale); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); } // check to see if the product is fully configured - if ("AGGREGATED".equals(product.getString("productTypeId"))|| "AGGREGATED_SERVICE".equals(product.getString("productTypeId"))) { + if ("AGGREGATED".equals(product.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(product.getString("productTypeId"))) { if (configWrapper == null || !configWrapper.isCompleted()) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", product.getString("productName"), "productId", product.getString("productId")); String excMsg = UtilProperties.getMessage(RES_ERROR, "item.cannot_add_product_not_configured_correctly", - messageMap , locale); + messageMap, locale); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); } @@ -897,7 +897,7 @@ public class ShoppingCartItem implements java.io.Serializable { selFixedAssetProduct = EntityQuery.use(delegator).from("FixedAssetProduct").where("productId", productId, "fixedAssetProductTypeId", "FAPT_USE").filterByDate(UtilDateTime.nowTimestamp(), "fromDate", "thruDate").queryList(); } catch (GenericEntityException e) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - String msg = UtilProperties.getMessage(RES_ERROR, "item.cannot_find_Fixed_Asset", messageMap , cart.getLocale()); + String msg = UtilProperties.getMessage(RES_ERROR, "item.cannot_find_Fixed_Asset", messageMap, cart.getLocale()); return msg; } if (UtilValidate.isNotEmpty(selFixedAssetProduct)) { @@ -905,7 +905,7 @@ public class ShoppingCartItem implements java.io.Serializable { fixedAssetProduct = firstOne.next(); } else { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productId", productId); - String msg = UtilProperties.getMessage(RES_ERROR, "item.cannot_find_Fixed_Asset", messageMap , cart.getLocale()); + String msg = UtilProperties.getMessage(RES_ERROR, "item.cannot_find_Fixed_Asset", messageMap, cart.getLocale()); return msg; } @@ -915,12 +915,12 @@ public class ShoppingCartItem implements java.io.Serializable { fixedAsset = fixedAssetProduct.getRelatedOne("FixedAsset", false); } catch (GenericEntityException e) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("fixedAssetId", fixedAssetProduct.getString("fixedAssetId")); - String msg = UtilProperties.getMessage(RES_ERROR, "item.fixed_Asset_not_found", messageMap , cart.getLocale()); + String msg = UtilProperties.getMessage(RES_ERROR, "item.fixed_Asset_not_found", messageMap, cart.getLocale()); return msg; } if (fixedAsset == null) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("fixedAssetId", fixedAssetProduct.getString("fixedAssetId")); - String msg = UtilProperties.getMessage(RES_ERROR, "item.fixed_Asset_not_found", messageMap , cart.getLocale()); + String msg = UtilProperties.getMessage(RES_ERROR, "item.fixed_Asset_not_found", messageMap, cart.getLocale()); return msg; } @@ -944,7 +944,7 @@ public class ShoppingCartItem implements java.io.Serializable { return msg; } // now find all the dates and check the availabilty for each date - // please note that calendarId is the same for (TechData)Calendar, CalendarExcDay and CalendarExWeek + // please note that calendarId is the same for (TechData) Calendar, CalendarExcDay and CalendarExWeek long dayCount = 0; String resultMessage = ""; while (BigDecimal.valueOf(dayCount).compareTo(reservLength) < 0) { @@ -1020,7 +1020,7 @@ public class ShoppingCartItem implements java.io.Serializable { if (this.isPromo) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("productName", this.getName(dispatcher), "productId", productId); - String excMsg = UtilProperties.getMessage(RESOURCE, "OrderCannotChangeQuantityInPromotion", messageMap , cart.getLocale()); + String excMsg = UtilProperties.getMessage(RESOURCE, "OrderCannotChangeQuantityInPromotion", messageMap, cart.getLocale()); throw new CartItemModifyException(excMsg); } @@ -1033,7 +1033,7 @@ public class ShoppingCartItem implements java.io.Serializable { if (!isInventoryAvailableOrNotRequired(quantity, productStoreId, dispatcher)) { Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("requestedQuantity", UtilFormatOut.formatQuantity(quantity.doubleValue()), "productName", this.getName(dispatcher), "productId", productId); - String excMsg = UtilProperties.getMessage(RESOURCE, "OrderDoNotHaveEnoughProducts", messageMap , cart.getLocale()); + String excMsg = UtilProperties.getMessage(RESOURCE, "OrderDoNotHaveEnoughProducts", messageMap, cart.getLocale()); Debug.logWarning(excMsg, MODULE); throw new CartItemModifyException(excMsg); } @@ -1124,7 +1124,7 @@ public class ShoppingCartItem implements java.io.Serializable { } // check alternative packaging - boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, this.productId , this.getParentProductId()); + boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, this.productId, this.getParentProductId()); BigDecimal pieces = BigDecimal.ONE; if (isAlternativePacking && UtilValidate.isNotEmpty(this.getParentProduct())) { GenericValue originalProduct = this.getParentProduct(); @@ -1409,9 +1409,9 @@ public class ShoppingCartItem implements java.io.Serializable { BigDecimal quantityUsed = entry.getValue(); if (quantityUsed != null) { // must be in the same rule and be a condition - if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) && - productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId")) && - productPromoCondActionPK.containsKey("productPromoCondSeqId")) { + if (productPromoId.equals(productPromoCondActionPK.getString("productPromoId")) + && productPromoRuleId.equals(productPromoCondActionPK.getString("productPromoRuleId")) + && productPromoCondActionPK.containsKey("productPromoCondSeqId")) { totalUse = totalUse.add(quantityUsed); } } @@ -2446,16 +2446,16 @@ public class ShoppingCartItem implements java.io.Serializable { return false; } - if ((this.additionalProductFeatureAndAppls == null && UtilValidate.isNotEmpty(additionalProductFeatureAndAppls)) || - (UtilValidate.isNotEmpty(this.additionalProductFeatureAndAppls) && additionalProductFeatureAndAppls == null) || - (this.additionalProductFeatureAndAppls != null && additionalProductFeatureAndAppls != null && - (this.additionalProductFeatureAndAppls.size() != additionalProductFeatureAndAppls.size() || - !(this.additionalProductFeatureAndAppls.equals(additionalProductFeatureAndAppls))))) { + if ((this.additionalProductFeatureAndAppls == null && UtilValidate.isNotEmpty(additionalProductFeatureAndAppls)) + || (UtilValidate.isNotEmpty(this.additionalProductFeatureAndAppls) && additionalProductFeatureAndAppls == null) + || (this.additionalProductFeatureAndAppls != null && additionalProductFeatureAndAppls != null + && (this.additionalProductFeatureAndAppls.size() != additionalProductFeatureAndAppls.size() + || !(this.additionalProductFeatureAndAppls.equals(additionalProductFeatureAndAppls))))) { return false; } - if ((this.attributes == null && UtilValidate.isNotEmpty(attributes)) || (UtilValidate.isNotEmpty(this.attributes) && attributes == null) || - (this.attributes != null && attributes != null && (this.attributes.size() != attributes.size() || !(this.attributes.equals(attributes))))) { + if ((this.attributes == null && UtilValidate.isNotEmpty(attributes)) || (UtilValidate.isNotEmpty(this.attributes) && attributes == null) + || (this.attributes != null && attributes != null && (this.attributes.size() != attributes.size() || !(this.attributes.equals(attributes))))) { return false; } @@ -2482,8 +2482,8 @@ public class ShoppingCartItem implements java.io.Serializable { } // order item attribute unique - return !((this.orderItemAttributes == null && UtilValidate.isNotEmpty(orderItemAttributes)) || (UtilValidate.isNotEmpty(this.orderItemAttributes) && orderItemAttributes == null) || - (this.orderItemAttributes != null && orderItemAttributes != null && (this.orderItemAttributes.size() != orderItemAttributes.size() || !(this.orderItemAttributes.equals(orderItemAttributes))))); + return !((this.orderItemAttributes == null && UtilValidate.isNotEmpty(orderItemAttributes)) || (UtilValidate.isNotEmpty(this.orderItemAttributes) && orderItemAttributes == null) + || (this.orderItemAttributes != null && orderItemAttributes != null && (this.orderItemAttributes.size() != orderItemAttributes.size() || !(this.orderItemAttributes.equals(orderItemAttributes))))); } /** Gets the Product entity. If it is not already retreived gets it from the delegator */ diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java index ae6139a..711c960 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java @@ -613,9 +613,9 @@ public class ShoppingCartServices { // reservation, tax calculation, etc. ShoppingCart.CartShipInfo csi = cart.getShipInfo(cartShipGroupIndex); ShoppingCartItem cartItem = cart.findCartItem(itemIndex); - if (cartItem == null || cartItem.getQuantity() == null || - BigDecimal.ZERO.equals(cartItem.getQuantity()) || - shipGroupQty.equals(cartItem.getQuantity())) { + if (cartItem == null || cartItem.getQuantity() == null + || BigDecimal.ZERO.equals(cartItem.getQuantity()) + || shipGroupQty.equals(cartItem.getQuantity())) { Debug.logInfo("In loadCartFromOrder not adding item [" + item.getString("orderItemSeqId") + "] to ship group with index [" + itemIndex + "]; group quantity is [" + shipGroupQty + "] item quantity is [" + (cartItem != null ? cartItem.getQuantity() : "no cart item") + @@ -921,7 +921,7 @@ public class ShoppingCartServices { if (adjs != null) { for (GenericValue adj : adjs) { - if (isTaxAdjustment( adj )) { + if (isTaxAdjustment(adj)) { shipInfo.shipTaxAdj.add(adj); } else { cartAdjs.add(adj); @@ -940,7 +940,7 @@ public class ShoppingCartServices { } if (adjs != null) { for (GenericValue adj : adjs) { - if (isTaxAdjustment( adj )) { + if (isTaxAdjustment(adj)) { CartShipItemInfo csii = shipInfo.getShipItemInfo(item); if (csii.itemTaxAdj == null) { @@ -1139,8 +1139,8 @@ public class ShoppingCartServices { cartItemData.put("displayItemQty_" + cartLineIndex, cartLine.getQuantity()); cartItemData.put("displayItemPrice_" + cartLineIndex, org.apache.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getDisplayPrice(), isoCode, locale)); cartItemData.put("displayItemSubTotal_" + cartLineIndex, cartLine.getDisplayItemSubTotal()); - cartItemData.put("displayItemSubTotalCurrencyFormatted_" + cartLineIndex , org.apache.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getDisplayItemSubTotal(), isoCode, locale)); - cartItemData.put("displayItemAdjustment_" + cartLineIndex , org.apache.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getOtherAdjustments(), isoCode, locale)); + cartItemData.put("displayItemSubTotalCurrencyFormatted_" + cartLineIndex, org.apache.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getDisplayItemSubTotal(), isoCode, locale)); + cartItemData.put("displayItemAdjustment_" + cartLineIndex, org.apache.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getOtherAdjustments(), isoCode, locale)); } result.put("cartItemData", cartItemData); } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/WebShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/WebShoppingCart.java index daea250..b640217 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/WebShoppingCart.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/WebShoppingCart.java @@ -42,7 +42,7 @@ public class WebShoppingCart extends ShoppingCart { // for purchase orders, bill to customer partyId must be set - otherwise, no way to know who we're purchasing for. supplierPartyId is furnished // by order manager for PO entry. // TODO: refactor constructor and the getCartObject method which calls them to multiple constructors for different types of orders - super((Delegator)request.getAttribute("delegator"), ProductStoreWorker.getProductStoreId(request), + super((Delegator) request.getAttribute("delegator"), ProductStoreWorker.getProductStoreId(request), WebSiteWorker.getWebSiteId(request), (locale != null ? locale : ProductStoreWorker.getStoreLocale(request)), (currencyUom != null ? currencyUom : ProductStoreWorker.getStoreCurrencyUomId(request)), request.getParameter("billToCustomerPartyId"), diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java index 6d827fc..d8fb556 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java @@ -271,7 +271,7 @@ public final class ProductDisplayWorker { Integer quantity = entry.getValue(); BigDecimal occs = productQuantities.get(prodId); //For quantity we should test if we allow to add decimal quantity for this product an productStore : if not then round to 0 - if (! ProductWorker.isDecimalQuantityOrderAllowed(delegator, prodId, cart.getProductStoreId())) { + if (!ProductWorker.isDecimalQuantityOrderAllowed(delegator, prodId, cart.getProductStoreId())) { occs = occs.setScale(0, UtilNumber.getRoundingMode("order.rounding")); } else { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java index 9fe56f0..21438eb 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java @@ -340,7 +340,7 @@ public final class ProductPromoWorker { int indexOfFirstOrderTotalPromo = -1; for (ProductPromoUseInfo promoUse: sortedPromoUses) { GenericValue productPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", promoUse.getProductPromoId()).cache().queryOne(); - GenericValue newProductPromo = (GenericValue)productPromo.clone(); + GenericValue newProductPromo = (GenericValue) productPromo.clone(); if (!usesPerPromo.containsKey(promoUse.getProductPromoId())) { usesPerPromo.put(promoUse.getProductPromoId(), 0l); } @@ -816,9 +816,9 @@ public final class ProductPromoWorker { boolean cartChanged = false; Map<ShoppingCartItem, BigDecimal> usageInfoMap = prepareProductUsageInfoMap(cart); String productPromoId = productPromo.getString("productPromoId"); - while ((useLimit == null || useLimit > cart.getProductPromoUseCount(productPromoId)) && - (!requireCode || UtilValidate.isNotEmpty(productPromoCodeId)) && - (codeUseLimit == null || codeUseLimit > cart.getProductPromoCodeUse(productPromoCodeId))) { + while ((useLimit == null || useLimit > cart.getProductPromoUseCount(productPromoId)) + && (!requireCode || UtilValidate.isNotEmpty(productPromoCodeId)) + && (codeUseLimit == null || codeUseLimit > cart.getProductPromoCodeUse(productPromoCodeId))) { boolean promoUsed = false; BigDecimal totalDiscountAmount = BigDecimal.ZERO; BigDecimal quantityLeftInActions = BigDecimal.ZERO; @@ -993,7 +993,7 @@ public final class ProductPromoWorker { } else if ("PPC_GTE".equals(operatorEnumId)) { if (compare >= 0) return true; } else { - Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderAnUnSupportedProductPromoCondCondition", UtilMisc.toMap("operatorEnumId", operatorEnumId) , cart.getLocale()), MODULE); + Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderAnUnSupportedProductPromoCondCondition", UtilMisc.toMap("operatorEnumId", operatorEnumId), cart.getLocale()), MODULE); return false; } } @@ -1061,7 +1061,7 @@ public final class ProductPromoWorker { || ("PPC_GTE".equals(operatorEnumId) && compare >= 0); if (!res) { Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderAnUnSupportedProductPromoCondCondition", - UtilMisc.toMap("operatorEnumId", operatorEnumId) , cart.getLocale()), MODULE); + UtilMisc.toMap("operatorEnumId", operatorEnumId), cart.getLocale()), MODULE); } return res; } @@ -1069,7 +1069,7 @@ public final class ProductPromoWorker { public static int checkConditionPartyHierarchy(Delegator delegator, Timestamp nowTimestamp, String groupPartyId, String partyId) throws GenericEntityException { List<GenericValue> partyRelationshipList = EntityQuery.use(delegator).from("PartyRelationship").where("partyIdTo", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").cache(true).filterByDate(nowTimestamp).queryList(); for (GenericValue genericValue : partyRelationshipList) { - String partyIdFrom = (String)genericValue.get("partyIdFrom"); + String partyIdFrom = (String) genericValue.get("partyIdFrom"); if (partyIdFrom.equals(groupPartyId)) { return 0; } @@ -1201,9 +1201,9 @@ public final class ProductPromoWorker { Iterator<GenericValue> checkOrderAdjustments = UtilMisc.toIterator(checkItem.getAdjustments()); while (checkOrderAdjustments != null && checkOrderAdjustments.hasNext()) { GenericValue checkOrderAdjustment = checkOrderAdjustments.next(); - if (productPromoAction.getString("productPromoId").equals(checkOrderAdjustment.get("productPromoId")) && - productPromoAction.getString("productPromoRuleId").equals(checkOrderAdjustment.get("productPromoRuleId")) && - productPromoAction.getString("productPromoActionSeqId").equals(checkOrderAdjustment.get("productPromoActionSeqId"))) { + if (productPromoAction.getString("productPromoId").equals(checkOrderAdjustment.get("productPromoId")) + && productPromoAction.getString("productPromoRuleId").equals(checkOrderAdjustment.get("productPromoRuleId")) + && productPromoAction.getString("productPromoActionSeqId").equals(checkOrderAdjustment.get("productPromoActionSeqId"))) { return i; } } @@ -1220,10 +1220,10 @@ public final class ProductPromoWorker { List<GenericValue> adjustments = cartItem.getAdjustments(); if (UtilValidate.isNotEmpty(adjustments)) { for (GenericValue adjustment : adjustments) { - if ("PROMOTION_ADJUSTMENT".equals(adjustment.getString("orderAdjustmentTypeId")) && - productPromoAction.get("productPromoId").equals(adjustment.getString("productPromoId")) && - productPromoAction.get("productPromoRuleId").equals(adjustment.getString("productPromoRuleId")) && - productPromoAction.get("productPromoActionSeqId").equals(adjustment.getString("productPromoActionSeqId"))) { + if ("PROMOTION_ADJUSTMENT".equals(adjustment.getString("orderAdjustmentTypeId")) + && productPromoAction.get("productPromoId").equals(adjustment.getString("productPromoId")) + && productPromoAction.get("productPromoRuleId").equals(adjustment.getString("productPromoRuleId")) + && productPromoAction.get("productPromoActionSeqId").equals(adjustment.getString("productPromoActionSeqId"))) { BigDecimal newAmount = amount.add(adjustment.getBigDecimal(amountField)); adjustment.set(amountField, newAmount); addNewAdjustment = false; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java index f0de811..02d7273 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java @@ -279,7 +279,7 @@ public class ShippingEvents { return responseResult; } - public static BigDecimal getGenericShipEstimate(LocalDispatcher dispatcher, GenericValue storeShipMeth, Map <String, ? extends Object>context) throws GeneralException { + public static BigDecimal getGenericShipEstimate(LocalDispatcher dispatcher, GenericValue storeShipMeth, Map<String, ? extends Object>context) throws GeneralException { // invoke the generic estimate service next -- append to estimate amount Map<String, Object> genericEstimate = null; BigDecimal genericShipAmt = null; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java index 5148be3..8cb29c4 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java @@ -63,7 +63,7 @@ public class OrderTestServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(outputMap)); } - String orderId = (String)outputMap.get("orderId"); + String orderId = (String) outputMap.get("orderId"); Debug.logInfo("Test sales order with id [" + orderId + "] has been processed.", MODULE); } catch (GenericServiceException e) { String errMsg = "Error calling createTestSalesOrderSingle: " + e.toString(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java index 842c41d..dc02658 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java @@ -46,41 +46,41 @@ public class PurchaseOrderTest extends OFBizTestCase { } public void testCreatePurchaseOrder() throws Exception { - Map <String, Object> ctx = new HashMap<>(); + Map<String, Object> ctx = new HashMap<>(); ctx.put("partyId", "Company"); ctx.put("orderTypeId", "PURCHASE_ORDER"); ctx.put("currencyUom", "USD"); - ctx.put("productStoreId","9000"); + ctx.put("productStoreId", "9000"); GenericValue orderItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", "00001", "orderItemTypeId", "PRODUCT_ORDER_ITEM", "prodCatalogId", "DemoCatalog", "productId", "GZ-1000", "quantity", new BigDecimal("2"), "isPromo", "N")); orderItem.set("unitPrice", new BigDecimal("1399.5")); orderItem.set("unitListPrice", BigDecimal.ZERO); orderItem.set("isModifiedPrice", "N"); orderItem.set("statusId", "ITEM_CREATED"); - List <GenericValue> orderItems = new LinkedList<>(); + List<GenericValue> orderItems = new LinkedList<>(); orderItems.add(orderItem); ctx.put("orderItems", orderItems); GenericValue orderContactMech = delegator.makeValue("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "SHIPPING_LOCATION", "contactMechId", "9000")); - List <GenericValue> orderContactMechs = new LinkedList<>(); + List<GenericValue> orderContactMechs = new LinkedList<>(); orderContactMechs.add(orderContactMech); ctx.put("orderContactMechs", orderContactMechs); GenericValue orderItemContactMech = delegator.makeValue("OrderItemContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "SHIPPING_LOCATION", "contactMechId", "9000", "orderItemSeqId", "00001")); - List <GenericValue> orderItemContactMechs = new LinkedList<>(); + List<GenericValue> orderItemContactMechs = new LinkedList<>(); orderItemContactMechs.add(orderItemContactMech); ctx.put("orderItemContactMechs", orderItemContactMechs); GenericValue orderItemShipGroup = delegator.makeValue("OrderItemShipGroup", UtilMisc.toMap("carrierPartyId", "UPS", "contactMechId", "9000", "isGift", "N", "maySplit", "N", "shipGroupSeqId", "00001", "shipmentMethodTypeId", "NEXT_DAY")); orderItemShipGroup.set("carrierRoleTypeId", "CARRIER"); - List <GenericValue> orderItemShipGroupInfo = new LinkedList<>(); + List<GenericValue> orderItemShipGroupInfo = new LinkedList<>(); orderItemShipGroupInfo.add(orderItemShipGroup); ctx.put("orderItemShipGroupInfo", orderItemShipGroupInfo); - List <GenericValue> orderTerms = new LinkedList<>(); + List<GenericValue> orderTerms = new LinkedList<>(); ctx.put("orderTerms", orderTerms); - List <GenericValue> orderAdjustments = new LinkedList<>(); + List<GenericValue> orderAdjustments = new LinkedList<>(); ctx.put("orderAdjustments", orderAdjustments); ctx.put("billToCustomerPartyId", "Company"); @@ -89,7 +89,7 @@ public class PurchaseOrderTest extends OFBizTestCase { ctx.put("supplierAgentPartyId", "DemoSupplier"); ctx.put("userLogin", getUserLogin("system")); - Map <String, Object> resp = dispatcher.runSync("storeOrder", ctx); + Map<String, Object> resp = dispatcher.runSync("storeOrder", ctx); if (ServiceUtil.isError(resp)) { Debug.logError(ServiceUtil.getErrorMessage(resp), MODULE); return; diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java index aca3ce4..d707e3c 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java @@ -99,9 +99,9 @@ public class CommunicationEventServices { } // make sure the from contact mech is an email if it is specified - if ((communicationEvent.getRelatedOne("FromContactMech", false) == null) || - (!("EMAIL_ADDRESS".equals(communicationEvent.getRelatedOne("FromContactMech", false).getString("contactMechTypeId"))) || - (communicationEvent.getRelatedOne("FromContactMech", false).getString("infoString") == null))) { + if ((communicationEvent.getRelatedOne("FromContactMech", false) == null) + || (!("EMAIL_ADDRESS".equals(communicationEvent.getRelatedOne("FromContactMech", false).getString("contactMechTypeId"))) + || (communicationEvent.getRelatedOne("FromContactMech", false).getString("infoString") == null))) { String errMsg = UtilProperties.getMessage(RESOURCE, "commeventservices.communication_event_from_contact_mech_must_be_email", locale); return ServiceUtil.returnError(errMsg + " " + communicationEventId); } @@ -125,7 +125,7 @@ public class CommunicationEventServices { // check for attachments boolean isMultiPart = false; - List <GenericValue> comEventContents = EntityQuery.use(delegator).from("CommEventContentAssoc").where("communicationEventId", communicationEventId).filterByDate().queryList(); + List<GenericValue> comEventContents = EntityQuery.use(delegator).from("CommEventContentAssoc").where("communicationEventId", communicationEventId).filterByDate().queryList(); if (UtilValidate.isNotEmpty(comEventContents)) { isMultiPart = true; List<Map<String, ? extends Object>> bodyParts = new LinkedList<>(); @@ -162,7 +162,7 @@ public class CommunicationEventServices { // add other parties from roles String sendCc = null; String sendBcc = null; - List <GenericValue> commRoles = communicationEvent.getRelated("CommunicationEventRole", null, null, false); + List<GenericValue> commRoles = communicationEvent.getRelated("CommunicationEventRole", null, null, false); if (UtilValidate.isNotEmpty(commRoles)) { for (GenericValue commRole : commRoles) { // 'from' and 'to' already defined on communication event if (commRole.getString("partyId").equals(communicationEvent.getString("partyIdFrom")) || commRole.getString("partyId").equals(communicationEvent.getString("partyIdTo"))) { @@ -459,7 +459,7 @@ public class CommunicationEventServices { } emailAddress = emailAddress.trim(); - if (! UtilValidate.isEmail(emailAddress)) { + if (!UtilValidate.isEmail(emailAddress)) { // If validation fails, just log and skip the email address Debug.logError(skippingInvalidEmailAddress + ": " + emailAddress, MODULE); @@ -958,8 +958,8 @@ public class CommunicationEventServices { //Get the first address from the list - this is the partyIdTo field of the CommunicationEvent if (!toParties.isEmpty()) { Map<String, Object> firstAddressTo = toParties.get(0); - partyIdTo = (String)firstAddressTo.get("partyId"); - contactMechIdTo = (String)firstAddressTo.get("contactMechId"); + partyIdTo = (String) firstAddressTo.get("partyId"); + contactMechIdTo = (String) firstAddressTo.get("contactMechId"); } String deliveredTo = wrapper.getFirstHeader("Delivered-To"); @@ -1108,7 +1108,7 @@ public class CommunicationEventServices { if (ServiceUtil.isError(result)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } - communicationEventId = (String)result.get("communicationEventId"); + communicationEventId = (String) result.get("communicationEventId"); Debug.logInfo("Persisting New Email: " + aboutThisEmail + " into CommunicationEventId: " + communicationEventId, MODULE); // handle the attachments @@ -1309,7 +1309,7 @@ public class CommunicationEventServices { /* * Helper method to retrieve the party information from the first email address of the Address[] specified. */ - private static Map<String, Object> getParyInfoFromEmailAddress(Address [] addresses, GenericValue userLogin, LocalDispatcher dispatcher) throws GenericServiceException { + private static Map<String, Object> getParyInfoFromEmailAddress(Address[] addresses, GenericValue userLogin, LocalDispatcher dispatcher) throws GenericServiceException { InternetAddress emailAddress = null; Map<String, Object> map = null; Map<String, Object> result = null; diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java index ea980a4..533ef5f 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java @@ -86,7 +86,7 @@ public class PartyRelationshipServices { Debug.logWarning(e, MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "PartyRelationshipTypeReadFailure", - UtilMisc.toMap("errorString", e.getMessage()), locale)); + UtilMisc.toMap("errorString", e.getMessage()), locale)); } try { @@ -95,7 +95,7 @@ public class PartyRelationshipServices { Debug.logWarning(e.getMessage(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "PartyRelationshipTypeWriteFailure", - UtilMisc.toMap("errorString", e.getMessage()), locale)); + UtilMisc.toMap("errorString", e.getMessage()), locale)); } result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java index f9ed123..35c4db8 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java @@ -236,7 +236,7 @@ public class PartyServices { EntityCondition.makeCondition("partyId", partyId), EntityCondition.makeCondition("enabled", EntityOperator.NOT_EQUAL, "N") ); - List <GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where(cond).queryList(); + List<GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where(cond).queryList(); for (GenericValue userLogin : userLogins) { userLogin.set("enabled", "N"); userLogin.set("disabledDateTime", UtilDateTime.nowTimestamp()); @@ -650,11 +650,11 @@ public class PartyServices { try { GenericValue value = EntityQuery.use(delegator).from("NoteData").where("noteId", noteId).queryOne(); if (value == null) { - Debug.logError("ERROR: Note id does not exist for : " + noteId + ", autogenerating." , MODULE); + Debug.logError("ERROR: Note id does not exist for : " + noteId + ", autogenerating.", MODULE); noteId = null; } } catch (GenericEntityException e) { - Debug.logError(e, "ERROR: Note id does not exist for : " + noteId + ", autogenerating." , MODULE); + Debug.logError(e, "ERROR: Note id does not exist for : " + noteId + ", autogenerating.", MODULE); noteId = null; } } @@ -1304,10 +1304,9 @@ public class PartyServices { String inventoryItemId = (String) context.get("inventoryItemId"); String serialNumber = (String) context.get("serialNumber"); String softIdentifier = (String) context.get("softIdentifier"); - if (UtilValidate.isNotEmpty(inventoryItemId) || - UtilValidate.isNotEmpty(serialNumber) || - UtilValidate.isNotEmpty(softIdentifier)) { - + if (UtilValidate.isNotEmpty(inventoryItemId) + || UtilValidate.isNotEmpty(serialNumber) + || UtilValidate.isNotEmpty(softIdentifier)) { // add role to view dynamicView.addMemberEntity("II", "InventoryItem"); dynamicView.addAlias("II", "ownerPartyId"); @@ -1715,10 +1714,7 @@ public class PartyServices { String idValue = (String) context.get("idValue"); String partyIdentificationTypeId = (String) context.get("partyIdentificationTypeId"); - if ("I".equals(extInfo) || - UtilValidate.isNotEmpty(idValue) || - UtilValidate.isNotEmpty(partyIdentificationTypeId)) { - + if ("I".equals(extInfo) || UtilValidate.isNotEmpty(idValue) || UtilValidate.isNotEmpty(partyIdentificationTypeId)) { // add role to view dynamicView.addMemberEntity("PAI", "PartyIdentification"); dynamicView.addAlias("PAI", "idValue"); @@ -1742,9 +1738,9 @@ public class PartyServices { String inventoryItemId = (String) context.get("inventoryItemId"); String serialNumber = (String) context.get("serialNumber"); String softIdentifier = (String) context.get("softIdentifier"); - if (UtilValidate.isNotEmpty(inventoryItemId) || - UtilValidate.isNotEmpty(serialNumber) || - UtilValidate.isNotEmpty(softIdentifier)) { + if (UtilValidate.isNotEmpty(inventoryItemId) + || UtilValidate.isNotEmpty(serialNumber) + || UtilValidate.isNotEmpty(softIdentifier)) { // add role to view dynamicView.addMemberEntity("II", "InventoryItem"); @@ -1774,10 +1770,10 @@ public class PartyServices { // PostalAddress fields // ---- String stateProvinceGeoId = (String) context.get("stateProvinceGeoId"); - if ( "P".equals(extInfo) || - UtilValidate.isNotEmpty(context.get("address1"))|| UtilValidate.isNotEmpty(context.get("address2"))|| - UtilValidate.isNotEmpty(context.get("city"))|| UtilValidate.isNotEmpty(context.get("postalCode"))|| - UtilValidate.isNotEmpty(context.get("countryGeoId"))|| (UtilValidate.isNotEmpty(stateProvinceGeoId))) { + if ("P".equals(extInfo) + || UtilValidate.isNotEmpty(context.get("address1")) || UtilValidate.isNotEmpty(context.get("address2")) + || UtilValidate.isNotEmpty(context.get("city")) || UtilValidate.isNotEmpty(context.get("postalCode")) + || UtilValidate.isNotEmpty(context.get("countryGeoId")) || (UtilValidate.isNotEmpty(stateProvinceGeoId))) { // add address to dynamic view dynamicView.addMemberEntity("PC", "PartyContactMech"); dynamicView.addMemberEntity("PA", "PostalAddress"); @@ -1930,8 +1926,7 @@ public class PartyServices { * @return the result of the service execution */ public static Map<String, Object> linkParty(DispatchContext dctx, Map<String, ? extends Object> context) { - Delegator _delegator = dctx.getDelegator(); - Delegator delegator = _delegator.cloneDelegator(); + Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); delegator.setEntityEcaHandler(null); @@ -2241,8 +2236,6 @@ public class PartyServices { } return partyId; } - - /** * Finds partyId(s) corresponding to a party reference, partyId or a GoodIdentification idValue * @param ctx the dispatch context @@ -2316,7 +2309,7 @@ public class PartyServices { String lastContactMechPurposeTypeId = null; String currentContactMechPurposeTypeId = null; - Boolean addParty = false; // when modify party, contact mech not added again + boolean addParty = false; // when modify party, contact mech not added again try (BufferedReader csvReader = new BufferedReader(new StringReader(csvString))) { @@ -2339,7 +2332,7 @@ public class PartyServices { lastContactNumber = null; // party validation - List <GenericValue> currencyCheck = EntityQuery.use(delegator).from("Uom") + List<GenericValue> currencyCheck = EntityQuery.use(delegator).from("Uom") .where("abbreviation", rec.get("preferredCurrencyUomId"), "uomTypeId", "CURRENCY_MEASURE") .queryList(); if (UtilValidate.isNotEmpty(rec.get("preferredCurrencyUomId")) && currencyCheck.size() == 0) { @@ -2352,13 +2345,14 @@ public class PartyServices { newErrMsgs.add("Line number " + rec.getRecordNumber() + ": RoletypeId is not valid: " + rec.get("roleTypeId") ); } - if (UtilValidate.isNotEmpty(rec.get("contactMechTypeId")) && - EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", rec.get("contactMechTypeId")).cache().queryOne() == null) { + if (UtilValidate.isNotEmpty(rec.get("contactMechTypeId")) + && EntityQuery.use(delegator).from("ContactMechType").where("contactMechTypeId", rec.get("contactMechTypeId")).cache().queryOne() == null) { newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + " contactMechTypeId code not found for: " + rec.get("contactMechTypeId")); } - if (UtilValidate.isNotEmpty(rec.get("contactMechPurposeTypeId")) && - EntityQuery.use(delegator).from("ContactMechPurposeType").where("contactMechPurposeTypeId", rec.get("contactMechPurposeTypeId")).cache().queryOne() == null) { + if (UtilValidate.isNotEmpty(rec.get("contactMechPurposeTypeId")) + && EntityQuery.use(delegator).from("ContactMechPurposeType").where("contactMechPurposeTypeId", + rec.get("contactMechPurposeTypeId")).cache().queryOne() == null) { newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + "contactMechPurposeTypeId code not found for: " + rec.get("contactMechPurposeTypeId")); } @@ -2366,7 +2360,7 @@ public class PartyServices { if (UtilValidate.isEmpty(rec.get("countryGeoId"))) { newErrMsgs.add("Line number " + rec.getRecordNumber() + ": partyId: " + currentPartyId + "Country code missing"); } else { - List <GenericValue> countryCheck = EntityQuery.use(delegator).from("Geo") + List<GenericValue> countryCheck = EntityQuery.use(delegator).from("Geo") .where("geoTypeId", "COUNTRY", "abbreviation", rec.get("countryGeoId")) .queryList(); if (countryCheck.size() == 0) { @@ -2379,7 +2373,7 @@ public class PartyServices { } if (UtilValidate.isNotEmpty(rec.get("stateProvinceGeoId"))) { - List <GenericValue> stateCheck = EntityQuery.use(delegator).from("Geo") + List<GenericValue> stateCheck = EntityQuery.use(delegator).from("Geo") .where("geoTypeId", "STATE", "abbreviation", rec.get("stateProvinceGeoId")) .queryList(); if (stateCheck.size() == 0) { @@ -2401,7 +2395,7 @@ public class PartyServices { } if (errMsgs.size() == 0) { - List <GenericValue> partyCheck = EntityQuery.use(delegator).from("PartyIdentification") + List<GenericValue> partyCheck = EntityQuery.use(delegator).from("PartyIdentification") .where("partyIdentificationTypeId", "PARTY_IMPORT", "idValue", rec.get("partyId")) .queryList(); addParty = partyCheck.size() == 0; @@ -2485,7 +2479,7 @@ public class PartyServices { } if (UtilValidate.isNotEmpty(rec.get("companyPartyId"))) { - List <GenericValue> companyCheck = EntityQuery.use(delegator).from("PartyIdentification") + List<GenericValue> companyCheck = EntityQuery.use(delegator).from("PartyIdentification") .where("partyIdentificationTypeId", "PARTY_IMPORT", "idValue", rec.get("partyId")) .queryList(); if (companyCheck.size() == 0) { // update party group @@ -2546,7 +2540,7 @@ public class PartyServices { "contactMechTypeId", "EMAIL_ADDRESS", "userLogin", userLogin ); - Boolean emailAddressChanged = false; + boolean emailAddressChanged = false; if ("EMAIL_ADDRESS".equals(currentContactMechTypeId)) { emailAddress.put("infoString", rec.get("emailAddress")); emailAddressChanged = lastEmailAddress == null || !lastEmailAddress.equals(rec.get("emailAddress")); @@ -2555,7 +2549,7 @@ public class PartyServices { Map<String, Object> postalAddress = UtilMisc.toMap("userLogin", (Object) userLogin); // casting is here necessary for some compiler versions - Boolean postalAddressChanged = false; + boolean postalAddressChanged = false; if ("POSTAL_ADDRESS".equals(currentContactMechTypeId)) { postalAddress.put("address1", rec.get("address1")); postalAddress.put("address2", rec.get("address2")); @@ -2564,10 +2558,10 @@ public class PartyServices { postalAddress.put("countryGeoId", rec.get("countryGeoId")); postalAddress.put("postalCode", rec.get("postalCode")); postalAddressChanged = - lastAddress1 == null || !lastAddress1.equals(postalAddress.get("address1")) || - lastAddress2 == null || !lastAddress2.equals(postalAddress.get("address2")) || - lastCity == null || !lastCity.equals(postalAddress.get("city")) || - lastCountryGeoId == null || !lastCountryGeoId.equals(postalAddress.get("countryGeoId")); + lastAddress1 == null || !lastAddress1.equals(postalAddress.get("address1")) + || lastAddress2 == null || !lastAddress2.equals(postalAddress.get("address2")) + || lastCity == null || !lastCity.equals(postalAddress.get("city")) + || lastCountryGeoId == null || !lastCountryGeoId.equals(postalAddress.get("countryGeoId")); lastAddress1 = (String) postalAddress.get("address1"); lastAddress2 = (String) postalAddress.get("address2"); lastCity = (String) postalAddress.get("city"); @@ -2576,22 +2570,22 @@ public class PartyServices { Map<String, Object> telecomNumber = UtilMisc.toMap("userLogin", (Object) userLogin); // casting is here necessary for some compiler versions - Boolean telecomNumberChanged = false; + boolean telecomNumberChanged = false; if ("TELECOM_NUMBER".equals(currentContactMechTypeId)) { telecomNumber.put("countryCode", rec.get("telCountryCode")); telecomNumber.put("areaCode", rec.get("telAreaCode")); telecomNumber.put("contactNumber", rec.get("telContactNumber")); telecomNumberChanged = - lastCountryCode == null || !lastCountryCode.equals(telecomNumber.get("countryCode")) || - lastAreaCode == null || !lastAreaCode.equals(telecomNumber.get("areaCode")) || - lastContactNumber == null || !lastContactNumber.equals(telecomNumber.get("contactNumber")); + lastCountryCode == null || !lastCountryCode.equals(telecomNumber.get("countryCode")) + || lastAreaCode == null || !lastAreaCode.equals(telecomNumber.get("areaCode")) + || lastContactNumber == null || !lastContactNumber.equals(telecomNumber.get("contactNumber")); lastCountryCode = (String) telecomNumber.get("countryCode"); lastAreaCode = (String) telecomNumber.get("areaCode"); lastContactNumber = (String) telecomNumber.get("contactNumber"); } Map<String, Object> partyContactMechPurpose = UtilMisc.toMap("partyId", newPartyId, "userLogin", userLogin); - Boolean partyContactMechPurposeChanged = false; + boolean partyContactMechPurposeChanged = false; currentContactMechPurposeTypeId = rec.get("contactMechPurposeTypeId"); if (currentContactMechPurposeTypeId != null && ("TELECOM_NUMBER".equals(currentContactMechTypeId) || "POSTAL_ADDRESS".equals(currentContactMechTypeId) ||"EMAIL_ADDRESS".equals(currentContactMechTypeId))) { partyContactMechPurpose.put("contactMechPurposeTypeId", currentContactMechPurposeTypeId); diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java index 505cce5..fa46065 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java @@ -509,7 +509,7 @@ public class PartyWorker { partiesFound = EntityQuery.use(delegator).from("PartyIdentificationAndParty").where(conditions).orderBy("partyId").cache(true).queryList(); } - if (! searchPartyFirst) { + if (!searchPartyFirst) { party = EntityQuery.use(delegator).from("Party").where("partyId", idToFind).cache().queryOne(); } @@ -557,7 +557,7 @@ public class PartyWorker { for (GenericValue party : partiesByIds) { GenericValue partyToAdd = party; //retreive party GV if the actual genericValue came from viewEntity - if (! "Party".equals(party.getEntityName())) { + if (!"Party".equals(party.getEntityName())) { partyToAdd = EntityQuery.use(delegator).from("Party").where("partyId", party.get("partyId")).cache().queryOne(); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java index bf1f835..9063ae6 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java @@ -264,8 +264,7 @@ public final class CatalogWorker { public static String getProdCatalogCategoryId(Delegator delegator, String prodCatalogId, String prodCatalogCategoryTypeId) { if (UtilValidate.isNotEmpty(prodCatalogId) && UtilValidate.isNotEmpty(prodCatalogCategoryTypeId)) { - GenericValue prodCatalogCategory = EntityUtil.getFirst(getProdCatalogCategories(delegator, prodCatalogId - , prodCatalogCategoryTypeId)); + GenericValue prodCatalogCategory = EntityUtil.getFirst(getProdCatalogCategories(delegator, prodCatalogId, prodCatalogCategoryTypeId)); if (prodCatalogCategory != null) { return prodCatalogCategory.getString("productCategoryId"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java index 5cbf51b..bd6f804 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java @@ -473,7 +473,7 @@ public class CategoryServices { childOfCats = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", productCategoryId).filterByDate().queryList(); } if (UtilValidate.isNotEmpty(childOfCats)) { - for (GenericValue childOfCat : childOfCats ) { + for (GenericValue childOfCat : childOfCats) { Object catId = null; String catNameField = null; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java index 6d09934..2cc26f7 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java @@ -104,8 +104,8 @@ public final class CategoryWorker { Map<String, Object> requestParameters = UtilHttp.getParameterMap((HttpServletRequest) request); String requestId = null; - requestId = UtilFormatOut.checkNull((String)requestParameters.get("catalog_id"), (String)requestParameters.get("CATALOG_ID"), - (String)requestParameters.get("category_id"), (String)requestParameters.get("CATEGORY_ID")); + requestId = UtilFormatOut.checkNull((String) requestParameters.get("catalog_id"), (String) requestParameters.get("CATALOG_ID"), + (String) requestParameters.get("category_id"), (String) requestParameters.get("CATEGORY_ID")); if (requestId.equals("")) return; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java index 3970e36..19f0004 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/ftl/SeoTransform.java @@ -130,8 +130,8 @@ public class SeoTransform implements TemplateTransformModel { /** * Transform a url according to seo pattern regular expressions. * - * @param url , String to do the seo transform - * @param isAnon , boolean to indicate whether it's an anonymous visit. + * @param url, String to do the seo transform + * @param isAnon, boolean to indicate whether it's an anonymous visit. * * @return String, the transformed url. */ diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java index 36022f9..cdce5d9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWorker.java @@ -59,7 +59,7 @@ public final class ProductConfigWorker { String catalogId = CatalogWorker.getCurrentCatalogId(request); String webSiteId = WebSiteWorker.getWebSiteId(request); String productStoreId = ProductStoreWorker.getProductStoreId(request); - GenericValue autoUserLogin = (GenericValue)request.getSession().getAttribute("autoUserLogin"); + GenericValue autoUserLogin = (GenericValue) request.getSession().getAttribute("autoUserLogin"); try { /* caching: there is one cache created, "product.config" Each product's config wrapper is cached with a key of * productId::catalogId::webSiteId::currencyUomId, or whatever the SEPARATOR is defined above to be. @@ -68,8 +68,8 @@ public final class ProductConfigWorker { String cacheKey = productId + SEPARATOR + productStoreId + SEPARATOR + catalogId + SEPARATOR + webSiteId + SEPARATOR + currencyUomId + SEPARATOR + delegator; configWrapper = productConfigCache.get(cacheKey); if (configWrapper == null) { - configWrapper = new ProductConfigWrapper((Delegator)request.getAttribute("delegator"), - (LocalDispatcher)request.getAttribute("dispatcher"), + configWrapper = new ProductConfigWrapper((Delegator) request.getAttribute("delegator"), + (LocalDispatcher) request.getAttribute("dispatcher"), productId, productStoreId, catalogId, webSiteId, currencyUomId, UtilHttp.getLocale(request), autoUserLogin); @@ -91,9 +91,9 @@ public final class ProductConfigWorker { String[] opts = new String[0]; Object o = combinedMap.get(Integer.toString(k)); if (o instanceof String) { - opts = new String[]{(String)o}; + opts = new String[]{(String) o}; } else if (o instanceof List) { - List<?> list = (List<?>)o; + List<?> list = (List<?>) o; opts = list.toArray(new String[list.size()]); } if (opts == null) { @@ -145,8 +145,8 @@ public final class ProductConfigWorker { } else { // handle also feature tree virtual variant methods - if (ProductWorker.isVirtual((Delegator)request.getAttribute("delegator"), selectedProductId)) { - if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod((Delegator)request.getAttribute("delegator"), selectedProductId))) { + if (ProductWorker.isVirtual((Delegator) request.getAttribute("delegator"), selectedProductId)) { + if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod((Delegator) request.getAttribute("delegator"), selectedProductId))) { // get the selected features List<String> selectedFeatures = new LinkedList<>(); String prefix = "FT" + k + "_" + cnt + "_" + variantIndex; @@ -161,7 +161,7 @@ public final class ProductConfigWorker { Debug.logWarning("ERROR: No features selected for productId [" + selectedProductId+ "]", MODULE); } - String variantProductId = ProductWorker.getVariantFromFeatureTree(selectedProductId, selectedFeatures, (Delegator)request.getAttribute("delegator")); + String variantProductId = ProductWorker.getVariantFromFeatureTree(selectedProductId, selectedFeatures, (Delegator) request.getAttribute("delegator")); if (UtilValidate.isNotEmpty(variantProductId)) { selectedProductId = variantProductId; } else { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java index 8c1fc41..05fc4dc 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/config/ProductConfigWrapper.java @@ -243,7 +243,7 @@ public class ProductConfigWrapper implements Serializable { if (!(obj instanceof ProductConfigWrapper)) { return false; } - ProductConfigWrapper cw = (ProductConfigWrapper)obj; + ProductConfigWrapper cw = (ProductConfigWrapper) obj; if (!product.getString("productId").equals(cw.getProduct().getString("productId"))) { return false; } @@ -580,7 +580,7 @@ public class ProductConfigWrapper implements Serializable { } BigDecimal componentListPrice = (BigDecimal) priceMap.get("listPrice"); BigDecimal componentPrice = (BigDecimal) priceMap.get("price"); - Boolean validPriceFound = (Boolean)priceMap.get("validPriceFound"); + Boolean validPriceFound = (Boolean) priceMap.get("validPriceFound"); BigDecimal mult = BigDecimal.ONE; if (oneComponent.getBigDecimal("quantity") != null) { mult = oneComponent.getBigDecimal("quantity"); @@ -655,7 +655,7 @@ public class ProductConfigWrapper implements Serializable { } BigDecimal componentListPrice = (BigDecimal) priceMap.get("listPrice"); BigDecimal componentPrice = (BigDecimal) priceMap.get("price"); - Boolean validPriceFound = (Boolean)priceMap.get("validPriceFound"); + Boolean validPriceFound = (Boolean) priceMap.get("validPriceFound"); BigDecimal mult = BigDecimal.ONE; if (oneComponent.getBigDecimal("quantity") != null) { mult = oneComponent.getBigDecimal("quantity"); @@ -752,7 +752,7 @@ public class ProductConfigWrapper implements Serializable { } public boolean hasVirtualComponent () { - List <GenericValue> components = getComponents(); + List<GenericValue> components = getComponents(); if (UtilValidate.isNotEmpty(components)) { for (GenericValue component : components) { if (isVirtualComponent(component)) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java index 776270e..bfde8b7 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java @@ -270,7 +270,7 @@ public class ProductFeatureServices { for (Map<String, Object> combination: oldCombinations) { // Verify if the default code is already used, if so add a numeric suffix if (defaultVariantProductIds.contains(combination.get("defaultVariantProductId"))) { - combination.put("defaultVariantProductId", combination.get("defaultVariantProductId") + "-" + (defaultCodeCounter < 10? "0" + defaultCodeCounter: "" + defaultCodeCounter)); + combination.put("defaultVariantProductId", combination.get("defaultVariantProductId") + "-" + (defaultCodeCounter < 10 ? "0" + defaultCodeCounter : "" + defaultCodeCounter)); defaultCodeCounter++; } defaultVariantProductIds.add((String) combination.get("defaultVariantProductId")); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java index 692ade2..df7c9b9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java @@ -246,7 +246,7 @@ public class ScaleImage { } } - public static Map<String, Object> scaleImageManageInAllSize(Map<String, ? extends Object> context, String filenameToUse, String viewType, String viewNumber , String imageType) + public static Map<String, Object> scaleImageManageInAllSize(Map<String, ? extends Object> context, String filenameToUse, String viewType, String viewNumber, String imageType) throws IllegalArgumentException, ImagingOpException, IOException, JDOMException { /* VARIABLES */ diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java index e4a5edd..e8cebee 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java @@ -157,8 +157,8 @@ public class FrameImage { String filenameToUse = (String) contentResult.get("contentId") + ".jpg"; String filenameTouseThumb = (String) contentResult.get("contentId") + nameOfThumb + ".jpg"; - Image newImg1 = bufImg1.getScaledInstance(width, height , Image.SCALE_SMOOTH); - Image newImg2 = bufImg2.getScaledInstance(width , height , Image.SCALE_SMOOTH); + Image newImg1 = bufImg1.getScaledInstance(width, height, Image.SCALE_SMOOTH); + Image newImg2 = bufImg2.getScaledInstance(width, height, Image.SCALE_SMOOTH); BufferedImage bufNewImg = combineBufferedImage(newImg1, newImg2, bufImgType); String mimeType = imageName.substring(imageName.lastIndexOf('.') + 1); ImageIO.write(bufNewImg, mimeType, new File(imageServerPath + "/" + productId + "/" + filenameToUse)); @@ -257,14 +257,14 @@ public class FrameImage { g.drawImage(bufferedImage, 0, 0, null); g.dispose(); - return( bufferedImage ); + return (bufferedImage); } public static String uploadFrame(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); Delegator delegator = dispatcher.getDelegator(); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); Map<String, ? extends Object> context = UtilGenerics.cast(request.getParameterMap()); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context); @@ -411,8 +411,8 @@ public class FrameImage { int width = Integer.parseInt(request.getParameter("imageWidth")); int height= Integer.parseInt(request.getParameter("imageHeight")); - Image newImg1 = bufImg1.getScaledInstance(width, height , Image.SCALE_SMOOTH); - Image newImg2 = bufImg2.getScaledInstance(width , height , Image.SCALE_SMOOTH); + Image newImg1 = bufImg1.getScaledInstance(width, height, Image.SCALE_SMOOTH); + Image newImg2 = bufImg2.getScaledInstance(width, height, Image.SCALE_SMOOTH); BufferedImage bufNewImg = combineBufferedImage(newImg1, newImg2, bufImgType); String mimeType = imageName.substring(imageName.lastIndexOf('.') + 1); ImageIO.write(bufNewImg, mimeType, new File(imageServerPath + "/preview/" + "/previewImage.jpg")); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java index 95798d0..c1762ae 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java @@ -517,7 +517,7 @@ public class ImageManagementServices { String contentIdThumb = (String) contentThumbResult.get("contentId"); result.put("contentIdThumb", contentIdThumb); - String filenameToUseThumb = imageName.substring(0 , imageName.indexOf('.')) + nameOfThumb; + String filenameToUseThumb = imageName.substring(0, imageName.indexOf('.')) + nameOfThumb; String fileContentType = (String) context.get("_uploadedFile_contentType"); if ("image/pjpeg".equals(fileContentType)) { fileContentType = "image/jpeg"; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java index ead991c..5d6ff8f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java @@ -110,7 +110,7 @@ public class PriceServices { } catch (GenericEntityException e) { Debug.logError(e, "Error getting product store info from the database while calculating price" + e.toString(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "ProductPriceCannotRetrieveProductStore", UtilMisc.toMap("errorString", e.toString()) , locale)); + "ProductPriceCannotRetrieveProductStore", UtilMisc.toMap("errorString", e.toString()), locale)); } if (UtilValidate.isEmpty(productStoreGroupId)) { if (productStore != null) { @@ -129,7 +129,7 @@ public class PriceServices { } catch (GenericEntityException e) { Debug.logError(e, "Error getting product store info from the database while calculating price" + e.toString(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "ProductPriceCannotRetrieveProductStore", UtilMisc.toMap("errorString", e.toString()) , locale)); + "ProductPriceCannotRetrieveProductStore", UtilMisc.toMap("errorString", e.toString()), locale)); } } @@ -168,7 +168,7 @@ public class PriceServices { } catch (GenericEntityException e) { Debug.logError(e, "Error getting virtual product id from the database while calculating price" + e.toString(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "ProductPriceCannotRetrieveVirtualProductId", UtilMisc.toMap("errorString", e.toString()) , locale)); + "ProductPriceCannotRetrieveVirtualProductId", UtilMisc.toMap("errorString", e.toString()), locale)); } } @@ -245,7 +245,7 @@ public class PriceServices { } catch (GenericEntityException e) { Debug.logError(e, "Error getting agreement info from the database while calculating price" + e.toString(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "ProductPriceCannotRetrieveAgreementInfo", UtilMisc.toMap("errorString", e.toString()) , locale)); + "ProductPriceCannotRetrieveAgreementInfo", UtilMisc.toMap("errorString", e.toString()), locale)); } } @@ -358,7 +358,7 @@ public class PriceServices { try { Map<String, Object> outMap = dispatcher.runSync(customMethod.getString("customMethodName"), inMap); if (ServiceUtil.isSuccess(outMap)) { - BigDecimal calculatedDefaultPrice = (BigDecimal)outMap.get("price"); + BigDecimal calculatedDefaultPrice = (BigDecimal) outMap.get("price"); orderItemPriceInfos = UtilGenerics.cast(outMap.get("orderItemPriceInfos")); if (UtilValidate.isNotEmpty(calculatedDefaultPrice)) { defaultPrice = calculatedDefaultPrice; @@ -508,7 +508,7 @@ public class PriceServices { } catch (GenericEntityException e) { Debug.logError(e, "Error getting rules from the database while calculating price", MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, - "ProductPriceCannotRetrievePriceRules", UtilMisc.toMap("errorString", e.toString()) , locale)); + "ProductPriceCannotRetrievePriceRules", UtilMisc.toMap("errorString", e.toString()), locale)); } } @@ -1186,7 +1186,7 @@ public class PriceServices { private static int checkConditionPartyHierarchy(Delegator delegator, Timestamp nowTimestamp, String groupPartyId, String partyId) throws GenericEntityException { List<GenericValue> partyRelationshipList = EntityQuery.use(delegator).from("PartyRelationship").where("partyIdTo", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").cache(true).filterByDate(nowTimestamp).queryList(); for (GenericValue genericValue : partyRelationshipList) { - String partyIdFrom = (String)genericValue.get("partyIdFrom"); + String partyIdFrom = (String) genericValue.get("partyIdFrom"); if (partyIdFrom.equals(groupPartyId)) { return 0; } @@ -1242,10 +1242,10 @@ public class PriceServices { priceFound = EntityUtil.getFirst(agreementPrices); try { Map<String, Object> priceConvertMap = UtilMisc.toMap("uomId", priceFound.getString("currencyUomId"), "uomIdTo", currencyUomId, - "originalValue", priceFound.getBigDecimal("price"), "defaultDecimalScale" , 2L, "defaultRoundingMode" , "HalfUp"); + "originalValue", priceFound.getBigDecimal("price"), "defaultDecimalScale", 2L, "defaultRoundingMode", "HalfUp"); Map<String, Object> priceResults = dispatcher.runSync("convertUom", priceConvertMap); if (ServiceUtil.isError(priceResults) || (priceResults.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert " + priceFound + " for product " + productId , MODULE); + Debug.logWarning("Unable to convert " + priceFound + " for product " + productId, MODULE); } else { price = (BigDecimal) priceResults.get("convertedValue"); validPriceFound = true; @@ -1300,7 +1300,7 @@ public class PriceServices { if (productSuppliers != null) { for (GenericValue productSupplier: productSuppliers) { if (!validPriceFound) { - price = ((BigDecimal)productSupplier.get("lastPrice")); + price = ((BigDecimal) productSupplier.get("lastPrice")); validPriceFound = true; } // add a orderItemPriceInfo element too, without orderId or orderItemId diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java index 2989f25..c67dcaf 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/KeywordIndex.java @@ -70,8 +70,8 @@ public class KeywordIndex { return; } Timestamp salesDiscontinuationDate = product.getTimestamp("salesDiscontinuationDate"); - if (salesDiscontinuationDate != null && salesDiscontinuationDate.before(nowTimestamp) && - "true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales", delegator))) { + if (salesDiscontinuationDate != null && salesDiscontinuationDate.before(nowTimestamp) + && "true".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.ignore.discontinued.sales", delegator))) { return; } } @@ -117,9 +117,9 @@ public class KeywordIndex { } // ProductFeatureAppl - if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.description", "0", delegator)) || - !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0", delegator)) || - !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0", delegator))) { + if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.description", "0", delegator)) + || !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.abbrev", "0", delegator)) + || !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductFeatureAndAppl.idCode", "0", delegator))) { // get strings from attributes and features List<GenericValue> productFeatureAndAppls = EntityQuery.use(delegator).from("ProductFeatureAndAppl").where("productId", productId).queryList(); for (GenericValue productFeatureAndAppl: productFeatureAndAppls) { @@ -130,8 +130,8 @@ public class KeywordIndex { } // ProductAttribute - if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0", delegator)) || - !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0", delegator))) { + if (!"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrName", "0", delegator)) + || !"0".equals(EntityUtilProperties.getPropertyValue("prodsearch", "index.weight.ProductAttribute.attrValue", "0", delegator))) { List<GenericValue> productAttributes = EntityQuery.use(delegator).from("ProductAttribute").where("productId", productId).queryList(); for (GenericValue productAttribute: productAttributes) { addWeightedKeywordSourceString(productAttribute, "attrName", strings); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java index 3a73228..bce6195 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearch.java @@ -233,7 +233,7 @@ public class ProductSearch { } long endMillis = System.currentTimeMillis(); - double totalSeconds = ((double)endMillis - (double)startMillis)/1000.0; + double totalSeconds = ((double) endMillis - (double) startMillis) / 1000.0; // store info about results in the database, attached to the user's visitId, if specified this.saveSearchResultInfo((long) productIds.size(), totalSeconds); @@ -356,12 +356,12 @@ public class ProductSearch { } public void finishCategoryAndFeatureConstraints() { - if (includeCategoryIds.size() == 0 && excludeCategoryIds.size() == 0 && alwaysIncludeCategoryIds.size() == 0 && - includeCategoryIdOrSetAndList.size() == 0 && alwaysIncludeCategoryIdOrSetAndList.size() == 0 && - includeFeatureIds.size() == 0 && excludeFeatureIds.size() == 0 && alwaysIncludeFeatureIds.size() == 0 && - includeFeatureIdOrSetAndList.size() == 0 && alwaysIncludeFeatureIdOrSetAndList.size() == 0 && - includeFeatureCategoryIds.size() == 0 && excludeFeatureCategoryIds.size() == 0 && alwaysIncludeFeatureCategoryIds.size() == 0 && - includeFeatureGroupIds.size() == 0 && excludeFeatureGroupIds.size() == 0 && alwaysIncludeFeatureGroupIds.size() == 0) { + if (includeCategoryIds.size() == 0 && excludeCategoryIds.size() == 0 && alwaysIncludeCategoryIds.size() == 0 + && includeCategoryIdOrSetAndList.size() == 0 && alwaysIncludeCategoryIdOrSetAndList.size() == 0 + && includeFeatureIds.size() == 0 && excludeFeatureIds.size() == 0 && alwaysIncludeFeatureIds.size() == 0 + && includeFeatureIdOrSetAndList.size() == 0 && alwaysIncludeFeatureIdOrSetAndList.size() == 0 + && includeFeatureCategoryIds.size() == 0 && excludeFeatureCategoryIds.size() == 0 && alwaysIncludeFeatureCategoryIds.size() == 0 + && includeFeatureGroupIds.size() == 0 && excludeFeatureGroupIds.size() == 0 && alwaysIncludeFeatureGroupIds.size() == 0) { return; } @@ -2164,9 +2164,8 @@ public class ProductSearch { @Override public void addConstraint(ProductSearchContext productSearchContext) { - if (UtilValidate.isNotEmpty(goodIdentificationTypeId) || - UtilValidate.isNotEmpty(goodIdentificationValue) || - UtilValidate.isNotEmpty(include)) { + if (UtilValidate.isNotEmpty(goodIdentificationTypeId) + || UtilValidate.isNotEmpty(goodIdentificationValue) || UtilValidate.isNotEmpty(include)) { // make index based values and increment String entityAlias = "GI" + productSearchContext.index; @@ -2201,9 +2200,8 @@ public class ProductSearch { @Override public String prettyPrintConstraint(Delegator delegator, boolean detailed, Locale locale) { - if (UtilValidate.isEmpty(goodIdentificationTypeId) && - UtilValidate.isEmpty(goodIdentificationValue) && - UtilValidate.isEmpty(include)) { + if (UtilValidate.isEmpty(goodIdentificationTypeId) + && UtilValidate.isEmpty(goodIdentificationValue) && UtilValidate.isEmpty(include)) { return null; } @@ -2277,7 +2275,7 @@ public class ProductSearch { @Override public void addConstraint(ProductSearchContext productSearchContext) { productSearchContext.dynamicViewEntity.addAlias("PROD", productFieldName, null, null, null, null, null); - productSearchContext.entityConditionList.add(EntityCondition.makeCondition(productFieldName , EntityOperator.LIKE, keyword + "%")); + productSearchContext.entityConditionList.add(EntityCondition.makeCondition(productFieldName, EntityOperator.LIKE, keyword + "%")); productSearchContext.productSearchConstraintList.add(productSearchContext.getDelegator().makeValue("ProductSearchConstraint", UtilMisc.toMap("constraintName", constraintName, "infoString", this.keyword))); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java index 8942882..c13130c 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java @@ -443,7 +443,7 @@ public class ProductSearchSession { } else if ("KOTT_AURL".equals(targetTypeEnumId)) { // do nothing, is absolute URL } else { - Debug.logError("The targetTypeEnumId [] is not recognized, not doing keyword override", MODULE); + Debug.logError("The targetTypeEnumId[] is not recognized, not doing keyword override", MODULE); // might as well see if there are any others... continue; } @@ -808,8 +808,8 @@ public class ProductSearchSession { constraintsChanged = true; } - if (UtilValidate.isNotEmpty(parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE")) || - UtilValidate.isNotEmpty(parameters.get("SEARCH_GOOD_IDENTIFICATION_VALUE"))) { + if (UtilValidate.isNotEmpty(parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE")) + || UtilValidate.isNotEmpty(parameters.get("SEARCH_GOOD_IDENTIFICATION_VALUE"))) { String include = (String) parameters.get("SEARCH_GOOD_IDENTIFICATION_INCL"); if (UtilValidate.isEmpty(include)) { include = "Y"; @@ -819,7 +819,7 @@ public class ProductSearchSession { inc = Boolean.FALSE; } - searchAddConstraint(new ProductSearch.GoodIdentificationConstraint((String)parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE"), + searchAddConstraint(new ProductSearch.GoodIdentificationConstraint((String) parameters.get("SEARCH_GOOD_IDENTIFICATION_TYPE"), (String) parameters.get("SEARCH_GOOD_IDENTIFICATION_VALUE"), inc), session); constraintsChanged = true; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java index 61b9382..80df49f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java @@ -1091,7 +1091,7 @@ public class ProductServices { /* now store the image versions created by ScaleImage.scaleImageInAllSize */ /* have to shrink length of productContentTypeId, as otherwise value is too long for database field */ Map<String, String> imageUrlMap = UtilGenerics.cast(resultResize.get("imageUrlMap")); - for ( String sizeType : ScaleImage.sizeTypeList ) { + for (String sizeType : ScaleImage.sizeTypeList) { imageUrl = imageUrlMap.get(sizeType); if ( UtilValidate.isNotEmpty(imageUrl)) { try { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java index fa313d8..917231c 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java @@ -103,9 +103,9 @@ public final class ProductWorker { // exclusion for (GenericValue productGeo: excludeGeos) { List<GenericValue> excludeGeoGroup = GeoWorker.expandGeoGroup(productGeo.getString("geoId"), delegator); - if (GeoWorker.containsGeo(excludeGeoGroup, postalAddress.getString("countryGeoId"), delegator) || - GeoWorker.containsGeo(excludeGeoGroup, postalAddress.getString("stateProvinceGeoId"), delegator) || - GeoWorker.containsGeo(excludeGeoGroup, postalAddress.getString("postalCodeGeoId"), delegator)) { + if (GeoWorker.containsGeo(excludeGeoGroup, postalAddress.getString("countryGeoId"), delegator) + || GeoWorker.containsGeo(excludeGeoGroup, postalAddress.getString("stateProvinceGeoId"), delegator) + || GeoWorker.containsGeo(excludeGeoGroup, postalAddress.getString("postalCodeGeoId"), delegator)) { return false; } } @@ -116,9 +116,9 @@ public final class ProductWorker { // inclusion for (GenericValue productGeo: includeGeos) { List<GenericValue> includeGeoGroup = GeoWorker.expandGeoGroup(productGeo.getString("geoId"), delegator); - if (GeoWorker.containsGeo(includeGeoGroup, postalAddress.getString("countryGeoId"), delegator) || - GeoWorker.containsGeo(includeGeoGroup, postalAddress.getString("stateProvinceGeoId"), delegator) || - GeoWorker.containsGeo(includeGeoGroup, postalAddress.getString("postalCodeGeoId"), delegator)) { + if (GeoWorker.containsGeo(includeGeoGroup, postalAddress.getString("countryGeoId"), delegator) + || GeoWorker.containsGeo(includeGeoGroup, postalAddress.getString("stateProvinceGeoId"), delegator) + || GeoWorker.containsGeo(includeGeoGroup, postalAddress.getString("postalCodeGeoId"), delegator)) { return true; } } @@ -423,7 +423,7 @@ public final class ProductWorker { if (product == null) { return null; } - List <List<Map<String, String>>> featureTypeFeatures = new LinkedList<>(); + List<List<Map<String, String>>> featureTypeFeatures = new LinkedList<>(); try { Delegator delegator = product.getDelegator(); List<GenericValue> featuresSorted = EntityQuery.use(delegator) @@ -893,7 +893,7 @@ public final class ProductWorker { productsFound = EntityQuery.use(delegator).from("GoodIdentificationAndProduct").where(conditions).orderBy("productId").cache(true).queryList(); } - if (! searchProductFirst) { + if (!searchProductFirst) { product = EntityQuery.use(delegator).from("Product").where("productId", idToFind).cache().queryOne(); } @@ -941,7 +941,7 @@ public final class ProductWorker { for (GenericValue product : productsByIds) { GenericValue productToAdd = product; //retreive product GV if the actual genericValue came from viewEntity - if (! "Product".equals(product.getEntityName())) { + if (!"Product".equals(product.getEntityName())) { productToAdd = EntityQuery.use(delegator).from("Product").where("productId", product.get("productId")).cache().queryOne(); } @@ -1179,7 +1179,7 @@ nextProd: if (isAlternativePacking) { List<GenericValue> productAssocs = null; try { - productAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").filterByDate().queryList(); + productAssocs = EntityQuery.use(delegator).from("ProductAssoc").where("productId", productId, "productAssocTypeId", "ALTERNATIVE_PACKAGE").filterByDate().queryList(); } catch (GenericEntityException e) { Debug.logError(e, MODULE); } @@ -1240,7 +1240,7 @@ nextProd: if ( UtilValidate.isNotEmpty(isMarketingPackage) && isMarketingPackage) { Map<String, Object> resultOutput = new HashMap<>(); - resultOutput = dispatcher.runSync("getMktgPackagesAvailable", UtilMisc.toMap("productId" , productId)); + resultOutput = dispatcher.runSync("getMktgPackagesAvailable", UtilMisc.toMap("productId", productId)); Debug.logWarning("Error getting available marketing package.", MODULE); BigDecimal availableInventory = (BigDecimal) resultOutput.get("availableToPromiseTotal"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java index 7accbbb..6551e13 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java @@ -53,7 +53,7 @@ public class ProductStoreEvents { if (productStoreGroup != null) { children = EntityQuery.use(delegator).from("ProductStoreGroupRollupAndChild").where("parentGroupId", parentGroupId).cache(true).filterByDate().queryList(); if (UtilValidate.isNotEmpty(children)) { - for (GenericValue child : children ) { + for (GenericValue child : children) { String productStoreGroupId = child.getString("productStoreGroupId"); Map<Object, Object> josonMap = new HashMap<>(); List<GenericValue> childList = null; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java index 2f9de2c..14abe69 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java @@ -378,9 +378,9 @@ public final class ProductStoreWorker { } if (UtilValidate.isNotEmpty(includeGeoId)) { List<GenericValue> includeGeoGroup = GeoWorker.expandGeoGroup(includeGeoId, delegator); - if (!GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("countryGeoId"), delegator) && - !GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("stateProvinceGeoId"), delegator) && - !GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("postalCodeGeoId"), delegator)) { + if (!GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("countryGeoId"), delegator) + && !GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("stateProvinceGeoId"), delegator) + && !GeoWorker.containsGeo(includeGeoGroup, shippingAddress.getString("postalCodeGeoId"), delegator)) { // not in required included geos returnShippingMethods.remove(method); continue; @@ -388,9 +388,9 @@ public final class ProductStoreWorker { } if (UtilValidate.isNotEmpty(excludeGeoId)) { List<GenericValue> excludeGeoGroup = GeoWorker.expandGeoGroup(excludeGeoId, delegator); - if (GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("countryGeoId"), delegator) || - GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("stateProvinceGeoId"), delegator) || - GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("postalCodeGeoId"), delegator)) { + if (GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("countryGeoId"), delegator) + || GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("stateProvinceGeoId"), delegator) + || GeoWorker.containsGeo(excludeGeoGroup, shippingAddress.getString("postalCodeGeoId"), delegator)) { // in excluded geos returnShippingMethods.remove(method); continue; diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java index 1089d78..b63bfa7 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingServices.java @@ -320,7 +320,7 @@ public class PackingServices { public static BigDecimal setSessionPackageWeights(PackingSession session, Map<String, String> packageWeights) { BigDecimal shippableWeight = BigDecimal.ZERO; - if (! UtilValidate.isEmpty(packageWeights)) { + if (!UtilValidate.isEmpty(packageWeights)) { for (Map.Entry<String, String> entry: packageWeights.entrySet()) { String packageSeqId = entry.getKey(); String packageWeightStr = entry.getValue(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java index 8e881b5..7b67e4a 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java @@ -237,12 +237,12 @@ public class PackingSession implements java.io.Serializable { public PackingSessionLine findLine(String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String inventoryItemId, int packageSeq) { for (PackingSessionLine line: this.getLines()) { - if (orderId.equals(line.getOrderId()) && - orderItemSeqId.equals(line.getOrderItemSeqId()) && - shipGroupSeqId.equals(line.getShipGroupSeqId()) && - productId.equals(line.getProductId()) && - inventoryItemId.equals(line.getInventoryItemId()) && - packageSeq == line.getPackageSeq()) { + if (orderId.equals(line.getOrderId()) + && orderItemSeqId.equals(line.getOrderItemSeqId()) + && shipGroupSeqId.equals(line.getShipGroupSeqId()) + && productId.equals(line.getProductId()) + && inventoryItemId.equals(line.getInventoryItemId()) + && packageSeq == line.getPackageSeq()) { return line; } } @@ -850,7 +850,7 @@ public class PackingSession implements java.io.Serializable { BigDecimal shipmentWeight = getTotalWeight(); if (shipmentWeight.compareTo(BigDecimal.ZERO) <= 0) return; List<GenericValue> shipmentRouteSegments = getDelegator().findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", this.getShipmentId()), null, false); - if (! UtilValidate.isEmpty(shipmentRouteSegments)) { + if (!UtilValidate.isEmpty(shipmentRouteSegments)) { for (GenericValue shipmentRouteSegment: shipmentRouteSegments) { shipmentRouteSegment.set("billingWeight", shipmentWeight); shipmentRouteSegment.set("billingWeightUomId", getWeightUomId()); @@ -932,7 +932,7 @@ public class PackingSession implements java.io.Serializable { BigDecimal total = BigDecimal.ZERO; for (int i = 0; i < packageSeq; i++) { BigDecimal packageWeight = getPackageWeight(i); - if (! UtilValidate.isEmpty(packageWeight)) { + if (!UtilValidate.isEmpty(packageWeight)) { total = total.add(packageWeight); } } @@ -1020,7 +1020,7 @@ public class PackingSession implements java.io.Serializable { public List<Integer> getPackageSeqIds() { Set<Integer> packageSeqIds = new TreeSet<>(); - if (! UtilValidate.isEmpty(this.getLines())) { + if (!UtilValidate.isEmpty(this.getLines())) { for (PackingSessionLine line: this.getLines()) { packageSeqIds.add(line.getPackageSeq()); } @@ -1131,9 +1131,9 @@ public class PackingSession implements java.io.Serializable { } else if (d.getOrderItem().getString("productId") != null || orderItem.getString("productId") != null) { sameOrderItemProduct = false; } - return (d.productId.equals(productId) && - d.getOrderItem().getString("orderItemSeqId").equals(orderItem.getString("orderItemSeqId")) && - sameOrderItemProduct); + return (d.productId.equals(productId) + && d.getOrderItem().getString("orderItemSeqId").equals(orderItem.getString("orderItemSeqId")) + && sameOrderItemProduct); } else { return false; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java index 7950379..ac94746 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentEvents.java @@ -92,7 +92,7 @@ public class ShipmentEvents { public static String checkForceShipmentReceived(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); String shipmentId = request.getParameter("shipmentIdReceived"); String forceShipmentReceived = request.getParameter("forceShipmentReceived"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java index 14540bf..fca0810 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java @@ -303,10 +303,10 @@ public class ShipmentServices { } List<GenericValue> toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator); // Make sure we have a valid GEOID. - if (UtilValidate.isEmpty(toGeoList) || - GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) || - GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) || - GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) { + if (UtilValidate.isEmpty(toGeoList) + || GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) + || GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) + || GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) { GenericValue wv = thisEstimate.getRelatedOne("WeightQuantityBreak", false); GenericValue qv = thisEstimate.getRelatedOne("QuantityQuantityBreak", false); GenericValue pv = thisEstimate.getRelatedOne("PriceQuantityBreak", false); @@ -823,7 +823,7 @@ public class ShipmentServices { // If there are shipment receipts, the shipment must have been shipped, so set the shipment status to PURCH_SHIP_SHIPPED if it's only PURCH_SHIP_CREATED GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); - if ((! UtilValidate.isEmpty(shipment)) && "PURCH_SHIP_CREATED".equals(shipment.getString("statusId"))) { + if ((!UtilValidate.isEmpty(shipment)) && "PURCH_SHIP_CREATED".equals(shipment.getString("statusId"))) { Map<String, Object> updateShipmentMap = dispatcher.runSync("updateShipment", UtilMisc.<String, Object>toMap("shipmentId", shipmentId, "statusId", "PURCH_SHIP_SHIPPED", "userLogin", userLogin)); if (ServiceUtil.isError(updateShipmentMap)) { return updateShipmentMap; diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java index 20a0308..bcd455b 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java @@ -603,7 +603,7 @@ public class DhlServices { // convert results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", billingWeightUomId, "uomIdTo", DHL_WEIGHT_UOM_ID, "originalValue", billingWeight)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert billing weights for shipmentId " + shipmentId , MODULE); + Debug.logWarning("Unable to convert billing weights for shipmentId " + shipmentId, MODULE); // try getting the weight from package instead hasBillingWeight = false; } else { @@ -647,7 +647,7 @@ public class DhlServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results)); } if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR)) || (results.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert weights for shipmentId " + shipmentId , MODULE); + Debug.logWarning("Unable to convert weights for shipmentId " + shipmentId, MODULE); packageWeight = BigDecimal.ONE; } else { packageWeight = (BigDecimal) results.get("convertedValue"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java index 8ffb1fc..b3d87d3 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java @@ -101,7 +101,7 @@ public class FedexServices { // xmlString should contain the auth document at the beginning // all documents require an <?xml version="1.0" encoding="UTF-8" ?> header - if (! xmlString.matches("^(?s)<\\?xml\\s+version=\"1\\.0\"\\s+encoding=\"UTF-8\"\\s*\\?>.*")) { + if (!xmlString.matches("^(?s)<\\?xml\\s+version=\"1\\.0\"\\s+encoding=\"UTF-8\"\\s*\\?>.*")) { throw new FedexConnectException(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentFedexXmlHeaderMalformed", locale)); } @@ -539,10 +539,10 @@ public class FedexServices { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentRouteSegmentOriginPostalAddressNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); - } else if (UtilValidate.isEmpty(originPostalAddress.getString("address1")) || - UtilValidate.isEmpty(originPostalAddress.getString("city")) || - UtilValidate.isEmpty(originPostalAddress.getString("postalCode")) || - UtilValidate.isEmpty(originPostalAddress.getString("countryGeoId"))) { + } else if (UtilValidate.isEmpty(originPostalAddress.getString("address1")) + || UtilValidate.isEmpty(originPostalAddress.getString("city")) + || UtilValidate.isEmpty(originPostalAddress.getString("postalCode")) + || UtilValidate.isEmpty(originPostalAddress.getString("countryGeoId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentRouteSegmentOriginPostalAddressNotComplete", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); @@ -615,10 +615,10 @@ public class FedexServices { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentRouteSegmentDestPostalAddressNotFound", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); - } else if (UtilValidate.isEmpty(destinationPostalAddress.getString("address1")) || - UtilValidate.isEmpty(destinationPostalAddress.getString("city")) || - UtilValidate.isEmpty(destinationPostalAddress.getString("postalCode")) || - UtilValidate.isEmpty(destinationPostalAddress.getString("countryGeoId"))) { + } else if (UtilValidate.isEmpty(destinationPostalAddress.getString("address1")) + || UtilValidate.isEmpty(destinationPostalAddress.getString("city")) + || UtilValidate.isEmpty(destinationPostalAddress.getString("postalCode")) + || UtilValidate.isEmpty(destinationPostalAddress.getString("countryGeoId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "FacilityShipmentRouteSegmentDestPostalAddressIncomplete", UtilMisc.toMap("shipmentId", shipmentId, "shipmentRouteSegmentId", shipmentRouteSegmentId), locale)); @@ -771,7 +771,7 @@ public class FedexServices { if (!billingWeightUomId.equals(weightUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", billingWeightUomId, "uomIdTo", weightUomId, "originalValue", billingWeight)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert billing weights for shipmentId " + shipmentId , MODULE); + Debug.logWarning("Unable to convert billing weights for shipmentId " + shipmentId, MODULE); // Try getting the weight from package instead hasBillingWeight = false; @@ -837,7 +837,7 @@ public class FedexServices { if (!boxDimensionsUomId.equals(dimensionsUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", boxDimensionsUomId, "uomIdTo", dimensionsUomId, "originalValue", dimensionsLength)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert length for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId , MODULE); + Debug.logWarning("Unable to convert length for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId, MODULE); dimensionsLength = null; } else { dimensionsLength = (BigDecimal) results.get("convertedValue"); @@ -849,7 +849,7 @@ public class FedexServices { if (!boxDimensionsUomId.equals(dimensionsUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", boxDimensionsUomId, "uomIdTo", dimensionsUomId, "originalValue", dimensionsWidth)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert width for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId , MODULE); + Debug.logWarning("Unable to convert width for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId, MODULE); dimensionsWidth = null; } else { dimensionsWidth = (BigDecimal) results.get("convertedValue"); @@ -861,7 +861,7 @@ public class FedexServices { if (!boxDimensionsUomId.equals(dimensionsUomId)) { Map<String, Object> results = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", boxDimensionsUomId, "uomIdTo", dimensionsUomId, "originalValue", dimensionsHeight)); if (ServiceUtil.isError(results) || (results.get("convertedValue") == null)) { - Debug.logWarning("Unable to convert height for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId , MODULE); + Debug.logWarning("Unable to convert height for package " + shipmentPackage.getString("shipmentPackageSeqId") + " of shipmentRouteSegment " + shipmentRouteSegmentId + " of shipment " + shipmentId, MODULE); dimensionsHeight = null; } else { dimensionsHeight = (BigDecimal) results.get("convertedValue"); @@ -882,7 +882,7 @@ public class FedexServices { try { packageWeight = EntityUtilProperties.getPropertyAsBigDecimal(shipmentPropertiesFile, "shipment.default.weight.value", BigDecimal.ZERO); } catch (NumberFormatException ne) { - Debug.logWarning("Default shippable weight not configured (shipment.default.weight.value), assuming 1.0" + weightUomId , MODULE); + Debug.logWarning("Default shippable weight not configured (shipment.default.weight.value), assuming 1.0" + weightUomId, MODULE); packageWeight = BigDecimal.ONE; } } @@ -917,10 +917,10 @@ public class FedexServices { shipRequestContext.put("CustomerReference", shipmentId + ":" + shipmentRouteSegmentId + ":" + shipmentPackage.getString("shipmentPackageSeqId")); shipRequestContext.put("DropoffType", dropoffType); shipRequestContext.put("Packaging", packaging); - if (UtilValidate.isNotEmpty(dimensionsUomId) && - dimensionsLength != null && dimensionsLength.setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) > 0 && - dimensionsWidth != null && dimensionsWidth.setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) > 0 && - dimensionsHeight != null && dimensionsHeight.setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) > 0) { + if (UtilValidate.isNotEmpty(dimensionsUomId) + && dimensionsLength != null && dimensionsLength.setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) > 0 + && dimensionsWidth != null && dimensionsWidth.setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) > 0 + && dimensionsHeight != null && dimensionsHeight.setScale(0, RoundingMode.HALF_UP).compareTo(BigDecimal.ZERO) > 0) { shipRequestContext.put("DimensionsUnits", "LEN_in".equals(dimensionsUomId) ? "IN" : "CM"); shipRequestContext.put("DimensionsLength", dimensionsLength.setScale(0, RoundingMode.HALF_UP).toString()); shipRequestContext.put("DimensionsWidth", dimensionsWidth.setScale(0, RoundingMode.HALF_UP).toString()); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java index bf77176..02c681f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java @@ -244,7 +244,7 @@ public class UpsServices { .where(EntityCondition.makeCondition("orderId", EntityOperator.IN, orderIdSet)).queryList(); List<String> paymentMethodTypeIds = EntityUtil.getFieldListFromEntityList(opps, "paymentMethodTypeId", true); - if (paymentMethodTypeIds.size() > 1 || ! paymentMethodTypeIds.contains("EXT_COD")) { + if (paymentMethodTypeIds.size() > 1 || !paymentMethodTypeIds.contains("EXT_COD")) { allowCOD = false; } } @@ -566,7 +566,7 @@ public class UpsServices { // Package insured value BigDecimal insuredValue = shipmentPackage.getBigDecimal("insuredValue"); - if (! UtilValidate.isEmpty(insuredValue)) { + if (!UtilValidate.isEmpty(insuredValue)) { Element insuredValueElement = UtilXml.addChildElement(packageServiceOptionsElement, "InsuredValue", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(insuredValueElement, "MonetaryValue", insuredValue.setScale(2, RoundingMode.HALF_UP).toString(), shipmentConfirmRequestDoc); @@ -2897,7 +2897,7 @@ public class UpsServices { GenericValue carrierShipmentMethod = null; // Filtering out rates of shipping methods which are not configured in ProductStoreShipmentMeth entity. try { - List <GenericValue> productStoreShipmentMethods = EntityQuery.use(delegator).from("ProductStoreShipmentMethView").where("productStoreId", productStoreId).queryList(); + List<GenericValue> productStoreShipmentMethods = EntityQuery.use(delegator).from("ProductStoreShipmentMethView").where("productStoreId", productStoreId).queryList(); for (GenericValue productStoreShipmentMethod :productStoreShipmentMethods) { if ("UPS".equals(productStoreShipmentMethod.get("partyId"))) { Map<String, Object> thisUpsRateCodeMap = new HashMap<>(); diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java index 74dd998..ccff525 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java @@ -79,8 +79,8 @@ public class WorkEffortKeywordIndex { } } //WorkEffortAttribute - if (!"0".equals(EntityUtilProperties.getPropertyValue("workeffort", "index.weight.WorkEffortAttribute.attrName", "1", delegator)) || - !"0".equals(EntityUtilProperties.getPropertyValue("workeffort", "index.weight.WorkEffortAttribute.attrValue", "1", delegator))) { + if (!"0".equals(EntityUtilProperties.getPropertyValue("workeffort", "index.weight.WorkEffortAttribute.attrName", "1", delegator)) + || !"0".equals(EntityUtilProperties.getPropertyValue("workeffort", "index.weight.WorkEffortAttribute.attrValue", "1", delegator))) { List<GenericValue> workEffortAttributes = EntityQuery.use(delegator).from("WorkEffortAttribute").where("workEffortId", workEffortId).queryList(); for (GenericValue workEffortAttribute : workEffortAttributes) { addWeightedKeywordSourceString(workEffortAttribute, "attrName", strings); diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java index 51f85aa..acd752a 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java @@ -192,7 +192,7 @@ public class WorkEffortSearch { try (EntityListIterator eli = this.doQuery(delegator)) { ArrayList<String> workEffortIds = this.makeWorkEffortIdList(eli); long endMillis = System.currentTimeMillis(); - double totalSeconds = ((double)endMillis - (double)startMillis)/1000.0; + double totalSeconds = ((double) endMillis - (double) startMillis) / 1000.0; // store info about results in the database, attached to the user's visitId, if specified this.saveSearchResultInfo((long) workEffortIds.size(), totalSeconds); diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java index 7d24c53..f41bcb1 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java @@ -381,7 +381,7 @@ public class WorkEffortServices { dateBoundaries.add(inDateRange.end()); } for (Map<String, Object>calendarEntry: calendarEntries) { - DateRange calEntryRange = (DateRange)calendarEntry.get("calEntryRange"); + DateRange calEntryRange = (DateRange) calendarEntry.get("calEntryRange"); dateBoundaries.add(calEntryRange.start()); dateBoundaries.add(calEntryRange.end()); } @@ -390,7 +390,7 @@ public class WorkEffortServices { if (prevDateBoundary != null) { DateRange dateRange = new DateRange(prevDateBoundary, dateBoundary); for (Map<String, Object>calendarEntry: calendarEntries) { - DateRange calEntryRange = (DateRange)calendarEntry.get("calEntryRange"); + DateRange calEntryRange = (DateRange) calendarEntry.get("calEntryRange"); if (calEntryRange.intersectsRange(dateRange) && !(calEntryRange.end().equals(dateRange.start()) || calEntryRange.start().equals(dateRange.end()))) { List<Map<String, Object>> calendarEntryByDateRangeList = calendarEntriesByDateRange.get(dateRange); if (calendarEntryByDateRangeList == null) { @@ -822,7 +822,7 @@ public class WorkEffortServices { quantitySummary.put("facilityId", weFacilityId); summaryInByFacility.put(weFacilityId, quantitySummary); } - Double remainingQuantityTot = (Double)quantitySummary.get("estimatedQuantityTotal"); + Double remainingQuantityTot = (Double) quantitySummary.get("estimatedQuantityTotal"); if (remainingQuantityTot == null) { quantitySummary.put("estimatedQuantityTotal", remainingQuantity); } else { @@ -870,7 +870,7 @@ public class WorkEffortServices { quantitySummary.put("facilityId", weFacilityId); summaryOutByFacility.put(weFacilityId, quantitySummary); } - Double remainingQuantityTot = (Double)quantitySummary.get("estimatedQuantityTotal"); + Double remainingQuantityTot = (Double) quantitySummary.get("estimatedQuantityTotal"); if (remainingQuantityTot == null) { quantitySummary.put("estimatedQuantityTotal", neededQuantity); } else { |
Free forum by Nabble | Edit this page |