/** * This policy is complete if any of the composed policies is complete. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext) */ @Override public boolean isComplete(RepeatContext context) { RepeatContext[] contexts = ((CompositeBatchContext) context).contexts; CompletionPolicy[] policies = ((CompositeBatchContext) context).policies; for (int i = 0; i < policies.length; i++) { if (policies[i].isComplete(contexts[i])) { return true; } } return false; }
/** * @return a new {@link RepeatContext} * @see org.springframework.batch.repeat.CompletionPolicy#start(org.springframework.batch.repeat.RepeatContext) */ @Override public RepeatContext start(RepeatContext parent) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.start(parent); }
/** * Delegate to the {@link CompletionPolicy}. * @param context the value returned by start. * * @see org.springframework.batch.repeat.CompletionPolicy#update(RepeatContext) */ protected void update(RepeatContext context) { completionPolicy.update(context); }
/** * This policy is complete if any of the composed policies is complete. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext, * RepeatStatus) */ @Override public boolean isComplete(RepeatContext context, RepeatStatus result) { RepeatContext[] contexts = ((CompositeBatchContext) context).contexts; CompletionPolicy[] policies = ((CompositeBatchContext) context).policies; for (int i = 0; i < policies.length; i++) { if (policies[i].isComplete(contexts[i], result)) { return true; } } return false; }
/** * @see org.springframework.batch.repeat.CompletionPolicy#update(org.springframework.batch.repeat.RepeatContext) */ @Override public void update(RepeatContext context) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); delegate.update(context); }
/** * Create a new composite context from all the available policies. * * @see org.springframework.batch.repeat.CompletionPolicy#start(RepeatContext) */ @Override public RepeatContext start(RepeatContext context) { List<RepeatContext> list = new ArrayList<>(); for (int i = 0; i < policies.length; i++) { list.add(policies[i].start(context)); } return new CompositeBatchContext(context, list); }
/** * @return true if the commit interval has been reached or the result * indicates completion * @see CompletionPolicy#isComplete(RepeatContext, RepeatStatus) */ @Override public boolean isComplete(RepeatContext context, RepeatStatus result) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.isComplete(context, result); }
/** * Update all the composed contexts, and also increment the parent context. * * @see org.springframework.batch.repeat.CompletionPolicy#update(org.springframework.batch.repeat.RepeatContext) */ @Override public void update(RepeatContext context) { RepeatContext[] contexts = ((CompositeBatchContext) context).contexts; CompletionPolicy[] policies = ((CompositeBatchContext) context).policies; for (int i = 0; i < policies.length; i++) { policies[i].update(contexts[i]); } ((RepeatContextSupport) context).increment(); }
/** * Delegate to the {@link CompletionPolicy}. * * @return a {@link RepeatContext} object that can be used by the implementation to store * internal state for a batch step. * * @see org.springframework.batch.repeat.CompletionPolicy#start(RepeatContext) */ protected RepeatContext start() { RepeatContext parent = RepeatSynchronizationManager.getContext(); RepeatContext context = completionPolicy.start(parent); RepeatSynchronizationManager.register(context); logger.debug("Starting repeat context."); return context; }
/** * @return if the commit interval has been reached * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext) */ @Override public boolean isComplete(RepeatContext context) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.isComplete(context); }
/** * Delegate to the {@link CompletionPolicy}. * @param context the value returned by start. * * @see org.springframework.batch.repeat.CompletionPolicy#update(RepeatContext) */ protected void update(RepeatContext context) { completionPolicy.update(context); }
/** * @param parent * @return a new {@link RepeatContext} * @see org.springframework.batch.repeat.CompletionPolicy#start(org.springframework.batch.repeat.RepeatContext) */ @Override public RepeatContext start(RepeatContext parent) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.start(parent); }
/** * Delegate to {@link CompletionPolicy}. * @param context the current batch context. * @return true if complete according to policy alone not including result value, else false. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(RepeatContext) */ protected boolean isComplete(RepeatContext context) { boolean complete = completionPolicy.isComplete(context); if (complete) { logger.debug("Repeat is complete according to policy alone not including result."); } return complete; }
/** * @see org.springframework.batch.repeat.CompletionPolicy#update(org.springframework.batch.repeat.RepeatContext) */ @Override public void update(RepeatContext context) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); delegate.update(context); }
/** * @param parent * @return a new {@link RepeatContext} * @see org.springframework.batch.repeat.CompletionPolicy#start(org.springframework.batch.repeat.RepeatContext) */ public RepeatContext start(RepeatContext parent) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.start(parent); }
/** * Delegate to the {@link CompletionPolicy}. * @param context the current batch context. * @param result the result of the latest batch item processing. * @return true if complete according to policy and result value, else false. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(RepeatContext, * RepeatStatus) */ protected boolean isComplete(RepeatContext context, RepeatStatus result) { boolean complete = completionPolicy.isComplete(context, result); if (complete) { logger.debug("Repeat is complete according to policy and result value."); } return complete; }
/** * @param context * @see org.springframework.batch.repeat.CompletionPolicy#update(org.springframework.batch.repeat.RepeatContext) */ public void update(RepeatContext context) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); delegate.update(context); }
/** * @return a new {@link RepeatContext} * @see org.springframework.batch.repeat.CompletionPolicy#start(org.springframework.batch.repeat.RepeatContext) */ @Override public RepeatContext start(RepeatContext parent) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); return delegate.start(parent); }
/** * This policy is complete if any of the composed policies is complete. * * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext, * RepeatStatus) */ @Override public boolean isComplete(RepeatContext context, RepeatStatus result) { RepeatContext[] contexts = ((CompositeBatchContext) context).contexts; CompletionPolicy[] policies = ((CompositeBatchContext) context).policies; for (int i = 0; i < policies.length; i++) { if (policies[i].isComplete(contexts[i], result)) { return true; } } return false; }
/** * @param context * @see org.springframework.batch.repeat.CompletionPolicy#update(org.springframework.batch.repeat.RepeatContext) */ @Override public void update(RepeatContext context) { Assert.state(delegate != null, "The delegate resource has not been initialised. " + "Remember to register this object as a StepListener."); delegate.update(context); }