Elena,
your answer is explained in amedeo's email :-)
You need to extend the default jetspeeduser to provide to jetspeed
additional infos abuot your new fields...
In the case of amedeo the AGE field.

Ciao, Dariush.


-----Messaggio originale-----
Da: Elena [mailto:[EMAIL PROTECTED]]
Inviato: marted� 8 ottobre 2002 12.01
A: Jetspeed Users List
Oggetto: Re: JetSpeed --New User Account Templates


Hi,

I have already configured these.
And I could add new fields in?my NewAccount.vm and also I could add the
additional
corresponding columns to the turbine_user table .
Now, I am trying to create a user with values in all the fields (including
the newly added)
and I want to insert the value in the turbine_user table.

IT ONLY INSERTS THE ORIGINAL COLUMNS values, not the newly added columns.

How can I insert values for the additional columns too ??
Where I shouls configure for this ??

Pls help me.

Regards
Bipul

----- Original Message -----
From: "Amedeo Zottola" <[EMAIL PROTECTED]>
To: "Jetspeed Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 6:37 PM
Subject: R: JetSpeed --New User Account Templates


Hi Elena,
this is a little example :

>   a.. 1. Modify build/torque/security_schema.xml, adding the
> new columns to the Torque XML schema.

  <table name="TURBINE_USER" idMethod="idbroker">
    <column name="USER_ID" required="true" primaryKey="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="DISABLED" size="1" type="CHAR"/>
    <column name="OBJECTDATA" type="LONGVARBINARY"/>
    <column name="PASSWORD_CHANGED" type="TIMESTAMP"/>
    <!-- Added AGE field -->
    <column name="AGE" required="false" type="INTEGER"/>

    <unique>
        <unique-column name="LOGIN_NAME"/>
    </unique>

  </table>






>   d.. 4. Extend JetspeedUser to, for ex, MyUser, and cast to
> it whenever you
> need to access your new columns .
> HERE , I COULD DO steps 1, 2, and 3.
>
> In the step 4, My class implements JetspeedUser .
> Now, what next ?? I didnot understand the line
>
> "*cast to it whenever you need to access your new columns *"

>>>>>> INTERFACE <<<<<<<<
package it.noema.portal.om.security;

import org.apache.jetspeed.om.security.JetspeedUser;

/**
 * NoemaPortalUser<p>
 *
 * @author Amedeo Zottola
 * @version 1.0
 */
public interface NoemaPortalUser extends JetspeedUser {

    public static final String AGE = "AGE";

    public int getAge();

    public void setAge(int age);
}

>>>>>> IMPLEMENTATION <<<<<<<<
package it.noema.portal.om.security;

import java.math.BigDecimal;
import org.apache.jetspeed.om.security.*;

public class NoemaPortalUserImpl extends BaseJetspeedUser implements
NoemaPortalUser {

    protected int age;

    public void setAge(int age) {
        setPerm(NoemaPortalUser.AGE, new BigDecimal(age));
    }

    public int getAge() {

        BigDecimal tmp = new BigDecimal(0.0d);

        try {
            tmp = (BigDecimal) getPerm (NoemaPortalUser.AGE);
        }
        catch (Exception e) {
        }
        return (tmp != null) ? tmp.intValue() : -1;
    }
}


Now you need to change the follow key in file JetspeedSecurity.* (3
files) :
#ORIGINAL
#services.JetspeedSecurity.user.class=org.apache.jetspeed.om.security.Ba
seJetspeedUser
#change to :
services.JetspeedSecurity.user.class=it.noema.portal.om.security.NoemaPo
rtalUserImpl

>>>> EXAMPLE <<<<<
package it.noema.portal.portlets.test;

import it.noema.portal.om.security.NoemaPortalUser;
import org.apache.jetspeed.portal.portlets.AbstractPortlet;
import org.apache.ecs.*;
import org.apache.ecs.html.*;
import org.apache.turbine.util.RunData;
import org.apache.jetspeed.om.security.*;

public class ProfileDetail extends AbstractPortlet  {

    public ConcreteElement getContent(RunData rundata) {

        ConcreteElement result = null;
        int age = ((NoemaPortalUser)rundata.getUser()).getAge();
        result = new StringElement("User's Age : " + age );
        return result;
    }
}


bye bye,
Amedeo.

>
> Can anyone please tell me, what should I supposed to do and
> How can I cast to it ?? If you can show me a sample, It will be very
> helpful.
>
> Thank you and regards
> Elena
>
>
>
>
>
>
> ----- Original Message -----
> From: "Elena" <[EMAIL PROTECTED]>
> To: "Jetspeed Users List" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 08, 2002 4:27 PM
> Subject: JetSpeed --New User Account Templates
>
>
> > Hi everyone,
> >
> > /jetspeed/WEB-INF/templates/vm/screens/html/NewAccount.vm
> >
> > As far as I understand, all the fields in NewAccount.vm are
> needed to be
> > registered  in my ExtUser.java (it is my extended class for
> new columns
> > added in turbine_user table)
> > before I can use it.
> >
> > Can anybody tell me how can I register it ?
> > Will you give me a Sample example code for this.
> >
> > YOUR HELP WILL BE APPRECIATED.
> > pls accept my apology
> >
> > Regards
> > Elena
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>

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

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



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

Reply via email to