use of com.xpn.xwiki.doc.XWikiAttachmentArchive in project xwiki-platform by xwiki.
the class FilesystemAttachmentVersioningStore method deleteArchive.
/**
* {@inheritDoc}
* <p>
* bTransaction is ignored by this implementation. If you need to delete an archive inside of a larger transaction,
* please use getArchiveDeleteRunnable()
* </p>
*
* @see AttachmentVersioningStore#deleteArchive(XWikiAttachment, XWikiContext, boolean)
*/
@Override
public void deleteArchive(final XWikiAttachment attachment, final XWikiContext context, final boolean bTransaction) throws XWikiException {
if (attachment == null) {
throw new NullPointerException("The attachment to delete cannot be null");
}
try {
final XWikiAttachmentArchive archive = this.loadArchive(attachment, context, bTransaction);
this.getArchiveDeleteRunnable(archive).start();
} catch (Exception e) {
if (e instanceof XWikiException) {
throw (XWikiException) e;
}
final Object[] args = { attachment.getFilename(), UNKNOWN_NAME };
if (attachment.getDoc() != null) {
args[1] = attachment.getDoc().getFullName();
}
throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_UNKNOWN, "Exception while deleting attachment archive {0} from document {1}", e, args);
}
}
Aggregations