You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by malcolm cooke <ma...@firstlightassociates.co.uk> on 2002/11/19 14:14:43 UTC

RE: Problems extending user as per how to (and previous messages)

Thanks for the response Chris - it helped set me off looking at the right 
area to get it working.

For the benefit of others here is a result of my findings.

1. Because the foreign keys were not defined in the AGENT alias at all the 
generated BaseAgentPeer had numColumns set to 1, so that even though I'd 
defined the extra columns in TurbineUserAdaptor, although the correct SQL 
was being generated to get the information from the turbine user table they 
weren't being put into Perm correctly (that's my theory based on my limited 
knowledge). Once i changed the definition of AGENT in my xml schema as follows:
                 <column name="EO_ID" required="true" type="INTEGER"/>
                 <column name="ST_ID" required="true" type="INTEGER"/>
                 <foreign-key foreignTable="ORGANISATION">
                         <reference local="EO_ID" foreign="O_ID"/>
                 </foreign-key>
                 <foreign-key foreignTable="STATUS">
                         <reference local="ST_ID" foreign="ST_ID"/>
                 </foreign-key>

then BaseAgentPeer had the correct number of columns , and I could then 
retrieve the foreign key (eventually - see next comment:-))

2. The docs describing the creation of TurbineUserAdapter and 
TurbineUserPeerAdapter are not precise enough for when you want to set up 
something other than a straightforward column (or perhaps my reading is not 
deep enough - who knows). I had made a few errors here which I had to 
rectify before I could get it completely working.

2.1 Foreign Keys are not string values they are NumberKey values so when 
defining setter/getter must match accordingly.
2.2 I had a string constant referring to STATUS rather than the actual 
column name of ST_ID - perhaps my not quite understanding that there is a 
strict 1:1 with the table column names, and that getter and setter methods 
must follow the naming convention i.e for ST_ID it is getStId
2.3 had to reflect the changed method names introduced in 
TurbineUserAdaptor in TurbineUserPeerAdaptor.
2.4 Also had TurbineMapBuilderAdapter defined as a private in 
TurbineUserPeerAdapter - had to change to public.

3. TurbineMapBuilderAdapter
3.1 Changed method names to reflect thos in TurbineUserAdapter
3.2 Realised that the object being created had to represent the type of the 
columns they were going to be used with ie for a Foreign Key needed to use 
a NumberKey object.
3.3 Realised that for foreign keys that addForeignKey method is used 
instead of addColumn method for adding the foreign key columns to the map.

It may well be that this is all obvious if I'd looked properly - but I 
couldn't see it easily. At least I'll be able to get an early night tonight 
:-))

Malcolm

At 09:30 18/11/02 -0700, you wrote:

