aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
index fc5769632b..21129d7c2d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
@@ -138,4 +138,72 @@ public class OrchestrationTasks {
}
}
+ @PUT
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Update an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response UpdateOrchestrationTask(@PathParam("taskId") String taskId, String requestJson,
+ @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Update", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+
+ try {
+ OrchestrationTask orchestrationTask = mapper.readValue(requestJson, OrchestrationTask.class);
+ requestsDbClient.updateOrchestrationTask(taskId, orchestrationTask);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Update", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
+ @DELETE
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Delete an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response DeleteOrchestrationTask(@PathParam("taskId") String taskId, @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+
+ try {
+ requestsDbClient.deleteOrchestrationTask(taskId);
+ return builder.buildResponse(HttpStatus.SC_OK, null, null, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
}