Interface XWikiRecycleBinStoreInterface

  • All Known Implementing Classes:
    XWikiHibernateRecycleBinStore

    @Role
    public interface XWikiRecycleBinStoreInterface
    Interface for RecycleBin feature (XWIKI-543) store system.
    Since:
    1.2M1
    Version:
    $Id: 50bd20932d8ec731058b580fdf86d80e7f32187f $
    • Method Detail

      • saveToRecycleBin

        void saveToRecycleBin​(XWikiDocument doc,
                              String deleter,
                              Date date,
                              XWikiContext context,
                              boolean bTransaction)
                       throws XWikiException
        Save document to recycle bin.
        Parameters:
        doc - - document to save
        deleter - - the user which delete document
        date - - date of delete action
        bTransaction - - should use old transaction(false) or create new (true)
        context - - used while saving
        Throws:
        XWikiException - if error in saving
      • saveToRecycleBin

        default void saveToRecycleBin​(XWikiDocument doc,
                                      String deleter,
                                      Date date,
                                      String batchId,
                                      XWikiContext context,
                                      boolean bTransaction)
                               throws XWikiException
        Save document to recycle bin.
        Parameters:
        doc - - document to save
        deleter - - the user which delete document
        date - - date of delete action
        batchId - - id of the operation that deleted multiple documents at the same time, useful when trying to revert the operation. null or empty values are ignored
        bTransaction - - should use old transaction(false) or create new (true)
        context - - used while saving
        Throws:
        XWikiException - if error in saving
        Since:
        9.4RC1
      • restoreFromRecycleBin

        default XWikiDocument restoreFromRecycleBin​(long index,
                                                    XWikiContext context,
                                                    boolean bTransaction)
                                             throws XWikiException
        Parameters:
        index - - what deleted document to restore. see XWikiDeletedDocument.getId()
        context - - used while loading
        bTransaction - - should use old transaction(false) or create new (true)
        Returns:
        the restored document from recycle bin
        Throws:
        XWikiException - if error while loading
        Since:
        9.4RC1
      • getDeletedDocument

        default XWikiDeletedDocument getDeletedDocument​(long index,
                                                        XWikiContext context,
                                                        boolean bTransaction)
                                                 throws XWikiException
        Parameters:
        index - - what deleted document to restore. See XWikiDeletedDocument.getId()
        context - - used while loading
        bTransaction - - 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
        Since:
        9.4RC1
      • getAllDeletedDocuments

        XWikiDeletedDocument[] getAllDeletedDocuments​(XWikiDocument doc,
                                                      XWikiContext context,
                                                      boolean bTransaction)
                                               throws XWikiException
        Parameters:
        doc - - the deleted document
        context - - used to load
        bTransaction - - 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

        default Long[] getAllDeletedDocumentsIds​(XWikiContext context,
                                                 int limit)
                                          throws XWikiException
        Get all the deleted documents ID or a specified number. Sorted by date.
        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
        Since:
        10.10RC1
      • getNumberOfDeletedDocuments

        default Long getNumberOfDeletedDocuments​(XWikiContext context)
                                          throws XWikiException
        Parameters:
        context - - used to realize the query.
        Returns:
        the number of deleted documents in the recycle bin.
        Throws:
        XWikiException - - if error in loading.
        Since:
        10.10RC1
      • getAllDeletedDocuments

        default XWikiDeletedDocument[] getAllDeletedDocuments​(String batchId,
                                                              XWikiContext context,
                                                              boolean bTransaction)
                                                       throws XWikiException
        Parameters:
        batchId - - id of the operation that deleted multiple documents at the same time; useful when trying to revert the operation
        context - - used to load
        bTransaction - - 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
        Since:
        9.4RC1
      • getAllDeletedDocuments

        default XWikiDeletedDocument[] getAllDeletedDocuments​(String batchId,
                                                              boolean withContent,
                                                              XWikiContext context,
                                                              boolean bTransaction)
                                                       throws XWikiException
        Parameters:
        batchId - - id of the operation that deleted multiple documents at the same time; useful when trying to revert the operation
        withContent - - true if the deleted document's content should also be loaded; false if
        context - - used to load
        bTransaction - - 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
        Since:
        9.4RC1
      • deleteFromRecycleBin

        @Deprecated
        void deleteFromRecycleBin​(XWikiDocument doc,
                                  long index,
                                  XWikiContext context,
                                  boolean bTransaction)
                           throws XWikiException
        Deprecated.
        since 9.4RC1. The document parameter is useless and gets in the way. Use deleteFromRecycleBin(long, XWikiContext, boolean) instead.
        Permanently delete document from recycle bin.
        Parameters:
        doc - - document to delete
        index - - which instance document in recycle bin to delete
        context - - used for environment
        bTransaction - - should use old transaction(false) or create new (true)
        Throws:
        XWikiException - if any error
      • deleteFromRecycleBin

        default void deleteFromRecycleBin​(long index,
                                          XWikiContext context,
                                          boolean bTransaction)
                                   throws XWikiException
        Permanently delete document from recycle bin.
        Parameters:
        index - - which instance document in recycle bin to delete
        context - - used for environment
        bTransaction - - should use old transaction(false) or create new (true)
        Throws:
        XWikiException - if any error
        Since:
        9.4RC1
      • checkAccess

        @Unstable
        default void checkAccess​(Right right,
                                 org.xwiki.user.UserReference userReference,
                                 XWikiDeletedDocument deletedDocument)
                          throws AuthorizationException
        Check if the given deleted document can be accessed for the given right by the given user. This method only throw the AuthorizationException if the right is not granted.
        Parameters:
        right - the right to check access for
        userReference - the user for whom to check access
        deletedDocument - the document to be accessed
        Throws:
        AuthorizationException - if the user doesn't have appropriate right
        Since:
        14.10, 14.4.7, 13.10.11
      • hasAccess

        @Unstable
        default 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.
        Parameters:
        right - the right to check access for
        userReference - the user for whom to check access
        deletedDocument - the document to be accessed
        Returns:
        true if the user have appropriate right
        Since:
        14.10, 14.4.7, 13.10.11