|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.rubis.beans.UserBean
UserBean is an entity bean with "bean managed persistence". The state of an instance is stored into a relational database. The following table should exist:
CREATE TABLE users ( id INTEGER UNSIGNED NOT NULL UNIQUE, firstname VARCHAR(20), lastname VARCHAR(20), nickname VARCHAR(20) NOT NULL UNIQUE, password VARCHAR(20) NOT NULL, email VARCHAR(50) NOT NULL, rating INTEGER, balance FLOAT, creation_date DATETIME, region INTEGER, PRIMARY KEY(id), INDEX auth (nickname,password), INDEX region_id (region) );
Field Summary | |
float |
balance
|
java.lang.String |
creationDate
|
java.lang.String |
email
|
protected javax.ejb.EntityContext |
entityContext
|
java.lang.String |
firstName
|
java.lang.Integer |
id
|
java.lang.String |
lastName
|
java.lang.String |
nickName
|
java.lang.String |
password
|
int |
rating
|
java.lang.Integer |
regionId
|
Constructor Summary | |
UserBean()
|
Method Summary | |
void |
ejbActivate()
Mandatory methods |
UserPK |
ejbCreate(java.lang.String userFirstName,
java.lang.String userLastName,
java.lang.String userNickName,
java.lang.String userEmail,
java.lang.String userPassword,
java.lang.Integer userRegionId)
This method is used to create a new User Bean. |
java.util.Collection |
ejbFindAllUsers()
This method is used to retrieve all users from the database! |
UserPK |
ejbFindByNickName(java.lang.String nickName)
This method is used to retrieve a User Bean from its name. |
UserPK |
ejbFindByPrimaryKey(UserPK id)
This method is used to retrieve a User Bean from its primary key, that is to say its id. |
void |
ejbLoad()
Read the reccord from the database and update the bean. |
void |
ejbPassivate()
|
void |
ejbPostCreate(java.lang.String userFirstName,
java.lang.String userLastName,
java.lang.String userNickName,
java.lang.String userEmail,
java.lang.String userPassword,
java.lang.Integer userRegionId)
This method does currently nothing |
void |
ejbRemove()
This method delete the record from the database. |
void |
ejbStore()
Update the record. |
float |
getBalance()
Get user's account current balance. |
java.sql.Connection |
getConnection()
Retrieve a connection.. |
java.lang.String |
getCreationDate()
Get user creation date. |
java.lang.String |
getEmail()
Get user email address. |
java.lang.String |
getFirstName()
Get user first name. |
java.lang.String |
getHTMLGeneralUserInformation()
Returns a string displaying general information about the user. |
java.lang.Integer |
getId()
Get user's id. |
java.lang.String |
getLastName()
Get user last name. |
java.lang.String |
getNickName()
Get user nick name. |
java.lang.String |
getPassword()
Get user password. |
int |
getRating()
Get user rating. |
java.lang.Integer |
getRegionId()
Get region identifier of user's region. |
void |
setBalance(float newBalance)
Set user's account current balance. |
void |
setCreationDate(java.lang.String newCreationDate)
Set a new creation date for this user account |
void |
setEmail(java.lang.String newEmail)
Set user's email address |
void |
setEntityContext(javax.ejb.EntityContext context)
Sets the associated entity context. |
void |
setFirstName(java.lang.String newName)
Set user's first name |
void |
setLastName(java.lang.String newName)
Set user's last name |
void |
setNickName(java.lang.String newName)
Set user's nick name |
void |
setPassword(java.lang.String newPassword)
Set user's password |
void |
setRating(int newRating)
Set user rating. |
void |
setRegionId(java.lang.Integer id)
Set a new region identifier. |
void |
unsetEntityContext()
Unsets the associated entity context. |
void |
updateRating(int diff)
Update the current rating by adding a new value to it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected javax.ejb.EntityContext entityContext
public java.lang.Integer id
public java.lang.String firstName
public java.lang.String lastName
public java.lang.String nickName
public java.lang.String password
public java.lang.String email
public int rating
public float balance
public java.lang.String creationDate
public java.lang.Integer regionId
Constructor Detail |
public UserBean()
Method Detail |
public java.lang.Integer getId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getFirstName() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getLastName() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getNickName() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getPassword() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getEmail() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic int getRating() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getBalance() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getCreationDate() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getRegionId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic void setFirstName(java.lang.String newName) throws java.rmi.RemoteException
newName
- user first namejava.rmi.RemoteException
- if an error occurspublic void setLastName(java.lang.String newName) throws java.rmi.RemoteException
newName
- user last namejava.rmi.RemoteException
- if an error occurspublic void setNickName(java.lang.String newName) throws java.rmi.RemoteException
newName
- user nick namejava.rmi.RemoteException
- if an error occurspublic void setPassword(java.lang.String newPassword) throws java.rmi.RemoteException
newPassword
- a String
valuejava.rmi.RemoteException
- if an error occurspublic void setEmail(java.lang.String newEmail) throws java.rmi.RemoteException
newEmail
- a String
valuejava.rmi.RemoteException
- if an error occurspublic void setCreationDate(java.lang.String newCreationDate) throws java.rmi.RemoteException
newCreationDate
- a String
valuejava.rmi.RemoteException
- if an error occurspublic void setRegionId(java.lang.Integer id) throws java.rmi.RemoteException
id
- region idjava.rmi.RemoteException
- if an error occurspublic void setRating(int newRating) throws java.rmi.RemoteException
newRating
- new user ratingjava.rmi.RemoteException
- if an error occurspublic void updateRating(int diff) throws java.rmi.RemoteException
diff
- value to add to the ratingjava.rmi.RemoteException
- if an error occurspublic void setBalance(float newBalance) throws java.rmi.RemoteException
newBalance
- set user's account current balancejava.rmi.RemoteException
- if an error occurspublic java.lang.String getHTMLGeneralUserInformation() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.sql.Connection getConnection() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic UserPK ejbFindByPrimaryKey(UserPK id) throws javax.ejb.FinderException, java.rmi.RemoteException
id
- User id (primary key)javax.ejb.FinderException
- if an error occursjava.rmi.RemoteException
- if an error occurspublic UserPK ejbFindByNickName(java.lang.String nickName) throws javax.ejb.FinderException, java.rmi.RemoteException
nickName
- User nicknamejavax.ejb.FinderException
- if an error occursjava.rmi.RemoteException
- if an error occurspublic java.util.Collection ejbFindAllUsers() throws java.rmi.RemoteException, javax.ejb.FinderException
java.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic UserPK ejbCreate(java.lang.String userFirstName, java.lang.String userLastName, java.lang.String userNickName, java.lang.String userEmail, java.lang.String userPassword, java.lang.Integer userRegionId) throws javax.ejb.CreateException, java.rmi.RemoteException, javax.ejb.RemoveException
userFirstName
- user's first nameuserLastName
- user's last nameuserNickName
- user's nick nameuserEmail
- email address of the useruserPassword
- user's passworduserRegionId
- region id where the user livesjavax.ejb.CreateException
- if an error occursjava.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbPostCreate(java.lang.String userFirstName, java.lang.String userLastName, java.lang.String userNickName, java.lang.String userEmail, java.lang.String userPassword, java.lang.Integer userRegionId)
public void ejbActivate() throws java.rmi.RemoteException
ejbActivate
in interface javax.ejb.EntityBean
public void ejbPassivate() throws java.rmi.RemoteException
ejbPassivate
in interface javax.ejb.EntityBean
public void ejbRemove() throws java.rmi.RemoteException, javax.ejb.RemoveException
ejbRemove
in interface javax.ejb.EntityBean
java.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbStore() throws java.rmi.RemoteException
ejbStore
in interface javax.ejb.EntityBean
java.rmi.RemoteException
- if an error occurspublic void ejbLoad() throws java.rmi.RemoteException
ejbLoad
in interface javax.ejb.EntityBean
java.rmi.RemoteException
- if an error occurspublic void setEntityContext(javax.ejb.EntityContext context) throws java.rmi.RemoteException
setEntityContext
in interface javax.ejb.EntityBean
context
- An EntityContext interface for the instance. The instance should
store the reference to the context in an instance variable.javax.ejb.EJBException
- Thrown by the method to indicate a failure
caused by a system-level error.java.rmi.RemoteException
- - This exception is defined in the method signature
to provide backward compatibility for enterprise beans
written for the EJB 1.0 specification.
Enterprise beans written for the EJB 1.1 and
higher specification should throw the javax.ejb.EJBException
instead of this exception.public void unsetEntityContext() throws java.rmi.RemoteException
unsetEntityContext
in interface javax.ejb.EntityBean
javax.ejb.EJBException
- Thrown by the method to indicate a failure
caused by a system-level error.java.rmi.RemoteException
- - This exception is defined in the method signature
to provide backward compatibility for enterprise beans
written for the EJB 1.0 specification.
Enterprise beans written for the EJB 1.1 and
higher specification should throw the javax.ejb.EJBException
instead of this exception.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |