org.hippoecm.hst.configuration.sitemap
Class HstSiteMapItemService

java.lang.Object
  extended by org.hippoecm.hst.configuration.sitemap.HstSiteMapItemService
All Implemented Interfaces:
HstSiteMapItem

public class HstSiteMapItemService
extends Object
implements HstSiteMapItem


Constructor Summary
HstSiteMapItemService(HstNode node, Mount mount, HstSiteMapItemHandlersConfiguration siteMapItemHandlersConfiguration, HstSiteMapItem parentItem, HstSiteMap hstSiteMap, int depth)
           
 
Method Summary
 void addAnyPrefixedChildSiteMapItems(HstSiteMapItemService hstSiteMapItem)
           
 void addWildCardPrefixedChildSiteMapItems(HstSiteMapItemService hstSiteMapItem)
           
 boolean containsAny()
           
 boolean containsWildCard()
           
 HstSiteMapItem getAnyPatternChild(String[] elements, int position, List<HstSiteMapItem> excludeList)
           
 HstSiteMapItem getChild(String value)
          Return the child HstSiteMapItem that has the corresponding value (HstSiteMapItem.getValue() ) and null otherwise
 List<HstSiteMapItem> getChildren()
          Returns a List of all child HstSiteMapItem's of this HstSiteMapItem.
 String getComponentConfigurationId()
          If a HstSiteMapItem can be used to resolve a url, it must have a componentConfigurationId referencing the component configuration the will handle the request processing.
 int getDepth()
           
 int getErrorCode()
          A HstSiteMapItem can specify an error-code.
 String getExtension()
           
 HstSiteMap getHstSiteMap()
          Return the HstSiteMap that is the container of this HstSiteMapItem
 String getId()
          The id of a HstSiteMapItem is mandatory and must be unique within its containing HstSiteMap because HstSiteMap.getSiteMapItemById(String) must uniquely return a HstSiteMapItem.
 Map<String,String> getKeyToPropertyPlaceHolderMap()
           
 String getLocale()
          the locale for this sitemapItem or null when it does not contain one.
 String getLocalParameter(String name)
          see HstSiteMapItem.getParameter(String), only this method returns parameters without inheritance
 Map<String,String> getLocalParameters()
          see HstSiteMapItem.getParameters(), only this method returns parameters (unmodifiable map) without inheritance
 String getNamedPipeline()
          the namedPipeline for this sitemapItem or null when it does not contain one.
 String getParameter(String name)
          A HstSiteMapItem can contain a Map of parameters.
 String getParameterizedPath()
           
 Map<String,String> getParameters()
          See HstSiteMapItem.getParameter(String), only now entire the parameters map is returned.
 HstSiteMapItem getParentItem()
          Returns parent HstSiteMapItem and null when the item does not have a parent (in other words, it is a root HstSiteMapItem)
 String getPortletComponentConfigurationId()
          If a HstSiteMapItem can be used to resolve a url, it must have a portletComponentConfigurationId referencing the portlet component configuration the will handle the request processing.
 String getPostfix()
           
 String getPrefix()
           
 String getQualifiedId()
          The qualified id, which might contain more info then just HstSiteMapItem.getId() as the getId might return an id which is meaningfull only within it's current HstSiteMap
 String getRefId()
          The refId of a HstSiteMapItem is non-mandatory and must be unique within its containing HstSiteMap because HstSiteMap.getSiteMapItemByRefId(String) must uniquely return a HstSiteMapItem.
 String getRelativeContentPath()
          This method returns a content path, relative to the Mount.getContentPath().
 Set<String> getRoles()
          Returns the roles that are allowed to access this sitemap item when HstSiteMapItem.isAuthenticated() is true.
 HstSiteMapItemHandlerConfiguration getSiteMapItemHandlerConfiguration(String handlerId)
           
 List<HstSiteMapItemHandlerConfiguration> getSiteMapItemHandlerConfigurations()
           The List of HstSiteMapItemHandlerConfigurations and an empty list if this SiteMapItem does not contain HstSiteMapItemHandlerConfigurations.
 int getStatusCode()
          A HstSiteMapItem can specify the status-code that needs to be set on the webpage header.
 Set<String> getUsers()
          Returns the users that are allowed to access this sitemap item when HstSiteMapItem.isAuthenticated() is true.
 String getValue()
          Returns the logical path element of this SiteMapItem.
 int getWildCardAnyOccurences()
           
 HstSiteMapItem getWildCardPatternChild(String value, List<HstSiteMapItem> excludeList)
           
 boolean isAny()
          Returns a boolean indicating whether this HstSiteMapItem represents a path with a any value **
 boolean isAuthenticated()
          If this method returns true, then only if the user is explicitly allowed or servletRequest.isUserInRole(role) returns true this sitemap item is accessible for the request.
 boolean isExcludedForLinkRewriting()
           When having more sitemapitem as sibblings, for example foo.xml, foo.html and foo.rss, you might not want all three being used for linkrewriting: Even worse, if they all three have the same HstSiteMapItem.getRelativeContentPath(), we cannot choose which one is the one you want, so, one of the items is used.
 boolean isUseableInRightContextOnly()
           
 boolean isWildCard()
          Returns a boolean indicating whether this HstSiteMapItem represents a path with a wildcard value *
 boolean patternMatch(String value, String prefix, String postfix)
           
 void setKeyToPropertyPlaceHolderMap(Map<String,String> keyToPropertyPlaceHolderMap)
           
 void setUseableInRightContextOnly(boolean useableInRightContextOnly)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HstSiteMapItemService

