svn commit: r1862220 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

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

svn commit: r1862220 - /ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

mthl
Author: mthl
Date: Thu Jun 27 14:26:12 2019
New Revision: 1862220

URL: http://svn.apache.org/viewvc?rev=1862220&view=rev
Log:
Improved: Rewrite ‘ComponentConfig#getAllWebappResourceInfos’
(OFBIZ-11101)

It now has a stream based implementation.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java?rev=1862220&r1=1862219&r2=1862220&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java Thu Jun 27 14:26:12 2019
@@ -149,18 +149,15 @@ public final class ComponentConfig {
                 .collect(Collectors.toList());
     }
 
+    /**
+     * Provides the list of all the web-app information in components
+     *
+     * @return a list of web-app information
+     */
     public static List<WebappInfo> getAllWebappResourceInfos() {
-        return getAllWebappResourceInfos(null);
-    }
-
-    public static List<WebappInfo> getAllWebappResourceInfos(String componentName) {
-        List<WebappInfo> webappInfos = new ArrayList<>();
-        for (ComponentConfig cc : getAllComponents()) {
-            if (componentName == null || componentName.equals(cc.getComponentName())) {
-                webappInfos.addAll(cc.getWebappInfos());
-            }
-        }
-        return webappInfos;
+        return getAllComponents().stream()
+                .flatMap(cc -> cc.getWebappInfos().stream())
+                .collect(Collectors.toList());
     }
 
     public static ComponentConfig getComponentConfig(String globalName) throws ComponentException {