[ofbiz-framework] branch trunk updated: Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in applications component. (OFBIZ-11963) Also made some related checkstyle code enhancements. Thanks Jacques for review.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in applications component. (OFBIZ-11963) Also made some related checkstyle code enhancements. Thanks Jacques for review.

surajk
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 b3fcbee  Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in applications component. (OFBIZ-11963) Also made some related checkstyle code enhancements. Thanks Jacques for review.
b3fcbee is described below

commit b3fcbeedbaea8e9777014bd938065325b5001599
Author: Suraj Khurana <[hidden email]>
AuthorDate: Sat Sep 12 12:09:03 2020 +0530

    Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in applications component.
    (OFBIZ-11963)
    Also made some related checkstyle code enhancements. Thanks Jacques for review.
---
 .../ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java     | 2 ++
 .../apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java  | 2 +-
 .../src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java       | 2 +-
 .../apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java    | 2 +-
 .../main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java   | 2 +-
 .../org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java     | 4 ++--
 .../src/main/java/org/apache/ofbiz/order/test/FinAccountTest.java     | 2 ++
 .../src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java  | 2 ++
 .../src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java     | 2 ++
 .../src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java    | 2 +-
 .../org/apache/ofbiz/workeffort/workeffort/WorkEffortServices.java    | 2 +-
 11 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java
index 16f14ef..8024dfb 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.service.GenericServiceException;
 import org.apache.ofbiz.service.ModelService;
@@ -51,6 +52,7 @@ public class CCServicesTest extends OFBizTestCase {
 
     @Override
     protected void setUp() throws Exception {
+        Delegator delegator = getDelegator();
         // populate test data
         configFile = "paymentTest.properties";
         creditAmount = new BigDecimal("234.00");
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 4f7f632..44aa17b 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
@@ -88,7 +88,7 @@ public class InjectNodeTrailCsvTransform implements TemplateTransformModel {
 
         return new LoopWriter(out) {
 
-            final String passedCsv = (String) templateCtx.get("nodeTrailCsv");
+            private final String passedCsv = (String) templateCtx.get("nodeTrailCsv");
 
             @Override
             public void write(char cbuf[], int off, int len) {
diff --git a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java
index e64a1c1..89e7852 100644
--- a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java
+++ b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java
@@ -220,7 +220,7 @@ public class HumanResEvents {
                     GenericValue emplContext = EntityQuery.use(delegator).from("EmplPositionType").where("emplPositionTypeId", typeId).queryOne();
                     String title = null;
                     if (UtilValidate.isNotEmpty(emplContext)) {
-                        title = (String) emplContext.get("description") + " " + "[" + emplId +"]";
+                        title = (String) emplContext.get("description") + " " + "[" + emplId + "]";
                     }
                     String hrefStr = "emplPositionView?emplPositionId=" + emplId;
                     emplAttrMap.put("href", hrefStr);
diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
index 42b00cb..54ba766 100644
--- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
+++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java
@@ -62,7 +62,7 @@ public class ProductionRunEvents {
 
         Collection<Map<String, Object>> componentRows = UtilHttp.parseMultiFormData(parameters);
         Map<GenericPK, Object> componentsLocationMap = new HashMap<>();
-        for (Map<String, Object>componentRow : componentRows) {
+        for (Map<String, Object> componentRow : componentRows) {
             Timestamp fromDate = null;
             try {
                 fromDate = Timestamp.valueOf((String) componentRow.get("fromDate"));
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 1df8a22..31e46aa 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
@@ -5783,7 +5783,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
         }
 
         public static class CartShipItemInfo implements Serializable {
-            public List<GenericValue> itemTaxAdj = new LinkedList<>();
+            private List<GenericValue> itemTaxAdj = new LinkedList<>();
             private ShoppingCartItem item = null;
             private BigDecimal quantity = BigDecimal.ZERO;
             /** get item tax adj*/
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 0302d94..d25583c 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
@@ -966,10 +966,10 @@ public class ShoppingCartServices {
                             if (isTaxAdjustment(adj)) {
                                 CartShipItemInfo csii = shipInfo.getShipItemInfo(item);
 
-                                if (csii.itemTaxAdj == null) {
+                                if (csii.getItemTaxAdj() == null) {
                                     shipInfo.setItemInfo(item, UtilMisc.toList(adj));
                                 } else {
-                                    csii.itemTaxAdj.add(adj);
+                                    csii.getItemTaxAdj().add(adj);
                                 }
                             } else {
                                 item.addAdjustment(adj);
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/FinAccountTest.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/FinAccountTest.java
index 5514c72..b706431 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/test/FinAccountTest.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/FinAccountTest.java
@@ -22,6 +22,7 @@ import java.util.Locale;
 
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.order.finaccount.FinAccountHelper;
 import org.apache.ofbiz.service.testtools.OFBizTestCase;
@@ -37,6 +38,7 @@ public class FinAccountTest extends OFBizTestCase {
      * @throws Exception the exception
      */
     public void testCreateFinAccountBasic() throws Exception {
+        Delegator delegator = getDelegator();
         String finAccountCode;
         GenericValue account;
 
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
index d292740..a88b924 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/PurchaseOrderTest.java
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.service.testtools.OFBizTestCase;
 import org.apache.ofbiz.service.ServiceUtil;
@@ -49,6 +50,7 @@ public class PurchaseOrderTest extends OFBizTestCase {
      * @throws Exception the exception
      */
     public void testCreatePurchaseOrder() throws Exception {
+        Delegator delegator = getDelegator();
         Map<String, Object> ctx = new HashMap<>();
         ctx.put("partyId", "Company");
         ctx.put("orderTypeId", "PURCHASE_ORDER");
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java
index 47d5bf6..6c7a689 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/SalesOrderTest.java
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.ofbiz.service.testtools.OFBizTestCase;
@@ -46,6 +47,7 @@ public class SalesOrderTest extends OFBizTestCase {
      * @throws Exception the exception
      */
     public void testCreateSalesOrder() throws Exception {
+        Delegator delegator = getDelegator();
         Map<String, Object> ctx = UtilMisc.<String, Object>toMap("partyId", "DemoCustomer", "orderTypeId", "SALES_ORDER", "currencyUom", "USD",
                 "productStoreId", "9000");
 
diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java
index ceee9ab..09110ca 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/test/IssuanceTest.java
@@ -59,7 +59,7 @@ public class IssuanceTest extends OFBizTestCase {
                 BigDecimal.valueOf(1000L), false);
         String shipmentId = packSession.complete(false);
 
-        GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne();
+        GenericValue orderHeader = EntityQuery.use(getDelegator()).from("OrderHeader").where("orderId", orderId).queryOne();
 
         // Test the OrderShipment is correct
         List<GenericValue> orderShipments = orderHeader.getRelated("OrderShipment", null, null, false);
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 e59047f..c152da3 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
@@ -398,7 +398,7 @@ public class WorkEffortServices {
         for (Date dateBoundary: dateBoundaries) {
             if (prevDateBoundary != null) {
                 DateRange dateRange = new DateRange(prevDateBoundary, dateBoundary);
-                for (Map<String, Object >calendarEntry: calendarEntries) {
+                for (Map<String, Object> calendarEntry: calendarEntries) {
                     DateRange calEntryRange = (DateRange) calendarEntry.get("calEntryRange");
                     if (calEntryRange.intersectsRange(dateRange) && !(calEntryRange.end().equals(dateRange.start())
                             || calEntryRange.start().equals(dateRange.end()))) {