portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/om/security/turbine TurbineUserPeer.java
Date Wed, 21 Aug 2002 22:25:21 GMT
taylor      2002/08/21 15:25:20

  Modified:    src/java/org/apache/jetspeed/om/security/turbine
                        TurbineUserPeer.java
  Log:
  - Rolling back Amit's patch until we can get this to work. Fails to find OBJECTDATA column
on Oracle.
  
  Revision  Changes    Path
  1.4       +90 -0     jakarta-jetspeed/src/java/org/apache/jetspeed/om/security/turbine/TurbineUserPeer.java
  
  Index: TurbineUserPeer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/security/turbine/TurbineUserPeer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TurbineUserPeer.java	19 Aug 2002 21:40:13 -0000	1.3
  +++ TurbineUserPeer.java	21 Aug 2002 22:25:20 -0000	1.4
  @@ -162,12 +162,101 @@
       /*
        * Populates a JetspeedUser from a single row in the result set.
        * The hashtable of attributes for each user is populated with columns
  +     * from the result set. 
  +     *
  +     * @param row a row containing a single user's attributes.
  +     * @param user the JetspeedUser object to be populated.
  +     *
  +     */
  +    protected static void populateUserObject(Record row, int offset, JetspeedUser user)
  +        throws Exception
  +    {
  +        // Set values are where columns are expected.  They are not
  +        // required to be in these positions, as we set the positions
  +        // immediately following.
  +        int idPosition = 1;
  +        int objectDataPosition = columnNames.length;
  +        for( int i=0; i<columnNames.length; i++ )
  +        {
  +            if (columnNames[i].equals(USER_ID))
  +                idPosition = i+1;
  +
  +            if (columnNames[i].equals(TURBINE_OBJECTDATA))
  +                objectDataPosition = i+1;
  +        }
  +
  +        // Restore the Permanent Storage Hashtable.  First the
  +        // Hashtable is restored, then any explicit table columns
  +        // which should be included in the Hashtable are added.
  +        byte[] objectData = (byte[])row.getValue(objectDataPosition).asBytes();
  +        Hashtable tempHash = (Hashtable)ObjectUtils.deserialize(objectData);
  +        if (tempHash == null)
  +        {
  +            tempHash = new Hashtable(10);
  +        }
  +
  +        for( int j=0; j<columnNames.length; j++ )
  +        {
  +            if (! columnNames[j].equalsIgnoreCase( TURBINE_OBJECTDATA ) )
  +            {
  +                Object obj2 = null;
  +                Value value = row.getValue(j+1);
  +                if (value.isString()) 
  +                    obj2 = value.asString();
  +                else if (value.isBigDecimal()) 
  +                    obj2 = value.asBigDecimal();
  +                else if (value.isBytes()) 
  +                    obj2 = value.asBytes();
  +                else if (value.isDate()) 
  +                    obj2 = value.asDate();
  +                else if (value.isShort()) 
  +                    obj2 = new Short(value.asShort());
  +                else if (value.isInt()) 
  +                    obj2 = new Integer(value.asInt());
  +                else if (value.isLong()) 
  +                    obj2 = new Long(value.asLong());
  +                else if (value.isDouble()) 
  +                    obj2 = new Double(value.asDouble());
  +                else if (value.isFloat()) 
  +                    obj2 = new Float(value.asFloat());
  +                else if (value.isBoolean()) 
  +                    obj2 = new Boolean(value.asBoolean());
  +                else if (value.isTime()) 
  +                    obj2 = value.asTime();
  +                else if (value.isTimestamp()) 
  +                    obj2 = value.asTimestamp();
  +                else if (value.isUtilDate()) 
  +                    obj2 = value.asUtilDate();
  +                else if (value.isByte()) 
  +                    obj2 = new Byte(value.asByte());
  +
  +                if ( obj2 != null )
  +                {
  +                    if (columnNames[j].equalsIgnoreCase( JetspeedUser.USER_ID ))
  +                    {
  +                        obj2 = value.toString();
  +                    }
  +
  +                    tempHash.put( columnNames[j], obj2 );
  +                }
  +            }
  +        }
  +        user.setPermStorage( tempHash );
  +    }
  +
  +
  +    /*
  +     * Populates a JetspeedUser from a single row in the result set.
  +     * The hashtable of attributes for each user is populated with columns
        * from the result set.
        *
        * @param row a row containing a single user's attributes.
        * @param user the JetspeedUser object to be populated.
        *
        */
  +    /*
  +    DST: COMMITTED 8/19 FROM AMIT AMTE - IT HAS SOME BUGS, GOING TO REMOVE UNTIL RESOLVED
  +    
       protected static void populateUserObject(Record row, int offset, JetspeedUser user)
           throws Exception
       {
  @@ -239,6 +328,7 @@
           }
           user.setPermStorage( tempHash );
       }
  +    */
   
       /**
        * Builds a criteria object based upon an User object
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message