Improved: Rewrite ‘ComponentConfig#getKeystoreInfo’
(OFBIZ-11101) It now has a stream based implementation. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1862223 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -195,17 +195,20 @@ public final class ComponentConfig {
|
||||
return cc.getFullLocation(resourceLoaderName, location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the first key-store matching a name from a specific component.
|
||||
*
|
||||
* @param componentName the name of the component to match which can be {@code null}
|
||||
* @param keystoreName the name of the key-store to match which can be {@code null}
|
||||
* @return the first key-store matching both {@code componentName} and {@code keystoreName}.
|
||||
*/
|
||||
public static KeystoreInfo getKeystoreInfo(String componentName, String keystoreName) {
|
||||
for (ComponentConfig cc : getAllComponents()) {
|
||||
if (componentName != null && componentName.equals(cc.getComponentName())) {
|
||||
for (KeystoreInfo ks : cc.getKeystoreInfos()) {
|
||||
if (keystoreName != null && keystoreName.equals(ks.getName())) {
|
||||
return ks;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return getAllComponents().stream()
|
||||
.filter(cc -> componentName != null && componentName.equals(cc.getComponentName()))
|
||||
.flatMap(cc -> cc.getKeystoreInfos().stream())
|
||||
.filter(ks -> keystoreName != null && keystoreName.equals(ks.getName()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public static String getRootLocation(String componentName) throws ComponentException {
|
||||
|
||||
Reference in New Issue
Block a user