Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.ui.util
Class SessionUtils

java.lang.Object
  extended by org.hyperic.hq.ui.util.SessionUtils

public class SessionUtils
extends java.lang.Object

Utilities class that provides convenience methods for operating on bizapp objects.


Constructor Summary
SessionUtils()
           
 
Method Summary
static void addToList(javax.servlet.http.HttpSession session, java.lang.String attr, java.lang.Integer[] ids)
           
static void addToList(javax.servlet.http.HttpSession session, java.lang.String attr, java.util.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, java.lang.String attr, java.lang.String[] ids)
           
static void addToListStr(javax.servlet.http.HttpSession session, java.lang.String attr, java.util.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, java.lang.String workflowName)
          Remove any old workflows
static int countWorkflow(javax.servlet.http.HttpSession session, java.lang.String workflowName)
          Returns the size of a workflow's stack.
static java.lang.Integer getIntegerAttribute(javax.servlet.http.HttpSession session, java.lang.String key, java.lang.Integer defValue)
           
static java.lang.Integer[] getList(javax.servlet.http.HttpSession session, java.lang.String attr)
          Retrieve the array of pending ids stored under the named session attribute.
static java.util.List getListAsList(javax.servlet.http.HttpSession session, java.lang.String attr)
          Retrieve the List of pending ids stored under the named session attribute.
static java.util.List getListAsListStr(javax.servlet.http.HttpSession session, java.lang.String attr)
          Retrieve the List of pending ids stored under the named session attribute.
static java.lang.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 java.lang.Boolean getReturnPathIgnoredForOk(javax.servlet.http.HttpSession session)
          Retrieve wether the "return path" should be paid attention to for new.
static java.lang.String getStringAttribute(javax.servlet.http.HttpSession session, java.lang.String key, java.lang.String defValue)
           
static WebUser getWebUser(javax.servlet.http.HttpSession session)
          Retrieve the cached WebUser representing the user interacting with server.
static void moveAttribute(javax.servlet.http.HttpServletRequest request, java.lang.String key)
          Move the attribute from the session to request scope.
static java.lang.String popWorkflow(javax.servlet.http.HttpSession session, java.lang.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, java.lang.String workflowName)
          Takes the current returnPath and pushes it onto the workflow's stack.
static void removeFromList(javax.servlet.http.HttpSession session, java.lang.String attr, java.lang.Integer[] ids)
           
static void removeFromList(javax.servlet.http.HttpSession session, java.lang.String attr, java.util.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, java.lang.String attr, java.lang.String[] ids)
           
static void removeFromListStr(javax.servlet.http.HttpSession session, java.lang.String attr, java.util.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, java.lang.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, java.lang.String key)
          Set a confirmation message upon completion of a user action.
static void setConfirmation(javax.servlet.http.HttpSession session, java.lang.String key, java.lang.Object value0)
          Set a confirmation message with a replacement value upon completion of a user action.
static void setError(javax.servlet.http.HttpSession session, java.lang.String key)
          Set an error message when a user action fails with a user-level error.
static void setError(javax.servlet.http.HttpSession session, java.lang.String key, java.lang.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, java.lang.String key, java.lang.Object value0, java.lang.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, java.lang.String key, java.lang.String property)
          Set an error message when a user action fails with a user-level error.
static void setReturnPath(javax.servlet.http.HttpSession session, java.lang.String path)
          Set the "returnPath", the possible point of origin for a workflow.
static void setReturnPath(javax.servlet.http.HttpSession session, java.lang.String path, java.lang.Boolean ignore)
          Set the "returnPath," the possible point of origin for a worklow
static void unsetConfirmation(javax.servlet.http.HttpSession session, java.lang.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

getIntegerAttribute

public static java.lang.Integer getIntegerAttribute(javax.servlet.http.HttpSession session,
                                                    java.lang.String key,
                                                    java.lang.Integer defValue)
Parameters:
key - the attribute key requested
defValue - the value to return if the key returns a null value
Returns:
the Integer value in the session otherwise the defaultValue if null

getStringAttribute

public static java.lang.String getStringAttribute(javax.servlet.http.HttpSession session,
                                                  java.lang.String key,
                                                  java.lang.String defValue)
Parameters:
key - the attribute key requested
defValue - the value to retun if the value is null or cannot be cast to a String
Returns:
the String value, otherwise the default value

getWebUser

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

Parameters:
session - the http session

getList

public static java.lang.Integer[] getList(javax.servlet.http.HttpSession session,
                                          java.lang.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 java.util.List getListAsList(javax.servlet.http.HttpSession session,
                                           java.lang.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 java.util.List getListAsListStr(javax.servlet.http.HttpSession session,
                                              java.lang.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,
                             java.lang.String attr,
                             java.util.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,
                             java.lang.String attr,
                             java.lang.Integer[] ids)

addToListStr

public static void addToListStr(javax.servlet.http.HttpSession session,
                                java.lang.String attr,
                                java.util.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,
                             java.lang.String attr,
                             java.lang.String[] ids)

removeFromList

public static void removeFromList(javax.servlet.http.HttpSession session,
                                  java.lang.String attr,
                                  java.util.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,
                                  java.lang.String attr,
                                  java.lang.Integer[] ids)

removeFromListStr

public static void removeFromListStr(javax.servlet.http.HttpSession session,
                                     java.lang.String attr,
                                     java.util.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,
                                  java.lang.String attr,
                                  java.lang.String[] ids)

removeList

public static void removeList(javax.servlet.http.HttpSession session,
                              java.lang.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 java.lang.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,
                                 java.lang.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,
                                 java.lang.String path,
                                 java.lang.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 java.lang.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,
                                 java.lang.String workflowName)
Remove any old workflows

Parameters:
session -
mapping -
workflowName -

pushWorkflow

public static void pushWorkflow(javax.servlet.http.HttpSession session,
                                org.apache.struts.action.ActionMapping mapping,
                                java.lang.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 java.lang.String popWorkflow(javax.servlet.http.HttpSession session,
                                           java.lang.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
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.

countWorkflow

public static int countWorkflow(javax.servlet.http.HttpSession session,
                                java.lang.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,
                                   java.lang.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,
                                   java.lang.String key,
                                   java.lang.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,
                                     java.lang.String key)

setError

public static void setError(javax.servlet.http.HttpSession session,
                            java.lang.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,
                            java.lang.String key,
                            java.lang.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,
                            java.lang.String key,
                            java.lang.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,
                            java.lang.String key,
                            java.lang.Object value0,
                            java.lang.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,
                                 java.lang.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.

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.