diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-10-02 09:13:13 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2020-10-02 09:13:18 -0400 |
commit | 7ae3ab19d0556a0308f0d293d4dd2e58dd3d3929 (patch) | |
tree | 16e26e30d7a6e734ec34108d24727eb8afc0c9dc /applications/guard/src/main/java/org | |
parent | 57e705469481f446aeada858c8eb411c5cccebc8 (diff) |
Remove duplicated code
Initially, just moving the applicationName and actions as protected
fields got rid of the sonar issue. I included also the supportedPolicyTypes
also. But that triggered another sonar duplicate code, so I had to rename
a few private fields to rid that. Seems like a very sensitive sonar detection
that results in kludgy code.
Issue-ID: POLICY-2681
Change-Id: Ie79a95786cdb80381cbce4b182e9e66a2776e0dd
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/guard/src/main/java/org')
-rw-r--r-- | applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java index 982c14b7..bb1b7588 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java @@ -22,9 +22,7 @@ package org.onap.policy.xacml.pdp.application.guard; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator; import org.onap.policy.pdp.xacml.application.common.std.StdXacmlApplicationServiceProvider; @@ -40,7 +38,7 @@ import org.slf4j.LoggerFactory; public class GuardPdpApplication extends StdXacmlApplicationServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(GuardPdpApplication.class); private static final String STRING_VERSION100 = "1.0.0"; - private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>(); + private GuardTranslator guardTranslator = new GuardTranslator(); private CoordinationGuardTranslator coordinationTranslator = new CoordinationGuardTranslator(); @@ -49,6 +47,11 @@ public class GuardPdpApplication extends StdXacmlApplicationServiceProvider { * */ public GuardPdpApplication() { + super(); + + applicationName = "guard"; + actions = Arrays.asList("guard"); + this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier( GuardTranslator.POLICYTYPE_FREQUENCY, STRING_VERSION100)); @@ -67,21 +70,6 @@ public class GuardPdpApplication extends StdXacmlApplicationServiceProvider { } @Override - public String applicationName() { - return "guard"; - } - - @Override - public List<String> actionDecisionsSupported() { - return Arrays.asList("guard"); - } - - @Override - public List<ToscaPolicyTypeIdentifier> supportedPolicyTypes() { - return supportedPolicyTypes; - } - - @Override public boolean canSupportPolicyType(ToscaPolicyTypeIdentifier policyTypeId) { // // For the time being, restrict this if the version isn't known. |