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/common/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/common/src/main')
-rw-r--r-- | applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java index ba562b83..465e3f58 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java @@ -32,6 +32,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -55,6 +56,11 @@ import org.slf4j.LoggerFactory; public abstract class StdXacmlApplicationServiceProvider implements XacmlApplicationServiceProvider { private static final Logger LOGGER = LoggerFactory.getLogger(StdXacmlApplicationServiceProvider.class); + + protected String applicationName = "Please Override"; + protected List<String> actions = Collections.emptyList(); + protected List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>(); + private Path pathForData = null; @Getter private RestServerParameters policyApiParameters; @@ -68,12 +74,12 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica @Override public String applicationName() { - return "Please Override"; + return applicationName; } @Override public List<String> actionDecisionsSupported() { - return Collections.emptyList(); + return actions; } @Override @@ -105,7 +111,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica @Override public List<ToscaPolicyTypeIdentifier> supportedPolicyTypes() { - throw new UnsupportedOperationException("Please override and implement supportedPolicyTypes"); + return supportedPolicyTypes; } @Override |