public class TemplatingFunctions extends Object
cmsfn
.Constructor and Description |
---|
TemplatingFunctions(javax.inject.Provider<info.magnolia.cms.core.AggregationState> aggregationStateProvider)
Deprecated.
since 5.4 - use
TemplatingFunctions(Provider instead. |
TemplatingFunctions(javax.inject.Provider<info.magnolia.cms.core.AggregationState> aggregationStateProvider,
info.magnolia.rendering.template.type.TemplateTypeHelper templateTypeFunctions)
Deprecated.
since 5.4.1 - use
TemplatingFunctions(Provider instead. |
TemplatingFunctions(javax.inject.Provider<info.magnolia.cms.core.AggregationState> aggregationStateProvider,
info.magnolia.rendering.template.type.TemplateTypeHelper templateTypeFunctions,
javax.inject.Provider<info.magnolia.cms.i18n.I18nContentSupport> i18nContentSupport)
Deprecated.
since 5.4.11/5.5.1. Use
TemplatingFunctions(info.magnolia.rendering.template.type.TemplateTypeHelper, javax.inject.Provider, javax.inject.Provider) instead. |
TemplatingFunctions(info.magnolia.rendering.template.type.TemplateTypeHelper templateTypeFunctions,
javax.inject.Provider<info.magnolia.cms.i18n.I18nContentSupport> i18nContentSupport,
javax.inject.Provider<info.magnolia.context.WebContext> webContextProvider) |
Modifier and Type | Method and Description |
---|---|
String |
abbreviateString(String stringToAbbreviate,
int length)
Shortens a
String to provided length and adds suffix " ... |
String |
abbreviateString(String stringToAbbreviate,
int length,
String suffix)
Shortens a
String to provided length and adds a custom suffix. |
List<info.magnolia.jcr.util.ContentMap> |
ancestors(info.magnolia.jcr.util.ContentMap contentMap)
See
ancestors(Node) for details. |
List<info.magnolia.jcr.util.ContentMap> |
ancestors(info.magnolia.jcr.util.ContentMap contentMap,
String nodeTypeName)
See
ancestors(Node, String) for details. |
List<javax.jcr.Node> |
ancestors(javax.jcr.Node content)
Return a list of ancestors of the provided node.
|
List<javax.jcr.Node> |
ancestors(javax.jcr.Node content,
String nodeTypeName)
Return a list of ancestors of the provided node which have the provided nodeType.
|
info.magnolia.jcr.util.ContentMap |
asContentMap(javax.jcr.Node content)
Return the equivalent contentMap for the provided node object.
|
List<info.magnolia.jcr.util.ContentMap> |
asContentMapList(Collection<javax.jcr.Node> nodeList)
Returns a List of
ContentMap objects for the provided collection of Node objects. |
protected List<info.magnolia.jcr.util.ContentMap> |
asContentMapList(Iterable<javax.jcr.Node> nodes) |
javax.jcr.Node |
asJCRNode(info.magnolia.jcr.util.ContentMap contentMap)
Return the equivalent jcr node object for the provided contentMap.
|
List<javax.jcr.Node> |
asNodeList(Collection<info.magnolia.jcr.util.ContentMap> contentMapList)
Returns a List of
Node objects for the provided collection of ContentMap objects. |
protected List<javax.jcr.Node> |
asNodeList(Iterable<javax.jcr.Node> nodes) |
List<info.magnolia.jcr.util.ContentMap> |
children(info.magnolia.jcr.util.ContentMap content)
Returns the child nodes of the provided contentMap - as a list of ContentMaps.
|
List<info.magnolia.jcr.util.ContentMap> |
children(info.magnolia.jcr.util.ContentMap content,
String nodeTypeName)
Returns the child nodes of the the provided contentMap of a specific nodeType - as a list of ContentMaps.
|
List<javax.jcr.Node> |
children(javax.jcr.Node content)
Returns the child nodes of the provided node.
|
List<javax.jcr.Node> |
children(javax.jcr.Node content,
String nodeTypeName)
Returns the child nodes of the provided node of a specific nodeType.
|
javax.jcr.Node |
content(String path)
Deprecated.
since 5.3.3 use
contentByPath(String) or nodeByPath(String) instead |
javax.jcr.Node |
content(String repository,
String path)
Deprecated.
since 5.3.3 use
contentByPath(String, String) or nodeByPath(String, String) instead |
info.magnolia.jcr.util.ContentMap |
contentById(String id)
Return the ContentMap by the given identifier from the website repository.
|
info.magnolia.jcr.util.ContentMap |
contentById(String id,
String workspace)
Return the ContentMap by the given identifier from the given repository.
|
javax.jcr.Node |
contentByIdentifier(String id)
Deprecated.
since 5.3.3 use
contentById(String) or {@link #nodeById(String) instead |
javax.jcr.Node |
contentByIdentifier(String repository,
String id)
Deprecated.
since 5.3.3 use
contentById(String, String) or contentByPath(String, String) instead |
info.magnolia.jcr.util.ContentMap |
contentByPath(String path)
Return the ContentMap for the given path from the website repository.
|
info.magnolia.jcr.util.ContentMap |
contentByPath(String path,
String workspace)
Return the ContentMap for the given path from the given repository.
|
info.magnolia.jcr.util.ContentMap |
contentByReference(info.magnolia.jcr.util.ContentMap content,
String idPropertyName,
String referencedWorkspace)
See
contentByReference(Node, String, String) for details. |
javax.jcr.Node |
contentByReference(javax.jcr.Node content,
String idPropertyName,
String referencedWorkspace)
Returns a
Node object which is referenced by its id, stored in
the @param propertyName. |
List<javax.jcr.Node> |
contentListByTemplateId(javax.jcr.Node searchRoot,
String templateId)
See
contentListByTemplateId(Node, String, int, String, String) for details. |
List<javax.jcr.Node> |
contentListByTemplateId(javax.jcr.Node searchRoot,
String templateId,
int maxResultSize,
String andClause,
String orderByClause)
Find content objects with the given template ID below a given search root.
|
List<info.magnolia.jcr.util.ContentMap> |
contentListByTemplateIds(info.magnolia.jcr.util.ContentMap searchRoot,
Set<String> templateIds,
int maxResultSize,
String andClause,
String orderByClause)
See
contentListByTemplateIds(Node, Set, int, String, String) for details. |
List<javax.jcr.Node> |
contentListByTemplateIds(javax.jcr.Node searchRoot,
Set<String> templateIds,
int maxResultSize,
String andClause,
String orderByClause)
Find content objects with one of the given template IDs below a given search root.
|
List<info.magnolia.jcr.util.ContentMap> |
contentListByTemplateType(info.magnolia.jcr.util.ContentMap siteRoot,
String templateType,
String templateSubtype)
See
contentListByTemplateType(Node, String, String, int, String, String) for details. |
List<info.magnolia.jcr.util.ContentMap> |
contentListByTemplateType(info.magnolia.jcr.util.ContentMap searchRoot,
String templateType,
String templateSubtype,
int maxResultSize,
String andClause,
String orderByClause)
See
contentListByTemplateType(Node, String, String, int, String, String) for details. |
List<javax.jcr.Node> |
contentListByTemplateType(javax.jcr.Node siteRoot,
String templateType,
String templateSubtype)
See
contentListByTemplateType(Node, String, String, int, String, String) for details. |
List<javax.jcr.Node> |
contentListByTemplateType(javax.jcr.Node searchRoot,
String templateType,
String templateSubtype,
int maxResultSize,
String andClause,
String orderByClause)
Find content objects with the given template type (and optionally subtype) below given search root.
|
String |
createHtmlAttribute(String name,
String value)
Util method to create html attributes
name="value" . |
info.magnolia.jcr.util.ContentMap |
decode(info.magnolia.jcr.util.ContentMap content)
Removes escaping of HTML on properties.
|
javax.jcr.Node |
decode(javax.jcr.Node content)
Removes escaping of HTML on properties.
|
String |
dump(Object obj) |
String |
dump(Object obj,
int depth) |
String |
dump(Object obj,
int depth,
boolean html) |
info.magnolia.jcr.util.ContentMap |
encode(info.magnolia.jcr.util.ContentMap content)
Adds escaping of HTML on properties as well as changing line breaks into <br/> tags.
|
javax.jcr.Node |
encode(javax.jcr.Node content)
Adds escaping of HTML on properties as well as changing line breaks into <br/> tags.
|
String |
encode(String text)
Adds escaping of HTML on normal text as well as changing line breaks into <br/> tags.
|
String |
externalLink(info.magnolia.jcr.util.ContentMap content,
String linkPropertyName)
Returns an external link prepended with
http:// in case the protocol is missing or an empty String
if the link does not exist. |
String |
externalLink(javax.jcr.Node content,
String linkPropertyName)
Returns an external link prepended with
http:// in case the protocol is missing or an empty String
if the link does not exist. |
String |
externalLinkTitle(info.magnolia.jcr.util.ContentMap content,
String linkPropertyName,
String linkTitlePropertyName)
Return a link title based on the @param linkTitlePropertyName.
|
String |
externalLinkTitle(javax.jcr.Node content,
String linkPropertyName,
String linkTitlePropertyName)
Return a link title based on the @param linkTitlePropertyName.
|
String |
fileExtension(String fileName)
Returns the file extension of a filename by returning the suffix after the last
. |
String |
getQueryStringAndFragment(String url)
Deprecated.
since 5.3.8 - use {@link #queryStringAndFragment(String) instead.
|
boolean |
hasTemplateOfType(info.magnolia.jcr.util.ContentMap page,
String templateType)
See
hasTemplateOfType(Node, String) for details. |
boolean |
hasTemplateOfType(javax.jcr.Node pageNode,
String templateType)
Checks whether the given page-
Node has the specified templateType . |
info.magnolia.jcr.util.ContentMap |
inherit(info.magnolia.jcr.util.ContentMap content)
See
inherit(Node) for details. |
info.magnolia.jcr.util.ContentMap |
inherit(info.magnolia.jcr.util.ContentMap content,
String relPath)
See
inherit(Node, String) for details. |
info.magnolia.jcr.util.ContentMap |
inherit(info.magnolia.jcr.util.ContentMap content,
String relPath,
String nodeTypes,
String nodeInheritance,
String propertyInheritance)
See
inherit(Node, String, String, String, String) for details. |
javax.jcr.Node |
inherit(javax.jcr.Node content)
Wraps the provided node with an inheritance wrapper so that the node appears to
contain the components and/or properties that exist in the equivalent nodes of the
ancestors of the provided node's "anchor".
|
javax.jcr.Node |
inherit(javax.jcr.Node content,
String relPath)
Wraps the provided node with an inheritance wrapper so that the node appears to
contain the components and/or properties that exist in the equivalent nodes of the
ancestors of the provided node's "anchor".
|
javax.jcr.Node |
inherit(javax.jcr.Node content,
String relPath,
String nodeTypes,
String nodeInheritance,
String propertyInheritance)
Wraps the provided node with an inheritance wrapper so that the node appears to contain the components and/or
properties that exist in the equivalent nodes of the ancestors of the provided node's "anchor" (The anchor is
the first parent of type mgnl:content - typically the page node of the provided node).
|
List<info.magnolia.jcr.util.ContentMap> |
inheritList(info.magnolia.jcr.util.ContentMap content,
String relPath)
Returns the children of the wrapped-for-inheritance subnode obtained as in
inherit(Node, String) . |
List<javax.jcr.Node> |
inheritList(javax.jcr.Node content,
String relPath)
Returns the children of the wrapped-for-inheritance subnode obtained as in
inherit(Node, String) . |
javax.jcr.Property |
inheritProperty(info.magnolia.jcr.util.ContentMap content,
String relPath)
See
inheritProperty(Node, String) for details. |
javax.jcr.Property |
inheritProperty(javax.jcr.Node content,
String relPath)
Returns the inherited property of the node, subject to the standard rules of inheritance.
|
boolean |
isAuthorInstance()
Returns whether the request is from an author instance.
|
boolean |
isCurrentLocale(String language)
Checks if given language is current locale (set in
AggregationState ). |
boolean |
isEditMode()
Returns whether the request is from the Page editor edit mode.
|
boolean |
isFromCurrentPage(info.magnolia.jcr.util.ContentMap content)
See
isFromCurrentPage(Node) for details. |
boolean |
isFromCurrentPage(javax.jcr.Node content)
Returns whether the content is an actual child of the current page -
i.e. that it was not inherited from another page (or node).
|
boolean |
isInherited(info.magnolia.jcr.util.ContentMap content)
See
isInherited(Node) for details. |
boolean |
isInherited(javax.jcr.Node content)
Returns whether the content is inherited from another node.
|
boolean |
isPreviewMode()
Returns whether the request is from the Page editor preview mode.
|
boolean |
isPublicInstance()
Returns whether the request is from a public instance.
|
String |
language()
Get the language used currently.
|
String |
link(info.magnolia.jcr.util.ContentMap contentMap)
See
link(Node) for details. |
String |
link(javax.jcr.Node content)
Returns a url for the provided node.
|
String |
link(String workspace,
String nodeIdentifier)
Returns a url for Node identified by nodeIdentifier in the specified workspace.
|
String |
linkPrefix(info.magnolia.jcr.util.ContentMap content)
See
linkPrefix(Node) for details. |
String |
linkPrefix(javax.jcr.Node content) |
Map<String,String> |
localizedLinks()
Creates a link of current URI to given language.
|
Map<String,String> |
localizedLinks(javax.jcr.Node content)
Creates a map of localized links to the node for all supported languages.
|
String |
metaData(info.magnolia.jcr.util.ContentMap content,
String property)
See
metaData(Node, String) for details. |
String |
metaData(javax.jcr.Node content,
String property)
Returns the string representation of a property from the metaData of the node or
null if the node has no Magnolia metaData or if no matching property is found. |
javax.jcr.Node |
nodeById(String id)
Return the Node by the given identifier from the website repository.
|
javax.jcr.Node |
nodeById(String id,
String workspace)
Return the Node by the given identifier from the given repository.
|
javax.jcr.Node |
nodeByPath(String path)
Return the Node for the given path from the website repository.
|
javax.jcr.Node |
nodeByPath(String path,
String workspace)
Return the Node for the given path from the given repository.
|
info.magnolia.jcr.util.ContentMap |
page(info.magnolia.jcr.util.ContentMap content)
Returns the page's
ContentMap of the passed ContentMap . |
javax.jcr.Node |
page(javax.jcr.Node content)
Returns the page
Node of the passed node. |
info.magnolia.jcr.util.ContentMap |
parent(info.magnolia.jcr.util.ContentMap contentMap)
See
parent(Node) for details. |
info.magnolia.jcr.util.ContentMap |
parent(info.magnolia.jcr.util.ContentMap contentMap,
String nodeTypeName)
See
parent(Node, String) for details. |
javax.jcr.Node |
parent(javax.jcr.Node content)
Returns the direct parent of the node.
|
javax.jcr.Node |
parent(javax.jcr.Node content,
String nodeTypeName)
Returns the closest ancestor of the provided node which is of the specified nodeType.
|
info.magnolia.jcr.util.ContentMap |
parentWithTemplateType(info.magnolia.jcr.util.ContentMap page,
String templateType)
|
javax.jcr.Node |
parentWithTemplateType(javax.jcr.Node pageNode,
String templateType)
Finds a parent
Node of given Node with the specified templateType . |
String |
queryStringAndFragment(String url)
Returns the querystring and fragment of a url, or an empty string if there are none.
|
String |
readableFileSize(long sizeBytes)
Returns a human friendly string for a file size.
|
info.magnolia.jcr.util.ContentMap |
root(info.magnolia.jcr.util.ContentMap contentMap)
See
root(Node) for details. |
info.magnolia.jcr.util.ContentMap |
root(info.magnolia.jcr.util.ContentMap contentMap,
String nodeTypeName)
See
root(Node, String) for details. |
javax.jcr.Node |
root(javax.jcr.Node content)
Returns the root node of the workspace to which the provided node belongs.
|
javax.jcr.Node |
root(javax.jcr.Node content,
String nodeTypeName)
Returns the *oldest* ancestor node of the provided node which has the specified nodeType.
|
Collection<javax.jcr.Node> |
search(String workspace,
String statement,
String language,
String returnItemType)
Deprecated.
since 5.4 - use
SearchTemplatingFunctions#searchContent(String, String, String, String, long, long) from info.magnolia.templating:magnolia-templating-essentials-models instead. |
SiblingsHelper |
siblings(info.magnolia.jcr.util.ContentMap node) |
SiblingsHelper |
siblings(javax.jcr.Node node)
Returns an instance of SiblingsHelper for the given node.
|
Collection<javax.jcr.Node> |
simpleSearch(String workspace,
String statement,
String returnItemType,
String startPath)
Deprecated.
since 5.4 - use
SearchTemplatingFunctions#searchContent(String, String, String, String, long, long) from info.magnolia.templating:magnolia-templating-essentials-models instead. |
info.magnolia.jcr.util.ContentMap |
siteRoot(info.magnolia.jcr.util.ContentMap content)
See
siteRoot(Node) for details.. |
info.magnolia.jcr.util.ContentMap |
siteRoot(info.magnolia.jcr.util.ContentMap content,
String siteRootTemplateType)
See
siteRoot(Node, String) for details. |
javax.jcr.Node |
siteRoot(javax.jcr.Node content)
Returns the site's root of the
Node . |
javax.jcr.Node |
siteRoot(javax.jcr.Node content,
String siteRootTemplateType)
Returns the site's root of the passed
Node . |
String |
templateSubtype(info.magnolia.jcr.util.ContentMap page)
See
templateSubtype(Node) for details. |
String |
templateSubtype(javax.jcr.Node pageNode)
Returns the subtype of the template assigned to a node.
|
String |
templateType(info.magnolia.jcr.util.ContentMap page)
See
templateType(Node) . |
String |
templateType(javax.jcr.Node pageNode)
Returns the type of the template assigned to a node.
|
info.magnolia.jcr.util.ContentMap |
wrapForI18n(info.magnolia.jcr.util.ContentMap content)
Wraps content into
I18nNodeWrapper so properties are in visitor's language. |
javax.jcr.Node |
wrapForI18n(javax.jcr.Node content)
Wraps content into
I18nNodeWrapper so properties are in visitor's language. |
@Inject public TemplatingFunctions(info.magnolia.rendering.template.type.TemplateTypeHelper templateTypeFunctions, javax.inject.Provider<info.magnolia.cms.i18n.I18nContentSupport> i18nContentSupport, javax.inject.Provider<info.magnolia.context.WebContext> webContextProvider)
@Deprecated public TemplatingFunctions(javax.inject.Provider<info.magnolia.cms.core.AggregationState> aggregationStateProvider, info.magnolia.rendering.template.type.TemplateTypeHelper templateTypeFunctions, javax.inject.Provider<info.magnolia.cms.i18n.I18nContentSupport> i18nContentSupport)
TemplatingFunctions(info.magnolia.rendering.template.type.TemplateTypeHelper, javax.inject.Provider, javax.inject.Provider)
instead.@Deprecated public TemplatingFunctions(javax.inject.Provider<info.magnolia.cms.core.AggregationState> aggregationStateProvider, info.magnolia.rendering.template.type.TemplateTypeHelper templateTypeFunctions)
TemplatingFunctions(Provider, TemplateTypeHelper, Provider)
instead.@Deprecated public TemplatingFunctions(javax.inject.Provider<info.magnolia.cms.core.AggregationState> aggregationStateProvider)
TemplatingFunctions(Provider, info.magnolia.rendering.template.type.TemplateTypeHelper)
instead.public javax.jcr.Node asJCRNode(info.magnolia.jcr.util.ContentMap contentMap)
public info.magnolia.jcr.util.ContentMap asContentMap(javax.jcr.Node content)
public List<javax.jcr.Node> children(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> children(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> children(info.magnolia.jcr.util.ContentMap content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> children(info.magnolia.jcr.util.ContentMap content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap root(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
root(Node)
for details.javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap root(info.magnolia.jcr.util.ContentMap contentMap, String nodeTypeName) throws javax.jcr.RepositoryException
root(Node, String)
for details.javax.jcr.RepositoryException
public javax.jcr.Node root(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node root(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap parent(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
parent(Node)
for details.javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap parent(info.magnolia.jcr.util.ContentMap contentMap, String nodeTypeName) throws javax.jcr.RepositoryException
parent(Node, String)
for details.javax.jcr.RepositoryException
public javax.jcr.Node parent(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node parent(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
page(Node)
.javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap page(info.magnolia.jcr.util.ContentMap content) throws javax.jcr.RepositoryException
ContentMap
of the passed ContentMap
. If the passed ContentMap
represents a page, the passed ContentMap
will be returned.
If the passed ContentMap
has no parent page at all, null is returned.content
- The ContentMap
to get the page's ContentMap
from.ContentMap
of the passed content ContentMap
.javax.jcr.RepositoryException
public javax.jcr.Node page(javax.jcr.Node content) throws javax.jcr.RepositoryException
Node
of the passed node. If the passed Node
is a page, the passed Node
will be returned.
If the passed Node has no parent page at all, null is returned.content
- The Node
to get the page from.Node
of the passed content Node
.javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> ancestors(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
ancestors(Node)
for details.javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> ancestors(info.magnolia.jcr.util.ContentMap contentMap, String nodeTypeName) throws javax.jcr.RepositoryException
ancestors(Node, String)
for details.javax.jcr.RepositoryException
public List<javax.jcr.Node> ancestors(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> ancestors(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node inherit(javax.jcr.Node content) throws javax.jcr.RepositoryException
(The anchor is the first parent of type mgnl:content - typically the page node of the area). The inheritance is subject to the inheritance configuration of the node. (See ConfiguredInheritance
.) Note: This is the most commonly used signature of the 'inherit' methods, but the inherit methods are seldom necessary because areas already support inheritance natively through configuration.
javax.jcr.RepositoryException
public javax.jcr.Node inherit(javax.jcr.Node content, String relPath) throws javax.jcr.RepositoryException
(The anchor is the first parent of type mgnl:content - typically the page node of the area). The inheritance is subject to the inheritance configuration of the node. (See ConfiguredInheritance
.)
relPath
- If not blank, the node will inherit the node specified by this relative path rather than the actual provided node.
This could be used to grab a specific property from a subnode.javax.jcr.RepositoryException
public javax.jcr.Node inherit(javax.jcr.Node content, String relPath, String nodeTypes, String nodeInheritance, String propertyInheritance) throws javax.jcr.RepositoryException
The inheritance is subject to the inheritance configuration of the node, but can be overridden with the parameters of this method.
Note: The inherit methods are seldom necessary because areas already support inheritance natively through configuration.
Node inheritance accepts:
ConfiguredInheritance.COMPONENTS_ALL
ConfiguredInheritance.COMPONENTS_FILTERED
inheritable=true
ConfiguredInheritance.COMPONENTS_NONE
Property inheritance accepts:
ConfiguredInheritance.PROPERTIES_ALL
ConfiguredInheritance.PROPERTIES_NONE
relPath
- If not blank, the node will inherit the node specified by this relative path rather than the
actual provided node. This can be used to grab a specific property from a subnode.nodeTypes
- If not blank, only ancestors of the anchor with one of the nodeTypes in this comma delimited
string will be evaluated.nodeInheritance
- Specify which child components of the ancestors to inherit.propertyInheritance
- Specify which properties of the ancestors to inherit.javax.jcr.RepositoryException
DefaultInheritanceContentDecorator
,
ConfiguredInheritance
public info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.ContentMap content) throws javax.jcr.RepositoryException
inherit(Node)
for details.javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.ContentMap content, String relPath) throws javax.jcr.RepositoryException
inherit(Node, String)
for details.javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.ContentMap content, String relPath, String nodeTypes, String nodeInheritance, String propertyInheritance) throws javax.jcr.RepositoryException
inherit(Node, String, String, String, String)
for details.javax.jcr.RepositoryException
public javax.jcr.Property inheritProperty(javax.jcr.Node content, String relPath) throws javax.jcr.RepositoryException
ConfiguredInheritance
.)relPath
- The path to the property. Can reference a property in the current (wrapped) node, or
within subnodes via a slash syntax. (i.e. "myNode/mySubNode/myPropertyName")javax.jcr.RepositoryException
public javax.jcr.Property inheritProperty(info.magnolia.jcr.util.ContentMap content, String relPath) throws javax.jcr.RepositoryException
inheritProperty(Node, String)
for details.javax.jcr.RepositoryException
public List<javax.jcr.Node> inheritList(javax.jcr.Node content, String relPath) throws javax.jcr.RepositoryException
inherit(Node, String)
.javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> inheritList(info.magnolia.jcr.util.ContentMap content, String relPath) throws javax.jcr.RepositoryException
inherit(Node, String)
.javax.jcr.RepositoryException
public boolean isInherited(javax.jcr.Node content)
public boolean isInherited(info.magnolia.jcr.util.ContentMap content)
isInherited(Node)
for details.public boolean isFromCurrentPage(javax.jcr.Node content)
public boolean isFromCurrentPage(info.magnolia.jcr.util.ContentMap content)
isFromCurrentPage(Node)
for details.public String link(String workspace, String nodeIdentifier)
public String link(javax.jcr.Node content)
public String link(info.magnolia.jcr.util.ContentMap contentMap) throws javax.jcr.RepositoryException
link(Node)
for details.javax.jcr.RepositoryException
public String linkPrefix(javax.jcr.Node content)
public String linkPrefix(info.magnolia.jcr.util.ContentMap content)
linkPrefix(Node)
for details.@Deprecated public String getQueryStringAndFragment(String url)
public String queryStringAndFragment(String url)
public String language()
public String externalLink(javax.jcr.Node content, String linkPropertyName)
http://
in case the protocol is missing or an empty String
if the link does not exist.content
- The node where the link property is stored on.linkPropertyName
- The property where the link value is stored in.http://
public String externalLink(info.magnolia.jcr.util.ContentMap content, String linkPropertyName)
http://
in case the protocol is missing or an empty String
if the link does not exist.content
- The node's map representation where the link property is stored on.linkPropertyName
- The property where the link value is stored in.http://
public String externalLinkTitle(javax.jcr.Node content, String linkPropertyName, String linkTitlePropertyName)
http://
).content
- The node where the link property is stored on.linkPropertyName
- The property where the link value is stored in.linkTitlePropertyName
- The property where the link title value is storedpublic String externalLinkTitle(info.magnolia.jcr.util.ContentMap content, String linkPropertyName, String linkTitlePropertyName)
http://
).content
- The node where the link property is stored on.linkPropertyName
- The property where the link value is stored in.linkTitlePropertyName
- The property where the link title value is storedpublic boolean isEditMode()
public boolean isPreviewMode()
public boolean isAuthorInstance()
public boolean isPublicInstance()
public String createHtmlAttribute(String name, String value)
name="value"
. If the value is empty an empty string will be returned.
This is mainly helpful to avoid empty attributes.public SiblingsHelper siblings(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public SiblingsHelper siblings(info.magnolia.jcr.util.ContentMap node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
@Deprecated public javax.jcr.Node content(String path)
contentByPath(String)
or nodeByPath(String)
instead@Deprecated public javax.jcr.Node content(String repository, String path)
contentByPath(String, String)
or nodeByPath(String, String)
instead@Deprecated public javax.jcr.Node contentByIdentifier(String id)
contentById(String)
or {@link #nodeById(String) instead@Deprecated public javax.jcr.Node contentByIdentifier(String repository, String id)
contentById(String, String)
or contentByPath(String, String)
insteadpublic info.magnolia.jcr.util.ContentMap contentByPath(String path)
public info.magnolia.jcr.util.ContentMap contentByPath(String path, String workspace)
public info.magnolia.jcr.util.ContentMap contentById(String id)
public info.magnolia.jcr.util.ContentMap contentById(String id, String workspace)
public javax.jcr.Node nodeByPath(String path)
public javax.jcr.Node nodeByPath(String path, String workspace)
public javax.jcr.Node nodeById(String id)
public javax.jcr.Node nodeById(String id, String workspace)
public javax.jcr.Node contentByReference(javax.jcr.Node content, String idPropertyName, String referencedWorkspace) throws javax.jcr.RepositoryException
Node
object which is referenced by its id, stored in
the @param propertyName.content
- The node with a property containing the referenced id value.idPropertyName
- The name of the property which contains the id of the referenced Node
.referencedWorkspace
- The workspace in which the referenced Node
exists.Node
javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap contentByReference(info.magnolia.jcr.util.ContentMap content, String idPropertyName, String referencedWorkspace) throws javax.jcr.RepositoryException
contentByReference(Node, String, String)
for details.javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)
ContentMap
objects for the provided collection of Node
objects.
Useful for working with a collection of Nodes in a template.public List<javax.jcr.Node> asNodeList(Collection<info.magnolia.jcr.util.ContentMap> contentMapList)
Node
objects for the provided collection of ContentMap
objects.
Useful for working with a collection of ContentMaps in java code.protected List<info.magnolia.jcr.util.ContentMap> asContentMapList(Iterable<javax.jcr.Node> nodes)
public info.magnolia.jcr.util.ContentMap decode(info.magnolia.jcr.util.ContentMap content)
public javax.jcr.Node decode(javax.jcr.Node content)
public info.magnolia.jcr.util.ContentMap encode(info.magnolia.jcr.util.ContentMap content)
public javax.jcr.Node encode(javax.jcr.Node content)
public String encode(String text)
public javax.jcr.Node wrapForI18n(javax.jcr.Node content)
I18nNodeWrapper
so properties are in visitor's language.public info.magnolia.jcr.util.ContentMap wrapForI18n(info.magnolia.jcr.util.ContentMap content)
I18nNodeWrapper
so properties are in visitor's language.public String metaData(javax.jcr.Node content, String property)
null
if the node has no Magnolia metaData or if no matching property is found.public String metaData(info.magnolia.jcr.util.ContentMap content, String property)
metaData(Node, String)
for details.@Deprecated public Collection<javax.jcr.Node> search(String workspace, String statement, String language, String returnItemType)
SearchTemplatingFunctions#searchContent(String, String, String, String, long, long)
from info.magnolia.templating:magnolia-templating-essentials-models
instead.statement
- has to be in formal form for chosen language@Deprecated public Collection<javax.jcr.Node> simpleSearch(String workspace, String statement, String returnItemType, String startPath)
SearchTemplatingFunctions#searchContent(String, String, String, String, long, long)
from info.magnolia.templating:magnolia-templating-essentials-models
instead.statement
- should be set of labels target has to contain inserted as one string each separated by commastartPath
- can be inserted, for results without limitation set it to slashpublic javax.jcr.Node siteRoot(javax.jcr.Node content)
Node
.
The root Node
is defined as the page Node
having template type DefaultTemplateTypes.SITE_ROOT
. If no ancestor page exists with type DefaultTemplateTypes.SITE_ROOT
, the JCR workspace root is returned.
content
- The node to determine its site rootNode
of the passed content Node
public info.magnolia.jcr.util.ContentMap siteRoot(info.magnolia.jcr.util.ContentMap content)
siteRoot(Node)
for details..public info.magnolia.jcr.util.ContentMap siteRoot(info.magnolia.jcr.util.ContentMap content, String siteRootTemplateType)
siteRoot(Node, String)
for details.public javax.jcr.Node siteRoot(javax.jcr.Node content, String siteRootTemplateType)
Node
.
The root Node
is defined as the page Node
with the passed template type (see: DefaultTemplateTypes
). If no ancestor page exists with provided type, the JCR workspace root is returned.
content
- The node to determine its site rootsiteRootTemplateType
- The template type value of the site root to detect.Node
of the passed content Node
public String templateType(javax.jcr.Node pageNode)
If the assigned template is not a TemplateDefinition
it defaults to DefaultTemplateTypes.CONTENT
and if there is no template assigned or the assigned template doesn't exists it returns the empty string.
public String templateType(info.magnolia.jcr.util.ContentMap page)
templateType(Node)
.public String templateSubtype(javax.jcr.Node pageNode)
If the assigned template is not a TemplateDefinition
it defaults to DefaultTemplateTypes.CONTENT
and if there is no template assigned or the assigned template doesn't exists it returns the empty string.
public String templateSubtype(info.magnolia.jcr.util.ContentMap page)
templateSubtype(Node)
for details.public boolean hasTemplateOfType(javax.jcr.Node pageNode, String templateType)
Node
has the specified templateType
.public boolean hasTemplateOfType(info.magnolia.jcr.util.ContentMap page, String templateType)
hasTemplateOfType(Node, String)
for details.public javax.jcr.Node parentWithTemplateType(javax.jcr.Node pageNode, String templateType) throws javax.jcr.RepositoryException
Node
of given Node
with the specified templateType
.javax.jcr.RepositoryException
public info.magnolia.jcr.util.ContentMap parentWithTemplateType(info.magnolia.jcr.util.ContentMap page, String templateType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> contentListByTemplateType(javax.jcr.Node searchRoot, String templateType, String templateSubtype, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
searchRoot
- the Node
to use as root of the searchtemplateType
- the TemplateType to search fortemplateSubtype
- the TemplateSubtype to search for (optional)maxResultSize
- setting this can drastically improve query performance, if you are interested only in a fixed number of leading result objectsandClause
- an additional "AND" clause in SQL syntax, excluding the "AND" itself, e.g. "date IS NOT NULL"orderByClause
- an "ORDER BY" clause in SQL syntax, excluding the "ORDER BY" itself, e.g. "date desc" or "date asc"javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> contentListByTemplateType(info.magnolia.jcr.util.ContentMap searchRoot, String templateType, String templateSubtype, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
contentListByTemplateType(Node, String, String, int, String, String)
for details.javax.jcr.RepositoryException
public List<javax.jcr.Node> contentListByTemplateType(javax.jcr.Node siteRoot, String templateType, String templateSubtype) throws javax.jcr.RepositoryException
contentListByTemplateType(Node, String, String, int, String, String)
for details.javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> contentListByTemplateType(info.magnolia.jcr.util.ContentMap siteRoot, String templateType, String templateSubtype) throws javax.jcr.RepositoryException
contentListByTemplateType(Node, String, String, int, String, String)
for details.javax.jcr.RepositoryException
public List<javax.jcr.Node> contentListByTemplateIds(javax.jcr.Node searchRoot, Set<String> templateIds, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
searchRoot
- the Node
to use as root of the searchtemplateIds
- a Set
of template IDs to search formaxResultSize
- setting this can drastically improve query performance, if you are interested only in a fixed number of leading result objectsandClause
- an additional "AND" clause in SQL syntax, excluding the "AND" itself, e.g. "date IS NOT NULL"orderByClause
- an "ORDER BY" clause in SQL syntax, excluding the "ORDER BY" itself, e.g. "date desc" or "date asc"javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> contentListByTemplateIds(info.magnolia.jcr.util.ContentMap searchRoot, Set<String> templateIds, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
contentListByTemplateIds(Node, Set, int, String, String)
for details.javax.jcr.RepositoryException
public List<javax.jcr.Node> contentListByTemplateId(javax.jcr.Node searchRoot, String templateId) throws javax.jcr.RepositoryException
contentListByTemplateId(Node, String, int, String, String)
for details.javax.jcr.RepositoryException
public List<javax.jcr.Node> contentListByTemplateId(javax.jcr.Node searchRoot, String templateId, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
searchRoot
- the Node
to use as root of the searchtemplateId
- a template ID to search formaxResultSize
- setting this can drastically improve query performance, if you are interested only in a fixed number of leading result objectsandClause
- an additional "AND" clause in SQL syntax, excluding the "AND" itself, e.g. "date IS NOT NULL"orderByClause
- an "ORDER BY" clause in SQL syntax, excluding the "ORDER BY" itself, e.g. "date desc" or "date asc"javax.jcr.RepositoryException
public String abbreviateString(String stringToAbbreviate, int length, String suffix)
String
to provided length and adds a custom suffix.public String abbreviateString(String stringToAbbreviate, int length)
String
to provided length and adds suffix " ...
".public String fileExtension(String fileName)
.
(dot).public String readableFileSize(long sizeBytes)
FileUtils.byteCountToDisplaySize(long)
public boolean isCurrentLocale(String language)
AggregationState
).public Map<String,String> localizedLinks() throws javax.jcr.RepositoryException
Note: This currently only works with links to pages in the website repository. It is not possible to generate localized links for URIs that point to another workspace or links that are forwarded.
javax.jcr.RepositoryException
public Map<String,String> localizedLinks(javax.jcr.Node content) throws javax.jcr.RepositoryException
localizedLinks()
for details.javax.jcr.RepositoryException
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.