10-18-2013 05:09 AM
@Put
public ExecutionResponse performExecutionAction(ExecutionActionRequest actionRequest) {
if(!authenticate()) {
return null;
}
Execution execution = getExecutionFromRequest();
if(ExecutionActionRequest.ACTION_SIGNAL.equals(actionRequest.getAction())) {
if(actionRequest.getVariables() != null) { // <—– ADDED
ActivitiUtil.getRuntimeService().signal(execution.getId(), getVariablesToSet(actionRequest)); // <—– ADDED
} else { // <—– ADDED
ActivitiUtil.getRuntimeService().signal(execution.getId());
} // <—– ADDED
} 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) {
ActivitiUtil.getRuntimeService().signalEventReceived(actionRequest.getSignalName(), execution.getId(), getVariablesToSet(actionRequest));
} else {
ActivitiUtil.getRuntimeService().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) {
ActivitiUtil.getRuntimeService().messageEventReceived(actionRequest.getMessageName(), execution.getId(), getVariablesToSet(actionRequest));
} else {
ActivitiUtil.getRuntimeService().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 = ActivitiUtil.getRuntimeService().createExecutionQuery().executionId(execution.getId()).singleResult();
if(execution == null) {
// Execution is finished, return empty body to inform user
setStatus(Status.SUCCESS_NO_CONTENT);
return null;
} else {
return getApplication(ActivitiRestServicesApplication.class).getRestResponseFactory()
.createExecutionResponse(this, execution);
}
}
10-21-2013 07:10 AM
10-21-2013 07:17 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.