From e24f5e8934c6be58e56949223727f6bde114c8d3 Mon Sep 17 00:00:00 2001 From: emaclee Date: Sat, 23 Sep 2023 13:46:15 +0100 Subject: Update return body of RestOutputCMHandle Issue-ID: CPS-1869 Signed-off-by: emaclee Change-Id: I946db9e6785fc50775d1c5ff18e7462e8bad9af6 --- .../onap/cps/ncmp/rest/controller/NetworkCmProxyController.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cps-ncmp-rest/src/main') 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 6c730cb1f8..ef70a3763c 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 @@ -32,6 +32,7 @@ import static org.onap.cps.ncmp.api.impl.operations.OperationType.UPDATE; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -39,6 +40,7 @@ import org.onap.cps.ncmp.api.NetworkCmProxyDataService; import org.onap.cps.ncmp.api.impl.exception.InvalidDatastoreException; import org.onap.cps.ncmp.api.impl.inventory.CompositeState; import org.onap.cps.ncmp.api.impl.operations.DatastoreType; +import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel; import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters; import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle; import org.onap.cps.ncmp.rest.api.NetworkCmProxyApi; @@ -77,6 +79,7 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { private final NcmpCachedResourceRequestHandler ncmpCachedResourceRequestHandler; private final NcmpPassthroughResourceRequestHandler ncmpPassthroughResourceRequestHandler; private final DataOperationRequestMapper dataOperationRequestMapper; + private final Map trustLevelPerCmHandle; /** * Get resource data from datastore. @@ -361,11 +364,15 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { private RestOutputCmHandle toRestOutputCmHandle(final NcmpServiceCmHandle ncmpServiceCmHandle) { final RestOutputCmHandle restOutputCmHandle = new RestOutputCmHandle(); final CmHandlePublicProperties cmHandlePublicProperties = new CmHandlePublicProperties(); + final TrustLevel cmHandleCurrentTrustLevel = trustLevelPerCmHandle.get(ncmpServiceCmHandle.getCmHandleId()); restOutputCmHandle.setCmHandle(ncmpServiceCmHandle.getCmHandleId()); cmHandlePublicProperties.add(ncmpServiceCmHandle.getPublicProperties()); restOutputCmHandle.setPublicCmHandleProperties(cmHandlePublicProperties); restOutputCmHandle.setState(cmHandleStateMapper.toCmHandleCompositeStateExternalLockReason( ncmpServiceCmHandle.getCompositeState())); + if (cmHandleCurrentTrustLevel != null) { + restOutputCmHandle.setTrustLevel(cmHandleCurrentTrustLevel.toString()); + } return restOutputCmHandle; } -- cgit 1.2.3-korg