diff options
author | 2023-09-23 13:46:15 +0100 | |
---|---|---|
committer | 2023-10-25 16:05:07 +0100 | |
commit | e24f5e8934c6be58e56949223727f6bde114c8d3 (patch) | |
tree | 9f65b98a27e9ac4f7350fc207231795f5cca405f /cps-ncmp-rest/src/main | |
parent | 3ccd62ed40e96dbe2970de1433b2ebdbe014d4aa (diff) |
Update return body of RestOutputCMHandle
Issue-ID: CPS-1869
Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
Change-Id: I946db9e6785fc50775d1c5ff18e7462e8bad9af6
Diffstat (limited to 'cps-ncmp-rest/src/main')
-rwxr-xr-x | cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java | 7 |
1 files changed, 7 insertions, 0 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 6c730cb1f..ef70a3763 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<String, TrustLevel> 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; } |