2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.rest.adapter;
23 import java.util.LinkedHashMap;
24 import java.util.List;
26 import javax.persistence.EntityManagerFactory;
27 import org.onap.policy.rest.jpa.OnapName;
29 public class PolicyRestAdapter {
33 * Note : Make Sure if any variables are added in PolicyRestAdapter.java, add them to PolicyElasticData.java file
40 private String policyName = null;
41 private String configBodyData = null;
42 private String configType = null;
43 private String policyID = null;
44 private String policyType = null;
45 private String comboPolicyType;
46 private String configPolicyType = null;
47 private String policyDescription = null;
48 private String onapName = null;
49 private String configName = null;
50 private String ruleID = null;
51 private String parentPath;
52 private boolean isValidData = false;
53 private String adminNotification = null;
54 private boolean isEditPolicy = false;
55 private boolean isViewPolicy = false;
56 private boolean isDraft = false;
57 private Object policyData = null;
58 private String gitPath;
59 private boolean readOnly;
60 private String configHome;
61 private String configUrl;
62 private String finalPolicyPath;
63 private String version;
64 private String jsonBody;
65 private String uiJsonBody;
66 private String apiflag;
67 private String prevJsonBody;
68 private Integer highestVersion;
69 private EntityManagerFactory entityManagerFactory = null;
70 private Boolean policyExists = false;
71 private String oldPolicyFileName = null;
72 private String domain = null;
73 private String userId;
74 private String newFileName;
75 private String clWarning = null;
76 private String newCLName = null;
77 private String existingCLName = null;
79 private OnapName onapNameField;
80 private Object jsonBodyData;
81 private String dirPath;
82 private String configBodyPath;
83 private List<Object> attributes;
84 private List<Object> settings;
85 private List<Object> ruleAlgorithmschoices;
87 private Map<?, ?> serviceTypePolicyName;
89 private Map<?, ?> verticaMetrics;
90 private Map<?, ?> description;
91 private Map<?, ?> attributeFields;
94 private String clearTimeOut;
95 private String trapMaxAge;
96 private String verificationclearTimeOut;
97 private Map<String, String> dynamicLayoutMap;
98 private ClosedLoopFaultTrapDatas trapDatas;
99 private ClosedLoopFaultTrapDatas faultDatas;
102 private String fwPolicyType;
103 private List<Object> fwattributes;
104 private String parentForChild;
105 private String securityZone;
108 private String ruleCombiningAlgId = null;
109 private Map<String, String> dynamicFieldConfigAttributes;
110 private Map<String, String> dynamicSettingsMap;
111 private Map<String, String> dropDownMap;
112 private String actionPerformer = null;
113 private String actionAttribute = null;
114 private List<String> dynamicRuleAlgorithmLabels;
115 private List<String> dynamicRuleAlgorithmCombo;
116 private List<String> dynamicRuleAlgorithmField1;
117 private List<String> dynamicRuleAlgorithmField2;
118 private List<Object> dynamicVariableList;
119 private List<String> dataTypeList;
120 private String actionAttributeValue;
121 private String ruleProvider;
122 private String actionBody = null;
123 private String actionDictHeader = null;
124 private String actionDictType = null;
125 private String actionDictUrl = null;
126 private String actionDictMethod = null;
127 private YAMLParams yamlparams;
128 private List<String> blackListEntries;
129 private List<String> appendBlackListEntries;
130 private String blackListEntryType;
131 private String rawXacmlPolicy;
133 // Rainy Day Decision
134 private RainyDayParams rainyday;
135 private Map<String, String> rainydayMap;
136 private List<String> errorCodeList;
137 private List<String> treatmentList;
140 private String serviceType = null;
141 private String uuid = null;
142 private String location = null;
143 private String priority = null;
144 private String msLocation = null;
145 private Object policyJSON = null;
148 private String ruleName;
149 private Map<String, String> brmsParamBody = null;
150 private String brmsController = null;
151 private List<String> brmsDependency = null;
152 private LinkedHashMap<?, ?> ruleData;
153 private LinkedHashMap<?, ?> ruleListData;
154 private Map<String, String> drlRuleAndUIParams = null;
157 private String policyScope;
158 private String providerComboBox = null;
159 private String riskType;
160 private String riskLevel;
161 private String guard = null;
162 private String ttlDate;
163 private Map<String, String> matching;
165 private List<Object> triggerSignatures;
166 private List<Object> symptomSignatures;
167 private String logicalConnector;
168 private String policyStatus;
169 private String gocServerScope;
170 private String supressionType;
172 public List<Object> getTriggerSignatures() {
173 return triggerSignatures;
176 public void setTriggerSignatures(List<Object> triggerSignatures) {
177 this.triggerSignatures = triggerSignatures;
180 public List<Object> getSymptomSignatures() {
181 return symptomSignatures;
184 public void setSymptomSignatures(List<Object> symptomSignatures) {
185 this.symptomSignatures = symptomSignatures;
188 public String getLogicalConnector() {
189 return logicalConnector;
192 public void setLogicalConnector(String logicalConnector) {
193 this.logicalConnector = logicalConnector;
196 public String getPolicyStatus() {
200 public void setPolicyStatus(String policyStatus) {
201 this.policyStatus = policyStatus;
204 public String getGocServerScope() {
205 return gocServerScope;
208 public void setGocServerScope(String gocServerScope) {
209 this.gocServerScope = gocServerScope;
212 public String getSupressionType() {
213 return supressionType;
216 public void setSupressionType(String supressionType) {
217 this.supressionType = supressionType;
220 /********************************************************************************/
222 public String getComboPolicyType() {
223 return comboPolicyType;
226 public void setComboPolicyType(String comboPolicyType) {
227 this.comboPolicyType = comboPolicyType;
230 public String getGitPath() {
234 public void setGitPath(String gitPath) {
235 this.gitPath = gitPath;
238 public String getOldPolicyFileName() {
239 return oldPolicyFileName;
242 public void setOldPolicyFileName(String oldPolicyFileName) {
243 this.oldPolicyFileName = oldPolicyFileName;
246 public String getDomainDir() {
250 public void setDomainDir(String domain) {
251 this.domain = domain;
254 public Integer getHighestVersion() {
255 return highestVersion;
258 public void setHighestVersion(Integer highestVersion) {
259 this.highestVersion = highestVersion;
262 public Object getData() {
266 public void setData(Object data) {
270 public String getPolicyName() {
274 public void setPolicyName(String policyName) {
275 this.policyName = policyName;
278 public String getConfigBodyData() {
279 return configBodyData;
282 public void setConfigBodyData(String configBodyData) {
283 this.configBodyData = configBodyData;
286 public String getConfigType() {
290 public void setConfigType(String configType) {
291 this.configType = configType;
294 public String getPolicyID() {
298 public void setPolicyID(String policyID) {
299 this.policyID = policyID;
302 public String getPolicyType() {
306 public void setPolicyType(String policyType) {
307 this.policyType = policyType;
310 public String getPolicyDescription() {
311 return policyDescription;
314 public void setPolicyDescription(String policyDescription) {
315 this.policyDescription = policyDescription;
318 public String getOnapName() {
322 public void setOnapName(String onapName) {
323 this.onapName = onapName;
326 public String getConfigName() {
330 public void setConfigName(String configName) {
331 this.configName = configName;
334 public String getRuleID() {
338 public void setRuleID(String ruleID) {
339 this.ruleID = ruleID;
342 public String getRuleCombiningAlgId() {
343 return ruleCombiningAlgId;
346 public void setRuleCombiningAlgId(String ruleCombiningAlgId) {
347 this.ruleCombiningAlgId = ruleCombiningAlgId;
350 public Map<String, String> getDynamicFieldConfigAttributes() {
351 return dynamicFieldConfigAttributes;
354 public void setDynamicFieldConfigAttributes(Map<String, String> dynamicFieldConfigAttributes) {
355 this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
358 public String getParentPath() {
362 public void setParentPath(String parentPath) {
363 this.parentPath = parentPath;
366 public boolean isEditPolicy() {
370 public void setEditPolicy(boolean isEditPolicy) {
371 this.isEditPolicy = isEditPolicy;
374 public boolean isViewPolicy() {
378 public void setViewPolicy(boolean isViewPolicy) {
379 this.isViewPolicy = isViewPolicy;
382 public Object getPolicyData() {
386 public void setPolicyData(Object policyData) {
387 this.policyData = policyData;
390 public boolean isReadOnly() {
394 public void setReadOnly(boolean readOnly) {
395 this.readOnly = readOnly;
398 public boolean isValidData() {
402 public void setValidData(boolean isValidData) {
403 this.isValidData = isValidData;
406 public String getAdminNotification() {
407 return adminNotification;
410 public void setAdminNotification(String adminNotification) {
411 this.adminNotification = adminNotification;
414 public String getConfigHome() {
418 public void setConfigHome(String configHome) {
419 this.configHome = configHome;
422 public String getConfigUrl() {
426 public void setConfigUrl(String configUrl) {
427 this.configUrl = configUrl;
430 public String getFinalPolicyPath() {
431 return finalPolicyPath;
434 public void setFinalPolicyPath(String finalPolicyPath) {
435 this.finalPolicyPath = finalPolicyPath;
438 public String getVersion() {
442 public void setVersion(String version) {
443 this.version = version;
446 public String getJsonBody() {
450 public void setJsonBody(String jsonBody) {
451 this.jsonBody = jsonBody;
454 public String getPrevJsonBody() {
458 public void setPrevJsonBody(String prevJsonBody) {
459 this.prevJsonBody = prevJsonBody;
462 public String getApiflag() {
466 public void setApiflag(String apiflag) {
467 this.apiflag = apiflag;
471 * @return the actionPerformer
473 public String getActionPerformer() {
474 return actionPerformer;
478 * @param actionPerformer the actionPerformer to set
480 public void setActionPerformer(String actionPerformer) {
481 this.actionPerformer = actionPerformer;
485 * @return the actionAttribute
487 public String getActionAttribute() {
488 return actionAttribute;
492 * @param actionAttribute the actionAttribute to set
494 public void setActionAttribute(String actionAttribute) {
495 this.actionAttribute = actionAttribute;
499 * @return the dynamicRuleAlgorithmLabels
501 public List<String> getDynamicRuleAlgorithmLabels() {
502 return dynamicRuleAlgorithmLabels;
506 * @param dynamicRuleAlgorithmLabels the dynamicRuleAlgorithmLabels to set
508 public void setDynamicRuleAlgorithmLabels(List<String> dynamicRuleAlgorithmLabels) {
509 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
513 * @return the dynamicRuleAlgorithmCombo
515 public List<String> getDynamicRuleAlgorithmCombo() {
516 return dynamicRuleAlgorithmCombo;
520 * @param dynamicRuleAlgorithmCombo the dynamicRuleAlgorithmCombo to set
522 public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
523 this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
527 * @return the dynamicRuleAlgorithmField1
529 public List<String> getDynamicRuleAlgorithmField1() {
530 return dynamicRuleAlgorithmField1;
534 * @param dynamicRuleAlgorithmField1 the dynamicRuleAlgorithmField1 to set
536 public void setDynamicRuleAlgorithmField1(List<String> dynamicRuleAlgorithmField1) {
537 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
541 * @return the dynamicRuleAlgorithmField2
543 public List<String> getDynamicRuleAlgorithmField2() {
544 return dynamicRuleAlgorithmField2;
548 * @param dynamicRuleAlgorithmField2 the dynamicRuleAlgorithmField2 to set
550 public void setDynamicRuleAlgorithmField2(List<String> dynamicRuleAlgorithmField2) {
551 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
554 public Map<String, String> getDropDownMap() {
558 public void setDropDownMap(Map<String, String> dropDownMap) {
559 this.dropDownMap = dropDownMap;
562 public Map<String, String> getDynamicSettingsMap() {
563 return dynamicSettingsMap;
566 public void setDynamicSettingsMap(Map<String, String> dynamicSettingsMap) {
567 this.dynamicSettingsMap = dynamicSettingsMap;
570 public List<Object> getDynamicVariableList() {
571 return dynamicVariableList;
574 public void setDynamicVariableList(List<Object> dynamicVariableList) {
575 this.dynamicVariableList = dynamicVariableList;
578 public List<String> getDataTypeList() {
582 public void setDataTypeList(List<String> dataTypeList) {
583 this.dataTypeList = dataTypeList;
586 public boolean isDraft() {
590 public void setDraft(boolean isDraft) {
591 this.isDraft = isDraft;
594 public String getConfigPolicyType() {
595 return configPolicyType;
598 public void setConfigPolicyType(String configPolicyType) {
599 this.configPolicyType = configPolicyType;
602 public String getServiceType() {
606 public void setServiceType(String serviceType) {
607 this.serviceType = serviceType;
610 public String getUuid() {
614 public void setUuid(String uuid) {
618 public String getLocation() {
622 public void setLocation(String location) {
623 this.location = location;
626 public String getPriority() {
630 public void setPriority(String priority) {
631 this.priority = priority;
634 public Map<String, String> getBrmsParamBody() {
635 return brmsParamBody;
638 public void setBrmsParamBody(Map<String, String> brmsParamBody) {
639 this.brmsParamBody = brmsParamBody;
642 public EntityManagerFactory getEntityManagerFactory() {
643 return entityManagerFactory;
646 public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
647 this.entityManagerFactory = entityManagerFactory;
651 * @return the policyExists
653 public Boolean getPolicyExists() {
658 * @param policyExists the policyExists to set
660 public void setPolicyExists(Boolean policyExists) {
661 this.policyExists = policyExists;
664 public String getPolicyScope() {
668 public void setPolicyScope(String domainDir) {
669 this.policyScope = domainDir;
672 public String getProviderComboBox() {
673 return providerComboBox;
676 public void setProviderComboBox(String providerComboBox) {
677 this.providerComboBox = providerComboBox;
680 public String getRiskType() {
684 public void setRiskType(String riskType) {
685 this.riskType = riskType;
688 public String getGuard() {
692 public void setGuard(String guard) {
696 public String getRiskLevel() {
700 public void setRiskLevel(String riskLevel) {
701 this.riskLevel = riskLevel;
704 public String getTtlDate() {
708 public void setTtlDate(String ttlDate) {
709 this.ttlDate = ttlDate;
712 public String getBrmsController() {
713 return brmsController;
716 public void setBrmsController(String brmsController) {
717 this.brmsController = brmsController;
720 public List<String> getBrmsDependency() {
721 return brmsDependency;
724 public void setBrmsDependency(List<String> brmsDependency) {
725 this.brmsDependency = brmsDependency;
728 public Map<String, String> getMatching() {
732 public void setMatching(Map<String, String> matching) {
733 this.matching = matching;
736 public String getUserId() {
740 public void setUserId(String userId) {
741 this.userId = userId;
744 public String getNewFileName() {
748 public void setNewFileName(String newFileName) {
749 this.newFileName = newFileName;
752 public OnapName getOnapNameField() {
753 return onapNameField;
756 public void setOnapNameField(OnapName onapNameField) {
757 this.onapNameField = onapNameField;
760 public Object getJsonBodyData() {
764 public void setJsonBodyData(Object jsonBodyData) {
765 this.jsonBodyData = jsonBodyData;
768 public String getDirPath() {
772 public void setDirPath(String dirPath) {
773 this.dirPath = dirPath;
776 public String getConfigBodyPath() {
777 return configBodyPath;
780 public void setConfigBodyPath(String configBodyPath) {
781 this.configBodyPath = configBodyPath;
784 public List<Object> getAttributes() {
788 public void setAttributes(List<Object> attributes) {
789 this.attributes = attributes;
792 public List<Object> getSettings() {
796 public void setSettings(List<Object> settings) {
797 this.settings = settings;
800 public List<Object> getRuleAlgorithmschoices() {
801 return ruleAlgorithmschoices;
804 public void setRuleAlgorithmschoices(List<Object> ruleAlgorithmschoices) {
805 this.ruleAlgorithmschoices = ruleAlgorithmschoices;
808 public Map<?, ?> getServiceTypePolicyName() {
809 return serviceTypePolicyName;
812 public void setServiceTypePolicyName(Map<?, ?> serviceTypePolicyName) {
813 this.serviceTypePolicyName = serviceTypePolicyName;
816 public Map<?, ?> getVerticaMetrics() {
817 return verticaMetrics;
820 public void setVerticaMetrics(Map<?, ?> verticaMetrics) {
821 this.verticaMetrics = verticaMetrics;
824 public Map<?, ?> getDescription() {
828 public void setDescription(LinkedHashMap<?, ?> description) {
829 this.description = description;
832 public Map<?, ?> getAttributeFields() {
833 return attributeFields;
836 public void setAttributeFields(LinkedHashMap<?, ?> attributeFields) {
837 this.attributeFields = attributeFields;
840 public String getClearTimeOut() {
844 public void setClearTimeOut(String clearTimeOut) {
845 this.clearTimeOut = clearTimeOut;
848 public String getTrapMaxAge() {
852 public void setTrapMaxAge(String trapMaxAge) {
853 this.trapMaxAge = trapMaxAge;
856 public String getVerificationclearTimeOut() {
857 return verificationclearTimeOut;
860 public void setVerificationclearTimeOut(String verificationclearTimeOut) {
861 this.verificationclearTimeOut = verificationclearTimeOut;
864 public Map<String, String> getDynamicLayoutMap() {
865 return dynamicLayoutMap;
868 public void setDynamicLayoutMap(Map<String, String> dynamicLayoutMap) {
869 this.dynamicLayoutMap = dynamicLayoutMap;
872 public String getFwPolicyType() {
876 public void setFwPolicyType(String fwPolicyType) {
877 this.fwPolicyType = fwPolicyType;
880 public List<Object> getFwattributes() {
884 public void setFwattributes(List<Object> fwattributes) {
885 this.fwattributes = fwattributes;
888 public String getParentForChild() {
889 return parentForChild;
892 public void setParentForChild(String parentForChild) {
893 this.parentForChild = parentForChild;
896 public String getRuleName() {
900 public void setRuleName(String ruleName) {
901 this.ruleName = ruleName;
904 public LinkedHashMap<?, ?> getRuleData() {
908 public void setRuleData(LinkedHashMap<?, ?> ruleData) {
909 this.ruleData = ruleData;
912 public LinkedHashMap<?, ?> getRuleListData() {
916 public void setRuleListData(LinkedHashMap<?, ?> ruleListData) {
917 this.ruleListData = ruleListData;
920 public String getSecurityZone() {
924 public void setSecurityZone(String securityZone) {
925 this.securityZone = securityZone;
928 public String getActionAttributeValue() {
929 return actionAttributeValue;
932 public void setActionAttributeValue(String actionAttributeValue) {
933 this.actionAttributeValue = actionAttributeValue;
936 public String getRuleProvider() {
940 public void setRuleProvider(String ruleProvider) {
941 this.ruleProvider = ruleProvider;
944 public String getMsLocation() {
948 public void setMsLocation(String msLocation) {
949 this.msLocation = msLocation;
952 public Map<String, String> getDrlRuleAndUIParams() {
953 return drlRuleAndUIParams;
956 public void setDrlRuleAndUIParams(Map<String, String> drlRuleAndUIParams) {
957 this.drlRuleAndUIParams = drlRuleAndUIParams;
960 public String getActionBody() {
964 public void setActionBody(String actionBody) {
965 this.actionBody = actionBody;
968 public String getActionDictHeader() {
969 return actionDictHeader;
972 public void setActionDictHeader(String actionDictHeader) {
973 this.actionDictHeader = actionDictHeader;
976 public String getActionDictType() {
977 return actionDictType;
980 public void setActionDictType(String actionDictType) {
981 this.actionDictType = actionDictType;
984 public String getActionDictUrl() {
985 return actionDictUrl;
988 public void setActionDictUrl(String actionDictUrl) {
989 this.actionDictUrl = actionDictUrl;
992 public String getActionDictMethod() {
993 return actionDictMethod;
996 public void setActionDictMethod(String actionDictMethod) {
997 this.actionDictMethod = actionDictMethod;
1000 public String getClWarning() {
1004 public void setClWarning(String clWarning) {
1005 this.clWarning = clWarning;
1008 public String getNewCLName() {
1012 public void setNewCLName(String newCLName) {
1013 this.newCLName = newCLName;
1016 public String getExistingCLName() {
1017 return existingCLName;
1020 public void setExistingCLName(String existingCLName) {
1021 this.existingCLName = existingCLName;
1024 public YAMLParams getYamlparams() {
1028 public void setYamlparams(YAMLParams yamlparams) {
1029 this.yamlparams = yamlparams;
1033 * @return the rainyday
1035 public RainyDayParams getRainyday() {
1040 * @param rainyday the rainyday to set
1042 public void setRainyday(RainyDayParams rainyday) {
1043 this.rainyday = rainyday;
1047 * @return the errorCodeList
1049 public List<String> getErrorCodeList() {
1050 return errorCodeList;
1054 * @param errorCodeList the errorCodeList to set
1056 public void setErrorCodeList(List<String> errorCodeList) {
1057 this.errorCodeList = errorCodeList;
1061 * @return the treatmentList
1063 public List<String> getTreatmentList() {
1064 return treatmentList;
1068 * @param treatmentList the treatmentList to set
1070 public void setTreatmentList(List<String> treatmentList) {
1071 this.treatmentList = treatmentList;
1075 * @return the rainydayMap
1077 public Map<String, String> getRainydayMap() {
1082 * @param rainydayMap the rainydayMap to set
1084 public void setRainydayMap(Map<String, String> rainydayMap) {
1085 this.rainydayMap = rainydayMap;
1089 * @return the policyJSON
1091 public Object getPolicyJSON() {
1096 * @param policyJSON the policyJSON to set
1098 public void setPolicyJSON(Object policyJSON) {
1099 this.policyJSON = policyJSON;
1102 public ClosedLoopFaultTrapDatas getTrapDatas() {
1106 public void setTrapDatas(ClosedLoopFaultTrapDatas trapDatas) {
1107 this.trapDatas = trapDatas;
1110 public ClosedLoopFaultTrapDatas getFaultDatas() {
1114 public void setFaultDatas(ClosedLoopFaultTrapDatas faultDatas) {
1115 this.faultDatas = faultDatas;
1118 public List<String> getAppendBlackListEntries() {
1119 return appendBlackListEntries;
1122 public void setAppendBlackListEntries(List<String> appendBlackListEntries) {
1123 this.appendBlackListEntries = appendBlackListEntries;
1126 public List<String> getBlackListEntries() {
1127 return blackListEntries;
1130 public void setBlackListEntries(List<String> blackListEntries) {
1131 this.blackListEntries = blackListEntries;
1134 public String getBlackListEntryType() {
1135 return blackListEntryType;
1138 public void setBlackListEntryType(String blackListEntryType) {
1139 this.blackListEntryType = blackListEntryType;
1142 public String getRawXacmlPolicy() {
1143 return rawXacmlPolicy;
1146 public void setRawXacmlPolicy(String rawXacmlPolicy) {
1147 this.rawXacmlPolicy = rawXacmlPolicy;
1150 public String getUiJsonBody() {
1154 public void setUiJsonBody(String uiJsonBody) {
1155 this.uiJsonBody = uiJsonBody;