org.rhq.enterprise.gui.legacy.util
Class SessionUtils

java.lang.Object
  extended by org.rhq.enterprise.gui.legacy.util.SessionUtils

public class SessionUtils
extends Object


Constructor Summary
SessionUtils()
           
 
Method Summary
static void addToList(javax.servlet.http.HttpSession session, String attr, Integer[] ids)
           
static void addToList(javax.servlet.http.HttpSession session, String attr, List ids)
          Merge the given ids into the array of pending ids stored under the named session attribute.
static void addToList(javax.servlet.http.HttpSession session, String attr, String[] ids)
           
static void addToListStr(javax.servlet.http.HttpSession session, String attr, List ids)
          Merge the given ids into the array of pending ids stored under the named session attribute.
static void clearWorkflow(javax.servlet.http.HttpSession session, String workflowName)
          Remove any old workflows
static int countWorkflow(javax.servlet.http.HttpSession session, String workflowName)
          Returns the size of a workflow's stack.
static Integer[] getList(javax.servlet.http.HttpSession session, String attr)
          Retrieve the array of pending ids stored under the named session attribute.
static List getListAsList(javax.servlet.http.HttpSession session, String attr)
          Retrieve the List of pending ids stored under the named session attribute.
static List<String> getListAsListStr(javax.servlet.http.HttpSession session, String attr)
          Retrieve the List of pending ids stored under the named session attribute.
static String getReturnPath(javax.servlet.http.HttpSession session)
          Retrieve the "return path" that locates the point at which a subflow was included into a primary workflow.
static Boolean getReturnPathIgnoredForOk(javax.servlet.http.HttpSession session)
          Retrieve wether the "return path" should be paid attention to for new.
static WebUser getWebUser(javax.servlet.http.HttpSession session)
          Retrieve the cached WebUser representing the user.
static void moveAttribute(javax.servlet.http.HttpServletRequest request, String key)
          Move the attribute from the session to request scope.
static String popWorkflow(javax.servlet.http.HttpSession session, String workflowName)
          Takes the current returnPath and pops it off of the workflow's stack.
static void pushWorkflow(javax.servlet.http.HttpSession session, org.apache.struts.action.ActionMapping mapping, String workflowName)
          Takes the current returnPath and pushes it onto the workflow's stack.
static void removeFromList(javax.servlet.http.HttpSession session, String attr, Integer[] ids)
           
static void removeFromList(javax.servlet.http.HttpSession session, String attr, List ids)
          Remove the given ids from the array of pending ids stored under the named session attribute.
static void removeFromList(javax.servlet.http.HttpSession session, String attr, String[] ids)
           
static void removeFromListStr(javax.servlet.http.HttpSession session, String attr, List ids)
          Remove the given ids from the array of pending ids stored under the named session attribute.
static void removeList(javax.servlet.http.HttpSession session, String attr)
          Remove the array of pending ids stored under the named session attribute.
static void resetReturnPath(javax.servlet.http.HttpSession session)
          clear out the return path stack.
static void setConfirmation(javax.servlet.http.HttpSession session, String key)
          Set a confirmation message upon completion of a user action.
static void setConfirmation(javax.servlet.http.HttpSession session, String key, Object value0)
          Set a confirmation message with a replacement value upon completion of a user action.
static void setError(javax.servlet.http.HttpSession session, String key)
          Set an error message when a user action fails with a user-level error.
static void setError(javax.servlet.http.HttpSession session, String key, Object value0)
          Set an error message with a replacement value when a user action fails with a user-level error.
static void setError(javax.servlet.http.HttpSession session, String key, Object value0, String property)
          Set an error message with a replacement value when a user action fails with a user-level error.
static void setError(javax.servlet.http.HttpSession session, String key, String property)
          Set an error message when a user action fails with a user-level error.
static void setReturnPath(javax.servlet.http.HttpSession session, String path)
          Set the "returnPath", the possible point of origin for a workflow.
static void setReturnPath(javax.servlet.http.HttpSession session, String path, Boolean ignore)
          Set the "returnPath," the possible point of origin for a worklow
static void setWebUser(javax.servlet.http.HttpSession session, WebUser user)
           
static void unsetConfirmation(javax.servlet.http.HttpSession session, String key)
           
static void unsetError(javax.servlet.http.HttpSession session)
           
static void unsetReturnPath(javax.servlet.http.HttpSession session)
          Unset the "return path" that locates the point at which a subflow was included into a primary workflow.
static void unsetReturnPathIgnoredForOk(javax.servlet.http.HttpSession session)
          Unset the "return path" that locates the point at which a subflow was included into a primary workflow.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionUtils

public SessionUtils()
Method Detail

getWebUser

public static WebUser getWebUser(javax.servlet.http.HttpSession session)
Retrieve the cached WebUser representing the user.

Parameters:
session - the http session
Returns:
null if the session or its attribute 'webUser' is invalid, the user otherwise

setWebUser

public static void setWebUser(javax.servlet.http.HttpSession session,
                              WebUser user)

getList

public static Integer[] getList(javax.servlet.http.HttpSession session,
                                String attr)
Retrieve the array of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute

getListAsList

public static List getListAsList(javax.servlet.http.HttpSession session,
                                 String attr)
Retrieve the List of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute

getListAsListStr

public static List<String> getListAsListStr(javax.servlet.http.HttpSession session,
                                            String attr)
Retrieve the List of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute

addToList

public static void addToList(javax.servlet.http.HttpSession session,
                             String attr,
                             List ids)
Merge the given ids into the array of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute
ids - the ids to be added

addToList

public static void addToList(javax.servlet.http.HttpSession session,
                             String attr,
                             Integer[] ids)

addToListStr

