This is an automated email from the ASF dual-hosted git repository.

jleroux 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 19676d4306 Improved: Reducing scope of variables in 
org.apache.ofbiz.base package (OFBIZ-1080)
19676d4306 is described below

commit 19676d430616a9d3be5228283f4381a37c3c8138
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Tue Sep 27 12:16:17 2022 +0200

    Improved: Reducing scope of variables in org.apache.ofbiz.base package 
(OFBIZ-1080)
    
    jleroux: maybe because not all was applied or code changed, (or?) I had to
    
    revert
    -    public ScriptHelperImpl(ScriptContext context) {
    +    ScriptHelperImpl(ScriptContext context) {
    
    Thanks: Pradhan Yash Sharma for the patch
---
 .../java/org/apache/ofbiz/common/CdyneServices.java    |  2 +-
 .../java/org/apache/ofbiz/common/CommonServices.java   |  2 +-
 .../java/org/apache/ofbiz/common/CommonWorkers.java    |  2 +-
 .../ofbiz/common/email/NotificationServices.java       |  4 ++--
 .../java/org/apache/ofbiz/common/geo/GeoWorker.java    |  4 ++--
 .../ofbiz/common/preferences/PreferenceWorker.java     | 12 ++++++------
 .../apache/ofbiz/common/scripting/ContextHelper.java   | 18 +++++++++---------
 .../java/org/apache/ofbiz/common/uom/UomWorker.java    |  2 +-
 8 files changed, 23 insertions(+), 23 deletions(-)

diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java 
b/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java
index 9025b889ac..6f69c5a3e2 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/CdyneServices.java
@@ -85,7 +85,7 @@ public class CdyneServices {
         }
     }
 
-    public static void populateCdyneAddress(Element addressRootElement, 
Map<String, Object> targetContext) {
+    private static void populateCdyneAddress(Element addressRootElement, 
Map<String, Object> targetContext) {
         targetContext.put("ServiceError", 
UtilXml.childElementValue(addressRootElement, "ServiceError"));
         targetContext.put("AddressError", 
UtilXml.childElementValue(addressRootElement, "AddressError"));
         targetContext.put("AddressFoundBeMoreSpecific", 
UtilXml.childElementValue(addressRootElement, "AddressFoundBeMoreSpecific"));
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java 
b/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
index c84b74be02..cbab226aec 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
@@ -79,7 +79,7 @@ public class CommonServices {
      *@param context Map containing the input parameters
      *@return Map with the result of the service, the output parameters
      */
-    public static Map<String, Object> testService(DispatchContext dctx, 
Map<String, ?> context) {
+    private static Map<String, Object> testService(DispatchContext dctx, 
Map<String, ?> context) {
         Map<String, Object> response = ServiceUtil.returnSuccess();
 
         if (!context.isEmpty()) {
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java 
b/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
index 8466c005c0..53dd903a79 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonWorkers.java
@@ -110,7 +110,7 @@ public final class CommonWorkers {
     /**
      * Returns a list of regional geo associations.
      */
-    public static List<GenericValue> getAssociatedStateList(Delegator 
delegator, String country, String listOrderBy) {
+    private static List<GenericValue> getAssociatedStateList(Delegator 
delegator, String country, String listOrderBy) {
         if (UtilValidate.isEmpty(country)) {
             // Load the system default country
             country = EntityUtilProperties.getPropertyValue("general", 
"country.geo.id.default", delegator);
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
 
b/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
index cb0e47c620..cd749a2dda 100644
--- 
a/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
+++ 
b/framework/common/src/main/java/org/apache/ofbiz/common/email/NotificationServices.java
@@ -118,7 +118,7 @@ public class NotificationServices {
      * the sevice
      * @return A Map with the service response messages in it
      */
-    public static Map<String, Object> sendNotification(DispatchContext ctx, 
Map<String, ? extends Object> context) {
+    private static Map<String, Object> sendNotification(DispatchContext ctx, 
Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = ctx.getDispatcher();
         Locale locale = (Locale) context.get("locale");
         Map<String, Object> result = null;
@@ -183,7 +183,7 @@ public class NotificationServices {
      * @return A new Map indicating success or error containing the
      * body generated from the template and the input parameters.
      */
-    public static Map<String, Object> prepareNotification(DispatchContext ctx, 
Map<String, ? extends Object> context) {
+    private static Map<String, Object> prepareNotification(DispatchContext 
ctx, Map<String, ? extends Object> context) {
         Delegator delegator = ctx.getDelegator();
         String templateName = (String) context.get("templateName");
         Map<String, Object> templateData = 
UtilGenerics.cast(context.get("templateData"));
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java 
b/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java
index bba5a49cc0..2d691c9652 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java
@@ -54,7 +54,7 @@ public final class GeoWorker {
         return expandGeoGroup(geo);
     }
 
-    public static List<GenericValue> expandGeoGroup(GenericValue geo) {
+    private static List<GenericValue> expandGeoGroup(GenericValue geo) {
         if (geo == null) {
             return new LinkedList<>();
         }
@@ -117,7 +117,7 @@ public final class GeoWorker {
         return containsGeo(geoList, geo);
     }
 
-    public static boolean containsGeo(List<GenericValue> geoList, GenericValue 
geo) {
+    private static boolean containsGeo(List<GenericValue> geoList, 
GenericValue geo) {
         if (geoList == null || geo == null) {
             return false;
         }
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
 
b/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
index f63bb6ae61..7f60059647 100644
--- 
a/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
+++ 
b/framework/common/src/main/java/org/apache/ofbiz/common/preferences/PreferenceWorker.java
@@ -60,7 +60,7 @@ public final class PreferenceWorker {
      * @throws GeneralException
      * @return user preference map
      */
-    public static Map<String, Object> addPrefToMap(GenericValue rec, 
Map<String, Object> userPrefMap) throws GeneralException {
+    private static Map<String, Object> addPrefToMap(GenericValue rec, 
Map<String, Object> userPrefMap) throws GeneralException {
         String prefDataType = rec.getString("userPrefDataType");
         if (UtilValidate.isEmpty(prefDataType)) {
             // default to String
@@ -133,7 +133,7 @@ public final class PreferenceWorker {
      * @throws GeneralException
      * @return user preference map
      */
-    public static Map<String, Object> createUserPrefMap(GenericValue rec) 
throws GeneralException {
+    static Map<String, Object> createUserPrefMap(GenericValue rec) throws 
GeneralException {
         return addPrefToMap(rec, new LinkedHashMap<>());
     }
 
@@ -143,7 +143,7 @@ public final class PreferenceWorker {
      * @throws GeneralException
      * @return user preference map
      */
-    public static Map<String, Object> createUserPrefMap(List<GenericValue> 
recList) throws GeneralException {
+    static Map<String, Object> createUserPrefMap(List<GenericValue> recList) 
throws GeneralException {
         Map<String, Object> userPrefMap = new LinkedHashMap<>();
         if (recList != null) {
             for (GenericValue value: recList) {
@@ -163,7 +163,7 @@ public final class PreferenceWorker {
      * @param returnDefault return <a href="#DEFAULT_UID">DEFAULT_UID</a> if 
no userLoginId is found.
      * @return userLoginId String
      */
-    public static String getUserLoginId(Map<String, ?> context, boolean 
returnDefault) {
+    static String getUserLoginId(Map<String, ?> context, boolean 
returnDefault) {
         String userLoginId = (String) context.get(LOGINID_PARAMETER_NAME);
         if (UtilValidate.isEmpty(userLoginId)) {
             GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -194,7 +194,7 @@ public final class PreferenceWorker {
      * @param context Map containing the input arguments.
      * @return true if the userLoginId arguments are valid
      */
-    public static boolean isValidGetId(DispatchContext ctx, Map<String, ?> 
context) {
+    static boolean isValidGetId(DispatchContext ctx, Map<String, ?> context) {
         String currentUserLoginId = null;
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         if (userLogin == null) {
@@ -228,7 +228,7 @@ public final class PreferenceWorker {
      * @param context Map containing the input arguments.
      * @return true if arguments are valid
      */
-    public static boolean isValidSetId(DispatchContext ctx, Map<String, ?> 
context) {
+    private static boolean isValidSetId(DispatchContext ctx, Map<String, ?> 
context) {
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         if (userLogin == null) {
             return false;
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java
 
b/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java
index f31b8e9140..b97c48c120 100644
--- 
a/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java
+++ 
b/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java
@@ -56,7 +56,7 @@ public final class ContextHelper {
     private final ScriptContext context;
     private final int scriptType;
 
-    public ContextHelper(ScriptContext context) {
+    ContextHelper(ScriptContext context) {
         Assert.notNull("context", context);
         this.context = context;
         if (context.getAttribute("request") != null) {
@@ -77,7 +77,7 @@ public final class ContextHelper {
         return FlexibleStringExpander.expandString(original, getBindings());
     }
 
-    public Map<String, Object> getBindings() {
+    Map<String, Object> getBindings() {
         return this.context.getBindings(ScriptContext.ENGINE_SCOPE);
     }
 
@@ -89,7 +89,7 @@ public final class ContextHelper {
         return (LocalDispatcher) this.context.getAttribute("dispatcher");
     }
 
-    public <T> T getEnv(FlexibleMapAccessor<T> fma) {
+    private <T> T getEnv(FlexibleMapAccessor<T> fma) {
         return fma.get(getBindings());
     }
 
@@ -173,7 +173,7 @@ public final class ContextHelper {
         return results;
     }
 
-    public String getScriptName() {
+    String getScriptName() {
         String scriptName = (String) 
this.context.getAttribute(ScriptEngine.FILENAME);
         return scriptName != null ? scriptName : "Unknown";
     }
@@ -208,7 +208,7 @@ public final class ContextHelper {
         }
     }
 
-    public <T> void putEnv(FlexibleMapAccessor<T> fma, T value) {
+    private <T> void putEnv(FlexibleMapAccessor<T> fma, T value) {
         fma.put(getBindings(), value);
     }
 
@@ -226,7 +226,7 @@ public final class ContextHelper {
      * @param value
      *            The value to set in the named environment location.
      */
-    public <T> void putEnv(String key, T value) {
+    private <T> void putEnv(String key, T value) {
         String ekey = this.expandString(key);
         FlexibleMapAccessor<T> fma = FlexibleMapAccessor.getInstance(ekey);
         this.putEnv(fma, value);
@@ -236,11 +236,11 @@ public final class ContextHelper {
         getParameters().put(key, value);
     }
 
-    public void putResult(String key, Object value) {
+    void putResult(String key, Object value) {
         getResults().put(key, value);
     }
 
-    public void putResults(Map<String, Object> results) {
+    void putResults(Map<String, Object> results) {
         getResults().putAll(results);
     }
 
@@ -248,7 +248,7 @@ public final class ContextHelper {
         return getBindings().remove(key);
     }
 
-    public <T> T removeEnv(FlexibleMapAccessor<T> fma) {
+    private <T> T removeEnv(FlexibleMapAccessor<T> fma) {
         return fma.remove(getBindings());
     }
 
diff --git 
a/framework/common/src/main/java/org/apache/ofbiz/common/uom/UomWorker.java 
b/framework/common/src/main/java/org/apache/ofbiz/common/uom/UomWorker.java
index 3e07f96245..b550acd6d2 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/uom/UomWorker.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/uom/UomWorker.java
@@ -70,7 +70,7 @@ public final class UomWorker {
         return null;
     }
 
-    public static Calendar addUomTime(Calendar cal, Timestamp startTime, 
String uomId, int value) {
+    private static Calendar addUomTime(Calendar cal, Timestamp startTime, 
String uomId, int value) {
         if (cal == null) {
             cal = Calendar.getInstance();
         }

Reply via email to