* org.apache.lenya.workflow.Workflow, Situation, java.lang.String)
*/
public void invoke(Workflowable workflowable, Workflow workflow, Situation situation,
String event) throws WorkflowException {
Transition firingTransition = null;
List firingTransitions = getFiringTransitions(workflowable, workflow, situation, event);
if (firingTransitions.size() == 0) {
throw new WorkflowException("No transition can fire!");
} else if (firingTransitions.size() > 1) {
throw new WorkflowException("More than one transitions can fire!");
} else {
firingTransition = (Transition) firingTransitions.get(0);
}
String destination = firingTransition.getDestination();
Version newVersion = createNewVersion(workflowable, workflow, event, destination);
Action[] actions = firingTransition.getActions();
for (int i = 0; i < actions.length; i++) {
actions[i].execute(newVersion);
}
workflowable.newVersion(workflow, newVersion, situation);