public HstSiteMapItemService(HstNode node,
                             Mount mount,
                             HstSiteMapItemHandlersConfiguration siteMapItemHandlersConfiguration,
                             HstSiteMapItem parentItem,
                             HstSiteMap hstSiteMap,
                             int depth)
                      throws ServiceException
Throws:
ServiceException
Method Detail

getChild

public HstSiteMapItem getChild(String value)
Description copied from interface: HstSiteMapItem
Return the child HstSiteMapItem that has the corresponding value (HstSiteMapItem.getValue() ) and null otherwise

Specified by:
getChild in interface HstSiteMapItem
Parameters:
value - the value of the child HstSiteMapItem as it would be return by HstSiteMapItem.getValue()
Returns:
Returns the HstSiteMapItem object corresponding to the unique value and null if no HstSiteMapItem exists with this value in this HstSiteMapItem object.

getChildren

public List<HstSiteMapItem> getChildren()
Description copied from interface: HstSiteMapItem
Returns a List of all child HstSiteMapItem's of this HstSiteMapItem. Implementations should return an unmodifiable list, for example Collections.UnmodifiableList to avoid client code changing configuration

Specified by:
getChildren in interface HstSiteMapItem
Returns:
the List of HstSiteMapItem children. If there are no children, an empty list is returned

getComponentConfigurationId

public String getComponentConfigurationId()
Description copied from interface: HstSiteMapItem
If a HstSiteMapItem can be used to resolve a url, it must have a componentConfigurationId referencing the component configuration the will handle the request processing. This component configuration can be the root of a component configuration tree, see HstComponentConfiguration.

Specified by:
getComponentConfigurationId in interface HstSiteMapItem
Returns:
the componentConfigurationId for this SiteMapItem or null

getPortletComponentConfigurationId

public String getPortletComponentConfigurationId()
Description copied from interface: HstSiteMapItem
If a HstSiteMapItem can be used to resolve a url, it must have a portletComponentConfigurationId referencing the portlet component configuration the will handle the request processing. This component configuration can be the root of a component configuration tree, see HstComponentConfiguration.

Specified by:
getPortletComponentConfigurationId in interface HstSiteMapItem
Returns:
the portletComponentConfigurationId for this SiteMapItem or null

getId

public String getId()
Description copied from interface: HstSiteMapItem
The id of a HstSiteMapItem is mandatory and must be unique within its containing HstSiteMap because HstSiteMap.getSiteMapItemById(String) must uniquely return a HstSiteMapItem.

Specified by:
getId in interface HstSiteMapItem
Returns:
the id of this HstSiteMapItem

getRefId

