org.requirementsascode.FlowStep Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of requirementsascodecore Show documentation
Show all versions of requirementsascodecore Show documentation
Enables you to define and run executable use case specifications, in your code.
package org.requirementsascode;
import java.io.Serializable;
import java.util.Objects;
import java.util.Optional;
import org.requirementsascode.flowposition.FlowPosition;
/**
* @author b_muth
*/
public abstract class FlowStep extends Step implements Serializable {
private static final long serialVersionUID = -2926490717985964131L;
private Flow flow;
private FlowPosition flowPosition;
private FlowStep previousStepInFlow;
private Condition reactWhile;
FlowStep(String stepName, Flow flow, Condition condition) {
super(stepName, flow.getUseCase(), condition);
this.flow = flow;
}
public Flow getFlow() {
return flow;
}
public Optional getPreviousStepInFlow() {
return Optional.ofNullable(previousStepInFlow);
}
void setPreviousStepInFlow(FlowStep previousStepInFlow) {
this.previousStepInFlow = previousStepInFlow;
}
public FlowPosition getFlowPosition() {
return flowPosition;
}
void setFlowPosition(FlowPosition flowPosition) {
Objects.requireNonNull(flowPosition);
this.flowPosition = flowPosition;
}
public void orAfter(FlowStep step) {
setFlowPosition(flowPosition.orAfter(step));
}
public void setReactWhile(Condition reactWhileCondition) {
this.reactWhile = reactWhileCondition;
createLoop();
}
private void createLoop() {
getFlowPosition().orAfter(this);
}
public Condition getReactWhile() {
return reactWhile;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy