/** * Starts the flow after any step that has been run, or at the beginning. * * @return the flow position part, to ease creation of the condition and the * first step of the flow */ public FlowPositionPart anytime() { Anytime anytime = new Anytime(); optionalFlowPositionPart = new FlowPositionPart(anytime, this); return optionalFlowPositionPart; }
/** * Constrains the flow's condition: only if the specified condition is true, the * flow is started. * * @param condition * the condition that constrains when the flow is started * @return the condition part, to ease creation of the first step of the flow */ public ConditionPart condition(Condition condition) { Objects.requireNonNull(condition); optionalFlowPositionPart = new FlowPositionPart(new Anytime(), this); ConditionPart conditionPart = optionalFlowPositionPart.condition(condition); return conditionPart; }
/** * Starts the flow as an alternative to the specified step, in this flow's use * case. * * @param stepName * the name of the specified step * @return the flow position part, to ease creation of the condition and the * first step of the flow * @throws NoSuchElementInModel * if the specified step is not found in this * flow's use case */ public FlowPositionPart insteadOf(String stepName) { FlowStep step = (FlowStep) useCase.findStep(stepName); InsteadOf insteadOf = new InsteadOf(step); optionalFlowPositionPart = new FlowPositionPart(insteadOf, this); return optionalFlowPositionPart; }
/** * Starts the flow after the specified step has been run, in this flow's use * case. * * Note: You should use after to handle exceptions that occurred in the * specified step. * * @param stepName * the name of the step to start the flow after * @return the flow position part, to ease creation of the condition and the * first step of the flow * @throws NoSuchElementInModel * if the specified step is not found in a flow * of this use case * */ public FlowPositionPart after(String stepName) { Step step = useCase.findStep(stepName); After after = new After((FlowStep) step); optionalFlowPositionPart = new FlowPositionPart(after, this); return optionalFlowPositionPart; }