Package com.xpn.xwiki.store.hibernate
Class HibernateAttachmentRecycleBinStore
- java.lang.Object
-
- com.xpn.xwiki.internal.store.AbstractXWikiStore
-
- com.xpn.xwiki.store.XWikiHibernateBaseStore
-
- com.xpn.xwiki.store.hibernate.HibernateAttachmentRecycleBinStore
-
- All Implemented Interfaces:
AttachmentRecycleBinStore
@Component @Named("hibernate") @Singleton public class HibernateAttachmentRecycleBinStore extends XWikiHibernateBaseStore implements AttachmentRecycleBinStore
Realization ofAttachmentRecycleBinStore
for Hibernate-based storage.- Since:
- 1.4M1
- Version:
- $Id: a0cbe871a4d1c6b9d9f8774a3995696544166090 $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.xpn.xwiki.store.XWikiHibernateBaseStore
XWikiHibernateBaseStore.HibernateCallback<T>
-
-
Field Summary
-
Fields inherited from class com.xpn.xwiki.store.XWikiHibernateBaseStore
hibernateConfiguration, HINT, loggerManager, store
-
-
Constructor Summary
Constructors Constructor Description HibernateAttachmentRecycleBinStore()
Empty constructor needed for component manager.HibernateAttachmentRecycleBinStore(XWikiContext context)
Deprecated.1.6M1.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteFromRecycleBin(long index, XWikiContext inputxcontext, 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.protected AttachmentRecycleBinContentStore
getAttachmentRecycleBinContentStore(String storeType)
DeletedAttachment
getDeletedAttachment(long index, XWikiContext context, boolean bTransaction)
Returns ahandler
for a deleted attachment.XWikiAttachment
restoreFromRecycleBin(XWikiAttachment attachment, long index, XWikiContext inputxcontext, boolean bTransaction)
Restore an attachment from the recycle bin (with full history).void
saveToRecycleBin(XWikiAttachment attachment, String deleter, Date date, XWikiContext inputxcontext, boolean bTransaction)
Save attachment to recycle bin, with full history.-
Methods inherited from class com.xpn.xwiki.store.XWikiHibernateBaseStore
beginTransaction, beginTransaction, beginTransaction, beginTransaction, checkHibernate, cleanUp, createHibernateSequenceIfRequired, dynamicMappingTableName, endTransaction, endTransaction, escapeSchema, execute, execute, executeRead, executeRead, executeWrite, executeWrite, failSafeExecute, failSafeExecuteRead, failSafeExecuteWrite, getConfiguration, getConnections, getDatabaseMetaData, getDatabaseProductName, getDatabaseProductName, getDialect, getExecution, getHint, getMapping, getMetadata, getNbConnections, getPath, getSchemaFromWikiName, getSchemaFromWikiName, getSchemaFromWikiName, getSchemaUpdateScript, getSession, getSessionFactory, getTransaction, isInSchemaMode, isVirtual, makeMapping, setDatabase, setNbConnections, setPath, setSession, setSessionFactory, setTransaction, shutdownHibernate, updateSchema, updateSchema, updateSchema, updateSchema
-
-
-
-
Constructor Detail
-
HibernateAttachmentRecycleBinStore
@Deprecated public HibernateAttachmentRecycleBinStore(XWikiContext context)
Deprecated.1.6M1. Use ComponentManager.lookup(AttachmentRecycleBinStore.class) instead.Constructor used byXWiki
during storage initialization.- Parameters:
context
- The current context.
-
HibernateAttachmentRecycleBinStore
public HibernateAttachmentRecycleBinStore()
Empty constructor needed for component manager.
-
-
Method Detail
-
saveToRecycleBin
public void saveToRecycleBin(XWikiAttachment attachment, String deleter, Date date, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
Description copied from interface:AttachmentRecycleBinStore
Save attachment to recycle bin, with full history.- Specified by:
saveToRecycleBin
in interfaceAttachmentRecycleBinStore
- Parameters:
attachment
- The attachment to save.deleter
- The user which deleted the attachment.date
- Date of delete action.inputxcontext
- 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
public XWikiAttachment restoreFromRecycleBin(XWikiAttachment attachment, long index, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
Description copied from interface:AttachmentRecycleBinStore
Restore an attachment from the recycle bin (with full history).- Specified by:
restoreFromRecycleBin
in interfaceAttachmentRecycleBinStore
- 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()
.inputxcontext
- 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:
AttachmentRecycleBinStore.getDeletedAttachment(long, XWikiContext, boolean)
-
getDeletedAttachment
public DeletedAttachment getDeletedAttachment(long index, XWikiContext context, boolean bTransaction) throws XWikiException
Description copied from interface:AttachmentRecycleBinStore
Returns ahandler
for a deleted attachment.- Specified by:
getDeletedAttachment
in interfaceAttachmentRecycleBinStore
- 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:
AttachmentRecycleBinStore.restoreFromRecycleBin(XWikiAttachment, long, XWikiContext, boolean)
-
getAllDeletedAttachments
public List<DeletedAttachment> getAllDeletedAttachments(XWikiAttachment attachment, XWikiContext context, boolean bTransaction) throws XWikiException
Description copied from interface:AttachmentRecycleBinStore
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).- Specified by:
getAllDeletedAttachments
in interfaceAttachmentRecycleBinStore
- 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
public List<DeletedAttachment> getAllDeletedAttachments(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException
Description copied from interface:AttachmentRecycleBinStore
Get all the deleted attachments for a given document.- Specified by:
getAllDeletedAttachments
in interfaceAttachmentRecycleBinStore
- 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
public void deleteFromRecycleBin(long index, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
Description copied from interface:AttachmentRecycleBinStore
Permanently delete attachment from recycle bin.- Specified by:
deleteFromRecycleBin
in interfaceAttachmentRecycleBinStore
- Parameters:
index
- Which instance to delete from the recycle bin.inputxcontext
- The current context.bTransaction
- Should use old transaction (false) or create new (true).- Throws:
XWikiException
- If an error occurs while executing the query.
-
getAttachmentRecycleBinContentStore
protected AttachmentRecycleBinContentStore getAttachmentRecycleBinContentStore(String storeType)
-
-