Example usage for org.springframework.batch.core Entity getId

List of usage examples for org.springframework.batch.core Entity getId

Introduction

In this page you can find the example usage for org.springframework.batch.core Entity getId.

Prototype

public Long getId() 

Source Link

Usage

From source file:org.trpr.platform.batch.impl.spring.admin.repository.MapStepExecutionDao.java

@Override
public void addStepExecutions(JobExecution jobExecution) {
    Map<Long, StepExecution> executions = executionsByJobExecutionId.get(jobExecution.getId());
    if (executions == null || executions.isEmpty()) {
        return;/*  w w w.  j a  v  a 2  s .  com*/
    }
    List<StepExecution> result = new ArrayList<StepExecution>(executions.values());
    Collections.sort(result, new Comparator<Entity>() {

        @Override
        public int compare(Entity o1, Entity o2) {
            return Long.signum(o2.getId() - o1.getId());
        }
    });

    List<StepExecution> copy = new ArrayList<StepExecution>(result.size());
    for (StepExecution exec : result) {
        copy.add(copy(exec));
    }
    jobExecution.addStepExecutions(copy);
}