@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 {