use of org.xwiki.store.FileSaveTransactionRunnable in project xwiki-platform by xwiki.
the class FilesystemRecycleBinContentStore method save.
@Override
public void save(XWikiDocument document, long index, boolean bTransaction) throws XWikiException {
final XWikiContext xcontext = this.xcontextProvider.get();
final XWikiHibernateTransaction transaction = new XWikiHibernateTransaction(xcontext);
final File contentFile = this.fileTools.getDeletedDocumentFileProvider(document.getDocumentReferenceWithLocale(), index).getDeletedDocumentContentFile();
FileSerializer serializer = new DeletedDocumentContentFileSerializer(document, StandardCharsets.UTF_8.name());
new FileSaveTransactionRunnable(contentFile, fileTools.getTempFile(contentFile), fileTools.getBackupFile(contentFile), fileTools.getLockForFile(contentFile), serializer).runIn(transaction);
try {
transaction.start();
} catch (Exception e) {
throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_SAVING_ATTACHMENT, "Exception while saving deleted document content.", e);
}
}
Aggregations