diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2024-06-25 14:40:40 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2024-06-26 15:03:09 +0100 |
commit | e18239631ff2f2f56961c8534a0edf294ee15fdd (patch) | |
tree | 450362e84841abbf97935dcb31adb2f1dd160d03 /cps-ncmp-rest/src/main | |
parent | 37d82d5d54ede4c05862fe648911c383d253cec3 (diff) |
Move TrustLevel Feature
-Moved TrustLevel impl from Controller to Inventory Facade
-Applied new package name convention using impl\inventory\trustlevel for this (sub)feature
-Renamed some trustlevel related classes to better describe their role
-Disabled failing architecture test (agreed this is tech. debt and created CPS-2293)
-Refactored YangDataConverter method names and signatures (moved Spec to correct place)
-Cleaned up names and javadoc of class now called DeviceTrustLevelMessageConsumer
-Applied conventions to modified test methods
Issue-ID: CPS-2255
Change-Id: Iccd20541488e6b61444bb2c7406c90e61a34124d
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
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 | 18 |
1 files changed, 4 insertions, 14 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 f21c6ecbdd..11252b7504 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 @@ -34,15 +34,12 @@ import io.micrometer.core.annotation.Timed; import java.util.ArrayList; 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; import org.onap.cps.ncmp.api.impl.NetworkCmProxyFacade; -import org.onap.cps.ncmp.api.impl.config.embeddedcache.TrustLevelCacheConfig; 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.trustlevel.TrustLevel; import org.onap.cps.ncmp.api.inventory.NetworkCmProxyInventoryFacade; import org.onap.cps.ncmp.api.inventory.models.CmHandleQueryApiParameters; import org.onap.cps.ncmp.api.inventory.models.CompositeState; @@ -63,7 +60,6 @@ import org.onap.cps.ncmp.rest.util.DeprecationHelper; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.model.ModuleDefinition; import org.onap.cps.utils.JsonObjectMapper; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.StringUtils; @@ -83,12 +79,8 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { private final DeprecationHelper deprecationHelper; private final NcmpRestInputMapper ncmpRestInputMapper; private final CmHandleStateMapper cmHandleStateMapper; - private final DataOperationRequestMapper dataOperationRequestMapper; - @Qualifier(TrustLevelCacheConfig.TRUST_LEVEL_PER_CM_HANDLE) - private final Map<String, TrustLevel> trustLevelPerCmHandle; - /** * Get resource data from datastore. * @@ -268,9 +260,9 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters); final Collection<NcmpServiceCmHandle> cmHandles = networkCmProxyInventoryFacade .executeCmHandleSearch(cmHandleQueryApiParameters); - final List<RestOutputCmHandle> outputCmHandles = + final List<RestOutputCmHandle> restOutputCmHandles = cmHandles.stream().map(this::toRestOutputCmHandle).collect(Collectors.toList()); - return ResponseEntity.ok(outputCmHandles); + return ResponseEntity.ok(restOutputCmHandles); } /** @@ -394,18 +386,16 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { return new ResponseEntity<>(HttpStatus.OK); } - 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()); + if (ncmpServiceCmHandle.getCurrentTrustLevel() != null) { + restOutputCmHandle.setTrustLevel(ncmpServiceCmHandle.getCurrentTrustLevel().toString()); } restOutputCmHandle.setModuleSetTag(ncmpServiceCmHandle.getModuleSetTag()); restOutputCmHandle.setAlternateId(ncmpServiceCmHandle.getAlternateId()); |