[Policy-52, Policy-92, Policy-93] Policy Enhancements and bugfixes
[policy/engine.git] / ECOMP-PAP-REST / src / main / java / org / openecomp / policy / pap / xacml / rest / policycontroller / PolicyCreation.java
index 0d84519..e6f322a 100644 (file)
@@ -379,14 +379,20 @@ public class PolicyCreation extends AbstractPolicyCreation{
                                                        && policyData.getYamlparams()!=null){
                                                attributeMap.put("actor", policyData.getYamlparams().getActor());
                                                attributeMap.put("recipe", policyData.getYamlparams().getRecipe());
+                                               attributeMap.put("clname", policyData.getYamlparams().getClname());
                                                attributeMap.put("limit", policyData.getYamlparams().getLimit());
                                                attributeMap.put("timeWindow", policyData.getYamlparams().getTimeWindow());
+                                               attributeMap.put("timeUnits", policyData.getYamlparams().getTimeUnits());
                                                attributeMap.put("guardActiveStart", policyData.getYamlparams().getGuardActiveStart());
                                                attributeMap.put("guardActiveEnd", policyData.getYamlparams().getGuardActiveEnd());
                                                if(policyData.getYamlparams().getBlackList()!=null){
                                                        String blackList = StringUtils.join(policyData.getYamlparams().getBlackList(), ",");
                                                        attributeMap.put("blackList", blackList);
                                                }
+                                               if(policyData.getYamlparams().getTargets()!=null){
+                                                       String targets = StringUtils.join(policyData.getYamlparams().getTargets(),",");
+                                                       attributeMap.put("targets", targets);
+                                               }
                                        }
                                        if(policyData.getRuleProvider()!=null && policyData.getRuleProvider().equals(DecisionPolicy.RAINY_DAY)){
                                                attributeMap.put("ServiceType", policyData.getRainyday().getServiceType());
@@ -513,8 +519,11 @@ public class PolicyCreation extends AbstractPolicyCreation{
                }
                catch (Exception e){
                        LOGGER.error("Exception Occured : "+e);
+                       body = "error";
+                       response.addHeader("error", e.getMessage());    
+                       response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                }
-               return new ResponseEntity<String>(body, status);
+               return new ResponseEntity<>(body, status);
        }
 
        @ExceptionHandler({ HttpMessageNotReadableException.class })