/*
- * ============LICENSE_START=======================================================
+ * ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation
- * Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020 Bell Canada.
* Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
import org.modelmapper.ModelMapper;
import org.onap.cps.api.CpsAdminService;
import org.onap.cps.api.CpsModuleService;
* @return a {@Link ResponseEntity} of created dataspace name & {@link HttpStatus} CREATED
*/
@Override
- public ResponseEntity<String> createDataspace(final String dataspaceName) {
+ public ResponseEntity<String> createDataspace(@NotNull @Valid final String dataspaceName) {
cpsAdminService.createDataspace(dataspaceName);
return new ResponseEntity<>(dataspaceName, HttpStatus.CREATED);
}
* @return a {@Link ResponseEntity} of created schemaset name & {@link HttpStatus} CREATED
*/
@Override
- public ResponseEntity<String> createSchemaSet(final MultipartFile multipartFile,
- final String schemaSetName, final String dataspaceName) {
+ public ResponseEntity<String> createSchemaSet(@NotNull @Valid final String schemaSetName,
+ final String dataspaceName, @Valid final MultipartFile multipartFile) {
cpsModuleService.createSchemaSet(dataspaceName, schemaSetName, extractYangResourcesMap(multipartFile));
return new ResponseEntity<>(schemaSetName, HttpStatus.CREATED);
}
@Override
public ResponseEntity<SchemaSetDetails> getSchemaSet(final String dataspaceName, final String schemaSetName) {
final var schemaSet = cpsModuleService.getSchemaSet(dataspaceName, schemaSetName);
- final SchemaSetDetails schemaSetDetails = modelMapper.map(schemaSet, SchemaSetDetails.class);
+ final var schemaSetDetails = modelMapper.map(schemaSet, SchemaSetDetails.class);
return new ResponseEntity<>(schemaSetDetails, HttpStatus.OK);
}
* @return a ResponseEntity with the anchor name & {@link HttpStatus} CREATED
*/
@Override
- public ResponseEntity<String> createAnchor(final String dataspaceName, final String schemaSetName,
- final String anchorName) {
+ public ResponseEntity<String> createAnchor(final String dataspaceName, @NotNull @Valid final String schemaSetName,
+ @NotNull @Valid final String anchorName) {
cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorName);
return new ResponseEntity<>(anchorName, HttpStatus.CREATED);
}
@Override
public ResponseEntity<AnchorDetails> getAnchor(final String dataspaceName, final String anchorName) {
final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
- final AnchorDetails anchorDetails = modelMapper.map(anchor, AnchorDetails.class);
+ final var anchorDetails = modelMapper.map(anchor, AnchorDetails.class);
return new ResponseEntity<>(anchorDetails, HttpStatus.OK);
}