Java 类org.springframework.batch.core.annotation.BeforeStep 实例源码

项目:nyla    文件:DAOCommandProcessor.java   
/**
 * 
 * @param stepExecution the step execution
 */
@BeforeStep
public void connect(StepExecution stepExecution) 
{
    this.skipCommand.connect();

    if(this.beforeCommand != null)
        this.beforeCommand.connect();

}
项目:nyla    文件:ExcelItemReader.java   
@BeforeStep
public void open()
throws IOException
{
    this.excel = Excel.getExcel(this.filePath);

    if(this.sheetName != null && this.sheetName.length() > 0)
        this.sheet = this.excel.retrieveSheet(this.sheetName);
    else
        this.sheet = this.excel.retrieveSheet(this.sheetNumber);

    this.rowCount = this.sheet.getRowCount();

    index = 1;
}
项目:batchers    文件:SingleJVMJobProgressListener.java   
@Override
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    totalItemCount = employeeService.getEmployeeCount().intValue();
    jobStartParams = new JobStartParamsMapper().map(stepExecution.getJobParameters());
    stepName = stepExecution.getStepName();
    currentItemCount = new AtomicLong();
    lastPercentageComplete = new AtomicInteger();
    eventBus.post(new JobProgressEvent(jobStartParams, stepName, 0));
}
项目:egovframework.rte.root    文件:EgovOutputFileListener.java   
/**
 * stepExecutionContext에 inputKeyName 을 이용하여 outputKeyName을 put 함
 * 
 * @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");
    }
}
项目:jvarkit    文件:JdkFilterItemProcessor.java   
@BeforeStep
public void beforeStep(final StepExecution stepExecution) {
    try {
        InMemoryCompiler javac = new InMemoryCompiler();

        String javaCode = InMemoryCompiler.getTheSourceCode(getExpression(), getScriptFile());
        final Class<?> clazz ;

        if( CODE2CLASS.containsKey(javaCode))
            {
            if(LOG.isWarnEnabled()) LOG.warn("Code already compiled");
            clazz = CODE2CLASS.get(javaCode);
            }
        else
            {
            final String className = "FunctionImpl"+ rand.nextInt()+ System.currentTimeMillis();
            if(LOG.isInfoEnabled()) LOG.info("Compiling\n" + InMemoryCompiler.beautifyCode(javaCode));

            clazz = javac.compileClass(className,
                javaCode.replace("__CLASS__", className));
            CODE2CLASS.put(javaCode, clazz);
            }
        final Constructor<?> ctor = clazz.getConstructor();
        final Object instance = ctor.newInstance();
        if(!(instance instanceof Function)) {
            throw new JvarkitException.ScriptingError("Not an instance of Function");
            }
        this.transformer = (Function)instance;
        }
    catch(final Exception err)
        {
        throw new RuntimeException(err);
        }
    }
项目:jenkins-csvexporter    文件:JobItemReader.java   
@BeforeStep
@SuppressWarnings({"unused", "unchecked"})
private void beforeAnyRead(StepExecution stepExecution) {

    JobExecution jobExecution = stepExecution.getJobExecution();
    ExecutionContext executionContext = jobExecution.getExecutionContext();
    contextMap = (Map<String, Map<String, String>>) executionContext.get("mapContext");

    urls = jenkinsReader.buildURLs();
}
项目:oma-riista-web    文件:LoggingBatchListener.java   
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    LOG.info("Starting step: {}", stepExecution.getStepName());
}
项目:springBatchBootJavaConfigkata    文件:StepLoggingListener.java   
@Override
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
     log.info("$$$ before step  {}",stepExecution.getStepName());

}
项目:marklogic-spring-batch    文件:YourTwoStepJobConfig.java   
@Bean
@JobScope
public Step step2(StepBuilderFactory stepBuilderFactory) {
    ItemReader<String> reader = new ItemReader<String>() {
        int i = 0;

        @Override
        public String read() throws Exception {
            i++;
            return i == 1 ? "hello" : null;
        }
    };


    ItemWriter<String> writer = new ItemWriter<String>() {
        String someString;

        @BeforeStep
        public void beforeStep(StepExecution stepExecution) {
            JobExecution jobExecution = stepExecution.getJobExecution();
            ExecutionContext jobContext = jobExecution.getExecutionContext();
            this.someString = jobContext.getString("someKey");
        }

        @Override
        public void write(List<? extends String> items) throws Exception {
            logger.info("Step 2: " + someString);
            for (String item : items) {
                logger.info("step2: " + item);
            }
        }

    };


    return stepBuilderFactory.get("step2")
            .<String, String>chunk(10)
            .reader(reader)
            .writer(writer)
            .listener(writer)
            .build();
}
项目:AGIA    文件:ExtendedMultiResourceItemReader.java   
@BeforeStep
public void saveStepExecution(StepExecution sStepExecution) {
    stepExecution = sStepExecution;
}
项目:batchers    文件:SlaveJobProgressListener.java   
@Override
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    jobStartParams = new JobStartParamsMapper().map(stepExecution.getJobParameters());
    stepName = stepExecution.getStepName();
}
项目:curso_spring-batch    文件:Step1FilterReportProcessor.java   
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    jobExecution = stepExecution.getJobExecution();
}
项目:spring-batch-experiments    文件:ImportProductsExecutionListener.java   
@BeforeStep
public void beforeStep(StepExecution stepExecution) {
    log.info("스텝 실행 전에 호출되는 리스너의 메소드입니다.");
}
项目:appstatus-spring-boot-starter    文件:OneItemWritter.java   
/**
 * retrieveInterstepData.
 * 
 * @param stepExecution
 *            to set
 */
@BeforeStep
public void retrieveInterstepData(StepExecution stepExecution) {
    this.stepExecution = stepExecution;
}
项目:appstatus-spring-boot-starter    文件:OneItemReader.java   
/**
 * retrieveInterstepData.
 * 
 * @param stepExecution
 *            to set
 */
@BeforeStep
public void retrieveInterstepData(StepExecution stepExecution) {
    StatusJobs.getMonitor("One job", "element", stepExecution)
              .beginTask("insert", "insert element", NB_ITEM.get());
}
项目:appstatus-spring-boot-starter    文件:OneItemProcessor.java   
/**
 * retrieveInterstepData.
 * 
 * @param stepExecution
 *            to set
 */
@BeforeStep
public void retrieveInterstepData(StepExecution stepExecution) {
    this.stepExecution = stepExecution;
}