aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller
diff options
context:
space:
mode:
authorMichael Mokry <mm117s@att.com>2017-12-01 11:39:27 -0600
committerMichael Mokry <mm117s@att.com>2017-12-06 14:14:40 +0000
commit3f1933cfe1f5cdb6d3fefdff9248c9d4430849c2 (patch)
tree006c952c7cf996ce99b6644ee9803f4fb013dd14 /ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller
parente1f1fc2f1c5cc5d0265e284e565c44676c6a32fc (diff)
Modified the code to fix various pushPolicy issuesv1.1.2
- Added modifications per Pam's review Change-Id: I5d67ee529cbc5245e7d1f8dbec6f2f2d453ce299 Issue-ID: POLICY-486 Signed-off-by: Michael Mokry <mm117s@att.com> (cherry picked from commit b6bae924c4a794cd772ac1524089fc8739e310b1)
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/policycontroller')
-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";