Package com.xpn.xwiki.store
Class XWikiHibernateRecycleBinStore
- java.lang.Object
-
- com.xpn.xwiki.internal.store.AbstractXWikiStore
-
- com.xpn.xwiki.store.XWikiHibernateBaseStore
-
- com.xpn.xwiki.store.XWikiHibernateRecycleBinStore
-
- All Implemented Interfaces:
XWikiRecycleBinStoreInterface
@Component @Named("hibernate") @Singleton public class XWikiHibernateRecycleBinStore extends XWikiHibernateBaseStore implements XWikiRecycleBinStoreInterfaceRealization ofXWikiRecycleBinStoreInterfacefor Hibernate store.- Version:
- $Id: 14afb5b8175cf189e78858f2e46567605fec0bba $
-
-
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 XWikiHibernateRecycleBinStore()Empty constructor needed for component manager.XWikiHibernateRecycleBinStore(XWikiContext context)Deprecated.1.6M1.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckAccess(Right right, org.xwiki.user.UserReference userReference, XWikiDeletedDocument deletedDocument)Check if the given deleted document can be accessed for the given right by the given user.voiddeleteFromRecycleBin(long index, XWikiContext context, boolean bTransaction)Permanently delete document from recycle bin.voiddeleteFromRecycleBin(XWikiDocument doc, long index, XWikiContext context, boolean bTransaction)Permanently delete document from recycle bin.XWikiDeletedDocument[]getAllDeletedDocuments(XWikiDocument doc, XWikiContext context, boolean bTransaction)XWikiDeletedDocument[]getAllDeletedDocuments(String batchId, boolean withContent, XWikiContext context, boolean bTransaction)XWikiDeletedDocument[]getAllDeletedDocuments(String batchId, XWikiContext context, boolean bTransaction)Long[]getAllDeletedDocumentsIds(XWikiContext context, int limit)Get all the deleted documents ID or a specified number.XWikiDeletedDocumentgetDeletedDocument(long index, XWikiContext context, boolean bTransaction)XWikiDeletedDocumentgetDeletedDocument(XWikiDocument doc, long index, XWikiContext context, boolean bTransaction)LonggetNumberOfDeletedDocuments(XWikiContext context)booleanhasAccess(Right right, org.xwiki.user.UserReference userReference, XWikiDeletedDocument deletedDocument)Check if the given deleted document can be accessed for the given right by the given user.XWikiDocumentrestoreFromRecycleBin(long index, XWikiContext inputxcontext, boolean bTransaction)XWikiDocumentrestoreFromRecycleBin(XWikiDocument doc, long index, XWikiContext inputxcontext, boolean bTransaction)voidsaveToRecycleBin(XWikiDocument doc, String deleter, Date date, XWikiContext inputxcontext, boolean bTransaction)Save document to recycle bin.voidsaveToRecycleBin(XWikiDocument doc, String deleter, Date date, String batchId, XWikiContext inputxcontext, boolean bTransaction)Save document to recycle bin.-
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
-
XWikiHibernateRecycleBinStore
@Deprecated public XWikiHibernateRecycleBinStore(XWikiContext context)
Deprecated.1.6M1. Use ComponentManager#getInstance(XWikiRecycleBinStoreInterface.class) instead.- Parameters:
context- used for environment
-
XWikiHibernateRecycleBinStore
public XWikiHibernateRecycleBinStore()
Empty constructor needed for component manager.
-
-
Method Detail
-
saveToRecycleBin
public void saveToRecycleBin(XWikiDocument doc, String deleter, Date date, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
Description copied from interface:XWikiRecycleBinStoreInterfaceSave document to recycle bin.- Specified by:
saveToRecycleBinin interfaceXWikiRecycleBinStoreInterface- Parameters:
doc- - document to savedeleter- - the user which delete documentdate- - date of delete actioninputxcontext- - used while savingbTransaction- - should use old transaction(false) or create new (true)- Throws:
XWikiException- if error in saving
-
saveToRecycleBin
public void saveToRecycleBin(XWikiDocument doc, String deleter, Date date, String batchId, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
Description copied from interface:XWikiRecycleBinStoreInterfaceSave document to recycle bin.- Specified by:
saveToRecycleBinin interfaceXWikiRecycleBinStoreInterface- Parameters:
doc- - document to savedeleter- - the user which delete documentdate- - date of delete actionbatchId- - id of the operation that deleted multiple documents at the same time, useful when trying to revert the operation.nullor empty values are ignoredinputxcontext- - used while savingbTransaction- - should use old transaction(false) or create new (true)- Throws:
XWikiException- if error in saving
-
restoreFromRecycleBin
public XWikiDocument restoreFromRecycleBin(XWikiDocument doc, long index, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
- Specified by:
restoreFromRecycleBinin interfaceXWikiRecycleBinStoreInterface- Parameters:
doc- - document to restoreindex- - what deleted document to restore. seeXWikiDeletedDocument.getId()inputxcontext- - used while loadingbTransaction- - should use old transaction(false) or create new (true)- Returns:
- restored document from recycle bin
- Throws:
XWikiException- if error while loading
-
restoreFromRecycleBin
public XWikiDocument restoreFromRecycleBin(long index, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
- Specified by:
restoreFromRecycleBinin interfaceXWikiRecycleBinStoreInterface- Parameters:
index- - what deleted document to restore. seeXWikiDeletedDocument.getId()inputxcontext- - used while loadingbTransaction- - should use old transaction(false) or create new (true)- Returns:
- the restored document from recycle bin
- Throws:
XWikiException- if error while loading
-
getDeletedDocument
public XWikiDeletedDocument getDeletedDocument(XWikiDocument doc, long index, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
getDeletedDocumentin interfaceXWikiRecycleBinStoreInterface- Parameters:
doc- - deleted documentindex- - what deleted document to restore. seeXWikiDeletedDocument.getId()context- - used while loadingbTransaction- - should use old transaction(false) or create new (true)- Returns:
- specified deleted document from recycle bin. null if not found.
- Throws:
XWikiException- if error while loading
-
getDeletedDocument
public XWikiDeletedDocument getDeletedDocument(long index, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
getDeletedDocumentin interfaceXWikiRecycleBinStoreInterface- Parameters:
index- - what deleted document to restore. SeeXWikiDeletedDocument.getId()context- - used while loadingbTransaction- - should use old transaction(false) or create new (true)- Returns:
- specified deleted document from recycle bin or
nullif not found. - Throws:
XWikiException- if error while loading
-
getAllDeletedDocuments
public XWikiDeletedDocument[] getAllDeletedDocuments(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
getAllDeletedDocumentsin interfaceXWikiRecycleBinStoreInterface- Parameters:
doc- - the deleted documentcontext- - used to loadbTransaction- - should use old transaction(false) or create new (true)- Returns:
- info about all delete actions of specific document. sorted by date.
- Throws:
XWikiException- - if error in loading
-
getAllDeletedDocumentsIds
public Long[] getAllDeletedDocumentsIds(XWikiContext context, int limit) throws XWikiException
Description copied from interface:XWikiRecycleBinStoreInterfaceGet all the deleted documents ID or a specified number. Sorted by date.- Specified by:
getAllDeletedDocumentsIdsin interfaceXWikiRecycleBinStoreInterface- Parameters:
context- - used to load the deleted documents id.limit- - if > 0 then all deleted documents id are returned. Else the specified number.- Returns:
- an array of IDs of deleted documents.
- Throws:
XWikiException- - if error in loading
-
getNumberOfDeletedDocuments
public Long getNumberOfDeletedDocuments(XWikiContext context) throws XWikiException
- Specified by:
getNumberOfDeletedDocumentsin interfaceXWikiRecycleBinStoreInterface- Parameters:
context- - used to realize the query.- Returns:
- the number of deleted documents in the recycle bin.
- Throws:
XWikiException- - if error in loading.
-
getAllDeletedDocuments
public XWikiDeletedDocument[] getAllDeletedDocuments(String batchId, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
getAllDeletedDocumentsin interfaceXWikiRecycleBinStoreInterface- Parameters:
batchId- - id of the operation that deleted multiple documents at the same time; useful when trying to revert the operationcontext- - used to loadbTransaction- - should use old transaction(false) or create new (true)- Returns:
- info about all documents that were deleted in the same batch, as part of the same operation
- Throws:
XWikiException- - if error in loading
-
getAllDeletedDocuments
public XWikiDeletedDocument[] getAllDeletedDocuments(String batchId, boolean withContent, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
getAllDeletedDocumentsin interfaceXWikiRecycleBinStoreInterface- Parameters:
batchId- - id of the operation that deleted multiple documents at the same time; useful when trying to revert the operationwithContent- -trueif the deleted document's content should also be loaded;falseifcontext- - used to loadbTransaction- - should use old transaction(false) or create new (true)- Returns:
- info about all documents that were deleted in the same batch, as part of the same operation
- Throws:
XWikiException- - if error in loading
-
deleteFromRecycleBin
public void deleteFromRecycleBin(XWikiDocument doc, long index, XWikiContext context, boolean bTransaction) throws XWikiException
Description copied from interface:XWikiRecycleBinStoreInterfacePermanently delete document from recycle bin.- Specified by:
deleteFromRecycleBinin interfaceXWikiRecycleBinStoreInterface- Parameters:
doc- - document to deleteindex- - which instance document in recycle bin to deletecontext- - used for environmentbTransaction- - should use old transaction(false) or create new (true)- Throws:
XWikiException- if any error
-
deleteFromRecycleBin
public void deleteFromRecycleBin(long index, XWikiContext context, boolean bTransaction) throws XWikiExceptionDescription copied from interface:XWikiRecycleBinStoreInterfacePermanently delete document from recycle bin.- Specified by:
deleteFromRecycleBinin interfaceXWikiRecycleBinStoreInterface- Parameters:
index- - which instance document in recycle bin to deletecontext- - used for environmentbTransaction- - should use old transaction(false) or create new (true)- Throws:
XWikiException- if any error
-
checkAccess
public void checkAccess(Right right, org.xwiki.user.UserReference userReference, XWikiDeletedDocument deletedDocument) throws AuthorizationException
Description copied from interface:XWikiRecycleBinStoreInterfaceCheck if the given deleted document can be accessed for the given right by the given user. This method only throw theAuthorizationExceptionif the right is not granted.- Specified by:
checkAccessin interfaceXWikiRecycleBinStoreInterface- Parameters:
right- the right to check access foruserReference- the user for whom to check accessdeletedDocument- the document to be accessed- Throws:
AuthorizationException- if the user doesn't have appropriate right
-
hasAccess
public boolean hasAccess(Right right, org.xwiki.user.UserReference userReference, XWikiDeletedDocument deletedDocument)
Description copied from interface:XWikiRecycleBinStoreInterfaceCheck if the given deleted document can be accessed for the given right by the given user.- Specified by:
hasAccessin interfaceXWikiRecycleBinStoreInterface- Parameters:
right- the right to check access foruserReference- the user for whom to check accessdeletedDocument- the document to be accessed- Returns:
trueif the user have appropriate right
-
-