You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jonas Denvall <jo...@arkatay.com> on 2002/08/26 19:27:15 UTC

Mapping between turbine.om.security.User and om generated TurbineUser

Hey all.

I'm getting a bit confused about the user handling mechanisms in Turbine
2.2. The getUser() method in RunData returns a
org.apache.turbine.om.security.User object. How do I convert this to a
com.mycompany.newapp.om.User object?

I could of course do a select on the userId, but that does not seem to
be the way to do it. Is there no standard way to map between the turbine
"raw" user objects and the generated ones?

I want to through out my system use my own object, MyUser, extending the
(modified) TurbineUser. But this seems dangerous, since when you do
changes to the logged-in user, you must user the RunData.getUser()
object to keep the changes after the session expires, according to
previous discussions.

What is the best way to handle this?

Thanx
/Jonas


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and om generatedTurbineUser

Posted by Peter Neubauer <pe...@yahoo.se>.
On Tue, 2002-08-27 at 12:17, Alexander Banthien wrote:
> Hi,
> 
> since I am also struggling with extending my user: is it required to upgrade the jars to the versions mentioned below? is it the case ( as appears to me) that
> e.g turbine 2.2b2 and torque 3.0b3 don't allow Users to be extended because of bugs?
> 
> Regards, Alex

After much struggle (which is far from over) I installed maven and use
now the versions:
torque-3.0-b4-dev.20020814.103755.jar
turbine-2.2-b3-dev.jar,
available at www.ibiblio.org/maven, where the default repository for
maven is located. If you use these, be sure to have the right versions
of the rest of the .jar, since everything is moving right now (like
stratum, commons-lang etc. etc).
I attach my project file so you can check the dependencies for yourself.

/peter

> 
> Peter Neubauer wrote:
> 
> > On Mon, 2002-08-26 at 19:27, Jonas Denvall wrote:
> > > Hey all.
> > >
> > > I'm getting a bit confused about the user handling mechanisms in Turbine
> > > 2.2. The getUser() method in RunData returns a
> > > org.apache.turbine.om.security.User object. How do I convert this to a
> > > com.mycompany.newapp.om.User object?
> > Basically, you implement your own User object (look at the User-Extend Howto) via an Adapter class that extends org.apache.turbine.om.security.TurbineUser.
> > In your app-schema.xml file, insert something like the following to get
> > your geenrated OM-classes extend your own classes:
> >
> >    <table name="APP_USER" javaName="APPUser" alias="TurbineUser"
> >         baseClass="com.....om.TurbineUserAdapter"
> >         basePeer="com.....om.TurbineUserPeerAdapter">
> >     <!-- Unique identifier -->
> >     <column name="USER_ID" primaryKey="true" required="true"
> > type="INTEGER"/>
> >   </table>
> > <table name="MEMBER" idMethod="idbroker">
> >     <column name="MEMBER_ID" required="true" primaryKey="true"
> > type="INTEGER"/>
> >     <column name="NAME" size="255" type="VARCHAR"/>
> >     <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
> >     <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
> >     <column name="EMAIL" size="99" type="VARCHAR"/>
> >     <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
> >     <column name="POINTS" type="INTEGER" default="0"/>
> >     <column name="BRANCH_ID" type="INTEGER" description=""/>
> >     <column name="INFO" type="LONGVARCHAR" description=""/>
> >     <column name="LOOKING_FOR" type="LONGVARCHAR" description=""/>
> >     <column name="PHOTO_ID" type="INTEGER" description=""/>
> >      <foreign-key foreignTable="APP_USER">
> >       <reference local="MEMBER_ID" foreign="USER_ID"/>
> >     </foreign-key>
> >   </table>
> >   <table name="STATUS" idMethod="idbroker">
> >     <column name="STATUS_ID" required="true" primaryKey="true"
> > type="INTEGER"/>
> >     <column name="DESCRIPTION" size="255" type="VARCHAR"/>
> >    </table>
> >
> >
> > This should do the trick.
> > Howeverm there is a huge migration underway, seperating torque from
> > turbine. The savest bet is to use turbine 2.2-b3-dev (or the latest CVS
> > snapshot) with torque 3.0-b4 since the BasePeer and UserPeer tables have
> > been moved, and the Criteria has been moved to torque which gives
> > problems when extending the older turbine peer classes that take the
> > turbine criteria.
> >
> > Hope that helps.
> >
> > /peter
> >
> > >
> > > I could of course do a select on the userId, but that does not seem to
> > > be the way to do it. Is there no standard way to map between the turbine
> > > "raw" user objects and the generated ones?
> > >
> > > I want to through out my system use my own object, MyUser, extending the
> > > (modified) TurbineUser. But this seems dangerous, since when you do
> > > changes to the logged-in user, you must user the RunData.getUser()
> > > object to keep the changes after the session expires, according to
> > > previous discussions.
> > >
> > > What is the best way to handle this?
> > >
> > > Thanx
> > > /Jonas
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> > _____________________________________________________
> >
> > Gratis e-mail resten av livet p� www.yahoo.se/mail
> >
> > Busenkelt!
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> --
> 
> Mit freundlichen Gr��en
> Alexander Banthien
> 
> _______________________________________
> Questech GmbH
> Schwarzwaldstr. 19
> 79199 Kirchzarten
> 
> Fon: +49 (0)7661 90 35-15
> Fax: +49 (0)7661 90 35-20
> www.questech.de
> 
> _______________________________________
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and om generatedTurbineUser

Posted by Scott Eade <se...@backstagetech.com.au>.
> From: Alexander Banthien <al...@questech.de>
> 
> since I am also struggling with extending my user: is it required to upgrade
> the jars to the versions mentioned below? is it the case ( as appears to me)
> that
> e.g turbine 2.2b2 and torque 3.0b3 don't allow Users to be extended because of
> bugs?

I had a pretty determined attempt at extending turbine user a couple of
weeks ago using tdk2.2b2 but kept running into brick walls.

There are actually a bunch of changes to the security classes sitting in cvs
(jakarta-turbine-fulcrum/proposals/db_security_service) that are supposedly
going to replace the existing ones real soon now.  When I get the chance I
want to install these and have another go at extending TurbineUser (I think
these strip out some of the complexities in the existing code).  I have
queried Henning (the author) on irc as to the status of this work, but our
timezones are way out of sync - hopefully I'll get a response back tonight.

The LDAP query was raised again in the last week or so - I am unsure how
well the previously provided patch is going to integrate with the latest
code (or after the update mentioned in the previous paragraph) as there has
been talk of stripping out the alternative SecurityService implementations
leaving only the one provided by torque - this may make things much easier
for extending turbine user, but may make things very difficult (or at least
very different) when it comes to LDAP.

Cheers,

Scott
-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and om generatedTurbineUser

Posted by Alexander Banthien <al...@questech.de>.
Hi,

since I am also struggling with extending my user: is it required to upgrade the jars to the versions mentioned below? is it the case ( as appears to me) that
e.g turbine 2.2b2 and torque 3.0b3 don't allow Users to be extended because of bugs?

Regards, Alex

Peter Neubauer wrote:

> On Mon, 2002-08-26 at 19:27, Jonas Denvall wrote:
> > Hey all.
> >
> > I'm getting a bit confused about the user handling mechanisms in Turbine
> > 2.2. The getUser() method in RunData returns a
> > org.apache.turbine.om.security.User object. How do I convert this to a
> > com.mycompany.newapp.om.User object?
> Basically, you implement your own User object (look at the User-Extend Howto) via an Adapter class that extends org.apache.turbine.om.security.TurbineUser.
> In your app-schema.xml file, insert something like the following to get
> your geenrated OM-classes extend your own classes:
>
>    <table name="APP_USER" javaName="APPUser" alias="TurbineUser"
>         baseClass="com.....om.TurbineUserAdapter"
>         basePeer="com.....om.TurbineUserPeerAdapter">
>     <!-- Unique identifier -->
>     <column name="USER_ID" primaryKey="true" required="true"
> type="INTEGER"/>
>   </table>
> <table name="MEMBER" idMethod="idbroker">
>     <column name="MEMBER_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="NAME" size="255" type="VARCHAR"/>
>     <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
>     <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
>     <column name="EMAIL" size="99" type="VARCHAR"/>
>     <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
>     <column name="POINTS" type="INTEGER" default="0"/>
>     <column name="BRANCH_ID" type="INTEGER" description=""/>
>     <column name="INFO" type="LONGVARCHAR" description=""/>
>     <column name="LOOKING_FOR" type="LONGVARCHAR" description=""/>
>     <column name="PHOTO_ID" type="INTEGER" description=""/>
>      <foreign-key foreignTable="APP_USER">
>       <reference local="MEMBER_ID" foreign="USER_ID"/>
>     </foreign-key>
>   </table>
>   <table name="STATUS" idMethod="idbroker">
>     <column name="STATUS_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="DESCRIPTION" size="255" type="VARCHAR"/>
>    </table>
>
>
> This should do the trick.
> Howeverm there is a huge migration underway, seperating torque from
> turbine. The savest bet is to use turbine 2.2-b3-dev (or the latest CVS
> snapshot) with torque 3.0-b4 since the BasePeer and UserPeer tables have
> been moved, and the Criteria has been moved to torque which gives
> problems when extending the older turbine peer classes that take the
> turbine criteria.
>
> Hope that helps.
>
> /peter
>
> >
> > I could of course do a select on the userId, but that does not seem to
> > be the way to do it. Is there no standard way to map between the turbine
> > "raw" user objects and the generated ones?
> >
> > I want to through out my system use my own object, MyUser, extending the
> > (modified) TurbineUser. But this seems dangerous, since when you do
> > changes to the logged-in user, you must user the RunData.getUser()
> > object to keep the changes after the session expires, according to
> > previous discussions.
> >
> > What is the best way to handle this?
> >
> > Thanx
> > /Jonas
> >
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> _____________________________________________________
>
> Gratis e-mail resten av livet på www.yahoo.se/mail
>
> Busenkelt!
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--

Mit freundlichen Grüßen
Alexander Banthien

_______________________________________
Questech GmbH
Schwarzwaldstr. 19
79199 Kirchzarten

Fon: +49 (0)7661 90 35-15
Fax: +49 (0)7661 90 35-20
www.questech.de

_______________________________________



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and omgeneratedTurbineUser

Posted by Peter Neubauer <pe...@yahoo.se>.
On Tue, 2002-08-27 at 19:40, Alexander Banthien wrote:
> Hi Peter,
> 
> how did you get around the problem in the class map.TurbineUserPeerAdapter.java (cf. Extend User Howto) when generating a
> -------------
> private static MapBuilder mapBuilder getMapBuilder();
> --------------
> how do you do that? is it required anymore?
> 
> Problem is that this statement is called outside any method and no Exception handling can take place. (compile error)
> The alternative, to call this method with a String, i don't understand. What must I put inas an argument?
> 
> Thanks in advance
> 
> Alex
Hi,
since we don't extend or deminish the TurbineUser tables, the whole
thing works with the default MapBuilder. Just omit this class and you
will be fine with the DeaultMapBuilder.

regards

/peter
> 
> Peter Neubauer wrote:
> 
> > On Tue, 2002-08-27 at 11:32, Jonas Denvall wrote:
> > > Thanx for your answer Peter. I need some clarifications, though:
> > >
> > > >Basically, you implement your own User object (look at the User-Extend
> > > Howto) via an Adapter class that extends
> > > >org.apache.turbine.om.security.TurbineUser.
> > >
> > > I somehow missed that step in the User-Extend How-to, regarding the
> > > TurbineUser adapter class. That's why my MyUser object extends
> > > com.mycompany.myapp.om.TurbineUser instead of
> > > org.apache.turbine.om.security.TurbineUser (via the adapter class),
> > > since I omitted the basClass and basePeer attributes. That will solve
> > > some of my problems, thanx.
> > >
> > > But I was under the impression that the User-Extend How-to guide is
> > > applicable only for Turbine 2.1. I'm using TDK 2.2 b3, including the
> > > Torque 3.0-b4. What issues in User-Extend How-to have changed in version
> > > 2.2? I've seen many questions about this, but no clear guides. I've read
> > > that there is no need to write Adapter classes in 2.2 (see the message
> > > link below), is this true, and why?
> > I don't know about that, but I implemented the adapter class anyway, in case you need to bridge some functionality (like inserting
> > a custom getUserName() function etc.
> > What has changed is that the BasePeer and Criteria Classes are now
> > located in Torque:
> >
> > import org.apache.torque.util.BasePeer;
> > import org.apache.torque.util.Criteria;
> >
> > (comes from TurbineUserPeer in Turbine)
> >
> > whereas the older turbine version have the BasePeer and Criteria in
> > turbine. That gives runtime problems since you construct Torque
> > criterias in your application, but the BasePeer is taking Turbine
> > criterias because of inheritance through the apapter classes.
> > >
> > > Another question:
> > > Following the guidelines in
> > > http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg07569.htm
> > > l,
> > > I have not only created my own MyUser table / class, (extending the
> > > TurbineUser), but also stripped the Turbine_User table of some
> > > attributes, such as FirstName and LastName. The reason for this is to
> > > gather as much data as possible in the MyUser table. But, what happens
> > > when the MyUser extends org.apache.turbine.om.security.TurbineUser? That
> > > class provides methods for retrieving FirstName and LastName - that
> > > don't exist in the database, and that does not feel good ;-). Am I on
> > > the wrong track here, am I not supposed to remove attributes from the
> > > TurbineUser table?
> > >
> > I tried that too, but looking at the source and activating the sql logs
> > in torque reveals that e.g. the Flux modules and turbine itself are
> > having dependencies, like an orderBy TURBINE_LOGIN name in a select I
> > saw.
> > I think it is no problem to leave the TURBINE_USER table as is, but not
> > using its columns except TURBINE.LOGIN_NAME and PASSWORD. The rest you
> > can do within your app_user.
> >
> > /peter
> >
> > > Thanx again,
> > > Jonas
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > > For additional commands, e-mail: <ma...@jakarta.apache.org>
> >
> > _____________________________________________________
> >
> > Gratis e-mail resten av livet på www.yahoo.se/mail
> >
> > Busenkelt!
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> --
> 
> Mit freundlichen Grüßen
> Alexander Banthien
> 
> _______________________________________
> Questech GmbH
> Schwarzwaldstr. 19
> 79199 Kirchzarten
> 
> Fon: +49 (0)7661 90 35-15
> Fax: +49 (0)7661 90 35-20
> www.questech.de
> 
> _______________________________________
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


