hero.session
Class UserRegistrationBean

java.lang.Object
  extended byhero.session.UserRegistrationBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class UserRegistrationBean
extends java.lang.Object
implements javax.ejb.SessionBean

The User Registration Bean, is an stateless session bean that provides the API to create users in Bonita database (new user account). This API allows some functionalities oriented to user configuration: set authorization roles, set Bonita roles, set preferences...

The following lines shows a sample code to use this API in your application:


First of all you have to import the User Registration files:

import hero.interfaces.UserRegistrationLocalHome;
import hero.interfaces.UserRegistrationLocal;
import hero.interfaces.UserRegistrationHome;
import hero.interfaces.UserRegistration;
import hero.interfaces.UserRegistrationUtil;

Now, it is time to create the User Registration instance:

Like this if you want to use local interfaces:

hero.interfaces.UserRegistrationLocalHome userh = (UserRegistrationLocalHome)hero.interfaces.UserRegistrationUtil.getLocalHome();
hero.interfaces.UserRegistrationLocal user = userh.create();

or like this if you use remote interfaces:

hero.interfaces.UserRegistrationHome userh = (UserRegistrationHome)hero.interfaces.UserRegistrationUtil.getHome();
hero.interfaces.UserRegistration user = userh.create();

Now, we can create a new user account by using userCreate methods (with or without the instant messaging address).

user.userCreate(name,password,email);
or user.userCreate(name,password,email,jabber);

Author:
Miguel Valdes
See Also:
Serialized Form

Constructor Summary
UserRegistrationBean()
           
 
Method Summary
 void assertUserSecurityRoleExists()
          Create the role BONITAUSER if it doesn't exist
 void deleteUser(java.lang.String userName)
          Detete a user from Bonita database.
 void ejbActivate()
          Internal Enterprise Java Beans method.
 void ejbCreate()
          Create the User Session Bean.
 void ejbPassivate()
          Internal Enterprise Java Beans method.
 void ejbRemove()
          Internal Enterprise Java Beans method.
 void roleCreate(java.lang.String name, java.lang.String roleGroup)
          Creates a new authorization role to the system.
 void setSessionContext(javax.ejb.SessionContext context)
          Internal Enterprise Java Beans method.
 void setUserProperty(java.lang.String userName, java.lang.String key, java.lang.String value)
          Set a new property to the user.
 void setUserRole(java.lang.String userName, java.lang.String roleName)
          Set a new authorization role to the user.
 void unsetSessionContext()
          Internal Enterprise Java Beans method.
 BnUserLocal userCreate(java.lang.String name)
          Creates user account.
 void userCreate(java.lang.String name, java.lang.String password, java.lang.String email)
          Creates user account.
 void userCreate(java.lang.String name, java.lang.String password, java.lang.String email, java.lang.String jabber)
          Creates user account with an instant messaging address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserRegistrationBean

public UserRegistrationBean()
Method Detail

assertUserSecurityRoleExists

public void assertUserSecurityRoleExists()
                                  throws hero.util.HeroException
Create the role BONITAUSER if it doesn't exist

Throws:
HeroException, - (catch : FinderException)
hero.util.HeroException

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Create the User Session Bean. This method is the first one to invoke in order to creates a new user account.

Throws:
javax.ejb.CreateException

userCreate

public BnUserLocal userCreate(java.lang.String name)
                       throws hero.util.HeroException
Creates user account. You have to call this method after "create" call (this API is an stateles session bean). This method is oriented to Bonita external users configuration

Parameters:
name - name of the new user
Throws:
hero.util.HeroException

userCreate

public void userCreate(java.lang.String name,
                       java.lang.String password,
                       java.lang.String email)
                throws hero.util.HeroException
Creates user account. You have to call this method after "create" call (this API is an stateles session bean).

Parameters:
name - name of the new user
password - password of the new user
email - email of the new user
Throws:
hero.util.HeroException

userCreate

public void userCreate(java.lang.String name,
                       java.lang.String password,
                       java.lang.String email,
                       java.lang.String jabber)
                throws hero.util.HeroException
Creates user account with an instant messaging address. You have to call this method after "create" call (this API is an stateles session bean).

Parameters:
name - name of the new user
password - password of the new user
email - email of the new user
jabber - jabber address of the new user
Throws:
hero.util.HeroException

deleteUser

public void deleteUser(java.lang.String userName)
                throws hero.util.HeroException
Detete a user from Bonita database. If the user is included in active projects this methods throws an exception.

Parameters:
userName - the name of the user
Throws:
hero.util.HeroException

roleCreate

public void roleCreate(java.lang.String name,
                       java.lang.String roleGroup)
                throws hero.util.HeroException
Creates a new authorization role to the system. This kind of role is used to control the user access to different APIs. You have to call this method after "create" call (this API is an stateles session bean).

Parameters:
name - name of the new role
roleGroup - the name of the group
Throws:
hero.util.HeroException

setUserRole

public void setUserRole(java.lang.String userName,
                        java.lang.String roleName)
                 throws hero.util.HeroException
Set a new authorization role to the user. You have to call this method after "create" call (this API is an stateles session bean).

Throws:
hero.util.HeroException

setUserProperty

public void setUserProperty(java.lang.String userName,
                            java.lang.String key,
                            java.lang.String value)
                     throws hero.util.HeroException
Set a new property to the user. User properties will be used to define user preferences. You have to call this method after "create" call (this API is an stateles session bean).

Parameters:
userName - the name of the user
key - the key of user property
value - the value of user property
Throws:
hero.util.HeroException

setSessionContext

public void setSessionContext(javax.ejb.SessionContext context)
                       throws java.rmi.RemoteException
Internal Enterprise Java Beans method.

Specified by:
setSessionContext in interface javax.ejb.SessionBean
Throws:
java.rmi.RemoteException

unsetSessionContext

public void unsetSessionContext()
                         throws java.rmi.RemoteException
Internal Enterprise Java Beans method.

Throws:
java.rmi.RemoteException

ejbRemove

public void ejbRemove()
               throws java.rmi.RemoteException
Internal Enterprise Java Beans method.

Specified by:
ejbRemove in interface javax.ejb.SessionBean
Throws:
java.rmi.RemoteException

ejbActivate

public void ejbActivate()
                 throws java.rmi.RemoteException
Internal Enterprise Java Beans method.

Specified by:
ejbActivate in interface javax.ejb.SessionBean
Throws:
java.rmi.RemoteException

ejbPassivate

public void ejbPassivate()
                  throws java.rmi.RemoteException
Internal Enterprise Java Beans method.

Specified by:
ejbPassivate in interface javax.ejb.SessionBean
Throws:
java.rmi.RemoteException