public String getRefId()
Description copied from interface: HstSiteMapItem
The refId of a HstSiteMapItem is non-mandatory and must be unique within its containing HstSiteMap because HstSiteMap.getSiteMapItemByRefId(String) must uniquely return a HstSiteMapItem. The difference with HstSiteMapItem.getId() is that that id is in general an auto-generated id, where this HstSiteMapItem.getRefId() is an optional id to get hold of this HstSiteMapItem.

Specified by:
getRefId in interface HstSiteMapItem
Returns:
the refId of this HstSiteMapItem or null when no refId is defined on the HstSiteMapItem

getRelativeContentPath

public String getRelativeContentPath()
Description copied from interface: HstSiteMapItem
This method returns a content path, relative to the Mount.getContentPath(). This value can contain property placeholders, like ${1}/${2}, which should be resolved in the ResolvedSiteMapItem.getRelativeContentPath()

Specified by:
getRelativeContentPath in interface HstSiteMapItem
Returns:
the content path relative to the Mount.getContentPath()

getParameter

public String getParameter(String name)
Description copied from interface: HstSiteMapItem
A HstSiteMapItem can contain a Map of parameters. These parameters can be accessed from HstComponent's instances through a parameter in the HstComponentConfiguration. For example, if this SiteMapItem would have a parameter named foo and value bar, the HstComponentConfiguration linked through the HstSiteMapItem.getComponentConfigurationId() can access this parameters by having an own parameter, for example named lux and the value ${foo}. If the HstSiteMapItem is a WILDCARD or any of its ancestors, you can also set the parameter values to ${1}, ${2} etc where ${1} refers to the first matched wildcard, ${2} to the second, etc. Parameters are inherited from ancestor sitemap items. When this sitemap item configures the same parameter as an ancestor, the value from the ancestor is overwritten. Thus, child items have precedence. Note that this is opposite to HstComponentConfiguration.getParameter(String)

Specified by:
getParameter in interface HstSiteMapItem
Parameters:
name - the name of the parameter
Returns:
the value of the parameter or null when not present

getParameters

public Map<String,String> getParameters()
Description copied from interface: HstSiteMapItem
See HstSiteMapItem.getParameter(String), only now entire the parameters map is returned. Implementations should return an unmodifiable map, for example Collections.UnmodifiableMap to avoid client code changing configuration Parameters are inherited from ancestor sitemap items. When this sitemap item configures the same parameter as an ancestor, the value from the ancestor is overwritten. Thus, child items have precedence. Note that this is opposite to HstComponentConfiguration.getParameters()

Specified by:
getParameters in interface HstSiteMapItem
Returns:
the Map of parameters contained in this HstSiteMapItem. If no parameters present, and empty map is returned

getLocalParameter

public String getLocalParameter(String name)
Description copied from interface: HstSiteMapItem
see HstSiteMapItem.getParameter(String), only this method returns parameters without inheritance

Specified by:
getLocalParameter in interface HstSiteMapItem
Parameters:
name - the name of the parameter
Returns:
the value of the parameter or null when not present

getLocalParameters

public Map<String,String> getLocalParameters()
Description copied from interface: HstSiteMapItem
see HstSiteMapItem.getParameters(), only this method returns parameters (unmodifiable map) without inheritance

Specified by:
getLocalParameters in interface HstSiteMapItem
Returns:
the Map of parameters contained in this HstSiteMapItem. If no parameters present, and empty map is returned

getSiteMapItemHandlerConfiguration

public HstSiteMapItemHandlerConfiguration getSiteMapItemHandlerConfiguration(String handlerId)
Specified by:
getSiteMapItemHandlerConfiguration in interface HstSiteMapItem
Returns:
the HstSiteMapItemHandlerConfiguration for handlerId or null if no handler present for handlerId

getSiteMapItemHandlerConfigurations

public List<HstSiteMapItemHandlerConfiguration> getSiteMapItemHandlerConfigurations()
Description copied from interface: HstSiteMapItem

The List of HstSiteMapItemHandlerConfigurations and an empty list if this SiteMapItem does not contain HstSiteMapItemHandlerConfigurations.
Note that HstSiteMapItemHandlerConfigurations are NOT inherited from parent/ancestor HstSiteMapItem's.

