X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fcrud%2Fservice%2FCrudRestService.java;h=3cfc65769d01e69e1f6477357ccc8a63ce229581;hb=3bc6a702f2d3d8710c7aaa94cdc8c0ccf3deb759;hp=35614cf2373993f3ab857f40c4f77ef095fdd2a6;hpb=bd2f6f01d9f8fe376dd5689f68305e40785ce94c;p=aai%2Fgizmo.git diff --git a/src/main/java/org/onap/crud/service/CrudRestService.java b/src/main/java/org/onap/crud/service/CrudRestService.java index 35614cf..3cfc657 100644 --- a/src/main/java/org/onap/crud/service/CrudRestService.java +++ b/src/main/java/org/onap/crud/service/CrudRestService.java @@ -53,6 +53,9 @@ import org.onap.aaiauth.auth.Auth; import org.onap.crud.exception.CrudException; import org.onap.crud.logging.CrudServiceMsgs; import org.onap.crud.logging.LoggingUtil; +import org.onap.crud.parser.BulkPayload; +import org.onap.crud.parser.EdgePayload; +import org.onap.crud.parser.VertexPayload; import org.onap.crud.util.CrudProperties; import org.onap.crud.util.CrudServiceConstants; import org.onap.crud.util.CrudServiceUtil; @@ -501,10 +504,6 @@ public class CrudRestService { EdgePayload edgePayload = EdgePayload.fromJson(item.getValue().getAsJsonObject().toString()); - if (edgePayload.getType() == null) { - throw new CrudException("Edge Type cannot be null for: " + item.getKey(), Status.BAD_REQUEST); - } - if (!opr.getKey().equalsIgnoreCase("operation")) { throw new CrudException("operation missing in item: " + item.getKey(), Status.BAD_REQUEST); } @@ -694,8 +693,9 @@ public class CrudRestService { } if (payload.getType() == null || payload.getType().isEmpty()) { - throw new CrudException("Missing Edge Type ", Status.BAD_REQUEST); + payload.setType(CrudServiceUtil.determineEdgeType(payload, version)); } + ImmutablePair result = graphDataService.addEdge(version, payload.getType(), payload); response = Response.status(Status.CREATED).entity(result.getValue()).tag(result.getKey()).type(mediaType).build(); } else {