diff options
author | raviteja.karumuri <raviteja.karumuri@est.tech> | 2023-06-20 19:10:21 +0100 |
---|---|---|
committer | raviteja.karumuri <raviteja.karumuri@est.tech> | 2023-06-22 11:23:30 +0100 |
commit | 977f7c395cee52cdecd0b01cb0412ebfeb9db048 (patch) | |
tree | 8547c2bf9426d25f3d5fd13ff4e328838ce0e1f4 /cps-ncmp-rest/src/main/java | |
parent | cac2186419db6c3d956dd8cd759622da022ea9b2 (diff) |
NCMP : Replacing the word 'Batch' as 'DataOperation'.
Issue-ID: CPS-1754
Signed-off-by: raviteja.karumuri <raviteja.karumuri@est.tech>
Change-Id: Ie9f56effb160582ba7177331fb6260b2bde2342b
Diffstat (limited to 'cps-ncmp-rest/src/main/java')
-rwxr-xr-x | cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java | 14 | ||||
-rw-r--r-- | cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java | 42 | ||||
-rw-r--r-- | cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java | 12 | ||||
-rw-r--r-- | cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java | 10 | ||||
-rw-r--r-- | cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java (renamed from cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java) | 16 |
5 files changed, 47 insertions, 47 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java index 1b78fa0343..3c22b81ef7 100755 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java @@ -46,10 +46,10 @@ import org.onap.cps.ncmp.rest.controller.handlers.NcmpCachedResourceRequestHandl import org.onap.cps.ncmp.rest.controller.handlers.NcmpDatastoreRequestHandler; import org.onap.cps.ncmp.rest.controller.handlers.NcmpPassthroughResourceRequestHandler; import org.onap.cps.ncmp.rest.mapper.CmHandleStateMapper; -import org.onap.cps.ncmp.rest.mapper.ResourceDataBatchRequestMapper; +import org.onap.cps.ncmp.rest.mapper.DataOperationRequestMapper; import org.onap.cps.ncmp.rest.model.CmHandlePublicProperties; import org.onap.cps.ncmp.rest.model.CmHandleQueryParameters; -import org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest; +import org.onap.cps.ncmp.rest.model.DataOperationRequest; import org.onap.cps.ncmp.rest.model.RestModuleDefinition; import org.onap.cps.ncmp.rest.model.RestModuleReference; import org.onap.cps.ncmp.rest.model.RestOutputCmHandle; @@ -76,7 +76,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { private final CmHandleStateMapper cmHandleStateMapper; private final NcmpCachedResourceRequestHandler ncmpCachedResourceRequestHandler; private final NcmpPassthroughResourceRequestHandler ncmpPassthroughResourceRequestHandler; - private final ResourceDataBatchRequestMapper resourceDataBatchRequestMapper; + private final DataOperationRequestMapper dataOperationRequestMapper; /** * Get resource data from datastore. @@ -105,11 +105,11 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { } @Override - public ResponseEntity<Object> getResourceDataForCmHandleBatch(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest) { + public ResponseEntity<Object> executeDataOperationForCmHandles(final String topicParamInQuery, + final DataOperationRequest + dataOperationRequest) { return ncmpPassthroughResourceRequestHandler.executeRequest(topicParamInQuery, - resourceDataBatchRequestMapper.toResourceDataBatchRequest(resourceDataBatchRequest)); + dataOperationRequestMapper.toDataOperationRequest(dataOperationRequest)); } /** diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java index a8ca13a752..101be45d37 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpDatastoreRequestHandler.java @@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j; import org.onap.cps.ncmp.api.impl.exception.InvalidDatastoreException; import org.onap.cps.ncmp.api.impl.operations.DatastoreType; import org.onap.cps.ncmp.api.impl.operations.OperationType; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; +import org.onap.cps.ncmp.api.models.DataOperationRequest; import org.onap.cps.ncmp.rest.exceptions.OperationNotSupportedException; import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor; import org.onap.cps.ncmp.rest.util.TopicValidator; @@ -105,21 +105,21 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler } /** - * Executes asynchronous request for batch of cm handles to resource data. + * Executes asynchronous request for group of cm handles to resource data. * * @param topicParamInQuery the topic param in query - * @param resourceDataBatchRequest batch request details for resource data + * @param dataOperationRequest data operation request details for resource data * @return the response entity */ public ResponseEntity<Object> executeRequest(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest) { - validateBatchRequest(topicParamInQuery, resourceDataBatchRequest); + final DataOperationRequest + dataOperationRequest) { + validateDataOperationRequest(topicParamInQuery, dataOperationRequest); if (!notificationFeatureEnabled) { return ResponseEntity.ok(Map.of("status", "Asynchronous request is unavailable as notification feature is currently disabled.")); } - return getRequestIdAndSendBatchRequestToDmiService(topicParamInQuery, resourceDataBatchRequest); + return getRequestIdAndSendDataOperationRequestToDmiService(topicParamInQuery, dataOperationRequest); } protected ResponseEntity<Object> executeTaskAsync(final String topicParamInQuery, @@ -152,27 +152,27 @@ public class NcmpDatastoreRequestHandler implements TaskManagementDefaultHandler return executeTaskAsync(topicParamInQuery, requestId, taskSupplier); } - private ResponseEntity<Object> getRequestIdAndSendBatchRequestToDmiService(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest) { + private ResponseEntity<Object> getRequestIdAndSendDataOperationRequestToDmiService(final String topicParamInQuery, + final DataOperationRequest + dataOperationRequest) { final String requestId = UUID.randomUUID().toString(); - sendResourceDataBatchRequestAsynchronously(topicParamInQuery, resourceDataBatchRequest, requestId); + sendDataOperationRequestAsynchronously(topicParamInQuery, dataOperationRequest, requestId); return ResponseEntity.ok(Map.of("requestId", requestId)); } - private void validateBatchRequest(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest) { + private void validateDataOperationRequest(final String topicParamInQuery, + final DataOperationRequest + dataOperationRequest) { TopicValidator.validateTopicName(topicParamInQuery); - resourceDataBatchRequest.getBatchOperationDefinitions().forEach(batchOperationDetail -> { - if (OperationType.fromOperationName(batchOperationDetail.getOperation()) != READ) { + dataOperationRequest.getDataOperationDefinitions().forEach(dataOperationDetail -> { + if (OperationType.fromOperationName(dataOperationDetail.getOperation()) != READ) { throw new OperationNotSupportedException( - batchOperationDetail.getOperation() + " operation not yet supported for target ids :" - + batchOperationDetail.getCmHandleIds()); - } else if (DatastoreType.fromDatastoreName(batchOperationDetail.getDatastore()) == OPERATIONAL) { - throw new InvalidDatastoreException(batchOperationDetail.getDatastore() + dataOperationDetail.getOperation() + " operation not yet supported for target ids :" + + dataOperationDetail.getCmHandleIds()); + } else if (DatastoreType.fromDatastoreName(dataOperationDetail.getDatastore()) == OPERATIONAL) { + throw new InvalidDatastoreException(dataOperationDetail.getDatastore() + " datastore is not supported for target ids : " - + batchOperationDetail.getCmHandleIds()); + + dataOperationDetail.getCmHandleIds()); } }); } diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java index 5c35818a3a..0e49c6df13 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/NcmpPassthroughResourceRequestHandler.java @@ -22,7 +22,7 @@ package org.onap.cps.ncmp.rest.controller.handlers; import java.util.function.Supplier; import org.onap.cps.ncmp.api.NetworkCmProxyDataService; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; +import org.onap.cps.ncmp.api.models.DataOperationRequest; import org.onap.cps.ncmp.rest.executor.CpsNcmpTaskExecutor; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; @@ -59,11 +59,11 @@ public class NcmpPassthroughResourceRequestHandler extends NcmpDatastoreRequestH @Async @Override - public void sendResourceDataBatchRequestAsynchronously(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest, - final String requestId) { - networkCmProxyDataService.requestResourceDataForCmHandleBatch(topicParamInQuery, resourceDataBatchRequest, + public void sendDataOperationRequestAsynchronously(final String topicParamInQuery, + final DataOperationRequest + dataOperationRequest, + final String requestId) { + networkCmProxyDataService.executeDataOperationForCmHandles(topicParamInQuery, dataOperationRequest, requestId); } diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java index 937935bec4..b2520b1609 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/handlers/TaskManagementDefaultHandler.java @@ -21,7 +21,7 @@ package org.onap.cps.ncmp.rest.controller.handlers; import java.util.function.Supplier; -import org.onap.cps.ncmp.api.models.ResourceDataBatchRequest; +import org.onap.cps.ncmp.api.models.DataOperationRequest; import org.onap.cps.spi.FetchDescendantsOption; public interface TaskManagementDefaultHandler { @@ -46,10 +46,10 @@ public interface TaskManagementDefaultHandler { return NO_OBJECT_SUPPLIER; } - default void sendResourceDataBatchRequestAsynchronously(final String topicParamInQuery, - final ResourceDataBatchRequest - resourceDataBatchRequest, - final String requestId) { + default void sendDataOperationRequestAsynchronously(final String topicParamInQuery, + final DataOperationRequest + dataOperationRequest, + final String requestId) { } static FetchDescendantsOption getFetchDescendantsOption(final boolean includeDescendants) { diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java index d045e31610..51ee8ca174 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/ResourceDataBatchRequestMapper.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/mapper/DataOperationRequestMapper.java @@ -24,18 +24,18 @@ import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.NullValueCheckStrategy; import org.mapstruct.NullValuePropertyMappingStrategy; -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; @Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS, nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.SET_TO_DEFAULT) -public interface ResourceDataBatchRequestMapper { +public interface DataOperationRequestMapper { - @Mapping(source = "operations", target = "batchOperationDefinitions") - ResourceDataBatchRequest toResourceDataBatchRequest( - org.onap.cps.ncmp.rest.model.ResourceDataBatchRequest resourceDataBatchRequest); + @Mapping(source = "operations", target = "dataOperationDefinitions") + DataOperationRequest toDataOperationRequest( + org.onap.cps.ncmp.rest.model.DataOperationRequest dataOperationRequest); @Mapping(source = "targetIds", target = "cmHandleIds") - BatchOperationDefinition toBatchOperationDefinition( - org.onap.cps.ncmp.rest.model.BatchOperationDefinition batchOperationDefinition); + DataOperationDefinition toDataOperationDefinition( + org.onap.cps.ncmp.rest.model.DataOperationDefinition dataOperationDefinition); } |