diff options
author | 2019-01-30 14:04:35 +0000 | |
---|---|---|
committer | 2019-01-30 15:48:22 +0000 | |
commit | 0c40bcde9facc109ceb8dabb91156df2b4fb4129 (patch) | |
tree | af3b32aa18092c7ea6bb60005a6d503448a92297 /src/main/java/org/onap/crud/service/CrudGraphDataService.java | |
parent | df7904cca9c67ed7ce99e1d1d1c3a2c961a61445 (diff) |
Remove Multiplicity feature
The multiplicty feature is not working properly around relantionships
and demands more investigation in order to identify the issues.
In the future we might add this back.
For reference multiplicity was added under AAI-1197
Basically reversing the commit: d10a218c76633374f083f7a2802c198e93a6abae
Issue-ID: AAI-2124
Change-Id: I5d27b950841da08b00fbb422fb13136d43f0e3bd
Signed-off-by: Sanchez, Gabriel (gs882h) <gabriel.sanchez@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/crud/service/CrudGraphDataService.java')
-rw-r--r-- | src/main/java/org/onap/crud/service/CrudGraphDataService.java | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/main/java/org/onap/crud/service/CrudGraphDataService.java b/src/main/java/org/onap/crud/service/CrudGraphDataService.java index ae2d294..034b0bf 100644 --- a/src/main/java/org/onap/crud/service/CrudGraphDataService.java +++ b/src/main/java/org/onap/crud/service/CrudGraphDataService.java @@ -31,12 +31,9 @@ import org.onap.crud.entity.Edge; import org.onap.crud.entity.Vertex; import org.onap.crud.exception.CrudException; import org.onap.crud.parser.CrudResponseBuilder; -import org.onap.crud.parser.EdgePayload; -import org.onap.crud.parser.VertexPayload; -import org.onap.crud.parser.util.EdgePayloadUtil; import org.onap.crud.util.CrudServiceUtil; -import org.onap.schema.validation.OxmModelValidator; -import org.onap.schema.validation.RelationshipSchemaValidator; +import org.onap.schema.OxmModelValidator; +import org.onap.schema.RelationshipSchemaValidator; public class CrudGraphDataService extends AbstractGraphDataService { @@ -74,16 +71,8 @@ public class CrudGraphDataService extends AbstractGraphDataService { @Override public ImmutablePair<EntityTag, String> addEdge(String version, String type, EdgePayload payload) throws CrudException { - // load source and target vertex relationships for validation - List<Edge> sourceVertexEdges = - EdgePayloadUtil.filterEdgesByRelatedVertexAndType(EdgePayloadUtil.getVertexNodeType(payload.getSource()), type, - daoForGet.getVertexEdges(EdgePayloadUtil.getVertexNodeId(payload.getSource()), null, null)); - - List<Edge> targetVertexEdges = - EdgePayloadUtil.filterEdgesByRelatedVertexAndType(EdgePayloadUtil.getVertexNodeType(payload.getTarget()), type, - daoForGet.getVertexEdges(EdgePayloadUtil.getVertexNodeId(payload.getTarget()), null, null)); - - Edge edge = RelationshipSchemaValidator.validateIncomingAddPayload(version, type, payload, sourceVertexEdges, targetVertexEdges); + + Edge edge = RelationshipSchemaValidator.validateIncomingAddPayload(version, type, payload); return addEdge(version, edge); } @@ -147,19 +136,7 @@ public class CrudGraphDataService extends AbstractGraphDataService { @Override public ImmutablePair<EntityTag, String> updateEdge(String version, String id, String type, EdgePayload payload) throws CrudException { - OperationResult edgeResult = dao.getEdge(id, type, new HashMap<String, String>()); - Edge edge = Edge.fromJson(edgeResult.getResult()); - - // load source and target vertex relationships for validation - List<Edge> sourceVertexEdges = - EdgePayloadUtil.filterEdgesByRelatedVertexAndType(EdgePayloadUtil.getVertexNodeType(payload.getSource()), type, - daoForGet.getVertexEdges(EdgePayloadUtil.getVertexNodeId(payload.getSource()), null, null)); - - List<Edge> targetVertexEdges = - EdgePayloadUtil.filterEdgesByRelatedVertexAndType(EdgePayloadUtil.getVertexNodeType(payload.getTarget()), type, - daoForGet.getVertexEdges(EdgePayloadUtil.getVertexNodeId(payload.getTarget()), null, null)); - - Edge validatedEdge = RelationshipSchemaValidator.validateIncomingUpdatePayload(edge, version, payload, type, sourceVertexEdges, targetVertexEdges); + Edge validatedEdge = getValidatedEdge(version, id, type, payload); return updateEdge(version, validatedEdge); } @@ -179,6 +156,11 @@ public class CrudGraphDataService extends AbstractGraphDataService { .buildUpsertEdgeResponse(RelationshipSchemaValidator.validateOutgoingPayload(version, updatedEdge), version); } + private Edge getValidatedEdge(String version, String id, String type, EdgePayload payload) throws CrudException { + OperationResult operationResult = dao.getEdge(id, type, new HashMap<String, String>()); + return RelationshipSchemaValidator.validateIncomingUpdatePayload(Edge.fromJson(operationResult.getResult()), version, payload); + } + @Override public ImmutablePair<EntityTag, String> patchEdge(String version, String id, String type, EdgePayload payload) throws CrudException { |