Package com.xpn.xwiki.store
Interface AttachmentRecycleBinStore
-
- All Known Implementing Classes:
HibernateAttachmentRecycleBinStore
@Role public interface AttachmentRecycleBinStore
Interface for AttachmentRecycleBin feature (XWIKI-2254) store system. Attachments can be placed in the recycle bin usingsaveToRecycleBin(XWikiAttachment, String, Date, XWikiContext, boolean)
, restored usingrestoreFromRecycleBin(XWikiAttachment, long, XWikiContext, boolean)
, and permanently removed from the recycle bin usingdeleteFromRecycleBin(long, XWikiContext, boolean)
.- Since:
- 1.4M1
- Version:
- $Id: e0392a10570ec1aa20f1b369a285d707b8266bfd $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deleteFromRecycleBin(long index, XWikiContext context, boolean bTransaction)
Permanently delete attachment from recycle bin.List<DeletedAttachment>
getAllDeletedAttachments(XWikiAttachment attachment, XWikiContext context, boolean bTransaction)
Get all the deleted attachments from the database matching an attachment template (document name and filename).List<DeletedAttachment>
getAllDeletedAttachments(XWikiDocument doc, XWikiContext context, boolean bTransaction)
Get all the deleted attachments for a given document.DeletedAttachment
getDeletedAttachment(long index, XWikiContext context, boolean bTransaction)
Returns ahandler
for a deleted attachment.XWikiAttachment
restoreFromRecycleBin(XWikiAttachment attachment, long index, XWikiContext context, boolean bTransaction)
Restore an attachment from the recycle bin (with full history).void
saveToRecycleBin(XWikiAttachment attachment, String deleter, Date date, XWikiContext context, boolean bTransaction)
Save attachment to recycle bin, with full history.
-
-
-
Method Detail
-
saveToRecycleBin
void saveToRecycleBin(XWikiAttachment attachment, String deleter, Date date, XWikiContext context, boolean bTransaction) throws XWikiException
Save attachment to recycle bin, with full history.- Parameters:
attachment
- The attachment to save.deleter
- The user which deleted the attachment.date
- Date of delete action.context
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Throws:
XWikiException
- If an exception occurs during the attachment export or attachment persistence.
-
restoreFromRecycleBin
XWikiAttachment restoreFromRecycleBin(XWikiAttachment attachment, long index, XWikiContext context, boolean bTransaction) throws XWikiException
Restore an attachment from the recycle bin (with full history).- Parameters:
attachment
- Optional attachment to restore. If a non-null value is passed, then this object will be changed to reflect the contents/history of the deleted attachment.index
- What deleted attachment to restore. SeeDeletedAttachment.getId()
.context
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Returns:
- Restored attachment, or
null
if an entry with the requested ID does not exist. - Throws:
XWikiException
- If an error occurs while loading or restoring the attachment.- See Also:
getDeletedAttachment(long, XWikiContext, boolean)
-
getDeletedAttachment
DeletedAttachment getDeletedAttachment(long index, XWikiContext context, boolean bTransaction) throws XWikiException
Returns ahandler
for a deleted attachment.- Parameters:
index
- What deleted attachment to restore. SeeDeletedAttachment.getId()
context
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Returns:
- Specified deleted document from recycle bin.
null
if not found. - Throws:
XWikiException
- If an error occurs while loading or restoring the attachment.- See Also:
restoreFromRecycleBin(XWikiAttachment, long, XWikiContext, boolean)
-
getAllDeletedAttachments
List<DeletedAttachment> getAllDeletedAttachments(XWikiAttachment attachment, XWikiContext context, boolean bTransaction) throws XWikiException
Get all the deleted attachments from the database matching an attachment template (document name and filename). The results are ordered by the deletion date, descending (most recently deleted first).- Parameters:
attachment
- Optional attachment template. Ifnull
, return information about all deleted attachments from the database. Otherwise, filter by the document and filename provided in the passed attachment.context
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Returns:
- Infos about all matching deleted attachments, sorted by date.
- Throws:
XWikiException
- If an error occurs while loading or restoring the attachments.
-
getAllDeletedAttachments
List<DeletedAttachment> getAllDeletedAttachments(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException
Get all the deleted attachments for a given document.- Parameters:
doc
- The document for which to retrieve deleted attachments.context
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Returns:
- Infos about all deleted attachments of specific document, sorted by date.
- Throws:
XWikiException
- If an error occurs while loading or restoring the attachments.
-
deleteFromRecycleBin
void deleteFromRecycleBin(long index, XWikiContext context, boolean bTransaction) throws XWikiException
Permanently delete attachment from recycle bin.- Parameters:
index
- Which instance to delete from the recycle bin.context
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Throws:
XWikiException
- If an error occurs while executing the query.
-
-