Interface TemplateManager


  • @Role
    public interface TemplateManager
    Internal toolkit to experiment on wiki-based templates.
    Since:
    7.0M1
    Version:
    $Id: 28bdf93272e0468b2a279f344669c10b045e695c $
    • Method Detail

      • getXDOMNoException

        org.xwiki.rendering.block.XDOM getXDOMNoException​(Template template)
        Parse the template with the provided name and return it as XDOM.

        Any failure is "printed" in the returned XDOM.

        Parameters:
        template - the template
        Returns:
        the XDOM source of the template
        Since:
        8.3RC1
      • getXDOMNoException

        org.xwiki.rendering.block.XDOM getXDOMNoException​(String templateName)
        Parse the template with the provided name and return it as XDOM.

        Any failure is "printed" in the returned XDOM.

        Parameters:
        templateName - the name of the template
        Returns:
        the XDOM source of the template
      • getXDOM

        org.xwiki.rendering.block.XDOM getXDOM​(Template template)
                                        throws Exception
        Parse the template with the provided name and return it as XDOM.
        Parameters:
        template - the template
        Returns:
        the XDOM source of the template
        Throws:
        Exception - when failing to parse the template
        Since:
        8.3RC1
      • getXDOM

        org.xwiki.rendering.block.XDOM getXDOM​(String templateName)
                                        throws Exception
        Parse the template with the provided name and return it as XDOM.
        Parameters:
        templateName - the name of the template
        Returns:
        the XDOM source of the template
        Throws:
        Exception - when failing to parse the template
      • executeNoException

        org.xwiki.rendering.block.XDOM executeNoException​(Template template)
        Execute and return the template as XDOM.

        Any failure is "printed" in the returned XDOM.

        Parameters:
        template - the template
        Returns:
        the XDOM result of the template execution
        Since:
        8.3RC1
      • executeNoException

        @Unstable
        default org.xwiki.rendering.block.Block executeNoException​(Template template,
                                                                   boolean inline)
        Execute and return the template as Block.

        Any failure is "printed" in the returned Block.

        Parameters:
        template - the template
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the Block result of the template execution
        Since:
        14.0RC1
      • executeNoException

        org.xwiki.rendering.block.XDOM executeNoException​(String templateName)
        Execute and return the template as XDOM.

        Any failure is "printed" in the returned XDOM.

        Parameters:
        templateName - the name of the template
        Returns:
        the XDOM result of the template execution
      • executeNoException

        @Unstable
        default org.xwiki.rendering.block.Block executeNoException​(String templateName,
                                                                   boolean inline)
        Execute and return the template as Block.

        Any failure is "printed" in the returned Block.

        Parameters:
        templateName - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the Block result of the template execution
        Since:
        14.0RC1
      • execute

        org.xwiki.rendering.block.XDOM execute​(Template template)
                                        throws Exception
        Execute and return the template as XDOM.
        Parameters:
        template - the template
        Returns:
        the XDOM result of the template execution
        Throws:
        Exception - when failing to parse the template
        Since:
        8.3RC1
      • execute

        @Unstable
        default org.xwiki.rendering.block.Block execute​(Template template,
                                                        boolean inline)
                                                 throws Exception
        Execute and return the template as Block.
        Parameters:
        template - the template
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the XDOM result of the template execution
        Throws:
        Exception - when failing to parse the template
        Since:
        14.0RC1
      • execute

        org.xwiki.rendering.block.XDOM execute​(String templateName)
                                        throws Exception
        Execute and return the template as XDOM.
        Parameters:
        templateName - the name of the template
        Returns:
        the XDOM result of the template execution
        Throws:
        Exception - when failing to parse the template
      • execute

        @Unstable
        default org.xwiki.rendering.block.Block execute​(String templateName,
                                                        boolean inline)
                                                 throws Exception
        Execute and return the template as Block.
        Parameters:
        templateName - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the Block result of the template execution
        Throws:
        Exception - when failing to parse the template
        Since:
        14.0RC1
      • renderNoException

        String renderNoException​(String templateName)
        Execute and render the template in current target syntax.

        Any failure is "printed" in the returned result.

        Parameters:
        templateName - the name of the template
        Returns:
        the result of the execution of the template in the current target syntax
      • renderNoException

        @Unstable
        default String renderNoException​(String templateName,
                                         boolean inline)
        Execute and render the template in current target syntax.

        Any failure is "printed" in the returned result.

        Parameters:
        templateName - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the result of the execution of the template in the current target syntax
        Since:
        14.0RC1
      • render

        String render​(String templateName)
               throws Exception
        Execute and render the template in current target syntax.
        Parameters:
        templateName - the name of the template
        Returns:
        the result of the execution of the template in the current target syntax
        Throws:
        Exception - when failing to render the template
      • render

        @Unstable
        default String render​(String templateName,
                              boolean inline)
                       throws Exception
        Execute and render the template in current target syntax.
        Parameters:
        templateName - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the result of the execution of the template in the current target syntax
        Throws:
        Exception - when failing to render the template
        Since:
        14.0RC1
      • renderNoException

        void renderNoException​(Template template,
                               Writer writer)
        Execute and render the template in current target syntax.
        Parameters:
        template - the template
        writer - the writer containing the result of the execution and rendering
        Since:
        8.3RC1
      • renderNoException

        @Unstable
        default void renderNoException​(Template template,
                                       boolean inline,
                                       Writer writer)
        Execute and render the template in current target syntax.
        Parameters:
        template - the template
        inline - indicate if the content of the template should be parse and executed as inline content
        writer - the writer containing the result of the execution and rendering
        Since:
        14.0RC1
      • renderNoException

        void renderNoException​(String templateName,
                               Writer writer)
        Execute and render the template in current target syntax.
        Parameters:
        templateName - the name of the template
        writer - the writer containing the result of the execution and rendering
      • renderNoException

        @Unstable
        default void renderNoException​(String templateName,
                                       boolean inline,
                                       Writer writer)
        Execute and render the template in current target syntax.
        Parameters:
        templateName - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        writer - the writer containing the result of the execution and rendering
        Since:
        14.0RC1
      • render

        void render​(Template template,
                    Writer writer)
             throws Exception
        Execute and render the template in current target syntax.
        Parameters:
        template - the name of the template
        writer - the writer containing the result of the execution and rendering
        Throws:
        Exception - when failing to render the template
      • render

        @Unstable
        default void render​(Template template,
                            boolean inline,
                            Writer writer)
                     throws Exception
        Execute and render the template in current target syntax.
        Parameters:
        template - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        writer - the writer containing the result of the execution and rendering
        Throws:
        Exception - when failing to render the template
        Since:
        14.0RC1
      • render

        void render​(String templateName,
                    Writer writer)
             throws Exception
        Execute and render the template in current target syntax.
        Parameters:
        templateName - the name of the template
        writer - the writer containing the result of the execution and rendering
        Throws:
        Exception - when failing to render the template
      • render

        @Unstable
        default void render​(String templateName,
                            boolean inline,
                            Writer writer)
                     throws Exception
        Execute and render the template in current target syntax.
        Parameters:
        templateName - the name of the template
        inline - indicate if the content of the template should be parse and executed as inline content
        writer - the writer containing the result of the execution and rendering
        Throws:
        Exception - when failing to render the template
        Since:
        14.0RC1
      • renderFromSkin

        String renderFromSkin​(String templateName,
                              Skin skin)
                       throws Exception
        Execute and render the template in current target syntax from the passed skin. When the template is not found in the passed skin it fallback on skin parent etc.
        Parameters:
        templateName - the name of the template
        skin - the skin
        Returns:
        the result of the execution of the template in the current target syntax
        Throws:
        Exception - when failing to render the template
      • renderFromSkin

        @Unstable
        default String renderFromSkin​(String templateName,
                                      Skin skin,
                                      boolean inline)
                               throws Exception
        Execute and render the template in current target syntax from the passed skin. When the template is not found in the passed skin it fallback on skin parent etc.
        Parameters:
        templateName - the name of the template
        skin - the skin
        inline - indicate if the content of the template should be parse and executed as inline content
        Returns:
        the result of the execution of the template in the current target syntax
        Throws:
        Exception - when failing to render the template
        Since:
        14.0RC1
      • renderFromSkin

        void renderFromSkin​(String templateName,
                            Skin skin,
                            Writer writer)
                     throws Exception
        Execute and render the template in current target syntax from the passed skin. When the template is not found in the passed skin it fallback on skin parent etc.
        Parameters:
        templateName - the name of the template
        skin - the skin
        writer - the writer containing the result of the execution and rendering
        Throws:
        Exception - when failing to render the template
      • renderFromSkin

        @Unstable
        default void renderFromSkin​(String templateName,
                                    Skin skin,
                                    boolean inline,
                                    Writer writer)
                             throws Exception
        Execute and render the template in current target syntax from the passed skin. When the template is not found in the passed skin it fallback on skin parent etc.
        Parameters:
        templateName - the name of the template
        skin - the skin
        inline - indicate if the content of the template should be parse and executed as inline content
        writer - the writer containing the result of the execution and rendering
        Throws:
        Exception - when failing to render the template
        Since:
        14.0RC1
      • getSkinTemplate

        Template getSkinTemplate​(String templateName,
                                 Skin skin)
        Search the template with passed name in the passed skin.

        Does not fallback on parent skin.

        Parameters:
        templateName - the name of the template
        skin - the skin
        Returns:
        the template
      • getTemplate

        Template getTemplate​(String templateName,
                             Skin skin)
        Search the template with passed name in the passed skin.

        Fallback on parent skin.

        Parameters:
        templateName - the name of the template
        skin - the skin
        Returns:
        the template
      • getTemplate

        Template getTemplate​(String templateName)
        Search everywhere for the template with passed name depending on the current context (current skin, etc).
        Parameters:
        templateName - the name of the template
        Returns:
        the template
      • createStringTemplate

        default Template createStringTemplate​(String content,
                                              DocumentReference author,
                                              DocumentReference sourceReference)
                                       throws Exception
        Create a new template using a given content and a specific author and source document.
        Parameters:
        content - the template content
        author - the template author
        sourceReference - the reference of the document associated with the Callable (which will be used to test the author right)
        Returns:
        the template
        Throws:
        Exception - if an error occurred during template instantiation
        Since:
        14.0RC1