Add REST Apis for Tosca Node template operations
[policy/api.git] / main / src / main / java / org / onap / policy / api / main / rest / ApiRestController.java
index 263345a..c564dbe 100644 (file)
@@ -4,7 +4,7 @@
  * ================================================================================\r
  * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.\r
  * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.\r
- * Modifications Copyright (C) 2020 Nordix Foundation.\r
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation.\r
  * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
@@ -61,7 +61,6 @@ import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;\r
 import org.springframework.http.ResponseEntity;\r
 import org.springframework.web.bind.annotation.DeleteMapping;\r
-import org.springframework.web.bind.annotation.ExceptionHandler;\r
 import org.springframework.web.bind.annotation.GetMapping;\r
 import org.springframework.web.bind.annotation.PathVariable;\r
 import org.springframework.web.bind.annotation.PostMapping;\r
@@ -95,43 +94,6 @@ import org.springframework.web.bind.annotation.RestController;
     securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))\r
 public class ApiRestController extends CommonRestController {\r
 \r
-    private static final Logger LOGGER = LoggerFactory.getLogger(ApiRestController.class);\r
-\r
-    private static final String ERROR_MESSAGE_NO_POLICIES_FOUND = "No policies found";\r
-\r
-    private static final String EXTENSION_NAME = "interface info";\r
-\r
-    private static final String API_VERSION_NAME = "api-version";\r
-    private static final String API_VERSION = "1.0.0";\r
-\r
-    private static final String LAST_MOD_NAME = "last-mod-release";\r
-\r
-    private static final String AUTHORIZATION_TYPE = "basicAuth";\r
-\r
-    private static final String VERSION_MINOR_NAME = "X-MinorVersion";\r
-    private static final String VERSION_MINOR_DESCRIPTION =\r
-        "Used to request or communicate a MINOR version back from the client"\r
-            + " to the server, and from the server back to the client";\r
-\r
-    private static final String VERSION_PATCH_NAME = "X-PatchVersion";\r
-    private static final String VERSION_PATCH_DESCRIPTION = "Used only to communicate a PATCH version in a response for"\r
-        + " troubleshooting purposes only, and will not be provided by" + " the client on request";\r
-\r
-    private static final String VERSION_LATEST_NAME = "X-LatestVersion";\r
-    private static final String VERSION_LATEST_DESCRIPTION = "Used only to communicate an API's latest version";\r
-\r
-    private static final String REQUEST_ID_NAME = "X-ONAP-RequestID";\r
-    private static final String REQUEST_ID_HDR_DESCRIPTION = "Used to track REST transactions for logging purpose";\r
-    private static final String REQUEST_ID_PARAM_DESCRIPTION = "RequestID for http transaction";\r
-\r
-    private static final String AUTHENTICATION_ERROR_MESSAGE = "Authentication Error";\r
-    private static final String AUTHORIZATION_ERROR_MESSAGE = "Authorization Error";\r
-    private static final String SERVER_ERROR_MESSAGE = "Internal Server Error";\r
-    private static final String NOT_FOUND_MESSAGE = "Resource Not Found";\r
-    private static final String INVALID_BODY_MESSAGE = "Invalid Body";\r
-    private static final String INVALID_PAYLOAD_MESSAGE = "Not Acceptable Payload";\r
-    private static final String HTTP_CONFLICT_MESSAGE = "Delete Conflict, Rule Violation";\r
-\r
     private enum Target {\r
         POLICY,\r
         POLICY_TYPE,\r
@@ -1090,13 +1052,6 @@ public class ApiRestController extends CommonRestController {
         }\r
     }\r
 \r
-    @ExceptionHandler(value = {PolicyApiRuntimeException.class})\r
-    protected ResponseEntity<Object> handleException(PolicyApiRuntimeException ex) {\r
-        LOGGER.warn(ex.getMessage(), ex.getCause());\r
-        return makeErrorResponse(ex.getRequestId(), ex.getErrorResponse(),\r
-            ex.getErrorResponse().getResponseCode().getStatusCode());\r
-    }\r
-\r
     private void updateApiStatisticsCounter(Target target, HttpStatus result, HttpMethod http) {\r
         mgr.updateTotalApiCallCount();\r
         switch (target) {\r