X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Frest%2Fjpa%2FPIPResolver.java;h=4838639f928443552273d1b6f825be53c0bd75cc;hp=daab6d6589e386857ee3840012e80388991990fc;hb=401b48bc573561f097960a9ca7abe6d788456f28;hpb=9301fed7c290f52208922f780fdfe4b5a880b5aa diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java index daab6d658..4838639f9 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java @@ -106,6 +106,7 @@ public class PIPResolver implements Serializable { private Set pipresolverParams = new HashSet<>(); public PIPResolver() { + //An empty constructor } public PIPResolver(String prefix, Properties properties, String user) throws PIPException { @@ -260,7 +261,7 @@ public class PIPResolver implements Serializable { @Transient public boolean isReadOnly() { - return (this.readOnly == '1'); + return this.readOnly == '1'; } @Transient @@ -293,62 +294,64 @@ public class PIPResolver implements Serializable { // // Go through each property // - for (Object name : properties.keySet()) { - if (name.toString().startsWith(prefix) == false) { + for (Object nme : properties.keySet()) { + if (nme.toString().startsWith(prefix) == false) { continue; } - if (name.equals(prefix + ".classname")) { + if (nme.equals(prefix + ".classname")) { // // We already saved this // - } else if (name.equals(prefix + "." + StdConfigurableEngine.PROP_NAME)) { - this.name = properties.getProperty(name.toString()); - } else if (name.equals(prefix + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { - this.description = properties.getProperty(name.toString()); - } else if (name.equals(prefix + "." + StdConfigurableEngine.PROP_ISSUER)) { - this.issuer = properties.getProperty(name.toString()); + } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_NAME)) { + this.name = properties.getProperty(nme.toString()); + } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { + this.description = properties.getProperty(nme.toString()); + } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_ISSUER)) { + this.issuer = properties.getProperty(nme.toString()); } else { - this.addPipresolverParam(new PIPResolverParam(name.toString().substring(prefix.length() + 1), - properties.getProperty(name.toString()))); + this.addPipresolverParam(new PIPResolverParam(nme.toString().substring(prefix.length() + 1), + properties.getProperty(nme.toString()))); } } } @Transient public Map getConfiguration(String prefix) { + String pref = prefix; Map map = new HashMap<>(); if (prefix.endsWith(".") == false) { - prefix = prefix + "."; + pref = prefix + "."; } - map.put(prefix + "classname", this.classname); - map.put(prefix + "name", this.name); + map.put(pref + "classname", this.classname); + map.put(pref + "name", this.name); if (this.description != null) { - map.put(prefix + "description", this.description); + map.put(pref + "description", this.description); } if (this.issuer != null && this.issuer.isEmpty() != false) { - map.put(prefix + "issuer", this.issuer); + map.put(pref + "issuer", this.issuer); } for (PIPResolverParam param : this.pipresolverParams) { - map.put(prefix + param.getParamName(), param.getParamValue()); + map.put(pref + param.getParamName(), param.getParamValue()); } return map; } @Transient public void generateProperties(Properties props, String prefix) { + String pref = prefix; if (prefix.endsWith(".") == false) { - prefix = prefix + "."; + pref = prefix + "."; } - props.setProperty(prefix + "classname", this.classname); - props.setProperty(prefix + "name", this.name); + props.setProperty(pref + "classname", this.classname); + props.setProperty(pref + "name", this.name); if (this.description != null) { - props.setProperty(prefix + "description", this.description); + props.setProperty(pref + "description", this.description); } if (this.issuer != null && this.issuer.isEmpty() != false) { - props.setProperty(prefix + "issuer", this.issuer); + props.setProperty(pref + "issuer", this.issuer); } for (PIPResolverParam param : this.pipresolverParams) { - props.setProperty(prefix + param.getParamName(), param.getParamValue()); + props.setProperty(pref + param.getParamName(), param.getParamValue()); } }