public Step getNextStep(Context context, XmlWorkflowItem wfi, Step currentStep, int outcome) throws IOException, WorkflowConfigurationException, WorkflowException, SQLException {
String nextStepID = currentStep.getNextStepID(outcome);
if(nextStepID != null){
Step nextStep = getStep(nextStepID);
if(nextStep == null)
throw new WorkflowException("Error while processing outcome, the following action was undefined: " + nextStepID);
if(nextStep.isValidStep(context, wfi)){
return nextStep;
} else {
return getNextStep(context, wfi, nextStep, 0);
}