2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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=========================================================
22 package org.onap.policy.xacml.std.pap;
24 import java.io.Serializable;
26 import java.util.HashMap;
27 import java.util.List;
30 import org.onap.policy.xacml.api.pap.OnapPAPPolicy;
32 public class StdPAPPolicy implements OnapPAPPolicy, Serializable {
33 private static final long serialVersionUID = 5260230629397322000L;
35 private String policyName = null;
36 private String oldPolicyFileName = null;
37 private String policyDescription = null;
38 private String onapName = null;
39 private String configName = null;
40 private Map<String, String> dynamicFieldConfigAttributes = new HashMap<>();
41 private Map<String, String> treatments = new HashMap<>();
42 private Map<String, String> dropDownMap = new HashMap<>();
43 private Map<String, String> dynamicSettingsMap = new HashMap<>();
44 private List<String> dynamicRuleAlgorithmLabels;
45 private List<String> dynamicRuleAlgorithmCombo;
46 private List<String> dynamicRuleAlgorithmField1;
47 private List<String> dynamicRuleAlgorithmField2;
48 private transient List<Object> dynamicVariableList;
49 private List<String> dataTypeList;
50 private String configBodyData = null;
51 private String policyID = null;
52 private String ruleID = null;
53 private String brmsController;
54 private List<String> brmsDependency;
55 private String configType = null;
56 private Boolean editPolicy = false;
57 private Boolean draft = false;
58 private String version = null;
59 private String domain = null;
60 private String configPolicyType = null;
61 private String jsonBody = null;
62 private String serviceType = null;
63 private Integer highestVersion = null;
64 private URI location = null;
65 private String actionPerformer = null;
66 private String actionAttribute = null;
67 private String actionBody = null;
68 private String actionDictHeader = null;
69 private String actionDictType = null;
70 private String actionDictUrl = null;
71 private String actionDictMethod = null;
72 private String uuid = null;
73 private String msLocation = null;
74 private String priority = null;
75 private transient Map<String, String> drlRuleAndUIParams = null;
76 private String deleteCondition = null;
77 private String dictionaryType = null;
78 private String dictionary = null;
79 private String dictionaryFields = null;
80 private String providerComboBox = null;
81 private String riskType = null;
82 private String guard = null;
83 private String riskLevel;
84 private String ttlDate = null;
85 private String rawXacmlPolicy = null;
87 public StdPAPPolicy() {
89 // Default empty constructor
93 // Constructor for sending location when pushing policies
94 public StdPAPPolicy(URI location) {
95 this.location = location;
99 * Constructor for Validating Config Policies.
101 * @param policyName String
103 * @param configType String
104 * @param configPolicyType String
106 public StdPAPPolicy(String policyName, String body, String configType, String configPolicyType) {
107 this.policyName = policyName;
108 this.configBodyData = body;
109 this.configType = configType;
110 this.configPolicyType = configPolicyType;
115 * Create Config Policies from API and Admin Console
116 * Updating Config Policies from the API
117 * Create/Update Action Policies from API
118 * Create/Update Decision Policies
120 * @param stdPAPPolicyParams Input params object
122 public StdPAPPolicy(StdPAPPolicyParams stdPAPPolicyParams) {
123 this.configPolicyType = stdPAPPolicyParams.getConfigPolicyType();
124 this.policyName = stdPAPPolicyParams.getPolicyName();
125 this.policyDescription = stdPAPPolicyParams.getDescription();
126 this.onapName = stdPAPPolicyParams.getOnapName();
127 this.providerComboBox = stdPAPPolicyParams.getProviderComboBox();
128 this.configName = stdPAPPolicyParams.getConfigName();
129 this.dynamicFieldConfigAttributes = stdPAPPolicyParams.getDynamicFieldConfigAttributes();
130 this.dynamicSettingsMap = stdPAPPolicyParams.getDynamicSettingsMap();
131 this.configType = stdPAPPolicyParams.getConfigType();
132 this.configBodyData = stdPAPPolicyParams.getConfigBodyData();
133 this.editPolicy = stdPAPPolicyParams.getEditPolicy();
134 this.domain = stdPAPPolicyParams.getDomain();
135 this.highestVersion = stdPAPPolicyParams.getHighestVersion();
136 this.riskLevel = stdPAPPolicyParams.getRiskLevel();
137 this.riskType = stdPAPPolicyParams.getRiskType();
138 this.guard = stdPAPPolicyParams.getGuard();
139 this.ttlDate = stdPAPPolicyParams.getTtlDate();
140 this.dynamicRuleAlgorithmLabels = stdPAPPolicyParams.getDynamicRuleAlgorithmLabels();
141 this.dynamicRuleAlgorithmCombo = stdPAPPolicyParams.getDynamicRuleAlgorithmCombo();
142 this.dynamicRuleAlgorithmField1 = stdPAPPolicyParams.getDynamicRuleAlgorithmField1();
143 this.dynamicRuleAlgorithmField2 = stdPAPPolicyParams.getDynamicRuleAlgorithmField2();
144 this.dynamicVariableList = stdPAPPolicyParams.getDynamicVariableList();
145 this.dataTypeList = stdPAPPolicyParams.getDataTypeList();
146 this.dropDownMap = stdPAPPolicyParams.getDropDownMap();
147 this.actionPerformer = stdPAPPolicyParams.getActionPerformer();
148 this.actionAttribute = stdPAPPolicyParams.getActionAttribute();
149 this.treatments = stdPAPPolicyParams.getTreatments();
150 this.policyID = stdPAPPolicyParams.getPolicyID();
151 this.ruleID = stdPAPPolicyParams.getRuleID();
152 this.version = stdPAPPolicyParams.getVersion();
153 this.jsonBody = stdPAPPolicyParams.getJsonBody();
154 this.brmsController = stdPAPPolicyParams.getBrmsController();
155 this.brmsDependency = stdPAPPolicyParams.getBrmsDependency();
156 this.drlRuleAndUIParams = stdPAPPolicyParams.getDrlRuleAndUIParams();
157 this.serviceType = stdPAPPolicyParams.getServiceType();
158 this.oldPolicyFileName = stdPAPPolicyParams.getOldPolicyFileName();
159 this.draft = stdPAPPolicyParams.isDraft();
160 this.uuid = stdPAPPolicyParams.getUuid();
161 this.msLocation = stdPAPPolicyParams.getMsLocation();
162 this.priority = stdPAPPolicyParams.getPriority();
163 this.deleteCondition = stdPAPPolicyParams.getDeleteCondition();
164 this.dictionaryType = stdPAPPolicyParams.getDictionaryType();
165 this.dictionary = stdPAPPolicyParams.getDictionary();
166 this.dictionaryFields = stdPAPPolicyParams.getDictionaryFields();
167 this.rawXacmlPolicy = stdPAPPolicyParams.getRawXacmlPolicy();
171 public String getPolicyName() {
176 public String getPolicyDescription() {
177 return policyDescription;
181 public String getOnapName() {
186 public String getConfigName() {
191 public Map<String, String> getDynamicFieldConfigAttributes() {
192 return dynamicFieldConfigAttributes;
196 public String getConfigBodyData() {
197 return configBodyData;
201 public String getPolicyID() {
206 public String getRuleID() {
211 public String getConfigType() {
216 public Boolean isEditPolicy() {
221 public Boolean isDraft() {
226 public String getVersion() {
231 public String getDomainDir() {
236 public String getConfigPolicyType() {
237 return configPolicyType;
241 public String getJsonBody() {
246 public Integer getHighestVersion() {
247 return highestVersion;
251 public URI getLocation() {
256 public List<String> getDynamicRuleAlgorithmLabels() {
257 return dynamicRuleAlgorithmLabels;
261 public List<String> getDynamicRuleAlgorithmCombo() {
262 return dynamicRuleAlgorithmCombo;
266 public List<String> getDynamicRuleAlgorithmField1() {
267 return dynamicRuleAlgorithmField1;
271 public List<String> getDynamicRuleAlgorithmField2() {
272 return dynamicRuleAlgorithmField2;
276 public String getActionPerformer() {
277 return actionPerformer;
281 public String getActionAttribute() {
282 return actionAttribute;
286 public String getActionBody() {
291 public Map<String, String> getDropDownMap() {
296 public String getActionDictHeader() {
297 return actionDictHeader;
301 public String getActionDictType() {
302 return actionDictType;
306 public String getActionDictUrl() {
307 return actionDictUrl;
311 public String getActionDictMethod() {
312 return actionDictMethod;
316 public Map<String, String> getDynamicSettingsMap() {
317 return dynamicSettingsMap;
321 public List<Object> getDynamicVariableList() {
322 return dynamicVariableList;
326 public List<String> getDataTypeList() {
331 public String getOldPolicyFileName() {
332 return oldPolicyFileName;
336 public String getServiceType() {
341 public String getUuid() {
346 public String getMsLocation() {
351 public String getPriority() {
356 public String getDeleteCondition() {
357 return deleteCondition;
361 public String getDictionaryType() {
362 return dictionaryType;
366 public String getDictionary() {
371 public String getTTLDate() {
376 public String getDictionaryFields() {
377 return dictionaryFields;
381 public String getRiskType() {
386 public String getRiskLevel() {
391 public String getGuard() {
396 public Map<String, String> getTreatments() {
401 public String toString() {
402 return "StdPAPPolicy [policyName=" + policyName + ", policyDescription=" + policyDescription + ", onapName="
403 + onapName + ", configName=" + configName + ", dynamicFieldConfigAttributes="
404 + dynamicFieldConfigAttributes + ", configBodyData=" + configBodyData + ", policyID=" + policyID
405 + ", ruleID=" + ruleID + ", configType=" + configType + ", editPolicy=" + ", version=" + ", domain="
406 + domain + ", configPolicyType=" + configPolicyType + ", jsonBody=" + jsonBody + ", highestVersion="
407 + highestVersion + ", location=" + location + ",dynamicRuleAlgorithmLabels="
408 + dynamicRuleAlgorithmLabels + ",dynamicRuleAlgorithmCombo=" + dynamicRuleAlgorithmCombo
409 + ",dynamicRuleAlgorithmField1=" + dynamicRuleAlgorithmField1 + ",dynamicRuleAlgorithmField2="
410 + dynamicRuleAlgorithmField2 + ",actionPerformer=" + actionPerformer + ",actionAttribute="
411 + actionAttribute + ",actionBody=" + actionBody + ",dropDownMap=" + dropDownMap + ",actionDictHeader="
412 + actionDictHeader + ",actionDictType=" + actionDictType + ",actionDictUrl=" + actionDictUrl
413 + ",actionDictMethod=" + actionDictMethod + ",dynamicSettingsMap=" + dynamicSettingsMap + ","
414 + "dynamicVariableList=" + dynamicVariableList + ",providerComboBox=" + providerComboBox
415 + ",dataTypeList=" + dataTypeList + ",draft=" + ",oldPolicyFileName=" + oldPolicyFileName + ","
416 + "serviceType=" + serviceType + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority
417 + ",deleteCondition=" + deleteCondition + ",dictionaryType=" + dictionaryType + ",dictionary="
418 + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + "," + "msLocation="
419 + msLocation + ",priority=" + priority + ",deleteCondition=" + deleteCondition + ",riskType=" + riskType
420 + ",riskLevel=" + riskLevel + ",guard=" + guard + ",ttlDate=" + ttlDate + ",treatments=" + treatments
424 // Methods needed for JSON Deserialization
425 public void setPolicyName(String policyName) {
426 this.policyName = policyName;
429 public void setPolicyDescription(String policyDescription) {
430 this.policyDescription = policyDescription;
433 public void setOnapName(String onapName) {
434 this.onapName = onapName;
437 public void setConfigName(String configName) {
438 this.configName = configName;
441 public void setDynamicFieldConfigAttributes(Map<String, String> dynamicFieldConfigAttributes) {
442 this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
445 public void setConfigBodyData(String configBodyData) {
446 this.configBodyData = configBodyData;
449 public void setPolicyID(String policyID) {
450 this.policyID = policyID;
453 public void setRuleID(String ruleID) {
454 this.ruleID = ruleID;
457 public void setConfigType(String configType) {
458 this.configType = configType;
461 public void setEditPolicy(Boolean editPolicy) {
462 this.editPolicy = editPolicy;
465 public void setVersion(String version) {
466 this.version = version;
469 public void setDomainDir(String domain) {
470 this.domain = domain;
473 public void setConfigPolicyType(String configPolicyType) {
474 this.configPolicyType = configPolicyType;
477 public void setJsonBody(String jsonBody) {
478 this.jsonBody = jsonBody;
481 public void setHighestVersion(Integer highestVersion) {
482 this.highestVersion = highestVersion;
485 public void setLocation(URI location) {
486 this.location = location;
489 public void setDynamicRuleAlgorithmLabels(List<String> dynamicRuleAlgorithmLabels) {
490 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
493 public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
494 this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
497 public void setDynamicRuleAlgorithmField1(List<String> dynamicRuleAlgorithmField1) {
498 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
501 public void setDynamicRuleAlgorithmField2(List<String> dynamicRuleAlgorithmField2) {
502 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
505 public void setActionPerformer(String actionPerformer) {
506 this.actionPerformer = actionPerformer;
509 public void setActionAttribute(String actionAttribute) {
510 this.actionAttribute = actionAttribute;
513 public void setActionBody(String actionBody) {
514 this.actionBody = actionBody;
517 public void setDropDownMap(Map<String, String> dropDownMap) {
518 this.dropDownMap = dropDownMap;
521 public void setActionDictHeader(String actionDictHeader) {
522 this.actionDictHeader = actionDictHeader;
525 public void setActionDictType(String actionDictType) {
526 this.actionDictType = actionDictType;
529 public void setActionDictUrl(String actionDictUrl) {
530 this.actionDictUrl = actionDictUrl;
533 public void setActionDictMethod(String actionDictMethod) {
534 this.actionDictMethod = actionDictMethod;
537 public void setDynamicSettingsMap(Map<String, String> dynamicSettingsMap) {
538 this.dynamicSettingsMap = dynamicSettingsMap;
541 public void setDynamicVariableList(List<Object> dynamicVariableList) {
542 this.dynamicVariableList = dynamicVariableList;
545 public void setDataTypeList(List<String> dataTypeList) {
546 this.dataTypeList = dataTypeList;
549 public void setDraft(Boolean draft) {
553 public void setOldPolicyFileName(String oldPolicyFileName) {
554 this.oldPolicyFileName = oldPolicyFileName;
557 public void setServiceType(String serviceType) {
558 this.serviceType = serviceType;
561 public Map<String, String> getDrlRuleAndUIParams() {
562 return drlRuleAndUIParams;
565 public void setDrlRuleAndUIParams(Map<String, String> drlRuleAndUIParams) {
566 this.drlRuleAndUIParams = drlRuleAndUIParams;
569 public void setUuid(String uuid) {
573 public void setMsLocation(String msLocation) {
574 this.msLocation = msLocation;
577 public void setPriority(String priority) {
578 this.priority = priority;
581 public void setDeleteCondition(String deleteCondition) {
582 this.deleteCondition = deleteCondition;
585 public void setDictionaryType(String dictionaryType) {
586 this.dictionaryType = dictionaryType;
589 public void setDictionary(String dictionary) {
590 this.dictionary = dictionary;
593 public void setDictionaryFields(String dictionaryFields) {
594 this.dictionaryFields = dictionaryFields;
597 public String getProviderComboBox() {
598 return providerComboBox;
601 public void setProviderComboBox(String providerComboBox) {
602 this.providerComboBox = providerComboBox;
605 public void setRiskType(String riskType) {
606 this.riskType = riskType;
609 public void setRiskLevel(String riskLevel) {
610 this.riskLevel = riskLevel;
613 public void setGuard(String guard) {
617 public void setTTLDate(String ttlDate) {
618 this.ttlDate = ttlDate;
621 public String getBrmsController() {
622 return brmsController;
625 public void setBrmsController(String brmsController) {
626 this.brmsController = brmsController;
629 public List<String> getBrmsDependency() {
630 return brmsDependency;
633 public void setBrmsDependency(List<String> brmsDependency) {
634 this.brmsDependency = brmsDependency;
637 public void setTreatments(Map<String, String> treatments) {
638 this.treatments = treatments;
641 public String getRawXacmlPolicy() {
642 return rawXacmlPolicy;
645 public void setRawXacmlPolicy(String rawXacmlPolicy) {
646 this.rawXacmlPolicy = rawXacmlPolicy;