use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class DocumentsDeletingListenerTest method testWhenNonInteractive.
@Test
public void testWhenNonInteractive() throws Exception {
Request request = mock(Request.class);
Job job = mock(Job.class);
when(job.getRequest()).thenReturn(request);
when(request.isInteractive()).thenReturn(false);
JobStatus status = mock(JobStatus.class);
when(job.getStatus()).thenReturn(status);
// Test
DocumentsDeletingEvent event = new DocumentsDeletingEvent();
mocker.getComponentUnderTest().onEvent(event, job, null);
// Verify
verify(mocker.getMockedLogger()).warn("XAR Extension Documents Deleting Listener will not check the document in non-interactive mode.");
verifyZeroInteractions(status);
verifyZeroInteractions(repository);
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class DistributionInternalScriptService method renderCurrentStepToXHTML.
public String renderCurrentStepToXHTML(String transformationId) {
DistributionJob job = this.distributionManager.getCurrentDistributionJob();
if (job != null) {
JobStatus jobStatus = job.getStatus();
if (jobStatus != null) {
State jobState = jobStatus.getState();
if (jobState == State.RUNNING || jobState == State.WAITING) {
Block block = job.getCurrentStep().executeInteractive();
WikiPrinter printer = new DefaultWikiPrinter();
this.xhtmlRenderer.render(block, printer);
return printer.toString();
}
}
}
return null;
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class FlavorSearchJob method createNewStatus.
@Override
protected DefaultFlavorSearchStatus createNewStatus(FlavorSearchRequest request) {
Job currentJob = this.jobContext.getCurrentJob();
JobStatus currentJobStatus = currentJob != null ? currentJob.getStatus() : null;
return new DefaultFlavorSearchStatus(request, this.observationManager, this.loggerManager, this.foundFlavors, currentJobStatus);
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class JobScriptService method getJobStatus.
/**
* @param jobId the job id
* @return the status of the specified job, {@code null} if the status cannot be found
*/
public JobStatus getJobStatus(List<String> jobId) {
JobStatus jobStatus;
Job job = this.jobExecutor.getJob(jobId);
if (job == null) {
jobStatus = this.jobStore.getJobStatus(jobId);
} else {
jobStatus = job.getStatus();
}
if (jobStatus != null && !this.authorization.hasAccess(Right.PROGRAM)) {
jobStatus = safe(jobStatus);
}
return jobStatus;
}
use of org.xwiki.job.event.status.JobStatus in project xwiki-platform by xwiki.
the class JobScriptService method getCurrentJobStatus.
/**
* Get the status of the currently executing job in the specified group job, if any.
*
* @param path specifies the job group where to look for a running job
* @return status of the currently executing job in the specified group, or {@code null} if no job is being executed
*/
public JobStatus getCurrentJobStatus(Collection<String> path) {
Job job = this.jobExecutor.getCurrentJob(new JobGroupPath(path));
JobStatus jobStatus = null;
if (job != null) {
jobStatus = job.getStatus();
if (!this.authorization.hasAccess(Right.PROGRAM)) {
jobStatus = safe(jobStatus);
}
}
return jobStatus;
}
Aggregations