@ApiOperation(value = "Get a single suspended job", tags = {"Jobs"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the suspended job exists and is returned."), @ApiResponse(code = 404, message = "Indicates the requested job does not exist.") }) @RequestMapping(value = "/management/suspended-jobs/{jobId}", method = RequestMethod.GET, produces = "application/json") public JobResponse getSuspendedJob(@ApiParam(name = "jobId") @PathVariable String jobId, HttpServletRequest request) { Job job = managementService.createSuspendedJobQuery().jobId(jobId).singleResult(); if (job == null) { throw new ActivitiObjectNotFoundException("Could not find a suspended job with id '" + jobId + "'.", Job.class); } return restResponseFactory.createJobResponse(job); }
query.jobId(allRequestParams.get("id")); query.processInstanceId(allRequestParams.get("processInstanceId")); query.executionId(allRequestParams.get("executionId")); query.processDefinitionId(allRequestParams.get("processDefinitionId")); query.executable(); query.timers(); query.messages(); query.duedateLowerThan(RequestUtil.getDate(allRequestParams, "dueBefore")); query.duedateHigherThan(RequestUtil.getDate(allRequestParams, "dueAfter")); query.withException(); query.withRetriesLeft(); query.noRetriesLeft(); query.exceptionMessage(allRequestParams.get("exceptionMessage")); query.jobTenantId(allRequestParams.get("tenantId")); query.jobTenantIdLike(allRequestParams.get("tenantIdLike"));
@ApiOperation(value = "Get the exception stacktrace for a suspended job", tags = {"Jobs"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the requested job was not found and the stacktrace has been returned. The response contains the raw stacktrace and always has a Content-type of text/plain."), @ApiResponse(code = 404, message = "Indicates the requested job was not found or the job doesn’t have an exception stacktrace. Status-description contains additional information about the error.") }) @RequestMapping(value = "/management/suspended-jobs/{jobId}/exception-stacktrace", method = RequestMethod.GET) public String getSuspendedJobStacktrace(@ApiParam(name = "jobId") @PathVariable String jobId, HttpServletResponse response) { Job job = managementService.createSuspendedJobQuery().jobId(jobId).singleResult(); if (job == null) { throw new ActivitiObjectNotFoundException("Could not find a job with id '" + jobId + "'.", Job.class); } String stackTrace = managementService.getSuspendedJobExceptionStacktrace(job.getId()); if (stackTrace == null) { throw new ActivitiObjectNotFoundException("Suspended job with id '" + job.getId() + "' doesn't have an exception stacktrace.", String.class); } response.setContentType("text/plain"); return stackTrace; }