diff options
author | 2023-08-08 19:30:41 +0100 | |
---|---|---|
committer | 2023-08-09 15:19:44 +0100 | |
commit | c38ada1f4b44cf5dcc9f8cc4fb49cd9a8568a774 (patch) | |
tree | a6470a025940cb486b08691ef8747369f50b27ce /cps-ncmp-service/src/main | |
parent | 67b4b3964cb5077c334ea057e9138213e7ac989c (diff) |
Modify DmiDataOperationRequest to make it identical as DataOperationRequest
- Modified DmiDataOperationRequest attribute from operationType to
operation.
- Wrapped operation details to parent attribute operationd array.
Issue-ID: CPS-1833
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Change-Id: I79aa943e10e1c32c3252a6eb4375c14496476f8b
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main')
3 files changed, 42 insertions, 7 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperation.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperation.java index 6346379b2..2e66ac0bf 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperation.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperation.java @@ -21,7 +21,6 @@ package org.onap.cps.ncmp.api.impl.operations; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.ArrayList; import java.util.List; @@ -35,8 +34,7 @@ import org.onap.cps.ncmp.api.models.DataOperationDefinition; @JsonPropertyOrder({"operation", "operationId", "datastore", "options", "resourceIdentifier", "cmHandles"}) public class DmiDataOperation { - @JsonProperty("operation") - private OperationType operationType; + private OperationType operation; private String operationId; private String datastore; private String options; @@ -54,7 +52,7 @@ public class DmiDataOperation { final DataOperationDefinition dataOperationDefinition) { return DmiDataOperation.builder() - .operationType(OperationType.fromOperationName(dataOperationDefinition.getOperation())) + .operation(OperationType.fromOperationName(dataOperationDefinition.getOperation())) .operationId(dataOperationDefinition.getOperationId()) .datastore(DatastoreType.fromDatastoreName(dataOperationDefinition.getDatastore()).getDatastoreName()) .options(dataOperationDefinition.getOptions()) diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationRequest.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationRequest.java new file mode 100644 index 000000000..8ee1d905b --- /dev/null +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperationRequest.java @@ -0,0 +1,35 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.api.impl.operations; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; +import lombok.Builder; +import lombok.Getter; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@Getter +@Builder +public class DmiDataOperationRequest { + + private List<DmiDataOperation> operations; + +} diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java index 8f0975f17..02de9854e 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiDataOperations.java @@ -241,10 +241,12 @@ public class DmiDataOperations extends DmiOperations { private void sendDataOperationRequestToDmiService(final String dataOperationResourceUrl, final List<DmiDataOperation> dmiDataOperationRequestBodies) { - final String dataOperationRequestBodiesAsJsonString = - jsonObjectMapper.asJsonString(dmiDataOperationRequestBodies); + final DmiDataOperationRequest dmiDataOperationRequest = DmiDataOperationRequest.builder() + .operations(dmiDataOperationRequestBodies).build(); + final String dmiDataOperationRequestAsJsonString = + jsonObjectMapper.asJsonString(dmiDataOperationRequest); TaskExecutor.executeTask(() -> dmiRestClient.postOperationWithJsonData(dataOperationResourceUrl, - dataOperationRequestBodiesAsJsonString, READ), + dmiDataOperationRequestAsJsonString, READ), DEFAULT_ASYNC_TASK_EXECUTOR_TIMEOUT_IN_MILLISECONDS) .whenCompleteAsync((response, throwable) -> handleTaskCompletionException(throwable, dataOperationResourceUrl, dmiDataOperationRequestBodies)); |