From 977f7c395cee52cdecd0b01cb0412ebfeb9db048 Mon Sep 17 00:00:00 2001 From: "raviteja.karumuri" Date: Tue, 20 Jun 2023 19:10:21 +0100 Subject: NCMP : Replacing the word 'Batch' as 'DataOperation'. Issue-ID: CPS-1754 Signed-off-by: raviteja.karumuri Change-Id: Ie9f56effb160582ba7177331fb6260b2bde2342b --- .../cps/ncmp/api/NetworkCmProxyDataService.java | 14 +++---- .../api/impl/NetworkCmProxyDataServiceImpl.java | 12 +++--- .../api/impl/operations/DmiBatchOperation.java | 18 ++++---- .../api/impl/operations/DmiDataOperations.java | 20 ++++----- .../impl/utils/ResourceDataBatchRequestUtils.java | 26 ++++++------ .../ncmp/api/models/BatchOperationDefinition.java | 49 ---------------------- .../ncmp/api/models/DataOperationDefinition.java | 49 ++++++++++++++++++++++ .../cps/ncmp/api/models/DataOperationRequest.java | 43 +++++++++++++++++++ .../ncmp/api/models/ResourceDataBatchRequest.java | 43 ------------------- 9 files changed, 137 insertions(+), 137 deletions(-) delete mode 100644 cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/BatchOperationDefinition.java create mode 100644 cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationDefinition.java create mode 100644 cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationRequest.java delete mode 100644 cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/ResourceDataBatchRequest.java (limited to 'cps-ncmp-service/src/main/java/org/onap') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java index 046c78879b..e20780bf56 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/NetworkCmProxyDataService.java @@ -29,10 +29,10 @@ import org.onap.cps.ncmp.api.impl.operations.OperationType; import org.onap.cps.ncmp.api.inventory.CompositeState; import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters; import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters; +import org.onap.cps.ncmp.api.models.DataOperationRequest; import org.onap.cps.ncmp.api.models.DmiPluginRegistration; import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse; import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.model.ModuleDefinition; import org.onap.cps.spi.model.ModuleReference; @@ -83,15 +83,15 @@ public interface NetworkCmProxyDataService { FetchDescendantsOption fetchDescendantsOption); /** - * Get resource data for batch of cm handles using dmi. + * Execute (async) data operation for group of cm handles using dmi. * * @param topicParamInQuery topic name for (triggering) async responses - * @param resourceDataBatchRequest cm handle identifiers + * @param dataOperationRequest cm handle identifiers */ - void requestResourceDataForCmHandleBatch(String topicParamInQuery, - ResourceDataBatchRequest - resourceDataBatchRequest, - String requestId); + void executeDataOperationForCmHandles(String topicParamInQuery, + DataOperationRequest + dataOperationRequest, + String requestId); /** diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index 536775ec5c..2e9d7c2021 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -60,10 +60,10 @@ import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters; import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters; import org.onap.cps.ncmp.api.models.CmHandleRegistrationResponse; import org.onap.cps.ncmp.api.models.CmHandleRegistrationResponse.RegistrationError; +import org.onap.cps.ncmp.api.models.DataOperationRequest; import org.onap.cps.ncmp.api.models.DmiPluginRegistration; import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse; import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.exceptions.AlreadyDefinedExceptionBatch; import org.onap.cps.spi.exceptions.CpsException; @@ -139,11 +139,11 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService } @Override - public void requestResourceDataForCmHandleBatch(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest, - final String requestId) { - dmiDataOperations.requestResourceDataFromDmi(topicParamInQuery, resourceDataBatchRequest, requestId); + public void executeDataOperationForCmHandles(final String topicParamInQuery, + final DataOperationRequest + dataOperationRequest, + final String requestId) { + dmiDataOperations.requestResourceDataFromDmi(topicParamInQuery, dataOperationRequest, requestId); } @Override diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiBatchOperation.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiBatchOperation.java index 76ad0f7b2e..512c3bcda8 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiBatchOperation.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiBatchOperation.java @@ -27,7 +27,7 @@ import java.util.ArrayList; import java.util.List; import lombok.Builder; import lombok.Getter; -import org.onap.cps.ncmp.api.models.BatchOperationDefinition; +import org.onap.cps.ncmp.api.models.DataOperationDefinition; @JsonInclude(JsonInclude.Include.NON_NULL) @Getter @@ -45,20 +45,20 @@ public class DmiBatchOperation { private final List cmHandles = new ArrayList<>(); /** - * Create and initialise a (outgoing) DMI batch operation. + * Create and initialise a (outgoing) DMI data operation. * - * @param batchOperationDefinition batchOperationDefinition definition of incoming of batch request + * @param dataOperationDefinition definition of incoming of dataOperation request * @return mapped dmi operation details */ public static DmiBatchOperation buildDmiBatchRequestBodyWithoutCmHandles( - final BatchOperationDefinition batchOperationDefinition) { + final DataOperationDefinition dataOperationDefinition) { return DmiBatchOperation.builder() - .operationType(OperationType.fromOperationName(batchOperationDefinition.getOperation())) - .operationId(batchOperationDefinition.getOperationId()) - .datastore(DatastoreType.fromDatastoreName(batchOperationDefinition.getDatastore()).getDatastoreName()) - .options(batchOperationDefinition.getOptions()) - .resourceIdentifier(batchOperationDefinition.getResourceIdentifier()) + .operationType(OperationType.fromOperationName(dataOperationDefinition.getOperation())) + .operationId(dataOperationDefinition.getOperationId()) + .datastore(DatastoreType.fromDatastoreName(dataOperationDefinition.getDatastore()).getDatastoreName()) + .options(dataOperationDefinition.getOptions()) + .resourceIdentifier(dataOperationDefinition.getResourceIdentifier()) .build(); } } 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 3e8d40a83b..adf634da57 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 @@ -38,7 +38,7 @@ import org.onap.cps.ncmp.api.impl.utils.ResourceDataBatchRequestUtils; import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle; import org.onap.cps.ncmp.api.inventory.CmHandleState; import org.onap.cps.ncmp.api.inventory.InventoryPersistence; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; +import org.onap.cps.ncmp.api.models.DataOperationRequest; import org.onap.cps.spi.exceptions.CpsException; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.http.ResponseEntity; @@ -118,21 +118,21 @@ public class DmiDataOperations extends DmiOperations { * The data wil be returned as message on the topic specified. * * @param topicParamInQuery topic name for (triggering) async responses - * @param resourceDataBatchRequest batch request for resource data + * @param dataOperationRequest data operation request to execute operations * @param requestId requestId for as a response */ public void requestResourceDataFromDmi(final String topicParamInQuery, - final ResourceDataBatchRequest resourceDataBatchRequest, + final DataOperationRequest dataOperationRequest, final String requestId) { final Set cmHandlesIds - = getDistinctCmHandleIdsFromBatchRequest(resourceDataBatchRequest); + = getDistinctCmHandleIdsFromDataOperationRequest(dataOperationRequest); final Collection yangModelCmHandles = getYangModelCmHandlesInReadyState(cmHandlesIds); final Map> operationsOutPerDmiServiceName - = ResourceDataBatchRequestUtils.processPerOperationInBatchRequest(resourceDataBatchRequest, + = ResourceDataBatchRequestUtils.processPerOperationInBatchRequest(dataOperationRequest, yangModelCmHandles); buildBatchRequestUrlAndSendToDmiService(topicParamInQuery, requestId, operationsOutPerDmiServiceName); @@ -214,11 +214,11 @@ public class DmiDataOperations extends DmiOperations { } } - private static Set getDistinctCmHandleIdsFromBatchRequest(final ResourceDataBatchRequest - resourceDataBatchRequest) { - return resourceDataBatchRequest.getBatchOperationDefinitions().stream() - .flatMap(batchOperationDefinition -> - batchOperationDefinition.getCmHandleIds().stream()).collect(Collectors.toSet()); + private static Set getDistinctCmHandleIdsFromDataOperationRequest(final DataOperationRequest + dataOperationRequest) { + return dataOperationRequest.getDataOperationDefinitions().stream() + .flatMap(dataOperationDefinition -> + dataOperationDefinition.getCmHandleIds().stream()).collect(Collectors.toSet()); } private Collection getYangModelCmHandlesInReadyState(final Set requestedCmHandleIds) { diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/ResourceDataBatchRequestUtils.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/ResourceDataBatchRequestUtils.java index e4c9bfb39b..f0d02552f6 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/ResourceDataBatchRequestUtils.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/utils/ResourceDataBatchRequestUtils.java @@ -33,8 +33,8 @@ import lombok.extern.slf4j.Slf4j; import org.onap.cps.ncmp.api.impl.operations.CmHandle; import org.onap.cps.ncmp.api.impl.operations.DmiBatchOperation; import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle; -import org.onap.cps.ncmp.api.models.BatchOperationDefinition; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; +import org.onap.cps.ncmp.api.models.DataOperationDefinition; +import org.onap.cps.ncmp.api.models.DataOperationRequest; @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) @@ -45,13 +45,13 @@ public class ResourceDataBatchRequestUtils { /** * Create a list of DMI batch operation per DMI service (name). * - * @param resourceDataBatchRequestIn incoming batch request details for resource data - * @param yangModelCmHandles involved cm handles represented as YangModelCmHandle (incl. metadata) + * @param dataOperationRequestIn incoming data operation request details + * @param yangModelCmHandles involved cm handles represented as YangModelCmHandle (incl. metadata) * * @return {@code Map>} Create a list of DMI batch operation per DMI service (name). */ public static Map> processPerOperationInBatchRequest( - final ResourceDataBatchRequest resourceDataBatchRequestIn, + final DataOperationRequest dataOperationRequestIn, final Collection yangModelCmHandles) { final Map>> dmiPropertiesPerCmHandleIdPerServiceName = @@ -62,9 +62,9 @@ public class ResourceDataBatchRequestUtils { final Map> dmiBatchOperationsOutPerDmiServiceName = new HashMap<>(); - for (final BatchOperationDefinition batchOperationDefinitionIn : - resourceDataBatchRequestIn.getBatchOperationDefinitions()) { - for (final String cmHandleId : batchOperationDefinitionIn.getCmHandleIds()) { + for (final DataOperationDefinition dataOperationDefinitionIn : + dataOperationRequestIn.getDataOperationDefinitions()) { + for (final String cmHandleId : dataOperationDefinitionIn.getCmHandleIds()) { final String dmiServiceName = dmiServiceNamesPerCmHandleId.get(cmHandleId); final Map cmHandleIdProperties = dmiPropertiesPerCmHandleIdPerServiceName.get(dmiServiceName).get(cmHandleId); @@ -72,7 +72,7 @@ public class ResourceDataBatchRequestUtils { publishErrorMessageToClientTopic(cmHandleId); } else { final DmiBatchOperation dmiBatchOperationOut = getOrAddDmiBatchOperation(dmiServiceName, - batchOperationDefinitionIn, dmiBatchOperationsOutPerDmiServiceName); + dataOperationDefinitionIn, dmiBatchOperationsOutPerDmiServiceName); final CmHandle cmHandle = CmHandle.buildCmHandleWithProperties(cmHandleId, cmHandleIdProperties); dmiBatchOperationOut.getCmHandles().add(cmHandle); } @@ -104,8 +104,8 @@ public class ResourceDataBatchRequestUtils { } private static DmiBatchOperation getOrAddDmiBatchOperation(final String dmiServiceName, - final BatchOperationDefinition - batchOperationDefinitionIn, + final DataOperationDefinition + dataOperationDefinitionIn, final Map> dmiBatchOperationsOutPerDmiServiceName) { dmiBatchOperationsOutPerDmiServiceName @@ -114,10 +114,10 @@ public class ResourceDataBatchRequestUtils { = dmiBatchOperationsOutPerDmiServiceName.get(dmiServiceName); final boolean isNewOperation = dmiBatchOperationsOut.isEmpty() || !dmiBatchOperationsOut.get(dmiBatchOperationsOut.size() - 1).getOperationId() - .equals(batchOperationDefinitionIn.getOperationId()); + .equals(dataOperationDefinitionIn.getOperationId()); if (isNewOperation) { final DmiBatchOperation newDmiBatchOperationOut = - DmiBatchOperation.buildDmiBatchRequestBodyWithoutCmHandles(batchOperationDefinitionIn); + DmiBatchOperation.buildDmiBatchRequestBodyWithoutCmHandles(dataOperationDefinitionIn); dmiBatchOperationsOut.add(newDmiBatchOperationOut); return newDmiBatchOperationOut; } diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/BatchOperationDefinition.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/BatchOperationDefinition.java deleted file mode 100644 index 04075b3b7c..0000000000 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/BatchOperationDefinition.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * ============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.models; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.ArrayList; -import java.util.List; -import javax.validation.Valid; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -@EqualsAndHashCode -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonIgnoreProperties(ignoreUnknown = true) -public class BatchOperationDefinition { - - private String operation; - private String operationId; - private String datastore; - private String options; - private String resourceIdentifier; - - @JsonProperty("targetIds") - @Valid - private List cmHandleIds = new ArrayList(); -} diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationDefinition.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationDefinition.java new file mode 100644 index 0000000000..8182fbfcc8 --- /dev/null +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationDefinition.java @@ -0,0 +1,49 @@ +/* + * ============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.models; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.Valid; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@EqualsAndHashCode +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonIgnoreProperties(ignoreUnknown = true) +public class DataOperationDefinition { + + private String operation; + private String operationId; + private String datastore; + private String options; + private String resourceIdentifier; + + @JsonProperty("targetIds") + @Valid + private List cmHandleIds = new ArrayList<>(); +} diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationRequest.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationRequest.java new file mode 100644 index 0000000000..6fa7d5c755 --- /dev/null +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DataOperationRequest.java @@ -0,0 +1,43 @@ +/* + * ============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.models; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Collections; +import java.util.List; +import javax.validation.Valid; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@EqualsAndHashCode +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonIgnoreProperties(ignoreUnknown = true) +public class DataOperationRequest { + + @JsonProperty("operations") + @Valid + private List dataOperationDefinitions = Collections.emptyList(); +} diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/ResourceDataBatchRequest.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/ResourceDataBatchRequest.java deleted file mode 100644 index 7af107c37a..0000000000 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/ResourceDataBatchRequest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ============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.models; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Collections; -import java.util.List; -import javax.validation.Valid; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -@EqualsAndHashCode -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonIgnoreProperties(ignoreUnknown = true) -public class ResourceDataBatchRequest { - - @JsonProperty("operations") - @Valid - private List batchOperationDefinitions = Collections.emptyList(); -} -- cgit 1.2.3-korg