Interface WikiMacroManager


  • @Role
    public interface WikiMacroManager
    Component interface responsible for managing wiki macro instances.
    Since:
    2.0M2
    Version:
    $Id: 6222178e3e5320d19f00aaf8323d9228b8fd0693 $
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean hasWikiMacro​(org.xwiki.model.reference.DocumentReference documentReference)
      Utility method for querying WikiMacroManager to see if there is a WikiMacro already registered for the given document.
      void registerWikiMacro​(org.xwiki.model.reference.DocumentReference documentReference, WikiMacro wikiMacro)
      Registers the given WikiMacro against the ComponentManager matching the Wiki Macro visibility defined (Current User, Current Wiki, Global).
      void unregisterWikiMacro​(org.xwiki.model.reference.DocumentReference documentReference)
      Unregisters the wiki macro defined on the given document (if there is one).
    • Method Detail

      • registerWikiMacro

        void registerWikiMacro​(org.xwiki.model.reference.DocumentReference documentReference,
                               WikiMacro wikiMacro)
                        throws InsufficientPrivilegesException,
                               WikiMacroException
        Registers the given WikiMacro against the ComponentManager matching the Wiki Macro visibility defined (Current User, Current Wiki, Global). For example Macros defined with a "Current User" visibility are registered against the User Component Manager so that they are only visible from that Component Manager and not from other Component Manager.

        Note that the Execution Context must be set properly (the current user or the current wiki must be set) prior to calling this API.

        Parameters:
        documentReference - the name of the document which contains the wiki macro
        wikiMacro - the WikiMacro instance
        Throws:
        InsufficientPrivilegesException - if asked visibility is not allowed
        WikiMacroException - if a problem happened when registering the macro (document doesn't exist, etc.)
        Since:
        2.2.M1
      • unregisterWikiMacro

        void unregisterWikiMacro​(org.xwiki.model.reference.DocumentReference documentReference)
                          throws WikiMacroException
        Unregisters the wiki macro defined on the given document (if there is one).
        Parameters:
        documentReference - the name of the document which contains the wiki macro
        Throws:
        WikiMacroException - if a problem happened when registering the macro (document doesn't exist, etc)
        Since:
        2.2.M1
      • hasWikiMacro

        boolean hasWikiMacro​(org.xwiki.model.reference.DocumentReference documentReference)
        Utility method for querying WikiMacroManager to see if there is a WikiMacro already registered for the given document.
        Parameters:
        documentReference - the name of the document which contains the wiki macro
        Returns:
        true if there is already a macro registered under the given document name
        Since:
        2.2.M1