diff options
Diffstat (limited to 'cps-tbdmt-rest/src/main/java/org')
3 files changed, 58 insertions, 54 deletions
diff --git a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java index fa6fa28..d20e9f3 100644 --- a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java +++ b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/exception/TemplateExceptionHandler.java @@ -1,21 +1,22 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2021 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Wipro Limited. + * Modifications Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ package org.onap.cps.tbdmt.exception; @@ -25,6 +26,7 @@ import java.util.List; import org.onap.cps.tbdmt.model.ErrorResponse; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import org.springframework.validation.ObjectError; import org.springframework.web.bind.MethodArgumentNotValidException; @@ -70,8 +72,8 @@ public class TemplateExceptionHandler extends ResponseEntityExceptionHandler { @Override protected ResponseEntity<Object> handleMethodArgumentNotValid( - final MethodArgumentNotValidException methodArgumentNotValidException, final HttpHeaders httpHeaders, - final HttpStatus httpStatus, final WebRequest webRequest) { + final MethodArgumentNotValidException methodArgumentNotValidException, final HttpHeaders httpHeaders, + final HttpStatusCode httpStatus, final WebRequest webRequest) { final List<String> details = new ArrayList<>(); for (final ObjectError objectError : methodArgumentNotValidException.getBindingResult().getAllErrors()) { details.add(objectError.getDefaultMessage()); diff --git a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java index b7dc4f6..2d717ae 100644 --- a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java +++ b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/ExecutionController.java @@ -1,26 +1,27 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2021 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Wipro Limited. + * Modifications Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ package org.onap.cps.tbdmt.rest; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.onap.cps.tbdmt.model.ExecutionRequest; import org.onap.cps.tbdmt.service.ExecutionBusinessLogic; import org.springframework.beans.factory.annotation.Autowired; @@ -47,8 +48,8 @@ public class ExecutionController { */ @PostMapping(path = "/execute/{model}/{templateId}") public ResponseEntity<String> executeTemplate(@Valid @PathVariable final String model, - @Valid @PathVariable final String templateId, - @Valid @RequestBody final ExecutionRequest executionRequest) { + @Valid @PathVariable final String templateId, + @Valid @RequestBody final ExecutionRequest executionRequest) { final String result = executionBusinessLogic.executeTemplate(model, templateId, executionRequest); return new ResponseEntity<>(result, HttpStatus.OK); } diff --git a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java index a17130f..cdb5f9c 100644 --- a/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java +++ b/cps-tbdmt-rest/src/main/java/org/onap/cps/tbdmt/rest/TemplateController.java @@ -1,27 +1,28 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - * ================================================================================ - * Copyright (C) 2021 Wipro Limited. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Wipro Limited. + * Modifications Copyright (C) 2023 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ package org.onap.cps.tbdmt.rest; +import jakarta.validation.Valid; import java.util.Collection; -import javax.validation.Valid; import org.onap.cps.tbdmt.exception.TemplateNotFoundException; import org.onap.cps.tbdmt.model.Template; import org.onap.cps.tbdmt.model.TemplateKey; |