From 6e0432014fbddd575a382d2dc2d7a9809b1d7ee5 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Thu, 27 Jun 2019 14:26:12 +0000 Subject: [PATCH] =?UTF-8?q?Improved:=20Rewrite=20=E2=80=98ComponentConfig#?= =?UTF-8?q?getAllWebappResourceInfos=E2=80=99=20(OFBIZ-11101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It now has a stream based implementation. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862220 13f79535-47bb-0310-9956-ffa450edef68 --- .../ofbiz/base/component/ComponentConfig.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java index c129ba597b..94842c96dd 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java @@ -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 getAllWebappResourceInfos() { - return getAllWebappResourceInfos(null); - } - - public static List getAllWebappResourceInfos(String componentName) { - List 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 {