diff options
Diffstat (limited to 'cps-rest/src/main/java/org')
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java index 993dad58c3..9b78f85201 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java @@ -33,7 +33,8 @@ import java.util.Collection; import java.util.List; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; -import org.onap.cps.api.CpsAdminService; +import org.onap.cps.api.CpsAnchorService; +import org.onap.cps.api.CpsDataspaceService; import org.onap.cps.api.CpsModuleService; import org.onap.cps.rest.api.CpsAdminApi; import org.onap.cps.rest.model.AnchorDetails; @@ -53,9 +54,10 @@ import org.springframework.web.multipart.MultipartFile; @RequiredArgsConstructor public class AdminRestController implements CpsAdminApi { - private final CpsAdminService cpsAdminService; + private final CpsDataspaceService cpsDataspaceService; private final CpsModuleService cpsModuleService; private final CpsRestInputMapper cpsRestInputMapper; + private final CpsAnchorService cpsAnchorService; /** * Create a dataspace. @@ -65,7 +67,7 @@ public class AdminRestController implements CpsAdminApi { */ @Override public ResponseEntity<String> createDataspace(@NotNull @Valid final String dataspaceName) { - cpsAdminService.createDataspace(dataspaceName); + cpsDataspaceService.createDataspace(dataspaceName); return new ResponseEntity<>(dataspaceName, HttpStatus.CREATED); } @@ -77,7 +79,7 @@ public class AdminRestController implements CpsAdminApi { */ @Override public ResponseEntity<Void> createDataspaceV2(@NotNull @Valid final String dataspaceName) { - cpsAdminService.createDataspace(dataspaceName); + cpsDataspaceService.createDataspace(dataspaceName); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -89,7 +91,7 @@ public class AdminRestController implements CpsAdminApi { */ @Override public ResponseEntity<Void> deleteDataspace(final String apiVersion, final String dataspaceName) { - cpsAdminService.deleteDataspace(dataspaceName); + cpsDataspaceService.deleteDataspace(dataspaceName); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -184,7 +186,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<String> createAnchor(final String dataspaceName, @NotNull @Valid final String schemaSetName, @NotNull @Valid final String anchorName) { - cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorName); + cpsAnchorService.createAnchor(dataspaceName, schemaSetName, anchorName); return new ResponseEntity<>(anchorName, HttpStatus.CREATED); } @@ -199,7 +201,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<Void> createAnchorV2(final String dataspaceName, @NotNull @Valid final String schemaSetName, @NotNull @Valid final String anchorName) { - cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorName); + cpsAnchorService.createAnchor(dataspaceName, schemaSetName, anchorName); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -214,7 +216,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<Void> deleteAnchor(final String apiVersion, final String dataspaceName, final String anchorName) { - cpsAdminService.deleteAnchor(dataspaceName, anchorName); + cpsAnchorService.deleteAnchor(dataspaceName, anchorName); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @@ -229,7 +231,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<AnchorDetails> getAnchor(final String apiVersion, final String dataspaceName, final String anchorName) { - final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName); + final var anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName); final var anchorDetails = cpsRestInputMapper.toAnchorDetails(anchor); return new ResponseEntity<>(anchorDetails, HttpStatus.OK); } @@ -244,7 +246,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<List<AnchorDetails>> getAnchors(final String apiVersion, final String dataspaceName) { - final Collection<Anchor> anchors = cpsAdminService.getAnchors(dataspaceName); + final Collection<Anchor> anchors = cpsAnchorService.getAnchors(dataspaceName); final List<AnchorDetails> anchorDetails = anchors.stream().map(cpsRestInputMapper::toAnchorDetails) .collect(Collectors.toList()); return new ResponseEntity<>(anchorDetails, HttpStatus.OK); @@ -252,7 +254,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<List<DataspaceDetails>> getAllDataspaces(final String apiVersion) { - final Collection<Dataspace> dataspaces = cpsAdminService.getAllDataspaces(); + final Collection<Dataspace> dataspaces = cpsDataspaceService.getAllDataspaces(); final List<DataspaceDetails> dataspaceDetails = dataspaces.stream().map(cpsRestInputMapper::toDataspaceDetails) .collect(Collectors.toList()); return new ResponseEntity<>(dataspaceDetails, HttpStatus.OK); @@ -260,7 +262,7 @@ public class AdminRestController implements CpsAdminApi { @Override public ResponseEntity<DataspaceDetails> getDataspace(final String apiVersion, final String dataspaceName) { - final Dataspace dataspace = cpsAdminService.getDataspace(dataspaceName); + final Dataspace dataspace = cpsDataspaceService.getDataspace(dataspaceName); final DataspaceDetails dataspaceDetails = cpsRestInputMapper.toDataspaceDetails(dataspace); return new ResponseEntity<>(dataspaceDetails, HttpStatus.OK); } |