com.fatwire.gst.foundation.wra.navigation
Class NavigationHelper

java.lang.Object
  extended by com.fatwire.gst.foundation.wra.navigation.NavigationHelper

public class NavigationHelper
extends Object

Used to retrieve the Navigation Bar data. See the description of getSitePlan(String) for more details.

Since:
Jun 17, 2010
Author:
David Chesebro, Dolf Dijkstra

Field Summary
protected  AliasCoreFieldDao aliasDao
          Local instance of the AliasCoreFieldDao.
protected  Date assetEffectiveDate
          Effective date for the purposes of startdate/enddate comparisons for an asset.
 String GST_ALIAS_TYPE
          Constant containing the asset type of the GST Alias asset.
protected  COM.FutureTense.Interfaces.ICS ics
          ICS context
protected  org.apache.commons.logging.Log LOG
          Log file
static String NAVBAR_LINK
          Name of the page subtype indicating that this page is a Link, meaning that the content is in the unnamed association
static String NAVBAR_NAME
          Name of the page subtype indicating that this page is NOT rendered on the site but is instead merely used to group navigation components on the site.
protected  WraCoreFieldDao wraDao
          Local instance of the WraCoreFieldDao, pre-instantiated and ready to go
 
Constructor Summary
NavigationHelper(COM.FutureTense.Interfaces.ICS ics)
          Constructor.
NavigationHelper(COM.FutureTense.Interfaces.ICS ics, AssetAccessTemplate assetTemplate, WraCoreFieldDao wraDao, AliasCoreFieldDao aliasDao)
          Constructor with all the dependencies listed.
 
Method Summary
protected  void decorateAsAlias(com.fatwire.assetapi.data.AssetId id, NavNode node)
           
protected  void decorateAsWra(com.fatwire.assetapi.data.AssetId id, NavNode node)
           
 long findP(String site_name, com.fatwire.assetapi.data.AssetId wraAssetId)
          Locate the page that contains the specified Web-Referenceable Asset.
 NavNode getSitePlan(com.fatwire.assetapi.data.AssetId pageid)
          Get the NavNode for the current page with unlimited depth.
 NavNode getSitePlan(int depth, com.fatwire.assetapi.data.AssetId pageid)
          Retrieves the NavNode for the given Page with the provided id.
 NavNode getSitePlan(int depth, com.fatwire.assetapi.data.AssetId pageid, com.fatwire.mda.DimensionFilterInstance dimensionFilter)
          Retrieves the NavNode for the given Page with the provided id.
 NavNode getSitePlan(String pageid)
          Retrieves the NavNode for the given Page with the provided id.
 NavNode getSitePlanByPage(int depth, String name)
          Retrieves the NavNode for the given Page with the provided name.
 NavNode getSitePlanByPage(int depth, String name, com.fatwire.mda.DimensionFilterInstance dimensionFilter)
          Retrieves the NavNode for the given Page with the provided name.
 NavNode getSitePlanByPage(int depth, String name, String sitename)
          Retrieves the NavNode for the given Page with the provided name.
 NavNode getSitePlanByPage(int depth, String name, String sitename, com.fatwire.mda.DimensionFilterInstance dimensionFilter)
          Retrieves the NavNode for the given Page with the provided name.
 NavNode getSitePlanByPage(String name)
           
protected  String getUrlForAlias(Alias alias)
          Get the URL for the alias.
protected  String getUrlForWra(VanityAsset wra)
          Get the URL to use for the web-referenceable asset.
protected  boolean isGstAlias(com.fatwire.assetapi.data.AssetId id)
          Return true if the asset type is a GSTAlias asset type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ics

protected final COM.FutureTense.Interfaces.ICS ics
ICS context


wraDao

protected final WraCoreFieldDao wraDao
Local instance of the WraCoreFieldDao, pre-instantiated and ready to go


aliasDao

protected final AliasCoreFieldDao aliasDao
Local instance of the AliasCoreFieldDao.


LOG

protected final org.apache.commons.logging.Log LOG
Log file


assetEffectiveDate

protected final Date assetEffectiveDate
Effective date for the purposes of startdate/enddate comparisons for an asset.


NAVBAR_NAME

public static final String NAVBAR_NAME
Name of the page subtype indicating that this page is NOT rendered on the site but is instead merely used to group navigation components on the site.

See Also:
Constant Field Values

NAVBAR_LINK

public static final String NAVBAR_LINK
Name of the page subtype indicating that this page is a Link, meaning that the content is in the unnamed association

See Also:
Constant Field Values

GST_ALIAS_TYPE

public final String GST_ALIAS_TYPE
Constant containing the asset type of the GST Alias asset.

See Also:
Constant Field Values
Constructor Detail

NavigationHelper

public NavigationHelper(COM.FutureTense.Interfaces.ICS ics)
Constructor. Initializes assetEffectiveDate to null.

Parameters:
ics - object

NavigationHelper

public NavigationHelper(COM.FutureTense.Interfaces.ICS ics,
                        AssetAccessTemplate assetTemplate,
                        WraCoreFieldDao wraDao,
                        AliasCoreFieldDao aliasDao)
Constructor with all the dependencies listed. Initializes assetEffectiveDate to null.

Parameters:
ics -
assetTemplate -
wraDao -
aliasDao -
Method Detail

getSitePlanByPage

public NavNode getSitePlanByPage(String name)
Parameters:
name - the name of the Page asset
Returns:
NavNode for the Page with the name

getSitePlanByPage

public NavNode getSitePlanByPage(int depth,
                                 String name)
Retrieves the NavNode for the given Page with the provided name.

Parameters:
depth - the maximum depth to retrieve, -1 for no limit.
name - the name of the Page asset
Returns:
NavNode for the Page with the name

getSitePlanByPage

public NavNode getSitePlanByPage(int depth,
                                 String name,
                                 com.fatwire.mda.DimensionFilterInstance dimensionFilter)
Retrieves the NavNode for the given Page with the provided name.

Parameters:
depth - the maximum depth to retrieve, -1 for no limit.
name - the name of the Page asset
dimensionFilter - in order to translate the output.
Returns:
NavNode for the Page with the name

getSitePlanByPage

public NavNode getSitePlanByPage(int depth,
                                 String name,
                                 String sitename)
Retrieves the NavNode for the given Page with the provided name.

Parameters:
depth - the maximum depth to retrieve, -1 for no limit.
name - the name of the Page asset
sitename - the name of the site you want the navigation for.
Returns:
NavNode for the Page with the name

getSitePlanByPage

public NavNode getSitePlanByPage(int depth,
                                 String name,
                                 String sitename,
                                 com.fatwire.mda.DimensionFilterInstance dimensionFilter)
Retrieves the NavNode for the given Page with the provided name.

Parameters:
depth - the maximum depth to retrieve, -1 for no limit.
name - the name of the Page asset
sitename - the name of the site you want the navigation for.
dimensionFilter - in order to translate the output.
Returns:
NavNode for the Page with the name

getSitePlan

public NavNode getSitePlan(String pageid)
Retrieves the NavNode for the given Page with the provided id. The NavNode contains all the attributes necessary to create a nav bar.

Links are not populated for Navigation Placeholders, but it is often very convenient to pass a navigation placeholder into this function in order to return all children under a specific placeholder.

StartDate and EndDate are checked and invalid pages aren't added. If a Page asset is not valid, its children are not even examined.

Parameters:
pageid - the assetid of the Page asset.
Returns:
the NavNode for this page

getSitePlan

public NavNode getSitePlan(com.fatwire.assetapi.data.AssetId pageid)
Get the NavNode for the current page with unlimited depth.

Parameters:
pageid -
Returns:
the NavNode associated with this pageid.

getSitePlan

public NavNode getSitePlan(int depth,
                           com.fatwire.assetapi.data.AssetId pageid)
Retrieves the NavNode for the given Page with the provided id.

Parameters:
depth - the maximum depth to retrieve, -1 for no limit.
pageid - the AssetId for the page
Returns:
the NavNode for this page

getSitePlan

public NavNode getSitePlan(int depth,
                           com.fatwire.assetapi.data.AssetId pageid,
                           com.fatwire.mda.DimensionFilterInstance dimensionFilter)
Retrieves the NavNode for the given Page with the provided id.

Parameters:
depth - the maximum depth to retrieve, -1 for no limit.
pageid - the AssetId for the page
dimensionFilter - in order to translate the output.
Returns:
the NavNode for this page

isGstAlias

protected boolean isGstAlias(com.fatwire.assetapi.data.AssetId id)
Return true if the asset type is a GSTAlias asset type. May be overridden if customers are attempting to retrofit this class for alias-like functionality that is not implemented by the GSTAlias asset type.

Parameters:
id - asset for which a link is required
Returns:
true if the asset is an alias, false if it is a web-referenceable asset

getUrlForAlias

protected String getUrlForAlias(Alias alias)
Get the URL for the alias. For external links, the targeturl attribute is rendered. For Aliases that refer to another WRA, the alias is allowed to override any WRA fields. For instance, the path, and the template can be overridden by an alias for a WRA (though the template in the Alias had better be typeless, or a template of the same name must exist in the WRA's asset type or there will be a problem).

Parameters:
alias - Alias bean, which of course is also a WRA.
Returns:
url

getUrlForWra

protected String getUrlForWra(VanityAsset wra)
Get the URL to use for the web-referenceable asset.

Parameters:
wra - WebReferenceableAsset bean
Returns:
url

decorateAsWra

protected void decorateAsWra(com.fatwire.assetapi.data.AssetId id,
                             NavNode node)

decorateAsAlias

protected void decorateAsAlias(com.fatwire.assetapi.data.AssetId id,
                               NavNode node)

findP

public long findP(String site_name,
                  com.fatwire.assetapi.data.AssetId wraAssetId)
Locate the page that contains the specified Web-Referenceable Asset.

A WRA is supposed to just be placed on one page (in the unnamed association block), and this method locates it. If it is not found, 0L is returned.

If multiple matches are found, a warning is logged and the first one is returned.

Parameters:
site_name - name of the site to search within
wraAssetId - the asset id of the web-referenceable asset
Returns:
page asset ID or 0L.


Copyright © 2010-2013 Oracle Corporation. All Rights Reserved.