You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/07/25 08:23:56 UTC

[ofbiz-framework] branch trunk updated: Improved: Updated case indentation to 0 for all switch statements in applications component. Also done formatting changes as per checkstyle best practices. (OFBIZ-11904)

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 df21972  Improved: Updated case indentation to 0 for all switch statements in applications component. Also done formatting changes as per checkstyle best practices. (OFBIZ-11904)
df21972 is described below

commit df21972eed26117dada43f7f50c0029598175f49
Author: Suraj Khurana <su...@apache.org>
AuthorDate: Sat Jul 25 13:53:10 2020 +0530

    Improved: Updated case indentation to 0 for all switch statements in applications component. Also done formatting changes as per checkstyle best practices.
    (OFBIZ-11904)
---
 .../ofbiz/accounting/invoice/InvoiceServices.java  |  15 +-
 .../ofbiz/accounting/invoice/InvoiceWorker.java    |  12 +-
 .../accounting/payment/BillingAccountWorker.java   |   6 +-
 .../ofbiz/accounting/payment/PaymentWorker.java    |   3 +-
 .../thirdparty/gosoftware/PcChargeApi.java         |   4 +-
 .../accounting/thirdparty/gosoftware/RitaApi.java  |   4 +-
 .../thirdparty/paypal/PayPalServices.java          |   7 +-
 .../thirdparty/sagepay/SagePayPaymentServices.java |  20 +-
 .../thirdparty/sagepay/SagePayServices.java        |  78 +--
 .../accounting/thirdparty/sagepay/SagePayUtil.java |  64 +-
 .../thirdparty/securepay/SecurePayServiceTest.java |  19 +-
 .../thirdparty/valuelink/ValueLinkApi.java         |   4 +-
 .../ofbiz/content/ContentManagementServices.java   | 750 +++++++++++----------
 .../ofbiz/content/ContentManagementWorker.java     | 154 +++--
 .../ofbiz/content/cms/ContentJsonEvents.java       |  16 +-
 .../apache/ofbiz/content/data/DataServices.java    |  16 +-
 .../org/apache/ofbiz/content/ftp/FtpServices.java  |  18 +-
 .../apache/ofbiz/content/survey/SurveyWrapper.java |   5 +-
 .../webapp/ftl/CheckPermissionTransform.java       |   5 +-
 .../webapp/ftl/InjectNodeTrailCsvTransform.java    |   5 +-
 .../webapp/ftl/TraverseSubContentTransform.java    |  15 +-
 .../apache/ofbiz/manufacturing/bom/BOMNode.java    |  18 +-
 .../jobshopmgt/ProductionRunServices.java          |   9 +-
 .../ofbiz/manufacturing/mrp/MrpServices.java       |   2 +-
 .../ofbiz/manufacturing/mrp/ProposedOrder.java     |   2 +-
 .../manufacturing/techdata/TechDataServices.java   |   8 +-
 .../ofbiz/order/finaccount/FinAccountHelper.java   |   6 +-
 .../apache/ofbiz/order/order/OrderReadHelper.java  |   4 +-
 .../apache/ofbiz/order/order/OrderServices.java    |  12 +-
 .../order/requirement/RequirementServices.java     |   3 +-
 .../ofbiz/order/shoppingcart/CheckOutEvents.java   |  12 +-
 .../ofbiz/order/shoppingcart/CheckOutHelper.java   |   3 +-
 .../ofbiz/order/shoppingcart/ShoppingCart.java     |   2 +-
 .../order/shoppingcart/ShoppingCartEvents.java     |   5 +-
 .../order/shoppingcart/ShoppingCartHelper.java     |   3 +-
 .../order/shoppingcart/ShoppingCartServices.java   |   6 +-
 .../shoppingcart/product/ProductDisplayWorker.java |   3 +-
 .../shoppingcart/product/ProductPromoWorker.java   | 410 +++++++----
 .../shoppingcart/shipping/ShippingEvents.java      |   3 +-
 .../order/shoppinglist/ShoppingListServices.java   |  33 +-
 .../thirdparty/zipsales/ZipSalesServices.java      | 132 ++--
 .../communication/CommunicationEventServices.java  |   6 +-
 .../ofbiz/party/contact/ContactMechWorker.java     |  24 +-
 .../apache/ofbiz/party/party/PartyServices.java    | 134 ++--
 .../org/apache/ofbiz/party/party/PartyWorker.java  |   7 +-
 .../ofbiz/product/catalog/CatalogWorker.java       |   4 +-
 .../ofbiz/product/category/CategoryServices.java   |   4 +-
 .../imagemanagement/ImageManagementHelper.java     |   8 +-
 .../ofbiz/product/inventory/InventoryWorker.java   |   3 +-
 .../ofbiz/product/product/ProductSearch.java       |   2 +-
 .../ofbiz/product/product/ProductWorker.java       |   6 +-
 .../ofbiz/product/store/ProductStoreWorker.java    |   3 +-
 .../apache/ofbiz/product/test/StockMovesTest.java  |   2 +-
 .../ofbiz/shipment/packing/PackingSession.java     |  58 +-
 .../ofbiz/shipment/packing/PackingSessionLine.java |   2 +-
 .../ofbiz/shipment/shipment/ShipmentServices.java  |   3 +-
 .../ofbiz/shipment/thirdparty/dhl/DhlServices.java |   6 +-
 .../ofbiz/shipment/thirdparty/ups/UpsServices.java |   3 +-
 .../ofbiz/shipment/verify/VerifyPickSession.java   |  52 +-
 .../workeffort/workeffort/WorkEffortServices.java  |   6 +-
 60 files changed, 1139 insertions(+), 1090 deletions(-)

diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
index 2558fb4..3330108 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
@@ -139,8 +139,7 @@ public class InvoiceServices {
             }
             result.remove("invoiceTypeId");  //remove extra parameter
             return result;
-        }
-        catch (GenericServiceException | GenericEntityException e) {
+        } catch (GenericServiceException | GenericEntityException e) {
             Debug.logError (e, "Entity/data problem creating invoice from order items: " + e.toString(), MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE,
                     "AccountingEntityDataProblemCreatingInvoiceFromOrderItems",
@@ -856,8 +855,7 @@ public class InvoiceServices {
             // check for previous order payments
             List<GenericValue> orderPaymentPrefs = EntityQuery.use(delegator).from("OrderPaymentPreference")
                     .where(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId),
-                            EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")
-                    ).queryList();
+                            EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")).queryList();
             List<GenericValue> currentPayments = new LinkedList<>();
             for (GenericValue paymentPref : orderPaymentPrefs) {
                 List<GenericValue> payments = paymentPref.getRelated("Payment", null, null, false);
@@ -1619,8 +1617,7 @@ public class InvoiceServices {
                             invoiceableShipments = EntityQuery.use(delegator).from("Shipment").where(
                                     UtilMisc.toList(
                                             EntityCondition.makeCondition("primaryOrderId", EntityOperator.IN, invoiceablePrimaryOrderIds),
-                                            EntityCondition.makeCondition("shipmentId", EntityOperator.IN, shipmentIds))
-                                    ).queryList();
+                                            EntityCondition.makeCondition("shipmentId", EntityOperator.IN, shipmentIds))).queryList();
                         }
                     } else {
                         List<String> invoiceableShipmentIds = EntityUtil.getFieldListFromEntityList(toBillItems, "shipmentId", true);
@@ -3574,8 +3571,7 @@ public class InvoiceServices {
                             "currencyUomId", rec.get("currencyUomId"),
                             "description", rec.get("description"),
                             "referenceNumber", rec.get("referenceNumber") + "   Imported: orginal InvoiceId: " + currentInvoiceId,
-                            "userLogin", userLogin
-                            );
+                            "userLogin", userLogin);
 
                     // replace values if required
                     if (UtilValidate.isNotEmpty(rec.get("partyIdFromTrans"))) {
@@ -3648,8 +3644,7 @@ public class InvoiceServices {
                             "description", rec.get("itemDescription"),
                             "amount", rec.get("amount"),
                             "quantity", rec.get("quantity"),
-                            "userLogin", userLogin
-                            );
+                            "userLogin", userLogin);
 
                     if (UtilValidate.isNotEmpty(rec.get("productIdTrans"))) {
                         invoiceItem.put("productId", rec.get("productIdTrans"));
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 3a5b250..22ab5f8 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
@@ -217,8 +217,7 @@ public final class InvoiceWorker {
             invoiceItems = invoice.getRelated("InvoiceItem", null, null, false);
             invoiceItems = EntityUtil.filterByAnd(
                     invoiceItems, UtilMisc.toList(
-                            EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.NOT_IN, getTaxableInvoiceItemTypeIds(invoice.getDelegator()))
-                    ));
+                            EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.NOT_IN, getTaxableInvoiceItemTypeIds(invoice.getDelegator()))));
         } catch (GenericEntityException e) {
             Debug.logError(e, "Trouble getting InvoiceItem list", MODULE);
         }
@@ -737,8 +736,7 @@ public final class InvoiceWorker {
             Delegator delegator = invoice.getDelegator();
             invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem")
                     .where(EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")),
-                            EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator))
-                    ).queryList();
+                            EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator))).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Trouble getting InvoiceItem list", MODULE);
             return null;
@@ -776,8 +774,7 @@ public final class InvoiceWorker {
                     .where(EntityCondition.makeCondition("invoiceId", invoice.getString("invoiceId")),
                             EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)),
                             EntityCondition.makeCondition("taxAuthPartyId", taxAuthPartyId),
-                            EntityCondition.makeCondition("taxAuthGeoId", taxAuthGeoId)
-                    ).queryList();
+                            EntityCondition.makeCondition("taxAuthGeoId", taxAuthGeoId)).queryList();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Trouble getting InvoiceItem list", MODULE);
             return null;
@@ -796,8 +793,7 @@ public final class InvoiceWorker {
              invoiceTaxItems = EntityQuery.use(delegator).from("InvoiceItem")
                      .where(EntityCondition.makeCondition("invoiceId", invoice.get("invoiceId")),
                              EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, getTaxableInvoiceItemTypeIds(delegator)),
-                             EntityCondition.makeCondition("taxAuthPartyId", null)
-                     ).queryList();
+                             EntityCondition.makeCondition("taxAuthPartyId", null)).queryList();
          } catch (GenericEntityException e) {
              Debug.logError(e, "Trouble getting InvoiceItem list", MODULE);
              return null;
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
index 4ca1175..1dd5d61 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
@@ -71,8 +71,7 @@ public final class BillingAccountWorker {
 
         List<GenericValue> billingAccountRoleList = EntityQuery.use(delegator).from("BillingAccountRole")
                 .where(EntityCondition.makeCondition("partyId", EntityOperator.IN, relatedPartyIdList),
-                        EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "BILL_TO_CUSTOMER")
-                ).filterByDate().queryList();
+                        EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "BILL_TO_CUSTOMER")).filterByDate().queryList();
 
         if (billingAccountRoleList.size() > 0) {
             BigDecimal totalAvailable = BigDecimal.ZERO;
@@ -110,8 +109,7 @@ public final class BillingAccountWorker {
                 .where(EntityCondition.makeCondition("billingAccountId", EntityOperator.EQUALS, billingAccountId),
                         EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
                         EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
-                        EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")
-                ).queryList();
+                        EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED")).queryList();
     }
 
     /**
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 9d41246..81a7fe9 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
@@ -309,8 +309,7 @@ public final class PaymentWorker {
         try {
             List<EntityExpr> cond = UtilMisc.toList(
                     EntityCondition.makeCondition("paymentId", EntityOperator.EQUALS, payment.getString("paymentId")),
-                    EntityCondition.makeCondition("toPaymentId", EntityOperator.EQUALS, payment.getString("paymentId"))
-                   );
+                    EntityCondition.makeCondition("toPaymentId", EntityOperator.EQUALS, payment.getString("paymentId")));
             EntityCondition partyCond = EntityCondition.makeCondition(cond, EntityOperator.OR);
             paymentApplications = payment.getDelegator().findList("PaymentApplication", partyCond, null, UtilMisc.toList("invoiceId", "billingAccountId"), null, false);
             if (UtilValidate.isNotEmpty(paymentApplications)) {
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java
index e615ab5..32e5a13 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java
@@ -77,8 +77,8 @@ public class PcChargeApi {
     public static final String CARD_ID_CODE = "CARD_ID_CODE";
     public static final String CVV2_CODE = "CVV2_CODE";
 
-    private static final String[] validOut = { RESULT, TRANS_DATE, AVS_CODE, CVV2_CODE, CARD_ID_CODE, TICKET };
-    private static final String[] validIn = { PROCESSOR_ID, MERCH_NUM, ACCT_NUM, EXP_DATE, TRANS_AMOUNT, TRACK_DATA,
+    private static final String[] validOut = {RESULT, TRANS_DATE, AVS_CODE, CVV2_CODE, CARD_ID_CODE, TICKET };
+    private static final String[] validIn = {PROCESSOR_ID, MERCH_NUM, ACCT_NUM, EXP_DATE, TRANS_AMOUNT, TRACK_DATA,
             CUSTOMER_CODE, TAX_AMOUNT, PRINT_RECEIPTS_FLAG, PERIODIC_PAYMENT_FLAG, OFFLINE_FLAG, VOID_FLAG, ZIP_CODE,
             STREET, TICKET_NUM, CARDHOLDER, TRANS_STORE, TOTAL_AUTH, MULTI_FLAG, PRESENT_FLAG, CVV2 };
 
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java
index 880e801..9f953e6 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java
@@ -76,11 +76,11 @@ public class RitaApi {
     public static final String ORIG_TRANS_AMOUNT = "ORIG_TRANS_AMOUNT";
 
     // IN/OUT validation array
-    private static final String[] validOut = { TERMINATION_STATUS, INTRN_SEQ_NUM, RESULT, RESULT_CODE, RESPONSE_TEXT,
+    private static final String[] validOut = {TERMINATION_STATUS, INTRN_SEQ_NUM, RESULT, RESULT_CODE, RESPONSE_TEXT,
             AUTH_CODE, AVS_CODE, CVV2_CODE, REFERENCE, TRANS_DATE, TRANS_TIME,
             ORIG_TRANS_AMOUNT };
 
-    private static final String[] validIn = { FUNCTION_TYPE, PAYMENT_TYPE, USER_ID, USER_PW, COMMAND, CLIENT_ID,
+    private static final String[] validIn = {FUNCTION_TYPE, PAYMENT_TYPE, USER_ID, USER_PW, COMMAND, CLIENT_ID,
             ACCT_NUM, EXP_MONTH, EXP_YEAR, TRANS_AMOUNT, CARDHOLDER, TRACK_DATA,
             INVOICE, PRESENT_FLAG, CUSTOMER_STREET, CUSTOMER_ZIP, CVV2, TAX_AMOUNT,
             PURCHASE_ID, FORCE_FLAG, ORIG_TRANS_AMOUNT, ORIG_SEQ_NUM };
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 465f6d8..31759a1 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
@@ -447,9 +447,7 @@ public class PayPalServices {
         if (!newParty) {
             EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition(UtilMisc.toMap("partyId", partyId, "contactMechTypeId", "EMAIL_ADDRESS")),
-                    EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityComparisonOperator.EQUALS, EntityFunction.UPPER(emailAddress))
-
-           ));
+                    EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityComparisonOperator.EQUALS, EntityFunction.UPPER(emailAddress))));
             try {
                 GenericValue matchingEmail = EntityQuery.use(delegator).from("PartyAndContactMech").where(cond).orderBy("fromDate").filterByDate().queryFirst();
                 if (matchingEmail != null) {
@@ -534,8 +532,7 @@ public class PayPalServices {
             EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition(postalMap),
                     EntityCondition.makeCondition(UtilMisc.toMap("attnName", null, "directions", null, "postalCodeExt", null, "postalCodeGeoId", null)),
-                    EntityCondition.makeCondition("partyId", partyId)
-           ));
+                    EntityCondition.makeCondition("partyId", partyId)));
             try {
                 GenericValue postalMatch = EntityQuery.use(delegator).from("PartyAndPostalAddress")
                         .where(cond).orderBy("fromDate").filterByDate().queryFirst();
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
index f503664..56d9ebb 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java
@@ -187,9 +187,7 @@ public class SagePayPaymentServices {
                             "amount", billingInfo.get("amount"),
                             "currency", billingInfo.get("currency"),
                             "billingAddress", billingInfo.get("billingAddress"),
-                            "billingPostCode", billingInfo.get("billingPostCode")
-                        )
-                    );
+                            "billingPostCode", billingInfo.get("billingPostCode")));
 
             Debug.logInfo("SagePay - SagePayPaymentAuthentication result : " + paymentResult, MODULE);
 
@@ -267,9 +265,7 @@ public class SagePayPaymentServices {
                             "vpsTxId", vpsTxId,
                             "securityKey", securityKey,
                             "txAuthNo", txAuthCode,
-                            "amount", amount.toString()
-                        )
-                    );
+                            "amount", amount.toString()));
             Debug.logInfo("SagePay - SagePayPaymentAuthorisation result : " + paymentResult, MODULE);
             String status = (String) paymentResult.get("status");
             String statusDetail = (String) paymentResult.get("statusDetail");
@@ -372,9 +368,7 @@ public class SagePayPaymentServices {
                             "relatedVPSTxId", captureTransaction.get("referenceNum"),
                             "relatedVendorTxCode", captureTransaction.get("altReference"),
                             "relatedSecurityKey", captureTransaction.get("gatewayFlag"),
-                            "relatedTxAuthNo", captureTransaction.get("gatewayCode")
-                        )
-                    );
+                            "relatedTxAuthNo", captureTransaction.get("gatewayCode")));
             Debug.logInfo("SagePay - SagePayPaymentRefund result : " + paymentResult, MODULE);
 
             String status = (String) paymentResult.get("status");
@@ -414,9 +408,7 @@ public class SagePayPaymentServices {
                             "vendorTxCode", captureTransaction.get("altReference"),
                             "vpsTxId", captureTransaction.get("referenceNum"),
                             "securityKey", captureTransaction.get("gatewayFlag"),
-                            "txAuthNo", captureTransaction.get("gatewayCode")
-                        )
-                    );
+                            "txAuthNo", captureTransaction.get("gatewayCode")));
 
             Debug.logInfo("SagePay - SagePayPaymentVoid result : " + paymentResult, MODULE);
 
@@ -481,9 +473,7 @@ public class SagePayPaymentServices {
                             "releaseAmount", amount.toString(),
                             "vpsTxId", refNum,
                             "securityKey", authTransaction.get("gatewayFlag"),
-                            "txAuthNo", authTransaction.get("gatewayCode")
-                        )
-                    );
+                            "txAuthNo", authTransaction.get("gatewayCode")));
 
             Debug.logInfo("SagePay - SagePayPaymentRelease result : " + paymentResult, MODULE);
 
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
index 380ecfb..4f57a94 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java
@@ -147,58 +147,58 @@ public class SagePayServices
         parameters.put("TxType", txType);
         parameters.put("Vendor", vendor);
 
-        if (vendorTxCode != null) { parameters.put("VendorTxCode", vendorTxCode); }
-        if (amount != null) { parameters.put("Amount", amount); }
-        if (currency != null) { parameters.put("Currency", currency); } //GBP/USD
-        if (description != null) { parameters.put("Description", description); }
-        if (cardHolder != null) { parameters.put("CardHolder", cardHolder); }
-        if (cardNumber != null) { parameters.put("CardNumber", cardNumber); }
-        if (expiryDate != null) { parameters.put("ExpiryDate", expiryDate); }
-        if (cardType != null) { parameters.put("CardType", cardType); }
+        if (vendorTxCode != null) {parameters.put("VendorTxCode", vendorTxCode); }
+        if (amount != null) {parameters.put("Amount", amount); }
+        if (currency != null) {parameters.put("Currency", currency); } //GBP/USD
+        if (description != null) {parameters.put("Description", description); }
+        if (cardHolder != null) {parameters.put("CardHolder", cardHolder); }
+        if (cardNumber != null) {parameters.put("CardNumber", cardNumber); }
+        if (expiryDate != null) {parameters.put("ExpiryDate", expiryDate); }
+        if (cardType != null) {parameters.put("CardType", cardType); }
 
         //start - billing details
-        if (billingSurname != null) { parameters.put("BillingSurname", billingSurname); }
-        if (billingFirstnames != null) { parameters.put("BillingFirstnames", billingFirstnames); }
-        if (billingAddress != null) { parameters.put("BillingAddress", billingAddress); }
-        if (billingAddress2 != null) { parameters.put("BillingAddress2", billingAddress2); }
-        if (billingCity != null) { parameters.put("BillingCity", billingCity); }
-        if (billingPostCode != null) { parameters.put("BillingPostCode", billingPostCode); }
-        if (billingCountry != null) { parameters.put("BillingCountry", billingCountry); }
-        if (billingState != null) { parameters.put("BillingState", billingState); }
-        if (billingPhone != null) { parameters.put("BillingPhone", billingPhone); }
+        if (billingSurname != null) {parameters.put("BillingSurname", billingSurname); }
+        if (billingFirstnames != null) {parameters.put("BillingFirstnames", billingFirstnames); }
+        if (billingAddress != null) {parameters.put("BillingAddress", billingAddress); }
+        if (billingAddress2 != null) {parameters.put("BillingAddress2", billingAddress2); }
+        if (billingCity != null) {parameters.put("BillingCity", billingCity); }
+        if (billingPostCode != null) {parameters.put("BillingPostCode", billingPostCode); }
+        if (billingCountry != null) {parameters.put("BillingCountry", billingCountry); }
+        if (billingState != null) {parameters.put("BillingState", billingState); }
+        if (billingPhone != null) {parameters.put("BillingPhone", billingPhone); }
         //end - billing details
 
         //start - delivery details
         if (isBillingSameAsDelivery != null && isBillingSameAsDelivery) {
-            if (billingSurname != null) { parameters.put("DeliverySurname", billingSurname); }
-            if (billingFirstnames != null) { parameters.put("DeliveryFirstnames", billingFirstnames); }
-            if (billingAddress != null) { parameters.put("DeliveryAddress", billingAddress); }
-            if (billingAddress2 != null) { parameters.put("DeliveryAddress2", billingAddress2); }
-            if (billingCity != null) { parameters.put("DeliveryCity", billingCity); }
-            if (billingPostCode != null) { parameters.put("DeliveryPostCode", billingPostCode); }
-            if (billingCountry != null) { parameters.put("DeliveryCountry", billingCountry); }
-            if (billingState != null) { parameters.put("DeliveryState", billingState); }
-            if (billingPhone != null) { parameters.put("DeliveryPhone", billingPhone); }
+            if (billingSurname != null) {parameters.put("DeliverySurname", billingSurname); }
+            if (billingFirstnames != null) {parameters.put("DeliveryFirstnames", billingFirstnames); }
+            if (billingAddress != null) {parameters.put("DeliveryAddress", billingAddress); }
+            if (billingAddress2 != null) {parameters.put("DeliveryAddress2", billingAddress2); }
+            if (billingCity != null) {parameters.put("DeliveryCity", billingCity); }
+            if (billingPostCode != null) {parameters.put("DeliveryPostCode", billingPostCode); }
+            if (billingCountry != null) {parameters.put("DeliveryCountry", billingCountry); }
+            if (billingState != null) {parameters.put("DeliveryState", billingState); }
+            if (billingPhone != null) {parameters.put("DeliveryPhone", billingPhone); }
         } else {
-            if (deliverySurname != null) { parameters.put("DeliverySurname", deliverySurname); }
-            if (deliveryFirstnames != null) { parameters.put("DeliveryFirstnames", deliveryFirstnames); }
-            if (deliveryAddress != null) { parameters.put("DeliveryAddress", deliveryAddress); }
-            if (deliveryAddress2 != null) { parameters.put("DeliveryAddress2", deliveryAddress2); }
-            if (deliveryCity != null) { parameters.put("DeliveryCity", deliveryCity); }
-            if (deliveryPostCode != null) { parameters.put("DeliveryPostCode", deliveryPostCode); }
-            if (deliveryCountry != null) { parameters.put("DeliveryCountry", deliveryCountry); }
-            if (deliveryState != null) { parameters.put("DeliveryState", deliveryState); }
+            if (deliverySurname != null) {parameters.put("DeliverySurname", deliverySurname); }
+            if (deliveryFirstnames != null) {parameters.put("DeliveryFirstnames", deliveryFirstnames); }
+            if (deliveryAddress != null) {parameters.put("DeliveryAddress", deliveryAddress); }
+            if (deliveryAddress2 != null) {parameters.put("DeliveryAddress2", deliveryAddress2); }
+            if (deliveryCity != null) {parameters.put("DeliveryCity", deliveryCity); }
+            if (deliveryPostCode != null) {parameters.put("DeliveryPostCode", deliveryPostCode); }
+            if (deliveryCountry != null) {parameters.put("DeliveryCountry", deliveryCountry); }
+            if (deliveryState != null) {parameters.put("DeliveryState", deliveryState); }
             if (deliveryPhone != null) {parameters.put("DeliveryPhone", deliveryPhone); }
         }
         //end - delivery details
         //end - required parameters
 
         //start - optional parameters
-        if (cv2 != null) { parameters.put("CV2", cv2); }
-        if (startDate != null) { parameters.put("StartDate", startDate); }
-        if (issueNumber != null) { parameters.put("IssueNumber", issueNumber); }
-        if (basket != null) { parameters.put("Basket", basket); }
-        if (clientIPAddress != null) { parameters.put("ClientIPAddress", clientIPAddress); }
+        if (cv2 != null) {parameters.put("CV2", cv2); }
+        if (startDate != null) {parameters.put("StartDate", startDate); }
+        if (issueNumber != null) {parameters.put("IssueNumber", issueNumber); }
+        if (basket != null) {parameters.put("Basket", basket); }
+        if (clientIPAddress != null) {parameters.put("ClientIPAddress", clientIPAddress); }
         //end - optional parameters
         //end - authentication parameters
 
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java
index f46b513..57a247b 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java
@@ -52,13 +52,13 @@ public final class SagePayUtil {
     (Boolean authResult, String authCode, String authFlag, BigDecimal processAmount, String authRefNum, String authAltRefNum, String authMessage) {
 
         Map<String, Object> result = new HashMap<>();
-        if (authResult != null) { result.put("authResult", authResult); }
-        if (authCode != null) { result.put("authCode", authCode); }
-        if (authFlag != null) { result.put("authFlag", authFlag); }
-        if (processAmount != null) { result.put("processAmount", processAmount); }
-        if (authRefNum != null) { result.put("authRefNum", authRefNum); }
-        if (authAltRefNum != null) { result.put("authAltRefNum", authAltRefNum); }
-        if (authMessage != null) { result.put("authMessage", authMessage); }
+        if (authResult != null) {result.put("authResult", authResult); }
+        if (authCode != null) {result.put("authCode", authCode); }
+        if (authFlag != null) {result.put("authFlag", authFlag); }
+        if (processAmount != null) {result.put("processAmount", processAmount); }
+        if (authRefNum != null) {result.put("authRefNum", authRefNum); }
+        if (authAltRefNum != null) {result.put("authAltRefNum", authAltRefNum); }
+        if (authMessage != null) {result.put("authMessage", authMessage); }
         return result;
     }
 
@@ -66,13 +66,13 @@ public final class SagePayUtil {
     (Boolean captureResult, String captureCode, String captureFlag, BigDecimal captureAmount, String captureRefNum, String captureAltRefNum, String captureMessage) {
 
         Map<String, Object> result = new HashMap<>();
-        if (captureResult != null) { result.put("captureResult", captureResult); }
-        if (captureCode != null) { result.put("captureCode", captureCode); }
-        if (captureFlag != null) { result.put("captureFlag", captureFlag); }
-        if (captureAmount != null) { result.put("captureAmount", captureAmount); }
-        if (captureRefNum != null) { result.put("captureRefNum", captureRefNum); }
-        if (captureAltRefNum != null) { result.put("captureAltRefNum", captureAltRefNum); }
-        if (captureMessage != null) { result.put("captureMessage", captureMessage); }
+        if (captureResult != null) {result.put("captureResult", captureResult); }
+        if (captureCode != null) {result.put("captureCode", captureCode); }
+        if (captureFlag != null) {result.put("captureFlag", captureFlag); }
+        if (captureAmount != null) {result.put("captureAmount", captureAmount); }
+        if (captureRefNum != null) {result.put("captureRefNum", captureRefNum); }
+        if (captureAltRefNum != null) {result.put("captureAltRefNum", captureAltRefNum); }
+        if (captureMessage != null) {result.put("captureMessage", captureMessage); }
         return result;
     }
 
@@ -80,12 +80,12 @@ public final class SagePayUtil {
     (Boolean releaseResult, String releaseCode, BigDecimal releaseAmount, String releaseRefNum, String releaseAltRefNum, String releaseMessage) {
 
         Map<String, Object> result = new HashMap<>();
-        if (releaseResult != null) { result.put("releaseResult", releaseResult); }
-        if (releaseCode != null) { result.put("releaseCode", releaseCode); }
-        if (releaseAmount != null) { result.put("releaseAmount", releaseAmount); }
-        if (releaseRefNum != null) { result.put("releaseRefNum", releaseRefNum); }
-        if (releaseAltRefNum != null) { result.put("releaseAltRefNum", releaseAltRefNum); }
-        if (releaseMessage != null) { result.put("releaseMessage", releaseMessage); }
+        if (releaseResult != null) {result.put("releaseResult", releaseResult); }
+        if (releaseCode != null) {result.put("releaseCode", releaseCode); }
+        if (releaseAmount != null) {result.put("releaseAmount", releaseAmount); }
+        if (releaseRefNum != null) {result.put("releaseRefNum", releaseRefNum); }
+        if (releaseAltRefNum != null) {result.put("releaseAltRefNum", releaseAltRefNum); }
+        if (releaseMessage != null) {result.put("releaseMessage", releaseMessage); }
         return result;
     }
 
@@ -93,11 +93,11 @@ public final class SagePayUtil {
     (Boolean refundResult, BigDecimal refundAmount, String refundRefNum, String refundAltRefNum, String refundMessage) {
 
         Map<String, Object> result = new HashMap<>();
-        if (refundResult != null) { result.put("refundResult", refundResult); }
-        if (refundAmount != null) { result.put("refundAmount", refundAmount); }
-        if (refundRefNum != null) { result.put("refundRefNum", refundRefNum); }
-        if (refundAltRefNum != null) { result.put("refundAltRefNum", refundAltRefNum); }
-        if (refundMessage != null) { result.put("refundMessage", refundMessage); }
+        if (refundResult != null) {result.put("refundResult", refundResult); }
+        if (refundAmount != null) {result.put("refundAmount", refundAmount); }
+        if (refundRefNum != null) {result.put("refundRefNum", refundRefNum); }
+        if (refundAltRefNum != null) {result.put("refundAltRefNum", refundAltRefNum); }
+        if (refundMessage != null) {result.put("refundMessage", refundMessage); }
         return result;
     }
 
@@ -105,12 +105,12 @@ public final class SagePayUtil {
     (Boolean refundResult, String refundCode, BigDecimal refundAmount, String refundRefNum, String refundAltRefNum, String refundMessage) {
 
         Map<String, Object> result = new HashMap<>();
-        if (refundResult != null) { result.put("refundResult", refundResult); }
-        if (refundCode != null) { result.put("refundCode", refundCode); }
-        if (refundAmount != null) { result.put("refundAmount", refundAmount); }
-        if (refundRefNum != null) { result.put("refundRefNum", refundRefNum); }
-        if (refundAltRefNum != null) { result.put("refundAltRefNum", refundAltRefNum); }
-        if (refundMessage != null) { result.put("refundMessage", refundMessage); }
+        if (refundResult != null) {result.put("refundResult", refundResult); }
+        if (refundCode != null) {result.put("refundCode", refundCode); }
+        if (refundAmount != null) {result.put("refundAmount", refundAmount); }
+        if (refundRefNum != null) {result.put("refundRefNum", refundRefNum); }
+        if (refundAltRefNum != null) {result.put("refundAltRefNum", refundAltRefNum); }
+        if (refundMessage != null) {result.put("refundMessage", refundMessage); }
         return result;
     }
 
@@ -132,7 +132,7 @@ public final class SagePayUtil {
         }
         String scheme = hostUrl.substring(0, 5);
         String host = hostUrl.substring(8, hostUrl.lastIndexOf(":"));
-        String port = hostUrl.substring(hostUrl.lastIndexOf(":")+1);
+        String port = hostUrl.substring(hostUrl.lastIndexOf(":") + 1);
         return getHost(host, Integer.parseInt(port), scheme);
     }
 
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 4b72f25..26e561c 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
@@ -90,8 +90,7 @@ public class SecurePayServiceTest extends OFBizTestCase {
                 "prodCatalogId", "DemoCatalog",
                 "quantity", new BigDecimal("2.000000"),
                 "unitPrice", new BigDecimal("59.00"),
-                "statusId", "ITEM_COMPLETED"
-                );
+                "statusId", "ITEM_COMPLETED");
         orderItems = UtilMisc.<Object>toList(orderItemMap);
         billToParty = delegator.makeValue("Party", UtilMisc.toMap("partyId", "DemoCustomer"));
         paymentGatewayConfigId = "SECUREPAY_CONFIG";
@@ -121,8 +120,7 @@ public class SecurePayServiceTest extends OFBizTestCase {
                     "billingAddress", billingAddress,
                     "shippingAddress", shippingAddress,
                     "orderId", orderId,
-                    "currency", "AUD"
-           );
+                    "currency", "AUD");
             serviceInput.put("processAmount", new BigDecimal("100.08"));
 
             // run the service
@@ -147,8 +145,7 @@ public class SecurePayServiceTest extends OFBizTestCase {
                         "referenceNum", authRefNum,
                         "paymentMethodTypeId", "CREDIT_CARD",
                         "paymentServiceTypeEnumId", "PRDS_PAY_AUTH",
-                        "currencyUomId", "AUD"
-                        ));
+                        "currencyUomId", "AUD"));
                 GenericValue checkPaymentGatewayResponse = EntityQuery.use(delegator).from("PaymentGatewayResponse").where("paymentGatewayResponseId", "testOrder1000_01").queryOne();
                 if (UtilValidate.isEmpty(checkPaymentGatewayResponse)) {
                     paymentGatewayResponse.create();
@@ -166,8 +163,7 @@ public class SecurePayServiceTest extends OFBizTestCase {
             Map<String, Object> serviceInput = UtilMisc.<String, Object>toMap(
                     "paymentConfig", configFile,
                     "orderPaymentPreference", orderPaymentPreference,
-                    "authTrans", paymentGatewayResponse
-           );
+                    "authTrans", paymentGatewayResponse);
             serviceInput.put("captureAmount", refundAmount);
 
             // run the service
@@ -197,9 +193,7 @@ public class SecurePayServiceTest extends OFBizTestCase {
         Debug.logInfo("=====[testdoRefund] starting....", MODULE);
         try {
             Map<String, Object> serviceInput = UtilMisc.toMap(
-                    "paymentConfig", configFile,
-                    "orderPaymentPreference", orderPaymentPreference
-           );
+                    "paymentConfig", configFile, "orderPaymentPreference", orderPaymentPreference);
             serviceInput.put("refundAmount", refundAmount);
             // run the service
             Map<String, Object> result = dispatcher.runSync("ofbScRefund", serviceInput);
@@ -232,8 +226,7 @@ public class SecurePayServiceTest extends OFBizTestCase {
                     "creditCard", creditCard,
                     "billingAddress", billingAddress,
                     "referenceCode", orderId,
-                    "currency", "AUD"
-           );
+                    "currency", "AUD");
             serviceInput.put("creditAmount", creditAmount);
             // run the service
             Map<String, Object> result = dispatcher.runSync("ofbScCCCredit", serviceInput);
diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
index 0e1c74f..e1dd58d 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
@@ -325,7 +325,7 @@ public class ValueLinkApi {
 
         // test the KEK
         Cipher cipher = this.getCipher(this.getKekKey(), Cipher.ENCRYPT_MODE);
-        byte[] kekTestB = { 0, 0, 0, 0, 0, 0, 0, 0 };
+        byte[] kekTestB = {0, 0, 0, 0, 0, 0, 0, 0 };
         byte[] kekTestC = new byte[0];
         if (kekTest != null) {
             kekTestB = StringUtil.fromHexString(kekTest);
@@ -767,7 +767,7 @@ public class ValueLinkApi {
 
     // return a cipher for a key - DESede/CBC/NoPadding IV = 0
     protected Cipher getCipher(SecretKey key, int mode) {
-        byte[] zeros = { 0, 0, 0, 0, 0, 0, 0, 0 };
+        byte[] zeros = {0, 0, 0, 0, 0, 0, 0, 0 };
         IvParameterSpec iv = new IvParameterSpec(zeros);
 
         // create the Cipher - DESede/CBC/NoPadding
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 2983043..284c1e3 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
@@ -132,7 +132,7 @@ public class ContentManagementServices {
      * This service tries to handle DataResource fields with and
      * without "dr" prefixes.
      * Assumes binary data is always in field, "imageData".
-     *
+     * <p>
      * This service does not accept straight ContentAssoc parameters. They must be prefaced with "ca" + cap first letter
      */
     public static Map<String, Object> persistContentAndAssoc(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException {
@@ -257,7 +257,7 @@ public class ContentManagementServices {
         context.put("skipPermissionCheck", null);  // Force check here
         boolean contentExists = true;
         if (Debug.infoOn()) {
-            Debug.logInfo("in persist... contentTypeId:" +  contentTypeId + " dataResourceTypeId:" + dataResourceTypeId + " contentId:" + contentId + " dataResourceId:" + dataResourceId, MODULE);
+            Debug.logInfo("in persist... contentTypeId:" + contentTypeId + " dataResourceTypeId:" + dataResourceTypeId + " contentId:" + contentId + " dataResourceId:" + dataResourceId, MODULE);
         }
         if (UtilValidate.isNotEmpty(contentTypeId)) {
             if (UtilValidate.isEmpty(contentId)) {
@@ -281,7 +281,8 @@ public class ContentManagementServices {
                 Debug.logInfo("In persistContentAndAssoc calling updateContent with content: " + contentContext, MODULE);
                 Map<String, Object> thisResult = dispatcher.runSync("updateContent", contentContext);
                 if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentUpdatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult);
+                    return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentUpdatingError", UtilMisc.toMap("serviceName",
+                        "persistContentAndAssoc"), locale), null, null, thisResult);
                 }
             } else {
                 Map<String, Object> contentContext = new HashMap<>();
@@ -293,7 +294,8 @@ public class ContentManagementServices {
                 Debug.logInfo("In persistContentAndAssoc calling createContent with content: " + contentContext, MODULE);
                 Map<String, Object> thisResult = dispatcher.runSync("createContent", contentContext);
                 if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult);
+                    return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentCreatingError", UtilMisc.toMap("serviceName",
+                        "persistContentAndAssoc"), locale), null, null, thisResult);
                 }
                 contentId = (String) thisResult.get("contentId");
             }
