use of org.xwiki.job.AbstractRequest in project xwiki-platform by xwiki.
the class ExtensionJobEventConverter method fromRemote.
@Override
public boolean fromRemote(RemoteEventData remoteEvent, LocalEventData localEvent) {
if (remoteEvent.getEvent() instanceof JobStartedEvent) {
JobStartedEvent jobEvent = (JobStartedEvent) remoteEvent.getEvent();
if (JOBS.contains(jobEvent.getJobType())) {
Request request = jobEvent.getRequest();
// Indicate the job has been triggered by a remote event
if (!(request instanceof AbstractRequest)) {
request = new DefaultRequest(request);
}
((AbstractRequest) request).setRemote(true);
// We don't want to directly simulate a new JobStartedEvent event but we want to start a new job
// which will generate a new JobStartedEvent
localEvent.setEvent(new RemoteExtensionJobStartedEvent(jobEvent.getJobType(), request));
return true;
}
}
return false;
}
Aggregations