X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-rest%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fncmp%2Frest%2Fcontroller%2FNetworkCmProxyController.java;h=de6c3c4f3d6526af99cf788a301fe2b99d2569e0;hb=d69742c1f02585ae5d82f49542581698367e9cde;hp=86f4460eaa81037e13e0e4d757f5b721cf9390e2;hpb=59aa954d37f8819acc1f927d045087254e7a6aea;p=cps.git 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 86f4460ea..de6c3c4f3 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 @@ -3,7 +3,7 @@ * Copyright (C) 2021 Pantheon.tech * Modifications Copyright (C) 2021-2022 Nordix Foundation * Modification Copyright (C) 2021 highstreet technologies GmbH - * Modifications (C) 2021 Bell Canada + * Modifications (C) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,6 @@ import javax.validation.Valid; import javax.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.modelmapper.ModelMapper; import org.onap.cps.ncmp.api.NetworkCmProxyDataService; import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; import org.onap.cps.ncmp.rest.api.NetworkCmProxyApi; @@ -49,7 +48,7 @@ import org.onap.cps.ncmp.rest.model.ConditionProperties; import org.onap.cps.ncmp.rest.model.Conditions; import org.onap.cps.ncmp.rest.model.ModuleNameAsJsonObject; import org.onap.cps.ncmp.rest.model.ModuleNamesAsJsonArray; -import org.onap.cps.ncmp.rest.model.ModuleReference; +import org.onap.cps.ncmp.rest.model.RestModuleReference; import org.onap.cps.ncmp.rest.model.RestOutputCmHandle; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.http.HttpStatus; @@ -65,28 +64,28 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { private static final String NO_BODY = null; - private final ModelMapper modelMapper; private final NetworkCmProxyDataService networkCmProxyDataService; private final JsonObjectMapper jsonObjectMapper; + private final NcmpRestInputMapper ncmpRestInputMapper; /** * Get resource data from operational datastore. * * @param cmHandle cm handle identifier * @param resourceIdentifier resource identifier - * @param acceptParamInHeader accept header parameter * @param optionsParamInQuery options query parameter + * @param topicParamInQuery topic query parameter * @return {@code ResponseEntity} response from dmi plugin */ @Override public ResponseEntity getResourceDataOperationalForCmHandle(final String cmHandle, final @NotNull @Valid String resourceIdentifier, - final String acceptParamInHeader, - final @Valid String optionsParamInQuery) { + final @Valid String optionsParamInQuery, + final @Valid String topicParamInQuery) { final Object responseObject = networkCmProxyDataService.getResourceDataOperationalForCmHandle(cmHandle, resourceIdentifier, - acceptParamInHeader, - optionsParamInQuery); + optionsParamInQuery, + topicParamInQuery); return ResponseEntity.ok(responseObject); } @@ -95,19 +94,19 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { * * @param cmHandle cm handle identifier * @param resourceIdentifier resource identifier - * @param acceptParamInHeader accept header parameter * @param optionsParamInQuery options query parameter + * @param topicParamInQuery topic query parameter * @return {@code ResponseEntity} response from dmi plugin */ @Override public ResponseEntity getResourceDataRunningForCmHandle(final String cmHandle, final @NotNull @Valid String resourceIdentifier, - final String acceptParamInHeader, - final @Valid String optionsParamInQuery) { + final @Valid String optionsParamInQuery, + final @Valid String topicParamInQuery) { final Object responseObject = networkCmProxyDataService.getResourceDataPassThroughRunningForCmHandle(cmHandle, resourceIdentifier, - acceptParamInHeader, - optionsParamInQuery); + optionsParamInQuery, + topicParamInQuery); return ResponseEntity.ok(responseObject); } @@ -205,14 +204,14 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { * Return module references for a cm handle. * * @param cmHandle the cm handle - * @return module references for cm handle + * @return module references for cm handle. Namespace will be always blank because restConf does not include this. */ - public ResponseEntity> getModuleReferencesByCmHandle(final String cmHandle) { - final List moduleReferences = + public ResponseEntity> getModuleReferencesByCmHandle(final String cmHandle) { + final List restModuleReferences = networkCmProxyDataService.getYangResourcesModuleReferences(cmHandle).stream() - .map(moduleReference -> modelMapper.map(moduleReference, ModuleReference.class)) + .map(ncmpRestInputMapper::toRestModuleReference) .collect(Collectors.toList()); - return new ResponseEntity<>(moduleReferences, HttpStatus.OK); + return new ResponseEntity<>(restModuleReferences, HttpStatus.OK); } private Collection processConditions(final List conditionProperties) {