X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2Fclient%2FDmiRestClient.java;h=62eca9451a892a4739e34f2ef94983162e96e232;hb=20b4f9cf0b662de4a7665b2a82593ef0205f5e06;hp=fc70708f927fe9cd5301c5f6fcafce3c5ec75e44;hpb=bc742a1dbe39a3269abab9e62a9d489f460144b0;p=cps.git diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java index fc70708f9..62eca9451 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/client/DmiRestClient.java @@ -35,13 +35,28 @@ public class DmiRestClient { private RestTemplate restTemplate; private DmiProperties dmiProperties; + /** + * Constructor injection for DmiRestClient objects. + * + * @param restTemplate the rest template + * @param dmiProperties the DMI properties + */ public DmiRestClient(final RestTemplate restTemplate, final DmiProperties dmiProperties) { this.restTemplate = restTemplate; this.dmiProperties = dmiProperties; } + /** + * Sends a PUT operation to DMI with JSON payload. + * + * @param dmiResourceUrl the DMI resource URL + * @param jsonData the JSON payload + * @param headers the HTTP headers + * @return response entity of type Object + */ public ResponseEntity putOperationWithJsonData(final String dmiResourceUrl, final String jsonData, final HttpHeaders headers) { + //TODO Toine Siebelink, should we use POST operation below instead (and return a String-Entity!) final var httpEntity = new HttpEntity<>(jsonData, configureHttpHeaders(headers)); return restTemplate.exchange(dmiResourceUrl, HttpMethod.PUT, httpEntity, Object.class); } @@ -76,4 +91,4 @@ public class DmiRestClient { final var httpEntity = new HttpEntity<>(configureHttpHeaders(httpHeaders)); return restTemplate.exchange(dmiResourceUrl, HttpMethod.POST, httpEntity, String.class); } -} \ No newline at end of file +}