@@ -306,7 +308,8 @@ public class ContentManagementServices {
                 try {
                     Set<String> contentPurposeSet = new LinkedHashSet<>(contentPurposeList);
                     for (String contentPurposeTypeId : contentPurposeSet) {
-                        GenericValue contentPurpose = delegator.makeValue("ContentPurpose", UtilMisc.toMap("contentId", contentId, "contentPurposeTypeId", contentPurposeTypeId));
+                        GenericValue contentPurpose = delegator.makeValue("ContentPurpose", UtilMisc.toMap("contentId", contentId,
+                            "contentPurposeTypeId", contentPurposeTypeId));
                         contentPurpose.create();
                     }
                 } catch (GenericEntityException e) {
@@ -399,275 +402,274 @@ public class ContentManagementServices {
     }
 
     /**
-    Service for update publish sites with a ContentRole that will tie them to the passed
-    in party.
-   */
+     * Service for update publish sites with a ContentRole that will tie them to the passed
+     * in party.
+     */
     public static Map<String, Object> updateSiteRoles(DispatchContext dctx, Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Delegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-      Map<String, Object> results = new HashMap<>();
-      String siteContentId = (String) context.get("contentId");
-      String partyId = (String) context.get("partyId");
-
-      if (UtilValidate.isEmpty(siteContentId) || UtilValidate.isEmpty(partyId))
-          return results;
-
-      List<GenericValue> siteRoles = null;
-      try {
-          siteRoles = EntityQuery.use(delegator).from("RoleType").where("parentTypeId", "BLOG").cache().queryList();
-      } catch (GenericEntityException e) {
-          return ServiceUtil.returnError(e.toString());
-      }
-
-      for (GenericValue roleType : siteRoles) {
-          Map<String, Object> serviceContext = new HashMap<>();
-          serviceContext.put("partyId", partyId);
-          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 cappedSiteRole = ModelUtil.dbNameToVarName(siteRole);
-          if (Debug.infoOn()) {
-              Debug.logInfo("updateSiteRoles, cappediteRole(1):" + cappedSiteRole, MODULE);
-          }
-          String siteRoleVal = (String) context.get(cappedSiteRole);
-          if (Debug.infoOn()) {
-              Debug.logInfo("updateSiteRoles, siteRoleVal(1):" + siteRoleVal, MODULE);
-              Debug.logInfo("updateSiteRoles, context(1):" + context, MODULE);
-          }
-          Object fromDate = context.get(cappedSiteRole + "FromDate");
-          if (Debug.infoOn()) {
-              Debug.logInfo("updateSiteRoles, fromDate(1):" + fromDate, MODULE);
-          }
-          serviceContext.put("roleTypeId", siteRole);
-          if (siteRoleVal != null && "Y".equalsIgnoreCase(siteRoleVal)) {
-              // for now, will assume that any error is due to duplicates - ignore
-              if (fromDate == null) {
-                  try {
-                      Map<String, Object> newContext = new HashMap<>();
-                      newContext.put("contentId", serviceContext.get("contentId"));
-                      newContext.put("partyId", serviceContext.get("partyId"));
-                      newContext.put("roleTypeId", serviceContext.get("roleTypeId"));
-                      newContext.put("userLogin", userLogin);
-                      Map<String, Object> permResults = dispatcher.runSync("deactivateAllContentRoles", newContext);
-                      if (ServiceUtil.isError(permResults)) {
-                          return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
-                      }
-                      serviceContext.put("fromDate", UtilDateTime.nowTimestamp());
-                      if (Debug.infoOn()) {
-                          Debug.logInfo("updateSiteRoles, serviceContext(1):" + serviceContext, MODULE);
-                      }
-                      permResults = dispatcher.runSync("createContentRole", serviceContext);
-                      if (ServiceUtil.isError(permResults)) {
-                          return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
-                      }
-                  } catch (GenericServiceException e) {
-                      Debug.logError(e, e.toString(), MODULE);
-                      return ServiceUtil.returnError(e.toString());
-                  }
-              }
-          } else {
-              if (fromDate != null) {
-                  // for now, will assume that any error is due to non-existence - ignore
-                  try {
-                      Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, MODULE);
-                      Map<String, Object> newContext = new HashMap<>();
-                      newContext.put("contentId", serviceContext.get("contentId"));
-                      newContext.put("partyId", serviceContext.get("partyId"));
-                      newContext.put("roleTypeId", serviceContext.get("roleTypeId"));
-                      newContext.put("userLogin", userLogin);
-                      Map<String, Object> permResults = dispatcher.runSync("deactivateAllContentRoles", newContext);
-                      if (ServiceUtil.isError(permResults)) {
-                          return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
-                      }
-                  } catch (GenericServiceException e) {
-                      Debug.logError(e, e.toString(), MODULE);
-                      return ServiceUtil.returnError(e.toString());
-                  }
-              }
-          }
-      }
-      return results;
-  }
+        Map<String, Object> results = new HashMap<>();
+        String siteContentId = (String) context.get("contentId");
+        String partyId = (String) context.get("partyId");
+
+        if (UtilValidate.isEmpty(siteContentId) || UtilValidate.isEmpty(partyId))
+            return results;
+
+        List<GenericValue> siteRoles = null;
+        try {
+            siteRoles = EntityQuery.use(delegator).from("RoleType").where("parentTypeId", "BLOG").cache().queryList();
+        } catch (GenericEntityException e) {
+            return ServiceUtil.returnError(e.toString());
+        }
+
+        for (GenericValue roleType : siteRoles) {
+            Map<String, Object> serviceContext = new HashMap<>();
+            serviceContext.put("partyId", partyId);
+            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 cappedSiteRole = ModelUtil.dbNameToVarName(siteRole);
+            if (Debug.infoOn()) {
+                Debug.logInfo("updateSiteRoles, cappediteRole(1):" + cappedSiteRole, MODULE);
+            }
+            String siteRoleVal = (String) context.get(cappedSiteRole);
+            if (Debug.infoOn()) {
+                Debug.logInfo("updateSiteRoles, siteRoleVal(1):" + siteRoleVal, MODULE);
+                Debug.logInfo("updateSiteRoles, context(1):" + context, MODULE);
+            }
+            Object fromDate = context.get(cappedSiteRole + "FromDate");
+            if (Debug.infoOn()) {
+                Debug.logInfo("updateSiteRoles, fromDate(1):" + fromDate, MODULE);
+            }
+            serviceContext.put("roleTypeId", siteRole);
+            if (siteRoleVal != null && "Y".equalsIgnoreCase(siteRoleVal)) {
+                // for now, will assume that any error is due to duplicates - ignore
+                if (fromDate == null) {
+                    try {
+                        Map<String, Object> newContext = new HashMap<>();
+                        newContext.put("contentId", serviceContext.get("contentId"));
+                        newContext.put("partyId", serviceContext.get("partyId"));
+                        newContext.put("roleTypeId", serviceContext.get("roleTypeId"));
+                        newContext.put("userLogin", userLogin);
+                        Map<String, Object> permResults = dispatcher.runSync("deactivateAllContentRoles", newContext);
+                        if (ServiceUtil.isError(permResults)) {
+                            return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
+                        }
+                        serviceContext.put("fromDate", UtilDateTime.nowTimestamp());
+                        if (Debug.infoOn()) {
+                            Debug.logInfo("updateSiteRoles, serviceContext(1):" + serviceContext, MODULE);
+                        }
+                        permResults = dispatcher.runSync("createContentRole", serviceContext);
+                        if (ServiceUtil.isError(permResults)) {
+                            return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
+                        }
+                    } catch (GenericServiceException e) {
+                        Debug.logError(e, e.toString(), MODULE);
+                        return ServiceUtil.returnError(e.toString());
+                    }
+                }
+            } else {
+                if (fromDate != null) {
+                    // for now, will assume that any error is due to non-existence - ignore
+                    try {
+                        Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, MODULE);
+                        Map<String, Object> newContext = new HashMap<>();
+                        newContext.put("contentId", serviceContext.get("contentId"));
+                        newContext.put("partyId", serviceContext.get("partyId"));
+                        newContext.put("roleTypeId", serviceContext.get("roleTypeId"));
+                        newContext.put("userLogin", userLogin);
+                        Map<String, Object> permResults = dispatcher.runSync("deactivateAllContentRoles", newContext);
+                        if (ServiceUtil.isError(permResults)) {
+                            return ServiceUtil.returnError(ServiceUtil.getErrorMessage(permResults));
+                        }
+                    } catch (GenericServiceException e) {
+                        Debug.logError(e, e.toString(), MODULE);
+                        return ServiceUtil.returnError(e.toString());
+                    }
+                }
+            }
+        }
+        return results;
+    }
 
     public static Map<String, Object> persistDataResourceAndData(DispatchContext dctx, Map<String, ? extends Object> context) {
-      LocalDispatcher dispatcher = dctx.getDispatcher();
-      Locale locale = (Locale) context.get("locale");
-      Map<String, Object> result;
-      try {
-          ModelService checkPermModel = dispatcher.getDispatchContext().getModelService("checkContentPermission");
-          Map<String, Object> ctx = checkPermModel.makeValid(context, ModelService.IN_PARAM);
-          Map<String, Object> thisResult = dispatcher.runSync("checkContentPermission", ctx);
-          if (ServiceUtil.isError(thisResult)) {
-              return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-          }
-          String permissionStatus = (String) thisResult.get("permissionStatus");
-          if (UtilValidate.isNotEmpty(permissionStatus) && "granted".equalsIgnoreCase(permissionStatus)) {
-              result = persistDataResourceAndDataMethod(dctx, context);
-          }
-          else {
-              return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentNoAccessToUploadImage", locale));
-          }
-      } catch (GenericEntityException | GenericServiceException e) {
-          Debug.logError(e, e.toString(), MODULE);
-          return ServiceUtil.returnError(e.toString());
-      }
-      String errorMsg = ServiceUtil.getErrorMessage(result);
-      if (UtilValidate.isNotEmpty(errorMsg)) {
-          return ServiceUtil.returnError(errorMsg);
-      }
-      return result;
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        Locale locale = (Locale) context.get("locale");
+        Map<String, Object> result;
+        try {
+            ModelService checkPermModel = dispatcher.getDispatchContext().getModelService("checkContentPermission");
+            Map<String, Object> ctx = checkPermModel.makeValid(context, ModelService.IN_PARAM);
+            Map<String, Object> thisResult = dispatcher.runSync("checkContentPermission", ctx);
+            if (ServiceUtil.isError(thisResult)) {
+                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+            }
+            String permissionStatus = (String) thisResult.get("permissionStatus");
+            if (UtilValidate.isNotEmpty(permissionStatus) && "granted".equalsIgnoreCase(permissionStatus)) {
+                result = persistDataResourceAndDataMethod(dctx, context);
+            } else {
+                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentContentNoAccessToUploadImage", locale));
+            }
+        } catch (GenericEntityException | GenericServiceException e) {
+            Debug.logError(e, e.toString(), MODULE);
+            return ServiceUtil.returnError(e.toString());
+        }
+        String errorMsg = ServiceUtil.getErrorMessage(result);
+        if (UtilValidate.isNotEmpty(errorMsg)) {
+            return ServiceUtil.returnError(errorMsg);
+        }
+        return result;
     }
 
     public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException {
-      Delegator delegator = dctx.getDelegator();
-      LocalDispatcher dispatcher = dctx.getDispatcher();
-      Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
-      Map<String, Object> result = new HashMap<>();
-      Map<String, Object> newDrContext = new HashMap<>();
-      GenericValue dataResource = delegator.makeValue("DataResource");
-      dataResource.setPKFields(context);
-      dataResource.setNonPKFields(context);
-      dataResource.setAllFields(context, false, "dr", null);
-      context.putAll(dataResource);
-
-      GenericValue electronicText = delegator.makeValue("ElectronicText");
-      electronicText.setPKFields(context);
-      electronicText.setNonPKFields(context);
-      String textData = (String) electronicText.get("textData");
-
-
-      String dataResourceId = (String) dataResource.get("dataResourceId");
-      String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId");
-      if (Debug.infoOn()) {
-          Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, MODULE);
-      }
-      context.put("skipPermissionCheck", "granted"); // TODO: a temp hack because I don't want to bother with DataResource permissions at this time.
-      boolean dataResourceExists = true;
-      if (UtilValidate.isEmpty(dataResourceId)) {
-          dataResourceExists = false;
-      } else {
-          try {
-              GenericValue val = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne();
-              if (val == null) {
-                  dataResourceExists = false;
-              }
-          } catch (GenericEntityException e) {
-              return ServiceUtil.returnError(e.toString());
-          }
-      }
-      GenericValue userLogin = (GenericValue) context.get("userLogin");
-      ModelService dataResourceModel = dispatcher.getDispatchContext().getModelService("updateDataResource");
-      Map<String, Object> ctx = dataResourceModel.makeValid(dataResource, ModelService.IN_PARAM);
-      newDrContext.putAll(ctx);
-      newDrContext.put("userLogin", userLogin);
-      newDrContext.put("skipPermissionCheck", context.get("skipPermissionCheck"));
-      ByteBuffer imageDataBytes = (ByteBuffer) context.get("imageData");
-      String mimeTypeId = (String) newDrContext.get("mimeTypeId");
-      if (imageDataBytes != null && (mimeTypeId == null || (mimeTypeId.indexOf("image") >= 0) || (mimeTypeId.indexOf("application") >= 0))) {
-          mimeTypeId = (String) context.get("_imageData_contentType");
-          if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
-              String fileName = (String) context.get("_imageData_fileName");
-              newDrContext.put("objectInfo", fileName);
-          }
-          newDrContext.put("mimeTypeId", mimeTypeId);
-      }
-
-      if (!dataResourceExists) { // Create
-          Map<String, Object> thisResult = dispatcher.runSync("createDataResource", newDrContext);
-          if (ServiceUtil.isError(thisResult)) {
-              throw(new GenericServiceException(ServiceUtil.getErrorMessage(thisResult)));
-          }
-          dataResourceId = (String) thisResult.get("dataResourceId");
-          if (Debug.infoOn()) {
-              Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, MODULE);
-          }
-          dataResource = (GenericValue) thisResult.get("dataResource");
-          Map<String, Object> fileContext = new HashMap<>();
-          fileContext.put("userLogin", userLogin);
-          if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
-              if (imageDataBytes != null) {
-                  fileContext.put("dataResourceId", dataResourceId);
-                  fileContext.put("imageData", imageDataBytes);
-                  thisResult = dispatcher.runSync("createImage", fileContext);
-                  if (ServiceUtil.isError(thisResult)) {
-                      return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-                  }
-              }
-          } else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
-          } else if ("SURVEY".startsWith(dataResourceTypeId)) {
-          } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) {
-              Map<String, Object> uploadImage = new HashMap<>();
-              uploadImage.put("userLogin", userLogin);
-              uploadImage.put("dataResourceId", dataResourceId);
-              uploadImage.put("dataResourceTypeId", dataResourceTypeId);
-              uploadImage.put("rootDir", context.get("objectInfo"));
-              uploadImage.put("uploadedFile", imageDataBytes);
-              uploadImage.put("_uploadedFile_fileName", context.get("_imageData_fileName"));
-              uploadImage.put("_uploadedFile_contentType", context.get("_imageData_contentType"));
-              thisResult = dispatcher.runSync("attachUploadToDataResource", uploadImage);
-              if (ServiceUtil.isError(thisResult)) {
-                  return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-              }
-          } else {
-              // assume ELECTRONIC_TEXT
-              if (UtilValidate.isNotEmpty(textData)) {
-                  fileContext.put("dataResourceId", dataResourceId);
-                  fileContext.put("textData", textData);
-                  thisResult = dispatcher.runSync("createElectronicText", fileContext);
-                  if (ServiceUtil.isError(thisResult)) {
-                      return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-                  }
-              }
-          }
-      } else { // Update
-          Map<String, Object> thisResult = dispatcher.runSync("updateDataResource", newDrContext);
-          if (ServiceUtil.isError(thisResult)) {
-              return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-          }
-          Map<String, Object> fileContext = new HashMap<>();
-          fileContext.put("userLogin", userLogin);
-          String forceElectronicText = (String) context.get("forceElectronicText");
-          if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
-              if (imageDataBytes != null || "true".equalsIgnoreCase(forceElectronicText)) {
-                  fileContext.put("dataResourceId", dataResourceId);
-                  fileContext.put("imageData", imageDataBytes);
-                  thisResult = dispatcher.runSync("updateImage", fileContext);
-                  if (ServiceUtil.isError(thisResult)) {
-                      return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-                  }
-              }
-          } else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
-          } else if ("SURVEY".startsWith(dataResourceTypeId)) {
-          } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) {
-              Map<String, Object> uploadImage = new HashMap<>();
-              uploadImage.put("userLogin", userLogin);
-              uploadImage.put("dataResourceId", dataResourceId);
-              uploadImage.put("dataResourceTypeId", dataResourceTypeId);
-              uploadImage.put("rootDir", context.get("objectInfo"));
-              uploadImage.put("uploadedFile", imageDataBytes);
-              uploadImage.put("_uploadedFile_fileName", context.get("_imageData_fileName"));
-              uploadImage.put("_uploadedFile_contentType", context.get("_imageData_contentType"));
-              thisResult = dispatcher.runSync("attachUploadToDataResource", uploadImage);
-              if (ServiceUtil.isError(thisResult)) {
-                  return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-              }
-          } else {
-              if (UtilValidate.isNotEmpty(textData) || "true".equalsIgnoreCase(forceElectronicText)) {
-                  fileContext.put("dataResourceId", dataResourceId);
-                  fileContext.put("textData", textData);
-                  thisResult = dispatcher.runSync("updateElectronicText", fileContext);
-                  if (ServiceUtil.isError(thisResult)) {
-                      return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
-                  }
-              }
-          }
-      }
-      result.put("dataResourceId", dataResourceId);
-      result.put("drDataResourceId", dataResourceId);
-      context.put("dataResourceId", dataResourceId);
-      return result;
+        Delegator delegator = dctx.getDelegator();
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
+        Map<String, Object> result = new HashMap<>();
+        Map<String, Object> newDrContext = new HashMap<>();
+        GenericValue dataResource = delegator.makeValue("DataResource");
+        dataResource.setPKFields(context);
+        dataResource.setNonPKFields(context);
+        dataResource.setAllFields(context, false, "dr", null);
+        context.putAll(dataResource);
+
+        GenericValue electronicText = delegator.makeValue("ElectronicText");
+        electronicText.setPKFields(context);
+        electronicText.setNonPKFields(context);
+        String textData = (String) electronicText.get("textData");
+
+
+        String dataResourceId = (String) dataResource.get("dataResourceId");
+        String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId");
+        if (Debug.infoOn()) {
+            Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, MODULE);
+        }
+        context.put("skipPermissionCheck", "granted"); // TODO: a temp hack because I don't want to bother with DataResource permissions at this time.
+        boolean dataResourceExists = true;
+        if (UtilValidate.isEmpty(dataResourceId)) {
+            dataResourceExists = false;
+        } else {
+            try {
+                GenericValue val = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne();
+                if (val == null) {
+                    dataResourceExists = false;
+                }
+            } catch (GenericEntityException e) {
+                return ServiceUtil.returnError(e.toString());
+            }
+        }
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        ModelService dataResourceModel = dispatcher.getDispatchContext().getModelService("updateDataResource");
+        Map<String, Object> ctx = dataResourceModel.makeValid(dataResource, ModelService.IN_PARAM);
+        newDrContext.putAll(ctx);
+        newDrContext.put("userLogin", userLogin);
+        newDrContext.put("skipPermissionCheck", context.get("skipPermissionCheck"));
+        ByteBuffer imageDataBytes = (ByteBuffer) context.get("imageData");
+        String mimeTypeId = (String) newDrContext.get("mimeTypeId");
+        if (imageDataBytes != null && (mimeTypeId == null || (mimeTypeId.indexOf("image") >= 0) || (mimeTypeId.indexOf("application") >= 0))) {
+            mimeTypeId = (String) context.get("_imageData_contentType");
+            if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
+                String fileName = (String) context.get("_imageData_fileName");
+                newDrContext.put("objectInfo", fileName);
+            }
+            newDrContext.put("mimeTypeId", mimeTypeId);
+        }
+
+        if (!dataResourceExists) { // Create
+            Map<String, Object> thisResult = dispatcher.runSync("createDataResource", newDrContext);
+            if (ServiceUtil.isError(thisResult)) {
+                throw (new GenericServiceException(ServiceUtil.getErrorMessage(thisResult)));
+            }
+            dataResourceId = (String) thisResult.get("dataResourceId");
+            if (Debug.infoOn()) {
+                Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, MODULE);
+            }
+            dataResource = (GenericValue) thisResult.get("dataResource");
+            Map<String, Object> fileContext = new HashMap<>();
+            fileContext.put("userLogin", userLogin);
+            if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
+                if (imageDataBytes != null) {
+                    fileContext.put("dataResourceId", dataResourceId);
+                    fileContext.put("imageData", imageDataBytes);
+                    thisResult = dispatcher.runSync("createImage", fileContext);
+                    if (ServiceUtil.isError(thisResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+                    }
+                }
+            } else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
+            } else if ("SURVEY".startsWith(dataResourceTypeId)) {
+            } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) {
+                Map<String, Object> uploadImage = new HashMap<>();
+                uploadImage.put("userLogin", userLogin);
+                uploadImage.put("dataResourceId", dataResourceId);
+                uploadImage.put("dataResourceTypeId", dataResourceTypeId);
+                uploadImage.put("rootDir", context.get("objectInfo"));
+                uploadImage.put("uploadedFile", imageDataBytes);
+                uploadImage.put("_uploadedFile_fileName", context.get("_imageData_fileName"));
+                uploadImage.put("_uploadedFile_contentType", context.get("_imageData_contentType"));
+                thisResult = dispatcher.runSync("attachUploadToDataResource", uploadImage);
+                if (ServiceUtil.isError(thisResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+                }
+            } else {
+                // assume ELECTRONIC_TEXT
+                if (UtilValidate.isNotEmpty(textData)) {
+                    fileContext.put("dataResourceId", dataResourceId);
+                    fileContext.put("textData", textData);
+                    thisResult = dispatcher.runSync("createElectronicText", fileContext);
+                    if (ServiceUtil.isError(thisResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+                    }
+                }
+            }
+        } else { // Update
+            Map<String, Object> thisResult = dispatcher.runSync("updateDataResource", newDrContext);
+            if (ServiceUtil.isError(thisResult)) {
+                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+            }
+            Map<String, Object> fileContext = new HashMap<>();
+            fileContext.put("userLogin", userLogin);
+            String forceElectronicText = (String) context.get("forceElectronicText");
+            if ("IMAGE_OBJECT".equals(dataResourceTypeId)) {
+                if (imageDataBytes != null || "true".equalsIgnoreCase(forceElectronicText)) {
+                    fileContext.put("dataResourceId", dataResourceId);
+                    fileContext.put("imageData", imageDataBytes);
+                    thisResult = dispatcher.runSync("updateImage", fileContext);
+                    if (ServiceUtil.isError(thisResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+                    }
+                }
+            } else if ("SHORT_TEXT".equals(dataResourceTypeId)) {
+            } else if ("SURVEY".startsWith(dataResourceTypeId)) {
+            } else if ("_FILE".indexOf(dataResourceTypeId) >= 0) {
+                Map<String, Object> uploadImage = new HashMap<>();
+                uploadImage.put("userLogin", userLogin);
+                uploadImage.put("dataResourceId", dataResourceId);
+                uploadImage.put("dataResourceTypeId", dataResourceTypeId);
+                uploadImage.put("rootDir", context.get("objectInfo"));
+                uploadImage.put("uploadedFile", imageDataBytes);
+                uploadImage.put("_uploadedFile_fileName", context.get("_imageData_fileName"));
+                uploadImage.put("_uploadedFile_contentType", context.get("_imageData_contentType"));
+                thisResult = dispatcher.runSync("attachUploadToDataResource", uploadImage);
+                if (ServiceUtil.isError(thisResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+                }
+            } else {
+                if (UtilValidate.isNotEmpty(textData) || "true".equalsIgnoreCase(forceElectronicText)) {
+                    fileContext.put("dataResourceId", dataResourceId);
+                    fileContext.put("textData", textData);
+                    thisResult = dispatcher.runSync("updateElectronicText", fileContext);
+                    if (ServiceUtil.isError(thisResult)) {
+                        return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult));
+                    }
+                }
+            }
+        }
+        result.put("dataResourceId", dataResourceId);
+        result.put("drDataResourceId", dataResourceId);
+        context.put("dataResourceId", dataResourceId);
+        return result;
     }
 
     public static void addRoleToUser(Delegator delegator, LocalDispatcher dispatcher, Map<String, Object> serviceContext) throws GenericServiceException, GenericEntityException {
@@ -703,7 +705,7 @@ public class ContentManagementServices {
         try {
             siteRoles = EntityQuery.use(delegator).from("RoleType").where("parentTypeId", "BLOG").cache().queryList();
         } catch (GenericEntityException e) {
-          return ServiceUtil.returnError(e.toString());
+            return ServiceUtil.returnError(e.toString());
         }
         for (GenericValue roleType : siteRoles) {
             String siteRole = (String) roleType.get("roleTypeId"); // BLOG_EDITOR, BLOG_ADMIN, etc.
@@ -827,12 +829,13 @@ public class ContentManagementServices {
             typeList = UtilMisc.toList("PUBLISH_LINK", "SUB_CONTENT");
         }
         EntityCondition conditionType = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList);
-        EntityCondition conditionMain = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("contentIdTo", EntityOperator.EQUALS, contentIdTo), conditionType), EntityOperator.AND);
+        EntityCondition conditionMain = EntityCondition.makeCondition(UtilMisc.toList(EntityCondition.makeCondition("contentIdTo",
+            EntityOperator.EQUALS, contentIdTo), conditionType), EntityOperator.AND);
         try {
             List<GenericValue> listAll = EntityQuery.use(delegator).from("ContentAssoc")
-                    .where(conditionMain)
-                    .orderBy("sequenceNum", "fromDate", "createdDate")
-                    .filterByDate().queryList();
+                .where(conditionMain)
+                .orderBy("sequenceNum", "fromDate", "createdDate")
+                .filterByDate().queryList();
             String contentId = (String) context.get("contentId");
             String dir = (String) context.get("dir");
             int seqNum = seqIncrement;
@@ -847,7 +850,7 @@ public class ContentManagementServices {
                             if (i > 0) {
                                 // Swap with previous entry
                                 try {
-                                    GenericValue prevValue = listAll.get(i-1);
+                                    GenericValue prevValue = listAll.get(i - 1);
                                     Long prevSeqNum = (Long) prevValue.get("sequenceNum");
                                     prevValue.put("sequenceNum", (long) seqNum);
                                     prevValue.store();
@@ -860,7 +863,7 @@ public class ContentManagementServices {
                         } else {
                             if (i < listAll.size()) {
                                 // Swap with next entry
-                                GenericValue nextValue = listAll.get(i+1);
+                                GenericValue nextValue = listAll.get(i + 1);
                                 nextValue.put("sequenceNum", (long) seqNum);
                                 nextValue.store();
                                 seqNum += seqIncrement;
@@ -990,7 +993,8 @@ public class ContentManagementServices {
         try {
             thisContent = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
             if (thisContent == null) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale));
+                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId),
+                    locale));
             }
             thisContent.set("contentTypeId", contentTypeId);
             thisContent.store();
@@ -1031,7 +1035,7 @@ public class ContentManagementServices {
             thisContent = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
             if (thisContent == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE,
-                        "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale));
+                    "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale));
             }
             thisContent.set("contentTypeId", "OUTLINE_NODE");
             thisContent.store();
@@ -1042,7 +1046,8 @@ public class ContentManagementServices {
                 } else {
                     kidContent.put("contentTypeId", "PAGE_NODE");
                     kidContent.store();
-                    List<GenericValue> kids2 = ContentWorker.getAssociatedContent(kidContent, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null);
+                    List<GenericValue> kids2 = ContentWorker.getAssociatedContent(kidContent, "from", UtilMisc.toList("SUB_CONTENT"), null, null,
+                        null);
                     for (GenericValue kidContent2 : kids2) {
                         updatePageNodeChildren(kidContent2, context);
                     }
@@ -1156,13 +1161,13 @@ public class ContentManagementServices {
         Delegator delegator = dctx.getDelegator();
         String contentIdTo = (String) context.get("contentId");
         try {
-             List<GenericValue> lst = EntityQuery.use(delegator).from("ContentAssocDataResourceViewFrom")
-                     .where("caContentIdTo", contentIdTo,
-                             "caContentAssocTypeId", "SUB_CONTENT",
-                             "caThruDate", null)
-                     .orderBy("caSequenceNum", "caFromDate", "createdDate")
-                     .queryList();
-             results.put("_LIST_", lst);
+            List<GenericValue> lst = EntityQuery.use(delegator).from("ContentAssocDataResourceViewFrom")
+                .where("caContentIdTo", contentIdTo,
+                    "caContentAssocTypeId", "SUB_CONTENT",
+                    "caThruDate", null)
+                .orderBy("caSequenceNum", "caFromDate", "createdDate")
+                .queryList();
+            results.put("_LIST_", lst);
         } catch (GenericEntityException e) {
             Debug.logError(e, MODULE);
             return ServiceUtil.returnError(e.toString());
@@ -1215,7 +1220,8 @@ public class ContentManagementServices {
         try {
             GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne();
             if (content == null) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale));
+                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId),
+                    locale));
             }
             Long leafCount = (Long) content.get("childLeafCount");
             if (leafCount == null) {
@@ -1224,7 +1230,8 @@ public class ContentManagementServices {
             int changeLeafCount = leafCount.intValue() + 1;
             int changeBranchCount = 1;
 
-            ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount, changeLeafCount);
+            ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount,
+                changeLeafCount);
         } catch (GenericEntityException e) {
             return ServiceUtil.returnError(e.toString());
         }
@@ -1241,7 +1248,8 @@ public class ContentManagementServices {
         try {
             GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne();
             if (content == null) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale));
+                return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId),
+                    locale));
             }
             Long leafCount = (Long) content.get("childLeafCount");
             if (leafCount == null) {
@@ -1250,7 +1258,8 @@ public class ContentManagementServices {
             int changeLeafCount = -1 * leafCount.intValue() - 1;
             int changeBranchCount = -1;
 
-            ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount, changeLeafCount);
+            ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount,
+                changeLeafCount);
         } catch (GenericEntityException e) {
             return ServiceUtil.returnError(e.toString());
         }
