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/native/src/main | |
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/native/src/main')
-rw-r--r-- | applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java index 0d862d11..f8248f1c 100644 --- a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java +++ b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java @@ -25,7 +25,6 @@ package org.onap.policy.xacml.pdp.application.nativ; import com.att.research.xacml.api.Request; import com.att.research.xacml.api.Response; 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; @@ -38,28 +37,24 @@ import org.onap.policy.pdp.xacml.application.common.std.StdXacmlApplicationServi */ public class NativePdpApplication extends StdXacmlApplicationServiceProvider { - private static final ToscaPolicyTypeIdentifier supportedPolicyType = new ToscaPolicyTypeIdentifier( + private static final ToscaPolicyTypeIdentifier nativePolicyType = new ToscaPolicyTypeIdentifier( "onap.policies.native.Xacml", "1.0.0"); private NativePdpApplicationTranslator translator = new NativePdpApplicationTranslator(); - @Override - public String applicationName() { - return "native"; - } - - @Override - public List<String> actionDecisionsSupported() { - return Arrays.asList("native"); - } + /** + * Constructor. + */ + public NativePdpApplication() { + super(); - @Override - public synchronized List<ToscaPolicyTypeIdentifier> supportedPolicyTypes() { - return Arrays.asList(supportedPolicyType); + applicationName = "native"; + actions = Arrays.asList("native"); + supportedPolicyTypes.add(nativePolicyType); } @Override public boolean canSupportPolicyType(ToscaPolicyTypeIdentifier policyTypeId) { - return supportedPolicyType.equals(policyTypeId); + return nativePolicyType.equals(policyTypeId); } @Override |