private javax.batch.runtime.context.StepContext getCurrent() { org.springframework.batch.core.StepExecution curStepExecution = null; if(StepSynchronizationManager.getContext() != null) { curStepExecution = StepSynchronizationManager.getContext().getStepExecution(); } if(curStepExecution == null) { throw new FactoryBeanNotInitializedException("A StepExecution is required"); } StepContext context = contextHolder.get(); // If the current context applies to the current step, use it if(context != null && context.getStepExecutionId() == curStepExecution.getId()) { return context; } Properties stepProperties = batchPropertyContext.getStepProperties(curStepExecution.getStepName()); if(stepProperties != null) { context = new JsrStepContext(curStepExecution, stepProperties); } else { context = new JsrStepContext(curStepExecution, new Properties()); } contextHolder.set(context); return context; }
@Before public void setUp() throws Exception { JobExecution jobExecution = new JobExecution(1L, new JobParametersBuilder().addString("key", "value").toJobParameters()); stepExecution = new StepExecution("testStep", jobExecution); stepExecution.setId(5L); stepExecution.setStatus(BatchStatus.STARTED); stepExecution.setExitStatus(new ExitStatus("customExitStatus")); stepExecution.setCommitCount(1); stepExecution.setFilterCount(2); stepExecution.setProcessSkipCount(3); stepExecution.setReadCount(4); stepExecution.setReadSkipCount(5); stepExecution.setRollbackCount(6); stepExecution.setWriteCount(7); stepExecution.setWriteSkipCount(8); executionContext = new ExecutionContext(); stepExecution.setExecutionContext(executionContext); Properties properties = new Properties(); properties.put("key", "value"); stepContext = new JsrStepContext(stepExecution, properties); stepContext.setTransientUserData("This is my transient data"); }
private javax.batch.runtime.context.StepContext getCurrent() { org.springframework.batch.core.StepExecution curStepExecution = null; if(StepSynchronizationManager.getContext() != null) { curStepExecution = StepSynchronizationManager.getContext().getStepExecution(); } if(curStepExecution == null) { throw new FactoryBeanNotInitializedException("A StepExecution is required"); } StepContext context = contextHolder.get(); // If the current context applies to the current step, use it if(context != null && context.getStepExecutionId() == curStepExecution.getId()) { return context; } Properties stepProperties = batchPropertyContext.getStepProperties(curStepExecution.getStepName()); if(stepProperties != null) { context = new JsrStepContext(curStepExecution, stepProperties); } else { context = new JsrStepContext(curStepExecution, new Properties()); } contextHolder.set(context); return context; }
private javax.batch.runtime.context.StepContext getCurrent() { org.springframework.batch.core.StepExecution curStepExecution = null; if(StepSynchronizationManager.getContext() != null) { curStepExecution = StepSynchronizationManager.getContext().getStepExecution(); } if(curStepExecution == null) { throw new FactoryBeanNotInitializedException("A StepExecution is required"); } StepContext context = contextHolder.get(); // If the current context applies to the current step, use it if(context != null && context.getStepExecutionId() == curStepExecution.getId()) { return context; } Properties stepProperties = batchPropertyContext.getStepProperties(curStepExecution.getStepName()); if(stepProperties != null) { context = new JsrStepContext(curStepExecution, stepProperties); } else { context = new JsrStepContext(curStepExecution, new Properties()); } contextHolder.set(context); return context; }
private javax.batch.runtime.context.StepContext getCurrent() { org.springframework.batch.core.StepExecution curStepExecution = null; if(StepSynchronizationManager.getContext() != null) { curStepExecution = StepSynchronizationManager.getContext().getStepExecution(); } if(curStepExecution == null) { throw new FactoryBeanNotInitializedException("A StepExecution is required"); } StepContext context = contextHolder.get(); // If the current context applies to the current step, use it if(context != null && context.getStepExecutionId() == curStepExecution.getId()) { return context; } Properties stepProperties = batchPropertyContext.getStepProperties(curStepExecution.getStepName()); if(stepProperties != null) { context = new JsrStepContext(curStepExecution, stepProperties); } else { context = new JsrStepContext(curStepExecution, new Properties()); } contextHolder.set(context); return context; }