diff options
author | Gurjeet Bedi <gurjeetb@amdocs.com> | 2018-01-07 21:07:50 -0500 |
---|---|---|
committer | Gurjeet Bedi <gurjeetb@amdocs.com> | 2018-01-07 21:10:18 -0500 |
commit | eabf0a08faa6581c88c2e4ca5be56d4630891046 (patch) | |
tree | f496c735e58fcc249a53eacaccc0456122d03a36 /src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java | |
parent | 5132ce03dac867af84eee209659238118f7ca4bc (diff) |
OXM which tracks provenance
Support for source-of-truth and last-mod-source-of-truth
Issue-ID: AAI-482
Change-Id: Idc7ec47c0561f2dad6f930d0ac0dd3fff9585b4f
Signed-off-by: Gurjeet Bedi <gurjeetb@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java')
-rw-r--r-- | src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java b/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java index 840576e..d825d79 100644 --- a/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java +++ b/src/main/java/org/onap/crud/service/CrudAsyncGraphDataService.java @@ -45,6 +45,7 @@ import org.onap.crud.logging.CrudServiceMsgs; import org.onap.crud.parser.CrudResponseBuilder; import org.onap.crud.util.CrudProperties; import org.onap.crud.util.CrudServiceConstants; +import org.onap.crud.util.CrudServiceUtil; import org.onap.schema.OxmModelValidator; import org.onap.schema.RelationshipSchemaValidator; @@ -63,6 +64,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.annotation.PreDestroy; +import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response.Status; public class CrudAsyncGraphDataService extends AbstractGraphDataService { @@ -372,7 +374,7 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService { } @Override - public String addBulk(String version, BulkPayload payload) throws CrudException { + public String addBulk(String version, BulkPayload payload, HttpHeaders headers) throws CrudException { HashMap<String, Vertex> vertices = new HashMap<String, Vertex>(); HashMap<String, Edge> edges = new HashMap<String, Edge>(); String txId = dao.openTransaction(); @@ -397,13 +399,17 @@ public class CrudAsyncGraphDataService extends AbstractGraphDataService { GraphEvent event; if (opr.getValue().getAsString().equalsIgnoreCase("add")) { + vertexPayload.setProperties(CrudServiceUtil.mergeHeaderInFoToPayload(vertexPayload.getProperties(), + headers, true)); // Publish add-vertex event validatedVertex = OxmModelValidator.validateIncomingUpsertPayload(null, version, vertexPayload.getType(), vertexPayload.getProperties()); event = GraphEvent.builder(GraphEventOperation.CREATE) .vertex(GraphEventVertex.fromVertex(validatedVertex, version)).build(); } else { - // Publish update-vertex event + vertexPayload.setProperties(CrudServiceUtil.mergeHeaderInFoToPayload(vertexPayload.getProperties(), + headers, false)); + // Publish update-vertex event validatedVertex = OxmModelValidator.validateIncomingUpsertPayload(vertexPayload.getId(), version, vertexPayload.getType(), vertexPayload.getProperties()); event = GraphEvent.builder(GraphEventOperation.UPDATE) |