summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorShwetank Dave <shwetank.dave@amdocs.com>2017-11-13 10:31:07 -0500
committerShwetank Dave <shwetank.dave@amdocs.com>2017-11-13 10:33:00 -0500
commiteec8ab503c1b61ad51676ac037a5d612cd146d0e (patch)
tree86d7c059a4c095da9bf5d5eb345f251f29e8d66e /src/main
parent676ee77a82fe64d3b2da009fb339e66236821992 (diff)
Adding safegaurd when adding new relationships.
When creating new relationships use POST, if PUT is used, it should return 400 BAD_REQUEST. When deleting relationships, ID should be passed in the URL. IssueID: AAI-463 Change-Id: I6dbe84707d54c509da3a01feb52e1b52f462f9bc Signed-off-by: Shwetank Dave <shwetank.dave@amdocs.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/openecomp/crud/service/CrudRestService.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/org/openecomp/crud/service/CrudRestService.java b/src/main/java/org/openecomp/crud/service/CrudRestService.java
index 09193ad..bef7b04 100644
--- a/src/main/java/org/openecomp/crud/service/CrudRestService.java
+++ b/src/main/java/org/openecomp/crud/service/CrudRestService.java
@@ -222,6 +222,21 @@ public class CrudRestService {
}
@PUT
+ @Path("/relationships/{version}/{type}/")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response updateEdgeWithoutId(String content, @Context HttpHeaders headers, @Context HttpServletRequest req) {
+
+ LoggingUtil.initMdcContext(req, headers);
+
+ logger.debug("Incoming request..." + content);
+ Response response = Response.status (Status.BAD_REQUEST).entity ("Cannot Update Edge Without Specifying Id in URL").build();
+
+ LoggingUtil.logRestRequest(logger, auditLogger, req, response);
+ return response;
+ }
+
+ @PUT
@Path("/relationships/{version}/{type}/{id}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
@@ -622,6 +637,20 @@ public class CrudRestService {
}
@DELETE
+ @Path("/relationships/{version}/{type}/")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response deleteEdgeWithouId(String content, @Context HttpHeaders headers, @Context HttpServletRequest req) {
+
+ LoggingUtil.initMdcContext(req, headers);
+
+ logger.debug("Incoming request..." + content);
+ Response response = Response.status ( Status.BAD_REQUEST ).entity ( "Cannot Delete Edge Without Specifying Id in URL" ).build ();
+ LoggingUtil.logRestRequest(logger, auditLogger, req, response);
+ return response;
+ }
+
+ @DELETE
@Path("/relationships/{version}/{type}/{id}")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})