diff options
author | Benjamin, Max <max.benjamin@att.com> | 2019-08-06 15:54:51 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-08-06 15:54:52 -0400 |
commit | 8c3e457e0465a3e65f5e4646e3ee0ea2b9aa0e72 (patch) | |
tree | 47dfa73f94c93cc6eb709d4bddcaad15a9d05ba0 /common/src/main/java | |
parent | 8cfa1b81d64c69c4a78dc5ac2b205418dabcbe91 (diff) |
updated delete payloads for bulk deletes
updated delete payloads for bulk deletes
moved test-request.json to the correct location
Issue-ID: SO-2203
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I8d9d4d0bbe45f32d4e07a1ba0128e627d3b27795
Diffstat (limited to 'common/src/main/java')
4 files changed, 29 insertions, 11 deletions
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java index 1370bb3fa3..3f9715bdef 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java @@ -116,17 +116,23 @@ public class AAISingleTransactionClient } @Override - public void put(String uri, Object body) { + protected void put(String uri, Object body) { request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body)); } @Override - public void delete(String uri, Object body) { - request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(body)); + protected void delete(String uri) { + request.getOperations() + .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object())); } @Override - public void patch(String uri, Object body) { + protected void delete(String uri, Object obj) { + request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj)); + } + + @Override + protected void patch(String uri, Object body) { request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body)); } diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java index 11e458a3da..e621566e5a 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java @@ -169,18 +169,22 @@ public class AAITransactionalClient } @Override - public void put(String uri, Object body) { + protected void put(String uri, Object body) { currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body)); } @Override - public void delete(String uri, Object body) { - currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(body)); + protected void delete(String uri) { + currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null)); + } + @Override + protected void delete(String uri, Object obj) { + currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj)); } @Override - public void patch(String uri, Object body) { + protected void patch(String uri, Object body) { currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body)); } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java index 72b01c268e..a4f9496d17 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java @@ -40,6 +40,7 @@ public class GraphInventoryCommonObjectMapperProvider extends CommonObjectMapper mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); mapper.enable(MapperFeature.USE_ANNOTATIONS); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance()); diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java index 5fc8726427..45ac1f741d 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java @@ -33,8 +33,7 @@ import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> - implements TransactionBuilder { +public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> { protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class); @@ -181,7 +180,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone()) .orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName())); String resourceVersion = (String) result.get("resource-version"); - this.delete(uri.resourceVersion(resourceVersion).build().toString(), ""); + this.delete(uri.resourceVersion(resourceVersion).build().toString()); incrementActionAmount(); return (Self) this; } @@ -192,6 +191,14 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv protected abstract String getGraphDBName(); + protected abstract void put(String uri, Object body); + + protected abstract void delete(String uri); + + protected abstract void delete(String uri, Object obj); + + protected abstract void patch(String uri, Object body); + /** * @param obj - can be any object which will marshal into a valid A&AI payload * @param uri |