@Test public void isAllowedNextActionReturnsTrueForMovingToFailureState() { WorkflowInstance instance = new WorkflowInstance.Builder().setState("begin").build(); NextAction nextAction = moveToState(TestWorkflow.State.failed, "reason"); assertThat(workflow.isAllowedNextAction(instance, nextAction), is(true)); }
public boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction) { if (nextAction.isRetry()) { return true; } List<String> allowedNextStates = allowedTransitions.get(instance.state); if (allowedNextStates != null && allowedNextStates.contains(nextAction.getNextState().name())) { return true; } if (nextAction.getNextState() == failureTransitions.get(instance.state)) { return true; } return nextAction.getNextState() == getErrorState(); }
AbstractWorkflowDefinition extends ModelObject { public boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction) { if (nextAction.isRetry()) { return true; } List<String> allowedNextStates = allowedTransitions.get(instance.state); if (allowedNextStates != null && allowedNextStates.contains(nextAction.getNextState().name())) { return true; } if (nextAction.getNextState() == failureTransitions.get(instance.state)) { return true; } return nextAction.getNextState() == getErrorState(); } }
AbstractWorkflowDefinition extends ModelObject { public boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction) { if (nextAction.isRetry()) { return true; } List<String> allowedNextStates = allowedTransitions.get(instance.state); if (allowedNextStates != null && allowedNextStates.contains(nextAction.getNextState().name())) { return true; } if (nextAction.getNextState() == failureTransitions.get(instance.state)) { return true; } return nextAction.getNextState() == getErrorState(); } protected  AbstractWorkflowDefinition(String type, S initialState, S errorState); protected  AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings); protected  AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings,
      Map<String, WorkflowStateMethod> stateMethods); }
AbstractWorkflowDefinition extends ModelObject { public boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction) { if (nextAction.isRetry()) { return true; } List<String> allowedNextStates = allowedTransitions.get(instance.state); if (allowedNextStates != null && allowedNextStates.contains(nextAction.getNextState().name())) { return true; } if (nextAction.getNextState() == failureTransitions.get(instance.state)) { return true; } return nextAction.getNextState() == getErrorState(); } protected  AbstractWorkflowDefinition(String type, S initialState, S errorState); protected  AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings); protected  AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings,
      Map<String, WorkflowStateMethod> stateMethods); String getName(); void setName(String name); String getDescription(); void setDescription(String description); String getType(); S getInitialState(); S getErrorState(); abstract Set<S> getStates(); Map<String, List<String>> getAllowedTransitions(); Map<String, WorkflowState> getFailureTransitions(); WorkflowSettings getSettings(); WorkflowStateMethod getMethod(String stateName); WorkflowState getState(String state); boolean isStartState(String state); boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction); Map<Integer, String> getSupportedSignals(); }
AbstractWorkflowDefinition extends ModelObject { public boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction) { if (nextAction.isRetry()) { return true; } List<String> allowedNextStates = allowedTransitions.get(instance.state); if (allowedNextStates != null && allowedNextStates.contains(nextAction.getNextState().name())) { return true; } if (nextAction.getNextState() == failureTransitions.get(instance.state)) { return true; } return nextAction.getNextState() == getErrorState(); } protected  AbstractWorkflowDefinition(String type, S initialState, S errorState); protected  AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings); protected  AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings,
      Map<String, WorkflowStateMethod> stateMethods); String getName(); void setName(String name); String getDescription(); void setDescription(String description); String getType(); S getInitialState(); S getErrorState(); abstract Set<S> getStates(); Map<String, List<String>> getAllowedTransitions(); Map<String, WorkflowState> getFailureTransitions(); WorkflowSettings getSettings(); WorkflowStateMethod getMethod(String stateName); WorkflowState getState(String state); boolean isStartState(String state); boolean isAllowedNextAction(WorkflowInstance instance, NextAction nextAction); Map<Integer, String> getSupportedSignals();  }