@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (++count >= limit) { return new FlowExecutionStatus("COMPLETED"); } else { return new FlowExecutionStatus("CONTINUE"); } }
@Override protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException { State nextState = findState(stateName, status, stepExecution); if(stepExecution != null) { ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext(); if(executionContext.containsKey("batch.stoppedStep")) { String stepName = executionContext.getString("batch.stoppedStep"); if(stateName.endsWith(stepName)) { if(nextState != null && executionContext.containsKey("batch.restartStep") && StringUtils.hasText(executionContext.getString("batch.restartStep"))) { nextState = findState(stateName, new FlowExecutionStatus(status.getName() + ".RESTART"), stepExecution); } } } } return nextState; }
/** * Create an ordering on {@link FlowExecution} instances by comparing their * statuses. * * @see Comparable#compareTo(Object) * * @param other the {@link FlowExecution} instance to compare with this instance. * @return negative, zero or positive as per the contract */ @Override public int compareTo(FlowExecution other) { return this.status.compareTo(other.getStatus()); }
/** * @return true if this status represents the end of a flow */ public boolean isEnd() { return isStop() || isFail() || isComplete(); }
/** * @param status The {@link FlowExecutionStatus} to end with * @param name The name of the state */ public EndState(FlowExecutionStatus status, String name) { this(status, status.getName(), name); }
@Override public boolean isEndState() { return !status.isStop(); }
/** * @param status The {@link FlowExecutionStatus} to end with * @param name The name of the state */ public JsrEndState(FlowExecutionStatus status, String name) { super(status, status.getName(), name); }
/** * @return true if this status represents the end of a flow */ public boolean isEnd() { return isStop() || isFail() || isComplete(); }
if (status.isStop()) { if (!executor.isRestart()) {
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (count++<2) { return new FlowExecutionStatus("OK"); } return new FlowExecutionStatus("END"); }
@Test public void testBasicProperties() throws Exception { FlowExecution execution = new FlowExecution("foo", new FlowExecutionStatus("BAR")); assertEquals("foo",execution.getName()); assertEquals("BAR",execution.getStatus().getName()); }
/** * @return true if the status starts with "FAILED" */ public boolean isFail() { return name.startsWith(FAILED.getName()); }
/** * @return true if this status represents the end of a flow */ public boolean isEnd() { return isStop() || isFail() || isComplete(); }
if (getStatus().isStop()) { JobExecution jobExecution = stepExecution.getJobExecution(); ExecutionContext executionContext = jobExecution.getExecutionContext();
/** * Create an ordering on {@link FlowExecution} instances by comparing their * statuses. * * @see Comparable#compareTo(Object) * * @param other * @return negative, zero or positive as per the contract */ public int compareTo(FlowExecution other) { return this.status.compareTo(other.getStatus()); }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { count++; if(count > 2) { return new FlowExecutionStatus("END"); } else { return new FlowExecutionStatus("CONTINUE"); } } }
@Override protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException { State nextState = findState(stateName, status, stepExecution); if(stepExecution != null) { ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext(); if(executionContext.containsKey("batch.stoppedStep")) { String stepName = executionContext.getString("batch.stoppedStep"); if(stateName.endsWith(stepName)) { if(nextState != null && executionContext.containsKey("batch.restartStep") && StringUtils.hasText(executionContext.getString("batch.restartStep"))) { nextState = findState(stateName, new FlowExecutionStatus(status.getName() + ".RESTART"), stepExecution); } } } } return nextState; }