private void enableStartOfIncludedFlow(Flow includedFlow) { Optional<FlowStep> optionalFirstStepOfIncludedFlow = includedFlow.getFirstStep(); optionalFirstStepOfIncludedFlow.ifPresent(this::enableStartOfFirstStepOfIncludedFlowAfterIncludeStep); }
/** * Convenience method that returns the position of the flow (as defined e.g. by * "InsteadOf"). * * <p> * Internally this calls the method of the same name of the first step in the * flow. * * @return the flow position, or null if the flow is empty. */ public FlowPosition getFlowPosition() { FlowPosition flowPosition = getFirstStep().map(step -> step.getFlowPosition()).orElse(null); return flowPosition; }
/** * Convenience method that returns the condition of the flow. * * <p> * Internally this calls the method of the same name of the first step in the * flow. * * @return the condition */ public Optional<Condition> getCondition() { Optional<Condition> condition = getFirstStep().flatMap(step -> step.getCondition()); return condition; } }
@Test public void implicitlyCreatesEmptyBasicFlow() { modelBuilder.useCase(USE_CASE); Model model = modelBuilder.build(); UseCase useCase = model.findUseCase(USE_CASE); Collection<Flow> flows = useCase.getFlows(); assertEquals(1, flows.size()); assertEquals(useCase.getBasicFlow(), flows.iterator().next()); assertFalse(useCase.getBasicFlow().getFirstStep().isPresent()); }