You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2002/09/13 23:55:23 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util PortletSessionState.java

taylor      2002/09/13 14:55:23

  Modified:    src/java/org/apache/jetspeed/util PortletSessionState.java
  Log:
  Added new methods to get, set and clear variables from the session.
  
  Revision  Changes    Path
  1.3       +41 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletSessionState.java
  
  Index: PortletSessionState.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletSessionState.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletSessionState.java	29 Jul 2002 04:50:34 -0000	1.2
  +++ PortletSessionState.java	13 Sep 2002 21:55:23 -0000	1.3
  @@ -71,6 +71,43 @@
       /**
       Returns the parameter for this name from the Temp - session object
       */
  +    public static Object getAttribute(RunData rundata, String attrName)
  +    {
  +        return rundata.getUser().getTemp(attrName);
  +    }
  +
  +    public static Object getAttribute(RunData rundata, String attrName, Object defValue)
  +    {
  +        Object o = rundata.getUser().getTemp(attrName, defValue);
  +        if (o instanceof java.lang.String && !(defValue instanceof java.lang.String))
  +        {
  +            return defValue;
  +        }
  +        return o;
  +    }
  +
  +    /**
  +     * Sets the parameter for this name in Temp
  +     * Uses the portlet parameter to generate a unique key.
  +     */
  +    public static void setAttribute(RunData rundata, String attrName, Object attrValue)
  +    {
  +        rundata.getUser().setTemp(attrName, attrValue);
  +    }
  +
  +    /**
  +     * Clears the parameter for this name from Temp
  +     * Uses the portlet parameter to generate a unique key.
  +     */
  +    public static void clearAttribute(RunData rundata, String attrName)
  +    {
  +        rundata.getUser().removeTemp(attrName);
  +    }
  +    
  +    /**
  +     * Returns the parameter for this name from the Temp - session object
  +     * Uses the portlet parameter to generate a unique key.
  +     */
       public static Object getAttribute(VelocityPortlet portlet, RunData rundata, String attrName)
       {
           return rundata.getUser().getTemp(generateKey(portlet, attrName));
  @@ -78,6 +115,7 @@
   
       /**
        * Sets the parameter for this name in Temp
  +     * Uses the portlet parameter to generate a unique key.
        */
       public static void setAttribute(VelocityPortlet portlet,
                                RunData rundata,
  @@ -89,6 +127,7 @@
   
       /**
        * Clears the parameter for this name from Temp
  +     * Uses the portlet parameter to generate a unique key.
        */
       public static void clearAttribute(VelocityPortlet portlet, RunData rundata, String attrName)
       {
  @@ -96,7 +135,7 @@
       }
   
       /**
  -     *
  +     * Uses the portlet parameter to generate a unique key, using the portlet.getId.
        */
       protected static String generateKey(VelocityPortlet portlet, String name)
       {
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>