use of io.zeebe.monitor.entity.JobEntity 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.entity.JobEntity in project zeebe-simple-monitor by camunda-community-hub.
the class JobImporter method importJob.
public void importJob(final Schema.JobRecord record) {
final JobIntent intent = JobIntent.valueOf(record.getMetadata().getIntent());
final long key = record.getMetadata().getKey();
final long timestamp = record.getMetadata().getTimestamp();
final JobEntity entity = jobRepository.findById(key).orElseGet(() -> {
final JobEntity newEntity = new JobEntity();
newEntity.setKey(key);
newEntity.setProcessInstanceKey(record.getProcessInstanceKey());
newEntity.setElementInstanceKey(record.getElementInstanceKey());
newEntity.setJobType(record.getType());
return newEntity;
});
entity.setState(intent.name().toLowerCase());
entity.setTimestamp(timestamp);
entity.setWorker(record.getWorker());
entity.setRetries(record.getRetries());
jobRepository.save(entity);
}
use of io.zeebe.monitor.entity.JobEntity in project zeebe-simple-monitor by camunda-community-hub.
the class JobResource method activateJob.
private ActivatedJob activateJob(final long key, final ZeebeClient client) {
final JobEntity job = getJob(key);
final String jobType = job.getJobType();
return activateJob(client, key, jobType);
}
Aggregations