/** * Creates the first step of this flow. It can be interrupted by any other flow * that has an explicit condition. It can be run when no other step has been run * before. * * @param stepName * the name of the step to be created * @return the newly created step part, to ease creation of further steps * @throws ElementAlreadyInModel * if a step with the specified name already * exists in the use case */ public StepPart step(String stepName) { FlowStep step = useCase.newInterruptableFlowStep(stepName, flow); StepPart stepPart = new StepPart(step, useCasePart, FlowPart.this); return stepPart; }
private StepPart createStepPart(Condition optionalCondition, Class<T> eventOrExceptionClass, String stepName) { FlowlessStep newStep = useCase.newFlowlessStep(stepName); newStep.setCondition(optionalCondition); StepPart stepPart = new StepPart(newStep, UseCasePart.this, null); return stepPart; }
/** * Creates a new step in this flow, with the specified name, that follows the * current step in sequence. * * @param stepName * the name of the step to be created * @return the newly created step * @throws ElementAlreadyInModel * if a step with the specified name already exists in the use case */ public StepPart step(String stepName) { Objects.requireNonNull(stepName); FlowPart flowPart = stepPart.getFlowPart(); FlowStep trailingStepInFlow = createTrailingStepInFlow(stepName, flowPart); StepPart trailingStepInFlowPart = new StepPart(trailingStepInFlow, stepPart.getUseCasePart(), flowPart); return trailingStepInFlowPart; }
/** * Creates the first step of this flow. It can be run when the runner is at the * right position. * * @param stepName * the name of the step to be created * @return the newly created step part, to ease creation of further steps * @throws ElementAlreadyInModel * if a step with the specified name already * exists in the use case */ public StepPart step(String stepName) { UseCasePart useCasePart = flowPart.getUseCasePart(); UseCase useCase = useCasePart.getUseCase(); Flow flow = flowPart.getFlow(); Condition condition = conditionPart.getCondition(); FlowStep step = useCase.newInterruptingFlowStep(stepName, flow, flowPosition, condition); StepPart stepPart = new StepPart(step, useCasePart, flowPart); return stepPart; } }