|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.module.templatingkit.functions.STKTemplatingFunctions
@Singleton public class STKTemplatingFunctions
This is an component exposing a couple of methods useful for STK templates. It's exposed in templates as "stkfn".
Field Summary | |
---|---|
protected static String |
SITE_TITLE_PROP_NAME
|
static String |
SITEROOT_TEMPLATE_CATEGORY
|
protected static String |
TITLE_PROP_NAME
|
Constructor Summary | |
---|---|
STKTemplatingFunctions(info.magnolia.templating.functions.TemplatingFunctions templatingFunctions,
CssSelectorBuilder cssSelectorBuilder,
CategorizationSupport categorizationSupport,
SiteManager siteManager,
javax.inject.Provider<STKModule> moduleProvider,
info.magnolia.dam.templating.functions.DamTemplatingFunctions damTemplatingFunctions)
|
Method Summary | |
---|---|
String |
abbreviateString(String stringToCut,
int size)
|
String |
abbreviateString(String stringToCut,
int size,
String closureString)
|
List<info.magnolia.jcr.util.ContentMap> |
ancestorsInSite(info.magnolia.jcr.util.ContentMap content)
|
List<info.magnolia.jcr.util.ContentMap> |
ancestorsInSite(info.magnolia.jcr.util.ContentMap content,
String nodeTypeName)
|
List<javax.jcr.Node> |
ancestorsInSite(javax.jcr.Node content)
|
List<javax.jcr.Node> |
ancestorsInSite(javax.jcr.Node content,
String nodeTypeName)
|
int |
count(String name)
Increases the context bound counter and returns the value. |
List<javax.jcr.Node> |
cutList(List<javax.jcr.Node> itemsList,
int maxResults)
Return a Node List with a maximum number or result less or equal to maxResults. |
info.magnolia.dam.api.Asset |
getAsset(info.magnolia.jcr.util.ContentMap content,
String assetProperty)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAsset(String) |
info.magnolia.dam.api.Asset |
getAsset(info.magnolia.jcr.util.ContentMap content,
String nodeDataPrefix,
String variationName)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetRenditionForAssetId(String, String) |
info.magnolia.dam.api.Asset |
getAsset(javax.jcr.Node content,
String assetProperty)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAsset(String) |
info.magnolia.dam.api.Asset |
getAsset(javax.jcr.Node node,
String assetProperty,
String renditionName)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetRenditionForAssetId(String, String) Get the Asset specified by 'nodeDataPrefix' property name
linked to 'node' for the specified 'rendition'. |
String |
getAssetLink(info.magnolia.jcr.util.ContentMap content,
String assetProperty)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetLinkForId(String) |
String |
getAssetLink(info.magnolia.jcr.util.ContentMap content,
String assetProperty,
AbstractSTKTemplateModel<? extends info.magnolia.rendering.template.TemplateDefinition> model)
Deprecated. Since 2.5. Use (String) |
String |
getAssetLink(info.magnolia.jcr.util.ContentMap content,
String assetProperty,
String renditionName)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetLinkForId(String, String) |
String |
getAssetLink(javax.jcr.Node content,
String assetProperty)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetLinkForId(String) |
String |
getAssetLink(javax.jcr.Node content,
String assetProperty,
String renditionName)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetLinkForId(String, String) |
List<info.magnolia.dam.api.Asset> |
getAssetsByQuery(String statement)
Deprecated. Since 2.5. Use DamTemplatingFunctions#getAssetsByQuery(String, boolean) |
List<info.magnolia.dam.api.Asset> |
getAssetsFromFolder(javax.jcr.Node node,
String assetProperty)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetsFromFolderId(String) |
info.magnolia.dam.api.AssetRendition |
getAssetVariation(info.magnolia.dam.api.Asset asset,
String renditionName)
Deprecated. Since 2.5. Use DamTemplatingFunctions.getAssetRendition(Asset, String) |
List<info.magnolia.jcr.util.ContentMap> |
getCategories(javax.jcr.Node page)
FIXME review: should this function be provided by this class? |
String |
getCategoryLink(javax.jcr.Node page,
String categoryName)
FIXME review: should this function be provided by this class? |
List<javax.jcr.Node> |
getContentListByTemplateCategorySubCategory(javax.jcr.Node siteRoot,
String category,
String subCategory)
FIXME review: should this function be provided by this class? |
static List<javax.jcr.Node> |
getContentListByTemplateCategorySubCategory(javax.jcr.Node siteRoot,
String category,
String subCategory,
int maxResultSize,
String andClause,
String orderBy)
FIXME review: should this function be provided by this class? |
static List<javax.jcr.Node> |
getContentListByTemplateName(javax.jcr.Node searchRoot,
String templateName)
FIXME review: should this function be provided by this class? |
static List<javax.jcr.Node> |
getContentListByTemplateName(javax.jcr.Node searchRoot,
String templateName,
int maxResultSize,
String andClause,
String orderByClause)
FIXME review: should this function be provided by this class? |
static List<javax.jcr.Node> |
getContentListByTemplateNames(javax.jcr.Node searchRoot,
Set<String> templateIds,
int maxResultSize,
String andClause,
String orderByClause)
FIXME review: should this function be provided by this class? |
String |
getDivIdAbbreviation(String divID)
|
String |
getDivIdAbbreviation(String divID,
String delimiter)
|
javax.jcr.Node |
getNearestContentByTemplateCategorySubCategory(javax.jcr.Node siteRoot,
String category,
String subCategory,
javax.jcr.Node current)
FIXME review: should this function be provided by this class? |
javax.jcr.Node |
getReferencedContent(javax.jcr.Node content,
String idPropertyName,
String referencedWorkspace)
Returns a Node object which is referenced by its id, stored in
the @param propertyName. |
String |
homeLink(info.magnolia.jcr.util.ContentMap content)
|
String |
homeLink(javax.jcr.Node content)
Return the home link of this site. |
String |
homeName(info.magnolia.jcr.util.ContentMap content)
|
String |
homeName(javax.jcr.Node content)
Return the Home Site Name = the physical node's object name. |
String |
homeTitle(info.magnolia.jcr.util.ContentMap content)
|
String |
homeTitle(javax.jcr.Node content)
Return the HomeTitle value. |
String |
metaDataProperty(info.magnolia.jcr.util.ContentMap content,
String property)
|
String |
metaDataProperty(javax.jcr.Node content,
String property)
Return a property from the metaData of the node. |
String |
metaDataTemplate(info.magnolia.jcr.util.ContentMap content)
|
String |
metaDataTemplate(javax.jcr.Node content)
Return the template id associated with this content. |
String |
resolveImageVariationName(AbstractSTKTemplateModel<? extends info.magnolia.rendering.template.TemplateDefinition> model)
|
String |
searchPageLink(info.magnolia.jcr.util.ContentMap content)
|
String |
searchPageLink(javax.jcr.Node content)
Method used to get the SearchPageLink. |
void |
setCategorizationSupport(CategorizationSupport categorizationSupport)
For test purpose only. |
void |
setCssSelectorBuilder(CssSelectorBuilder cssSelectorBuilder)
For test purpose only. |
Site |
site()
|
Site |
site(info.magnolia.jcr.util.ContentMap content)
Returns the according Site of the passed content ContentMap . |
Site |
site(javax.jcr.Node content)
Returns the according Site of the passed content Node . |
info.magnolia.jcr.util.ContentMap |
siteRoot(info.magnolia.jcr.util.ContentMap content)
Returns the site's root ContentMap of the @param content ContentMap . |
info.magnolia.jcr.util.ContentMap |
siteRoot(info.magnolia.jcr.util.ContentMap content,
String siteRootTemplateCategory)
Returns the site's root Node of the passed @param content Node . |
javax.jcr.Node |
siteRoot(javax.jcr.Node content)
Returns the site's root Node of the @param content Node . |
javax.jcr.Node |
siteRoot(javax.jcr.Node content,
String siteRootTemplateCategory)
Returns the site's root Node of the passed @param content Node . |
String |
siteTitle(info.magnolia.jcr.util.ContentMap content)
|
String |
siteTitle(javax.jcr.Node content)
Return the SiteTitle value. |
Theme |
theme(Site site)
|
javax.jcr.Node |
wrap(javax.jcr.Node content)
FIXME review: should this function be provided by this class? FIXME I18nContentWrapper --> I18nNodeWrapper |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SITEROOT_TEMPLATE_CATEGORY
protected static final String TITLE_PROP_NAME
protected static final String SITE_TITLE_PROP_NAME
Constructor Detail |
---|
@Inject public STKTemplatingFunctions(info.magnolia.templating.functions.TemplatingFunctions templatingFunctions, CssSelectorBuilder cssSelectorBuilder, CategorizationSupport categorizationSupport, SiteManager siteManager, javax.inject.Provider<STKModule> moduleProvider, info.magnolia.dam.templating.functions.DamTemplatingFunctions damTemplatingFunctions)
Method Detail |
---|
public String searchPageLink(javax.jcr.Node content)
content
- : Current Content node.
public String searchPageLink(info.magnolia.jcr.util.ContentMap content)
public String homeName(javax.jcr.Node content)
public String homeName(info.magnolia.jcr.util.ContentMap content)
public String homeTitle(javax.jcr.Node content)
public String homeTitle(info.magnolia.jcr.util.ContentMap content)
public String siteTitle(javax.jcr.Node content)
public String siteTitle(info.magnolia.jcr.util.ContentMap content)
public String homeLink(javax.jcr.Node content)
public String homeLink(info.magnolia.jcr.util.ContentMap content)
public Site site()
public Site site(javax.jcr.Node content)
Site
of the passed content Node
.
content
- The Node
to determine its Site
from
Site
The according Site
of the passed @param
contentpublic Theme theme(Site site)
public Site site(info.magnolia.jcr.util.ContentMap content)
Site
of the passed content ContentMap
.
content
- The ContentMap
to determine its Site
from
Site
The according Site
of the passed @param
contentpublic javax.jcr.Node siteRoot(javax.jcr.Node content)
Node
of the @param content Node
.
The root Node
is defined as the page Node
having template
category TemplateCategory.HOME. If no ancestor page exists with category
TemplateCategory.HOME, the JCR workspace root is returned.
content
- The Node
to determine its site root
Node
The site root Node
of the passed content Node
public info.magnolia.jcr.util.ContentMap siteRoot(info.magnolia.jcr.util.ContentMap content)
ContentMap
of the @param content ContentMap
. The root ContentMap
is defined as the page Node
having template category TemplateCategory.HOME. If no
ancestor page exists with category TemplateCategory.HOME, the JCR
workspace root is returned.
content
- The ContentMap
to determine its site root
ContentMap
The site root ContentMap
of the passed @param
contentpublic info.magnolia.jcr.util.ContentMap siteRoot(info.magnolia.jcr.util.ContentMap content, String siteRootTemplateCategory)
Node
of the passed @param content Node
. The root Node
is defined as the page Node
with template its category as @param siteRootTemplateCategory. If no
ancestor page exists with category TemplateCategory.HOME, the JCR
workspace root is returned.
content
- The Node
to determine its site rootsiteRootTemplateCategory
- The TemplateCategory
value of the site root to detect.
If null or EMPTY is passed, the default value
SITEROOT_TEMPLATE_CATEGORY is used instead.
Node
The site root Node
of the passed content Node
public javax.jcr.Node siteRoot(javax.jcr.Node content, String siteRootTemplateCategory)
Node
of the passed @param content Node
. The root Node
is defined as the page Node
with template its category as @param siteRootTemplateCategory. If no
ancestor page exists with category TemplateCategory.HOME, the JCR
workspace root is returned.
content
- The Node
to determine its site rootsiteRootTemplateCategory
- The TemplateCategory
value of the site root to detect.
If null or EMPTY is passed, the default value
SITEROOT_TEMPLATE_CATEGORY is used instead.
Node
The site root Node
of the passed content Node
public List<info.magnolia.jcr.util.ContentMap> ancestorsInSite(info.magnolia.jcr.util.ContentMap content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> ancestorsInSite(javax.jcr.Node content) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<info.magnolia.jcr.util.ContentMap> ancestorsInSite(info.magnolia.jcr.util.ContentMap content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public List<javax.jcr.Node> ancestorsInSite(javax.jcr.Node content, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public String getAssetLink(javax.jcr.Node content, String assetProperty)
DamTemplatingFunctions.getAssetLinkForId(String)
public String getAssetLink(info.magnolia.jcr.util.ContentMap content, String assetProperty)
DamTemplatingFunctions.getAssetLinkForId(String)
public String getAssetLink(info.magnolia.jcr.util.ContentMap content, String assetProperty, AbstractSTKTemplateModel<? extends info.magnolia.rendering.template.TemplateDefinition> model)
(String)
public String getAssetLink(info.magnolia.jcr.util.ContentMap content, String assetProperty, String renditionName)
DamTemplatingFunctions.getAssetLinkForId(String, String)
public String getAssetLink(javax.jcr.Node content, String assetProperty, String renditionName)
DamTemplatingFunctions.getAssetLinkForId(String, String)
public String resolveImageVariationName(AbstractSTKTemplateModel<? extends info.magnolia.rendering.template.TemplateDefinition> model)
public info.magnolia.dam.api.AssetRendition getAssetVariation(info.magnolia.dam.api.Asset asset, String renditionName)
DamTemplatingFunctions.getAssetRendition(Asset, String)
. This implementation of AssetRenderer return a STKAssetRendition that extends {@link AssetDecorator}.
public javax.jcr.Node wrap(javax.jcr.Node content)
public List<info.magnolia.jcr.util.ContentMap> getCategories(javax.jcr.Node page)
public String getCategoryLink(javax.jcr.Node page, String categoryName)
public List<javax.jcr.Node> getContentListByTemplateCategorySubCategory(javax.jcr.Node siteRoot, String category, String subCategory) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static List<javax.jcr.Node> getContentListByTemplateCategorySubCategory(javax.jcr.Node siteRoot, String category, String subCategory, int maxResultSize, String andClause, String orderBy) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node getNearestContentByTemplateCategorySubCategory(javax.jcr.Node siteRoot, String category, String subCategory, javax.jcr.Node current) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static List<javax.jcr.Node> getContentListByTemplateName(javax.jcr.Node searchRoot, String templateName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static List<javax.jcr.Node> getContentListByTemplateName(javax.jcr.Node searchRoot, String templateName, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static List<javax.jcr.Node> getContentListByTemplateNames(javax.jcr.Node searchRoot, Set<String> templateIds, int maxResultSize, String andClause, String orderByClause) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.Node getReferencedContent(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.dam.api.Asset getAsset(javax.jcr.Node node, String assetProperty, String renditionName)
DamTemplatingFunctions.getAssetRenditionForAssetId(String, String)
Get the Asset specified by 'nodeDataPrefix' property name
linked to 'node' for the specified 'rendition'.
node
- Content NodenodeDataPrefix
- Property name of the node containing the Asset identifier
(composite key containing a reference of the Asset Provider)renditionName
- Name of the rendition. If not specified, the default rendition
will be applied.
public info.magnolia.dam.api.Asset getAsset(javax.jcr.Node content, String assetProperty)
DamTemplatingFunctions.getAsset(String)
public info.magnolia.dam.api.Asset getAsset(info.magnolia.jcr.util.ContentMap content, String assetProperty)
DamTemplatingFunctions.getAsset(String)
public info.magnolia.dam.api.Asset getAsset(info.magnolia.jcr.util.ContentMap content, String nodeDataPrefix, String variationName)
DamTemplatingFunctions.getAssetRenditionForAssetId(String, String)
public List<info.magnolia.dam.api.Asset> getAssetsFromFolder(javax.jcr.Node node, String assetProperty)
DamTemplatingFunctions.getAssetsFromFolderId(String)
public List<info.magnolia.dam.api.Asset> getAssetsByQuery(String statement)
DamTemplatingFunctions#getAssetsByQuery(String, boolean)
public List<javax.jcr.Node> cutList(List<javax.jcr.Node> itemsList, int maxResults)
public String abbreviateString(String stringToCut, int size)
public String abbreviateString(String stringToCut, int size, String closureString)
public int count(String name)
public String getDivIdAbbreviation(String divID)
public String getDivIdAbbreviation(String divID, String delimiter)
public String metaDataProperty(javax.jcr.Node content, String property)
public String metaDataProperty(info.magnolia.jcr.util.ContentMap content, String property)
public String metaDataTemplate(javax.jcr.Node content)
public String metaDataTemplate(info.magnolia.jcr.util.ContentMap content)
public void setCssSelectorBuilder(CssSelectorBuilder cssSelectorBuilder)
public void setCategorizationSupport(CategorizationSupport categorizationSupport)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |