Tabnine Logo
StateTransition
Code IndexAdd Tabnine to your IDE (free)

How to use
StateTransition
in
org.springframework.batch.core.job.flow.support

Best Java code snippets using org.springframework.batch.core.job.flow.support.StateTransition (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

private void addTransition(String pattern, State next) {
  tos.put(next.getName(), next);
  transitions.add(StateTransition.createStateTransition(currentState, pattern, next.getName()));
  if (transitions.size() == 1) {
    transitions.add(StateTransition.createEndStateTransition(failedState));
    transitions.add(StateTransition.createEndStateTransition(completedState));
    transitions.add(StateTransition.createEndStateTransition(stoppedState));
  }
  if (next.isEndState()) {
    transitions.add(StateTransition.createEndStateTransition(next));
  }
  dirty = true;
}
origin: spring-projects/spring-batch

if (stateTransition.matches(exitCode) || (exitCode.equals("PENDING") && stateTransition.matches("STOPPED"))) {
  if (stateTransition.isEnd()) {
  next = stateTransition.getNext();
  break;
origin: spring-projects/spring-batch

/**
 * Create a new {@link StateTransition} specification from one {@link State}
 * to another (by name).
 *
 * @param state the {@link State} used to generate the outcome for this
 * transition
 * @param pattern the pattern to match in the exit status of the
 * {@link State} (can be {@code null})
 * @param next the name of the next {@link State} to execute (can be {@code null})
 * @return {@link StateTransition} that was created.
 */
public static StateTransition createStateTransition(State state, @Nullable String pattern, @Nullable String next) {
  return new StateTransition(state, pattern, next);
}
origin: spring-projects/spring-batch

private boolean matches(String from, String status) {
  for (StateTransition transition : transitions) {
    if (from.equals(transition.getState().getName()) && transition.matches(status)) {
      return true;
    }
  }
  return false;
}
origin: spring-projects/spring-batch

@Override
public SimpleFlow getObject() throws Exception {
  SimpleFlow flow = flowType.getConstructor(String.class).newInstance(name);
  flow.setStateTransitionComparator(stateTransitionComparator);
  List<StateTransition> updatedTransitions = new ArrayList<>();
  for (StateTransition stateTransition : stateTransitions) {
    State state = getProxyState(stateTransition.getState());
    updatedTransitions.add(StateTransition.switchOriginAndDestination(stateTransition, state,
        getNext(stateTransition.getNext())));
  }
  flow.setStateTransitions(updatedTransitions);
  flow.afterPropertiesSet();
  return flow;
}
origin: spring-projects/spring-batch

  State state = stateTransition.getState();
  String stateName = state.getName();
  stateMap.put(stateName, state);
  State state = stateTransition.getState();
  if (!stateTransition.isEnd()) {
    String next = stateTransition.getNext();
startState = stateTransitions.get(0).getState();
origin: spring-projects/spring-batch

@Test
public void testMatchesStar() {
  StateTransition transition = StateTransition.createStateTransition(state, "*", "start");
  assertTrue(transition.matches("CONTINUABLE"));
}
origin: spring-projects/spring-batch

@Test
public void testIsEnd() {
  StateTransition transition = StateTransition.createEndStateTransition(state, "");
  assertTrue(transition.isEnd());
  assertNull(transition.getNext());
}
origin: spring-projects/spring-batch

/**
 * Create a new end state {@link StateTransition} specification. This
 * transition explicitly goes unconditionally to an end state (i.e. no more
 * executions).
 *
 * @param state the {@link State} used to generate the outcome for this
 * transition
 * @return {@link StateTransition} that was created.
 */
public static StateTransition createEndStateTransition(State state) {
  return createStateTransition(state, null, null);
}
origin: spring-projects/spring-batch

@Test
public void testGetStateDoesNotExist() throws Exception {
  flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
      "step1"))));
  flow.afterPropertiesSet();
  State state = flow.getState("bar");
  assertNull(state);
}
origin: spring-projects/spring-batch

