|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.rubis.beans.BidBean
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 bids ( id INTEGER UNSIGNED NOT NULL UNIQUE, user_id INTEGER, item_id INTEGER, qty INTEGER, bid FLOAT UNSIGNED NOT NULL, max_bid FLOAT UNSIGNED NOT NULL, date DATETIME INDEX item (item_id), INDEX user (user_id) );
Field Summary | |
float |
bid
|
java.lang.String |
date
|
java.lang.Integer |
id
|
java.lang.Integer |
itemId
|
float |
maxBid
|
int |
qty
|
java.lang.Integer |
userId
|
Constructor Summary | |
BidBean()
|
Method Summary | |
void |
ejbActivate()
This method is empty because persistence is managed by the container |
BidPK |
ejbCreate(java.lang.Integer bidUserId,
java.lang.Integer bidItemId,
float userBid,
float userMaxBid,
int quantity)
This method is used to create a new Bid 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 bidUserId,
java.lang.Integer bidItemId,
float userBid,
float userMaxBid,
int quantity)
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 |
float |
getBid()
Get the bid of the user. |
java.lang.String |
getBidderNickName()
Give the nick name of the bidder |
java.lang.String |
getDate()
Time of the Bid in the format 'YYYY-MM-DD hh:mm:ss' |
java.lang.Integer |
getId()
Get bid's id. |
java.lang.Integer |
getItemId()
Get the item id which is the primary key in the items table. |
float |
getMaxBid()
Get the maximum bid wanted by the user. |
int |
getQuantity()
Get how many of this item the user wants. |
java.lang.Integer |
getUserId()
Get the user id which is the primary key in the users table. |
boolean |
isModified()
Returns true if the beans has been modified. |
java.lang.String |
printBidHistory()
Display bid history information as an HTML table row |
void |
setBid(float newBid)
Set a new bid on the item for the user. |
void |
setDate(java.lang.String newDate)
Set a new date for this bid |
void |
setEntityContext(javax.ejb.EntityContext context)
Sets the associated entity context. |
void |
setItemId(java.lang.Integer id)
Set a new item identifier. |
void |
setMaxBid(float newBid)
Set a new maximum bid on the item for the user |
void |
setQuantity(int Qty)
Set a new quantity for this bid |
void |
setUserId(java.lang.Integer id)
Set a new user identifier. |
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 userId
public java.lang.Integer itemId
public int qty
public float bid
public float maxBid
public java.lang.String date
Constructor Detail |
public BidBean()
Method Detail |
public java.lang.Integer getId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getUserId() 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 int getQuantity() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getBid() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getMaxBid() 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 getBidderNickName() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic void setUserId(java.lang.Integer id) throws java.rmi.RemoteException
id
- user idjava.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 setQuantity(int Qty) throws java.rmi.RemoteException
Qty
- quantityjava.rmi.RemoteException
- if an error occurspublic void setBid(float newBid) throws java.rmi.RemoteException
Warning! This method does not update the maxBid value in the items table
newBid
- a float
valuejava.rmi.RemoteException
- if an error occurspublic void setMaxBid(float newBid) throws java.rmi.RemoteException
newBid
- a float
valuejava.rmi.RemoteException
- if an error occurspublic void setDate(java.lang.String newDate) throws java.rmi.RemoteException
newDate
- bid datejava.rmi.RemoteException
- if an error occurspublic BidPK ejbCreate(java.lang.Integer bidUserId, java.lang.Integer bidItemId, float userBid, float userMaxBid, int quantity) throws javax.ejb.CreateException, java.rmi.RemoteException, javax.ejb.RemoveException
bidUserId
- user id of the bidder, must match the primary key of table usersbidItemId
- item id, must match the primary key of table itemsuserBid
- the amount of the user biduserMaxBid
- the maximum amount the user wants to bidquantity
- number of items the user wants to buyjavax.ejb.CreateException
- if an error occursjava.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbPostCreate(java.lang.Integer bidUserId, java.lang.Integer bidItemId, float userBid, float userMaxBid, int quantity)
public void ejbLoad() throws java.rmi.RemoteException
ejbLoad
in interface javax.ejb.EntityBean
public void ejbStore() throws java.rmi.RemoteException
ejbStore
in interface javax.ejb.EntityBean
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 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.public boolean isModified()
boolean
valuepublic java.lang.String printBidHistory() 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 |