You must extend registration action and add your fields...
>>>>>> EXAMPLE <<<<<<<
package it.noema.portal.modules.actions;

import it.noema.portal.om.security.NoemaPortalUser;
import org.apache.jetspeed.modules.actions.CreateNewUserAndConfirm;
import org.apache.jetspeed.om.security.JetspeedUser;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.Log;

public class RegistraNuovoUtente extends CreateNewUserAndConfirm {

    //you must add here your behaviour
    protected void createUser(JetspeedUser user, RunData data) throws
Exception {

        //parameter from NewAccount.vm
       String ageParameter = data.getParameters().getString("age");
       
       int age;
       try {
            age = Integer.parseInt(ageParameter);
       }
       catch (Exception ex) {
           age = -1;
       }

       ((NoemaPortalUser)user).setAge( age );
    }
}


You must add in TurbineResource.properties this key (action's packages)
#base package for your action 
module.packages=it.noema.portal.modules

In NewAccount.vm you must invoke your action ( in this case :
RegistraNuovoUtente )

<!-- CHANGE -->
            <input name="$jslink.ActionKey" type="hidden"
value="CreateNewUserAndConfirm">
<!-- IN-->
            <input name="$jslink.ActionKey" type="hidden"
value="RegistraNuovoUtente">


that's all!!!
bye bye,
Amedeo.

> -----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.s
> ecurity.Ba
> seJetspeedUser
> #change to :
> services.JetspeedSecurity.user.class=it.noema.portal.om.securi
> ty.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