summaryrefslogtreecommitdiffstats
path: root/ONAP-XACML/src/main/java/org/onap
diff options
context:
space:
mode:
authorKrishnajinka <kris.jinka@samsung.com>2018-08-20 14:18:14 +0900
committerKrishnajinka <kris.jinka@samsung.com>2018-08-20 14:18:50 +0900
commitc47063d7cf7b6294547c7628630a5b9fca1daedc (patch)
treea025965d319f5138238d153c32245f86ccf7dbed /ONAP-XACML/src/main/java/org/onap
parent84df4a428ded309f750f52ac1c104ac84e426fc0 (diff)
Use builder for std pap policy
Modify constructor in stdpappolicy to use builder this will fix the sonar issue related with more than 7 parameters method parameters Issue-ID: POLICY-1016 Change-Id: Id736a66e5ea48f0f233cffb640cdce8aaa8f2c0d Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
Diffstat (limited to 'ONAP-XACML/src/main/java/org/onap')
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java102
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java129
2 files changed, 140 insertions, 91 deletions
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
index 74ded6d43..185175907 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicy.java
@@ -3,7 +3,7 @@
* ONAP-XACML
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
+ * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -145,97 +145,17 @@ public class StdPAPPolicy implements OnapPAPPolicy, Serializable {
this.brmsController = stdPAPPolicyParams.getBrmsController();
this.brmsDependency = stdPAPPolicyParams.getBrmsDependency();
this.drlRuleAndUIParams = stdPAPPolicyParams.getDrlRuleAndUIParams();
- }
-
- //Constructor for Creating BRMS Param Policies from the Admin Console
- public StdPAPPolicy(String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- Map<String, String> dynamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData, Map<String, String> drlRuleAndUIParams, String riskLevel,
- String riskType, String guard, String ttlDate, String brmsController,
- List<String> brmsDependency) {
-
- this.configPolicyType = configPolicyType;
- this.policyName = policyName;
- this.policyDescription = description;
- this.configName = configName;
- this.editPolicy = editPolicy;
- this.domain = domain;
- this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
- this.highestVersion = highestVersion;
- this.onapName = eCompName;
- this.configBodyData = configBodyData;
- this.drlRuleAndUIParams = drlRuleAndUIParams;
- this.riskLevel = riskLevel;
- this.riskType = riskType;
- this.guard = guard;
- this.ttlDate = ttlDate;
- this.brmsController = brmsController;
- this.brmsDependency = brmsDependency;
- }
-
- //Constructor for Creating CloseLoop_Fault and Performance Metric Policies
- public StdPAPPolicy(String configPolicyType, String policyName, String description, String onapName,
- String jsonBody, Boolean draft, String oldPolicyFileName, String serviceType,
- Boolean editPolicy,
- String domain, Integer highestVersion, String riskLevel, String riskType, String guard,
- String ttlDate) {
+ this.serviceType = stdPAPPolicyParams.getServiceType();
+ this.oldPolicyFileName = stdPAPPolicyParams.getOldPolicyFileName();
+ this.draft = stdPAPPolicyParams.isDraft();
+ this.uuid = stdPAPPolicyParams.getUuid();
+ this.msLocation = stdPAPPolicyParams.getMsLocation();
+ this.priority = stdPAPPolicyParams.getPriority();
+ this.deleteCondition = stdPAPPolicyParams.getDeleteCondition();
+ this.dictionaryType = stdPAPPolicyParams.getDictionaryType();
+ this.dictionary = stdPAPPolicyParams.getDictionary();
+ this.dictionaryFields = stdPAPPolicyParams.getDictionaryFields();
- this.configPolicyType = configPolicyType;
- this.policyName = policyName;
- this.policyDescription = description;
- this.onapName = onapName;
- this.jsonBody = jsonBody;
- this.draft = draft;
- this.oldPolicyFileName = oldPolicyFileName;
- this.serviceType = serviceType;
- this.editPolicy = editPolicy;
- this.domain = domain;
- this.highestVersion = highestVersion;
- this.riskLevel = riskLevel;
- this.riskType = riskType;
- this.guard = guard;
- this.ttlDate = ttlDate;
- }
-
- //Constructor for Micro Service Creating/Updating Policies from the Admin Console
- public StdPAPPolicy(String configPolicyType, String policyName, String description, String onapName,
- String configName, String serviceType, String uuid,
- String msLocation, String jsonBody, String priority, String version, Boolean editPolicy,
- String domain, int highestVersion, String riskLevel,
- String riskType, String guard, String ttlDate) {
-
- this.configPolicyType = configPolicyType;
- this.policyName = policyName;
- this.policyDescription = description;
- this.onapName = onapName;
- this.configName = configName;
- this.serviceType = serviceType;
- this.uuid = uuid;
- this.msLocation = msLocation;
- this.priority = priority;
- this.version = version;
- this.jsonBody = jsonBody;
- this.editPolicy = editPolicy;
- this.domain = domain;
- this.highestVersion = highestVersion;
- this.riskLevel = riskLevel;
- this.riskType = riskType;
- this.guard = guard;
- this.ttlDate = ttlDate;
- }
-
- // Constructor for deleting policies from the API
- public StdPAPPolicy(String policyName, String deleteCondition) {
- this.policyName = policyName;
- this.deleteCondition = deleteCondition;
- }
-
- // Constructor for creating dictionary items from the API>
- public StdPAPPolicy(String dictionaryType, String dictionary, String dictionaryFields) {
- this.dictionaryType = dictionaryType;
- this.dictionary = dictionary;
- this.dictionaryFields = dictionaryFields;
}
@Override
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java
index 7eb422b99..780decd88 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/std/pap/StdPAPPolicyParams.java
@@ -61,14 +61,37 @@ public class StdPAPPolicyParams {
private String brmsController;
private List<String> brmsDependency;
private Map<String,String> drlRuleAndUIParams;
+ private boolean draft;
+ private String oldPolicyFileName;
+ private String serviceType;
+ private String uuid;
+ private String msLocation;
+ private String priority;
+ private String deleteCondition;
+ private String dictionaryType;
+ private String dictionary;
+ private String dictionaryFields;
/**
+
* Default constructor
*/
private StdPAPPolicyParams() {
super();
}
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public String getOldPolicyFileName() {
+ return oldPolicyFileName;
+ }
+
+ public boolean isDraft() {
+ return draft;
+ }
+
public int getHighestVersion() {
return highestVersion;
}
@@ -209,6 +232,62 @@ public class StdPAPPolicyParams {
return drlRuleAndUIParams;
}
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public String getMsLocation() {
+ return msLocation;
+ }
+
+ public void setMsLocation(String msLocation) {
+ this.msLocation = msLocation;
+ }
+
+ public String getPriority() {
+ return priority;
+ }
+
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
+
+ public String getDeleteCondition() {
+ return deleteCondition;
+ }
+
+ public void setDeleteCondition(String deleteCondition) {
+ this.deleteCondition = deleteCondition;
+ }
+
+ public String getDictionaryType() {
+ return dictionaryType;
+ }
+
+ public void setDictionaryType(String dictionaryType) {
+ this.dictionaryType = dictionaryType;
+ }
+
+ public String getDictionary() {
+ return dictionary;
+ }
+
+ public void setDictionary(String dictionary) {
+ this.dictionary = dictionary;
+ }
+
+ public String getDictionaryFields() {
+ return dictionaryFields;
+ }
+
+ public void setDictionaryFields(String dictionaryFields) {
+ this.dictionaryFields = dictionaryFields;
+ }
+
/**
* Builder class for the Policy parameters
*/
@@ -389,5 +468,55 @@ public class StdPAPPolicyParams {
m.drlRuleAndUIParams = drlRuleAndUIParams;
return this;
}
+
+ public StdPAPPolicyParamsBuilder draft(boolean b) {
+ m.draft = b;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder oldPolicyFileName(String name) {
+ m.oldPolicyFileName = name;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder serviceType(String s) {
+ m.serviceType = s;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder uuid(String uuid) {
+ m.uuid = uuid;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder msLocation(String msLocation) {
+ m.msLocation = msLocation;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder priority(String priority) {
+ m.priority = priority;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder deleteCondition(String deleteCondition) {
+ m.deleteCondition = deleteCondition;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dictionaryType(String dictionaryType) {
+ m.dictionaryType = dictionaryType;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dictionary(String dictionary) {
+ m.dictionary = dictionary;
+ return this;
+ }
+
+ public StdPAPPolicyParamsBuilder dictionaryFields(String dictionaryFields) {
+ m.dictionaryFields = dictionaryFields;
+ return this;
+ }
}
}