svn commit: r1863499 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/ applications/content/src/main/java/org/apache/ofbiz/content/content/ applications/content/src/main/java/org/apache/ofbiz/content/survey...

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

svn commit: r1863499 - in /ofbiz/ofbiz-framework/trunk: applications/content/src/main/java/org/apache/ofbiz/content/ applications/content/src/main/java/org/apache/ofbiz/content/content/ applications/content/src/main/java/org/apache/ofbiz/content/survey...

mthl
Author: mthl
Date: Sat Jul 20 16:31:29 2019
New Revision: 1863499

URL: http://svn.apache.org/viewvc?rev=1863499&view=rev
Log:
Improved: Inline ‘UtilGenerics#checkSet’
(OFBIZ-11141)

Modified:
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java
    ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
    ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java Sat Jul 20 16:31:29 2019
@@ -989,7 +989,7 @@ public class ContentManagementServices {
         Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
         Map<String, Object> results = new HashMap<>();
         Locale locale = (Locale) context.get("locale");
-        Set<String> visitedSet = UtilGenerics.checkSet(context.get("visitedSet"));
+        Set<String> visitedSet = UtilGenerics.cast(context.get("visitedSet"));
         if (visitedSet == null) {
             visitedSet = new HashSet<>();
             context.put("visitedSet", visitedSet);
@@ -1029,7 +1029,7 @@ public class ContentManagementServices {
         Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
         Map<String, Object> results = new HashMap<>();
         Locale locale = (Locale) context.get("locale");
-        Set<String> visitedSet = UtilGenerics.checkSet(context.get("visitedSet"));
+        Set<String> visitedSet = UtilGenerics.cast(context.get("visitedSet"));
         if (visitedSet == null) {
             visitedSet = new HashSet<>();
             context.put("visitedSet", visitedSet);
@@ -1103,7 +1103,7 @@ public class ContentManagementServices {
 
     public static void updatePageNodeChildren(GenericValue content, Map<String, Object> context) throws GenericEntityException {
         String contentId = content.getString("contentId");
-        Set<String> visitedSet = UtilGenerics.checkSet(context.get("visitedSet"));
+        Set<String> visitedSet = UtilGenerics.cast(context.get("visitedSet"));
         if (visitedSet == null) {
             visitedSet = new HashSet<>();
             context.put("visitedSet", visitedSet);
@@ -1126,7 +1126,7 @@ public class ContentManagementServices {
 
     public static void updateOutlineNodeChildren(GenericValue content, boolean forceOutline, Map<String, Object> context) throws GenericEntityException {
         String contentId = content.getString("contentId");
-        Set<String> visitedSet = UtilGenerics.checkSet(context.get("visitedSet"));
+        Set<String> visitedSet = UtilGenerics.cast(context.get("visitedSet"));
         if (visitedSet == null) {
             visitedSet = new HashSet<>();
             context.put("visitedSet", visitedSet);
@@ -1520,7 +1520,7 @@ public class ContentManagementServices {
         String contentId = content.getString("contentId");
         List<String> contentAssocTypeIdList = UtilGenerics.checkList(context.get("contentAssocTypeIdList"));
         Locale locale = (Locale) context.get("locale");
-        Set<String> visitedSet = UtilGenerics.checkSet(context.get("visitedSet"));
+        Set<String> visitedSet = UtilGenerics.cast(context.get("visitedSet"));
         if (visitedSet == null) {
             visitedSet = new HashSet<>();
             context.put("visitedSet", visitedSet);

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java Sat Jul 20 16:31:29 2019
@@ -180,7 +180,7 @@ public class ContentMapFacade implements
 
     @Override
     public Set<Object> keySet() {
-        return UtilGenerics.checkSet(mapKeySet);
+        return UtilGenerics.cast(mapKeySet);
     }
 
     @Override

Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java Sat Jul 20 16:31:29 2019
@@ -168,7 +168,7 @@ public class PdfSurveyServices {
                     PdfObject typeValue = null;
                     PdfObject tuValue = null;
 
-                    Set<PdfName> dictKeys = UtilGenerics.checkSet(dict.getKeys());
+                    Set<PdfName> dictKeys = UtilGenerics.cast(dict.getKeys());
                     for (PdfName dictKeyName : dictKeys) {
                         PdfObject dictObject = dict.get(dictKeyName);
 

Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Sat Jul 20 16:31:29 2019
@@ -920,7 +920,7 @@ public class OrderServices {
         }
 
         // store the orderProductPromoCodes
-        Set<String> orderProductPromoCodes = UtilGenerics.checkSet(context.get("orderProductPromoCodes"));
+        Set<String> orderProductPromoCodes = UtilGenerics.cast(context.get("orderProductPromoCodes"));
         if (UtilValidate.isNotEmpty(orderProductPromoCodes)) {
             for (String productPromoCodeId : orderProductPromoCodes) {
                 GenericValue orderProductPromoCode = delegator.makeValue("OrderProductPromoCode");

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java Sat Jul 20 16:31:29 2019
@@ -385,7 +385,7 @@ public class ShipmentServices {
                 // add the feature quantities
                 BigDecimal quantity = (BigDecimal) itemMap.get("quantity");
                 if (itemMap.containsKey("featureSet")) {
-                    Set<String> featureSet = UtilGenerics.checkSet(itemMap.get("featureSet"));
+                    Set<String> featureSet = UtilGenerics.cast(itemMap.get("featureSet"));
                     if (UtilValidate.isNotEmpty(featureSet)) {
                         for (String featureId: featureSet) {
                             BigDecimal featureQuantity = shippableFeatureMap.get(featureId);

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilGenerics.java Sat Jul 20 16:31:29 2019
@@ -21,7 +21,6 @@ package org.apache.ofbiz.base.util;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 public final class UtilGenerics {
 
@@ -81,8 +80,4 @@ public final class UtilGenerics {
         }
         return checkMap(object);
     }
-
-    public static <T> Set<T> checkSet(Object object) {
-        return cast(object);
-    }
 }

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java Sat Jul 20 16:31:29 2019
@@ -389,7 +389,7 @@ public final class UtilMisc {
     }
 
     public static <K, V> void addToSetInMap(V element, Map<K, Set<V>> theMap, K setKey) {
-        Set<V> theSet = UtilGenerics.checkSet(theMap.get(setKey));
+        Set<V> theSet = UtilGenerics.cast(theMap.get(setKey));
         if (theSet == null) {
             theSet = new LinkedHashSet<>();
             theMap.put(setKey, theSet);
@@ -398,7 +398,7 @@ public final class UtilMisc {
     }
 
     public static <K, V> void addToSortedSetInMap(V element, Map<K, Set<V>> theMap, K setKey) {
-        Set<V> theSet = UtilGenerics.checkSet(theMap.get(setKey));
+        Set<V> theSet = UtilGenerics.cast(theMap.get(setKey));
         if (theSet == null) {
             theSet = new TreeSet<>();
             theMap.put(setKey, theSet);

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1863499&r1=1863498&r2=1863499&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java Sat Jul 20 16:31:29 2019
@@ -360,7 +360,7 @@ public final class FreeMarkerWorker {
         Map<String, Object> templateRoot = new HashMap<>();
         Set<String> varNames = null;
         try {
-            varNames = UtilGenerics.checkSet(env.getKnownVariableNames());
+            varNames = UtilGenerics.cast(env.getKnownVariableNames());
         } catch (TemplateModelException e1) {
             Debug.logError(e1, "Error getting FreeMarker variable names, will not put pass current context on to sub-content", module);
         }