in flux/src/main/java/software/amazon/aws/clients/swf/flux/wf/graph/WorkflowGraphBuilder.java [310:345]
public WorkflowGraphBuilder customTransition(Class<? extends WorkflowStep> step, String resultCode,
Class<? extends WorkflowStep> nextStep) {
if (!stepImpls.containsKey(step)) {
throw new WorkflowGraphBuildException("Please add a step with addStep before defining transitions away from it.");
}
if (nextStep == null) {
throw new WorkflowGraphBuildException("Cannot transition to a null step."
+ " (Did you mean to transition to CloseWorkflow.class?)");
} else if (nextStep == step) {
throw new WorkflowGraphBuildException("Cannot transition a step to itself (the step should retry instead).");
}
if (resultCode == null || resultCode.equals("")) {
throw new WorkflowGraphBuildException("Result codes must not be blank.");
}
if (PartitionedWorkflowStep.class.isAssignableFrom(step)
&& !StepResult.VALID_PARTITIONED_STEP_RESULT_CODES.contains(resultCode)) {
throw new WorkflowGraphBuildException("Partitioned steps may not define custom result codes.");
}
if (!steps.containsKey(step)) {
steps.put(step, new HashMap<>());
} else if (steps.get(step).containsKey(resultCode)) {
throw new WorkflowGraphBuildException("Multiple transitions cannot be defined for a single result code ("
+ resultCode + ").");
} else if (!steps.get(step).isEmpty() && (StepResult.ALWAYS_RESULT_CODE.equals(resultCode)
|| steps.get(step).containsKey(StepResult.ALWAYS_RESULT_CODE))) {
throw new WorkflowGraphBuildException("Cannot define 'always' and another transition for the same step.");
}
steps.get(step).put(resultCode, nextStep);
return this;
}