From: sblimkie Date: Tue, 23 Jan 2018 14:56:05 +0000 (-0500) Subject: Fix issue patching edges X-Git-Tag: 2.0.0-ONAP~34 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fgizmo.git;a=commitdiff_plain;h=d8b5c7ec53e0ae80c7aecd4c33e0c63e172b2544 Fix issue patching edges Fix an issue where edge patch fails Change-Id: Ia6987b5ced127bb2d475c3c13dcf9dabf2242ff0 Issue-ID: AAI-685 Signed-off-by: sblimkie --- diff --git a/src/main/java/org/onap/schema/RelationshipSchemaValidator.java b/src/main/java/org/onap/schema/RelationshipSchemaValidator.java index 53048be..73e8445 100644 --- a/src/main/java/org/onap/schema/RelationshipSchemaValidator.java +++ b/src/main/java/org/onap/schema/RelationshipSchemaValidator.java @@ -31,6 +31,7 @@ import org.onap.crud.entity.Vertex; import org.onap.crud.exception.CrudException; import org.onap.crud.service.EdgePayload; import org.onap.crud.util.CrudServiceUtil; +import org.onap.schema.OxmModelValidator.Metadata; import org.radeox.util.logging.Logger; import java.util.HashMap; @@ -179,6 +180,17 @@ public class RelationshipSchemaValidator { throw new CrudException("Target can't be updated", Status.BAD_REQUEST); } } + + // Remove the timestamp properties from the existing edge, as these should be managed by Champ. + Map existingProps = edge.getProperties(); + + if (existingProps.containsKey(Metadata.CREATED_TS.propertyName())) { + existingProps.remove(Metadata.CREATED_TS.propertyName()); + } + if (existingProps.containsKey(Metadata.UPDATED_TS.propertyName())) { + existingProps.remove(Metadata.UPDATED_TS.propertyName()); + } + // create key based on source:target:relationshipType String key = edge.getSource().getType() + ":" + edge.getTarget().getType()