planetj.dataengine
Class NavigationManager

java.lang.Object
  |
  +--planetj.dataengine.NavigationManager
All Implemented Interfaces:
INavigation

public final class NavigationManager
extends Object
implements INavigation


Field Summary
static String className
          Class name.
 
Fields inherited from interface planetj.dataengine.INavigation
CHILD_PREFIX, GROUP_ATTRIBUTES, GROUP_ID, INITIAL_GROUP_ID, INITIAL_PAGE_ID, INITIAL_REQUEST_ID, NAVIGATION_CHECKED, NAVIGATION_OBJECT_LIST_PREFIX, NEW_GROUP_ID, NEW_REQUEST_ID, NEW_SESSION_ID, PAGE_ATTRIBUTES, PAGE_ID, PARENT_PREFIX, PERSISTENT_ATTRIBUTES, PREVIOUS_ATTRIBUTES, PREVIOUS_GROUP_ID, PREVIOUS_PAGE_ID, PREVIOUS_REQUEST_ID, REQUEST_ID, RESET_GROUP_ID, RESET_NAVIGATION_IDS, RESET_NAVIGATION_IDS_COMPLETED, RESET_PAGE_ID, RESET_REQUEST_ID, RESET_SESSION_ID, SESSION_ID
 
Constructor Summary
NavigationManager()
           
 
Method Summary
static void expireOldPages(javax.servlet.http.HttpServletRequest request)
          Expire any old pages.
static NavigationGroup getGroup(String sessionId, String requestId, String groupId, javax.servlet.http.HttpServletRequest request)
          Gets this navigation group for the specified ids.
static String getGroupId(boolean create, javax.servlet.http.HttpServletRequest request)
          Get the current group id from the request.
static int getGroupIdAsInt(boolean create, javax.servlet.http.HttpServletRequest request)
          Get the current group id from the request.
static List getNavigationKeys(String listKey, javax.servlet.http.HttpServletRequest request)
          Gets a list of keys for navigation objects stored in navigation that have the same navigation list key as the given key.
static int getNextGroupIdAsInt(javax.servlet.http.HttpServletRequest request)
          Gets the next group id.
static int getNextPageIdAsInt(javax.servlet.http.HttpServletRequest request)
          Gets the next page id.
static int getNextRequestIdAsInt(javax.servlet.http.HttpServletRequest request)
          Gets the next group id.
static String getNextSessionId(javax.servlet.http.HttpServletRequest request)
          Gets the next group id.
static NavigationPage getPage(String sessionId, String requestId, String groupId, String pageId, javax.servlet.http.HttpServletRequest request)
          Gets this navigation group for the specified ids.
static String getPageId(boolean create, javax.servlet.http.HttpServletRequest request)
          Get the current page id from the request.
static int getPageIdAsInt(boolean create, javax.servlet.http.HttpServletRequest request)
          Get the current page id from the request.
static int getPreviousGroupId(javax.servlet.http.HttpServletRequest request)
          Get the group id from the previous request.
static int getPreviousPageId(javax.servlet.http.HttpServletRequest request)
          Get the page id from the previous request.
static int getPreviousRequestId(javax.servlet.http.HttpServletRequest request)
          Get the request id from the previous request.
static NavigationRequest getRequest(String sessionId, String requestId, javax.servlet.http.HttpServletRequest request)
          Gets this navigation request for the specified ids.
static String getRequestId(boolean create, javax.servlet.http.HttpServletRequest request)
          Get the current request id from the request.
static int getRequestIdAsInt(boolean create, javax.servlet.http.HttpServletRequest request)
          Get the current request id from the request.
static NavigationSession getSession(String sessionId, javax.servlet.http.HttpServletRequest request)
          Gets this navigation session for the specified id.
static String getSessionId(boolean create, javax.servlet.http.HttpServletRequest request)
          Gets the session id for the given request to use for getting and setting session attributes.
