Sean,

Ahh!  I didn't catch that part.  Thank you!!  So when I update the
JetspeedSecurity.properties file to use my custom user class (UnifocusUser),
does that mean that the runData.getUser() method will return a User class of
type UnifocusUser, or is it still of type TurbineUser?  Or does updating the
JetspeedSecurity.properties file have anything to do with the object type
that the runData.getUser() method returns?

Thank you for pointing out where my mistake was.

Celeste

-----Original Message-----
From: Doherty, Sean [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 1:34 PM
To: 'Jetspeed Users List'
Subject: RE: Question on Extending the BaseJetspeedUser Object in
Jetspeed 1.4


You need to update the JetspeedSecurity.properties file to specify your
class as the User class.  Specifically, you need to update the
"services.JetspeedSecurity.user.class" property.

You may also need to provide your own implementation of the UserManagement
class if your UnifocusUser class needs additional initialization.

Regards,
Sean

-----Original Message-----
From: Celeste Haseltine [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 18, 2003 2:28 PM
To: 'Jetspeed Users List'
Subject: Question on Extending the BaseJetspeedUser Object in Jetspeed
1.4


I'm having a problem extending the BaseJetspeedUser class to handle
additional fields that we need to add to the Turbine User table.  Bottom
line, how do I go about accessing this custom object in a portlet?  If I
cast the TurbineUser object returned by the method runData.getUser() to my
UnifocusUser object in a AbstractInstancePortlet portlet, I get a run time
class cast exception, as I would expect.  I thought I would post this and
see if anyone can advise me on exactly where/how I am suppose to use my
custom User object in Jetspeed.  

To create my custom User class (UnifocusUser), I did the following per the
web site and the BaseJetspeedUser API:

Added the new columns in my table to build/torque/security_schema.xml
Modified the build/torque/build.properties file to generate DDL for
SQLServer 2000
Rebuilt Jetspeed 1.4 source to generate the OM objects.
Extended class BaseJetspeedUser to create UnifocusUser, per the
BaseJetspeedUser API.

My UnifocusUser object is as follows:

public class UnifocusUser extends BaseJetspeedUser {
        
        public void setWebLoginID(String ID){
                        setPerm("WEBLOGINID",ID);                       
        }//end method
        
        public String getWebLoginID(){
                return (String) getPerm("WEBLOGINID");
        }//end method

}//end class definition

So far so good.  The problem comes in trying to figure out how to use this
class in a portlet.  If my understanding of Jetspeed is correct, the object
returned by the runData.getUser() method is a TurbineUser object.  So
exactly how do I utilize this UnifocusUser object in my own portlets?

Here is the test portlet I used to verify that I could access the additional
fields I added to the TurbineUser table:

public class PortletTestUnifocusUser extends AbstractInstancePortlet{

        public ConcreteElement getContent(RunData runData)
        {
                StringBuffer text =new StringBuffer();
                text.append("Hello ");
                
                //THIS WORKS, I CAN ACCESS THE ADDED FIELD.
                String ID = (String)runData.getUser().getPerm("WEBLOGINID");
                
                //THIS DOES NOT WORK, CLASS CAST EXCEPTION, AS EXPECTED 
                //UnifocusUser user = (UnifocusUser) runData.getUser();
                //String ID = user.getWebLoginID();
                
                String name  = runData.getUser().getFirstName();
                if (name ==null)
                        name =" Anonymous";
                text.append (name);
                text.append ("!");
                text.append ("  Your ID is " + ID);
                return (new StringElement(text.toString()));
        }//end method

}//end class definition

What am I missing here?  Any advice would be greatly appreciated!!!

Celeste


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to