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<ContentMap> ancestors(ContentMap contentMap, String nodeTypeName)
           
static ContentMap asContentMap(javax.jcr.Node content)
           
static List<ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)
           
static javax.jcr.Node asJCRNode(ContentMap contentMap)
           
static List<javax.jcr.Node> asNodeList(Collection<ContentMap> contentMapList)
           
static List<ContentMap> children(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 ContentMap decode(ContentMap content)
          Removes escaping of HTML on properties.
static String externalLink(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(ContentMap content, String linkPropertyName, String linkTitlePropertyName)
          Return a link title based on the @param linkTitlePropertyName.
static ContentMap inherit(ContentMap content, String relPath)
           
static List<ContentMap> inheritList(ContentMap content, String relPath)
           
static javax.jcr.Property inheritProperty(ContentMap content, String relPath)
           
static boolean isAuthorInstance()
           
static boolean isEditMode()
           
static boolean isFromCurrentPage(ContentMap content)
           
static boolean isInherited(ContentMap content)
           
static boolean isPreviewMode()
           
static boolean isPublicInstance()
           
static String language()
          Get the language used currently.
static String link(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 ContentMap page(ContentMap content)
          Returns the page's ContentMap of the passed ContentMap.
static ContentMap parent(ContentMap contentMap, String nodeTypeName)
           
static ContentMap root(ContentMap contentMap, String nodeTypeName)
           
static SiblingsHelper siblings(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(ContentMap contentMap)

asContentMap

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

children

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

root

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

parent

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

page

@Function
public static ContentMap page(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<ContentMap> ancestors(ContentMap contentMap,
                                                  String nodeTypeName)
                                  throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

inherit

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

inheritProperty

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

inheritList

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

isInherited

@Function
public static boolean isInherited(ContentMap content)

isFromCurrentPage

@Function
public static boolean isFromCurrentPage(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(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(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(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 SiblingsHelper siblings(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<ContentMap> asContentMapList(Collection<javax.jcr.Node> nodeList)

asNodeList

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

decode

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



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