All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.requirementsascode.flowposition.InsteadOf Maven / Gradle / Ivy

There is a newer version: 2.0
Show newest version
package org.requirementsascode.flowposition;

import org.requirementsascode.FlowStep;
import org.requirementsascode.ModelRunner;
import org.requirementsascode.UseCase;

public class InsteadOf extends FlowPosition{
  private String stepName;
  private FlowStep step;
  
	public InsteadOf(String stepName, UseCase useCase) {
	  super(useCase);
	  this.stepName = stepName;
  }

  @Override
	protected boolean isRunnerAtRightPositionFor(ModelRunner modelRunner) {
      FlowPosition flowPosition = step.getFlowPosition();
      return flowPosition.test(modelRunner);
	}
  
  public void resolveSteps() {
    if(step == null) {
      FlowStep resolvedStep = null;
      
      UseCase useCase = getUseCase();
      String stepName = getStepName();
      if (useCase != null && stepName != null) {
        resolvedStep = (FlowStep) useCase.findStep(stepName);
      }
      
      this.step = resolvedStep;
    }
  }
  
  public final String getStepName() {
    return stepName;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy