[Opensource] Question on SingleDBUserInfo/DefaultUserInfo

Mike Traum mtraum at jgroup.net
Tue Feb 10 15:36:25 PST 2004


Ivan,
It sounds like DefaultDBUserInfo doesn't contain the user 4. You need to
look at what table that referencing, and do a query to see exactly what
you have in there. What is DefaultDBUserInfo? Are you implementing your
own UserInfo object?

BTW, there's a construct built into expresso that probably does what you
want it to. Instead of modifying USERSTABLE, you define extra DBObjects
that should be associated with registration. Then, you modify the
'Registration Object Map' to include those objects in the 'Registration
Domain'. See
http://www.jcorporate.com/econtent/Content.do;jsessionid=aoTLEfvzkdYc?state=resource&resource=555#domain.

mike

On Tue, 2004-02-10 at 12:23, Ivan Ivanov wrote:
> 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
> 
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mailman.jcorporate.com/mailman/listinfo/opensource
-- 

Mike Traum
--
JGroup Expert 
Expresso Core Developer 
Providing support and development services - Available Now!




More information about the Opensource mailing list