2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Modified 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();
150 //Constructor for Creating BRMS Param Policies from the Admin Console
151 public StdPAPPolicy(String configPolicyType, String policyName, String description,
152 String configName, Boolean editPolicy, String domain,
153 Map<String, String> dynamicFieldConfigAttributes, Integer highestVersion, String eCompName,
154 String configBodyData, Map<String, String> drlRuleAndUIParams, String riskLevel,
155 String riskType, String guard, String ttlDate, String brmsController,
156 List<String> brmsDependency) {
158 this.configPolicyType = configPolicyType;
159 this.policyName = policyName;
160 this.policyDescription = description;
161 this.configName = configName;
162 this.editPolicy = editPolicy;
163 this.domain = domain;
164 this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
165 this.highestVersion = highestVersion;
166 this.onapName = eCompName;
167 this.configBodyData = configBodyData;
168 this.drlRuleAndUIParams = drlRuleAndUIParams;
169 this.riskLevel = riskLevel;
170 this.riskType = riskType;
172 this.ttlDate = ttlDate;
173 this.brmsController = brmsController;
174 this.brmsDependency = brmsDependency;
177 //Constructor for Creating CloseLoop_Fault and Performance Metric Policies
178 public StdPAPPolicy(String configPolicyType, String policyName, String description, String onapName,
179 String jsonBody, Boolean draft, String oldPolicyFileName, String serviceType,
181 String domain, Integer highestVersion, String riskLevel, String riskType, String guard,
184 this.configPolicyType = configPolicyType;
185 this.policyName = policyName;
186 this.policyDescription = description;
187 this.onapName = onapName;
188 this.jsonBody = jsonBody;
190 this.oldPolicyFileName = oldPolicyFileName;
191 this.serviceType = serviceType;
192 this.editPolicy = editPolicy;
193 this.domain = domain;
194 this.highestVersion = highestVersion;
195 this.riskLevel = riskLevel;
196 this.riskType = riskType;
198 this.ttlDate = ttlDate;
201 //Constructor for Micro Service Creating/Updating Policies from the Admin Console
202 public StdPAPPolicy(String configPolicyType, String policyName, String description, String onapName,
203 String configName, String serviceType, String uuid,
204 String msLocation, String jsonBody, String priority, String version, Boolean editPolicy,
205 String domain, int highestVersion, String riskLevel,
206 String riskType, String guard, String ttlDate) {
208 this.configPolicyType = configPolicyType;
209 this.policyName = policyName;
210 this.policyDescription = description;
211 this.onapName = onapName;
212 this.configName = configName;
213 this.serviceType = serviceType;
215 this.msLocation = msLocation;
216 this.priority = priority;
217 this.version = version;
218 this.jsonBody = jsonBody;
219 this.editPolicy = editPolicy;
220 this.domain = domain;
221 this.highestVersion = highestVersion;
222 this.riskLevel = riskLevel;
223 this.riskType = riskType;
225 this.ttlDate = ttlDate;
228 // Constructor for deleting policies from the API
229 public StdPAPPolicy(String policyName, String deleteCondition) {
230 this.policyName = policyName;
231 this.deleteCondition = deleteCondition;
234 // Constructor for creating dictionary items from the API>
235 public StdPAPPolicy(String dictionaryType, String dictionary, String dictionaryFields) {
236 this.dictionaryType = dictionaryType;
237 this.dictionary = dictionary;
238 this.dictionaryFields = dictionaryFields;
242 public String getPolicyName() {
247 public String getPolicyDescription() {
248 return policyDescription;
252 public String getOnapName() {
257 public String getConfigName() {
262 public Map<String, String> getDynamicFieldConfigAttributes() {
263 return dynamicFieldConfigAttributes;
267 public String getConfigBodyData() {
268 return configBodyData;
272 public String getPolicyID() {
277 public String getRuleID() {
282 public String getConfigType() {
287 public Boolean isEditPolicy() {
292 public Boolean isDraft() {
297 public String getVersion() {
302 public String getDomainDir() {
307 public String getConfigPolicyType() {
308 return configPolicyType;
312 public String getJsonBody() {
317 public Integer getHighestVersion() {
318 return highestVersion;
322 public URI getLocation() {
327 public List<String> getDynamicRuleAlgorithmLabels() {
328 return dynamicRuleAlgorithmLabels;
332 public List<String> getDynamicRuleAlgorithmCombo() {
333 return dynamicRuleAlgorithmCombo;
337 public List<String> getDynamicRuleAlgorithmField1() {
338 return dynamicRuleAlgorithmField1;
342 public List<String> getDynamicRuleAlgorithmField2() {
343 return dynamicRuleAlgorithmField2;
347 public String getActionPerformer() {
348 return actionPerformer;
352 public String getActionAttribute() {
353 return actionAttribute;
357 public String getActionBody() {
362 public Map<String, String> getDropDownMap() {
367 public String getActionDictHeader() {
368 return actionDictHeader;
372 public String getActionDictType() {
373 return actionDictType;
377 public String getActionDictUrl() {
378 return actionDictUrl;
382 public String getActionDictMethod() {
383 return actionDictMethod;
387 public Map<String, String> getDynamicSettingsMap() {
388 return dynamicSettingsMap;
392 public List<Object> getDynamicVariableList() {
393 return dynamicVariableList;
397 public List<String> getDataTypeList() {
402 public String getOldPolicyFileName() {
403 return oldPolicyFileName;
407 public String getServiceType() {
412 public String getUuid() {
417 public String getMsLocation() {
422 public String getPriority() {
427 public String getDeleteCondition() {
428 return deleteCondition;
432 public String getDictionaryType() {
433 return dictionaryType;
437 public String getDictionary() {
442 public String getTTLDate() {
447 public String getDictionaryFields() {
448 return dictionaryFields;
452 public String getRiskType() {
457 public String getRiskLevel() {
462 public String getGuard() {
467 public Map<String, String> getTreatments() {
472 public String toString() {
473 return "StdPAPPolicy [policyName=" + policyName + ", policyDescription=" + policyDescription + ", onapName="
474 + onapName + ", configName=" + configName + ", dynamicFieldConfigAttributes=" +
475 dynamicFieldConfigAttributes + ", configBodyData=" + configBodyData
476 + ", policyID=" + policyID + ", ruleID=" + ruleID + ", configType=" + configType + ", editPolicy=" +
477 ", version=" + ", domain=" + domain
478 + ", configPolicyType=" + configPolicyType + ", jsonBody=" + jsonBody + ", highestVersion=" +
479 highestVersion + ", location=" + location
480 + ",dynamicRuleAlgorithmLabels=" + dynamicRuleAlgorithmLabels + ",dynamicRuleAlgorithmCombo=" +
481 dynamicRuleAlgorithmCombo
482 + ",dynamicRuleAlgorithmField1=" + dynamicRuleAlgorithmField1 + ",dynamicRuleAlgorithmField2=" +
483 dynamicRuleAlgorithmField2
484 + ",actionPerformer=" + actionPerformer + ",actionAttribute=" + actionAttribute + ",actionBody=" +
485 actionBody + ",dropDownMap=" + dropDownMap
486 + ",actionDictHeader=" + actionDictHeader + ",actionDictType=" + actionDictType + ",actionDictUrl=" +
488 + ",actionDictMethod=" + actionDictMethod + ",dynamicSettingsMap=" + dynamicSettingsMap + "," +
489 "dynamicVariableList=" + dynamicVariableList + ",providerComboBox=" + providerComboBox
490 + ",dataTypeList=" + dataTypeList + ",draft=" + ",oldPolicyFileName=" + oldPolicyFileName + "," +
491 "serviceType=" + serviceType
492 + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" +
493 deleteCondition + ",dictionaryType=" + dictionaryType
494 + ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + "," +
495 "msLocation=" + msLocation + ",priority="
496 + priority + ",deleteCondition=" + deleteCondition + ",riskType=" + riskType + ",riskLevel=" +
497 riskLevel + ",guard=" + guard + ",ttlDate=" + ttlDate
498 + ",treatments=" + treatments + "]";
501 // Methods needed for JSON Deserialization
502 public void setPolicyName(String policyName) {
503 this.policyName = policyName;
506 public void setPolicyDescription(String policyDescription) {
507 this.policyDescription = policyDescription;
510 public void setOnapName(String onapName) {
511 this.onapName = onapName;
514 public void setConfigName(String configName) {
515 this.configName = configName;
518 public void setDynamicFieldConfigAttributes(
519 Map<String, String> dynamicFieldConfigAttributes) {
520 this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
523 public void setConfigBodyData(String configBodyData) {
524 this.configBodyData = configBodyData;
527 public void setPolicyID(String policyID) {
528 this.policyID = policyID;
531 public void setRuleID(String ruleID) {
532 this.ruleID = ruleID;
535 public void setConfigType(String configType) {
536 this.configType = configType;
539 public void setEditPolicy(Boolean editPolicy) {
540 this.editPolicy = editPolicy;
543 public void setVersion(String version) {
544 this.version = version;
547 public void setDomainDir(String domain) {
548 this.domain = domain;
551 public void setConfigPolicyType(String configPolicyType) {
552 this.configPolicyType = configPolicyType;
555 public void setJsonBody(String jsonBody) {
556 this.jsonBody = jsonBody;
559 public void setHighestVersion(Integer highestVersion) {
560 this.highestVersion = highestVersion;
563 public void setLocation(URI location) {
564 this.location = location;
567 public void setDynamicRuleAlgorithmLabels(
568 List<String> dynamicRuleAlgorithmLabels) {
569 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
572 public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
573 this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
576 public void setDynamicRuleAlgorithmField1(
577 List<String> dynamicRuleAlgorithmField1) {
578 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
581 public void setDynamicRuleAlgorithmField2(
582 List<String> dynamicRuleAlgorithmField2) {
583 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
586 public void setActionPerformer(String actionPerformer) {
587 this.actionPerformer = actionPerformer;
590 public void setActionAttribute(String actionAttribute) {
591 this.actionAttribute = actionAttribute;
594 public void setActionBody(String actionBody) {
595 this.actionBody = actionBody;
598 public void setDropDownMap(Map<String, String> dropDownMap) {
599 this.dropDownMap = dropDownMap;
602 public void setActionDictHeader(String actionDictHeader) {
603 this.actionDictHeader = actionDictHeader;
606 public void setActionDictType(String actionDictType) {
607 this.actionDictType = actionDictType;
610 public void setActionDictUrl(String actionDictUrl) {
611 this.actionDictUrl = actionDictUrl;
614 public void setActionDictMethod(String actionDictMethod) {
615 this.actionDictMethod = actionDictMethod;
618 public void setDynamicSettingsMap(Map<String, String> dynamicSettingsMap) {
619 this.dynamicSettingsMap = dynamicSettingsMap;
622 public void setDynamicVariableList(List<Object> dynamicVariableList) {
623 this.dynamicVariableList = dynamicVariableList;
626 public void setDataTypeList(List<String> dataTypeList) {
627 this.dataTypeList = dataTypeList;
630 public void setDraft(Boolean draft) {
634 public void setOldPolicyFileName(String oldPolicyFileName) {
635 this.oldPolicyFileName = oldPolicyFileName;
638 public void setServiceType(String serviceType) {
639 this.serviceType = serviceType;
642 public Map<String, String> getDrlRuleAndUIParams() {
643 return drlRuleAndUIParams;
646 public void setDrlRuleAndUIParams(Map<String, String> drlRuleAndUIParams) {
647 this.drlRuleAndUIParams = drlRuleAndUIParams;
650 public void setUuid(String uuid) {
654 public void setMsLocation(String msLocation) {
655 this.msLocation = msLocation;
658 public void setPriority(String priority) {
659 this.priority = priority;
662 public void setDeleteCondition(String deleteCondition) {
663 this.deleteCondition = deleteCondition;
666 public void setDictionaryType(String dictionaryType) {
667 this.dictionaryType = dictionaryType;
670 public void setDictionary(String dictionary) {
671 this.dictionary = dictionary;
674 public void setDictionaryFields(String dictionaryFields) {
675 this.dictionaryFields = dictionaryFields;
678 public String getProviderComboBox() {
679 return providerComboBox;
682 public void setProviderComboBox(String providerComboBox) {
683 this.providerComboBox = providerComboBox;
686 public void setRiskType(String riskType) {
687 this.riskType = riskType;
690 public void setRiskLevel(String riskLevel) {
691 this.riskLevel = riskLevel;
694 public void setGuard(String guard) {
698 public void setTTLDate(String ttlDate) {
699 this.ttlDate = ttlDate;
702 public String getBrmsController() {
703 return brmsController;
706 public void setBrmsController(String brmsController) {
707 this.brmsController = brmsController;
710 public List<String> getBrmsDependency() {
711 return brmsDependency;
714 public void setBrmsDependency(List<String> brmsDependency) {
715 this.brmsDependency = brmsDependency;
718 public void setTreatments(Map<String, String> treatments) {
719 this.treatments = treatments;