_____________________________________________________
Följ VM på nära håll på Yahoo!s officielle VM-sajt www.yahoo.se/vm2002
Håll dig ajour med nyheter och resultat, med vinnare och förlorare...

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and omgeneratedTurbineUser

Posted by Alexander Banthien <al...@questech.de>.
Hi Peter,

how did you get around the problem in the class map.TurbineUserPeerAdapter.java (cf. Extend User Howto) when generating a
-------------
private static MapBuilder mapBuilder getMapBuilder();
--------------
how do you do that? is it required anymore?

Problem is that this statement is called outside any method and no Exception handling can take place. (compile error)
The alternative, to call this method with a String, i don't understand. What must I put inas an argument?

Thanks in advance

Alex

Peter Neubauer wrote:

> On Tue, 2002-08-27 at 11:32, Jonas Denvall wrote:
> > Thanx for your answer Peter. I need some clarifications, though:
> >
> > >Basically, you implement your own User object (look at the User-Extend
> > Howto) via an Adapter class that extends
> > >org.apache.turbine.om.security.TurbineUser.
> >
> > I somehow missed that step in the User-Extend How-to, regarding the
> > TurbineUser adapter class. That's why my MyUser object extends
> > com.mycompany.myapp.om.TurbineUser instead of
> > org.apache.turbine.om.security.TurbineUser (via the adapter class),
> > since I omitted the basClass and basePeer attributes. That will solve
> > some of my problems, thanx.
> >
> > But I was under the impression that the User-Extend How-to guide is
> > applicable only for Turbine 2.1. I'm using TDK 2.2 b3, including the
> > Torque 3.0-b4. What issues in User-Extend How-to have changed in version
> > 2.2? I've seen many questions about this, but no clear guides. I've read
> > that there is no need to write Adapter classes in 2.2 (see the message
> > link below), is this true, and why?
> I don't know about that, but I implemented the adapter class anyway, in case you need to bridge some functionality (like inserting
> a custom getUserName() function etc.
> What has changed is that the BasePeer and Criteria Classes are now
> located in Torque:
>
> import org.apache.torque.util.BasePeer;
> import org.apache.torque.util.Criteria;
>
> (comes from TurbineUserPeer in Turbine)
>
> whereas the older turbine version have the BasePeer and Criteria in
> turbine. That gives runtime problems since you construct Torque
> criterias in your application, but the BasePeer is taking Turbine
> criterias because of inheritance through the apapter classes.
> >
> > Another question:
> > Following the guidelines in
> > http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg07569.htm
> > l,
> > I have not only created my own MyUser table / class, (extending the
> > TurbineUser), but also stripped the Turbine_User table of some
> > attributes, such as FirstName and LastName. The reason for this is to
> > gather as much data as possible in the MyUser table. But, what happens
> > when the MyUser extends org.apache.turbine.om.security.TurbineUser? That
> > class provides methods for retrieving FirstName and LastName - that
> > don't exist in the database, and that does not feel good ;-). Am I on
> > the wrong track here, am I not supposed to remove attributes from the
> > TurbineUser table?
> >
> I tried that too, but looking at the source and activating the sql logs
> in torque reveals that e.g. the Flux modules and turbine itself are
> having dependencies, like an orderBy TURBINE_LOGIN name in a select I
> saw.
> I think it is no problem to leave the TURBINE_USER table as is, but not
> using its columns except TURBINE.LOGIN_NAME and PASSWORD. The rest you
> can do within your app_user.
>
> /peter
>
> > Thanx again,
> > Jonas
> >
> >
> > --
> > To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
> _____________________________________________________
>
> Gratis e-mail resten av livet på www.yahoo.se/mail
>
> Busenkelt!
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--

Mit freundlichen Grüßen
Alexander Banthien

_______________________________________
Questech GmbH
Schwarzwaldstr. 19
79199 Kirchzarten

Fon: +49 (0)7661 90 35-15
Fax: +49 (0)7661 90 35-20
www.questech.de

_______________________________________



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and om generatedTurbineUser

Posted by Peter Neubauer <pe...@yahoo.se>.
On Tue, 2002-08-27 at 11:32, Jonas Denvall wrote:
> Thanx for your answer Peter. I need some clarifications, though:
> 
> >Basically, you implement your own User object (look at the User-Extend
> Howto) via an Adapter class that extends
> >org.apache.turbine.om.security.TurbineUser.
> 
> I somehow missed that step in the User-Extend How-to, regarding the
> TurbineUser adapter class. That's why my MyUser object extends
> com.mycompany.myapp.om.TurbineUser instead of
> org.apache.turbine.om.security.TurbineUser (via the adapter class),
> since I omitted the basClass and basePeer attributes. That will solve
> some of my problems, thanx.
> 
> But I was under the impression that the User-Extend How-to guide is
> applicable only for Turbine 2.1. I'm using TDK 2.2 b3, including the
> Torque 3.0-b4. What issues in User-Extend How-to have changed in version
> 2.2? I've seen many questions about this, but no clear guides. I've read
> that there is no need to write Adapter classes in 2.2 (see the message
> link below), is this true, and why?
I don't know about that, but I implemented the adapter class anyway, in case you need to bridge some functionality (like inserting 
a custom getUserName() function etc.
What has changed is that the BasePeer and Criteria Classes are now 
located in Torque:

import org.apache.torque.util.BasePeer;
import org.apache.torque.util.Criteria;

(comes from TurbineUserPeer in Turbine)

whereas the older turbine version have the BasePeer and Criteria in
turbine. That gives runtime problems since you construct Torque
criterias in your application, but the BasePeer is taking Turbine
criterias because of inheritance through the apapter classes.
> 
> Another question:
> Following the guidelines in
> http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg07569.htm
> l,
> I have not only created my own MyUser table / class, (extending the
> TurbineUser), but also stripped the Turbine_User table of some
> attributes, such as FirstName and LastName. The reason for this is to
> gather as much data as possible in the MyUser table. But, what happens
> when the MyUser extends org.apache.turbine.om.security.TurbineUser? That
> class provides methods for retrieving FirstName and LastName - that
> don't exist in the database, and that does not feel good ;-). Am I on
> the wrong track here, am I not supposed to remove attributes from the
> TurbineUser table?
> 
I tried that too, but looking at the source and activating the sql logs
in torque reveals that e.g. the Flux modules and turbine itself are
having dependencies, like an orderBy TURBINE_LOGIN name in a select I
saw.
I think it is no problem to leave the TURBINE_USER table as is, but not
using its columns except TURBINE.LOGIN_NAME and PASSWORD. The rest you
can do within your app_user.

/peter

> Thanx again,
> Jonas
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


_____________________________________________________
Gratis e-mail resten av livet p� www.yahoo.se/mail
Busenkelt!

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and om generatedTurbineUser

Posted by Jonas Denvall <jo...@arkatay.com>.
Thanx for your answer Peter. I need some clarifications, though:

>Basically, you implement your own User object (look at the User-Extend
Howto) via an Adapter class that extends
>org.apache.turbine.om.security.TurbineUser.