public static void addToListStr(javax.servlet.http.HttpSession session,
                                String attr,
                                List ids)
Merge the given ids into the array of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute
ids - the ids to be added

addToList

public static void addToList(javax.servlet.http.HttpSession session,
                             String attr,
                             String[] ids)

removeFromList

public static void removeFromList(javax.servlet.http.HttpSession session,
                                  String attr,
                                  List ids)
Remove the given ids from the array of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute
ids - the ids to be removed

removeFromList

public static void removeFromList(javax.servlet.http.HttpSession session,
                                  String attr,
                                  Integer[] ids)

removeFromListStr

public static void removeFromListStr(javax.servlet.http.HttpSession session,
                                     String attr,
                                     List ids)
Remove the given ids from the array of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute
ids - the ids to be removed

removeFromList

public static void removeFromList(javax.servlet.http.HttpSession session,
                                  String attr,
                                  String[] ids)

removeList

public static void removeList(javax.servlet.http.HttpSession session,
                              String attr)
Remove the array of pending ids stored under the named session attribute.

Parameters:
session - the http session
attr - the name of the session attribute

getReturnPath

public static String getReturnPath(javax.servlet.http.HttpSession session)
Retrieve the "return path" that locates the point at which a subflow was included into a primary workflow.

Parameters:
session - the http session

setReturnPath

public static void setReturnPath(javax.servlet.http.HttpSession session,
                                 String path)
Set the "returnPath", the possible point of origin for a workflow.

Parameters:
session - the http session
path - the return path

setReturnPath

public static void setReturnPath(javax.servlet.http.HttpSession session,
                                 String path,
                                 Boolean ignore)
Set the "returnPath," the possible point of origin for a worklow

Parameters:
session - The http session.
path - The return path url represented as a String.
ignore -

resetReturnPath

public static void resetReturnPath(javax.servlet.http.HttpSession session)
clear out the return path stack.


unsetReturnPath

public static void unsetReturnPath(javax.servlet.http.HttpSession session)
Unset the "return path" that locates the point at which a subflow was included into a primary workflow.

Parameters:
session - the http session

getReturnPathIgnoredForOk

public static Boolean getReturnPathIgnoredForOk(javax.servlet.http.HttpSession session)
Retrieve wether the "return path" should be paid attention to for new. should default to false, which means that it is not ignored.

Parameters:
session - the http session
Returns:
whether or not to ignore the return path

unsetReturnPathIgnoredForOk

public static void unsetReturnPathIgnoredForOk(javax.servlet.http.HttpSession session)
Unset the "return path" that locates the point at which a subflow was included into a primary workflow.

Parameters:
session - the http session

clearWorkflow

public static void clearWorkflow(javax.servlet.http.HttpSession session,
                                 String workflowName)
Remove any old workflows

Parameters:
session -
workflowName -

pushWorkflow

public static void pushWorkflow(javax.servlet.http.HttpSession session,
                                org.apache.struts.action.ActionMapping mapping,
                                String workflowName)
Takes the current returnPath and pushes it onto the workflow's stack.

Parameters:
session - The HttpSesion to get and save the workflow to/from
mapping - Use the input attribute from this mapping if a returnPath is not defined in the current session.
workflowName - The name of the workflow scope to save the input under.

popWorkflow

public static String popWorkflow(javax.servlet.http.HttpSession session,
                                 String workflowName)
Takes the current returnPath and pops it off of the workflow's stack.

Parameters:
session - The HttpSesion to get and save the workflow to/from
workflowName - The name of the workflow scope to save the input under.
Returns:
return path or null if it can't be retrieved

countWorkflow

public static int countWorkflow(javax.servlet.http.HttpSession session,
                                String workflowName)
Returns the size of a workflow's stack.

Parameters:
session - The HttpSesion to get and save the workflow to/from
workflowName - The name of the workflow scope to save the input under.

setConfirmation

public static void setConfirmation(javax.servlet.http.HttpSession session,
                                   String key)
Set a confirmation message upon completion of a user action.

Parameters:
session - The servlet session object
key - the message resource key

setConfirmation

public static void setConfirmation(javax.servlet.http.HttpSession session,
                                   String key,
                                   Object value0)
Set a confirmation message with a replacement value upon completion of a user action.

Parameters:
session - The servlet session object
key - the message resource key
value0 - the replacement value

unsetConfirmation

public static void unsetConfirmation(javax.servlet.http.HttpSession session,
                                     String key)

setError

public static void setError(javax.servlet.http.HttpSession session,
                            String key)
Set an error message when a user action fails with a user-level error.

Parameters:
session - The servlet session object
key - the message resource key

setError

public static void setError(javax.servlet.http.HttpSession session,
                            String key,
                            String property)
Set an error message when a user action fails with a user-level error.

Parameters:
session - The servlet session object
key - the message resource key
property - the form property for which the error occurred

setError

public static void setError(javax.servlet.http.HttpSession session,
                            String key,
                            Object value0)
Set an error message with a replacement value when a user action fails with a user-level error.

Parameters:
session - The servlet session object
key - the message resource key
value0 - the replacement value

setError

public static void setError(javax.servlet.http.HttpSession session,
                            String key,
                            Object value0,
                            String property)
Set an error message with a replacement value when a user action fails with a user-level error.

Parameters:
session - The servlet session object
key - the message resource key
value0 - the replacement value
property - the form property for which the error occurred

unsetError

public static void unsetError(javax.servlet.http.HttpSession session)

moveAttribute

public static void moveAttribute(javax.servlet.http.HttpServletRequest request,
                                 String key)
Move the attribute from the session to request scope.

Parameters:
request - The request to move the attribute to.
key - Key indicating the attribute to move scope.


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.