@RequestMapping( value = "/history/historic-task-instances/{taskId}", method = RequestMethod.DELETE) public void deleteTaskInstance(@PathVariable String taskId, HttpServletResponse response) { historyService.deleteHistoricTaskInstance(taskId); response.setStatus(HttpStatus.NO_CONTENT.value()); }
@RequestMapping( value = "/runtime/executions/{executionId}", method = RequestMethod.PUT, produces = "application/json") public ExecutionResponse performExecutionAction( @PathVariable String executionId, @RequestBody ExecutionActionRequest actionRequest, HttpServletRequest request, HttpServletResponse response) { Execution execution = getExecutionFromRequest(executionId); if (ExecutionActionRequest.ACTION_SIGNAL.equals(actionRequest.getAction())) { if (actionRequest.getVariables() != null) { runtimeService.signal(execution.getId(), getVariablesToSet(actionRequest)); } else { runtimeService.signal(execution.getId()); } } else if (ExecutionActionRequest.ACTION_SIGNAL_EVENT_RECEIVED.equals( actionRequest.getAction())) { if (actionRequest.getSignalName() == null) { throw new ActivitiIllegalArgumentException("Signal name is required"); } if (actionRequest.getVariables() != null) { runtimeService.signalEventReceived( actionRequest.getSignalName(), execution.getId(), getVariablesToSet(actionRequest)); } else { runtimeService.signalEventReceived(actionRequest.getSignalName(), execution.getId()); } } else if (ExecutionActionRequest.ACTION_MESSAGE_EVENT_RECEIVED.equals( actionRequest.getAction())) { if (actionRequest.getMessageName() == null) { throw new ActivitiIllegalArgumentException("Message name is required"); } if (actionRequest.getVariables() != null) { runtimeService.messageEventReceived( actionRequest.getMessageName(), execution.getId(), getVariablesToSet(actionRequest)); } else { runtimeService.messageEventReceived(actionRequest.getMessageName(), execution.getId()); } } else { throw new ActivitiIllegalArgumentException( "Invalid action: '" + actionRequest.getAction() + "'."); } // Re-fetch the execution, could have changed due to action or even completed execution = runtimeService.createExecutionQuery().executionId(execution.getId()).singleResult(); if (execution == null) { // Execution is finished, return empty body to inform user response.setStatus(HttpStatus.NO_CONTENT.value()); return null; } else { String serverRootUrl = request.getRequestURL().toString(); serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/runtime/executions/")); return restResponseFactory.createExecutionResponse(execution, serverRootUrl); } }
@RequestMapping(value = "/runtime/tasks/{taskId}/events/{eventId}", method = RequestMethod.DELETE) public void deleteEvent( @PathVariable("taskId") String taskId, @PathVariable("eventId") String eventId, HttpServletResponse response) { // Check if task exists Task task = getTaskFromRequest(taskId); Event event = taskService.getEvent(eventId); if (event == null || event.getTaskId() == null || !event.getTaskId().equals(task.getId())) { throw new ActivitiObjectNotFoundException( "Task '" + task.getId() + "' doesn't have an event with id '" + event + "'.", Event.class); } taskService.deleteComment(eventId); response.setStatus(HttpStatus.NO_CONTENT.value()); }