aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java5
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java6
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java6
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java2
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java12
5 files changed, 26 insertions, 5 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java
index d870ca86c..22d2da311 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java
@@ -230,7 +230,8 @@ public class DecisionPolicy extends Policy {
decisionPolicy.setTarget(target);
Map<String, String> dynamicFieldDecisionSettings = policyAdapter.getDynamicSettingsMap();
- if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals(AAFPROVIDER)){
+ if(policyAdapter.getRuleProvider()!=null && (policyAdapter.getRuleProvider().equals(AAFPROVIDER)||
+ policyAdapter.getRuleProvider().equals(RAINY_DAY))){
dynamicFieldDecisionSettings = new HashMap<>();
}
@@ -242,8 +243,8 @@ public class DecisionPolicy extends Policy {
VariableDefinitionType dynamicVariable = createDynamicVariable(key, value, dataType);
decisionPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(dynamicVariable);
}
- Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap();
+ Map<String, String> dynamicFieldTreatmentAttributes = policyAdapter.getRainydayMap();
if(policyAdapter.getRuleProvider().equals(RAINY_DAY)){
for(String keyField : dynamicFieldTreatmentAttributes.keySet()) {
String errorcode = keyField;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
index aac777a67..ab077b9ca 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DecisionPolicyDictionaryController.java
@@ -264,7 +264,7 @@ public class DecisionPolicyDictionaryController {
@RequestMapping(value={"/get_RainyDayDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getRainyDayDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
+ public void getRainyDayDictionaryEntityData(HttpServletResponse response){
try{
Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
@@ -329,8 +329,8 @@ public class DecisionPolicyDictionaryController {
counter ++;
}
}
+ decisionRainyDay.setTreatments(userValue);
}
- decisionRainyDay.setTreatments(userValue);
if(decisionRainyDay.getId() == 0){
List<Object> duplicateData = commonClassDao.checkDuplicateEntry(decisionRainyDay.getBbid()+":"+decisionRainyDay.getWorkstep(), "bbid:workstep", RainyDayTreatments.class);
@@ -416,7 +416,7 @@ public class DecisionPolicyDictionaryController {
}
class TreatmentValues {
- private ArrayList<Object> userDataTypeValues;
+ private ArrayList<Object> userDataTypeValues = new ArrayList<>();
public ArrayList<Object> getUserDataTypeValues() {
return userDataTypeValues;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
index 13eee4a3f..ae749adb5 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
@@ -69,6 +69,9 @@ public class DictionaryHandlerImpl implements DictionaryHandler{
case "Settings":
dictionary.getSettingsDictionary(response);
break;
+ case "RainyDayTreatments":
+ dictionary.getRainyDayDictionary(response);
+ break;
case "DescriptiveScope":
dictionary.getDescriptiveDictionary(response);
break;
@@ -212,6 +215,9 @@ public class DictionaryHandlerImpl implements DictionaryHandler{
case "Settings":
result = dictionary.saveSettingsDictionary(request, response);
break;
+ case "RainyDayTreatments":
+ result = dictionary.saveRainyDayDictionary(request, response);
+ break;
case "DescriptiveScope":
result = dictionary.saveDescriptiveDictionary(request, response);
break;
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
index c86ded43f..e7680c3e2 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/SavePolicyHandler.java
@@ -131,6 +131,8 @@ public class SavePolicyHandler {
policyAdapter.setRuleProvider(policy.getProviderComboBox());
policyAdapter.setDomainDir(policyAdapter.getPolicyScope());
policyAdapter.setDomain(policyAdapter.getPolicyScope());
+ policyAdapter.setRainydayMap(policy.getTreatments());
+
return policyAdapter;
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
index 5b2fc4cd7..6e19b9b1c 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/service/DictionaryService.java
@@ -121,6 +121,13 @@ public class DictionaryService {
return result.getViewName();
}
+ public String saveRainyDayDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
+
+ DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
+ ModelAndView result = dictionary.saveRainyDayDictionary(request, response);
+ return result.getViewName();
+ }
+
public String saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
@@ -343,6 +350,11 @@ public class DictionaryService {
dictionary.getSettingsDictionaryEntityData(response);
}
+ public void getRainyDayDictionary(HttpServletResponse response){
+ DecisionPolicyDictionaryController dictionary = new DecisionPolicyDictionaryController();
+ dictionary.getRainyDayDictionaryEntityData(response);
+ }
+
public void getDescriptiveDictionary(HttpServletResponse response){
DescriptiveDictionaryController dictionary = new DescriptiveDictionaryController();
dictionary.getDescriptiveDictionaryEntityData(response);