org.jaffa.presentation.portlet
Class HistoryNav

java.lang.Object
  extended byorg.jaffa.presentation.portlet.HistoryNav

public class HistoryNav
extends Object

This is a helper class for marshalling the HistoryNavList into XML and vice versa.

Author:
GautamJ

Field Summary
static String HISTORY_NAV_PARAMETER
          Constant to denote the 'historyNav' parameter.
 
Constructor Summary
HistoryNav()
           
 
Method Summary
static void addFormKeyToHistoryNav(HttpServletRequest request, FormKey fk)
          This will add the input FormKey to the historyNav.
static List decode(String historyNavXml)
          This will unmarshal the input XML into a List of FormKey objects.
static String encode(List historyNavList)
          This will marhsal the input List into XML.
static List initializeHistoryNav(HttpServletRequest request)
          This will initialze a List with the 'jaffa_home' link and set the 'historyNav' attribute on the input request stream with the new List.
static List initializeHistoryNav(HttpServletRequest request, String finalUrl)
          This will initialze a List with the 'jaffa_home' link and set the 'historyNav' attribute on the input request stream with the new List.
static List obtainHistoryNav(HttpServletRequest request)
          This will search the request stream for the attribute 'historyNav'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTORY_NAV_PARAMETER

public static final String HISTORY_NAV_PARAMETER
Constant to denote the 'historyNav' parameter.

See Also:
Constant Field Values
Constructor Detail

HistoryNav

public HistoryNav()
Method Detail

encode

public static String encode(List historyNavList)
This will marhsal the input List into XML. The List is assumed to contain FormKey objects.

Parameters:
historyNavList - The List of FormKey objects.
Returns:
The XML representation of the historyNavList.

decode

public static List decode(String historyNavXml)
This will unmarshal the input XML into a List of FormKey objects.

Parameters:
historyNavXml - The XML representation of the historyNavList.
Returns:
The List of FormKey objects.

initializeHistoryNav

public static List initializeHistoryNav(HttpServletRequest request)
This will initialze a List with the 'jaffa_home' link and set the 'historyNav' attribute on the input request stream with the new List.

Parameters:
request - The request stream
Returns:
the newly initialized List.

initializeHistoryNav

public static List initializeHistoryNav(HttpServletRequest request,
                                        String finalUrl)
                                 throws UnsupportedEncodingException
This will initialze a List with the 'jaffa_home' link and set the 'historyNav' attribute on the input request stream with the new List. It will also add a link for the finalUrl, the title for which should be passed in as the value for the paramter "desktopName" or "title", within the finalUrl.

Parameters:
request - The request stream
finalUrl - The final Url encoded in UTF-8 format.
Returns:
the newly initialized List.
Throws:
UnsupportedEncodingException - if the UTF-8 format is not supported. should never happen.

obtainHistoryNav

public static List obtainHistoryNav(HttpServletRequest request)
This will search the request stream for the attribute 'historyNav'. If not found, it'll search for the parameter 'historyNav'. This parameter is expected to be in XML format and will be decoded into a List

Parameters:
request - The request stream.
Returns:
The List containing the links for the HistoryNav.

addFormKeyToHistoryNav

public static void addFormKeyToHistoryNav(HttpServletRequest request,
                                          FormKey fk)
This will add the input FormKey to the historyNav. If the historyNav didn't exist, then one will be initialized. If the input FormKey already existed on the historyNav, then all subsequent FormKeys will be removed from the list. Also, all the subsequent components will be closed.

Parameters:
request - The request stream.
fk - The FormKey to add.


Copyright © 2002-2004 JAFFA Project.