/** * Add a Double value to the context. * * @param key Key to add to context * @param value Value to associate with key */ public void putDouble(String key, double value) { put(key, value); }
/** * @param items list of items to be written. * @throws Exception thrown if error occurs. */ protected void writeItems(List<O> items) throws Exception { if (itemWriter != null) { itemWriter.write(items); } }
public void close() throws Exception { if (itemWriter instanceof ItemStream) { ((ItemStream) itemWriter).close(); } }
@Override public Integer call() throws Exception { int count = 0; readerStream.open(new ExecutionContext()); try { while (reader.read() != null) { count++; } } finally { readerStream.close(); } return count; } });
/** * Open the reader if applicable. */ private void open(ItemReader<?> reader) { if (reader instanceof ItemStream) { ((ItemStream) reader).open(new ExecutionContext()); } }
@Override public void open(ExecutionContext executionContext) { if (executionContext.containsKey(TOTAL_AMOUNT_KEY)) { this.totalPrice = (BigDecimal) executionContext.get(TOTAL_AMOUNT_KEY); } else { // // Fresh run. Disregard old state. // this.totalPrice = BigDecimal.ZERO; } }
@Override public void open(ExecutionContext executionContext) throws ItemStreamException { if(executionContext.containsKey(CURRENT_INDEX)){ currentIndex = executionContext.getInt(CURRENT_INDEX); } else{ currentIndex = 0; } }
/** * @param jobRepository a {@link org.springframework.batch.core.repository.JobRepository} */ public SimpleStepHandler(JobRepository jobRepository) { this(jobRepository, new ExecutionContext()); }
@Override @Before public void setUp() throws Exception { super.setUp(); testedAsStream().open(executionContext); }
public void open(ExecutionContext executionContext) throws Exception { if (itemWriter instanceof ItemStream) { ((ItemStream) itemWriter).open(executionContext); } opened = true; }
@Override public void update(ExecutionContext executionContext) throws ItemStreamException { for (ItemWriter<? super T> writer : delegates) { if (!ignoreItemStream && (writer instanceof ItemStream)) { ((ItemStream) writer).update(executionContext); } } }
/** * Typesafe Getter for the Double represented by the provided key. * * @param key The key to get a value for * @return The <code>Double</code> value */ public double getDouble(String key) { return (Double) readAndValidate(key, Double.class); }
/** * The name of the component which will be used as a stem for keys in the * {@link ExecutionContext}. Subclasses should provide a default value, e.g. * the short form of the class name. * * @param name the name for the component */ public void setName(String name) { this.setExecutionContextName(name); }
/** * Open the reader if applicable. */ private void open(ItemReader<?> reader) { if (reader instanceof ItemStream) { ((ItemStream) reader).open(new ExecutionContext()); } }
@Override public void open(ExecutionContext executionContext) throws ItemStreamException { for (ItemWriter<? super T> writer : delegates) { if (!ignoreItemStream && (writer instanceof ItemStream)) { ((ItemStream) writer).open(executionContext); } } }
/** * Close the reader if applicable. */ private void close(ItemReader<?> reader) { if (reader instanceof ItemStream) { ((ItemStream) reader).close(); } } }
/** * Open the reader if applicable. */ private void open(ItemReader<?> reader) { if (reader instanceof ItemStream) { ((ItemStream) reader).open(new ExecutionContext()); } }
/** * Close the reader if applicable. */ private void close(ItemReader<?> reader) { if (reader instanceof ItemStream) { ((ItemStream) reader).close(); } } }