Implementations should return an unmodifiable list, for example Collections.UnmodifiableList to avoid client code changing configuration

Specified by:
getSiteMapItemHandlerConfigurations in interface HstSiteMapItem
Returns:
The List of HstSiteMapItemHandlerConfigurations and an empty list if this SiteMapItem does not contain HstSiteMapItemHandlerConfigurations

getStatusCode

public int getStatusCode()
Description copied from interface: HstSiteMapItem
A HstSiteMapItem can specify the status-code that needs to be set on the webpage header. If a status-code is specified, it can be retrieved through this method. 0 is return is non is specified.

Specified by:
getStatusCode in interface HstSiteMapItem
Returns:
if a status code is set, return this, otherwise 0

getErrorCode

public int getErrorCode()
Description copied from interface: HstSiteMapItem
A HstSiteMapItem can specify an error-code. If an error-code is specified, the framework will invoke a sendError(int code) where the code is the value returned by this method . 0 is return is non is specified.

Specified by:
getErrorCode in interface HstSiteMapItem
Returns:
if an error code is set, return this, otherwise 0

isAuthenticated

public boolean isAuthenticated()
Description copied from interface: HstSiteMapItem
If this method returns true, then only if the user is explicitly allowed or servletRequest.isUserInRole(role) returns true this sitemap item is accessible for the request. If a sitemap item does not have a configuration for authenticated, the value from the parent item is taken. The root sitemap items return by default false for HstSiteMapItem.isAuthenticated() when no configuration is set for authenticated.

Specified by:
isAuthenticated in interface HstSiteMapItem
Returns:
true if the sitemap item is authenticated.

getRoles

public Set<String> getRoles()
Description copied from interface: HstSiteMapItem
Returns the roles that are allowed to access this sitemap item when HstSiteMapItem.isAuthenticated() is true. If the sitemap items does not have any roles defined by itself, it inherits them from the parent. If it defines roles, the roles from any ancestor are ignored. An empty set of roles in combination with HstSiteMapItem.isAuthenticated() return true means nobody has access to the item HstComponent instances can access HstSiteMapItem but should not be able to modify them, implementations should return an unmodifiable set.

Specified by:
getRoles in interface HstSiteMapItem
Returns:
The set of roles that are allowed to access this sitemap item. When no roles defined, the roles from the parent item are inherited. If none of the parent items have a role defined, an empty set is returned

getUsers

public Set<String> getUsers()
Description copied from interface: HstSiteMapItem
Returns the users that are allowed to access this sitemap item when HstSiteMapItem.isAuthenticated() is true. If the sitemap items does not have any users defined by itself, it inherits them from the parent. If it defines users, the users from any ancestor are ignored. An empty set of users in combination with HstSiteMapItem.isAuthenticated() return true means nobody has access to the item HstComponent instances can access HstSiteMapItem but should not be able to modify them, implementations should return an unmodifiable set.

Specified by:
getUsers in interface HstSiteMapItem
Returns:
The set of users that are allowed to access this sitemap item. When no users defined, the users from the parent item are inherited. If none of the parent items have a user defined, an empty set is returned

getValue

public String getValue()
Description copied from interface: HstSiteMapItem
Returns the logical path element of this SiteMapItem. The constraint to the return value is, that it needs to be unique within the sibbling HstSiteMapItem's because it is used as a key for HstSiteMapItem.getChild(String) and HstSiteMap.getSiteMapItem(String)

Specified by:
getValue in interface HstSiteMapItem
Returns:
the value of this SiteMapItem which represents the logical path element for this SiteMapItem

getLocale

public String getLocale()
Description copied from interface: HstSiteMapItem
the locale for this sitemapItem or null when it does not contain one. Note that if an ancestor sitemapItem contains a locale, this value is inherited unless this sitemapItem explicitly defines its own.

Specified by:
getLocale in interface HstSiteMapItem
Returns:
the locale for this sitemapItem or null when it does not contain one.

isWildCard

public boolean isWildCard()
Description copied from interface: HstSiteMapItem
Returns a boolean indicating whether this HstSiteMapItem represents a path with a wildcard value *

Specified by:
isWildCard in interface HstSiteMapItem
Returns:
true if this HstSiteMapItem represents *

