Fix issue patching edges 31/28931/1
authorsblimkie <steven.blimkie@amdocs.com>
Tue, 23 Jan 2018 14:56:05 +0000 (09:56 -0500)
committersblimkie <steven.blimkie@amdocs.com>
Tue, 23 Jan 2018 14:57:42 +0000 (09:57 -0500)
Fix an issue where edge patch fails

Change-Id: Ia6987b5ced127bb2d475c3c13dcf9dabf2242ff0
Issue-ID: AAI-685
Signed-off-by: sblimkie <steven.blimkie@amdocs.com>
src/main/java/org/onap/schema/RelationshipSchemaValidator.java

index 53048be..73e8445 100644 (file)
@@ -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<String,Object> 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()