info.magnolia.templating.jsp.cmsfn
Class JspTemplatingFunction

java.lang.Object
  extended by info.magnolia.templating.jsp.cmsfn.JspTemplatingFunction

public class JspTemplatingFunction
extends Object

Static wrapper of the Templating function class. This wrapper gives us the ability to expose these functions as Tags in the JSP's.

Version:
$Id$

Constructor Summary
JspTemplatingFunction()
           
 
Method Summary
static List<info.magnolia.jcr.util.ContentMap> ancestors(info.magnolia.jcr.util.ContentMap contentMap, String nodeTypeName)
           
static info.magnolia.jcr.util.ContentMap asContentMap(javax.jcr.Node content)
           
static List<info.magnolia.jcr.util.ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)
           
static javax.jcr.Node asJCRNode(info.magnolia.jcr.util.ContentMap contentMap)
           
static List<javax.jcr.Node> asNodeList(Collection<info.magnolia.jcr.util.ContentMap> contentMapList)
           
static List<info.magnolia.jcr.util.ContentMap> children(info.magnolia.jcr.util.ContentMap content, String nodeTypeName)
           
static javax.jcr.Node content(String path, String repository)
          Return the Node for the Given Path from the given repository.
static String createHtmlAttribute(String name, String value)
          Util method to create html attributes name="value".
static info.magnolia.jcr.util.ContentMap decode(info.magnolia.jcr.util.ContentMap content)
          Removes escaping of HTML on properties.
static 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.
static String externalLinkTitle(info.magnolia.jcr.util.ContentMap content, String linkPropertyName, String linkTitlePropertyName)
          Return a link title based on the @param linkTitlePropertyName.
static info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.ContentMap content, String relPath)
           
static List<info.magnolia.jcr.util.ContentMap> inheritList(info.magnolia.jcr.util.ContentMap content, String relPath)
           
static javax.jcr.Property inheritProperty(info.magnolia.jcr.util.ContentMap content, String relPath)
           
static boolean isAuthorInstance()
           
static boolean isEditMode()
           
static boolean isFromCurrentPage(info.magnolia.jcr.util.ContentMap content)
           
static boolean isInherited(info.magnolia.jcr.util.ContentMap content)
           
static boolean isPreviewMode()
           
static boolean isPublicInstance()
           
static String language()
          Get the language used currently.
static String link(info.magnolia.jcr.util.ContentMap contentMap)
           
static String linkForProperty(javax.jcr.Property property)
          FIXME Add a LinkUtil.createLink(Property property)....
static String linkForWorkspace(String workspace, String nodeIdentifier)
          Create link for the Node identified by nodeIdentifier in the specified workspace.
static info.magnolia.jcr.util.ContentMap page(info.magnolia.jcr.util.ContentMap content)
          Returns the page's ContentMap of the passed ContentMap.
static info.magnolia.jcr.util.ContentMap parent(info.magnolia.jcr.util.ContentMap contentMap, String nodeTypeName)
           
static info.magnolia.jcr.util.ContentMap root(info.magnolia.jcr.util.ContentMap contentMap, String nodeTypeName)
           
static info.magnolia.cms.util.SiblingsHelper siblings(info.magnolia.jcr.util.ContentMap node)
          Returns an instance of SiblingsHelper for the given contentMap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspTemplatingFunction

public JspTemplatingFunction()
Method Detail

asJCRNode

@Function
public static javax.jcr.Node asJCRNode(info.magnolia.jcr.util.ContentMap contentMap)

asContentMap

@Function
public static info.magnolia.jcr.util.ContentMap asContentMap(javax.jcr.Node content)

children

@Function
public static List<info.magnolia.jcr.util.ContentMap> children(info.magnolia.jcr.util.ContentMap content,
                                                                        String nodeTypeName)
                                                        throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

root

@Function
public static info.magnolia.jcr.util.ContentMap root(info.magnolia.jcr.util.ContentMap contentMap,
                                                              String nodeTypeName)
                                              throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

parent

