use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class XWiki method getCurrentInitializerJobStatus.
/**
* @return the status of the job initializing the instance or the current wiki
* @since 8.4RC1
*/
public JobStatus getCurrentInitializerJobStatus() {
// Get XWiki initializer job
JobStatus jobStatus = getJobStatus();
if (jobStatus == null) {
return null;
}
// The XWiki initialization is not done yet
if (jobStatus.getState() != State.FINISHED) {
return jobStatus;
}
// If XWiki initialization did not failed
if (this.xwiki != null) {
// Get current wiki initializer job
Job wikiJob = this.xwiki.getWikiInitializerJob(this.context.getWikiId());
jobStatus = wikiJob != null ? wikiJob.getStatus() : null;
}
return jobStatus;
}
use of org.xwiki.job.event.status.JobStatus 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