>Hi Malcolm.
>
>Gosh, you are really doing a lot of extending, and the problem could be just
>about anywhere.  I would suggest setting up some junit test cases and adding
>the extensions one-by-one, that is, adding a new extension only after the
>previous extension passes the test.  When you get to specific problem that
>you can't figure out, we will be much more likely to lead you in the right
>direction.
>
>Also, it is a good practice to write Services to wrap your OM layer instead
>of repeatedly using the Peers.  In this case, Turbine already provides a
>service, the TurbineSecurity Service:
>
>TurbineUserAdapter user =
>(TurbineUserAdapter)TurbineSecurity.get("username");
>assertEquals("Name","name",user.getFirstName());
>assertEquals("EoId","1",user.getEoId());
>
>Good luck,
>
>Chris
>
> > -----Original Message-----
> > From: malcolm cooke [mailto:malcolm.cooke@firstlightassociates.co.uk]
> > Sent: Monday, November 18, 2002 5:05 AM
> > To: Turbine Users List
> > Subject: Problems extending user as per how to (and previous messages)
> >
> >
> > Hi,
> > I am Using tdk 2.1.and trying to extend turbine_user as per the
> > how to and
> > have made patches to Object.vm as described in previous threads on this
> > subject. I am a newbie as far as turbine is concerned and any
> > help would be
> > appreciated.
> >
> > I have extended turbine user as per the how to  i.e
> >       <table name="TURBINE_USER" idMethod="idbroker">
> >               <column name="USER_ID" required="true"
> > primaryKey="true" type="INTEGER"/>
> >               <column name="EO_ID" required="true" type="INTEGER"/>
> >               <column name="ST_ID" required="true" type="INTEGER"/>
> >               <column name="LOGIN_NAME" required="true" size="32"
> > type="VARCHAR"/>
> >               <column name="PASSWORD_VALUE" required="true"
> > size="32" 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="MODIFIED" type="TIMESTAMP"/>
> >               <column name="CREATED" type="TIMESTAMP"/>
> >               <column name="LAST_LOGIN" type="TIMESTAMP"/>
> >               <column name="NOTES" size="255" type="VARCHAR"/>
> >               <column name="OBJECTDATA" type="VARBINARY"/>
> >               <unique>
> >                       <unique-column name="LOGIN_NAME"/>
> >               </unique>
> >               <foreign-key foreignTable="ORGANISATION">
> >                       <reference local="EO_ID" foreign="O_ID"/>
> >               </foreign-key>
> >               <foreign-key foreignTable="STATUS">
> >                       <reference local="ST_ID" foreign="ST_ID"/>
> >               </foreign-key>
> >       </table>
> >
> > with amongst other things two foreign keys. My Agent table
> > definition is as
> > follows:
> >       <table name="AGENT" javaName="Agent" alias="TurbineUser"
> > baseClass="com.testthingy.test.om.TurbineUserAdapter"
> > basePeer="com.testthingy.test.om.TurbineUserPeerAdapter">
> >               <column name="USER_ID" primaryKey="true"
> > autoIncrement="true"
> > required="true" type="INTEGER"/>
> >       </table>
> >
> > I have created the TurbineUserAdapter with the following methods :
> >
> >   public void setEoId(NumberKey org)    {
> >          setPerm(EO_ID, org);
> >      }
> >
> >      public NumberKey getEoId()    {
> >          NumberKey tmp = null;
> >          try   {
> >              tmp = (NumberKey) getPerm(EO_ID);
> >          }
> >          catch ( Exception e )
> >          {
> >          }
> >          return tmp;
> >      }
> >
> > and TurbineUserAdapterPeer with
> >      public static final String EO_ID = mapBuilder.getUser_EoId(); in it.
> >
> > TurbineMapBuilderAdapter has the following:
> >
> >       public static String getEoId()    {
> >          return "EO_ID";
> >      }
> >
> >      public String getUser_EoId()    {
> >          return getTableUser() + '.' + getEoId();
> >      }
> >
> >
> > THE PROBLEM:
> > When I try to access the EO_ID column via the agent i.e
> >       NumberKey numkey = new NumberKey("0");
> >
> >          tester = AgentPeer.retrieveByPK(numkey);
> >          System.out.println("pk = " + tester.getUserId());
> >          System.out.println("name = " + tester.getFirstName());
> >          System.out.println("eoid = " + tester.getEoId());
> >
> > I get the User Id and the First name correctly , but it always
> > returns null
> > for getEoId(). Where am I going wrong?
> >
> > thanks
> >
> > Malcolm
> >
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02

Re: Problems extending user as per how to (and previous messages)

Posted by malcolm cooke <ma...@firstlightassociates.co.uk>.
Renuka

I am fairly new to all this so may not be able to help you much.

To make the data available I would have thought that you need to store it 
in the session as you say.

If you are not using the security service then I would think that you will 
have to create your own tool with a method similar to getAuthenticatedUser 
which will check against your user, role tables etc.

One possibility might be to modify the fluxtool and put your required 
methods in there - but to a large degree you may be better off taking 
advice from someone else in the group with a better understanding of these 
things than I have.

Good luck

Malcolm


At 10:52 21/11/02 +0530, you wrote:

>Hi Malcolm
>Even i am also facing the similar type of problem extending the user.
>In my applicatin I am not  importing the Om.Security at all . I have created
>my own tables and users for application security and created the users,
>roles and permissions also.  According to the role id 's and permissions the
>application is working perfectly.
>The main (Big) problem is when i am navigating the pages backward then the
>page is not displaying anything. because I am passing the Userid and role id
>everything to the next page . so It's forward navigation the Userid and
>Roleid are available so pages are displaying the data. If it's back ward
>then problem is Occuring.
>it's not holding the Userid value at all.
>The solution is if i will put the Userid and Roleid in the Session then it
>will work.I am not importing the Om.Security  i am not able to use
>geAuthenticatedUser(username,password) . what ever the solution i got at
>last they mentioned to use the getAuthenticatedUser().
>Is there any other way to invoke the session and put the required values
>where ever we required if the navigation is forward or backward? .
>Your help is alway appreciateble
>
>Regards
>Renuka
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02

confirm_value in turbine_user?

Posted by malcolm cooke <ma...@firstlightassociates.co.uk>.
Hi,

can anyone give me a clue what the column confirm_value in TURBINE_USER 
(tdk 2.1) is used for.

Thanks

malcolm

Re: Problems extending user as per how to (and previous messages)

Posted by Renuka <re...@bigtec.org>.
Hi Malcolm
Even i am also facing the similar type of problem extending the user.
In my applicatin I am not  importing the Om.Security at all . I have created
my own tables and users for application security and created the users,
roles and permissions also.  According to the role id 's and permissions the
application is working perfectly.
The main (Big) problem is when i am navigating the pages backward then the
page is not displaying anything. because I am passing the Userid and role id
everything to the next page . so It's forward navigation the Userid and
Roleid are available so pages are displaying the data. If it's back ward
then problem is Occuring.
it's not holding the Userid value at all.
The solution is if i will put the Userid and Roleid in the Session then it
will work.I am not importing the Om.Security  i am not able to use
geAuthenticatedUser(username,password) . what ever the solution i got at
last they mentioned to use the getAuthenticatedUser().
Is there any other way to invoke the session and put the required values
where ever we required if the navigation is forward or backward? .
Your help is alway appreciateble

Regards
Renuka


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


RE: Problems extending user as per how to (and previous messages)

Posted by malcolm cooke <ma...@firstlightassociates.co.uk>.
Ok Chris we'll do that.

Rgds

Malcolm

At 10:31 20/11/02 -0700, you wrote:

>I am glad to hear you got it working!  I encourage you to check out the
>turbine-2-site source code from cvs and add your lessons learned to the
>Extend-User Howto.  When you are finished, submit the patch to the
>'turbine-2 -> documentation' module in Scarab.
>
>CVS: http://jakarta.apache.org/site/cvsindex.html
>SCARAB: http://scarab.werken.com/scarab/issues/
>
>Thanks,
>
>Chris
>
> > -----Original Message-----
> > From: malcolm cooke [mailto:malcolm.cooke@firstlightassociates.co.uk]
> > Sent: Tuesday, November 19, 2002 6:15 AM
> > To: Turbine Users List
> > Subject: RE: Problems extending user as per how to (and previous
> > messages)
> >
> >
> > Thanks for the response Chris - it helped set me off looking at the right
> > area to get it working.
> >
> > For the benefit of others here is a result of my findings.
> >
>...snip...
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/02

RE: Problems extending user as per how to (and previous messages)

Posted by Chris K Chew <ch...@fenetics.com>.
I am glad to hear you got it working!  I encourage you to check out the
turbine-2-site source code from cvs and add your lessons learned to the
Extend-User Howto.  When you are finished, submit the patch to the
'turbine-2 -> documentation' module in Scarab.

CVS: http://jakarta.apache.org/site/cvsindex.html
SCARAB: http://scarab.werken.com/scarab/issues/

Thanks,

Chris

> -----Original Message-----
> From: malcolm cooke [mailto:malcolm.cooke@firstlightassociates.co.uk]
> Sent: Tuesday, November 19, 2002 6:15 AM
> To: Turbine Users List
> Subject: RE: Problems extending user as per how to (and previous
> messages)
>
>
> Thanks for the response Chris - it helped set me off looking at the right
> area to get it working.
>
> For the benefit of others here is a result of my findings.
>
...snip...


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