@Function
public static info.magnolia.jcr.util.ContentMap parent(info.magnolia.jcr.util.ContentMap contentMap,
                                                                String nodeTypeName)
                                                throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

page

@Function
public static info.magnolia.jcr.util.ContentMap page(info.magnolia.jcr.util.ContentMap content)
                                              throws javax.jcr.RepositoryException
Returns the page's 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.

Parameters:
content - the ContentMap to get the page's ContentMap from.
Returns:
returns the page ContentMap of the passed content ContentMap.
Throws:
javax.jcr.RepositoryException

ancestors

@Function
public static List<info.magnolia.jcr.util.ContentMap> ancestors(info.magnolia.jcr.util.ContentMap contentMap,
                                                                         String nodeTypeName)
                                                         throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

inherit

@Function
public static info.magnolia.jcr.util.ContentMap inherit(info.magnolia.jcr.util.ContentMap content,
                                                                 String relPath)
                                                 throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

inheritProperty

@Function
public static javax.jcr.Property inheritProperty(info.magnolia.jcr.util.ContentMap content,
                                                          String relPath)
                                          throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

inheritList

@Function
public static List<info.magnolia.jcr.util.ContentMap> inheritList(info.magnolia.jcr.util.ContentMap content,
                                                                           String relPath)
                                                           throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

isInherited

@Function
public static boolean isInherited(info.magnolia.jcr.util.ContentMap content)

isFromCurrentPage

@Function
public static boolean isFromCurrentPage(info.magnolia.jcr.util.ContentMap content)

linkForWorkspace

@Function
public static String linkForWorkspace(String workspace,
                                               String nodeIdentifier)
Create link for the Node identified by nodeIdentifier in the specified workspace.


linkForProperty

@Function
public static String linkForProperty(javax.jcr.Property property)
FIXME Add a LinkUtil.createLink(Property property).... Dirty Hack. FIXME: Should be changed when a decision is made on SCRUM-525.


link

@Function
public static String link(info.magnolia.jcr.util.ContentMap contentMap)
                   throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

language

@Function
public static String language()
Get the language used currently.

Returns:
The language as a String.

externalLink

@Function
public static 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.

Parameters:
content - The node's map representation where the link property is stored on.
linkPropertyName - The property where the link value is stored in.
Returns:
The link prepended with http://

externalLinkTitle

@Function
public static String externalLinkTitle(info.magnolia.jcr.util.ContentMap content,
                                                String linkPropertyName,
                                                String linkTitlePropertyName)
Return a link title based on the @param linkTitlePropertyName. When property @param linkTitlePropertyName is empty or null, the link itself is provided as the linkTitle (prepended with http://).

Parameters:
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 stored
Returns:
the resolved link title value

isEditMode

@Function
public static boolean isEditMode()

isPreviewMode

@Function
public static boolean isPreviewMode()

isAuthorInstance

@Function
public static boolean isAuthorInstance()

isPublicInstance

@Function
public static boolean isPublicInstance()

createHtmlAttribute

@Function
public static String createHtmlAttribute(String name,
                                                  String value)
Util method to create html attributes name="value". If the value is empty an empty string will be returned. This is mainly helpful to avoid empty attributes.


siblings

@Function
public static info.magnolia.cms.util.SiblingsHelper siblings(info.magnolia.jcr.util.ContentMap node)
                                                      throws javax.jcr.RepositoryException
Returns an instance of SiblingsHelper for the given contentMap.

Throws:
javax.jcr.RepositoryException

content

@Function
public static javax.jcr.Node content(String path,
                                              String repository)
Return the Node for the Given Path from the given repository. If the repository is empty, take the default (website).


asContentMapList

@Function
public static List<info.magnolia.jcr.util.ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)

asNodeList

@Function
public static List<javax.jcr.Node> asNodeList(Collection<info.magnolia.jcr.util.ContentMap> contentMapList)

decode

@Function
public static info.magnolia.jcr.util.ContentMap decode(info.magnolia.jcr.util.ContentMap content)
Removes escaping of HTML on properties.



Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.