@Autowired
protected ManagementService managementService;
@RequestMapping(value="/management/jobs", method = RequestMethod.GET, produces = "application/json")
public DataResponse getJobs(@RequestParam Map<String,String> allRequestParams, HttpServletRequest request) {
JobQuery query = managementService.createJobQuery();
if (allRequestParams.containsKey("id")) {
query.jobId(allRequestParams.get("id"));
}
if (allRequestParams.containsKey("processInstanceId")) {
query.processInstanceId(allRequestParams.get("processInstanceId"));
}
if (allRequestParams.containsKey("executionId")) {
query.executionId(allRequestParams.get("executionId"));
}
if (allRequestParams.containsKey("processDefinitionId")) {
query.processDefinitionId(allRequestParams.get("processDefinitionId"));
}
if (allRequestParams.containsKey("withRetriesLeft")) {
if (Boolean.valueOf(allRequestParams.get("withRetriesLeft"))) {
query.withRetriesLeft();
}
}
if (allRequestParams.containsKey("executable")) {
if (Boolean.valueOf(allRequestParams.get("executable"))) {
query.executable();
}
}
if (allRequestParams.containsKey("timersOnly")) {
if (allRequestParams.containsKey("messagesOnly")) {
throw new ActivitiIllegalArgumentException("Only one of 'timersOnly' or 'messagesOnly' can be provided.");
}
if (Boolean.valueOf(allRequestParams.get("timersOnly"))) {
query.timers();
}
}
if (allRequestParams.containsKey("messagesOnly")) {
if (Boolean.valueOf(allRequestParams.get("messagesOnly"))) {
query.messages();
}
}
if (allRequestParams.containsKey("dueBefore")) {
query.duedateLowerThan(RequestUtil.getDate(allRequestParams, "dueBefore"));
}
if (allRequestParams.containsKey("dueAfter")) {
query.duedateHigherThan(RequestUtil.getDate(allRequestParams, "dueAfter"));
}
if (allRequestParams.containsKey("withException")) {
if (Boolean.valueOf(allRequestParams.get("withException"))) {
query.withException();
}
}
if (allRequestParams.containsKey("exceptionMessage")) {
query.exceptionMessage(allRequestParams.get("exceptionMessage"));
}
if (allRequestParams.containsKey("tenantId")) {
query.jobTenantId(allRequestParams.get("tenantId"));
}
if (allRequestParams.containsKey("tenantIdLike")) {
query.jobTenantIdLike(allRequestParams.get("tenantIdLike"));
}
if (allRequestParams.containsKey("withoutTenantId")) {
if (Boolean.valueOf(allRequestParams.get("withoutTenantId"))) {
query.jobWithoutTenantId();
}
}
return new JobPaginateList(restResponseFactory, request.getRequestURL().toString().replace("/management/jobs", ""))
.paginateList(allRequestParams, query, "id", properties);