1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.batch.admin.web.resource;
18
19 import org.springframework.batch.admin.domain.StepExecutionProgressInfo;
20 import org.springframework.batch.admin.domain.StepExecutionProgressInfoResource;
21 import org.springframework.batch.admin.web.BatchStepExecutionsController;
22 import org.springframework.hateoas.mvc.ResourceAssemblerSupport;
23
24
25
26
27
28
29
30
31 public class StepExecutionProgressInfoResourceAssembler extends
32 ResourceAssemblerSupport<StepExecutionProgressInfo, StepExecutionProgressInfoResource> {
33
34 public StepExecutionProgressInfoResourceAssembler() {
35 super(BatchStepExecutionsController.class, StepExecutionProgressInfoResource.class);
36 }
37
38 @Override
39 public StepExecutionProgressInfoResource toResource(StepExecutionProgressInfo entity) {
40 return createResourceWithId(entity.getStepExecutionId(), entity, entity.getStepExecution().getJobExecutionId());
41 }
42
43 @Override
44 protected StepExecutionProgressInfoResource instantiateResource(StepExecutionProgressInfo entity) {
45 return new StepExecutionProgressInfoResource(entity.getStepExecution(), entity.getStepExecutionHistory(),
46 entity.getEstimatedPercentComplete(), entity.isFinished(), entity.getDuration(), entity.getTimeZone());
47 }
48 }