OK, now I have another question on using my own User object.  I can retrieve
data from my additional fields in my UnifocusUser class.  But how do you
save a revised field value back to the database in the Turbine_user table?

I've tried the following two "ways":

Revising my UnifocusUser object as follows:

public class UnifocusUser extends BaseJetspeedUser {
        
        public void setWebLoginID(String ID){
                        setPerm("WEBLOGINID",ID);
                        super.save():           <---------- added this line.

        }//end method
        
        public String getWebLoginID(){
                return (String) getPerm("WEBLOGINID");
        }//end method

}//end class definition

And in my test portlet adding the following lines. 
public class PortletTestUnifocusUser extends AbstractInstancePortlet{

        public ConcreteElement getContent(RunData runData)
        {
                StringBuffer text =new StringBuffer();
                text.append("Hello ");
                
                //THIS WORKS TO RETRIEVE 
                //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);
                
                //now change the LoginID value and resave to database
                //using extended UserObject.  THIS DOES NOT WORK.
                ID = "9999";
                try {
                        user.setUserId(ID);
                } catch (Exception e) {
                        e.printStackTrace();
                }
                ID = user.getWebLoginID();
                text.append ("  And your revised ID is " + ID);
                return (new StringElement(text.toString()));
        }//end method
}//end class definition

My revised ID is still the original value of 33, the change was not saved to
the database.

I then tried the following in my test portlet:

                        ID = "99";
                        runData.getUser().setPerm("WEBLOGINID", ID);
                        runData.save();
                        ID = user.getWebLoginID();
                        text.append ("  And your revised ID after
runData.save is " + ID);

And the ID value is still unchanged.  I even verified this in the database.

So how do you save a revised value back to your extended table fields in
Turbine_user?

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]

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

Reply via email to