@@ -1294,10 +1303,10 @@ public class ContentManagementServices {
         GenericValue contentRole = null;
         try {
             contentRole = EntityQuery.use(delegator).from("ContentRole")
-                    .where("partyId", partyId, "contentId", webPubPt, "roleTypeId", roleTypeId)
-                    .orderBy("fromDate DESC")
-                    .cache().filterByDate()
-                    .queryFirst();
+                .where("partyId", partyId, "contentId", webPubPt, "roleTypeId", roleTypeId)
+                .orderBy("fromDate DESC")
+                .cache().filterByDate()
+                .queryFirst();
             if (contentRole != null) {
                 hasExistingContentRole = true;
             }
@@ -1319,7 +1328,8 @@ public class ContentManagementServices {
             thruDate = nowTimestamp;
         } else {
             // there is a thru date... if it is in the past, bring it up to NOW before adding on the time period
-            //don't want to penalize for skipping time, in other words if they had a subscription last year for a month and buy another month, we want that second month to start now and not last year
+            //don't want to penalize for skipping time, in other words if they had a subscription last year for a month and buy another month, we
+            // want that second month to start now and not last year
             if (thruDate.before(nowTimestamp)) {
                 thruDate = nowTimestamp;
             }
@@ -1374,13 +1384,14 @@ public class ContentManagementServices {
         }
 
         GenericValue productContent = null;
-           try {
+        try {
             List<GenericValue> lst = EntityQuery.use(delegator).from("ProductContent")
-                    .where("productId", productId, "productContentTypeId", "ONLINE_ACCESS")
-                    .orderBy("purchaseFromDate", "purchaseThruDate")
-                    .filterByDate("purchaseFromDate", "purchaseThruDate")
-                    .cache().queryList();
-            List<GenericValue> listThrusOnly = EntityUtil.filterOutByCondition(lst, EntityCondition.makeCondition("purchaseThruDate", EntityOperator.EQUALS, null));
+                .where("productId", productId, "productContentTypeId", "ONLINE_ACCESS")
+                .orderBy("purchaseFromDate", "purchaseThruDate")
+                .filterByDate("purchaseFromDate", "purchaseThruDate")
+                .cache().queryList();
+            List<GenericValue> listThrusOnly = EntityUtil.filterOutByCondition(lst, EntityCondition.makeCondition("purchaseThruDate",
+                EntityOperator.EQUALS, null));
             if (listThrusOnly.size() > 0) {
                 productContent = listThrusOnly.get(0);
             } else if (lst.size() > 0) {
@@ -1426,8 +1437,8 @@ public class ContentManagementServices {
         GenericValue orderHeader = null;
         try {
             GenericValue orderRole = EntityQuery.use(delegator).from("OrderRole")
-                    .where("orderId", orderId, "roleTypeId", "END_USER_CUSTOMER")
-                    .queryFirst();
+                .where("orderId", orderId, "roleTypeId", "END_USER_CUSTOMER")
+                .queryFirst();
             if (orderRole != null) {
                 String partyId = (String) orderRole.get("partyId");
                 context.put("partyId", partyId);
@@ -1438,7 +1449,7 @@ public class ContentManagementServices {
             }
             orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
             if (orderHeader == null) {
-            	 String msg = UtilProperties.getMessage(RESOURCE, "ContentNoOrderHeaderFound", UtilMisc.toMap("orderId", orderId), locale);
+                String msg = UtilProperties.getMessage(RESOURCE, "ContentNoOrderHeaderFound", UtilMisc.toMap("orderId", orderId), locale);
                 return ServiceUtil.returnError(msg);
             }
             Timestamp orderCreatedDate = (Timestamp) orderHeader.get("orderDate");
@@ -1449,8 +1460,8 @@ public class ContentManagementServices {
                 BigDecimal qty = orderItem.getBigDecimal("quantity");
                 String productId = (String) orderItem.get("productId");
                 long productContentCount = EntityQuery.use(delegator).from("ProductContent")
-                        .where("productId", productId, "productContentTypeId", "ONLINE_ACCESS")
-                        .filterByDate().queryCount();
+                    .where("productId", productId, "productContentTypeId", "ONLINE_ACCESS")
+                    .filterByDate().queryCount();
                 if (productContentCount > 0) {
                     context.put("productId", productId);
                     context.put("quantity", qty.intValue());
@@ -1483,7 +1494,7 @@ public class ContentManagementServices {
         String contentAssocTypeId = (String) context.get("contentAssocTypeId");
         List<String> contentAssocTypeIdList = new LinkedList<>();
         if (UtilValidate.isNotEmpty(contentAssocTypeId)) {
-             contentAssocTypeIdList = StringUtil.split(contentAssocTypeId, "|");
+            contentAssocTypeIdList = StringUtil.split(contentAssocTypeId, "|");
         }
         if (contentAssocTypeIdList.size() == 0) {
             contentAssocTypeIdList.add("SUB_CONTENT");
@@ -1501,7 +1512,9 @@ public class ContentManagementServices {
         }
         return result;
     }
-    public static Map<String, Object> followNodeChildrenMethod(GenericValue content,  LocalDispatcher dispatcher, String serviceName, Map<String, Object> context) throws GenericEntityException, GenericServiceException {
+
+    public static Map<String, Object> followNodeChildrenMethod(GenericValue content, LocalDispatcher dispatcher, String serviceName, Map<String,
+        Object> context) throws GenericEntityException, GenericServiceException {
         Map<String, Object> result = null;
         String contentId = content.getString("contentId");
         List<String> contentAssocTypeIdList = UtilGenerics.cast(context.get("contentAssocTypeIdList"));
@@ -1532,70 +1545,69 @@ public class ContentManagementServices {
         return result;
     }
 
-  public static Map<String, Object> persistContentWithRevision(DispatchContext dctx, Map<String, ? extends Object> context) {
-      Map<String, Object> result = null;
-      Delegator delegator = dctx.getDelegator();
-      LocalDispatcher dispatcher = dctx.getDispatcher();
-      GenericValue dataResource = null;
-      String masterRevisionContentId = (String) context.get("masterRevisionContentId");
-      String oldDataResourceId = (String) context.get("drDataResourceId");
-      if (UtilValidate.isEmpty(oldDataResourceId)) {
-          oldDataResourceId = (String) context.get("dataResourceId");
-      }
-      if (UtilValidate.isNotEmpty(oldDataResourceId)) {
-          try {
-              dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", oldDataResourceId).queryOne();
-          } catch (GenericEntityException e) {
-              Debug.logError(e.toString(), MODULE);
-              return ServiceUtil.returnError(e.toString());
-          }
-      }
-
-      try {
-          ModelService persistContentAndAssocModel = dispatcher.getDispatchContext().getModelService("persistContentAndAssoc");
-          Map<String, Object> ctx = persistContentAndAssocModel.makeValid(context, ModelService.IN_PARAM);
-          if (dataResource != null) {
-              ctx.remove("dataResourceId");
-              ctx.remove("drDataResourceId");
-          }
-          result = dispatcher.runSync("persistContentAndAssoc", ctx);
-          if (ServiceUtil.isError(result)) {
-              return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
-          }
-          String contentId = (String) result.get("contentId");
-          List<String> parentList = new LinkedList<>();
-          if (UtilValidate.isEmpty(masterRevisionContentId)) {
-              Map<String, Object> traversMap = new HashMap<>();
-              traversMap.put("contentId", contentId);
-              traversMap.put("direction", "To");
-              traversMap.put("contentAssocTypeId", "COMPDOC_PART");
-              Map<String, Object> traversResult = dispatcher.runSync("traverseContent", traversMap);
-              if (ServiceUtil.isError(traversResult)) {
-                  return ServiceUtil.returnError(ServiceUtil.getErrorMessage(traversResult));
-              }
-              parentList = UtilGenerics.cast(traversResult.get("parentList"));
-          } else {
-              parentList.add(masterRevisionContentId);
-          }
-
-          // Update ContentRevision and ContentRevisonItem
-          Map<String, Object> contentRevisionMap = new HashMap<>();
-          contentRevisionMap.put("itemContentId", contentId);
-          contentRevisionMap.put("newDataResourceId", result.get("dataResourceId"));
-          contentRevisionMap.put("oldDataResourceId", oldDataResourceId);
-          // need committedByPartyId
-          for (String thisContentId : parentList) {
-              contentRevisionMap.put("contentId", thisContentId);
-              result = dispatcher.runSync("persistContentRevisionAndItem", contentRevisionMap);
-              if (ServiceUtil.isError(result)) {
-                  return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
-              }
-          }
-      } catch (GenericServiceException e) {
-          Debug.logError(e.toString(), MODULE);
-          return ServiceUtil.returnError(e.toString());
-      }
-      return result;
-  }
+    public static Map<String, Object> persistContentWithRevision(DispatchContext dctx, Map<String, ? extends Object> context) {
+        Map<String, Object> result = null;
+        Delegator delegator = dctx.getDelegator();
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        GenericValue dataResource = null;
+        String masterRevisionContentId = (String) context.get("masterRevisionContentId");
+        String oldDataResourceId = (String) context.get("drDataResourceId");
+        if (UtilValidate.isEmpty(oldDataResourceId)) {
+            oldDataResourceId = (String) context.get("dataResourceId");
+        }
+        if (UtilValidate.isNotEmpty(oldDataResourceId)) {
+            try {
+                dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", oldDataResourceId).queryOne();
+            } catch (GenericEntityException e) {
+                Debug.logError(e.toString(), MODULE);
+                return ServiceUtil.returnError(e.toString());
+            }
+        }
+
+        try {
+            ModelService persistContentAndAssocModel = dispatcher.getDispatchContext().getModelService("persistContentAndAssoc");
+            Map<String, Object> ctx = persistContentAndAssocModel.makeValid(context, ModelService.IN_PARAM);
+            if (dataResource != null) {
+                ctx.remove("dataResourceId");
+                ctx.remove("drDataResourceId");
+            }
+            result = dispatcher.runSync("persistContentAndAssoc", ctx);
+            if (ServiceUtil.isError(result)) {
+                return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+            }
+            String contentId = (String) result.get("contentId");
+            List<String> parentList = new LinkedList<>();
+            if (UtilValidate.isEmpty(masterRevisionContentId)) {
+                Map<String, Object> traversMap = new HashMap<>();
+                traversMap.put("contentId", contentId);
+                traversMap.put("direction", "To");
+                traversMap.put("contentAssocTypeId", "COMPDOC_PART");
+                Map<String, Object> traversResult = dispatcher.runSync("traverseContent", traversMap);
+                if (ServiceUtil.isError(traversResult)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(traversResult));
+                }
+                parentList = UtilGenerics.cast(traversResult.get("parentList"));
+            } else {
+                parentList.add(masterRevisionContentId);
+            }
 
+            // Update ContentRevision and ContentRevisonItem
+            Map<String, Object> contentRevisionMap = new HashMap<>();
+            contentRevisionMap.put("itemContentId", contentId);
+            contentRevisionMap.put("newDataResourceId", result.get("dataResourceId"));
+            contentRevisionMap.put("oldDataResourceId", oldDataResourceId);
+            // need committedByPartyId
+            for (String thisContentId : parentList) {
+                contentRevisionMap.put("contentId", thisContentId);
+                result = dispatcher.runSync("persistContentRevisionAndItem", contentRevisionMap);
+                if (ServiceUtil.isError(result)) {
+                    return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+                }
+            }
+        } catch (GenericServiceException e) {
+            Debug.logError(e.toString(), MODULE);
+            return ServiceUtil.returnError(e.toString());
+        }
+        return result;
+    }
 }
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 3e065be..218dc35 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
@@ -21,7 +21,6 @@ package org.apache.ofbiz.content;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -90,14 +89,14 @@ public final class ContentManagementWorker {
         mruAddByEntityName(entityName, pk, lookupCaches);
     }
 
-   /**
-    * Makes an entry in the "most recently used" cache. It picks the cache
-    * by the entity name and builds a signature from the primary key values.
-    *
-    * @param entityName
-    * @param lookupCaches
-    * @param pk either a GenericValue or GenericPK - populated
-    */
+    /**
+     * Makes an entry in the "most recently used" cache. It picks the cache
+     * by the entity name and builds a signature from the primary key values.
+     *
+     * @param entityName
+     * @param lookupCaches
+     * @param pk           either a GenericValue or GenericPK - populated
+     */
     public static void mruAddByEntityName(String entityName, GenericEntity pk, Map<String, LifoSet<Object>> lookupCaches) {
         String cacheEntityName = entityName;
         LifoSet<Object> lkupCache = lookupCaches.get(cacheEntityName);
@@ -124,12 +123,12 @@ public final class ContentManagementWorker {
     }
 
 
-   /**
-    * Builds a string signature from a GenericValue or GenericPK.
-    *
-    * @param pk either a populated GenericValue or GenericPK.
-    * @param suffix a string that can be used to distinguish the signature (probably not used).
-    */
+    /**
+     * Builds a string signature from a GenericValue or GenericPK.
+     *
+     * @param pk     either a populated GenericValue or GenericPK.
+     * @param suffix a string that can be used to distinguish the signature (probably not used).
+     */
     public static String buildPKSig(GenericEntity pk, String suffix) {
         StringBuilder sig = new StringBuilder("");
         Collection<String> keyColl = pk.getPrimaryKey().getAllKeys();
@@ -278,7 +277,9 @@ 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 {
+    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
@@ -296,12 +297,13 @@ public final class ContentManagementWorker {
             List<String> roles = StringUtil.split(passedRoles, "|");
             List<String> targetOperationList = new LinkedList<>();
             if (UtilValidate.isEmpty(permittedOperations)) {
-                 targetOperationList.add("CONTENT" + entityAction);
+                targetOperationList.add("CONTENT" + entityAction);
             } else {
-                 targetOperationList = StringUtil.split(permittedOperations, "|");
+                targetOperationList = StringUtil.split(permittedOperations, "|");
             }
             Map<String, Object> results = null;
-            results = EntityPermissionChecker.checkPermission(content, statusId, userLogin, passedPurposes, targetOperationList, roles, delegator, security, entityAction);
+            results = EntityPermissionChecker.checkPermission(content, statusId, userLogin, passedPurposes, targetOperationList, roles, delegator,
+                security, entityAction);
             String permissionStatus = (String) results.get("permissionStatus");
             if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) {
                 String[] arr = {contentId, templateTitle};
@@ -312,26 +314,26 @@ public final class ContentManagementWorker {
     }
 
     /**
-     Returns a list of WebSitePublishPoint entities that are children of parentPubPt
-     The name should be "getAllTopLevelPublishPoints" or "getAllChildPublishPoints"
-
-     @param parentPubPt The parent publish point.
+     * Returns a list of WebSitePublishPoint entities that are children of parentPubPt
+     * The name should be "getAllTopLevelPublishPoints" or "getAllChildPublishPoints"
+     *
+     * @param parentPubPt The parent publish point.
      */
     public static List<GenericValue> getAllPublishPoints(Delegator delegator, String parentPubPt) throws GeneralException {
         List<GenericValue> relatedPubPts = null;
         try {
             relatedPubPts = EntityQuery.use(delegator).from("ContentAssoc")
-                    .where("contentIdTo", parentPubPt, "contentAssocTypeId", "SUBSITE")
-                    .cache().queryList();
+                .where("contentIdTo", parentPubPt, "contentAssocTypeId", "SUBSITE")
+                .cache().queryList();
         } catch (GenericEntityException e) {
             throw new GeneralException(e.getMessage());
         }
         List<GenericValue> allPublishPoints = new LinkedList<>();
         GenericValue webSitePublishPoint = null;
         for (GenericValue contentAssoc : relatedPubPts) {
-           String pub = (String) contentAssoc.get("contentId");
-           webSitePublishPoint = getWebSitePublishPoint(delegator, pub, false);
-           allPublishPoints.add(webSitePublishPoint);
+            String pub = (String) contentAssoc.get("contentId");
+            webSitePublishPoint = getWebSitePublishPoint(delegator, pub, false);
+            allPublishPoints.add(webSitePublishPoint);
         }
         return allPublishPoints;
     }
@@ -340,8 +342,8 @@ 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");
-           publishPointMap.put(pub, webSitePublishPoint);
+            String pub = (String) webSitePublishPoint.get("contentId");
+            publishPointMap.put(pub, webSitePublishPoint);
         }
         return publishPointMap;
     }
@@ -350,22 +352,23 @@ 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");
-           publishPointMap.put(pub, webSitePublishPoint);
-           getAllPublishPointMap(delegator, pub, publishPointMap);
+            String pub = (String) webSitePublishPoint.get("contentId");
+            publishPointMap.put(pub, webSitePublishPoint);
+            getAllPublishPointMap(delegator, pub, publishPointMap);
         }
     }
 
     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");
-           publishPointMap.put(pub, webSitePublishPoint);
+            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();
@@ -401,7 +404,7 @@ public final class ContentManagementWorker {
     }
 
     public static GenericValue getWebSitePublishPoint(Delegator delegator, String contentId) throws GenericEntityException {
-           return getWebSitePublishPoint(delegator, contentId, false);
+        return getWebSitePublishPoint(delegator, contentId, false);
     }
 
     public static GenericValue getWebSitePublishPoint(Delegator delegator, String contentId, boolean ignoreCache) throws GenericEntityException {
@@ -448,8 +451,8 @@ public final class ContentManagementWorker {
     public static String getParentWebSitePublishPointId(Delegator delegator, String contentId) throws GenericEntityException {
         String contentIdTo = null;
         GenericValue contentAssoc = EntityQuery.use(delegator).from("ContentAssoc")
-                .where("contentId", contentId, "contentAssocTypeId", "SUBSITE")
-                .filterByDate().cache().queryFirst();
+            .where("contentId", contentId, "contentAssocTypeId", "SUBSITE")
+            .filterByDate().cache().queryFirst();
         if (contentAssoc != null) {
             contentIdTo = contentAssoc.getString("contentIdTo");
         }
@@ -469,11 +472,13 @@ 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) {
@@ -495,8 +500,8 @@ public final class ContentManagementWorker {
         List<GenericValue> assocValueList = null;
         try {
             assocValueList = EntityQuery.use(delegator).from("ContentAssoc")
-                    .where("contentId", targContentId, "contentAssocTypeId", "PUBLISH_LINK")
-                    .filterByDate().cache().queryList();
+                .where("contentId", targContentId, "contentAssocTypeId", "PUBLISH_LINK")
+                .filterByDate().cache().queryList();
         } catch (GenericEntityException e) {
             throw new GeneralException(e.getMessage());
         }
@@ -538,7 +543,8 @@ public final class ContentManagementWorker {
             List<String> assocTypes = UtilMisc.toList("AUTHOR");
             // TODO check if we want contentTypes to be filled/used, else this should be removed
             List<String> contentTypes = null;
-            Map<String, Object> results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, null, "To", null, null, assocTypes, contentTypes, Boolean.TRUE, null, null);
+            Map<String, Object> results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, null, "To",
+                null, null, assocTypes, contentTypes, Boolean.TRUE, null, null);
             List<GenericValue> valueList = UtilGenerics.cast(results.get("entityList"));
             if (valueList.size() > 0) {
                 GenericValue value = valueList.get(0);
@@ -553,7 +559,9 @@ 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 {
+    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
@@ -569,12 +577,13 @@ public final class ContentManagementWorker {
             List<String> roles = StringUtil.split(passedRoles, "|");
             List<String> targetOperationList = new LinkedList<>();
             if (UtilValidate.isEmpty(permittedOperations)) {
-                 targetOperationList.add("CONTENT" + entityAction);
+                targetOperationList.add("CONTENT" + entityAction);
             } else {
-                 targetOperationList = StringUtil.split(permittedOperations, "|");
+                targetOperationList = StringUtil.split(permittedOperations, "|");
             }
             Map<String, Object> results = null;
-            results = EntityPermissionChecker.checkPermission(content, statusId, userLogin, passedPurposes, targetOperationList, roles, delegator, security, entityAction);
+            results = EntityPermissionChecker.checkPermission(content, statusId, userLogin, passedPurposes, targetOperationList, roles, delegator,
+                security, entityAction);
             String permissionStatus = (String) results.get("permissionStatus");
             if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) {
                 String[] arr = {contentId, contentName};
@@ -585,17 +594,17 @@ public final class ContentManagementWorker {
     }
 
     /**
-     Returns a list of "department" (having ContentAssoc of type "DEPARTMENT")
-     Content entities that are children of parentPubPt
-
-     @param parentPubPt The parent publish point.
+     * Returns a list of "department" (having ContentAssoc of type "DEPARTMENT")
+     * Content entities that are children of parentPubPt
+     *
+     * @param parentPubPt The parent publish point.
      */
     public static List<GenericValue> getAllDepartmentContent(Delegator delegator, String parentPubPt) throws GeneralException {
         List<GenericValue> relatedPubPts = null;
         try {
             relatedPubPts = EntityQuery.use(delegator).from("ContentAssoc")
-                    .where("contentIdTo", parentPubPt, "contentAssocTypeId", "DEPARTMENT")
-                    .cache().queryList();
+                .where("contentIdTo", parentPubPt, "contentAssocTypeId", "DEPARTMENT")
+                .cache().queryList();
 
         } catch (GenericEntityException e) {
             throw new GeneralException(e.getMessage());
@@ -603,9 +612,9 @@ public final class ContentManagementWorker {
         List<GenericValue> allDepartmentPoints = new LinkedList<>();
         GenericValue departmentContent = null;
         for (GenericValue contentAssoc : relatedPubPts) {
-           String pub = (String) contentAssoc.get("contentId");
-           departmentContent = EntityQuery.use(delegator).from("Content").where("contentId", pub).cache().queryOne();
-           allDepartmentPoints.add(departmentContent);
+            String pub = (String) contentAssoc.get("contentId");
+            departmentContent = EntityQuery.use(delegator).from("Content").where("contentId", pub).cache().queryOne();
+            allDepartmentPoints.add(departmentContent);
         }
         return allDepartmentPoints;
     }
@@ -625,17 +634,17 @@ public final class ContentManagementWorker {
         if (thisContent == null)
             throw new RuntimeException("No entity found for id=" + contentId);
 
-       List<EntityCondition> conditionMain = new ArrayList<>();
-       conditionMain.add(EntityCondition.makeCondition("contentIdTo", contentId));
-       if (typeList.size() > 0) {
-           conditionMain.add(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList));
-       }
-       List<GenericValue> contentAssocs = EntityQuery.use(delegator).from("ContentAssoc").where(conditionMain)
-               .filterByDate().cache().queryList();
-       for (GenericValue contentAssoc : contentAssocs) {
-           String subContentId = contentAssoc.getString("contentId");
-           subLeafCount += updateStatsTopDown(delegator, subContentId, typeList);
-       }
+        List<EntityCondition> conditionMain = new ArrayList<>();
+        conditionMain.add(EntityCondition.makeCondition("contentIdTo", contentId));
+        if (typeList.size() > 0) {
+            conditionMain.add(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList));
+        }
+        List<GenericValue> contentAssocs = EntityQuery.use(delegator).from("ContentAssoc").where(conditionMain)
+            .filterByDate().cache().queryList();
+        for (GenericValue contentAssoc : contentAssocs) {
+            String subContentId = contentAssoc.getString("contentId");
+            subLeafCount += updateStatsTopDown(delegator, subContentId, typeList);
+        }
 
         // If no children, count this as a leaf
         if (subLeafCount == 0)
@@ -647,15 +656,16 @@ public final class ContentManagementWorker {
         return subLeafCount;
     }
 
-    public static void updateStatsBottomUp(Delegator delegator, String contentId, List<String> typeList, int branchChangeAmount, int leafChangeAmount) throws GenericEntityException {
+    public static void updateStatsBottomUp(Delegator delegator, String contentId, List<String> typeList, int branchChangeAmount,
+                                           int leafChangeAmount) throws GenericEntityException {
         GenericValue thisContent = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
         if (thisContent == null)
             throw new RuntimeException("No entity found for id=" + contentId);
 
         List<GenericValue> contentAssocs = EntityQuery.use(delegator).from("ContentAssoc")
-                .where(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList),
-                        EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId))
-                .cache().filterByDate().queryList();
+            .where(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList),
+                EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId))
+            .cache().filterByDate().queryList();
         for (GenericValue contentAssoc : contentAssocs) {
             String contentIdTo = contentAssoc.getString("contentIdTo");
             GenericValue contentTo = EntityQuery.use(delegator).from("Content").where("contentId", contentIdTo).queryOne();
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
index 6aea602..fa1235e 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
@@ -57,8 +57,7 @@ public class ContentJsonEvents {
 
         EntityCondition condition = EntityCondition.makeCondition(
             EntityCondition.makeCondition(UtilMisc.toMap("contentId", contentId)),
-            EntityUtil.getFilterByDateExpr()
-            );
+            EntityUtil.getFilterByDateExpr());
         List<GenericValue> assocs = delegator.findList("ContentAssoc", condition, null, null, null, false);
 
         List<Map<String, Object>> nodes = new LinkedList<>();
@@ -135,8 +134,7 @@ public class ContentJsonEvents {
         Timestamp now = UtilDateTime.nowTimestamp();
         EntityCondition condition = EntityCondition.makeCondition(
             EntityCondition.makeCondition(UtilMisc.toMap("contentIdTo", contentId)),
-            EntityUtil.getFilterByDateExpr()
-        );
+            EntityUtil.getFilterByDateExpr());
         List<GenericValue> assocs = delegator.findList("ContentAssoc", condition, null, null, null, true);
         for (GenericValue assoc : assocs) {
             assoc.set("thruDate", now);
@@ -149,8 +147,7 @@ public class ContentJsonEvents {
         Timestamp now = UtilDateTime.nowTimestamp();
         EntityCondition condition = EntityCondition.makeCondition(
             EntityCondition.makeCondition(UtilMisc.toMap("contentId", contentId)),
-            EntityUtil.getFilterByDateExpr()
-        );
+            EntityUtil.getFilterByDateExpr());
         List<GenericValue> pathAliases = delegator.findList("WebSitePathAlias", condition, null, null, null, true);
         for (GenericValue alias : pathAliases) {
             alias.set("thruDate", now);
@@ -172,16 +169,13 @@ public class ContentJsonEvents {
             }
         }
 
-        Map<String, Object> data = UtilMisc.toMap(
-            "title", (Object) contentName
-        );
+        Map<String, Object> data = UtilMisc.toMap("title", (Object) contentName);
 
         Map<String, Object> attr = UtilMisc.toMap(
             "id", assoc.get("contentIdTo"),
             "contentId", assoc.get("contentId"),
             "fromDate", assoc.getTimestamp("fromDate").toString(),
-            "contentAssocTypeId", assoc.get("contentAssocTypeId")
-        );
+            "contentAssocTypeId", assoc.get("contentAssocTypeId"));
 
         Map<String, Object> node = UtilMisc.toMap("data", (Object) data, "attr", (Object) attr);
 
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 8efb19c..de484f5 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
@@ -243,9 +243,7 @@ public class DataServices {
 
         // write the data to the file
         if (UtilValidate.isNotEmpty(textData)) {
-            try (
-                OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
-            ) {
+            try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);) {
                 out.write(textData);
             } catch (IOException e) {
                 Debug.logWarning(e, MODULE);
@@ -432,9 +430,7 @@ public class DataServices {
 
             // write the data to the file
             if (UtilValidate.isNotEmpty(textData)) {
-                try (
-                        OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
-                ) {
+                try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);) {
                     out.write(textData);
                 } catch (IOException e) {
                     Debug.logWarning(e, MODULE);
@@ -599,9 +595,7 @@ public class DataServices {
             Debug.logInfo("in createBinaryFileMethod, imageData:" + imageData.length, MODULE);
         }
         if (imageData != null && imageData.length > 0) {
-            try (
-                FileOutputStream out = new FileOutputStream(file);
-            ) {
+            try (FileOutputStream out = new FileOutputStream(file);) {
                 out.write(imageData);
                 if (Debug.infoOn()) {
                     Debug.logInfo("in createBinaryFileMethod, length:" + file.length(), MODULE);
@@ -652,9 +646,7 @@ public class DataServices {
             Debug.logInfo("in updateBinaryFileMethod, imageData:" + Arrays.toString(imageData), MODULE);
         }
         if (imageData != null && imageData.length > 0) {
-            try (
-                    FileOutputStream out = new FileOutputStream(file);
-                    ) {
+            try (FileOutputStream out = new FileOutputStream(file);) {
                 out.write(imageData);
                 if (Debug.infoOn()) {
                     Debug.logInfo("in updateBinaryFileMethod, length:" + file.length(), MODULE);
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java
index b74dbef..5746a5f 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/ftp/FtpServices.java
@@ -53,15 +53,15 @@ public class FtpServices {
             throws GeneralException {
         FtpClientInterface ftpClient = null;
         switch (serverType) {
-            case "ftp":
-                ftpClient = new SimpleFtpClient();
-                break;
-            case "ftps":
-                //TODO : to implements
-                throw new GeneralException("Ftp secured transfer protocol not yet implemented");
-            case "sftp":
-                ftpClient = new SshFtpClient();
-                break;
+        case "ftp":
+            ftpClient = new SimpleFtpClient();
+            break;
+        case "ftps":
+            //TODO : to implements
+            throw new GeneralException("Ftp secured transfer protocol not yet implemented");
+        case "sftp":
+            ftpClient = new SshFtpClient();
+            break;
         }
         return ftpClient;
     }
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 460f3d4..33952a9 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
@@ -225,8 +225,7 @@ public class SurveyWrapper {
         Template template = null;
         try (
             InputStream templateStream = templateUrl.openStream();
-            InputStreamReader templateReader = new InputStreamReader(templateStream, StandardCharsets.UTF_8);
-                ) {
+            InputStreamReader templateReader = new InputStreamReader(templateStream, StandardCharsets.UTF_8);) {
             template = new Template(templateUrl.toExternalForm(), templateReader, config);
         } catch (IOException e) {
             Debug.logError(e, "Unable to get template from URL :" + templateUrl.toExternalForm(), MODULE);
@@ -372,7 +371,7 @@ public class SurveyWrapper {
             for (String key : passThru.keySet()) {
                 if (key.toUpperCase(Locale.getDefault()).startsWith("ANSWERS_")) {
                     int splitIndex = key.indexOf('_');
-                    String questionId = key.substring(splitIndex+1);
+                    String questionId = key.substring(splitIndex + 1);
                     Map<String, Object> thisAnswer = new HashMap<>();
                     String answer = (String) passThru.remove(key);
                     thisAnswer.put("booleanResponse", answer);
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 56cf917..0e95355 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,7 @@ 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[] SAVE_KEY_NAMES = {"globalNodeTrail", "nodeTrail", "mode", "purposeTypeId", "statusId", "entityOperation", "targetOperation" };
 
     /**
      * @deprecated use FreeMarkerWorker.getWrappedObject()
@@ -179,7 +178,7 @@ public class CheckPermissionTransform implements TemplateTransformModel {
                 }
 
                 if (permissionStatus != null && "granted".equalsIgnoreCase(permissionStatus)) {
-                    FreeMarkerWorker.saveContextValues(templateCtx, saveKeyNames, savedValues);
+                    FreeMarkerWorker.saveContextValues(templateCtx, SAVE_KEY_NAMES, savedValues);
                     if (mode == null || !"not-equals".equalsIgnoreCase(mode)) {
                         return TransformControl.EVALUATE_BODY;
                     }
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 b0de1f2..c813ef7 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
@@ -46,8 +46,9 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel {
 
     private static final String MODULE = InjectNodeTrailCsvTransform.class.getName();
 
-    static final String[] saveKeyNames = {"nodeTrailCsv", "globalNodeTrail", "nodeTrail" };
-    static final String[] removeKeyNames = {"nodeTrailCsv" };
+    //TODO: Not being used, should be removed.
+    static final String[] SAVE_KEY_NAMES = {"nodeTrailCsv", "globalNodeTrail", "nodeTrail" };
+    static final String[] REMOVE_KEY_NAMES = {"nodeTrailCsv" };
 
     /**
      * @deprecated use FreeMarkerWorker.getWrappedObject()
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 834188d..2f219c6 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,9 @@ 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[] SAVE_KEY_NAMES = {"contentId", "subContentId", "mimeType", "subContentDataResourceView", "wrapTemplateId",
+            "templateContentId", "pickWhen", "followWhen", "returnAfterPickWhen", "returnBeforePickWhen", "indent"};
+    public static final String[] REMOVE_KEY_NAMES = {"templateContentId", "subDataResourceTypeId", "mapKey", "wrappedFTL", "nodeTrail"};
 
     /**
      * @deprecated use FreeMarkerWorker.getWrappedObject()
@@ -86,7 +87,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel {
         final StringBuilder buf = new StringBuilder();
         final Environment env = Environment.getCurrentEnvironment();
         final Map<String, Object> templateCtx = FreeMarkerWorker.getWrappedObject("context", env);
-        final Map<String, Object> savedValues = FreeMarkerWorker.saveValues(templateCtx, saveKeyNames);
+        final Map<String, Object> savedValues = FreeMarkerWorker.saveValues(templateCtx, SAVE_KEY_NAMES);
         FreeMarkerWorker.overrideWithArgs(templateCtx, args);
         final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
         final LocalDispatcher dispatcher = FreeMarkerWorker.getWrappedObject("dispatcher", env);
@@ -216,14 +217,15 @@ public class TraverseSubContentTransform implements TemplateTransformModel {
                         throw new IOException("Error rendering content" + e.toString());
                     }
                 } else {
-                    if (UtilValidate.isNotEmpty(wrappedFTL))
+                    if (UtilValidate.isNotEmpty(wrappedFTL)) {
                         out.write(wrappedFTL);
+                    }
                 }
-                FreeMarkerWorker.removeValues(templateCtx, removeKeyNames);
+                FreeMarkerWorker.removeValues(templateCtx, REMOVE_KEY_NAMES);
                 FreeMarkerWorker.reloadValues(templateCtx, savedValues, env);
             }
 
-            private boolean checkWhen (GenericValue thisContent, String contentAssocTypeId) {
+            private boolean checkWhen(GenericValue thisContent, String contentAssocTypeId) {
                 boolean isPick = false;
                 Map<String, Object> assocContext = new HashMap<>();
                 if (UtilValidate.isEmpty(contentAssocTypeId)) {
@@ -274,7 +276,6 @@ public class TraverseSubContentTransform implements TemplateTransformModel {
                     templateContext.put("nodeTrail", nodeTrail);
                 }
             }
-
         };
     }
 }
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 c70d35d..7afd6b2 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
@@ -121,15 +121,15 @@ public class BOMNode {
             if (oneChildNode != null) {
                 oneChildNode.setParentNode(this);
                 switch (type) {
-                    case BOMTree.EXPLOSION:
-                        oneChildNode.loadChildren(partBomTypeId, inDate, productFeatures, BOMTree.EXPLOSION);
-                    break;
-                    case BOMTree.EXPLOSION_MANUFACTURING:
-                        // for manufacturing trees, do not look through and create production runs for children unless there is no warehouse stocking of this node item
-                        if (!oneChildNode.isWarehouseManaged(null)) { // FIXME: we will need to pass a facilityId here
-                            oneChildNode.loadChildren(partBomTypeId, inDate, productFeatures, type);
-                        }
-                    break;
+                case BOMTree.EXPLOSION:
+                    oneChildNode.loadChildren(partBomTypeId, inDate, productFeatures, BOMTree.EXPLOSION);
+                break;
+                case BOMTree.EXPLOSION_MANUFACTURING:
+                    // for manufacturing trees, do not look through and create production runs for children unless there is no warehouse stocking of this node item
+                    if (!oneChildNode.isWarehouseManaged(null)) { // FIXME: we will need to pass a facilityId here
+                        oneChildNode.loadChildren(partBomTypeId, inDate, productFeatures, type);
+                    }
+                break;
                 }
             }
             childrenNodes.add(oneChildNode);
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 2038b6f..a8f6da2 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
@@ -458,8 +458,7 @@ public class ProductionRunServices {
                         "roleTypeId",  workEffortPartyAssignment.getString("roleTypeId"),
                         "fromDate",  workEffortPartyAssignment.getTimestamp("fromDate"),
                         "statusId",  workEffortPartyAssignment.getString("statusId"),
-                        "userLogin", userLogin
-               );
+                        "userLogin", userLogin);
                 try {
                     Map<String, Object> result = dctx.getDispatcher().runSync("assignPartyToWorkEffort", partyToWorkEffort);
                     if (ServiceUtil.isError(result)) {
@@ -497,8 +496,7 @@ public class ProductionRunServices {
                         "costComponentCalcId", costCalc.getString("costComponentCalcId"),
                         "fromDate", costCalc.get("fromDate"),
                         "thruDate", costCalc.get("thruDate"),
-                        "userLogin", userLogin
-                );
+                        "userLogin", userLogin);
 
                 try {
                     Map<String, Object> result = dctx.getDispatcher().runSync("createWorkEffortCostCalc", createCostCalc);
@@ -1669,8 +1667,7 @@ public class ProductionRunServices {
                         "roleTypeId",  workEffortPartyAssignment.getString("roleTypeId"),
                         "fromDate",  workEffortPartyAssignment.getTimestamp("fromDate"),
                         "statusId",  workEffortPartyAssignment.getString("statusId"),
-                        "userLogin", userLogin
-               );
+                        "userLogin", userLogin);
                 try {
                     serviceResult = dispatcher.runSync("assignPartyToWorkEffort", partyToWorkEffort);
                     if (ServiceUtil.isError(serviceResult)) {
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 58d7d4f..9ebe99f 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
@@ -568,7 +568,7 @@ public class MrpServices {
                     try {
                         InventoryEventPlannedServices.createOrUpdateMrpEvent(parameters, componentEventQuantity.negate(), null, product.get("productId") + ": " + eventDate, false, delegator);
                     } catch (GenericEntityException e) {
-                        Debug.logError("Error : findOne(\"MrpEvent\", parameters) ="+parameters+"--"+e.getMessage(), MODULE);
+                        Debug.logError("Error : findOne(\"MrpEvent\", parameters) =" + parameters + "--" + e.getMessage(), MODULE);
                         logMrpError(mrpId, node.getProduct().getString("productId"), "Unable to create event (processBomComponent)", delegator);
                     }
                 }
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 3be0f17..6593056 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
@@ -267,7 +267,7 @@ public class ProposedOrder {
             }
             return (String) result.get("requirementId");
         } catch (GenericServiceException e) {
-            Debug.logError(e, "Error : createRequirement with parameters = "+parameters+"--"+e.getMessage(), MODULE);
+            Debug.logError(e, "Error : createRequirement with parameters = "+parameters+"--" + e.getMessage(), MODULE);
             return null;
         }
     }
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java
index 114cf50..7ae4f24 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
@@ -190,7 +190,7 @@ public class TechDataServices {
                         techDataCalendar = machine.getRelatedOne("TechDataCalendar", true);
                     }
                 } catch (GenericEntityException e) {
-                    Debug.logError("Pb reading machine child from machineGroup"+e.getMessage(), MODULE);
+                    Debug.logError("Pb reading machine child from machineGroup" + e.getMessage(), MODULE);
                 }
             }
         }
@@ -199,7 +199,7 @@ public class TechDataServices {
                 Delegator delegator = routingTask.getDelegator();
                 techDataCalendar = EntityQuery.use(delegator).from("TechDataCalendar").where("calendarId", "DEFAULT").queryOne();
             } catch (GenericEntityException e) {
-                Debug.logError("Pb reading TechDataCalendar DEFAULT"+e.getMessage(), MODULE);
+                Debug.logError("Pb reading TechDataCalendar DEFAULT" + e.getMessage(), MODULE);
             }
         }
         return techDataCalendar;
@@ -302,7 +302,7 @@ public class TechDataServices {
         try {
             techDataCalendarWeek = techDataCalendar.getRelatedOne("TechDataCalendarWeek", true);
         } catch (GenericEntityException e) {
-            Debug.logError("Pb reading Calendar Week associated with calendar"+e.getMessage(), MODULE);
+            Debug.logError("Pb reading Calendar Week associated with calendar" + e.getMessage(), MODULE);
             return ServiceUtil.returnError("Pb reading Calendar Week associated with calendar");
         }
         // TODO read TechDataCalendarExcDay to manage execption day
@@ -455,7 +455,7 @@ public class TechDataServices {
         try {
             techDataCalendarWeek = techDataCalendar.getRelatedOne("TechDataCalendarWeek", true);
         } catch (GenericEntityException e) {
-            Debug.logError("Pb reading Calendar Week associated with calendar"+e.getMessage(), MODULE);
+            Debug.logError("Pb reading Calendar Week associated with calendar" + e.getMessage(), MODULE);
             return ServiceUtil.returnError("Pb reading Calendar Week associated with calendar");
         }
         // TODO read TechDataCalendarExcDay to manage execption day
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java
index 48a5f61..307258d 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/finaccount/FinAccountHelper.java
@@ -193,7 +193,7 @@ public final class FinAccountHelper {
                                 EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, "ADJUSTMENT")),
                             EntityOperator.OR))
                 .queryList();
-        incrementTotal = addFirstEntryAmount(incrementTotal, transSums, "amount", (DECIMALS+1), ROUNDING);
+        incrementTotal = addFirstEntryAmount(incrementTotal, transSums, "amount", (DECIMALS + 1), ROUNDING);
 
         // now find sum of all transactions with decrease the value
         transSums = EntityQuery.use(delegator)
@@ -203,7 +203,7 @@ public final class FinAccountHelper {
                         EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, asOfDateTime),
                         EntityCondition.makeCondition("finAccountTransTypeId", EntityOperator.EQUALS, "WITHDRAWAL"))
                 .queryList();
-        decrementTotal = addFirstEntryAmount(decrementTotal, transSums, "amount", (DECIMALS+1), ROUNDING);
+        decrementTotal = addFirstEntryAmount(decrementTotal, transSums, "amount", (DECIMALS + 1), ROUNDING);
 
         // the net balance is just the incrementTotal minus the decrementTotal
         return incrementTotal.subtract(decrementTotal).setScale(DECIMALS, ROUNDING);
@@ -230,7 +230,7 @@ public final class FinAccountHelper {
                         EntityCondition.makeCondition("authorizationDate", EntityOperator.LESS_THAN_EQUAL_TO, asOfDateTime))
                 .queryList();
 
-        BigDecimal authorizationsTotal = addFirstEntryAmount(ZERO, authSums, "amount", (DECIMALS+1), ROUNDING);
+        BigDecimal authorizationsTotal = addFirstEntryAmount(ZERO, authSums, "amount", (DECIMALS + 1), ROUNDING);
 
         // the total available balance is transactions total minus authorizations total
         return netBalance.subtract(authorizationsTotal).setScale(DECIMALS, ROUNDING);
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 c3c671c..fddaf60 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
@@ -236,7 +236,7 @@ public class OrderReadHelper {
             BigDecimal chargedToPaymentPref = ZERO;
             for (GenericValue payment : payments) {
                 if (payment.get("amount") != null) {
-                    chargedToPaymentPref = chargedToPaymentPref.add(payment.getBigDecimal("amount")).setScale(DECIMALS+1, ROUNDING);
+                    chargedToPaymentPref = chargedToPaymentPref.add(payment.getBigDecimal("amount")).setScale(DECIMALS + 1, ROUNDING);
                 }
             }
 
@@ -271,7 +271,7 @@ public class OrderReadHelper {
             }
             BigDecimal refundedToPaymentPref = ZERO;
             for (GenericValue returnItemResponse : returnItemResponses) {
-                refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount")).setScale(DECIMALS+1, ROUNDING);
+                refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount")).setScale(DECIMALS + 1, ROUNDING);
             }
 
             if (refundedToPaymentPref.compareTo(ZERO) == 1) {
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 842204b..7c24190 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
@@ -3032,8 +3032,7 @@ public class OrderServices {
                 EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"),
                 EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"),
                 EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
-                EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")
-       );
+                EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"));
 
         // get the orders
         try {
@@ -6244,8 +6243,7 @@ public class OrderServices {
             // Expire any pre-existing ALSO_BOUGHT ProductAssocs in preparation for reprocessing
             EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
                     EntityCondition.makeCondition("productAssocTypeId", "ALSO_BOUGHT"),
-                    EntityCondition.makeConditionDate("fromDate", "thruDate")
-           ));
+                    EntityCondition.makeConditionDate("fromDate", "thruDate")));
             try {
                 delegator.storeByCondition("ProductAssoc", UtilMisc.toMap("thruDate", UtilDateTime.nowTimestamp()), cond);
             } catch (GenericEntityException e) {
@@ -6330,9 +6328,7 @@ public class OrderServices {
                                 EntityCondition.makeCondition("productIdTo", productIdTo),
                                 EntityCondition.makeCondition("productAssocTypeId", "ALSO_BOUGHT"),
                                 EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, UtilDateTime.nowTimestamp()),
-                                EntityCondition.makeCondition("thruDate", null)
-                       )
-               );
+                                EntityCondition.makeCondition("thruDate", null)));
                 GenericValue existingProductAssoc = null;
                 try {
                     // No point in using the cache because of the filterByDateExpr
@@ -7030,7 +7026,7 @@ public class OrderServices {
                     serviceCtx.put("orderItemSeqId", orderItemSeqId);
                     serviceCtx.put("productId", productId);
                     serviceCtx.put("allocatedQuantity", allocatedQuantity);
-                    serviceCtx.put("prioritySeqId", String.valueOf(i+1));
+                    serviceCtx.put("prioritySeqId", String.valueOf(i + 1));
                     serviceCtx.put("createdByUserLogin", userLoginId);
                     serviceCtx.put("userLogin", userLogin);
                     serviceResult = dispatcher.runSync("createAllocationPlanItem", serviceCtx);
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 713c118..537cfe8 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
@@ -71,8 +71,7 @@ public class RequirementServices {
         try {
             List<EntityCondition> conditions = UtilMisc.toList(
                     EntityCondition.makeCondition("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"),
-                    EntityUtil.getFilterByDateExpr()
-                   );
+                    EntityUtil.getFilterByDateExpr());
             if (UtilValidate.isNotEmpty(statusIds)) {
                 conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, statusIds));
             } else {
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 14a100b..d5184b0 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
@@ -582,12 +582,12 @@ public class CheckOutEvents {
 
         // event return based on failureCode
         switch (failureCode) {
-            case 0:
-                return "success";
-            case 1:
-                return "fail";
-            default:
-                return "error";
+        case 0:
+            return "success";
+        case 1:
+            return "fail";
+        default:
+            return "error";
         }
     }
 
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 23f0eb6..e03a6f7 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
@@ -1020,8 +1020,7 @@ public class CheckOutHelper {
         // check for a paypal express checkout needing completion
         List<EntityExpr> payPalExprs = UtilMisc.toList(
                 EntityCondition.makeCondition("paymentMethodId", EntityOperator.NOT_EQUAL, null),
-                EntityCondition.makeCondition("paymentMethodTypeId", "EXT_PAYPAL")
-           );
+                EntityCondition.makeCondition("paymentMethodTypeId", "EXT_PAYPAL"));
         List<GenericValue> payPalPaymentPrefs = EntityUtil.filterByAnd(allPaymentPreferences, payPalExprs);
         if (UtilValidate.isNotEmpty(payPalPaymentPrefs)) {
             GenericValue payPalPaymentPref = EntityUtil.getFirst(payPalPaymentPrefs);
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 01d3f37..f03cdba 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
@@ -4269,7 +4269,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
                 try {
                     productFacility = EntityQuery.use(delegator).from("ProductFacility").where("productId", productId, "facilityId", shipInfo.getFacilityId()).queryOne();
                 } catch (GenericEntityException e) {
-                    Debug.logError("Error :" +e.getMessage(), MODULE);
+                    Debug.logError("Error :" + e.getMessage(), MODULE);
                     e.printStackTrace();
                 }
 
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 94861ef..d4eaf9c 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
@@ -677,7 +677,7 @@ public class ShoppingCartEvents {
                 }
             }
         } catch (GenericEntityException e) {
-            Debug.logError(e, "Error getting product"+e.getMessage(), MODULE);
+            Debug.logError(e, "Error getting product" + e.getMessage(), MODULE);
         }
         // Determine where to send the browser
         if (controlDirective.equals(ERROR)) {
@@ -1847,8 +1847,7 @@ public class ShoppingCartEvents {
                             return "error";
                         }
                         quantity = quantity.setScale(0, UtilNumber.getRoundingMode("order.rounding"));
-                    }
-                    else {
+                    } else {
                         quantity = quantity.setScale(UtilNumber.getBigDecimalScale("order.decimals"), UtilNumber.getRoundingMode("order.rounding"));
                     }
                 } catch (GenericEntityException e) {
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 60c6dc0..0ce2085 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
@@ -796,8 +796,7 @@ public class ShoppingCartHelper {
                                 return result;
                             }
                             quantity = quantity.setScale(0, UtilNumber.getRoundingMode("order.rounding"));
-                        }
-                        else {
+                        } else {
                             quantity = quantity.setScale(UtilNumber.getBigDecimalScale("order.decimals"), UtilNumber.getRoundingMode("order.rounding"));
                         }
                         if (quantity.compareTo(BigDecimal.ZERO) < 0) {
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 c8cebba..b90fd3c 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
@@ -649,7 +649,7 @@ public class ShoppingCartServices {
             // set the item seq in the cart
             if (nextItemSeq > 0) {
                 try {
-                    cart.setNextItemSeq(nextItemSeq+1);
+                    cart.setNextItemSeq(nextItemSeq + 1);
                 } catch (GeneralException e) {
                     Debug.logError(e, MODULE);
                     return ServiceUtil.returnError(e.getMessage());
@@ -960,7 +960,7 @@ public class ShoppingCartServices {
         // set the item seq in the cart
         if (nextItemSeq > 0) {
             try {
-                cart.setNextItemSeq(nextItemSeq+1);
+                cart.setNextItemSeq(nextItemSeq + 1);
             } catch (GeneralException e) {
                 Debug.logError(e, MODULE);
                 return ServiceUtil.returnError(e.getMessage());
@@ -1103,7 +1103,7 @@ public class ShoppingCartServices {
         // set the item seq in the cart
         if (nextItemSeq > 0) {
             try {
-                cart.setNextItemSeq(nextItemSeq+1);
+                cart.setNextItemSeq(nextItemSeq + 1);
             } catch (GeneralException e) {
                 Debug.logError(e, MODULE);
                 return ServiceUtil.returnError(e.getMessage());
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 d8fb556..d34f421 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
@@ -273,8 +273,7 @@ public final class ProductDisplayWorker {
                 //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())) {
                     occs = occs.setScale(0, UtilNumber.getRoundingMode("order.rounding"));
-                }
-                else {
+                } else {
                     occs = occs.setScale(UtilNumber.getBigDecimalScale("order.decimals"), UtilNumber.getRoundingMode("order.rounding"));
                 }
                 productQuantities.put(prodId, occs);
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 4f04d8c..cd59c13 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
@@ -1,4 +1,4 @@
-    /*******************************************************************************
+/*******************************************************************************
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -75,7 +75,8 @@ public final class ProductPromoWorker {
     private static final RoundingMode ROUNDING = UtilNumber.getRoundingMode("order.rounding");
     private static final MathContext GEN_ROUNDING = new MathContext(10);
 
-    private ProductPromoWorker() { }
+    private ProductPromoWorker() {
+    }
 
     public static List<GenericValue> getStoreProductPromos(Delegator delegator, LocalDispatcher dispatcher, ServletRequest request) {
         List<GenericValue> productPromos = new LinkedList<>();
@@ -106,17 +107,21 @@ public final class ProductPromoWorker {
                 Debug.logError(e, "Error looking up store with id " + productStoreId, MODULE);
             }
             if (productStore == null) {
-                Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE);
+                Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId",
+                        productStoreId), cart.getLocale()), MODULE);
                 return productPromos;
             }
 
-            Iterator<GenericValue> productStorePromoAppls = UtilMisc.toIterator(EntityUtil.filterByDate(productStore.getRelated("ProductStorePromoAppl", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNum"), true), true));
+            Iterator<GenericValue> productStorePromoAppls = UtilMisc.toIterator(EntityUtil.filterByDate(productStore.getRelated(
+                    "ProductStorePromoAppl", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNum"), true), true));
             while (productStorePromoAppls != null && productStorePromoAppls.hasNext()) {
                 GenericValue productStorePromoAppl = productStorePromoAppls.next();
-                if (UtilValidate.isNotEmpty(productStorePromoAppl.getString("manualOnly")) && "Y".equals(productStorePromoAppl.getString("manualOnly"))) {
+                if (UtilValidate.isNotEmpty(productStorePromoAppl.getString("manualOnly")) && "Y".equals(productStorePromoAppl.getString(
+                        "manualOnly"))) {
                     // manual only promotions are not automatically evaluated (they must be explicitly selected by the user)
                     if (Debug.verboseOn()) {
-                        Debug.logVerbose("Skipping promotion with id [" + productStorePromoAppl.getString("productPromoId") + "] because it is applied to the store with ID " + productStoreId + " as a manual only promotion.", MODULE);
+                        Debug.logVerbose("Skipping promotion with id [" + productStorePromoAppl.getString("productPromoId") + "] because it is " +
+                                "applied to the store with ID " + productStoreId + " as a manual only promotion.", MODULE);
                     }
                     continue;
                 }
@@ -129,7 +134,8 @@ public final class ProductPromoWorker {
 
                     while (condResult && promoRulesItr != null && promoRulesItr.hasNext()) {
                         GenericValue promoRule = promoRulesItr.next();
-                        Iterator<GenericValue> productPromoConds = UtilMisc.toIterator(promoRule.getRelated("ProductPromoCond", null, UtilMisc.toList("productPromoCondSeqId"), true));
+                        Iterator<GenericValue> productPromoConds = UtilMisc.toIterator(promoRule.getRelated("ProductPromoCond", null,
+                                UtilMisc.toList("productPromoCondSeqId"), true));
 
                         while (condResult && productPromoConds != null && productPromoConds.hasNext()) {
                             GenericValue productPromoCond = productPromoConds.next();
@@ -172,19 +178,23 @@ public final class ProductPromoWorker {
             Debug.logError(e, "Error looking up store with id " + productStoreId, MODULE);
         }
         if (productStore == null) {
-            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE);
+            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId",
+                    productStoreId), cart.getLocale()), MODULE);
             return promoCodes;
         }
         try {
-            Iterator<GenericValue> productStorePromoAppls = UtilMisc.toIterator(EntityUtil.filterByDate(productStore.getRelated("ProductStorePromoAppl", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNum"), true), true));
+            Iterator<GenericValue> productStorePromoAppls = UtilMisc.toIterator(EntityUtil.filterByDate(productStore.getRelated(
+                    "ProductStorePromoAppl", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNum"), true), true));
             while (productStorePromoAppls != null && productStorePromoAppls.hasNext()) {
                 GenericValue productStorePromoAppl = productStorePromoAppls.next();
-                if (UtilValidate.isNotEmpty(productStorePromoAppl.getString("manualOnly")) && "Y".equals(productStorePromoAppl.getString("manualOnly"))) {
+                if (UtilValidate.isNotEmpty(productStorePromoAppl.getString("manualOnly")) && "Y".equals(productStorePromoAppl.getString(
+                        "manualOnly"))) {
                     // manual only promotions are not automatically evaluated (they must be explicitly selected by the user)
                     if (Debug.verboseOn()) {
-                        Debug.logVerbose("Skipping promotion with id [" + productStorePromoAppl.getString("productPromoId") + "] because it is applied to the store with ID " + productStoreId + " as a manual only promotion.", MODULE);
+                        Debug.logVerbose("Skipping promotion with id [" + productStorePromoAppl.getString("productPromoId") + "] because it is " +
+                                "applied to the store with ID " + productStoreId + " as a manual only promotion.", MODULE);
                     }
-                        continue;
+                    continue;
                 }
                 GenericValue productPromo = productStorePromoAppl.getRelatedOne("ProductPromo", true);
                 Iterator<GenericValue> productPromoCodesIter = UtilMisc.toIterator(productPromo.getRelated("ProductPromoCode", null, null, true));
@@ -212,13 +222,15 @@ public final class ProductPromoWorker {
             Debug.logError(e, "Error looking up store with id " + productStoreId, MODULE);
         }
         if (productStore == null) {
-            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId", productStoreId), cart.getLocale()), MODULE);
+            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoStoreFoundWithIdNotDoingPromotions", UtilMisc.toMap("productStoreId",
+                    productStoreId), cart.getLocale()), MODULE);
             return productPromoList;
         }
 
         try {
             // loop through promotions and get a list of all of the rules...
-            List<GenericValue> productStorePromoApplsList = productStore.getRelated("ProductStorePromoAppl", null, UtilMisc.toList("sequenceNum"), true);
+            List<GenericValue> productStorePromoApplsList = productStore.getRelated("ProductStorePromoAppl", null, UtilMisc.toList("sequenceNum"),
+                    true);
             productStorePromoApplsList = EntityUtil.filterByDate(productStorePromoApplsList, nowTimestamp);
 
             if (UtilValidate.isEmpty(productStorePromoApplsList)) {
@@ -231,7 +243,8 @@ public final class ProductPromoWorker {
                 if ("Y".equals(prodCatalogPromoAppl.getString("manualOnly"))) {
                     // manual only promotions are not automatically evaluated (they must be explicitly selected by the user)
                     if (Debug.verboseOn()) {
-                        Debug.logVerbose("Skipping promotion with id [" + prodCatalogPromoAppl.getString("productPromoId") + "] because it is applied to the store with ID " + productStoreId + " as a manual only promotion.", MODULE);
+                        Debug.logVerbose("Skipping promotion with id [" + prodCatalogPromoAppl.getString("productPromoId") + "] because it is " +
+                                "applied to the store with ID " + productStoreId + " as a manual only promotion.", MODULE);
                     }
                     continue;
                 }
@@ -257,17 +270,20 @@ public final class ProductPromoWorker {
             Debug.logError(e, "Error looking up agreement with id " + agreementId, MODULE);
         }
         if (agreement == null) {
-            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementFoundWithIdNotDoingPromotions", UtilMisc.toMap("agreementId", agreementId), cart.getLocale()), MODULE);
+            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementFoundWithIdNotDoingPromotions", UtilMisc.toMap("agreementId",
+                    agreementId), cart.getLocale()), MODULE);
             return productPromoList;
         }
         GenericValue agreementItem = null;
         try {
-            agreementItem = EntityQuery.use(delegator).from("AgreementItem").where("agreementId", agreementId, "agreementItemTypeId", "AGREEMENT_PRICING_PR", "currencyUomId", cart.getCurrency()).cache(true).queryFirst();
+            agreementItem = EntityQuery.use(delegator).from("AgreementItem").where("agreementId", agreementId, "agreementItemTypeId",
+                    "AGREEMENT_PRICING_PR", "currencyUomId", cart.getCurrency()).cache(true).queryFirst();
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error looking up agreement items for agreement with id " + agreementId, MODULE);
         }
         if (agreementItem == null) {
-            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementItemFoundForAgreementWithIdNotDoingPromotions", UtilMisc.toMap("agreementId", agreementId), cart.getLocale()), MODULE);
+            Debug.logWarning(UtilProperties.getMessage(RES_ERROR, "OrderNoAgreementItemFoundForAgreementWithIdNotDoingPromotions", UtilMisc.toMap(
+                    "agreementId", agreementId), cart.getLocale()), MODULE);
             return productPromoList;
         }
 
@@ -277,7 +293,7 @@ public final class ProductPromoWorker {
             agreementPromoApplsList = EntityUtil.filterByDate(agreementPromoApplsList, nowTimestamp);
 
             if (Debug.verboseOn() && UtilValidate.isEmpty(agreementPromoApplsList)) {
-                    Debug.logVerbose("Not doing promotions, none applied to agreement with ID " + agreementId, MODULE);
+                Debug.logVerbose("Not doing promotions, none applied to agreement with ID " + agreementId, MODULE);
             }
 
             Iterator<GenericValue> agreementPromoAppls = UtilMisc.toIterator(agreementPromoApplsList);
@@ -300,8 +316,11 @@ public final class ProductPromoWorker {
         // this is called when a user logs in so that per customer limits are honored, called by cart when new userlogin is set
         // there is code to store ProductPromoUse information when an order is placed
         // ProductPromoUses are ignored if the corresponding order is cancelled
-        // limits sub total for promos to not use gift cards (products with a don't use in promo indicator), also exclude gift cards from all other promotion considerations including subTotals for discounts, etc
-        // TODO: (not done, delay, still considering...) add code to check ProductPromoUse limits per promo (customer, promo), and per code (customer, code) to avoid use of promos or codes getting through due to multiple carts getting promos applied at the same time, possibly on totally different servers
+        // limits sub total for promos to not use gift cards (products with a don't use in promo indicator), also exclude gift cards from all other
+        // promotion considerations including subTotals for discounts, etc
+        // TODO: (not done, delay, still considering...) add code to check ProductPromoUse limits per promo (customer, promo), and per code
+        // (customer, code) to avoid use of promos or codes getting through due to multiple carts getting promos applied at the same time, possibly
+        // on totally different servers
 
         if (!cart.getDoPromotions()) {
             return;
@@ -338,15 +357,16 @@ public final class ProductPromoWorker {
             List<GenericValue> sortedExplodedProductPromoList = new ArrayList<>(sortedPromoUses.size());
             Map<String, Long> usesPerPromo = new HashMap<>();
             int indexOfFirstOrderTotalPromo = -1;
-            for (ProductPromoUseInfo promoUse: sortedPromoUses) {
-                GenericValue productPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", promoUse.getProductPromoId()).cache().queryOne();
+            for (ProductPromoUseInfo promoUse : sortedPromoUses) {
+                GenericValue productPromo =
+                        EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", promoUse.getProductPromoId()).cache().queryOne();
                 GenericValue newProductPromo = (GenericValue) productPromo.clone();
                 if (!usesPerPromo.containsKey(promoUse.getProductPromoId())) {
                     usesPerPromo.put(promoUse.getProductPromoId(), 0l);
                 }
                 long uses = usesPerPromo.get(promoUse.getProductPromoId());
                 uses = uses + 1;
-                long useLimitPerOrder = (newProductPromo.get("useLimitPerOrder") != null? newProductPromo.getLong("useLimitPerOrder"): -1);
+                long useLimitPerOrder = (newProductPromo.get("useLimitPerOrder") != null ? newProductPromo.getLong("useLimitPerOrder") : -1);
                 if (useLimitPerOrder == -1 || uses < useLimitPerOrder) {
                     newProductPromo.set("useLimitPerOrder", uses);
                 }
@@ -405,10 +425,12 @@ public final class ProductPromoWorker {
         return hasOtCond;
     }
 
-    private static void runProductPromos(List<GenericValue> productPromoList, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp, boolean isolatedTestRun) throws GeneralException {
+    private static void runProductPromos(List<GenericValue> productPromoList, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher,
+                                         Timestamp nowTimestamp, boolean isolatedTestRun) throws GeneralException {
         String partyId = cart.getPartyId();
 
-        // this is our safety net; we should never need to loop through the rules more than a certain number of times, this is that number and may have to be changed for insanely large promo sets...
+        // this is our safety net; we should never need to loop through the rules more than a certain number of times, this is that number and may
+        // have to be changed for insanely large promo sets...
         long maxIterations = 1000;
         // part of the safety net to avoid infinite iteration
         long numberOfIterations = 0;
@@ -425,7 +447,8 @@ public final class ProductPromoWorker {
                 cartChanged = false;
                 numberOfIterations++;
                 if (numberOfIterations > maxIterations) {
-                    Debug.logError("ERROR: While calculating promotions the promotion rules where run more than " + maxIterations + " times, so the calculation has been ended. This should generally never happen unless you have bad rule definitions.", MODULE);
+                    Debug.logError("ERROR: While calculating promotions the promotion rules where run more than " + maxIterations + " times, so the" +
+                            " calculation has been ended. This should generally never happen unless you have bad rule definitions.", MODULE);
                     break;
                 }
 
@@ -447,7 +470,8 @@ public final class ProductPromoWorker {
                             Set<String> enteredCodes = cart.getProductPromoCodesEntered();
                             // Check whether any promotion code is applied on order.
                             if (cart.getOrderId() != null) {
-                                List<GenericValue> orderproductPromoCodes = EntityQuery.use(delegator).from("OrderProductPromoCode").where("orderId", cart.getOrderId()).queryList();
+                                List<GenericValue> orderproductPromoCodes = EntityQuery.use(delegator).from("OrderProductPromoCode").where("orderId"
+                                        , cart.getOrderId()).queryList();
                                 Iterator<GenericValue> orderproductPromoCodesItr = UtilMisc.toIterator(orderproductPromoCodes);
                                 while (orderproductPromoCodesItr != null && orderproductPromoCodesItr.hasNext()) {
                                     GenericValue orderproductPromoCode = orderproductPromoCodesItr.next();
@@ -456,29 +480,40 @@ public final class ProductPromoWorker {
                             }
                             if (enteredCodes.size() > 0) {
                                 // get all promo codes entered, do a query with an IN condition to see if any of those are related
-                                EntityCondition codeCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("productPromoId", EntityOperator.EQUALS, productPromoId), EntityOperator.AND, EntityCondition.makeCondition("productPromoCodeId", EntityOperator.IN, enteredCodes));
+                                EntityCondition codeCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("productPromoId",
+                                        EntityOperator.EQUALS, productPromoId), EntityOperator.AND, EntityCondition.makeCondition(
+                                                "productPromoCodeId",
+                                        EntityOperator.IN, enteredCodes));
                                 // may want to sort by something else to decide which code to use if there is more than one candidate
-                                List<GenericValue> productPromoCodeList = EntityQuery.use(delegator).from("ProductPromoCode").where(codeCondition).orderBy("productPromoCodeId").queryList();
+                                List<GenericValue> productPromoCodeList =
+                                        EntityQuery.use(delegator).from("ProductPromoCode").where(codeCondition).orderBy("productPromoCodeId").queryList();
                                 Iterator<GenericValue> productPromoCodeIter = productPromoCodeList.iterator();
-                                // support multiple promo codes for a single promo, ie if we run into a use limit for one code see if we can find another for this promo
-                                // check the use limit before each pass so if the promo use limit has been hit we don't keep on trying for the promo code use limit, if there is one of course
+                                // support multiple promo codes for a single promo, ie if we run into a use limit for one code see if we can find
+                                // another for this promo
+                                // check the use limit before each pass so if the promo use limit has been hit we don't keep on trying for the
+                                // promo code use limit, if there is one of course
                                 while ((useLimit == null || useLimit > cart.getProductPromoUseCount(productPromoId)) && productPromoCodeIter.hasNext()) {
                                     GenericValue productPromoCode = productPromoCodeIter.next();
                                     String productPromoCodeId = productPromoCode.getString("productPromoCodeId");
                                     Long codeUseLimit = getProductPromoCodeUseLimit(productPromoCode, partyId, delegator);
-                                    if (runProductPromoRules(cart, useLimit, true, productPromoCodeId, codeUseLimit, maxUseLimit, productPromo, productPromoRules, dispatcher, delegator, nowTimestamp)) {
+                                    if (runProductPromoRules(cart, useLimit, true, productPromoCodeId, codeUseLimit, maxUseLimit, productPromo,
+                                            productPromoRules, dispatcher, delegator, nowTimestamp)) {
                                         cartChanged = true;
                                     }
 
                                     if (cart.getProductPromoUseCount(productPromoId) > maxUseLimit) {
-                                        Debug.logError("ERROR: While calculating promotions the promotion [" + productPromoId + "] action was applied more than " + maxUseLimit + " times, so the calculation has been ended. This should generally never happen unless you have bad rule definitions.", MODULE);
+                                        Debug.logError("ERROR: While calculating promotions the promotion [" + productPromoId + "] action was " +
+                                                "applied more than " + maxUseLimit + " times, so the calculation has been ended. This should " +
+                                                "generally " +
+                                                "never happen unless you have bad rule definitions.", MODULE);
                                         break;
                                     }
                                 }
                             }
                         } else {
                             try {
-                                if (runProductPromoRules(cart, useLimit, false, null, null, maxUseLimit, productPromo, productPromoRules, dispatcher, delegator, nowTimestamp)) {
+                                if (runProductPromoRules(cart, useLimit, false, null, null, maxUseLimit, productPromo, productPromoRules,
+                                        dispatcher, delegator, nowTimestamp)) {
                                     cartChanged = true;
                                 }
                             } catch (RuntimeException e) {
@@ -504,7 +539,9 @@ public final class ProductPromoWorker {
         }
     }
 
-    /** calculate low use limit for this promo for the current "order", check per order, customer, promo */
+    /**
+     * calculate low use limit for this promo for the current "order", check per order, customer, promo
+     */
     public static Long getProductPromoUseLimit(GenericValue productPromo, String partyId, Delegator delegator) throws GenericEntityException {
         String productPromoId = productPromo.getString("productPromoId");
         Long candidateUseLimit = null;
@@ -594,27 +631,32 @@ public final class ProductPromoWorker {
 
     public static String checkCanUsePromoCode(String productPromoCodeId, String partyId, Delegator delegator, ShoppingCart cart, Locale locale) {
         try {
-            GenericValue productPromoCode = EntityQuery.use(delegator).from("ProductPromoCode").where("productPromoCodeId", productPromoCodeId).queryOne();
+            GenericValue productPromoCode =
+                    EntityQuery.use(delegator).from("ProductPromoCode").where("productPromoCodeId", productPromoCodeId).queryOne();
             if (productPromoCode == null) {
-                return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_not_valid", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), locale);
+                return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_not_valid", UtilMisc.toMap("productPromoCodeId",
+                        productPromoCodeId), locale);
             }
             if (cart != null) {
                 Set<String> promoCodes = ProductPromoWorker.getStoreProductPromoCodes(cart);
                 if (UtilValidate.isEmpty(promoCodes) || !promoCodes.contains(productPromoCodeId)) {
-                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_not_valid", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), locale);
+                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_not_valid", UtilMisc.toMap("productPromoCodeId",
+                            productPromoCodeId), locale);
                 }
             }
             Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
             Timestamp thruDate = productPromoCode.getTimestamp("thruDate");
             if (thruDate != null) {
                 if (nowTimestamp.after(thruDate)) {
-                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_is_expired_at", UtilMisc.toMap("productPromoCodeId", productPromoCodeId, "thruDate", thruDate), locale);
+                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_is_expired_at", UtilMisc.toMap(
+                            "productPromoCodeId", productPromoCodeId, "thruDate", thruDate), locale);
                 }
             }
             Timestamp fromDate = productPromoCode.getTimestamp("fromDate");
             if (fromDate != null) {
                 if (nowTimestamp.before(fromDate)) {
-                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_will_be_activated_at", UtilMisc.toMap("productPromoCodeId", productPromoCodeId, "fromDate", fromDate), locale);
+                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_will_be_activated_at", UtilMisc.toMap(
+                            "productPromoCodeId", productPromoCodeId, "fromDate", fromDate), locale);
                 }
             }
 
@@ -623,7 +665,8 @@ public final class ProductPromoWorker {
 
                 // check partyId
                 if (UtilValidate.isNotEmpty(partyId)) {
-                    if (EntityQuery.use(delegator).from("ProductPromoCodeParty").where("productPromoCodeId", productPromoCodeId, "partyId", partyId).queryOne() != null) {
+                    if (EntityQuery.use(delegator).from("ProductPromoCodeParty").where("productPromoCodeId", productPromoCodeId, "partyId",
+                            partyId).queryOne() != null) {
                         // found party associated with the code, looks good...
                         return null;
                     }
@@ -633,7 +676,8 @@ public final class ProductPromoWorker {
                     validEmailCondList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
                     validEmailCondList.add(EntityCondition.makeCondition("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId));
                     validEmailCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp));
-                    validEmailCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp),
+                    validEmailCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate",
+                            EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp),
                             EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)));
                     long validEmailCount = EntityQuery.use(delegator).from("ProductPromoCodeEmailParty").where(validEmailCondList).queryCount();
                     if (validEmailCount > 0) {
@@ -643,20 +687,23 @@ public final class ProductPromoWorker {
                 }
 
                 if (!hasEmailOrParty) {
-                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_no_account_or_email", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), locale);
+                    return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_no_account_or_email", UtilMisc.toMap(
+                            "productPromoCodeId", productPromoCodeId), locale);
                 }
             }
 
             // check per customer and per promotion code use limits
             Long useLimit = getProductPromoCodeUseLimit(productPromoCode, partyId, delegator);
             if (useLimit != null && useLimit <= 0) {
-                return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_maximum_limit", UtilMisc.toMap("productPromoCodeId", productPromoCodeId), locale);
+                return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_maximum_limit", UtilMisc.toMap("productPromoCodeId",
+                        productPromoCodeId), locale);
             }
 
             return null;
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error looking up ProductPromoCode", MODULE);
-            return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_error_lookup", UtilMisc.toMap("productPromoCodeId", productPromoCodeId, "errorMsg", e.toString()), locale);
+            return UtilProperties.getMessage(RES_ERROR, "productpromoworker.promotion_code_error_lookup", UtilMisc.toMap("productPromoCodeId",
+                    productPromoCodeId, "errorMsg", e.toString()), locale);
         }
     }
 
@@ -672,25 +719,32 @@ public final class ProductPromoWorker {
         while (promoRulesIter != null && promoRulesIter.hasNext()) {
             GenericValue productPromoRule = promoRulesIter.next();
 
-            List<GenericValue> productPromoConds = EntityQuery.use(delegator).from("ProductPromoCond").where("productPromoId", productPromo.get("productPromoId")).orderBy("productPromoCondSeqId").cache(true).queryList();
-            productPromoConds = EntityUtil.filterByAnd(productPromoConds, UtilMisc.toMap("productPromoRuleId", productPromoRule.get("productPromoRuleId")));
-            // using the other method to consolidate cache entries because the same cache is used elsewhere: List productPromoConds = productPromoRule.getRelated("ProductPromoCond", null, UtilMisc.toList("productPromoCondSeqId"), true);
+            List<GenericValue> productPromoConds = EntityQuery.use(delegator).from("ProductPromoCond").where("productPromoId", productPromo.get(
+                    "productPromoId")).orderBy("productPromoCondSeqId").cache(true).queryList();
+            productPromoConds = EntityUtil.filterByAnd(productPromoConds, UtilMisc.toMap("productPromoRuleId", productPromoRule.get(
+                    "productPromoRuleId")));
+            // using the other method to consolidate cache entries because the same cache is used elsewhere: List productPromoConds =
+            // productPromoRule.getRelated("ProductPromoCond", null, UtilMisc.toList("productPromoCondSeqId"), true);
             Iterator<GenericValue> productPromoCondIter = UtilMisc.toIterator(productPromoConds);
             while (productPromoCondIter != null && productPromoCondIter.hasNext()) {
                 GenericValue productPromoCond = productPromoCondIter.next();
 
-                String equalityOperator = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoOperatorEquality." + productPromoCond.getString("operatorEnumId"), locale);
-                String quantityOperator = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoOperatorQuantity." + productPromoCond.getString("operatorEnumId"), locale);
+                String equalityOperator = UtilProperties.getMessage("ProductPromoUiLabels",
+                        "ProductPromoOperatorEquality." + productPromoCond.getString("operatorEnumId"), locale);
+                String quantityOperator = UtilProperties.getMessage("ProductPromoUiLabels",
+                        "ProductPromoOperatorQuantity." + productPromoCond.getString("operatorEnumId"), locale);
 
                 String condValue = "invalid";
                 if (UtilValidate.isNotEmpty(productPromoCond.getString("condValue"))) {
                     condValue = productPromoCond.getString("condValue");
                 }
 
-                Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("condValue", condValue, "equalityOperator", equalityOperator, "quantityOperator", quantityOperator);
+                Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("condValue", condValue, "equalityOperator", equalityOperator,
+                        "quantityOperator", quantityOperator);
 
                 if ("PPIP_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("inputParamEnumId")) || "PPC_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("customMethodId"))) {
-                    GenericValue partyClassificationGroup = EntityQuery.use(delegator).from("PartyClassificationGroup").where("partyClassificationGroupId", condValue).cache(true).queryOne();
+                    GenericValue partyClassificationGroup = EntityQuery.use(delegator).from("PartyClassificationGroup").where(
+                            "partyClassificationGroupId", condValue).cache(true).queryOne();
                     if (partyClassificationGroup != null && UtilValidate.isNotEmpty(partyClassificationGroup.getString("description"))) {
                         condValue = partyClassificationGroup.getString("description");
                     }
@@ -704,7 +758,8 @@ public final class ProductPromoWorker {
                 } else {
                     String enumId = null;
                     if (UtilValidate.isNotEmpty(productPromoCond.getString("customMethodId"))) {
-                        GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumCode", productPromoCond.getString("customMethodId")).cache().queryFirst();
+                        GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumCode", productPromoCond.getString(
+                                "customMethodId")).cache().queryFirst();
                         if (enumeration != null) {
                             enumId = enumeration.getString("enumId");
                         }
@@ -725,14 +780,16 @@ public final class ProductPromoWorker {
                 }
             }
 
-            List<GenericValue> productPromoActions = productPromoRule.getRelated("ProductPromoAction", null, UtilMisc.toList("productPromoActionSeqId"), true);
+            List<GenericValue> productPromoActions = productPromoRule.getRelated("ProductPromoAction", null, UtilMisc.toList(
+                    "productPromoActionSeqId"), true);
             Iterator<GenericValue> productPromoActionIter = UtilMisc.toIterator(productPromoActions);
             while (productPromoActionIter != null && productPromoActionIter.hasNext()) {
                 GenericValue productPromoAction = productPromoActionIter.next();
 
                 String productId = productPromoAction.getString("productId");
 
-                Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("quantity", productPromoAction.get("quantity"), "amount", productPromoAction.get("amount"), "productId", productId, "partyId", productPromoAction.get("partyId"));
+                Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("quantity", productPromoAction.get("quantity"), "amount",
+                        productPromoAction.get("amount"), "productId", productId, "partyId", productPromoAction.get("partyId"));
 
                 if (UtilValidate.isEmpty(messageContext.get("productId"))) {
                     messageContext.put("productId", "any");
@@ -742,12 +799,14 @@ public final class ProductPromoWorker {
                 }
                 GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne();
                 if (product != null) {
-                    messageContext.put("productName", ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, dispatcher, "html"));
+                    messageContext.put("productName", ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, dispatcher,
+                            "html"));
                 }
 
                 String enumId = null;
                 if (UtilValidate.isNotEmpty(productPromoAction.getString("customMethodId"))) {
-                    GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumCode", productPromoAction.getString("customMethodId")).cache().queryFirst();
+                    GenericValue enumeration = EntityQuery.use(delegator).from("Enumeration").where("enumCode", productPromoAction.getString(
+                            "customMethodId")).cache().queryFirst();
                     if (enumeration != null) {
                         enumId = enumeration.getString("enumId");
                     }
@@ -798,21 +857,25 @@ public final class ProductPromoWorker {
 
         if (UtilValidate.isNotEmpty(partyClassificationsIncluded)) {
             Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("partyClassificationsIncluded", partyClassificationsIncluded);
-            String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoCondition.PPIP_PARTY_CLASS.APPLIED", messageContext, locale);
+            String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoCondition.PPIP_PARTY_CLASS.APPLIED", messageContext,
+                    locale);
             promoDescBuf.append("\n" + msgProp);
         }
 
         if (UtilValidate.isNotEmpty(partyClassificationsExcluded)) {
             Map<String, Object> messageContext = UtilMisc.<String, Object>toMap("partyClassificationsExcluded", partyClassificationsExcluded);
-            String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoCondition.PPIP_PARTY_CLASS.NOT_APPLIED", messageContext, locale);
+            String msgProp = UtilProperties.getMessage("ProductPromoUiLabels", "ProductPromoCondition.PPIP_PARTY_CLASS.NOT_APPLIED", messageContext
+                    , locale);
             promoDescBuf.append("\n" + msgProp);
         }
 
         return promoDescBuf.toString();
     }
 
-    private static boolean runProductPromoRules(ShoppingCart cart, Long useLimit, boolean requireCode, String productPromoCodeId, Long codeUseLimit, long maxUseLimit,
-        GenericValue productPromo, List<GenericValue> productPromoRules, LocalDispatcher dispatcher, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException, UseLimitException {
+    private static boolean runProductPromoRules(ShoppingCart cart, Long useLimit, boolean requireCode, String productPromoCodeId, Long codeUseLimit
+            , long maxUseLimit,
+                                                GenericValue productPromo, List<GenericValue> productPromoRules, LocalDispatcher dispatcher,
+                                                Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException, UseLimitException {
         boolean cartChanged = false;
         Map<ShoppingCartItem, BigDecimal> usageInfoMap = prepareProductUsageInfoMap(cart);
         String productPromoId = productPromo.getString("productPromoId");
@@ -831,9 +894,12 @@ public final class ProductPromoWorker {
                 boolean performActions = true;
 
                 // loop through conditions for rule, if any false, set allConditionsTrue to false
-                List<GenericValue> productPromoConds = EntityQuery.use(delegator).from("ProductPromoCond").where("productPromoId", productPromo.get("productPromoId")).orderBy("productPromoCondSeqId").cache(true).queryList();
-                productPromoConds = EntityUtil.filterByAnd(productPromoConds, UtilMisc.toMap("productPromoRuleId", productPromoRule.get("productPromoRuleId")));
-                // using the other method to consolidate cache entries because the same cache is used elsewhere: List productPromoConds = productPromoRule.getRelated("ProductPromoCond", null, UtilMisc.toList("productPromoCondSeqId"), true);
+                List<GenericValue> productPromoConds = EntityQuery.use(delegator).from("ProductPromoCond").where("productPromoId",
+                        productPromo.get("productPromoId")).orderBy("productPromoCondSeqId").cache(true).queryList();
+                productPromoConds = EntityUtil.filterByAnd(productPromoConds, UtilMisc.toMap("productPromoRuleId", productPromoRule.get(
+                        "productPromoRuleId")));
+                // using the other method to consolidate cache entries because the same cache is used elsewhere: List productPromoConds =
+                // productPromoRule.getRelated("ProductPromoCond", null, UtilMisc.toList("productPromoCondSeqId"), true);
                 if (Debug.verboseOn()) {
                     Debug.logVerbose("Checking " + productPromoConds.size() + " conditions for rule " + productPromoRule, MODULE);
                 }
@@ -854,7 +920,8 @@ public final class ProductPromoWorker {
                 if (performActions) {
                     // perform all actions, either apply or unapply
 
-                    List<GenericValue> productPromoActions = productPromoRule.getRelated("ProductPromoAction", null, UtilMisc.toList("productPromoActionSeqId"), true);
+                    List<GenericValue> productPromoActions = productPromoRule.getRelated("ProductPromoAction", null, UtilMisc.toList(
+                            "productPromoActionSeqId"), true);
                     Iterator<GenericValue> productPromoActionIter = UtilMisc.toIterator(productPromoActions);
                     while (productPromoActionIter != null && productPromoActionIter.hasNext()) {
                         GenericValue productPromoAction = productPromoActionIter.next();
@@ -870,7 +937,9 @@ public final class ProductPromoWorker {
                                 cartChanged = true;
                             }
                         } catch (CartItemModifyException e) {
-                            Debug.logError(e, "Error modifying the cart while performing promotion action [" + productPromoAction.getPrimaryKey() + "]", MODULE);
+                            Debug.logError(e,
+                                    "Error modifying the cart while performing promotion action [" + productPromoAction.getPrimaryKey() + "]",
+                                    MODULE);
                         }
                     }
                 }
@@ -881,14 +950,19 @@ public final class ProductPromoWorker {
                 Map<ShoppingCartItem, BigDecimal> newUsageInfoMap = prepareProductUsageInfoMap(cart);
                 Map<ShoppingCartItem, BigDecimal> deltaUsageInfoMap = prepareDeltaProductUsageInfoMap(usageInfoMap, newUsageInfoMap);
                 usageInfoMap = newUsageInfoMap;
-                cart.addProductPromoUse(productPromo.getString("productPromoId"), productPromoCodeId, totalDiscountAmount, quantityLeftInActions, deltaUsageInfoMap);
+                cart.addProductPromoUse(productPromo.getString("productPromoId"), productPromoCodeId, totalDiscountAmount, quantityLeftInActions,
+                        deltaUsageInfoMap);
             } else {
-                // the promotion was not used, don't try again until we finish a full pass and come back to see the promo conditions are now satisfied based on changes to the cart
+                // the promotion was not used, don't try again until we finish a full pass and come back to see the promo conditions are now
+                // satisfied based on changes to the cart
                 break;
             }
 
             if (cart.getProductPromoUseCount(productPromoId) > maxUseLimit) {
-                throw new UseLimitException("ERROR: While calculating promotions the promotion [" + productPromoId + "] action was applied more than " + maxUseLimit + " times, so the calculation has been ended. This should generally never happen unless you have bad rule definitions.");
+                throw new UseLimitException("ERROR: While calculating promotions the promotion [" + productPromoId + "] action was applied more " +
+                        "than " + maxUseLimit + " times, so the calculation has been ended. This should generally never happen unless you have bad " +
+                        "rule" +
+                        " definitions.");
             }
         }
 
@@ -907,7 +981,8 @@ public final class ProductPromoWorker {
         return usageInfoMap;
     }
 
-    private static Map<ShoppingCartItem, BigDecimal> prepareDeltaProductUsageInfoMap(Map<ShoppingCartItem, BigDecimal> oldMap, Map<ShoppingCartItem, BigDecimal> newMap) {
+    private static Map<ShoppingCartItem, BigDecimal> prepareDeltaProductUsageInfoMap(Map<ShoppingCartItem, BigDecimal> oldMap, Map<ShoppingCartItem
+            , BigDecimal> newMap) {
         Map<ShoppingCartItem, BigDecimal> deltaUsageInfoMap = new HashMap<>(newMap);
 
         for (Entry<ShoppingCartItem, BigDecimal> entry : oldMap.entrySet()) {
@@ -923,7 +998,8 @@ public final class ProductPromoWorker {
         return deltaUsageInfoMap;
     }
 
-    private static boolean checkCondition(GenericValue productPromoCond, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException {
+    private static boolean checkCondition(GenericValue productPromoCond, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher,
+                                          Timestamp nowTimestamp) throws GenericEntityException {
         String condValue = productPromoCond.getString("condValue");
         String otherValue = productPromoCond.getString("otherValue");
         String inputParamEnumId = productPromoCond.getString("inputParamEnumId");
@@ -953,7 +1029,8 @@ public final class ProductPromoWorker {
                 //for backward compatibility resolve customMethodId from enumCode
                 GenericValue condEnum = EntityQuery.use(delegator).from("Enumeration").where("enumId", inputParamEnumId).cache().queryOne();
                 if (condEnum != null) {
-                    customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", condEnum.get("enumCode")).cache().queryOne();
+                    customMethod =
+                            EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", condEnum.get("enumCode")).cache().queryOne();
                     if (customMethod == null) {
                         Debug.logWarning("The oldest enumeration " + inputParamEnumId + " for promo " + productPromoCond.getPkShortValueString()
                                 + " haven't the new customMethod to use, please check your data or load seed data", MODULE);
@@ -965,7 +1042,8 @@ public final class ProductPromoWorker {
         }
 
         if (serviceName != null) {
-            Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("productPromoCond", productPromoCond, "shoppingCart", cart, "nowTimestamp", nowTimestamp);
+            Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("productPromoCond", productPromoCond, "shoppingCart", cart,
+                    "nowTimestamp", nowTimestamp);
             Map<String, Object> condResult = null;
             try {
                 condResult = dispatcher.runSync(serviceName, serviceCtx);
@@ -995,7 +1073,8 @@ 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;
                 }
             }
@@ -1004,12 +1083,15 @@ public final class ProductPromoWorker {
         return false;
     }
 
-    public static boolean checkConditionsForItem(GenericValue productPromoActionOrCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException {
+    public static boolean checkConditionsForItem(GenericValue productPromoActionOrCond, ShoppingCart cart, ShoppingCartItem cartItem,
+            Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException {
         GenericValue productPromoRule = productPromoActionOrCond.getRelatedOne("ProductPromoRule", true);
 
-        List<GenericValue> productPromoConds = EntityQuery.use(delegator).from("ProductPromoCond").where("productPromoId", productPromoRule.get("productPromoId")).orderBy("productPromoCondSeqId").cache(true).queryList();
-        productPromoConds = EntityUtil.filterByAnd(productPromoConds, UtilMisc.toMap("productPromoRuleId", productPromoRule.get("productPromoRuleId")));
-        for (GenericValue productPromoCond: productPromoConds) {
+        List<GenericValue> productPromoConds = EntityQuery.use(delegator).from("ProductPromoCond").where("productPromoId", productPromoRule.get(
+                "productPromoId")).orderBy("productPromoCondSeqId").cache(true).queryList();
+        productPromoConds = EntityUtil.filterByAnd(productPromoConds, UtilMisc.toMap("productPromoRuleId",
+                productPromoRule.get("productPromoRuleId")));
+        for (GenericValue productPromoCond : productPromoConds) {
             boolean passed = checkConditionForItem(productPromoCond, cart, cartItem, delegator, dispatcher, nowTimestamp);
             if (!passed) {
                 return false;
@@ -1018,19 +1100,20 @@ public final class ProductPromoWorker {
         return true;
     }
 
-    public static boolean checkConditionForItem(GenericValue productPromoCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException {
+    public static boolean checkConditionForItem(GenericValue productPromoCond, ShoppingCart cart, ShoppingCartItem cartItem, Delegator delegator,
+                                                LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException {
         String condValue = productPromoCond.getString("condValue");
         String inputParamEnumId = productPromoCond.getString("inputParamEnumId");
         String customMethodId = productPromoCond.getString("customMethodId");
         String operatorEnumId = productPromoCond.getString("operatorEnumId");
 
-        // don't get list price from cart because it may have tax included whereas the base price does not: BigDecimal listPrice = cartItem.getListPrice();
+        // don't get list price from cart because it may have tax included whereas the base price does not: BigDecimal listPrice = cartItem
+        // .getListPrice();
         List<GenericValue> listProductPriceList = EntityQuery.use(delegator).from("ProductPrice")
                 .where("productId", cartItem.getProductId(), "productPriceTypeId", "LIST_PRICE", "productPricePurposeId", "PURCHASE")
                 .orderBy("-fromDate")
-                .filterByDate()
-                .queryList();
-        GenericValue listProductPrice = (listProductPriceList != null && listProductPriceList.size() > 0) ? listProductPriceList.get(0): null;
+                .filterByDate().queryList();
+        GenericValue listProductPrice = (listProductPriceList != null && listProductPriceList.size() > 0) ? listProductPriceList.get(0) : null;
         BigDecimal listPrice = (listProductPrice != null) ? listProductPrice.getBigDecimal("price") : null;
 
         if (listPrice == null) {
@@ -1069,7 +1152,8 @@ 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();
+        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");
             if (partyIdFrom.equals(groupPartyId)) {
@@ -1082,20 +1166,19 @@ public final class ProductPromoWorker {
         return 1;
     }
 
-    public static class ActionResultInfo {
-        public boolean ranAction = false;
-        public BigDecimal totalDiscountAmount = BigDecimal.ZERO;
-        public BigDecimal quantityLeftInAction = BigDecimal.ZERO;
-    }
-
-    /** returns true if the cart was changed and rules need to be re-evaluted */
-    private static ActionResultInfo performAction(GenericValue productPromoAction, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException, CartItemModifyException {
+    /**
+     * returns true if the cart was changed and rules need to be re-evaluted
+     */
+    private static ActionResultInfo performAction(GenericValue productPromoAction, ShoppingCart cart, Delegator delegator,
+                                                  LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException,
+            CartItemModifyException {
         ActionResultInfo actionResultInfo = new ActionResultInfo();
         performAction(actionResultInfo, productPromoAction, cart, delegator, dispatcher, nowTimestamp);
         return actionResultInfo;
     }
 
-    public static void performAction(ActionResultInfo actionResultInfo, GenericValue productPromoAction, ShoppingCart cart, Delegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException, CartItemModifyException {
+    public static void performAction(ActionResultInfo actionResultInfo, GenericValue productPromoAction, ShoppingCart cart, Delegator delegator,
+                                     LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException, CartItemModifyException {
         String productPromoActionEnumId = productPromoAction.getString("productPromoActionEnumId");
         String serviceName = null;
         GenericValue customMethod = productPromoAction.getRelatedOne("CustomMethod", true);
@@ -1108,16 +1191,18 @@ public final class ProductPromoWorker {
                 //for backware compatibility resolve customMethodId from enumCode
                 GenericValue condEnum = EntityQuery.use(delegator).from("Enumeration").where("enumId", productPromoActionEnumId).cache().queryOne();
                 if (condEnum != null) {
-                    customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", condEnum.get("enumCode")).cache().queryOne();
+                    customMethod =
+                            EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", condEnum.get("enumCode")).cache().queryOne();
                     if (customMethod != null) {
                         serviceName = customMethod.getString("customMethodName");
                     }
                 }
             }
-        } 
+        }
 
         if (serviceName != null) {
-            Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("productPromoAction", productPromoAction, "shoppingCart", cart, "nowTimestamp", nowTimestamp, "actionResultInfo", actionResultInfo);
+            Map<String, Object> serviceCtx = UtilMisc.<String, Object>toMap("productPromoAction", productPromoAction, "shoppingCart", cart,
+                    "nowTimestamp", nowTimestamp, "actionResultInfo", actionResultInfo);
             Map<String, Object> actionResult;
             try {
                 actionResult = dispatcher.runSync(serviceName, serviceCtx);
@@ -1139,7 +1224,8 @@ public final class ProductPromoWorker {
             actionResultInfo.ranAction = false;
         }
 
-        // in action, if doesn't have enough quantity to use the promo at all, remove candidate promo uses and increment promoQuantityUsed; this should go for all actions, if any action runs we confirm
+        // in action, if doesn't have enough quantity to use the promo at all, remove candidate promo uses and increment promoQuantityUsed; this
+        // should go for all actions, if any action runs we confirm
         if (actionResultInfo.ranAction) {
             cart.confirmPromoRuleUse(productPromoAction.getString("productPromoId"), productPromoAction.getString("productPromoRuleId"));
         } else {
@@ -1169,9 +1255,11 @@ public final class ProductPromoWorker {
         return totalAmount;
     }
 
-    public static void distributeDiscountAmount(BigDecimal discountAmountTotal, BigDecimal totalAmount, List<ShoppingCartItem> cartItemsUsed, GenericValue productPromoAction, Delegator delegator) {
+    public static void distributeDiscountAmount(BigDecimal discountAmountTotal, BigDecimal totalAmount, List<ShoppingCartItem> cartItemsUsed,
+                                                GenericValue productPromoAction, Delegator delegator) {
         BigDecimal discountAmount = discountAmountTotal;
-        // distribute the discount evenly weighted according to price over the order items that the individual quantities came from; avoids a number of issues with tax/shipping calc, inclusion in the sub-total for other promotions, etc
+        // distribute the discount evenly weighted according to price over the order items that the individual quantities came from; avoids a
+        // number of issues with tax/shipping calc, inclusion in the sub-total for other promotions, etc
         Iterator<ShoppingCartItem> cartItemsUsedIter = cartItemsUsed.iterator();
         while (cartItemsUsedIter.hasNext()) {
             ShoppingCartItem cartItem = cartItemsUsedIter.next();
@@ -1180,7 +1268,8 @@ public final class ProductPromoWorker {
                 BigDecimal quantityUsed = cartItem.getPromoQuantityCandidateUseActionAndAllConds(productPromoAction);
                 BigDecimal ratioOfTotal = quantityUsed.multiply(cartItem.getBasePrice()).divide(totalAmount, GEN_ROUNDING);
                 BigDecimal weightedAmount = ratioOfTotal.multiply(discountAmountTotal);
-                // round the weightedAmount to 3 decimal places, we don't want an exact number cents/whatever because this will be added up as part of a subtotal which will be rounded to 2 decimal places
+                // round the weightedAmount to 3 decimal places, we don't want an exact number cents/whatever because this will be added up as part
+                // of a subtotal which will be rounded to 2 decimal places
                 weightedAmount = weightedAmount.setScale(3, RoundingMode.HALF_UP);
                 discountAmount = discountAmount.subtract(weightedAmount);
                 doOrderItemPromoAction(productPromoAction, cartItem, weightedAmount, "amount", delegator);
@@ -1204,8 +1293,8 @@ public final class ProductPromoWorker {
                 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"))) {
+                            && productPromoAction.getString("productPromoRuleId").equals(checkOrderAdjustment.get("productPromoRuleId"))
+                            && productPromoAction.getString("productPromoActionSeqId").equals(checkOrderAdjustment.get("productPromoActionSeqId"))) {
                         return i;
                     }
                 }
@@ -1214,9 +1303,11 @@ public final class ProductPromoWorker {
         return null;
     }
 
-    public static void doOrderItemPromoAction(GenericValue productPromoAction, ShoppingCartItem cartItem, BigDecimal amount, String amountField, Delegator delegator) {
+    public static void doOrderItemPromoAction(GenericValue productPromoAction, ShoppingCartItem cartItem, BigDecimal amount, String amountField,
+                                              Delegator delegator) {
         // round the amount before setting to make sure we don't get funny numbers in there
-        // only round to 3 places, we need more specific amounts in adjustments so that they add up cleaner as part of the item subtotal, which will then be rounded
+        // only round to 3 places, we need more specific amounts in adjustments so that they add up cleaner as part of the item subtotal, which
+        // will then be rounded
         amount = amount.setScale(3, ROUNDING);
         boolean addNewAdjustment = true;
         List<GenericValue> adjustments = cartItem.getAdjustments();
@@ -1233,23 +1324,24 @@ public final class ProductPromoWorker {
             }
         }
         if (addNewAdjustment) {
-        GenericValue orderAdjustment = delegator.makeValue("OrderAdjustment",
-                UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT", amountField, amount,
-                        "productPromoId", productPromoAction.get("productPromoId"),
-                        "productPromoRuleId", productPromoAction.get("productPromoRuleId"),
-                        "productPromoActionSeqId", productPromoAction.get("productPromoActionSeqId"),
-                        "description", getProductPromoDescription((String) productPromoAction.get("productPromoId"), delegator)));
+            GenericValue orderAdjustment = delegator.makeValue("OrderAdjustment",
+                    UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT", amountField, amount,
+                            "productPromoId", productPromoAction.get("productPromoId"),
+                            "productPromoRuleId", productPromoAction.get("productPromoRuleId"),
+                            "productPromoActionSeqId", productPromoAction.get("productPromoActionSeqId"),
+                            "description", getProductPromoDescription((String) productPromoAction.get("productPromoId"), delegator)));
 
-        // if an orderAdjustmentTypeId was included, override the default
-        if (UtilValidate.isNotEmpty(productPromoAction.getString("orderAdjustmentTypeId"))) {
-            orderAdjustment.set("orderAdjustmentTypeId", productPromoAction.get("orderAdjustmentTypeId"));
-        }
+            // if an orderAdjustmentTypeId was included, override the default
+            if (UtilValidate.isNotEmpty(productPromoAction.getString("orderAdjustmentTypeId"))) {
+                orderAdjustment.set("orderAdjustmentTypeId", productPromoAction.get("orderAdjustmentTypeId"));
+            }
 
-        cartItem.addAdjustment(orderAdjustment);
+            cartItem.addAdjustment(orderAdjustment);
         }
     }
 
-    public static void doOrderPromoAction(GenericValue productPromoAction, ShoppingCart cart, BigDecimal amount, String amountField, Delegator delegator) {
+    public static void doOrderPromoAction(GenericValue productPromoAction, ShoppingCart cart, BigDecimal amount, String amountField,
+                                          Delegator delegator) {
         // round the amount before setting to make sure we don't get funny numbers in there
         amount = amount.setScale(DECIMALS, ROUNDING);
         GenericValue orderAdjustment = delegator.makeValue("OrderAdjustment",
@@ -1289,12 +1381,18 @@ public final class ProductPromoWorker {
 
     public static Set<String> getPromoRuleCondProductIds(GenericValue productPromoCond, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
         // get a cached list for the whole promo and filter it as needed, this for better efficiency in caching
-        List<GenericValue> productPromoCategoriesAll = EntityQuery.use(delegator).from("ProductPromoCategory").where("productPromoId", productPromoCond.get("productPromoId")).cache(true).queryList();
-        List<GenericValue> productPromoCategories = EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", "_NA_", "productPromoCondSeqId", "_NA_"));
-        productPromoCategories.addAll(EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", productPromoCond.get("productPromoRuleId"), "productPromoCondSeqId", productPromoCond.get("productPromoCondSeqId"))));
-        List<GenericValue> productPromoProductsAll = EntityQuery.use(delegator).from("ProductPromoProduct").where("productPromoId", productPromoCond.get("productPromoId")).cache(true).queryList();
-        List<GenericValue> productPromoProducts = EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", "_NA_", "productPromoCondSeqId", "_NA_"));
-        productPromoProducts.addAll(EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", productPromoCond.get("productPromoRuleId"), "productPromoCondSeqId", productPromoCond.get("productPromoCondSeqId"))));
+        List<GenericValue> productPromoCategoriesAll = EntityQuery.use(delegator).from("ProductPromoCategory").where("productPromoId",
+                productPromoCond.get("productPromoId")).cache(true).queryList();
+        List<GenericValue> productPromoCategories = EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", "_NA_",
+                "productPromoCondSeqId", "_NA_"));
+        productPromoCategories.addAll(EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", productPromoCond.get(
+                "productPromoRuleId"), "productPromoCondSeqId", productPromoCond.get("productPromoCondSeqId"))));
+        List<GenericValue> productPromoProductsAll = EntityQuery.use(delegator).from("ProductPromoProduct").where("productPromoId",
+                productPromoCond.get("productPromoId")).cache(true).queryList();
+        List<GenericValue> productPromoProducts = EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", "_NA_",
+                "productPromoCondSeqId", "_NA_"));
+        productPromoProducts.addAll(EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", productPromoCond.get(
+                "productPromoRuleId"), "productPromoCondSeqId", productPromoCond.get("productPromoCondSeqId"))));
 
         Set<String> productIds = new HashSet<>();
         makeProductPromoIdSet(productIds, productPromoCategories, productPromoProducts, delegator, nowTimestamp, false);
@@ -1303,20 +1401,28 @@ public final class ProductPromoWorker {
 
     public static Set<String> getPromoRuleActionProductIds(GenericValue productPromoAction, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
         // get a cached list for the whole promo and filter it as needed, this for better efficiency in caching
-        List<GenericValue> productPromoCategoriesAll = EntityQuery.use(delegator).from("ProductPromoCategory").where("productPromoId", productPromoAction.get("productPromoId")).cache(true).queryList();
-        List<GenericValue> productPromoCategories = EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", "_NA_", "productPromoActionSeqId", "_NA_"));
-        productPromoCategories.addAll(EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", productPromoAction.get("productPromoRuleId"), "productPromoActionSeqId", productPromoAction.get("productPromoActionSeqId"))));
-
-        List<GenericValue> productPromoProductsAll = EntityQuery.use(delegator).from("ProductPromoProduct").where("productPromoId", productPromoAction.get("productPromoId")).cache(true).queryList();
-        List<GenericValue> productPromoProducts = EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", "_NA_", "productPromoActionSeqId", "_NA_"));
-        productPromoProducts.addAll(EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", productPromoAction.get("productPromoRuleId"), "productPromoActionSeqId", productPromoAction.get("productPromoActionSeqId"))));
+        List<GenericValue> productPromoCategoriesAll = EntityQuery.use(delegator).from("ProductPromoCategory").where("productPromoId",
+                productPromoAction.get("productPromoId")).cache(true).queryList();
+        List<GenericValue> productPromoCategories = EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId", "_NA_",
+                "productPromoActionSeqId", "_NA_"));
+        productPromoCategories.addAll(EntityUtil.filterByAnd(productPromoCategoriesAll, UtilMisc.toMap("productPromoRuleId",
+                productPromoAction.get("productPromoRuleId"), "productPromoActionSeqId", productPromoAction.get("productPromoActionSeqId"))));
+
+        List<GenericValue> productPromoProductsAll = EntityQuery.use(delegator).from("ProductPromoProduct").where("productPromoId",
+                productPromoAction.get("productPromoId")).cache(true).queryList();
+        List<GenericValue> productPromoProducts = EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", "_NA_",
+                "productPromoActionSeqId", "_NA_"));
+        productPromoProducts.addAll(EntityUtil.filterByAnd(productPromoProductsAll, UtilMisc.toMap("productPromoRuleId", productPromoAction.get(
+                "productPromoRuleId"), "productPromoActionSeqId", productPromoAction.get("productPromoActionSeqId"))));
 
         Set<String> productIds = new HashSet<>();
         makeProductPromoIdSet(productIds, productPromoCategories, productPromoProducts, delegator, nowTimestamp, false);
         return productIds;
     }
 
-    public static void makeProductPromoIdSet(Set<String> productIds, List<GenericValue> productPromoCategories, List<GenericValue> productPromoProducts, Delegator delegator, Timestamp nowTimestamp, boolean filterOldProducts) throws GenericEntityException {
+    public static void makeProductPromoIdSet(Set<String> productIds, List<GenericValue> productPromoCategories,
+                                             List<GenericValue> productPromoProducts, Delegator delegator, Timestamp nowTimestamp,
+                                             boolean filterOldProducts) throws GenericEntityException {
         // do the includes
         handleProductPromoCategories(productIds, productPromoCategories, "PPPA_INCLUDE", delegator, nowTimestamp);
         handleProductPromoProducts(productIds, productPromoProducts, "PPPA_INCLUDE");
@@ -1330,17 +1436,21 @@ public final class ProductPromoWorker {
         handleProductPromoProducts(productIds, productPromoProducts, "PPPA_ALWAYS");
     }
 
-    public static void makeProductPromoCondActionIdSets(String productPromoId, Set<String> productIdsCond, Set<String> productIdsAction, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
+    public static void makeProductPromoCondActionIdSets(String productPromoId, Set<String> productIdsCond, Set<String> productIdsAction,
+                                                        Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
         makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, nowTimestamp, false);
     }
 
-    public static void makeProductPromoCondActionIdSets(String productPromoId, Set<String> productIdsCond, Set<String> productIdsAction, Delegator delegator, Timestamp nowTimestamp, boolean filterOldProducts) throws GenericEntityException {
+    public static void makeProductPromoCondActionIdSets(String productPromoId, Set<String> productIdsCond, Set<String> productIdsAction,
+                                                        Delegator delegator, Timestamp nowTimestamp, boolean filterOldProducts) throws GenericEntityException {
         if (nowTimestamp == null) {
             nowTimestamp = UtilDateTime.nowTimestamp();
         }
 
-        List<GenericValue> productPromoCategoriesAll = EntityQuery.use(delegator).from("ProductPromoCategory").where("productPromoId", productPromoId).cache(true).queryList();
-        List<GenericValue> productPromoProductsAll = EntityQuery.use(delegator).from("ProductPromoProduct").where("productPromoId", productPromoId).cache(true).queryList();
+        List<GenericValue> productPromoCategoriesAll = EntityQuery.use(delegator).from("ProductPromoCategory").where("productPromoId",
+                productPromoId).cache(true).queryList();
+        List<GenericValue> productPromoProductsAll =
+                EntityQuery.use(delegator).from("ProductPromoProduct").where("productPromoId", productPromoId).cache(true).queryList();
 
         List<GenericValue> productPromoProductsCond = new LinkedList<>();
         List<GenericValue> productPromoCategoriesCond = new LinkedList<>();
@@ -1349,18 +1459,22 @@ public final class ProductPromoWorker {
 
         for (GenericValue productPromoProduct : productPromoProductsAll) {
             // if the rule id is null then this is a global promo one, so always include
-            if (!"_NA_".equals(productPromoProduct.getString("productPromoCondSeqId")) || "_NA_".equals(productPromoProduct.getString("productPromoRuleId"))) {
+            if (!"_NA_".equals(productPromoProduct.getString("productPromoCondSeqId")) || "_NA_".equals(productPromoProduct.getString(
+                    "productPromoRuleId"))) {
                 productPromoProductsCond.add(productPromoProduct);
             }
-            if (!"_NA_".equals(productPromoProduct.getString("productPromoActionSeqId")) || "_NA_".equals(productPromoProduct.getString("productPromoRuleId"))) {
+            if (!"_NA_".equals(productPromoProduct.getString("productPromoActionSeqId")) || "_NA_".equals(productPromoProduct.getString(
+                    "productPromoRuleId"))) {
                 productPromoProductsAction.add(productPromoProduct);
             }
         }
         for (GenericValue productPromoCategory : productPromoCategoriesAll) {
-            if (!"_NA_".equals(productPromoCategory.getString("productPromoCondSeqId")) || "_NA_".equals(productPromoCategory.getString("productPromoRuleId"))) {
+            if (!"_NA_".equals(productPromoCategory.getString("productPromoCondSeqId")) || "_NA_".equals(productPromoCategory.getString(
+                    "productPromoRuleId"))) {
                 productPromoCategoriesCond.add(productPromoCategory);
             }
-            if (!"_NA_".equals(productPromoCategory.getString("productPromoActionSeqId")) || "_NA_".equals(productPromoCategory.getString("productPromoRuleId"))) {
+            if (!"_NA_".equals(productPromoCategory.getString("productPromoActionSeqId")) || "_NA_".equals(productPromoCategory.getString(
+                    "productPromoRuleId"))) {
                 productPromoCategoriesAction.add(productPromoCategory);
             }
         }
@@ -1398,7 +1512,8 @@ public final class ProductPromoWorker {
         return false;
     }
 
-    private static void handleProductPromoCategories(Set<String> productIds, List<GenericValue> productPromoCategories, String productPromoApplEnumId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
+    private static void handleProductPromoCategories(Set<String> productIds, List<GenericValue> productPromoCategories,
+                                                     String productPromoApplEnumId, Delegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
         boolean include = !"PPPA_EXCLUDE".equals(productPromoApplEnumId);
         Set<String> productCategoryIds = new HashSet<>();
         Map<String, List<Set<String>>> productCategoryGroupSetListMap = new HashMap<>();
@@ -1458,7 +1573,8 @@ public final class ProductPromoWorker {
             }
 
             // now go through all productId sets and only include IDs that are in all sets
-            // by definition if each id must be in all categories, then it must be in the first, so go through the first and drop each one that is not in all others
+            // by definition if each id must be in all categories, then it must be in the first, so go through the first and drop each one that is
+            // not in all others
             Set<String> firstProductIdSet = productIdSetList.remove(0);
             for (Set<String> productIdSet : productIdSetList) {
                 firstProductIdSet.retainAll(productIdSet);
@@ -1474,10 +1590,12 @@ public final class ProductPromoWorker {
         }
     }
 
-    private static void getAllProductIds(Set<String> productCategoryIdSet, Set<String> productIdSet, Delegator delegator, Timestamp nowTimestamp, boolean include) throws GenericEntityException {
+    private static void getAllProductIds(Set<String> productCategoryIdSet, Set<String> productIdSet, Delegator delegator, Timestamp nowTimestamp,
+                                         boolean include) throws GenericEntityException {
         for (String productCategoryId : productCategoryIdSet) {
             // get all product category memebers, filter by date
-            List<GenericValue> productCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId", productCategoryId).cache(true).filterByDate(nowTimestamp).queryList();
+            List<GenericValue> productCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId",
+                    productCategoryId).cache(true).filterByDate(nowTimestamp).queryList();
             for (GenericValue productCategoryMember : productCategoryMembers) {
                 String productId = productCategoryMember.getString("productId");
                 if (include) {
@@ -1503,6 +1621,12 @@ public final class ProductPromoWorker {
         }
     }
 
+    public static class ActionResultInfo {
+        public boolean ranAction = false;
+        public BigDecimal totalDiscountAmount = BigDecimal.ZERO;
+        public BigDecimal quantityLeftInAction = BigDecimal.ZERO;
+    }
+
     @SuppressWarnings("serial")
     private static class UseLimitException extends Exception {
         public UseLimitException(String str) {
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 02d7273..160d949 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
@@ -381,8 +381,7 @@ public class ShippingEvents {
                 EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "POSTAL_ADDRESS"),
                 EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.IN, UtilMisc.toList("SHIP_ORIG_LOCATION", "GENERAL_LOCATION")),
                 EntityUtil.getFilterByDateExpr("contactFromDate", "contactThruDate"),
-                EntityUtil.getFilterByDateExpr("purposeFromDate", "purposeThruDate")
-        );
+                EntityUtil.getFilterByDateExpr("purposeFromDate", "purposeThruDate"));
         EntityConditionList<EntityCondition> ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
 
         List<GenericValue> addresses = delegator.findList("PartyContactWithPurpose", ecl, null, UtilMisc.toList("contactMechPurposeTypeId DESC"), null, false);
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
index e6836aa..fe553e7 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java
@@ -83,17 +83,17 @@ public class ShoppingListServices {
 
         if (startDate == null) {
             switch (frequency) {
-                case 5:
-                    startDate = UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp(), 0, interval);
-                    break;
-                case 6:
-                    startDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp(), 0, interval);
-                    break;
-                case 7:
-                    startDate = UtilDateTime.getYearStart(UtilDateTime.nowTimestamp(), 0, interval);
-                    break;
-                default:
-                    return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderInvalidFrequencyForShoppingListRecurrence", locale));
+            case 5:
+                startDate = UtilDateTime.getWeekStart(UtilDateTime.nowTimestamp(), 0, interval);
+                break;
+            case 6:
+                startDate = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp(), 0, interval);
+                break;
+            case 7:
+                startDate = UtilDateTime.getYearStart(UtilDateTime.nowTimestamp(), 0, interval);
+                break;
+            default:
+                return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR, "OrderInvalidFrequencyForShoppingListRecurrence", locale));
             }
         }
 
@@ -483,10 +483,11 @@ public class ShoppingListServices {
                         reservPersons = shoppingListItem.getBigDecimal("reservPersons");
                     }
                     if (UtilValidate.isNotEmpty(productId) && quantity != null) {
-
-                    if (UtilValidate.isNotEmpty(configId)) {
-                        configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, configId, productId, listCart.getProductStoreId(), null, listCart.getWebSiteId(), listCart.getCurrency(), listCart.getLocale(), listCart.getAutoUserLogin());
-                    }
+                        if (UtilValidate.isNotEmpty(configId)) {
+                            configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, configId, productId,
+                                listCart.getProductStoreId(), null, listCart.getWebSiteId(), listCart.getCurrency(), listCart.getLocale(),
+                                listCart.getAutoUserLogin());
+                        }
                         // list items are noted in the shopping cart
                         String listId = shoppingListItem.getString("shoppingListId");
                         String itemId = shoppingListItem.getString("shoppingListItemSeqId");
@@ -569,7 +570,7 @@ public class ShoppingListServices {
                 }
             }
         } catch (GenericEntityException gee) {
-            Debug.logInfo("updateShoppingListQuantitiesFromOrder error:"+gee.getMessage(), MODULE);
+            Debug.logInfo("updateShoppingListQuantitiesFromOrder error:" + gee.getMessage(), MODULE);
         }
         return result;
     }
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
index 6a24bf3..1906bc0 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java
@@ -371,7 +371,7 @@ public class ZipSalesServices {
                 String idCode = rule.getString("idCode");
                 String taxable = rule.getString("taxable");
                 String condition = rule.getString("shipCond");
-                if ("T".equals(taxable))  {
+                if ("T".equals(taxable)) {
                     // this record is taxable
                     continue;
                 } else {
@@ -381,71 +381,71 @@ public class ZipSalesServices {
                         char[] conditions = condition.toCharArray();
                         for (int i = 0; i < conditions.length; i++) {
                             switch (conditions[i]) {
-                                case 'A' :
-                                    // SHIPPING CHARGE SEPARATELY STATED ON INVOICE
-                                    qualify = true; // OFBiz does this by default
-                                    break;
-                                case 'B' :
-                                    // SHIPPING CHARGE SEPARATED ON INVOICE FROM HANDLING OR SIMILAR CHARGES
-                                    qualify = false; // we do not support this currently
-                                    break;
-                                case 'C' :
-                                    // ITEM NOT SOLD FOR GUARANTEED SHIPPED PRICE
-                                    qualify = false; // we don't support this currently
-                                    break;
-                                case 'D' :
-                                    // SHIPPING CHARGE IS COST ONLY
-                                    qualify = false; // we assume a handling charge is included
-                                    break;
-                                case 'E' :
-                                    // SHIPPED DIRECTLY TO PURCHASER
-                                    qualify = true; // this is true, unless gifts do not count?
-                                    break;
-                                case 'F' :
-                                    // SHIPPED VIA COMMON CARRIER
-                                    qualify = true; // best guess default
-                                    break;
-                                case 'G' :
-                                    // SHIPPED VIA CONTRACT CARRIER
-                                    qualify = false; // best guess default
-                                    break;
-                                case 'H' :
-                                    // SHIPPED VIA VENDOR EQUIPMENT
-                                    qualify = false; // best guess default
-                                    break;
-                                case 'I' :
-                                    // SHIPPED F.O.B. ORIGIN
-                                    qualify = false; // no clue
-                                    break;
-                                case 'J' :
-                                    // SHIPPED F.O.B. DESTINATION
-                                    qualify = false; // no clue
-                                    break;
-                                case 'K' :
-                                    // F.O.B. IS PURCHASERS OPTION
-                                    qualify = false; // no clue
-                                    break;
-                                case 'L' :
-                                    // SHIPPING ORIGINATES OR TERMINATES IN DIFFERENT STATES
-                                    qualify = true; // not determined at order time, no way to know
-                                    break;
-                                case 'M' :
-                                    // PROOF OF VENDOR ACTING AS SHIPPING AGENT FOR PURCHASER
-                                    qualify = false; // no clue
-                                    break;
-                                case 'N' :
-                                    // SHIPPED FROM VENDOR LOCATION
-                                    qualify = true; // sure why not
-                                    break;
-                                case 'O' :
-                                    // SHIPPING IS BY PURCHASER OPTION
-                                    qualify = false; // most online stores require shipping
-                                    break;
-                                case 'P' :
-                                    // CREDIT ALLOWED FOR SHIPPING CHARGE PAID BY PURCHASER TO CARRIER
-                                    qualify = false; // best guess default
-                                    break;
-                                default: break;
+                            case 'A' :
+                                // SHIPPING CHARGE SEPARATELY STATED ON INVOICE
+                                qualify = true; // OFBiz does this by default
+                                break;
+                            case 'B' :
+                                // SHIPPING CHARGE SEPARATED ON INVOICE FROM HANDLING OR SIMILAR CHARGES
+                                qualify = false; // we do not support this currently
+                                break;
+                            case 'C' :
+                                // ITEM NOT SOLD FOR GUARANTEED SHIPPED PRICE
+                                qualify = false; // we don't support this currently
+                                break;
+                            case 'D' :
+                                // SHIPPING CHARGE IS COST ONLY
+                                qualify = false; // we assume a handling charge is included
+                                break;
+                            case 'E' :
+                                // SHIPPED DIRECTLY TO PURCHASER
+                                qualify = true; // this is true, unless gifts do not count?
+                                break;
+                            case 'F' :
+                                // SHIPPED VIA COMMON CARRIER
+                                qualify = true; // best guess default
+                                break;
+                            case 'G' :
+                                // SHIPPED VIA CONTRACT CARRIER
+                                qualify = false; // best guess default
+                                break;
+                            case 'H' :
+                                // SHIPPED VIA VENDOR EQUIPMENT
+                                qualify = false; // best guess default
+                                break;
+                            case 'I' :
+                                // SHIPPED F.O.B. ORIGIN
+                                qualify = false; // no clue
+                                break;
+                            case 'J' :
+                                // SHIPPED F.O.B. DESTINATION
+                                qualify = false; // no clue
+                                break;
+                            case 'K' :
+                                // F.O.B. IS PURCHASERS OPTION
+                                qualify = false; // no clue
+                                break;
+                            case 'L' :
+                                // SHIPPING ORIGINATES OR TERMINATES IN DIFFERENT STATES
+                                qualify = true; // not determined at order time, no way to know
+                                break;
+                            case 'M' :
+                                // PROOF OF VENDOR ACTING AS SHIPPING AGENT FOR PURCHASER
+                                qualify = false; // no clue
+                                break;
+                            case 'N' :
+                                // SHIPPED FROM VENDOR LOCATION
+                                qualify = true; // sure why not
+                                break;
+                            case 'O' :
+                                // SHIPPING IS BY PURCHASER OPTION
+                                qualify = false; // most online stores require shipping
+                                break;
+                            case 'P' :
+                                // CREDIT ALLOWED FOR SHIPPING CHARGE PAID BY PURCHASER TO CARRIER
+                                qualify = false; // best guess default
+                                break;
+                            default: break;
                             }
                         }
                     }
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 d707e3c..4ce9478 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
@@ -337,9 +337,9 @@ public class CommunicationEventServices {
                     ftpServiceMap.put("partyId", communicationEvent.getString("partyIdTo"));
                     ftpServiceMap.put("contactMechId", contactMechId);
                     // no need to create a child CommEvent if it is a single content transfer
-                    if (contents.size() == 1)
+                    if (contents.size() == 1) {
                         ftpServiceMap.put("communicationEventId", communicationEvent.get("communicationEventId"));
-                    else {
+                    } else {
                         // check if currentContent is already sent by an existing children communicationEvent
                         EntityCondition sentCond = EntityCondition.makeCondition(UtilMisc.toList(
                                 EntityCondition.makeCondition("communicationEventId", EntityOperator.IN, childrenCommunicationEventIds),
@@ -967,7 +967,7 @@ public class CommunicationEventServices {
                 // check if started with the domain name if yes remove including the dash.
                 String dn = deliveredTo.substring(deliveredTo.indexOf('@') + 1, deliveredTo.length());
                 if (deliveredTo.startsWith(dn)) {
-                    deliveredTo = deliveredTo.substring(dn.length()+1, deliveredTo.length());
+                    deliveredTo = deliveredTo.substring(dn.length() + 1, deliveredTo.length());
                 }
             }
 
diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java b/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java
index d0d1144..2f96d04 100644
--- a/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java
+++ b/applications/party/src/main/java/org/apache/ofbiz/party/contact/ContactMechWorker.java
@@ -70,18 +70,18 @@ public class ContactMechWorker {
         String entityName = null;
         String prefix = null;
         switch (contactMechTypeId) {
-            case "POSTAL_ADDRESS":
-                entityName = "PostalAddress";
-                prefix = "pa";
-                break;
-            case "TELECOM_NUMBER":
-                entityName = "TelecomNumber";
-                prefix = "tn";
-                break;
-            case "FTP_ADDRESS":
-                entityName = "FtpAddress";
-                prefix = "fa";
-                break;
+        case "POSTAL_ADDRESS":
+            entityName = "PostalAddress";
+            prefix = "pa";
+            break;
+        case "TELECOM_NUMBER":
+            entityName = "TelecomNumber";
+            prefix = "tn";
+            break;
+        case "FTP_ADDRESS":
+            entityName = "FtpAddress";
+            prefix = "fa";
+            break;
         }
         if (entityName != null) {
             GenericValue element = delegator.makeValue(entityName);
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 fabb6d4..2ce8d70 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
@@ -173,7 +173,7 @@ public class PartyServices {
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
-                    "person.create.db_error", new Object[] { e.getMessage() }, locale));
+                    "person.create.db_error", new Object[] {e.getMessage() }, locale));
         }
 
         result.put("partyId", partyId);
@@ -207,24 +207,22 @@ public class PartyServices {
                     party.set("statusId", statusId);
                     oldStatusId = party.getString("statusId");
                 } else {
-
-                // check that status is defined as a valid change
-                GenericValue statusValidChange = EntityQuery.use(delegator).from("StatusValidChange").where("statusId", party.getString("statusId"), "statusIdTo", statusId).queryOne();
-                if (statusValidChange == null) {
-                    String errorMsg = "Cannot change party status from " + party.getString("statusId") + " to " + statusId;
-                    Debug.logWarning(errorMsg, MODULE);
-                    return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE,
-                            "PartyStatusCannotBeChanged",
-                            UtilMisc.toMap("partyFromStatusId", party.getString("statusId"),
-                            "partyToStatusId", statusId), locale));
-                }
-
-                party.set("statusId", statusId);
+                    // check that status is defined as a valid change
+                    GenericValue statusValidChange = EntityQuery.use(delegator).from("StatusValidChange").where("statusId", party.getString("statusId"),
+                        "statusIdTo", statusId).queryOne();
+                    if (statusValidChange == null) {
+                        String errorMsg = "Cannot change party status from " + party.getString("statusId") + " to " + statusId;
+                        Debug.logWarning(errorMsg, MODULE);
+                        return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "PartyStatusCannotBeChanged",
+                                UtilMisc.toMap("partyFromStatusId", party.getString("statusId"), "partyToStatusId", statusId), locale));
+                    }
+                    party.set("statusId", statusId);
                 }
                 party.store();
 
                 // record this status change in PartyStatus table
-                GenericValue partyStatus = delegator.makeValue("PartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", statusId, "statusDate", statusDate));
+                GenericValue partyStatus = delegator.makeValue("PartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", statusId,
+                    "statusDate", statusDate));
                 if (loggedInUserLogin != null) {
                     partyStatus.put("changeByUserLoginId", loggedInUserLogin.get("userLoginId"));
                 }
@@ -234,8 +232,7 @@ public class PartyServices {
                 if (("PARTY_DISABLED").equals(statusId)) {
                     EntityCondition cond = EntityCondition.makeCondition(
                             EntityCondition.makeCondition("partyId", partyId),
-                            EntityCondition.makeCondition("enabled", EntityOperator.NOT_EQUAL, "N")
-                            );
+                            EntityCondition.makeCondition("enabled", EntityOperator.NOT_EQUAL, "N"));
                     List<GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").where(cond).queryList();
                     for (GenericValue userLogin : userLogins) {
                         userLogin.set("enabled", "N");
@@ -251,7 +248,7 @@ public class PartyServices {
         } catch (GenericEntityException e) {
             Debug.logError(e, e.getMessage(), MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
-                    "person.update.write_failure", new Object[] { e.getMessage() }, locale));
+                    "person.update.write_failure", new Object[] {e.getMessage() }, locale));
         }
     }
 
@@ -282,7 +279,7 @@ public class PartyServices {
         } catch (GenericEntityException e) {
             Debug.logWarning(e, MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
-                    "person.update.read_failure", new Object[] { e.getMessage() }, locale));
+                    "person.update.read_failure", new Object[] {e.getMessage() }, locale));
         }
 
         if (person == null || party == null) {
@@ -307,7 +304,7 @@ public class PartyServices {
         } catch (GenericEntityException e) {
             Debug.logWarning(e.getMessage(), MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
-                    "person.update.write_failure", new Object[] { e.getMessage() }, locale));
+                    "person.update.write_failure", new Object[] {e.getMessage() }, locale));
         }
 
         if (UtilValidate.isNotEmpty(context.get("statusId")) && !context.get("statusId").equals(oldStatusId)) {
@@ -319,7 +316,7 @@ public class PartyServices {
             } catch (GenericServiceException e) {
                 Debug.logWarning(e.getMessage(), MODULE);
                 return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
-                        "person.update.write_failure", new Object[] { e.getMessage() }, locale));
+                        "person.update.write_failure", new Object[] {e.getMessage() }, locale));
             }
         }
 
@@ -501,7 +498,7 @@ public class PartyServices {
             } catch (GenericServiceException e) {
                 Debug.logWarning(e.getMessage(), MODULE);
                 return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
-                        "person.update.write_failure", new Object[] { e.getMessage() }, locale));
+                        "person.update.write_failure", new Object[] {e.getMessage() }, locale));
             }
         }
 
@@ -1168,7 +1165,7 @@ public class PartyServices {
                 // check for a partyId
                 if (UtilValidate.isNotEmpty(partyId)) {
                     paramList = paramList + "&partyId=" + partyId;
-                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+partyId+"%")));
+                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + partyId + "%")));
                 }
 
                 // now the statusId - send ANY for all statuses; leave null for just enabled; or pass a specific status
@@ -1184,7 +1181,7 @@ public class PartyServices {
                 // check for partyTypeId
                 if (partyTypeId != null && !"ANY".equals(partyTypeId)) {
                     paramList = paramList + "&partyTypeId=" + partyTypeId;
-                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyTypeId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+partyTypeId+"%")));
+                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyTypeId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + partyTypeId + "%")));
                 }
 
                 // ----
@@ -1201,7 +1198,7 @@ public class PartyServices {
                     dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
 
                     // add the expr
-                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+userLoginId+"%")));
+                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + userLoginId + "%")));
 
                     fieldsToSelect.add("userLoginId");
                 }
@@ -1220,7 +1217,7 @@ public class PartyServices {
                     dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
 
                     // add the expr
-                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+groupName+"%")));
+                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + groupName + "%")));
 
                     fieldsToSelect.add("groupName");
                 }
@@ -1245,13 +1242,13 @@ public class PartyServices {
                 // filter on firstName
                 if (UtilValidate.isNotEmpty(firstName)) {
                     paramList = paramList + "&firstName=" + firstName;
-                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+firstName+"%")));
+                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + firstName + "%")));
                 }
 
                 // filter on lastName
                 if (UtilValidate.isNotEmpty(lastName)) {
                     paramList = paramList + "&lastName=" + lastName;
-                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+lastName+"%")));
+                    andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + lastName + "%")));
                 }
 
                 // ----
@@ -1383,7 +1380,7 @@ public class PartyServices {
                     String infoString = (String) context.get("infoString");
                     if (UtilValidate.isNotEmpty(infoString)) {
                         paramList = paramList + "&infoString=" + infoString;
-                        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER("%"+infoString+"%")));
+                        andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("infoString"), EntityOperator.LIKE, EntityFunction.UPPER("%" + infoString + "%")));
                         fieldsToSelect.add("infoString");
                     }
 
@@ -1573,7 +1570,7 @@ public class PartyServices {
 
         // check for a partyId
         if (UtilValidate.isNotEmpty(partyId)) {
-            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+partyId+"%")));
+            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("partyId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + partyId + "%")));
         }
 
         // now the statusId - send ANY for all statuses; leave null for just enabled; or pass a specific status
@@ -1604,7 +1601,7 @@ public class PartyServices {
             dynamicView.addViewLink("PT", "UL", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
 
             // add the expr
-            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%"+userLoginId+"%")));
+            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"), EntityOperator.LIKE, EntityFunction.UPPER("%" + userLoginId + "%")));
             fieldsToSelect.add("userLoginId");
         }
 
@@ -1621,7 +1618,7 @@ public class PartyServices {
             dynamicView.addViewLink("PT", "PG", Boolean.FALSE, ModelKeyMap.makeKeyMapList("partyId"));
 
             // add the expr
-            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+groupName+"%")));
+            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("groupName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + groupName + "%")));
             fieldsToSelect.add("groupName");
         }
 
@@ -1644,12 +1641,12 @@ public class PartyServices {
 
         // filter on firstName
         if (UtilValidate.isNotEmpty(firstName)) {
-            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+firstName+"%")));
+            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("firstName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + firstName + "%")));
         }
 
         // filter on lastName
         if (UtilValidate.isNotEmpty(lastName)) {
-            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%"+lastName+"%")));
+            andExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("lastName"), EntityOperator.LIKE, EntityFunction.UPPER("%" + lastName + "%")));
         }
 
         // ----
@@ -1869,8 +1866,8 @@ public class PartyServices {
         }
 
         // do the lookup
-        if (UtilValidate.isNotEmpty(noConditionFind) &&
-                ("Y".equals(noConditionFind) || andExprs.size()>1)) { //exclude on condition the status expr
+        if (UtilValidate.isNotEmpty(noConditionFind) && ("Y".equals(noConditionFind) || andExprs.size() > 1)) {
+            //exclude on condition the status expr
             try {
                 // set distinct on so we only get one row per party
                 // using list iterator
@@ -2319,7 +2316,7 @@ public class PartyServices {
                     if (UtilValidate.isEmpty(rec.get("roleTypeId"))) {
                         newErrMsgs.add("Line number " + rec.getRecordNumber() + ": Mandatory roletype is missing, possible values: CUSTOMER, SUPPLIER, EMPLOYEE and more....");
                     } else if (EntityQuery.use(delegator).from("RoleType").where("roleTypeId", rec.get("roleTypeId")).queryOne() == null) {
-                        newErrMsgs.add("Line number " + rec.getRecordNumber() + ": RoletypeId is not valid: " + rec.get("roleTypeId") );
+                        newErrMsgs.add("Line number " + rec.getRecordNumber() + ": RoletypeId is not valid: " + rec.get("roleTypeId"));
                     }
 
                     if (UtilValidate.isNotEmpty(rec.get("contactMechTypeId"))
@@ -2384,8 +2381,7 @@ public class PartyServices {
                                         "partyId", newPartyId,
                                         "preferredCurrencyUomId", rec.get("preferredCurrencyUomId"),
                                         "groupName", rec.get("groupName"),
-                                        "userLogin", userLogin
-                                        );
+                                        "userLogin", userLogin);
                                 result = dispatcher.runSync("updatePartyGroup", partyGroup);
                                 if (ServiceUtil.isError(result)) {
                                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2397,8 +2393,7 @@ public class PartyServices {
                                         "middleName", rec.get("middleName"),
                                         "lastName", rec.get("lastName"),
                                         "preferredCurrencyUomId", rec.get("preferredCurrencyUomId"),
-                                        "userLogin", userLogin
-                                        );
+                                        "userLogin", userLogin);
                                 result = dispatcher.runSync("updatePerson", person);
                                 if (ServiceUtil.isError(result)) {
                                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2411,8 +2406,7 @@ public class PartyServices {
                                         "preferredCurrencyUomId", rec.get("preferredCurrencyUomId"),
                                         "groupName", rec.get("groupName"),
                                         "userLogin", userLogin,
-                                        "statusId", "PARTY_ENABLED"
-                                        );
+                                        "statusId", "PARTY_ENABLED");
                                 result = dispatcher.runSync("createPartyGroup", partyGroup);
                                 if (ServiceUtil.isError(result)) {
                                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2424,8 +2418,7 @@ public class PartyServices {
                                         "lastName", rec.get("lastName"),
                                         "preferredCurrencyUomId", rec.get("preferredCurrencyUomId"),
                                         "statusId", "PARTY_ENABLED",
-                                        "userLogin", userLogin
-                                        );
+                                        "userLogin", userLogin);
                                 result = dispatcher.runSync("createPerson", person);
                                 if (ServiceUtil.isError(result)) {
                                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2433,23 +2426,16 @@ public class PartyServices {
                             }
                             newPartyId = (String) result.get("partyId");
 
-                            Map<String, Object> partyIdentification = UtilMisc.toMap(
-                                "partyId", newPartyId,
-                                "partyIdentificationTypeId", "PARTY_IMPORT",
-                                "idValue", rec.get("partyId"),
-                                "userLogin", userLogin
-                                );
+                            Map<String, Object> partyIdentification = UtilMisc.toMap("partyId", newPartyId,
+                                "partyIdentificationTypeId", "PARTY_IMPORT", "idValue", rec.get("partyId"), "userLogin", userLogin);
 
                             result = dispatcher.runSync("createPartyIdentification", partyIdentification);
                             if (ServiceUtil.isError(result)) {
                                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
                             }
 
-                            Map<String, Object> partyRole = UtilMisc.toMap(
-                                    "partyId", newPartyId,
-                                    "roleTypeId", rec.get("roleTypeId"),
-                                    "userLogin", userLogin
-                                    );
+                            Map<String, Object> partyRole = UtilMisc.toMap("partyId", newPartyId, "roleTypeId", rec.get("roleTypeId"),
+                                    "userLogin", userLogin);
                             dispatcher.runSync("createPartyRole", partyRole);
                             if (ServiceUtil.isError(result)) {
                                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2462,10 +2448,7 @@ public class PartyServices {
                                 if (companyCheck.size() == 0) { // update party group
                                     // company does not exist so create
                                     Map<String, Object> companyPartyGroup = UtilMisc.toMap(
-                                        "partyId", newCompanyPartyId,
-                                        "statusId", "PARTY_ENABLED",
-                                        "userLogin", userLogin
-                                        );
+                                        "partyId", newCompanyPartyId, "statusId", "PARTY_ENABLED", "userLogin", userLogin);
                                     result = dispatcher.runSync("createPartyGroup", companyPartyGroup);
                                     if (ServiceUtil.isError(result)) {
                                         return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2476,23 +2459,15 @@ public class PartyServices {
                                 }
 
                                 Map<String, Object> companyRole = UtilMisc.toMap(
-                                        "partyId", newCompanyPartyId,
-                                        "roleTypeId", "ACCOUNT",
-                                        "userLogin", userLogin
-                                        );
+                                        "partyId", newCompanyPartyId, "roleTypeId", "ACCOUNT", "userLogin", userLogin);
                                 Map<String, Object> serviceResult = dispatcher.runSync("createPartyRole", companyRole);
                                 if (ServiceUtil.isError(serviceResult)) {
                                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
                                 }
 
                                 // company exist, so create link
-                                Map<String, Object> partyRelationship = UtilMisc.toMap(
-                                    "partyIdTo", newPartyId,
-                                    "partyIdFrom", newCompanyPartyId,
-                                    "roleTypeIdFrom", "ACCOUNT",
-                                    "partyRelationshipTypeId", "EMPLOYMENT",
-                                    "userLogin", userLogin
-                                    );
+                                Map<String, Object> partyRelationship = UtilMisc.toMap("partyIdTo", newPartyId, "partyIdFrom", newCompanyPartyId,
+                                    "roleTypeIdFrom", "ACCOUNT", "partyRelationshipTypeId", "EMPLOYMENT", "userLogin", userLogin);
                                 result = dispatcher.runSync("createPartyRelationship", partyRelationship);
                                 if (ServiceUtil.isError(result)) {
                                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
@@ -2513,10 +2488,7 @@ public class PartyServices {
                 if (newPartyId != null && addParty && UtilValidate.isNotEmpty(currentContactMechTypeId)) {
 
                     // fill maps and check changes
-                    Map<String, Object> emailAddress = UtilMisc.toMap(
-                            "contactMechTypeId", "EMAIL_ADDRESS",
-                            "userLogin", userLogin
-                            );
+                    Map<String, Object> emailAddress = UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "userLogin", userLogin);
                     boolean emailAddressChanged = false;
                     if ("EMAIL_ADDRESS".equals(currentContactMechTypeId)) {
                         emailAddress.put("infoString", rec.get("emailAddress"));
@@ -2530,7 +2502,7 @@ public class PartyServices {
                     if ("POSTAL_ADDRESS".equals(currentContactMechTypeId)) {
                         postalAddress.put("address1", rec.get("address1"));
                         postalAddress.put("address2", rec.get("address2"));
-                           postalAddress.put("city", rec.get("city"));
+                        postalAddress.put("city", rec.get("city"));
                         postalAddress.put("stateProvinceGeoId", rec.get("stateProvinceGeoId"));
                         postalAddress.put("countryGeoId", rec.get("countryGeoId"));
                         postalAddress.put("postalCode", rec.get("postalCode"));
@@ -2564,7 +2536,7 @@ public class PartyServices {
                     Map<String, Object> partyContactMechPurpose = UtilMisc.toMap("partyId", newPartyId, "userLogin", userLogin);
                     boolean partyContactMechPurposeChanged = false;
                     currentContactMechPurposeTypeId = rec.get("contactMechPurposeTypeId");
-                    if (currentContactMechPurposeTypeId != null && ("TELECOM_NUMBER".equals(currentContactMechTypeId) || "POSTAL_ADDRESS".equals(currentContactMechTypeId) ||"EMAIL_ADDRESS".equals(currentContactMechTypeId))) {
+                    if (currentContactMechPurposeTypeId != null && ("TELECOM_NUMBER".equals(currentContactMechTypeId) || "POSTAL_ADDRESS".equals(currentContactMechTypeId) || "EMAIL_ADDRESS".equals(currentContactMechTypeId))) {
                         partyContactMechPurpose.put("contactMechPurposeTypeId", currentContactMechPurposeTypeId);
                         partyContactMechPurposeChanged = (lastContactMechPurposeTypeId == null || !lastContactMechPurposeTypeId.equals(currentContactMechPurposeTypeId)) && !telecomNumberChanged && !postalAddressChanged && !emailAddressChanged;
                         Debug.logInfo("===================================last:" + lastContactMechPurposeTypeId + " current: " + currentContactMechPurposeTypeId + " t :" + telecomNumberChanged + " p: " + postalAddressChanged + " e: " + emailAddressChanged + " result: " + partyContactMechPurposeChanged, MODULE);
@@ -2579,7 +2551,7 @@ public class PartyServices {
                             if (ServiceUtil.isError(result)) {
                                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
                             }
-                               newContactMechId = (String) result.get("contactMechId");
+                            newContactMechId = (String) result.get("contactMechId");
                             if (currentContactMechPurposeTypeId == null) {
                                 currentContactMechPurposeTypeId = "GENERAL_LOCATION";
                             }
@@ -2594,9 +2566,9 @@ public class PartyServices {
                             if (ServiceUtil.isError(result)) {
                                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
                             }
-                               newContactMechId = (String) result.get("contactMechId");
+                            newContactMechId = (String) result.get("contactMechId");
                             if (currentContactMechPurposeTypeId == null) {
-                                currentContactMechPurposeTypeId= "PHONE_WORK";
+                                currentContactMechPurposeTypeId = "PHONE_WORK";
                             }
                             Map<String, Object> resultMap = dispatcher.runSync("createPartyContactMech", UtilMisc.toMap("partyId", newPartyId, "contactMechId", newContactMechId, "contactMechPurposeTypeId", currentContactMechPurposeTypeId, "userLogin", userLogin));
                             if (ServiceUtil.isError(resultMap)) {
@@ -2609,7 +2581,7 @@ public class PartyServices {
                             if (ServiceUtil.isError(result)) {
                                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
                             }
-                               newContactMechId = (String) result.get("contactMechId");
+                            newContactMechId = (String) result.get("contactMechId");
                             if (currentContactMechPurposeTypeId == null) {
                                 currentContactMechPurposeTypeId = "PRIMARY_EMAIL";
                             }
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 0bd7a91..13c86e6 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
@@ -222,7 +222,7 @@ public class PartyWorker {
             postalCodeExt, countryGeoId, firstName, middleName, lastName);
         GenericValue v = EntityUtil.getFirst(matching);
         if (v != null) {
-            return new String[] { v.getString("partyId"), v.getString("contactMechId") };
+            return new String[] {v.getString("partyId"), v.getString("contactMechId") };
         }
         return null;
     }
@@ -527,7 +527,7 @@ public class PartyWorker {
     }
 
     public static List<GenericValue> findPartiesById(Delegator delegator, String idToFind, String partyIdentificationTypeId)
-    throws GenericEntityException {
+        throws GenericEntityException {
         return findPartiesById(delegator, idToFind, partyIdentificationTypeId, true, false);
     }
 
@@ -563,8 +563,7 @@ public class PartyWorker {
 
                 if (UtilValidate.isEmpty(parties)) {
                     parties = UtilMisc.toList(partyToAdd);
-                }
-                else {
+                } else {
                     parties.add(partyToAdd);
                 }
             }
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 e155ae5..b5c118e 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
@@ -354,9 +354,7 @@ public final class CatalogWorker {
 
         return EntityUtil.getFieldListFromEntityList(
                 getProdCatalogCategories(request, prodCatalogId, "PCCT_QUICK_ADD"),
-                "productCategoryId",
-                true
-        );
+                "productCategoryId", true);
     }
 
     public static String getCatalogTopEbayCategoryId(ServletRequest request, String prodCatalogId) {
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 900a2a9..cebc785 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
@@ -315,7 +315,7 @@ public class CategoryServices {
                         try {
                             productCategoryMembers = ProductWorker.filterOutOfStockProducts(productCategoryMembers, dispatcher, delegator);
                         } catch (GeneralException e) {
-                            Debug.logWarning("Problem filtering out of stock products :"+e.getMessage(), MODULE);
+                            Debug.logWarning("Problem filtering out of stock products :" + e.getMessage(), MODULE);
                         }
                     }
                     // filter out the view allow before getting the sublist
@@ -407,7 +407,7 @@ public class CategoryServices {
                             productCategoryMembers = ProductWorker.filterOutOfStockProducts(productCategoryMembers, dispatcher, delegator);
                             listSize = productCategoryMembers.size();
                         } catch (GeneralException e) {
-                            Debug.logWarning("Problem filtering out of stock products :"+e.getMessage(), MODULE);
+                            Debug.logWarning("Problem filtering out of stock products :" + e.getMessage(), MODULE);
                         }
                     }
 
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementHelper.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementHelper.java
index 718c481..91d2130 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementHelper.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementHelper.java
@@ -33,7 +33,7 @@ import org.apache.ofbiz.entity.util.EntityUtil;
 
 public final class ImageManagementHelper {
 
-    static String MODULE = ImageManagementHelper.class.getName();
+    private static final String MODULE = ImageManagementHelper.class.getName();
     private ImageManagementHelper() { }
 
     public static String getInternalImageUrl(HttpServletRequest request, String productId) {
@@ -43,14 +43,16 @@ public final class ImageManagementHelper {
         }
         try {
             Delegator delegator = (Delegator) request.getAttribute("delegator");
-            List<GenericValue> defaultImageList = EntityQuery.use(delegator).from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "DEFAULT_IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "N").orderBy("sequenceNum").queryList();
+            List<GenericValue> defaultImageList = EntityQuery.use(delegator).from("ProductContentAndInfo").where("productId", productId,
+                    "productContentTypeId", "DEFAULT_IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "N").orderBy("sequenceNum").queryList();
             if (UtilValidate.isNotEmpty(defaultImageList)) {
                 GenericValue productContent = EntityUtil.getFirst(defaultImageList);
                 if (UtilValidate.isNotEmpty(productContent.get("drObjectInfo"))) {
                     internalImageUrl = (String) productContent.get("drObjectInfo");
                 }
             } else {
-                List<GenericValue> productContentList = EntityQuery.use(delegator).from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "N").orderBy("sequenceNum").queryList();
+                List<GenericValue> productContentList = EntityQuery.use(delegator).from("ProductContentAndInfo").where("productId", productId,
+                        "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "N").orderBy("sequenceNum").queryList();
                 if (UtilValidate.isNotEmpty(productContentList)) {
                     GenericValue productContent = EntityUtil.getFirst(productContentList);
                     if (UtilValidate.isNotEmpty(productContent.get("drObjectInfo"))) {
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java
index 050a50d..4ba36b2 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryWorker.java
@@ -114,8 +114,7 @@ public final class InventoryWorker {
                 EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, orderTypeId),
                 EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_COMPLETED"),
                 EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
-                EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED")
-               );
+                EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"));
         if (productIds.size() > 0) {
             condList.add(EntityCondition.makeCondition("productId", EntityOperator.IN, productIds));
         }
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 bce6195..16bb960 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
@@ -2173,7 +2173,7 @@ public class ProductSearch {
                 productSearchContext.index++;
 
 
-                EntityComparisonOperator<?,?> operator = EntityOperator.EQUALS;
+                EntityComparisonOperator<?, ?> operator = EntityOperator.EQUALS;
 
                 if (UtilValidate.isNotEmpty(include) && !include) {
                     operator = EntityOperator.NOT_EQUAL;
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 c38fbfe..7b47f47 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
@@ -383,8 +383,7 @@ public final class ProductWorker {
             List<GenericValue> productAppls;
             List<EntityCondition> condList = UtilMisc.toList(
                     EntityCondition.makeCondition("productId", product.getString("productId")),
-                    EntityUtil.getFilterByDateExpr()
-            );
+                    EntityUtil.getFilterByDateExpr());
             if (productFeatureApplTypeId != null) {
                 condList.add(EntityCondition.makeCondition("productFeatureApplTypeId", productFeatureApplTypeId));
             }
@@ -946,8 +945,7 @@ public final class ProductWorker {
 
                 if (UtilValidate.isEmpty(products)) {
                     products = UtilMisc.toList(productToAdd);
-                }
-                else {
+                } else {
                     products.add(productToAdd);
                 }
             }
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 9d37851..e0e7e35 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
@@ -513,8 +513,7 @@ public final class ProductStoreWorker {
                     if ((product != null) && ("Y".equals(product.get("isVariant")))) {
                         if (parentProductId != null) {
                             virtualProductId = parentProductId;
-                        }
-                        else {
+                        } else {
                             virtualProductId = ProductWorker.getVariantVirtualId(product);
                         }
                         Debug.logInfo("getSurvey for virtual product " + virtualProductId, MODULE);
diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java b/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java
index 7e68cf6..a17105e 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/test/StockMovesTest.java
@@ -45,7 +45,7 @@ public class StockMovesTest extends OFBizTestCase {
     public void testStockMoves() throws Exception {
         GenericValue userLogin = getUserLogin("system");
         Map<String, Object> fsmnCtx = new HashMap<>();
-        Map<?,?> stockMoveHandled = null;
+        Map<?, ?> stockMoveHandled = null;
         List<?> warningList;
 
         fsmnCtx.put("facilityId", "WebStoreWarehouse");
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 ffa8c84..641f0ff 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
@@ -179,21 +179,21 @@ public class PackingSession implements java.io.Serializable {
 
                     int thisCheck = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, thisQty, packageSeqId, update);
                     switch (thisCheck) {
-                        case 2:
-                            Debug.logInfo("Packing check returned '2' - new pack line will be created!", MODULE);
-                            toCreateMap.put(res, thisQty);
-                            qtyRemain = qtyRemain.subtract(thisQty);
-                            break;
-                        case 1:
-                            Debug.logInfo("Packing check returned '1' - existing pack line has been updated!", MODULE);
-                            qtyRemain = qtyRemain.subtract(thisQty);
-                            break;
-                        case 0:
-                            Debug.logInfo("Packing check returned '0' - doing nothing.", MODULE);
-                            break;
-                        default:
-                            Debug.logInfo("Packing check returned '> 2' or '< 0'", MODULE);
-                            break;
+                    case 2:
+                        Debug.logInfo("Packing check returned '2' - new pack line will be created!", MODULE);
+                        toCreateMap.put(res, thisQty);
+                        qtyRemain = qtyRemain.subtract(thisQty);
+                        break;
+                    case 1:
+                        Debug.logInfo("Packing check returned '1' - existing pack line has been updated!", MODULE);
+                        qtyRemain = qtyRemain.subtract(thisQty);
+                        break;
+                    case 0:
+                        Debug.logInfo("Packing check returned '0' - doing nothing.", MODULE);
+                        break;
+                    default:
+                        Debug.logInfo("Packing check returned '> 2' or '< 0'", MODULE);
+                        break;
                     }
                 }
             }
@@ -252,17 +252,17 @@ public class PackingSession implements java.io.Serializable {
     protected void createPackLineItem(int checkCode, GenericValue res, String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, BigDecimal quantity, BigDecimal weight, int packageSeqId) throws GeneralException {
         // process the result; add new item if necessary
         switch (checkCode) {
-            case 0:
-                // not enough reserved
-                throw new GeneralException("Not enough inventory reservation available; cannot pack the item! [201]");
-            case 1:
-                // we're all good to go; quantity already updated
-                break;
-            case 2:
-                // need to create a new item
-                String invItemId = res.getString("inventoryItemId");
-                packLines.add(new PackingSessionLine(orderId, orderItemSeqId, shipGroupSeqId, productId, invItemId, quantity, weight, packageSeqId));
-                break;
+        case 0:
+            // not enough reserved
+            throw new GeneralException("Not enough inventory reservation available; cannot pack the item! [201]");
+        case 1:
+            // we're all good to go; quantity already updated
+            break;
+        case 2:
+            // need to create a new item
+            String invItemId = res.getString("inventoryItemId");
+            packLines.add(new PackingSessionLine(orderId, orderItemSeqId, shipGroupSeqId, productId, invItemId, quantity, weight, packageSeqId));
+            break;
         default:
             throw new GeneralException("value of checkCode different than expected");
 
@@ -823,13 +823,13 @@ public class PackingSession implements java.io.Serializable {
 
     protected void createPackages() throws GeneralException {
         for (int i = 0; i < packageSeq; i++) {
-            String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5);
+            String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i + 1, 5);
 
             Map<String, Object> pkgCtx = new HashMap<>();
             pkgCtx.put("shipmentId", shipmentId);
             pkgCtx.put("shipmentPackageSeqId", shipmentPackageSeqId);
-            pkgCtx.put("shipmentBoxTypeId", getShipmentBoxType(i+1));
-            pkgCtx.put("weight", getPackageWeight(i+1));
+            pkgCtx.put("shipmentBoxTypeId", getShipmentBoxType(i + 1));
+            pkgCtx.put("weight", getPackageWeight(i + 1));
             pkgCtx.put("weightUomId", getWeightUomId());
             pkgCtx.put("userLogin", userLogin);
             Map<String, Object> newPkgResp = this.getDispatcher().runSync("createShipmentPackage", pkgCtx);
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java
index 5b9ecb8..f9c99fb 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java
@@ -34,7 +34,7 @@ import org.apache.ofbiz.service.ServiceUtil;
 @SuppressWarnings("serial")
 public class PackingSessionLine implements java.io.Serializable {
 
-    public final String MODULE = PackingSessionLine.class.getName();
+    private static final String MODULE = PackingSessionLine.class.getName();
 
     protected String orderId = null;
     protected String orderItemSeqId = null;
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 fca0810..d750705 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
@@ -181,8 +181,7 @@ public class ShipmentServices {
                     } catch (Exception e) {
                         Debug.logError(e, MODULE);
                     }
-                }
-                else {
+                } else {
                     result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
                     result.put(ModelService.ERROR_MESSAGE, "Max " + breakTypeString +
                             " must not be less than Min " + breakTypeString + ".");
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 bcd455b..fff4d27 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
@@ -278,8 +278,7 @@ public class DhlServices {
             if (Debug.verboseOn()) {
                 Debug.logVerbose(rateResponseString, MODULE);
             }
-        }
-        catch (DhlConnectException e) {
+        } catch (DhlConnectException e) {
             String uceErrMsg = "Error sending DHL request for DHL Service Rate: " + e.toString();
             Debug.logError(e, uceErrMsg, MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
@@ -291,8 +290,7 @@ public class DhlServices {
         try {
             rateResponseDocument = UtilXml.readXmlDocument(rateResponseString, false);
             return handleDhlRateResponse(rateResponseDocument, locale);
-        }
-        catch (SAXException | IOException | ParserConfigurationException e2) {
+        } catch (SAXException | IOException | ParserConfigurationException e2) {
             String excErrMsg = "Error parsing the RatingServiceResponse: " + e2.toString();
             Debug.logError(e2, excErrMsg, MODULE);
             return ServiceUtil.returnError(UtilProperties.getMessage(RES_ERROR,
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 9bbdd91..7bca658 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
@@ -2959,8 +2959,7 @@ public class UpsServices {
                         Element netSummaryCharges = UtilXml.firstChildElement(negotiatedRates, "NetSummaryCharges");
                         Element grandTotal = UtilXml.firstChildElement(netSummaryCharges, "GrandTotal");
                         totalRates = UtilXml.childElementValue(grandTotal, "MonetaryValue");
-                    }
-                    else {
+                    } else {
                         // get total rates
                         Element totalCharges = UtilXml.firstChildElement(element, "TotalCharges");
                         totalRates = UtilXml.childElementValue(totalCharges, "MonetaryValue");
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java
index 2912517..3ab9c1d 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java
@@ -125,18 +125,18 @@ public class VerifyPickSession implements Serializable {
                     BigDecimal thisQty = reservedQty.compareTo(qtyRemain) > 0 ? qtyRemain : reservedQty;
                     int thisCheck = this.checkRowForAdd(reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, thisQty);
                     switch (thisCheck) {
-                        case 2:
-                            // new verify pick row will be created
-                            reserveQtyMap.put(reservation, thisQty);
-                            qtyRemain = qtyRemain.subtract(thisQty);
-                            break;
-                        case 1:
-                            // existing verify pick row has been updated
-                            qtyRemain = qtyRemain.subtract(thisQty);
-                            break;
-                        case 0:
-                            //doing nothing
-                            break;
+                    case 2:
+                        // new verify pick row will be created
+                        reserveQtyMap.put(reservation, thisQty);
+                        qtyRemain = qtyRemain.subtract(thisQty);
+                        break;
+                    case 1:
+                        // existing verify pick row has been updated
+                        qtyRemain = qtyRemain.subtract(thisQty);
+                        break;
+                    case 0:
+                        //doing nothing
+                        break;
                     }
                 }
             }
@@ -214,20 +214,20 @@ public class VerifyPickSession implements Serializable {
     protected void createVerifyPickRow(int checkCode, GenericValue res, String orderId, String orderItemSeqId, String shipGroupSeqId, String productId, String originGeoId, BigDecimal quantity, Locale locale) throws GeneralException {
         // process the result; add new item if necessary
         switch (checkCode) {
-            case 0:
-                // not enough reserved
-                throw new GeneralException(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNotEnoughInventoryReservationAvailableCannotVerifyTheItem", locale));
-            case 1:
-                // we're all good to go; quantity already updated
-                break;
-            case 2:
-                // need to create a new item
-                String inventoryItemId = res.getString("inventoryItemId");
-                pickRows.add(new VerifyPickSessionRow(orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, inventoryItemId, quantity));
-                break;
-            default:
-                // if a wrong checkCode is given
-                Debug.logError("There was a wrong checkCode given in the method createVerifyPickRow: " + checkCode, MODULE);
+        case 0:
+            // not enough reserved
+            throw new GeneralException(UtilProperties.getMessage("ProductErrorUiLabels", "ProductErrorNotEnoughInventoryReservationAvailableCannotVerifyTheItem", locale));
+        case 1:
+            // we're all good to go; quantity already updated
+            break;
+        case 2:
+            // need to create a new item
+            String inventoryItemId = res.getString("inventoryItemId");
+            pickRows.add(new VerifyPickSessionRow(orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, inventoryItemId, quantity));
+            break;
+        default:
+            // if a wrong checkCode is given
+            Debug.logError("There was a wrong checkCode given in the method createVerifyPickRow: " + checkCode, MODULE);
         }
     }
 
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 55fdc9e..876c9bc 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
@@ -87,8 +87,7 @@ public class WorkEffortServices {
                         EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DECLINED"),
                         EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_DELEGATED"),
                         EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_COMPLETED"),
-                        EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED")
-               );
+                        EntityCondition.makeCondition("currentStatusId", EntityOperator.NOT_EQUAL, "CAL_CANCELLED"));
                 validWorkEfforts = EntityQuery.use(delegator).from("WorkEffortAndPartyAssign").where(ecl).orderBy("estimatedStartDate", "priority").filterByDate().queryList();
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, MODULE);
@@ -419,8 +418,7 @@ public class WorkEffortServices {
             // public events are always included to the "personal calendar"
             List<EntityCondition> publicEvents = UtilMisc.<EntityCondition>toList(
                     EntityCondition.makeCondition("scopeEnumId", EntityOperator.EQUALS, "WES_PUBLIC"),
-                    EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "EVENT")
-                    );
+                    EntityCondition.makeCondition("parentTypeId", EntityOperator.EQUALS, "EVENT"));
             if (UtilValidate.isNotEmpty(partyIds)) {
                 entityExprList.add(
                         EntityCondition.makeCondition(UtilMisc.toList(