Skip to content
Permalink
Browse files

Improved: Rewrite ‘ComponentConfig#getAllWebappResourceInfos’

(OFBIZ-11101)

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
  • Loading branch information
mthl committed Jun 27, 2019
1 parent ba54e32 commit 6e0432014fbddd575a382d2dc2d7a9809b1d7ee5
Showing with 8 additions and 11 deletions.
  1. +8 −11 framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
@@ -149,18 +149,15 @@ public static Boolean componentExists(String componentName) {
.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 {

0 comments on commit 6e04320

Please sign in to comment.
You can’t perform that action at this time.