congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
StepState
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: spring-projects/spring-batch

private State createState(Object input) {
  State result;
  if (input instanceof Step) {
    if (!states.containsKey(input)) {
      Step step = (Step) input;
      states.put(input, new StepState(prefix + step.getName(), step));
    }
    result = states.get(input);
  }
  else if (input instanceof JobExecutionDecider) {
    if (!states.containsKey(input)) {
      states.put(input, new DecisionState((JobExecutionDecider) input, prefix + "decision"
          + (decisionCounter++)));
    }
    result = states.get(input);
  }
  else if (input instanceof Flow) {
    if (!states.containsKey(input)) {
      states.put(input, new FlowState((Flow) input, prefix + ((Flow) input).getName()));
    }
    result = states.get(input);
  }
  else {
    throw new FlowBuilderException("No state can be created for: " + input);
  }
  dirty = true;
  return result;
}
origin: spring-projects/spring-batch

/**
 * Provides an extension point to provide alternative {@link StepState}
 * implementations within a {@link SimpleFlow}
 *
 * @param state The state that will be used to create the StepState
 * @param oldName The name to be replaced
 * @param stateName The name for the new State
 * @return a state for the requested data
 */
protected State createNewStepState(State state, String oldName,
    String stateName) {
  return new StepState(stateName, ((StepState) state).getStep(oldName));
}
origin: spring-projects/spring-batch

  @Override
  public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
    FlowExecutionStatus result = super.handle(executor);

    executor.getJobExecution().getExecutionContext().put("batch.lastSteps", Collections.singletonList(getStep().getName()));

    return result;
  }
}
origin: spring-projects/spring-batch

@Bean
public SimpleFlow simpleFlow() {
  SimpleFlow simpleFlow = new SimpleFlow("simpleFlow");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(dummyStep()), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  simpleFlow.setStateTransitions(transitions);
  return simpleFlow;
}

origin: org.springframework.batch/spring-batch-core

/**
 * Provides an extension point to provide alternative {@link StepState}
 * implementations within a {@link SimpleFlow}
 *
 * @param state The state that will be used to create the StepState
 * @param oldName The name to be replaced
 * @param stateName The name for the new State
 * @return a state for the requested data
 */
protected State createNewStepState(State state, String oldName,
    String stateName) {
  return new StepState(stateName, ((StepState) state).getStep(oldName));
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

  @Override
  public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
    FlowExecutionStatus result = super.handle(executor);

    executor.getJobExecution().getExecutionContext().put("batch.lastSteps", Collections.singletonList(getStep().getName()));

    return result;
  }
}
origin: spring-projects/spring-batch

@Test
public void testGetSteps() throws Exception {
  SimpleFlow flow = new JsrFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  assertEquals(2, job.getStepNames().size());
}
origin: org.springframework.batch.core/org.motechproject.org.springframework.batch.core

/**
 * Provides an extension point to provide alternative {@link StepState}
 * implementations within a {@link SimpleFlow}
 *
 * @param state The state that will be used to create the StepState
 * @param oldName The name to be replaced
 * @param stateName The name for the new State
 * @return
 */
protected State createNewStepState(State state, String oldName,
    String stateName) {
  return new StepState(stateName, ((StepState) state).getStep(oldName));
}
origin: org.springframework.batch/spring-batch-core

  @Override
  public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
    FlowExecutionStatus result = super.handle(executor);

    executor.getJobExecution().getExecutionContext().put("batch.lastSteps", Collections.singletonList(getStep().getName()));

    return result;
  }
}
origin: spring-projects/spring-batch

@Test
public void testGetSteps() throws Exception {
  SimpleFlow flow = new SimpleFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  assertEquals(2, job.getStepNames().size());
}
origin: apache/servicemix-bundles

/**
 * Provides an extension point to provide alternative {@link StepState}
 * implementations within a {@link SimpleFlow}
 *
 * @param state The state that will be used to create the StepState
 * @param oldName The name to be replaced
 * @param stateName The name for the new State
 * @return a state for the requested data
 */
protected State createNewStepState(State state, String oldName,
    String stateName) {
  return new StepState(stateName, ((StepState) state).getStep(oldName));
}
origin: apache/servicemix-bundles

  @Override
  public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
    FlowExecutionStatus result = super.handle(executor);

    executor.getJobExecution().getExecutionContext().put("batch.lastSteps", Collections.singletonList(getStep().getName()));

    return result;
  }
}
origin: spring-projects/spring-batch

@Test
public void testGetStepNotStepState() throws Exception {
  SimpleFlow flow = new SimpleFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  Step step = job.getStep("end0");
  assertNull(step);
}
origin: org.springframework.batch/org.springframework.batch.core

/**
 * Convenience method to get a state that proxies the input but with a
 * different name, appropriate to this flow. If the state is a StepState
 * then the step name is also changed.
 * 
 * @param state
 * @return
 */
private State getProxyState(State state) {
  String oldName = state.getName();
  if (oldName.startsWith(prefix)) {
    return state;
  }
  String stateName = prefix + oldName;
  if (state instanceof StepState) {
    return new StepState(stateName, ((StepState) state).getStep());
  }
  return new DelegateState(stateName, state);
}
origin: spring-projects/spring-batch

@Test
public void testGetStepNotExists() throws Exception {
  SimpleFlow flow = new SimpleFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  Step step = job.getStep("foo");
  assertNull(step);
}
origin: spring-projects/spring-batch

@Test
public void testGetStepNotExists() throws Exception {
  SimpleFlow flow = new JsrFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  Step step = job.getStep("foo");
  assertNull(step);
}
origin: spring-projects/spring-batch

@Test
public void testGetStepNotStepState() throws Exception {
  SimpleFlow flow = new JsrFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  Step step = job.getStep("end0");
  assertNull(step);
}
origin: spring-projects/spring-batch

@Test
public void testGetStepNestedFlow() throws Exception {
  SimpleFlow nested = new JsrFlow("nested");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end1"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end1")));
  nested.setStateTransitions(transitions);
  nested.afterPropertiesSet();
  SimpleFlow flow = new JsrFlow("job");
  transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "nested"));
  transitions.add(StateTransition.createStateTransition(new FlowState(nested, "nested"), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  flow.afterPropertiesSet();
  job.setFlow(flow);
  job.afterPropertiesSet();
  List<String> names = new ArrayList<>(job.getStepNames());
  Collections.sort(names);
  assertEquals("[step1, step2]", names.toString());
}
origin: spring-projects/spring-batch

@Test
public void testBasicFlow() throws Throwable {
  SimpleFlow flow = new SimpleFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  job.setFlow(flow);
  job.execute(jobExecution);
  if (!jobExecution.getAllFailureExceptions().isEmpty()) {
    throw jobExecution.getAllFailureExceptions().get(0);
  }
  assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
}
origin: spring-projects/spring-batch

@Test
public void testBasicFlow() throws Throwable {
  SimpleFlow flow = new JsrFlow("job");
  List<StateTransition> transitions = new ArrayList<>();
  transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step")), "end0"));
  transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
  flow.setStateTransitions(transitions);
  job.setFlow(flow);
  job.execute(jobExecution);
  if (!jobExecution.getAllFailureExceptions().isEmpty()) {
    throw jobExecution.getAllFailureExceptions().get(0);
  }
  assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
}
org.springframework.batch.core.job.flow.support.stateStepState

Javadoc

State implementation that delegates to a FlowExecutor to execute the specified Step.

Most used methods

  • <init>
  • getStep
  • handle

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • getApplicationContext (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Path (java.nio.file)
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Best plugins for Eclipse
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