aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
index 64324d432..2af8a6ee1 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller/PolicyCreation.java
@@ -193,6 +193,15 @@ public class PolicyCreation extends AbstractPolicyCreation{
return new ResponseEntity<String>(body, status);
}
}else{
+ // if policy does not exist and the request is updatePolicy return error
+ if(policyData.isEditPolicy()){
+ body = "policyNotAvailableForEdit";
+ status = HttpStatus.NOT_FOUND;
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ response.addHeader("error", body);
+ response.addHeader("message", policyData.getPolicyName() + " does not exist on the PAP and cannot be updated.");
+ return new ResponseEntity<String>(body, status);
+ }
version = 1;
if(userId == null){
createdBy = "API";