Package org.xwiki.template
Interface TemplateManager
-
@Role public interface TemplateManager
Internal toolkit to experiment on wiki-based templates.- Since:
- 7.0M1
- Version:
- $Id: 28bdf93272e0468b2a279f344669c10b045e695c $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default Template
createStringTemplate(String content, DocumentReference author)
Deprecated.since 14.0CR1, usecreateStringTemplate(String, DocumentReference, DocumentReference)
insteaddefault Template
createStringTemplate(String content, DocumentReference author, DocumentReference sourceReference)
Create a new template using a given content and a specific author and source document.org.xwiki.rendering.block.XDOM
execute(String templateName)
Execute and return the template asXDOM
.default org.xwiki.rendering.block.Block
execute(String templateName, boolean inline)
Execute and return the template asBlock
.org.xwiki.rendering.block.XDOM
execute(Template template)
Execute and return the template asXDOM
.default org.xwiki.rendering.block.Block
execute(Template template, boolean inline)
Execute and return the template asBlock
.org.xwiki.rendering.block.XDOM
executeNoException(String templateName)
Execute and return the template asXDOM
.default org.xwiki.rendering.block.Block
executeNoException(String templateName, boolean inline)
Execute and return the template asBlock
.org.xwiki.rendering.block.XDOM
executeNoException(Template template)
Execute and return the template asXDOM
.default org.xwiki.rendering.block.Block
executeNoException(Template template, boolean inline)
Execute and return the template asBlock
.Template
getSkinTemplate(String templateName, Skin skin)
Search the template with passed name in the passed skin.Template
getTemplate(String templateName)
Search everywhere for the template with passed name depending on the current context (current skin, etc).Template
getTemplate(String templateName, Skin skin)
Search the template with passed name in the passed skin.org.xwiki.rendering.block.XDOM
getXDOM(String templateName)
Parse the template with the provided name and return it asXDOM
.org.xwiki.rendering.block.XDOM
getXDOM(Template template)
Parse the template with the provided name and return it asXDOM
.org.xwiki.rendering.block.XDOM
getXDOMNoException(String templateName)
Parse the template with the provided name and return it asXDOM
.org.xwiki.rendering.block.XDOM
getXDOMNoException(Template template)
Parse the template with the provided name and return it asXDOM
.String
render(String templateName)
Execute and render the template in current target syntax.default String
render(String templateName, boolean inline)
Execute and render the template in current target syntax.default void
render(String templateName, boolean inline, Writer writer)
Execute and render the template in current target syntax.void
render(String templateName, Writer writer)
Execute and render the template in current target syntax.default void
render(Template template, boolean inline, Writer writer)
Execute and render the template in current target syntax.void
render(Template template, Writer writer)
Execute and render the template in current target syntax.String
renderFromSkin(String templateName, Skin skin)
Execute and render the template in current target syntax from the passed skin.default String
renderFromSkin(String templateName, Skin skin, boolean inline)
Execute and render the template in current target syntax from the passed skin.default void
renderFromSkin(String templateName, Skin skin, boolean inline, Writer writer)
Execute and render the template in current target syntax from the passed skin.void
renderFromSkin(String templateName, Skin skin, Writer writer)
Execute and render the template in current target syntax from the passed skin.String
renderNoException(String templateName)
Execute and render the template in current target syntax.default String
renderNoException(String templateName, boolean inline)
Execute and render the template in current target syntax.default void
renderNoException(String templateName, boolean inline, Writer writer)
Execute and render the template in current target syntax.void
renderNoException(String templateName, Writer writer)
Execute and render the template in current target syntax.default void
renderNoException(Template template, boolean inline, Writer writer)
Execute and render the template in current target syntax.void
renderNoException(Template template, Writer writer)
Execute and render the template in current target syntax.
-
-
-
Method Detail
-
getXDOMNoException
org.xwiki.rendering.block.XDOM getXDOMNoException(Template template)
Parse the template with the provided name and return it asXDOM
.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 asXDOM
.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 asXDOM
.- 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 asXDOM
.- 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 asXDOM
.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 asBlock
.Any failure is "printed" in the returned
Block
.- Parameters:
template
- the templateinline
- 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 asXDOM
.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 asBlock
.Any failure is "printed" in the returned
Block
.- Parameters:
templateName
- the name of the templateinline
- 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 asXDOM
.- 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 asBlock
.- Parameters:
template
- the templateinline
- 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 asXDOM
.- 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 asBlock
.- Parameters:
templateName
- the name of the templateinline
- 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 templateinline
- 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 templateinline
- 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 templatewriter
- 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 templateinline
- indicate if the content of the template should be parse and executed as inline contentwriter
- 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 templatewriter
- 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 templateinline
- indicate if the content of the template should be parse and executed as inline contentwriter
- 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 templatewriter
- 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 templateinline
- indicate if the content of the template should be parse and executed as inline contentwriter
- 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 templatewriter
- 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 templateinline
- indicate if the content of the template should be parse and executed as inline contentwriter
- 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 templateskin
- 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 templateskin
- the skininline
- 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 templateskin
- the skinwriter
- 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 templateskin
- the skininline
- indicate if the content of the template should be parse and executed as inline contentwriter
- 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 templateskin
- 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 templateskin
- 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
@Deprecated default Template createStringTemplate(String content, DocumentReference author) throws Exception
Deprecated.since 14.0CR1, usecreateStringTemplate(String, DocumentReference, DocumentReference)
insteadCreate a new template using a given content and a specific author.- Parameters:
content
- the template contentauthor
- the template author- Returns:
- the template
- Throws:
Exception
- if an error occurred during template instantiation- Since:
- 9.6RC1
-
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 contentauthor
- the template authorsourceReference
- the reference of the document associated with theCallable
(which will be used to test the author right)- Returns:
- the template
- Throws:
Exception
- if an error occurred during template instantiation- Since:
- 14.0RC1
-
-