Interface DocumentRevisionProvider


  • @Role
    public interface DocumentRevisionProvider
    Provide generic way of requesting a specific revision of a document from several sources (database, installed XAR extension, etc.).

    The revision syntax is <provider hint>:<revision>, default provide being database (the version of the document in the history).

    Since:
    9.4RC1
    Version:
    $Id: ce21cd452fa088c17a54fcd1ee878db79155ef1b $
    • Method Detail

      • getRevision

        XWikiDocument getRevision​(XWikiDocument document,
                                  String revision)
                           throws XWikiException
        Load the document in the provided revision.
        Parameters:
        document - the current document
        revision - the revision of the document
        Returns:
        the XWikiDocument instance or null if none existing
        Throws:
        XWikiException - when failing to load the document revision
      • checkAccess

        @Unstable
        default void checkAccess​(Right right,
                                 org.xwiki.user.UserReference userReference,
                                 DocumentReference documentReference,
                                 String revision)
                          throws AuthorizationException,
                                 XWikiException
        Check if access is granted on the given document revision, for the given user and right: if the access is not granted this method will throw an AccessDeniedException. This method allows each revision provider to have their own check depending on the type of revision.
        Parameters:
        right - the right for which to check if access is granted
        userReference - the user for whom to check access
        documentReference - the reference of the document
        revision - the revision of the document
        Throws:
        AuthorizationException - if the access is denied
        XWikiException - in case of problem when loading the revision
        Since:
        14.10, 14.4.7, 13.10.11