@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { /* * On starting a new step, possibly upgrade the last execution to make * sure it is abandoned on restart if it failed. */ executor.abandonStepExecution(); return new FlowExecutionStatus(executor.executeStep(step)); }
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { return decider.decide(executor.getJobExecution(), executor.getStepExecution()); }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (++count >= limit) { return new FlowExecutionStatus("COMPLETED"); } else { return new FlowExecutionStatus("CONTINUE"); } }
/** * @return true if this status represents the end of a flow */ public boolean isEnd() { return isStop() || isFail() || isComplete(); }
/** * 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()); }
/** * @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 FlowExecution call() throws Exception { return flow.start(executor); } });
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { JobExecution jobExecution = executor.getJobExecution(); jobExecution.createStepExecution(getName()); if (fail) { return FlowExecutionStatus.FAILED; } else { return FlowExecutionStatus.COMPLETED; } } };
@Override public FlowExecutionStatus handle(FlowExecutor executor) throws Exception { JobExecution jobExecution = executor.getJobExecution(); if (jobExecution != null) { jobExecution.createStepExecution(getName()); } return this.status; }
/** * Constructor for a {@link FlowStep} that sets the flow and of the step * explicitly. * * @param flow the {@link Flow} instance to be associated with this step. */ public FlowStep(Flow flow) { super(flow.getName()); }
/** * Initialize the step names */ private void init() { findSteps(flow, stepMap); }
/** * Performs any logic to update the exit status for the current flow. * * @param executor {@link FlowExecutor} for the current flow * @param code The exit status to save */ protected void setExitStatus(FlowExecutor executor, String code) { executor.addExitStatus(code); }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (count++<2) { return new FlowExecutionStatus("OK"); } return new FlowExecutionStatus("END"); }
/** * @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); }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { count++; if(count > 2) { return new FlowExecutionStatus("END"); } else { return new FlowExecutionStatus("CONTINUE"); } } }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (count++ < 2) { return new FlowExecutionStatus("OK"); } return new FlowExecutionStatus("END"); }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { return new FlowExecutionStatus("FOO"); } }
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { count++; return count<2 ? new FlowExecutionStatus("ONGOING") : FlowExecutionStatus.COMPLETED; } };
@Override public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { return new FlowExecutionStatus("FOO"); } }