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 XWikiRecycleBinStoreInterface
Realization ofXWikiRecycleBinStoreInterface
for 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 void
checkAccess(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.void
deleteFromRecycleBin(long index, XWikiContext context, boolean bTransaction)
Permanently delete document from recycle bin.void
deleteFromRecycleBin(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.XWikiDeletedDocument
getDeletedDocument(long index, XWikiContext context, boolean bTransaction)
XWikiDeletedDocument
getDeletedDocument(XWikiDocument doc, long index, XWikiContext context, boolean bTransaction)
Long
getNumberOfDeletedDocuments(XWikiContext context)
boolean
hasAccess(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.XWikiDocument
restoreFromRecycleBin(long index, XWikiContext inputxcontext, boolean bTransaction)
XWikiDocument
restoreFromRecycleBin(XWikiDocument doc, long index, XWikiContext inputxcontext, boolean bTransaction)
void
saveToRecycleBin(XWikiDocument doc, String deleter, Date date, XWikiContext inputxcontext, boolean bTransaction)
Save document to recycle bin.void
saveToRecycleBin(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:XWikiRecycleBinStoreInterface
Save document to recycle bin.- Specified by:
saveToRecycleBin
in 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:XWikiRecycleBinStoreInterface
Save document to recycle bin.- Specified by:
saveToRecycleBin
in 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.null
or 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:
restoreFromRecycleBin
in 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:
restoreFromRecycleBin
in 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:
getDeletedDocument
in 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:
getDeletedDocument
in 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
null
if not found. - Throws:
XWikiException
- if error while loading
-
getAllDeletedDocuments
public XWikiDeletedDocument[] getAllDeletedDocuments(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
getAllDeletedDocuments
in 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:XWikiRecycleBinStoreInterface
Get all the deleted documents ID or a specified number. Sorted by date.- Specified by:
getAllDeletedDocumentsIds
in 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:
getNumberOfDeletedDocuments
in 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:
getAllDeletedDocuments
in 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:
getAllDeletedDocuments
in interfaceXWikiRecycleBinStoreInterface
- Parameters:
batchId
- - id of the operation that deleted multiple documents at the same time; useful when trying to revert the operationwithContent
- -true
if the deleted document's content should also be loaded;false
ifcontext
- - 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:XWikiRecycleBinStoreInterface
Permanently delete document from recycle bin.- Specified by:
deleteFromRecycleBin
in 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 XWikiException
Description copied from interface:XWikiRecycleBinStoreInterface
Permanently delete document from recycle bin.- Specified by:
deleteFromRecycleBin
in 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:XWikiRecycleBinStoreInterface
Check if the given deleted document can be accessed for the given right by the given user. This method only throw theAuthorizationException
if the right is not granted.- Specified by:
checkAccess
in 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:XWikiRecycleBinStoreInterface
Check if the given deleted document can be accessed for the given right by the given user.- Specified by:
hasAccess
in interfaceXWikiRecycleBinStoreInterface
- Parameters:
right
- the right to check access foruserReference
- the user for whom to check accessdeletedDocument
- the document to be accessed- Returns:
true
if the user have appropriate right
-
-