isAny

public boolean isAny()
Description copied from interface: HstSiteMapItem
Returns a boolean indicating whether this HstSiteMapItem represents a path with a any value **

Specified by:
isAny in interface HstSiteMapItem
Returns:
true if this HstSiteMapItem represents **

getHstSiteMap

public HstSiteMap getHstSiteMap()
Description copied from interface: HstSiteMapItem
Return the HstSiteMap that is the container of this HstSiteMapItem

Specified by:
getHstSiteMap in interface HstSiteMapItem
Returns:
the HstSiteMap that is the container of this HstSiteMapItem

getParentItem

public HstSiteMapItem getParentItem()
Description copied from interface: HstSiteMapItem
Returns parent HstSiteMapItem and null when the item does not have a parent (in other words, it is a root HstSiteMapItem)

Specified by:
getParentItem in interface HstSiteMapItem
Returns:
the parent HstSiteMapItem and null when the item does not have a parent

getParameterizedPath

public String getParameterizedPath()

getWildCardAnyOccurences

public int getWildCardAnyOccurences()

addWildCardPrefixedChildSiteMapItems

public void addWildCardPrefixedChildSiteMapItems(HstSiteMapItemService hstSiteMapItem)

addAnyPrefixedChildSiteMapItems

public void addAnyPrefixedChildSiteMapItems(HstSiteMapItemService hstSiteMapItem)

getWildCardPatternChild

public HstSiteMapItem getWildCardPatternChild(String value,
                                              List<HstSiteMapItem> excludeList)

getAnyPatternChild

public HstSiteMapItem getAnyPatternChild(String[] elements,
                                         int position,
                                         List<HstSiteMapItem> excludeList)

patternMatch

public boolean patternMatch(String value,
                            String prefix,
                            String postfix)

getNamedPipeline

public String getNamedPipeline()
Description copied from interface: HstSiteMapItem
the namedPipeline for this sitemapItem or null when it does not contain one. Note that if an ancestor sitemapItem contains a namedPipeline, this value is inherited unless this sitemapItem explicitly defines its own

Specified by:
getNamedPipeline in interface HstSiteMapItem
Returns:
the namedPipeline for this sitemapItem or null when it does not contain one.

getPostfix

public String getPostfix()

getExtension

public String getExtension()

getPrefix

public String getPrefix()

containsWildCard

public boolean containsWildCard()

containsAny

public boolean containsAny()

setUseableInRightContextOnly

public void setUseableInRightContextOnly(boolean useableInRightContextOnly)

isUseableInRightContextOnly

public boolean isUseableInRightContextOnly()

setKeyToPropertyPlaceHolderMap

public void setKeyToPropertyPlaceHolderMap(Map<String,String> keyToPropertyPlaceHolderMap)

getKeyToPropertyPlaceHolderMap

public Map<String,String> getKeyToPropertyPlaceHolderMap()

getDepth

public int getDepth()

getQualifiedId

public String getQualifiedId()
Description copied from interface: HstSiteMapItem
The qualified id, which might contain more info then just HstSiteMapItem.getId() as the getId might return an id which is meaningfull only within it's current HstSiteMap

Specified by:
getQualifiedId in interface HstSiteMapItem
Returns:
the qualified id of this HstSiteMapItem

isExcludedForLinkRewriting

public boolean isExcludedForLinkRewriting()
Description copied from interface: HstSiteMapItem

When having more sitemapitem as sibblings, for example foo.xml, foo.html and foo.rss, you might not want all three being used for linkrewriting: Even worse, if they all three have the same HstSiteMapItem.getRelativeContentPath(), we cannot choose which one is the one you want, so, one of the items is used. When configuring a SiteMapItem to return true for isExcludedForLinkRewriting(), you can exclude the item to be used for linkrewriting. Thus, setting the .rss and .xml version to true will make sure that linkrewriting returns you the .html links.

Note that this value is not inherited from ancestor HstSiteMapItem's

Specified by:
isExcludedForLinkRewriting in interface HstSiteMapItem
Returns:
true when this sitemap item should be ignored for linkrewriting


Copyright © 2008-2012 Hippo. All Rights Reserved.