List of usage examples for org.springframework.batch.item ExecutionContext getString
public String getString(String key)
From source file:batch.OutputFileListener.java
@BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); }//from w w w. ja v a 2 s . c o m if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".csv"); } }
From source file:mpg.biochem.de.interbase.batch.OutputFileListener.java
@BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); }/* w ww . ja v a2 s . co m*/ if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".mapped.tab"); } }
From source file:com.cat.ic.listener.impl.OutputFileListenerMVNO.java
@BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); }// w ww . jav a 2s . c om if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getName(inputName) + ".mvno"); } log.info("[" + executionContext.getString(outputKeyName) + "]"); }
From source file:egovframework.rte.bat.core.listener.EgovOutputFileListener.java
/** * stepExecutionContext? inputKeyName ? ? outputKeyName? put * /* w w w .j a va2 s.com*/ * @param stepExecution */ @BeforeStep public void createOutputNameFromInput(StepExecution stepExecution) { ExecutionContext executionContext = stepExecution.getExecutionContext(); String inputName = stepExecution.getStepName().replace(":", "-"); if (executionContext.containsKey(inputKeyName)) { inputName = executionContext.getString(inputKeyName); } if (!executionContext.containsKey(outputKeyName)) { executionContext.putString(outputKeyName, path + FilenameUtils.getBaseName(inputName) + ".csv"); } }
From source file:ru.xxlabaza.test.batch.job.RangePartitioner.java
@Override public Map<String, ExecutionContext> partition(int gridSize) { long totalItems = personRepository.count(); System.out.println("\nTotal items: " + totalItems); int range = (int) totalItems / gridSize; if (range < chunkSize) { throw new IllegalArgumentException(); }//from w ww. ja va 2s . c om return IntStream.range(0, gridSize).boxed().map(index -> { ExecutionContext context = new ExecutionContext(); context.putString("name", "partition-" + index); context.putInt("from", index * range); int nextIndex = index + 1; int to = nextIndex * range - 1; if (nextIndex == gridSize) { to += totalItems % gridSize; } context.putInt("to", to); return context; }).map(context -> { System.out.format("\nCREATED PARTITION: '%s', RANGE FROM %d, TO %d\n", context.getString("name"), context.getInt("from"), context.getInt("to")); return context; }).collect(toMap(context -> context.getString("name"), Function.identity())); }