|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.rubis.beans.CommentBean
BidBean is an entity bean with "container managed persistence". The state of an instance is stored into a relational database. The following table should exist:
CREATE TABLE comments ( id INTEGER UNSIGNED NOT NULL UNIQUE, from_user_id INTEGER, to_user_id INTEGER, item_id INTEGER, rating INTEGER, date DATETIME, comment TEXT PRIMARY KEY(id), INDEX from_user (from_user_id), INDEX to_user (to_user_id), INDEX item (item_id) );
Field Summary | |
java.lang.String |
comment
|
java.lang.String |
date
|
java.lang.Integer |
fromUserId
|
java.lang.Integer |
id
|
java.lang.Integer |
itemId
|
int |
rating
|
java.lang.Integer |
toUserId
|
Constructor Summary | |
CommentBean()
|
Method Summary | |
void |
ejbActivate()
This method is empty because persistence is managed by the container |
CommentPK |
ejbCreate(java.lang.Integer FromUserId,
java.lang.Integer ToUserId,
java.lang.Integer ItemId,
int Rating,
java.lang.String Comment)
This method is used to create a new Comment Bean. |
void |
ejbLoad()
Persistence is managed by the container and the bean becomes up to date |
void |
ejbPassivate()
This method is empty because persistence is managed by the container |
void |
ejbPostCreate(java.lang.Integer FromUserId,
java.lang.Integer ToUserId,
java.lang.Integer ItemId,
int Rating,
java.lang.String Comment)
This method does currently nothing |
void |
ejbRemove()
This method is empty because persistence is managed by the container |
void |
ejbStore()
Persistence is managed by the container and the bean becomes up to date |
java.lang.String |
getComment()
Get the comment text. |
java.lang.String |
getDate()
Time of the Comment in the format 'YYYY-MM-DD hh:mm:ss' |
java.lang.Integer |
getFromUserId()
Get the user id of the author of the comment |
java.lang.Integer |
getId()
Get comment's id. |
java.lang.Integer |
getItemId()
Get the item id which is the primary key in the items table. |
float |
getRating()
Get the rating associated to this comment. |
java.lang.Integer |
getToUserId()
Get the user id of the user this comment is about. |
boolean |
isModified()
Returns true if the beans has been modified. |
java.lang.String |
printComment(java.lang.String userName)
Display comment information as an HTML table row |
void |
setComment(java.lang.String newComment)
Set a new comment for ToUserId from FromUserId. |
void |
setDate(java.lang.String newDate)
Set a new date for this comment |
void |
setEntityContext(javax.ejb.EntityContext context)
Sets the associated entity context. |
void |
setFromUserId(java.lang.Integer id)
Set a new user identifier for the author of the comment. |
void |
setItemId(java.lang.Integer id)
Set a new item identifier. |
void |
setRating(int Rating)
Set a new rating for the ToUserId. |
void |
setToUserId(java.lang.Integer id)
Set a new user identifier for the user this comment is about. |
void |
unsetEntityContext()
Unsets the associated entity context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.lang.Integer id
public java.lang.Integer fromUserId
public java.lang.Integer toUserId
public java.lang.Integer itemId
public int rating
public java.lang.String date
public java.lang.String comment
Constructor Detail |
public CommentBean()
Method Detail |
public java.lang.Integer getId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getFromUserId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getToUserId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getItemId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getRating() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getDate() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getComment() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic void setFromUserId(java.lang.Integer id) throws java.rmi.RemoteException
id
- author user idjava.rmi.RemoteException
- if an error occurspublic void setToUserId(java.lang.Integer id) throws java.rmi.RemoteException
id
- user id comment is aboutjava.rmi.RemoteException
- if an error occurspublic void setItemId(java.lang.Integer id) throws java.rmi.RemoteException
id
- item idjava.rmi.RemoteException
- if an error occurspublic void setRating(int Rating) throws java.rmi.RemoteException
Rating
- an int
valuejava.rmi.RemoteException
- if an error occurspublic void setDate(java.lang.String newDate) throws java.rmi.RemoteException
newDate
- comment datejava.rmi.RemoteException
- if an error occurspublic void setComment(java.lang.String newComment) throws java.rmi.RemoteException
newComment
- Commentjava.rmi.RemoteException
- if an error occurspublic CommentPK ejbCreate(java.lang.Integer FromUserId, java.lang.Integer ToUserId, java.lang.Integer ItemId, int Rating, java.lang.String Comment) throws javax.ejb.CreateException, java.rmi.RemoteException, javax.ejb.RemoveException
FromUserId
- user id of the comment author, must match the primary key of table usersToUserId
- user id of the user this comment is about, must match the primary key of table usersItemId
- item id, must match the primary key of table itemsRating
- user (ToUserId) rating given by the author (FromUserId)Comment
- comment textjavax.ejb.CreateException
- if an error occursjava.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbPostCreate(java.lang.Integer FromUserId, java.lang.Integer ToUserId, java.lang.Integer ItemId, int Rating, java.lang.String Comment)
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
public void ejbStore() throws java.rmi.RemoteException
ejbStore
in interface javax.ejb.EntityBean
public void ejbLoad() throws java.rmi.RemoteException
ejbLoad
in interface javax.ejb.EntityBean
public 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 boolean isModified()
boolean
valuepublic 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.public java.lang.String printComment(java.lang.String userName) throws java.rmi.RemoteException
String
containing HTML codejava.rmi.RemoteException
- if an error occurs
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |