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%2FPIPConfiguration.java;h=01f5cfcff2edb3328bf541eb3e79d6b97bcdb72c;hp=5d731552b38ba057740f1a543961b62291a139b2;hb=401b48bc573561f097960a9ca7abe6d788456f28;hpb=9301fed7c290f52208922f780fdfe4b5a880b5aa diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java index 5d731552b..01f5cfcff 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java @@ -124,6 +124,7 @@ public class PIPConfiguration implements Serializable { private Set pipresolvers = new HashSet<>(); public PIPConfiguration() { + //An empty constructor } public PIPConfiguration(PIPConfiguration config, String user) { @@ -316,7 +317,7 @@ public class PIPConfiguration implements Serializable { @Transient public boolean isReadOnly() { - return (this.readOnly == '1'); + return this.readOnly == '1'; } @Transient @@ -330,7 +331,7 @@ public class PIPConfiguration implements Serializable { @Transient public boolean requiresResolvers() { - return (this.requiresResolvers == '1'); + return this.requiresResolvers == '1'; } @Transient @@ -390,21 +391,21 @@ public class PIPConfiguration implements Serializable { // // Go through each property // - for (Object name : properties.keySet()) { - if (name.toString().startsWith(id) == false) { + for (Object nme : properties.keySet()) { + if (nme.toString().startsWith(id) == false) { continue; } - if (name.equals(id + ".classname")) { + if (nme.equals(id + ".classname")) { // // We already saved this // - } else if (name.equals(id + "." + StdConfigurableEngine.PROP_NAME)) { - this.name = properties.getProperty(name.toString()); - } else if (name.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { - this.description = properties.getProperty(name.toString()); - } else if (name.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) { - this.issuer = properties.getProperty(name.toString()); - } else if (name.equals(id + ".resolvers")) { + } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_NAME)) { + this.name = properties.getProperty(nme.toString()); + } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) { + this.description = properties.getProperty(nme.toString()); + } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) { + this.issuer = properties.getProperty(nme.toString()); + } else if (nme.equals(id + ".resolvers")) { // // It has resolvers, make sure this is set to true if // it has been already. @@ -414,13 +415,13 @@ public class PIPConfiguration implements Serializable { // Parse the resolvers // Collection resolvers = PIPResolver.importResolvers(id + ".resolver", - properties.getProperty(name.toString()), + properties.getProperty(nme.toString()), properties,"super-admin" ); for (PIPResolver resolver : resolvers) { this.addPipresolver(resolver); } - } else if (name.toString().startsWith(id + ".resolver")) { + } else if (nme.toString().startsWith(id + ".resolver")) { // // Ignore, the PIPResolver will parse these values // @@ -428,8 +429,8 @@ public class PIPConfiguration implements Serializable { // // Config Parameter // - this.addPipconfigParam(new PIPConfigParam(name.toString().substring(id.length() + 1), - properties.getProperty(name.toString()))); + this.addPipconfigParam(new PIPConfigParam(nme.toString().substring(id.length() + 1), + properties.getProperty(nme.toString()))); } } // @@ -470,12 +471,12 @@ public class PIPConfiguration implements Serializable { Iterator iter = this.pipresolvers.iterator(); while (iter.hasNext()) { PIPResolver resolver = iter.next(); - String id = Integer.toString(resolver.getId()); - Map resolverMap = resolver.getConfiguration(prefix + "resolver." + id); + String idd = Integer.toString(resolver.getId()); + Map resolverMap = resolver.getConfiguration(prefix + "resolver." + idd); map.putAll(resolverMap); - ids.add(id); + ids.add(idd); } - if (ids.size() > 0) { + if (!ids.isEmpty()) { map.put(prefix + "resolvers", Joiner.on(',').join(ids)); } return map; @@ -512,11 +513,11 @@ public class PIPConfiguration implements Serializable { Iterator iter = this.pipresolvers.iterator(); while (iter.hasNext()) { PIPResolver resolver = iter.next(); - String id = Integer.toString(resolver.getId()); - resolver.generateProperties(props, prefix + "resolver." + id); - ids.add(id); + String idd = Integer.toString(resolver.getId()); + resolver.generateProperties(props, prefix + "resolver." + idd); + ids.add(idd); } - if (ids.size() > 0) { + if (!ids.isEmpty()) { props.setProperty(prefix + "resolvers", Joiner.on(',').join(ids)); } return props;