2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.policy.xacml.std.pap;
23 import java.io.Serializable;
25 import java.util.HashMap;
26 import java.util.List;
29 import org.onap.policy.xacml.api.pap.OnapPAPPolicy;
31 public class StdPAPPolicy implements OnapPAPPolicy, Serializable {
32 private static final long serialVersionUID = 5260230629397322000L;
34 private String policyName = null;
35 private String oldPolicyFileName = null;
36 private String policyDescription = null;
37 private String onapName = null;
38 private String configName = null;
39 private Map<String, String> dynamicFieldConfigAttributes = new HashMap<>();
40 private Map<String, String> treatments = new HashMap<>();
41 private Map<String, String> dropDownMap = new HashMap<>();
42 private Map<String, String> dynamicSettingsMap = new HashMap<>();
43 private List<String> dynamicRuleAlgorithmLabels;
44 private List<String> dynamicRuleAlgorithmCombo;
45 private List<String> dynamicRuleAlgorithmField1;
46 private List<String> dynamicRuleAlgorithmField2;
47 private transient List<Object> dynamicVariableList;
48 private List<String> dataTypeList;
49 private String configBodyData = null;
50 private String policyID = null;
51 private String ruleID = null;
52 private String brmsController;
53 private List<String> brmsDependency;
54 private String configType = null;
55 private Boolean editPolicy = false;
56 private Boolean draft = false;
57 private String version = null;
58 private String domain = null;
59 private String configPolicyType = null;
60 private String jsonBody = null;
61 private String serviceType = null;
62 private Integer highestVersion = null;
63 private URI location = null;
64 private String actionPerformer = null;
65 private String actionAttribute = null;
66 private String actionBody = null;
67 private String actionDictHeader = null;
68 private String actionDictType = null;
69 private String actionDictUrl = null;
70 private String actionDictMethod = null;
71 private String uuid = null;
72 private String msLocation = null;
73 private String priority = null;
74 private transient Map<String, String> drlRuleAndUIParams = null;
75 private String deleteCondition = null;
76 private String dictionaryType = null;
77 private String dictionary = null;
78 private String dictionaryFields = null;
79 private String providerComboBox = null;
80 private String riskType = null;
81 private String guard = null;
82 private String riskLevel;
83 private String ttlDate = null;
86 public StdPAPPolicy() {
88 // Default empty constructor
92 //Constructor for sending location when pushing policies
93 public StdPAPPolicy(URI location) {
94 this.location = location;
97 //Constructor for Validating Config Policies
98 public StdPAPPolicy(String policyName, String body, String configType, String configPolicyType) {
99 this.policyName = policyName;
100 this.configBodyData = body;
101 this.configType = configType;
102 this.configPolicyType = configPolicyType;
107 * Create Config Policies from API and Admin Console
108 * Updating Config Policies from the API
109 * Create/Update Action Policies from API
110 * Create/Update Decision Policies
111 * @param stdPAPPolicyParams Input params object
113 public StdPAPPolicy(StdPAPPolicyParams stdPAPPolicyParams) {
114 this.configPolicyType=stdPAPPolicyParams.getConfigPolicyType();
115 this.policyName = stdPAPPolicyParams.getPolicyName();
116 this.policyDescription = stdPAPPolicyParams.getDescription();
117 this.onapName = stdPAPPolicyParams.getOnapName();
118 this.providerComboBox = stdPAPPolicyParams.getProviderComboBox();
119 this.configName = stdPAPPolicyParams.getConfigName();
120 this.dynamicFieldConfigAttributes = stdPAPPolicyParams.getDynamicFieldConfigAttributes();
121 this.dynamicSettingsMap = stdPAPPolicyParams.getDynamicSettingsMap();
122 this.configType = stdPAPPolicyParams.getConfigType();
123 this.configBodyData = stdPAPPolicyParams.getConfigBodyData();
124 this.editPolicy = stdPAPPolicyParams.getEditPolicy();
125 this.domain = stdPAPPolicyParams.getDomain();
126 this.highestVersion = stdPAPPolicyParams.getHighestVersion();
127 this.riskLevel = stdPAPPolicyParams.getRiskLevel();
128 this.riskType = stdPAPPolicyParams.getRiskType();
129 this.guard = stdPAPPolicyParams.getGuard();
130 this.ttlDate = stdPAPPolicyParams.getTtlDate();
131 this.dynamicRuleAlgorithmLabels = stdPAPPolicyParams.getDynamicRuleAlgorithmLabels();
132 this.dynamicRuleAlgorithmCombo = stdPAPPolicyParams.getDynamicRuleAlgorithmCombo();
133 this.dynamicRuleAlgorithmField1 = stdPAPPolicyParams.getDynamicRuleAlgorithmField1();
134 this.dynamicRuleAlgorithmField2 = stdPAPPolicyParams.getDynamicRuleAlgorithmField2();
135 this.dynamicVariableList = stdPAPPolicyParams.getDynamicVariableList();
136 this.dataTypeList = stdPAPPolicyParams.getDataTypeList();
137 this.dropDownMap = stdPAPPolicyParams.getDropDownMap();
138 this.actionPerformer = stdPAPPolicyParams.getActionPerformer();
139 this.actionAttribute = stdPAPPolicyParams.getActionAttribute();
140 this.treatments = stdPAPPolicyParams.getTreatments();
141 this.policyID = stdPAPPolicyParams.getPolicyID();
142 this.ruleID = stdPAPPolicyParams.getRuleID();
143 this.version = stdPAPPolicyParams.getVersion();
144 this.jsonBody = stdPAPPolicyParams.getJsonBody();
145 this.brmsController = stdPAPPolicyParams.getBrmsController();
146 this.brmsDependency = stdPAPPolicyParams.getBrmsDependency();
147 this.drlRuleAndUIParams = stdPAPPolicyParams.getDrlRuleAndUIParams();
148 this.serviceType = stdPAPPolicyParams.getServiceType();
149 this.oldPolicyFileName = stdPAPPolicyParams.getOldPolicyFileName();
150 this.draft = stdPAPPolicyParams.isDraft();
151 this.uuid = stdPAPPolicyParams.getUuid();
152 this.msLocation = stdPAPPolicyParams.getMsLocation();
153 this.priority = stdPAPPolicyParams.getPriority();
154 this.deleteCondition = stdPAPPolicyParams.getDeleteCondition();
155 this.dictionaryType = stdPAPPolicyParams.getDictionaryType();
156 this.dictionary = stdPAPPolicyParams.getDictionary();
157 this.dictionaryFields = stdPAPPolicyParams.getDictionaryFields();
162 public String getPolicyName() {
167 public String getPolicyDescription() {
168 return policyDescription;
172 public String getOnapName() {
177 public String getConfigName() {
182 public Map<String, String> getDynamicFieldConfigAttributes() {
183 return dynamicFieldConfigAttributes;
187 public String getConfigBodyData() {
188 return configBodyData;
192 public String getPolicyID() {
197 public String getRuleID() {
202 public String getConfigType() {
207 public Boolean isEditPolicy() {
212 public Boolean isDraft() {
217 public String getVersion() {
222 public String getDomainDir() {
227 public String getConfigPolicyType() {
228 return configPolicyType;
232 public String getJsonBody() {
237 public Integer getHighestVersion() {
238 return highestVersion;
242 public URI getLocation() {
247 public List<String> getDynamicRuleAlgorithmLabels() {
248 return dynamicRuleAlgorithmLabels;
252 public List<String> getDynamicRuleAlgorithmCombo() {
253 return dynamicRuleAlgorithmCombo;
257 public List<String> getDynamicRuleAlgorithmField1() {
258 return dynamicRuleAlgorithmField1;
262 public List<String> getDynamicRuleAlgorithmField2() {
263 return dynamicRuleAlgorithmField2;
267 public String getActionPerformer() {
268 return actionPerformer;
272 public String getActionAttribute() {
273 return actionAttribute;
277 public String getActionBody() {
282 public Map<String, String> getDropDownMap() {
287 public String getActionDictHeader() {
288 return actionDictHeader;
292 public String getActionDictType() {
293 return actionDictType;
297 public String getActionDictUrl() {
298 return actionDictUrl;
302 public String getActionDictMethod() {
303 return actionDictMethod;
307 public Map<String, String> getDynamicSettingsMap() {
308 return dynamicSettingsMap;
312 public List<Object> getDynamicVariableList() {
313 return dynamicVariableList;
317 public List<String> getDataTypeList() {
322 public String getOldPolicyFileName() {
323 return oldPolicyFileName;
327 public String getServiceType() {
332 public String getUuid() {
337 public String getMsLocation() {
342 public String getPriority() {
347 public String getDeleteCondition() {
348 return deleteCondition;
352 public String getDictionaryType() {
353 return dictionaryType;
357 public String getDictionary() {
362 public String getTTLDate() {
367 public String getDictionaryFields() {
368 return dictionaryFields;
372 public String getRiskType() {
377 public String getRiskLevel() {
382 public String getGuard() {
387 public Map<String, String> getTreatments() {
392 public String toString() {
393 return "StdPAPPolicy [policyName=" + policyName + ", policyDescription=" + policyDescription + ", onapName="
394 + onapName + ", configName=" + configName + ", dynamicFieldConfigAttributes=" +
395 dynamicFieldConfigAttributes + ", configBodyData=" + configBodyData
396 + ", policyID=" + policyID + ", ruleID=" + ruleID + ", configType=" + configType + ", editPolicy=" +
397 ", version=" + ", domain=" + domain
398 + ", configPolicyType=" + configPolicyType + ", jsonBody=" + jsonBody + ", highestVersion=" +
399 highestVersion + ", location=" + location
400 + ",dynamicRuleAlgorithmLabels=" + dynamicRuleAlgorithmLabels + ",dynamicRuleAlgorithmCombo=" +
401 dynamicRuleAlgorithmCombo
402 + ",dynamicRuleAlgorithmField1=" + dynamicRuleAlgorithmField1 + ",dynamicRuleAlgorithmField2=" +
403 dynamicRuleAlgorithmField2
404 + ",actionPerformer=" + actionPerformer + ",actionAttribute=" + actionAttribute + ",actionBody=" +
405 actionBody + ",dropDownMap=" + dropDownMap
406 + ",actionDictHeader=" + actionDictHeader + ",actionDictType=" + actionDictType + ",actionDictUrl=" +
408 + ",actionDictMethod=" + actionDictMethod + ",dynamicSettingsMap=" + dynamicSettingsMap + "," +
409 "dynamicVariableList=" + dynamicVariableList + ",providerComboBox=" + providerComboBox
410 + ",dataTypeList=" + dataTypeList + ",draft=" + ",oldPolicyFileName=" + oldPolicyFileName + "," +
411 "serviceType=" + serviceType
412 + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" +
413 deleteCondition + ",dictionaryType=" + dictionaryType
414 + ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + "," +
415 "msLocation=" + msLocation + ",priority="
416 + priority + ",deleteCondition=" + deleteCondition + ",riskType=" + riskType + ",riskLevel=" +
417 riskLevel + ",guard=" + guard + ",ttlDate=" + ttlDate
418 + ",treatments=" + treatments + "]";
421 // Methods needed for JSON Deserialization
422 public void setPolicyName(String policyName) {
423 this.policyName = policyName;
426 public void setPolicyDescription(String policyDescription) {
427 this.policyDescription = policyDescription;
430 public void setOnapName(String onapName) {
431 this.onapName = onapName;
434 public void setConfigName(String configName) {
435 this.configName = configName;
438 public void setDynamicFieldConfigAttributes(
439 Map<String, String> dynamicFieldConfigAttributes) {
440 this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
443 public void setConfigBodyData(String configBodyData) {
444 this.configBodyData = configBodyData;
447 public void setPolicyID(String policyID) {
448 this.policyID = policyID;
451 public void setRuleID(String ruleID) {
452 this.ruleID = ruleID;
455 public void setConfigType(String configType) {
456 this.configType = configType;
459 public void setEditPolicy(Boolean editPolicy) {
460 this.editPolicy = editPolicy;
463 public void setVersion(String version) {
464 this.version = version;
467 public void setDomainDir(String domain) {
468 this.domain = domain;
471 public void setConfigPolicyType(String configPolicyType) {
472 this.configPolicyType = configPolicyType;
475 public void setJsonBody(String jsonBody) {
476 this.jsonBody = jsonBody;
479 public void setHighestVersion(Integer highestVersion) {
480 this.highestVersion = highestVersion;
483 public void setLocation(URI location) {
484 this.location = location;
487 public void setDynamicRuleAlgorithmLabels(
488 List<String> dynamicRuleAlgorithmLabels) {
489 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
492 public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
493 this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
496 public void setDynamicRuleAlgorithmField1(
497 List<String> dynamicRuleAlgorithmField1) {
498 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
501 public void setDynamicRuleAlgorithmField2(
502 List<String> dynamicRuleAlgorithmField2) {
503 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
506 public void setActionPerformer(String actionPerformer) {
507 this.actionPerformer = actionPerformer;
510 public void setActionAttribute(String actionAttribute) {
511 this.actionAttribute = actionAttribute;
514 public void setActionBody(String actionBody) {
515 this.actionBody = actionBody;
518 public void setDropDownMap(Map<String, String> dropDownMap) {
519 this.dropDownMap = dropDownMap;
522 public void setActionDictHeader(String actionDictHeader) {
523 this.actionDictHeader = actionDictHeader;
526 public void setActionDictType(String actionDictType) {
527 this.actionDictType = actionDictType;
530 public void setActionDictUrl(String actionDictUrl) {
531 this.actionDictUrl = actionDictUrl;
534 public void setActionDictMethod(String actionDictMethod) {
535 this.actionDictMethod = actionDictMethod;
538 public void setDynamicSettingsMap(Map<String, String> dynamicSettingsMap) {
539 this.dynamicSettingsMap = dynamicSettingsMap;
542 public void setDynamicVariableList(List<Object> dynamicVariableList) {
543 this.dynamicVariableList = dynamicVariableList;
546 public void setDataTypeList(List<String> dataTypeList) {
547 this.dataTypeList = dataTypeList;
550 public void setDraft(Boolean draft) {
554 public void setOldPolicyFileName(String oldPolicyFileName) {
555 this.oldPolicyFileName = oldPolicyFileName;
558 public void setServiceType(String serviceType) {
559 this.serviceType = serviceType;
562 public Map<String, String> getDrlRuleAndUIParams() {
563 return drlRuleAndUIParams;
566 public void setDrlRuleAndUIParams(Map<String, String> drlRuleAndUIParams) {
567 this.drlRuleAndUIParams = drlRuleAndUIParams;
570 public void setUuid(String uuid) {
574 public void setMsLocation(String msLocation) {
575 this.msLocation = msLocation;
578 public void setPriority(String priority) {
579 this.priority = priority;
582 public void setDeleteCondition(String deleteCondition) {
583 this.deleteCondition = deleteCondition;
586 public void setDictionaryType(String dictionaryType) {
587 this.dictionaryType = dictionaryType;
590 public void setDictionary(String dictionary) {
591 this.dictionary = dictionary;
594 public void setDictionaryFields(String dictionaryFields) {
595 this.dictionaryFields = dictionaryFields;
598 public String getProviderComboBox() {
599 return providerComboBox;
602 public void setProviderComboBox(String providerComboBox) {
603 this.providerComboBox = providerComboBox;
606 public void setRiskType(String riskType) {
607 this.riskType = riskType;
610 public void setRiskLevel(String riskLevel) {
611 this.riskLevel = riskLevel;
614 public void setGuard(String guard) {
618 public void setTTLDate(String ttlDate) {
619 this.ttlDate = ttlDate;
622 public String getBrmsController() {
623 return brmsController;
626 public void setBrmsController(String brmsController) {
627 this.brmsController = brmsController;
630 public List<String> getBrmsDependency() {
631 return brmsDependency;
634 public void setBrmsDependency(List<String> brmsDependency) {
635 this.brmsDependency = brmsDependency;
638 public void setTreatments(Map<String, String> treatments) {
639 this.treatments = treatments;