Skip to content
Permalink
Browse files

Improved: Rewrite ‘ComponentConfig#getAllKeystoreInfos’

(OFBIZ-11101)

It now has a stream based implementation.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862217 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 27, 2019
1 parent 2305408 commit 58ed9c5ce8e95e37833f3f8c10fe50b066054910
Showing with 8 additions and 11 deletions.
  1. +8 −11 framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java
@@ -112,18 +112,15 @@ public static Boolean componentExists(String componentName) {
return entityInfos;
}

/**
* Provides the list of all the keystore information available in components.
*
* @return a list of keystore information
*/
public static List<KeystoreInfo> getAllKeystoreInfos() {
return getAllKeystoreInfos(null);
}

public static List<KeystoreInfo> getAllKeystoreInfos(String componentName) {
List<KeystoreInfo> keystoreInfos = new ArrayList<>();
for (ComponentConfig cc : getAllComponents()) {
if (componentName == null || componentName.equals(cc.getComponentName())) {
keystoreInfos.addAll(cc.getKeystoreInfos());
}
}
return keystoreInfos;
return getAllComponents().stream()
.flatMap(cc -> cc.getKeystoreInfos().stream())
.collect(Collectors.toList());
}

public static List<ServiceResourceInfo> getAllServiceResourceInfos(String type) {

0 comments on commit 58ed9c5

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