static void initializeNavigationIds(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Initializes the navigation state to the proper session, request, group, and page ids.
static boolean isNewGroupId(javax.servlet.http.HttpServletRequest request)
          Test if a new group is desired.
static boolean isNewRequestId(javax.servlet.http.HttpServletRequest request)
          Test if a new request is desired.
static boolean isNewSessionId(javax.servlet.http.HttpServletRequest request)
          Test if a new session is desired.
static boolean isPageExpired(javax.servlet.http.HttpServletRequest request)
          Check if a page is expired.
static void removeNavigationKey(INavigationObject object, javax.servlet.http.HttpServletRequest request)
          Removes the navigation key from the given navigation object.
static void resetGroupId(javax.servlet.http.HttpServletRequest request)
          Resets the group id for the given request used to get and set attributes in the request's session and maintain naviation state.
static void resetPageId(javax.servlet.http.HttpServletRequest request)
          Resets the page id for the given request used to get and set attributes in the request's session and maintain naviation state.
static void resetRequestId(javax.servlet.http.HttpServletRequest request)
          Resets the request id for the given request used to get and set attributes in the request and maintain state navigation.
static void resetSessionId(javax.servlet.http.HttpServletRequest request)
          Reset the session id for the given request used to get and set attributes in the request's session and maintain naviation state.
static boolean saveState(javax.servlet.http.HttpServletRequest request)
          Saves the current state of navigation.
static void setGroupId(int id, javax.servlet.http.HttpServletRequest request)
          Sets the group id.
static void setGroupId(String id, javax.servlet.http.HttpServletRequest request)
          Sets the group id.
static void setNavigationKey(String key, INavigationObject object, javax.servlet.http.HttpServletRequest request)
          Sets the navigation key on the given navigation object.
static void setNewGroup(javax.servlet.http.HttpServletRequest request)
          Sets a flag in the request that a new group is starting.
static void setNewRequest(javax.servlet.http.HttpServletRequest request)
          Sets a flag in the request that a new request is starting.
static void setNewSession(javax.servlet.http.HttpServletRequest request)
          Sets a flag in the request that a new session is starting.
static void setPageId(int id, javax.servlet.http.HttpServletRequest request)
          Sets the page id.
static void setPageId(String id, javax.servlet.http.HttpServletRequest request)
          Sets the request id.
static void setRequestId(int id, javax.servlet.http.HttpServletRequest request)
          Sets the request id.
static void setRequestId(String id, javax.servlet.http.HttpServletRequest request)
          Sets the request id.
static void setSessionId(String id, javax.servlet.http.HttpServletRequest request)
          Sets the session id.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

public static final String className
Class name.

Constructor Detail

NavigationManager

public NavigationManager()
Method Detail

expireOldPages

public static void expireOldPages(javax.servlet.http.HttpServletRequest request)
Expire any old pages.


getGroup

public static NavigationGroup getGroup(String sessionId,
                                       String requestId,
                                       String groupId,
                                       javax.servlet.http.HttpServletRequest request)
Gets this navigation group for the specified ids.


getGroupId

public static String getGroupId(boolean create,
                                javax.servlet.http.HttpServletRequest request)
Get the current group id from the request.


getGroupIdAsInt

public static int getGroupIdAsInt(boolean create,
                                  javax.servlet.http.HttpServletRequest request)
Get the current group id from the request.


getNavigationKeys

public static List getNavigationKeys(String listKey,
                                     javax.servlet.http.HttpServletRequest request)
Gets a list of keys for navigation objects stored in navigation that have the same navigation list key as the given key.


getNextGroupIdAsInt

public static int getNextGroupIdAsInt(javax.servlet.http.HttpServletRequest request)
Gets the next group id.

Parameters:
request - the HttpServletRequest object that containing the client's request

getNextPageIdAsInt

public static int getNextPageIdAsInt(javax.servlet.http.HttpServletRequest request)
Gets the next page id. If its a new session, request, or group the page id will be 0.

Parameters:
request - the HttpServletRequest object that containing the client's request

getNextRequestIdAsInt

public static int getNextRequestIdAsInt(javax.servlet.http.HttpServletRequest request)
Gets the next group id.

Parameters:
request - the HttpServletRequest object that containing the client's request

getNextSessionId

public static String getNextSessionId(javax.servlet.http.HttpServletRequest request)
Gets the next group id.

Parameters:
request - the HttpServletRequest object that containing the client's request

getPage

public static NavigationPage getPage(String sessionId,
                                     String requestId,
                                     String groupId,
                                     String pageId,
                                     javax.servlet.http.HttpServletRequest request)
Gets this navigation group for the specified ids.


getPageId

public static String getPageId(boolean create,
                               javax.servlet.http.HttpServletRequest request)
Get the current page id from the request.


getPageIdAsInt

public static int getPageIdAsInt(boolean create,
                                 javax.servlet.http.HttpServletRequest request)
Get the current page id from the request.


getPreviousGroupId

public static int getPreviousGroupId(javax.servlet.http.HttpServletRequest request)
Get the group id from the previous request.


getPreviousPageId

public static int getPreviousPageId(javax.servlet.http.HttpServletRequest request)
Get the page id from the previous request.


getPreviousRequestId

public static int getPreviousRequestId(javax.servlet.http.HttpServletRequest request)
Get the request id from the previous request.


getRequest

public static NavigationRequest getRequest(String sessionId,
                                           String requestId,
                                           javax.servlet.http.HttpServletRequest request)
Gets this navigation request for the specified ids.


getRequestId

public static String getRequestId(boolean create,
                                  javax.servlet.http.HttpServletRequest request)
Get the current request id from the request.


getRequestIdAsInt

public static int getRequestIdAsInt(boolean create,
                                    javax.servlet.http.HttpServletRequest request)
Get the current request id from the request.


getSession

public static NavigationSession getSession(String sessionId,
                                           javax.servlet.http.HttpServletRequest request)
Gets this navigation session for the specified id.

Parameters:
request - the HttpServletRequest object that contains the request the client made of the servlet

getSessionId

public static String getSessionId(boolean create,
                                  javax.servlet.http.HttpServletRequest request)
Gets the session id for the given request to use for getting and setting session attributes.

Parameters:
create - whether or not the session id should be created if it doesn't exist
request - HttpServletRequest
Returns:
session id

initializeNavigationIds

public static void initializeNavigationIds(javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
Initializes the navigation state to the proper session, request, group, and page ids.


isNewGroupId

public static boolean isNewGroupId(javax.servlet.http.HttpServletRequest request)
Test if a new group is desired.

Parameters:
request - the HttpServletRequest object that containing the client's request

isNewRequestId

public static boolean isNewRequestId(javax.servlet.http.HttpServletRequest request)
Test if a new request is desired.

Parameters:
request - the HttpServletRequest object that containing the client's request

isNewSessionId

public static boolean isNewSessionId(javax.servlet.http.HttpServletRequest request)
Test if a new session is desired.

Parameters:
request - the HttpServletRequest object that containing the client's request

isPageExpired

public static boolean isPageExpired(javax.servlet.http.HttpServletRequest request)
Check if a page is expired. A page gets expired once it no longer falls into the last x navigation groups.


removeNavigationKey

public static void removeNavigationKey(INavigationObject object,
                                       javax.servlet.http.HttpServletRequest request)
Removes the navigation key from the given navigation object.


resetGroupId

public static void resetGroupId(javax.servlet.http.HttpServletRequest request)
Resets the group id for the given request used to get and set attributes in the request's session and maintain naviation state. Reseting the group id also resets the page id.

Parameters:
request - HttpServletRequest

resetPageId

public static void resetPageId(javax.servlet.http.HttpServletRequest request)
Resets the page id for the given request used to get and set attributes in the request's session and maintain naviation state.

Parameters:
request - HttpServletRequest

resetRequestId

public static void resetRequestId(javax.servlet.http.HttpServletRequest request)
Resets the request id for the given request used to get and set attributes in the request and maintain state navigation. Reseting the request id also resets the group and page ids.

Parameters:
request - HttpServletRequest

resetSessionId

public static void resetSessionId(javax.servlet.http.HttpServletRequest request)
Reset the session id for the given request used to get and set attributes in the request's session and maintain naviation state. Reseting the session id also resets the request, group, and page ids.

Parameters:
request - HttpServletRequest

saveState

public static boolean saveState(javax.servlet.http.HttpServletRequest request)
Saves the current state of navigation.

Parameters:
request - the HttpServletRequest object that contains the request the client made of the servlet
Returns:
true if the navigation state was successfully saved

setGroupId

public static void setGroupId(int id,
                              javax.servlet.http.HttpServletRequest request)
Sets the group id.


setGroupId

public static void setGroupId(String id,
                              javax.servlet.http.HttpServletRequest request)
Sets the group id.


setNavigationKey

public static void setNavigationKey(String key,
                                    INavigationObject object,
                                    javax.servlet.http.HttpServletRequest request)
Sets the navigation key on the given navigation object.


setNewGroup

public static void setNewGroup(javax.servlet.http.HttpServletRequest request)
Sets a flag in the request that a new group is starting.

Parameters:
request - the HttpServletRequest object that containing the client's request

setNewRequest

public static void setNewRequest(javax.servlet.http.HttpServletRequest request)
Sets a flag in the request that a new request is starting.

Parameters:
request - the HttpServletRequest object that containing the client's request

setNewSession

public static void setNewSession(javax.servlet.http.HttpServletRequest request)
Sets a flag in the request that a new session is starting.

Parameters:
request - the HttpServletRequest object that containing the client's request

setPageId

public static void setPageId(int id,
                             javax.servlet.http.HttpServletRequest request)
Sets the page id.


setPageId

public static void setPageId(String id,
                             javax.servlet.http.HttpServletRequest request)
Sets the request id.


setRequestId

public static void setRequestId(int id,
                                javax.servlet.http.HttpServletRequest request)
Sets the request id.


setRequestId

public static void setRequestId(String id,
                                javax.servlet.http.HttpServletRequest request)
Sets the request id.


setSessionId

public static void setSessionId(String id,
                                javax.servlet.http.HttpServletRequest request)
Sets the session id.