use of io.zeebe.monitor.rest.dto.JobDto in project zeebe-simple-monitor by camunda-community-hub.
the class JobsViewController method jobList.
@GetMapping("/views/jobs")
public String jobList(final Map<String, Object> model, final Pageable pageable) {
final long count = jobRepository.countByStateNotIn(JOB_COMPLETED_INTENTS);
final List<JobDto> dtos = new ArrayList<>();
for (final JobEntity jobEntity : jobRepository.findByStateNotIn(JOB_COMPLETED_INTENTS, pageable)) {
final JobDto dto = toDto(jobEntity);
dtos.add(dto);
}
model.put("jobs", dtos);
model.put("count", count);
addPaginationToModel(model, pageable, count);
addDefaultAttributesToModel(model);
return "job-list-view";
}
use of io.zeebe.monitor.rest.dto.JobDto in project zeebe-simple-monitor by camunda-community-hub.
the class JobsViewController method toDto.
static JobDto toDto(final JobEntity job) {
final JobDto dto = new JobDto();
dto.setKey(job.getKey());
dto.setJobType(job.getJobType());
dto.setProcessInstanceKey(job.getProcessInstanceKey());
dto.setElementInstanceKey(job.getElementInstanceKey());
dto.setState(job.getState());
dto.setRetries(job.getRetries());
Optional.ofNullable(job.getWorker()).ifPresent(dto::setWorker);
dto.setTimestamp(Instant.ofEpochMilli(job.getTimestamp()).toString());
return dto;
}
Aggregations