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/match | |
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/match')
-rw-r--r-- | applications/match/src/main/java/org/onap/policy/xacml/pdp/application/match/MatchPdpApplication.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/applications/match/src/main/java/org/onap/policy/xacml/pdp/application/match/MatchPdpApplication.java b/applications/match/src/main/java/org/onap/policy/xacml/pdp/application/match/MatchPdpApplication.java index 5f9cfa1a..62466b95 100644 --- a/applications/match/src/main/java/org/onap/policy/xacml/pdp/application/match/MatchPdpApplication.java +++ b/applications/match/src/main/java/org/onap/policy/xacml/pdp/application/match/MatchPdpApplication.java @@ -24,7 +24,6 @@ package org.onap.policy.xacml.pdp.application.match; import java.nio.file.Path; import java.util.Arrays; -import java.util.List; import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator; @@ -42,14 +41,15 @@ public class MatchPdpApplication extends StdXacmlApplicationServiceProvider { private StdMatchableTranslator translator = new StdMatchableTranslator(); - @Override - public String applicationName() { - return "match"; - } + /** + * Constructor. + */ + public MatchPdpApplication() { + super(); - @Override - public List<String> actionDecisionsSupported() { - return Arrays.asList("match"); + applicationName = "match"; + actions = Arrays.asList("match"); + supportedPolicyTypes.add(supportedPolicy); } @Override @@ -68,11 +68,6 @@ public class MatchPdpApplication extends StdXacmlApplicationServiceProvider { } @Override - public synchronized List<ToscaPolicyTypeIdentifier> supportedPolicyTypes() { - return Arrays.asList(supportedPolicy); - } - - @Override public boolean canSupportPolicyType(ToscaPolicyTypeIdentifier policyTypeId) { return policyTypeId.getName().startsWith(ONAP_MATCH_DERIVED_POLICY_TYPE); } |