summaryrefslogtreecommitdiffstats
path: root/framework/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/main/java')
-rw-r--r--framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java19
-rw-r--r--framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java10
2 files changed, 26 insertions, 3 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java b/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java
index ee6dbed3..5b00be19 100644
--- a/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java
+++ b/framework/src/main/java/org/onap/cli/fw/input/cache/OnapCommandParameterCache.java
@@ -58,6 +58,13 @@ public class OnapCommandParameterCache {
return single;
}
+ public void includeProfile(String profile) {
+ this.load(profile, true);
+ }
+
+ public void excludeProfile(String profile) {
+ this.load(profile, false);
+ }
public void add(String productVersion, String paramName, String paramValue) {
@@ -111,15 +118,23 @@ public class OnapCommandParameterCache {
}
private void load() {
+ this.load(this.profileName, true);
+ }
+
+ private void load(String profileName, boolean include) {
List<OnapCommandParamEntity> params= new ArrayList<>();
try {
- params = this.loadParamFromCache(this.profileName);
+ params = this.loadParamFromCache(profileName);
} catch (OnapCommandLoadProfileFailed e) {
throw new RuntimeException(e); // NOSONAR
}
for (OnapCommandParamEntity p : params) {
- this.add(p.getProduct(), p.getName(), p.getValue());
+ if (include) {
+ this.add(p.getProduct(), p.getName(), p.getValue());
+ } else {
+ this.remove(p.getProduct(), p.getName());
+ }
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java
index 8ba215e6..6564628d 100644
--- a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java
+++ b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java
@@ -90,8 +90,16 @@ public class OnapCommandRegistrar {
paramCache.remove(this.getEnabledProductVersion(), paramName);
}
- public void setProfile(String profileName) {
+ public void setProfile(String profileName, List<String> includes, List<String> excludes) {
this.paramCache.setProfile(profileName);
+
+ for (String profile: includes) {
+ this.paramCache.includeProfile(profile);
+ }
+
+ for (String profile: excludes) {
+ this.paramCache.excludeProfile(profile);
+ }
}
public List<String> getUserProfiles() {