[Opensource] Question on SingleDBUserInfo/DefaultUserInfo
Ivan Ivanov
rambiusparkisanius at yahoo.com
Tue Feb 10 10:23:58 PST 2004
Dear colleagues,
I am writing an Expresso-based web application and I
am facing some problems with users' manipulation.
I want to "extends" the information about users, kept
in expresso table USERSTABLE, so that I can store an
user's first name, middle name, last name and other
things. I added the table MYUSERINFO in my app'
database and wrote the corresponding MyUserInfo
DBObject. I plan that every time an user is added in
my app, he is added also in expresso USERSTABLE and
his ID in MYUSERINFO will be equal to
USERSTABLE.ExpUid.
Next, I want to show the stored information to the
user and in one of the contrroler's states I am doing
the following:
MyUserInfo userInfo = new MyUserInfo();
DefaultDBUserInfo defaultInfo = new
DefaultDBUserInfo();
userInfo.setField("ID", userId);
defaultInfo.setField("ExpUid", userId);
//for simplicity I added user called TestUser in
USERSTABLE through expresso web interface, whose
ExpUid is 4 and hardcoded userId=4.
ArrayList myUsers = userInfo.searchAndRetrieveList();
ArtayList users = defaultInfo.searchAndRetrieveList();
MyUserInfo myUser = (MyUserInfo)myUsers.get(0);
DefaultDBUserInfo defaultUser =
(DefaultDBUserInfo)users.get(0);
Output userProfile = new Output();
userProfile.setName("userProfile");
userProfile.setAttribute("ID",
defaultUser.getField("ExpUid"));
userProfile.setAttribute("firstname",
myUser.getField("FIRSTNAME"));
userProfile.setAttribute("middlename",
myUser.getField("MIDDLENAME"));
userProfile.setAttribute("lastname",
myUser.getField("LASTNAME"));
//and so on..
But when I run this state I am receiving
ArrayIndexOutOfBounds exception at line
DefaultDBUserInfo defaultUser =
(DefaultDBUserInfo)users.get(0);
After I debugged it, I noticed that the user with
ExpUid=4 is not read from USERSTABLE, i.e when I
commented the line
defaultInfo.setField("ExpUid", userId); then
defaultInfo.searchAndRetrieveList() returns all users
except my TestUser.
So is my approach completely wrong and if not how it
can be fixed?
I also searched the forum and in a previous message
called " RE:Newbie - How to get Current User info in
the controller" Mike Rimov is suggesting of creating
Custom UserInfo and registering it in the
ClassHandlers section of the expresso-config. So if my
approach cannot be fixed can you give me some hints on
how to extend UserInfo?
Thank you very much in advance.
Regards Ivan Ivanov
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
More information about the Opensource
mailing list