use of org.xwiki.extension.xar.job.diff.DiffXarJobStatus in project xwiki-platform by xwiki.
the class XarExtensionScriptService method reset.
/**
* @param reference the reference of the document to reset to its standard state (what it looks like in the
* extension XAR)
* @param jobId the id of the job which computed the diff if any
* @return true if the reset actually did something, false otherwise (any produced error can be accessed using
* {@link #getLastError()})
* @since 9.3RC1
*/
public boolean reset(DocumentReference reference, List<String> jobId) {
setError(null);
try {
// Only current author is allowed to modify (and so reset) the target document
this.genericAuthorization.checkAccess(Right.EDIT, this.xcontextProvider.get().getAuthorReference(), reference);
// Reset the document in the DB
this.packager.reset(reference, this.xcontextProvider.get().getUserReference());
// Update the existing job status if any
if (jobId != null) {
JobStatus jobStatus = getJobStatus(jobId);
if (jobStatus != null && jobStatus instanceof DiffXarJobStatus) {
((DiffXarJobStatus) jobStatus).reset(reference);
}
}
return true;
} catch (Exception e) {
setError(e);
}
return false;
}
Aggregations