I somehow missed that step in the User-Extend How-to, regarding the
TurbineUser adapter class. That's why my MyUser object extends
com.mycompany.myapp.om.TurbineUser instead of
org.apache.turbine.om.security.TurbineUser (via the adapter class),
since I omitted the basClass and basePeer attributes. That will solve
some of my problems, thanx.

But I was under the impression that the User-Extend How-to guide is
applicable only for Turbine 2.1. I'm using TDK 2.2 b3, including the
Torque 3.0-b4. What issues in User-Extend How-to have changed in version
2.2? I've seen many questions about this, but no clear guides. I've read
that there is no need to write Adapter classes in 2.2 (see the message
link below), is this true, and why?

Another question:
Following the guidelines in
http://www.mail-archive.com/turbine-user@jakarta.apache.org/msg07569.htm
l,
I have not only created my own MyUser table / class, (extending the
TurbineUser), but also stripped the Turbine_User table of some
attributes, such as FirstName and LastName. The reason for this is to
gather as much data as possible in the MyUser table. But, what happens
when the MyUser extends org.apache.turbine.om.security.TurbineUser? That
class provides methods for retrieving FirstName and LastName - that
don't exist in the database, and that does not feel good ;-). Am I on
the wrong track here, am I not supposed to remove attributes from the
TurbineUser table?

Thanx again,
Jonas


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mapping between turbine.om.security.User and om generated TurbineUser

Posted by Peter Neubauer <pe...@yahoo.se>.
On Mon, 2002-08-26 at 19:27, Jonas Denvall wrote:
> Hey all.
> 
> I'm getting a bit confused about the user handling mechanisms in Turbine
> 2.2. The getUser() method in RunData returns a
> org.apache.turbine.om.security.User object. How do I convert this to a
> com.mycompany.newapp.om.User object?
Basically, you implement your own User object (look at the User-Extend Howto) via an Adapter class that extends org.apache.turbine.om.security.TurbineUser.
In your app-schema.xml file, insert something like the following to get
your geenrated OM-classes extend your own classes:

   <table name="APP_USER" javaName="APPUser" alias="TurbineUser"
    	baseClass="com.....om.TurbineUserAdapter"
	basePeer="com.....om.TurbineUserPeerAdapter">
    <!-- Unique identifier -->
    <column name="USER_ID" primaryKey="true" required="true"
type="INTEGER"/>
  </table>
<table name="MEMBER" idMethod="idbroker">
    <column name="MEMBER_ID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="NAME" size="255" type="VARCHAR"/>
    <column name="FIRST_NAME" required="true" size="99" type="VARCHAR"/>
    <column name="LAST_NAME" required="true" size="99" type="VARCHAR"/>
    <column name="EMAIL" size="99" type="VARCHAR"/>
    <column name="CONFIRM_VALUE" size="99" type="VARCHAR"/>
    <column name="POINTS" type="INTEGER" default="0"/>
    <column name="BRANCH_ID" type="INTEGER" description=""/>
    <column name="INFO" type="LONGVARCHAR" description=""/>
    <column name="LOOKING_FOR" type="LONGVARCHAR" description=""/>
    <column name="PHOTO_ID" type="INTEGER" description=""/>
     <foreign-key foreignTable="APP_USER">
      <reference local="MEMBER_ID" foreign="USER_ID"/>
    </foreign-key>
  </table>
  <table name="STATUS" idMethod="idbroker">
    <column name="STATUS_ID" required="true" primaryKey="true"
type="INTEGER"/>
    <column name="DESCRIPTION" size="255" type="VARCHAR"/>
   </table>
 

This should do the trick.
Howeverm there is a huge migration underway, seperating torque from
turbine. The savest bet is to use turbine 2.2-b3-dev (or the latest CVS
snapshot) with torque 3.0-b4 since the BasePeer and UserPeer tables have
been moved, and the Criteria has been moved to torque which gives
problems when extending the older turbine peer classes that take the
turbine criteria.

Hope that helps.

/peter

> 
> I could of course do a select on the userId, but that does not seem to
> be the way to do it. Is there no standard way to map between the turbine
> "raw" user objects and the generated ones?
> 
> I want to through out my system use my own object, MyUser, extending the
> (modified) TurbineUser. But this seems dangerous, since when you do
> changes to the logged-in user, you must user the RunData.getUser()
> object to keep the changes after the session expires, according to
> previous discussions.
> 
> What is the best way to handle this?
> 
> Thanx
> /Jonas
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


_____________________________________________________
Gratis e-mail resten av livet p� www.yahoo.se/mail
Busenkelt!

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>