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=01b892218d92746ea7e5041a9cd5dc19b746e20a;hb=d5bda8848a661465f214b0bf11211e63b272cfd6;hp=86f4460eaa81037e13e0e4d757f5b721cf9390e2;hpb=e557338803286d8aaa0f877aa25d52d18735f309;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..01b892218 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 @@ -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,9 +64,9 @@ 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. @@ -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) {