From 157f8cb05752a6bff2b7b9ad192acba4b6def6c3 Mon Sep 17 00:00:00 2001 From: Lathish Date: Fri, 11 Dec 2020 14:47:43 +0000 Subject: Global Exception Handler Issue-ID: CCSDK-3054 Change-Id: I0281e616b58bb405b4f79d046af5c30b82753ea0 Signed-off-by: Lathish --- a1-policy-management/api/pms-api.json | 35 +++---- .../controllers/v1/PolicyController.java | 102 ++++++++------------ .../controllers/v1/RicRepositoryController.java | 16 ++-- .../controllers/v2/ErrorResponse.java | 4 +- .../controllers/v2/PolicyController.java | 103 +++++++++------------ .../controllers/v2/RicRepositoryController.java | 45 ++++----- .../exceptions/EntityNotFoundException.java | 34 +++++++ .../exceptions/GlobalExceptionHandler.java | 43 +++++++++ .../exceptions/InvalidRequestException.java | 34 +++++++ .../repository/Policies.java | 6 +- .../repository/PolicyTypes.java | 6 +- .../a1policymanagementservice/repository/Rics.java | 13 ++- 12 files changed, 254 insertions(+), 187 deletions(-) create mode 100644 a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/exceptions/EntityNotFoundException.java create mode 100644 a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/exceptions/GlobalExceptionHandler.java create mode 100644 a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/exceptions/InvalidRequestException.java diff --git a/a1-policy-management/api/pms-api.json b/a1-policy-management/api/pms-api.json index 173d8df1..126eab56 100644 --- a/a1-policy-management/api/pms-api.json +++ b/a1-policy-management/api/pms-api.json @@ -17,7 +17,7 @@ "401": {"description": "Unauthorized"}, "403": {"description": "Forbidden"}, "404": { - "schema": {"type": "string"}, + "schema": {"$ref": "#/definitions/error_information"}, "description": "Near-RT RIC is not found" } }, @@ -79,7 +79,7 @@ "summary": "Returns service information", "deprecated": false, "produces": ["*/*"], - "operationId": "getServicesUsingGET", + "operationId": "getServicesUsingGET_1", "responses": { "200": { "schema": { @@ -109,7 +109,7 @@ "summary": "Delete a service", "deprecated": false, "produces": ["*/*"], - "operationId": "deleteServiceUsingDELETE", + "operationId": "deleteServiceUsingDELETE_1", "responses": { "200": { "schema": {"type": "string"}, @@ -141,7 +141,7 @@ "summary": "Unregister a service", "deprecated": false, "produces": ["*/*"], - "operationId": "deleteServiceUsingDELETE_1", + "operationId": "deleteServiceUsingDELETE", "responses": { "200": {"description": "Not used"}, "401": {"description": "Unauthorized"}, @@ -177,7 +177,10 @@ }, "401": {"description": "Unauthorized"}, "403": {"description": "Forbidden"}, - "404": {"description": "Policy is not found"} + "404": { + "schema": {"$ref": "#/definitions/error_information"}, + "description": "Policy is not found" + } }, "parameters": [{ "in": "query", @@ -409,7 +412,7 @@ "401": {"description": "Unauthorized"}, "403": {"description": "Forbidden"}, "404": { - "schema": {"type": "string"}, + "schema": {"$ref": "#/definitions/error_information"}, "description": "The policy type is not found" } }, @@ -427,7 +430,7 @@ "summary": "Query Near-RT RIC information", "deprecated": false, "produces": ["*/*"], - "operationId": "getRicsUsingGET", + "operationId": "getRicsUsingGET_1", "responses": { "200": { "schema": { @@ -511,7 +514,7 @@ "deprecated": false, "produces": ["application/json"], "description": "The call returns all Near-RT RICs that supports a given policy type identity", - "operationId": "getRicsUsingGET_1", + "operationId": "getRicsUsingGET", "responses": { "200": { "schema": {"$ref": "#/definitions/ric_info_list_v2"}, @@ -651,7 +654,7 @@ "401": {"description": "Unauthorized"}, "403": {"description": "Forbidden"}, "404": { - "schema": {"type": "string"}, + "schema": {"$ref": "#/definitions/error_information"}, "description": "Near-RT RIC is not found" } }, @@ -717,7 +720,7 @@ "deprecated": false, "produces": ["application/json"], "description": "Either information about a registered service with given identity or all registered services are returned.", - "operationId": "getServicesUsingGET_1", + "operationId": "getServicesUsingGET", "responses": { "200": { "schema": {"$ref": "#/definitions/service_list_v2"}, @@ -745,7 +748,7 @@ "deprecated": false, "produces": ["*/*"], "description": "Registering a service is needed to: