@Singleton public class TemplateTypeHelper extends Object
DefaultTemplateTypes
, i.e. template types set for a
TemplateDefinition
(see:
TemplateDefinition.getType()
and
TemplateDefinition.getSubtype()
).TemplateDefinition
,
DefaultTemplateTypes
Constructor and Description |
---|
TemplateTypeHelper(TemplateDefinitionRegistry templateDefinitionRegistry) |
Modifier and Type | Method and Description |
---|---|
javax.jcr.Node |
findParentWithTemplateType(javax.jcr.Node pageNode,
String templateType)
Finds a parent
Node of given Node with the specified templateType . |
List<javax.jcr.Node> |
getContentListByTemplateIds(javax.jcr.Node searchRoot,
Set<String> templateIds,
int maxResultSize,
String andClause,
String orderByClause)
Find content objects with one of the given templates below a given search root.
|
List<javax.jcr.Node> |
getContentListByTemplateType(javax.jcr.Node searchRoot,
String templateType,
String templateSubtype,
int maxResultSize,
String andClause,
String orderByClause)
Find content objects with one of the given template (sub) types below given search root.
|
String |
getTemplateSubtypeOrDefault(javax.jcr.Node pageNode)
Returns the subtype of the template assigned to a node, 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. |
String |
getTemplateTypeOrDefault(javax.jcr.Node pageNode)
Returns the type of the template assigned to a node, 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. |
boolean |
hasTemplateOfType(javax.jcr.Node pageNode,
String templateType)
Checks whether the given page-
Node has the specified templateType . |
@Inject public TemplateTypeHelper(TemplateDefinitionRegistry templateDefinitionRegistry)
public String getTemplateTypeOrDefault(javax.jcr.Node pageNode)
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 getTemplateSubtypeOrDefault(javax.jcr.Node pageNode)
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 boolean hasTemplateOfType(javax.jcr.Node pageNode, String templateType)
Node
has the specified templateType
.public javax.jcr.Node findParentWithTemplateType(javax.jcr.Node pageNode, String templateType) throws javax.jcr.RepositoryException
Node
of given Node
with the specified templateType
.javax.jcr.RepositoryException
public List<javax.jcr.Node> getContentListByTemplateType(javax.jcr.Node searchRoot, String templateType, String templateSubtype, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> getContentListByTemplateIds(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
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.