private void addDanglingEndStates() {
  Set<String> froms = new HashSet<>();
  for (StateTransition transition : transitions) {
    froms.add(transition.getState().getName());
origin: spring-projects/spring-batch

@Test
public void testToString() {
  StateTransition transition = StateTransition.createStateTransition(state, "CONTIN???LE", "start");
  String string = transition.toString();
  assertTrue("Wrong string: " + string, string.contains("Transition"));
  assertTrue("Wrong string: " + string, string.contains("start"));
  assertTrue("Wrong string: " + string, string.contains("CONTIN???LE"));
  assertTrue("Wrong string: " + string, string.contains("next="));
}
origin: spring-projects/spring-batch

  @Override
  public int compare(StateTransition arg0, StateTransition arg1) {
    String value = arg1.getPattern();
    if (arg0.getPattern().equals(value)) {
      return 0;
    }
    int patternCount = StringUtils.countOccurrencesOf(arg0.getPattern(), "*");
    int valueCount = StringUtils.countOccurrencesOf(value, "*");
    if (patternCount > valueCount) {
      return 1;
    }
    if (patternCount < valueCount) {
      return -1;
    }
    patternCount = StringUtils.countOccurrencesOf(arg0.getPattern(), "?");
    valueCount = StringUtils.countOccurrencesOf(value, "?");
    if (patternCount > valueCount) {
      return 1;
    }
    if (patternCount < valueCount) {
      return -1;
    }
    return arg0.getPattern().compareTo(value);
  }
}
origin: org.springframework.batch/org.springframework.batch.core

  State state = stateTransition.getState();
  String stateName = state.getName();
  stateMap.put(stateName, state);
  State state = stateTransition.getState();
  if (!stateTransition.isEnd()) {
    String next = stateTransition.getNext();
startState = stateTransitions.get(0).getState();
origin: org.springframework.batch/org.springframework.batch.core

public Object getObject() throws Exception {
  SimpleFlow flow = new SimpleFlow(name);
  List<StateTransition> updatedTransitions = new ArrayList<StateTransition>();
  for (StateTransition stateTransition : stateTransitions) {
    State state = getProxyState(stateTransition.getState());
    updatedTransitions.add(StateTransition.switchOriginAndDestination(stateTransition, state,
        getNext(stateTransition.getNext())));
  }
  flow.setStateTransitions(updatedTransitions);
  flow.afterPropertiesSet();
  return flow;
}
origin: spring-projects/spring-batch

@Test
public void testMatchesNull() {
  StateTransition transition = StateTransition.createStateTransition(state, null, "start");
  assertTrue(transition.matches("CONTINUABLE"));
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

private boolean matches(String from, String status) {
  for (StateTransition transition : transitions) {
    if (from.equals(transition.getState().getName()) && transition.matches(status)) {
      return true;
    }
  }
  return false;
}
origin: spring-projects/spring-batch

/**
 * Create a new state {@link StateTransition} specification with a wildcard
 * pattern that matches all outcomes.
 *
 * @param state the {@link State} used to generate the outcome for this
 * transition
 * @param next the name of the next {@link State} to execute
 * @return {@link StateTransition} that was created.
 */
public static StateTransition createStateTransition(State state, String next) {
  return createStateTransition(state, null, next);
}
origin: spring-projects/spring-batch

@Test
public void testUnconnectedSteps() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createEndStateTransition(new StubState("step1")),
      StateTransition.createEndStateTransition(new StubState("step2"))));
  flow.afterPropertiesSet();
  FlowExecution execution = flow.start(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step1", execution.getName());
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

private void addDanglingEndStates() {
  Set<String> froms = new HashSet<String>();
  for (StateTransition transition : transitions) {
    froms.add(transition.getState().getName());
org.springframework.batch.core.job.flow.supportStateTransition

Javadoc

Value object representing a potential transition from one State to another. The originating State name and the next State to execute are linked by a pattern for the ExitStatus#getExitCode() of an execution of the originating State.

Most used methods

  • createStateTransition
    Create a new StateTransition specification from one Stateto another (by name).
  • getNext
    Public getter for the next State name.
  • isEnd
    Check for a special next State signalling the end of a job.
  • matches
    Check if the provided status matches the pattern, signalling that the next State should be executed.
  • <init>
  • createEndStateTransition
    Create a new end state StateTransition specification. This transition explicitly goes to an end stat
  • getState
    Public getter for the State.
  • switchOriginAndDestination
    Convenience method to switch the origin and destination of a transition, creating a new instance.
  • getPattern
  • toString

Popular in Java

  • Making http post requests using okhttp
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BoxLayout (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now