Example usage for org.springframework.batch.repeat RepeatStatus FINISHED

List of usage examples for org.springframework.batch.repeat RepeatStatus FINISHED

Introduction

In this page you can find the example usage for org.springframework.batch.repeat RepeatStatus FINISHED.

Prototype

RepeatStatus FINISHED

To view the source code for org.springframework.batch.repeat RepeatStatus FINISHED.

Click Source Link

Document

Indicates that processing is finished (either successful or unsuccessful)

Usage

From source file:com.javaetmoi.core.batch.test.EndTasklet.java

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) {
    JobExecution jobExecution = chunkContext.getStepContext().getStepExecution().getJobExecution();
    StepExecution resume = getUnpartitionedStepResume(jobExecution);
    LOG.info("{} masterpiece(s) have been processed", resume.getWriteCount());
    return RepeatStatus.FINISHED;
}

From source file:de.langmi.spring.batch.examples.complex.file.renamefile.simple.SimpleRenameFileTaskletStep.java

/** */
@Override//from  ww w.  ja v  a 2 s.  c o m
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {

    // get used output file
    String outputFilePath = (String) chunkContext.getStepContext().getJobParameters().get("output.file");
    UrlResource oldFile = new UrlResource(outputFilePath);
    // get desired output file name
    String desiredOutputFilePath = (String) chunkContext.getStepContext().getJobExecutionContext()
            .get("desired.output.file");
    UrlResource newFile = new UrlResource(desiredOutputFilePath);

    // rename
    oldFile.getFile().renameTo(newFile.getFile());

    return RepeatStatus.FINISHED;
}

From source file:cn.cuizuoli.appranking.batch.tasklet.AppleStoreTasklet.java

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    FeedType feedType = FeedType.getObject(feedTypeCode);
    Country country = Country.getObject(countryCode);
    List<AppRanking> appRankingList = appleStoreService.getAppRankingList(country, feedType);
    appRankingService.batchAdd(appRankingList);
    return RepeatStatus.FINISHED;
}

From source file:org.trpr.example.batch.email.EmailTasklet.java

/**
 * Interface method implementation. Sends out a canned email.
 * @see org.springframework.batch.core.step.tasklet.Tasklet#execute(org.springframework.batch.core.StepContribution, org.springframework.batch.core.scope.context.ChunkContext)
 *///from ww  w . ja  va 2s .c om
public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
    this.mailSender.sendMail("noreply@trooper.org", "Trooper Batch : status",
            new String[] { "regunathb@trooper.org" }, "Email tasklet run successful!", null);
    return RepeatStatus.FINISHED;
}

From source file:cn.cuizuoli.appranking.batch.tasklet.GooglePlayTasklet.java

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    FeedType feedType = FeedType.getObject(feedTypeCode);
    Category category = Category.getObject(categoryCode);
    List<AppRanking> appRankingList = googlePlayService.getAppRankingList(feedType, category);
    appRankingService.batchAdd(appRankingList);
    return RepeatStatus.FINISHED;
}

From source file:de.langmi.spring.batch.examples.complex.file.split.GetLineCountTasklet.java

/**
 * Check if resouce is a file and get the line count from the file.
 * Line count is //w  ww.ja  v a 2  s. co m
 *
 * @param contribution
 * @param chunkContext
 * @return
 * @throws Exception 
 */
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {

    checkResource();
    int lineCount = getLineCount(resource.getFile());

    chunkContext.getStepContext().getStepExecution().getExecutionContext().put("line.count", lineCount);

    return RepeatStatus.FINISHED;
}

From source file:batch.configuration.BatchConfiguration.java

@Bean
public Job job() {
    return jobBuilderFactory.get("bootJob")
            .start(stepBuilderFactory.get("step").tasklet((stepContribution, chunkContext) -> {
                System.out.println("Starting wait...");
                Thread.sleep(20000);
                System.out.println("Was executed");
                return RepeatStatus.FINISHED;
            }).build()).build();/*from  w  ww .j  ava  2 s  . c om*/
}

From source file:de.langmi.spring.batch.tutorials.helloworld.HelloWorldTasklet.java

/** {@inheritDoc} */
@Override//from w  ww .  j  a va 2  s. c o m
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {

    // why not using println? because it makes testing harder, *nix and
    // windows think different about new line as in \n vs \r\n
    System.out.print("Hello World!");

    return RepeatStatus.FINISHED;
}

From source file:org.obiba.onyx.core.etl.participant.impl.ArchiveAppointmentFileTasklet.java

public RepeatStatus execute(StepContribution stepContribution, ChunkContext context) throws Exception {

    if (getInputDirectory() != null && getInputDirectory().getFile() != null) {
        for (File file : getInputDirectory().getFile().listFiles(getFilter())) {
            archiveFile(file, context.getStepContext().getStepExecution().getExecutionContext());
        }// w  w w  . j a  v a  2 s  .co m
    }

    return RepeatStatus.FINISHED;
}

From source file:com.dd.mdr.batch.SampleBatchApplication.java

@Bean
protected Tasklet tasklet() {
    return new Tasklet() {
        @Override//  w ww  .j  a v a  2 s. co  m
        public RepeatStatus execute(StepContribution contribution, ChunkContext context) {
            return RepeatStatus.FINISHED;
        }
    };
}