From d8b5c7ec53e0ae80c7aecd4c33e0c63e172b2544 Mon Sep 17 00:00:00 2001 From: sblimkie Date: Tue, 23 Jan 2018 09:56:05 -0500 Subject: [PATCH] Fix issue patching edges Fix an issue where edge patch fails Change-Id: Ia6987b5ced127bb2d475c3c13dcf9dabf2242ff0 Issue-ID: AAI-685 Signed-off-by: sblimkie --- .../java/org/onap/schema/RelationshipSchemaValidator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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() -- 2.16.6