use of org.xwiki.job.Job in project xwiki-platform by xwiki.
the class XWikiJobResource method getRealJobStatus.
protected JobStatus getRealJobStatus(String jobId) throws WebApplicationException {
JobStatus jobStatus;
String[] idArray = jobId.split("/");
List<String> id = new ArrayList<>(idArray.length);
// Unescape id sections
for (String idElement : idArray) {
try {
id.add(URLDecoder.decode(idElement, "UTF8"));
} catch (UnsupportedEncodingException e) {
throw new WebApplicationException(e);
}
}
// Search job
Job job = this.jobExecutor.getJob(id);
if (job == null) {
jobStatus = this.jobStore.getJobStatus(id);
} else {
jobStatus = job.getStatus();
}
if (jobStatus == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return jobStatus;
}
Aggregations