|
||||||||
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 just set an internal flag to reload the id generated by the DB |
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()
public java.lang.Integer getFromUserId()
public java.lang.Integer getToUserId()
public java.lang.Integer getItemId()
public float getRating()
public java.lang.String getDate()
public java.lang.String getComment()
public void setFromUserId(java.lang.Integer id)
id
- author user idpublic void setToUserId(java.lang.Integer id)
id
- user id comment is aboutpublic void setItemId(java.lang.Integer id)
id
- item idpublic void setRating(int Rating)
Rating
- an int
valuepublic void setDate(java.lang.String newDate)
newDate
- comment datepublic void setComment(java.lang.String newComment)
newComment
- Commentpublic CommentPK ejbCreate(java.lang.Integer FromUserId, java.lang.Integer ToUserId, java.lang.Integer ItemId, int Rating, java.lang.String Comment) throws javax.ejb.CreateException
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 occurspublic void ejbPostCreate(java.lang.Integer FromUserId, java.lang.Integer ToUserId, java.lang.Integer ItemId, int Rating, java.lang.String Comment)
public void ejbLoad()
ejbLoad
in interface javax.ejb.EntityBean
public void ejbStore()
ejbStore
in interface javax.ejb.EntityBean
public void ejbActivate()
ejbActivate
in interface javax.ejb.EntityBean
public void ejbPassivate()
ejbPassivate
in interface javax.ejb.EntityBean
public void ejbRemove()
ejbRemove
in interface javax.ejb.EntityBean
public void setEntityContext(javax.ejb.EntityContext context)
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.public void unsetEntityContext()
unsetEntityContext
in interface javax.ejb.EntityBean
javax.ejb.EJBException
- Thrown by the method to indicate a failure
caused by a system-level error.public boolean isModified()
boolean
valuepublic java.lang.String printComment(java.lang.String userName)
String
containing HTML code
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |