summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-10-06 09:49:12 +0100
committerniamhcore <niamh.core@est.tech>2021-10-07 11:51:40 +0100
commitacc0f8b83a320b979cb5db23906f4ef3baf5f42c (patch)
tree581a83acb0129de9f061bc0b4fce0ecef83f50c1 /src/main
parentf0acf5b1a4dd4bb774a81a7a75c48aeb81169fde (diff)
Updating get module schema request body
Issue-ID: CPS-706 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: I92d241c4ccde77aaaf8aa5a3903437016edf65d0
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
index 908ccbe2..b17280ae 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
@@ -20,8 +20,6 @@
package org.onap.cps.ncmp.dmi.rest.controller;
-import static org.onap.cps.ncmp.dmi.model.DmiModuleReadRequestBody.OperationEnum.READ;
-
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
@@ -30,7 +28,8 @@ import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.dmi.model.CmHandles;
import org.onap.cps.ncmp.dmi.model.DataAccessReadRequest;
import org.onap.cps.ncmp.dmi.model.DataAccessWriteRequest;
-import org.onap.cps.ncmp.dmi.model.DmiModuleReadRequestBody;
+import org.onap.cps.ncmp.dmi.model.ModuleReferencesRequest;
+import org.onap.cps.ncmp.dmi.model.ModuleResourcesReadRequest;
import org.onap.cps.ncmp.dmi.model.ModuleSet;
import org.onap.cps.ncmp.dmi.model.YangResources;
import org.onap.cps.ncmp.dmi.rest.api.DmiPluginApi;
@@ -58,8 +57,8 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
}
@Override
- public ResponseEntity<ModuleSet> getModulesForCmHandle(final String cmHandle,
- final @Valid DataAccessReadRequest body) {
+ public ResponseEntity<ModuleSet> getModuleReferences(final String cmHandle,
+ final @Valid ModuleReferencesRequest body) {
// For onap-dmi-plugin we don't need cmHandleProperties, so DataAccessReadRequest is not used.
final var moduleSet = dmiService.getModulesForCmHandle(cmHandle);
return ResponseEntity.ok(moduleSet);
@@ -67,14 +66,11 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
@Override
public ResponseEntity<YangResources> retrieveModuleResources(
- final @Valid DmiModuleReadRequestBody dmiModuleReadRequestBody,
- final String cmHandle) {
- if (READ.equals(dmiModuleReadRequestBody.getOperation())) {
- final var moduleReferenceList = convertRestObjectToJavaApiObject(dmiModuleReadRequestBody);
- final var response = dmiService.getModuleResources(cmHandle, moduleReferenceList);
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
- return new ResponseEntity<>(HttpStatus.CONFLICT);
+ final @Valid ModuleResourcesReadRequest moduleResourcesReadRequest,
+ final String cmHandle) {
+ final List<ModuleReference> moduleReferences = convertRestObjectToJavaApiObject(moduleResourcesReadRequest);
+ final YangResources yangResources = dmiService.getModuleResources(cmHandle, moduleReferences);
+ return new ResponseEntity<>(yangResources, HttpStatus.OK);
}
/**
@@ -162,9 +158,9 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
}
private List<ModuleReference> convertRestObjectToJavaApiObject(
- final DmiModuleReadRequestBody dmiModuleSchemaReadRequestBody) {
+ final ModuleResourcesReadRequest moduleResourcesReadRequest) {
return objectMapper
- .convertValue(dmiModuleSchemaReadRequestBody.getData().getModules(),
+ .convertValue(moduleResourcesReadRequest.getData().getModules(),
new TypeReference<List<ModuleReference>>() {});
}
}