|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.rubis.beans.OldItemBean
OldItemBean is an entity bean with "bean managed persistence". The state of an instance is stored into a relational database. Items are considered old when the end auction date is over. A daemon moves at specific times items from the items table to the old_items table. The following table should exist:
CREATE TABLE old_items ( id INTEGER UNSIGNED NOT NULL UNIQUE, name VARCHAR(100), description TEXT, initial_price FLOAT UNSIGNED NOT NULL, quantity INTEGER UNSIGNED NOT NULL, reserve_price FLOAT UNSIGNED DEFAULT 0, buy_now FLOAT UNSIGNED DEFAULT 0, nb_of_bids INTEGER UNSIGNED DEFAULT 0, max_bid FLOAT UNSIGNED DEFAULT 0, start_date DATETIME, end_date DATETIME, seller INTEGER, category INTEGER, PRIMARY KEY(id), INDEX seller_id (seller), INDEX category_id (category) );
Field Summary | |
float |
buyNow
|
java.lang.Integer |
categoryId
|
java.lang.String |
description
|
java.lang.String |
endDate
|
java.lang.Integer |
id
|
float |
initialPrice
|
float |
maxBid
|
java.lang.String |
name
|
int |
nbOfBids
|
int |
quantity
|
float |
reservePrice
|
java.lang.Integer |
sellerId
|
java.lang.String |
startDate
|
Constructor Summary | |
OldItemBean()
|
Method Summary | |
void |
addOneBid()
Add one bid for this item |
void |
ejbActivate()
Mandatory methods |
OldItemPK |
ejbCreate(java.lang.Integer itemId,
java.lang.String itemName,
java.lang.String itemDescription,
float itemInitialPrice,
int itemQuantity,
float itemReservePrice,
float itemBuyNow,
int duration,
java.lang.Integer itemSellerId,
java.lang.Integer itemCategoryId)
This method is used to create a new OldItem Bean. |
java.util.Collection |
ejbFindAllOldItems()
This method is used to retrieve all old items from the database! |
java.util.Collection |
ejbFindByCategory(java.lang.Integer id)
This method is used to retrieve all OldItem Beans belonging to a specific category. |
OldItemPK |
ejbFindByPrimaryKey(OldItemPK id)
This method is used to retrieve an OldItem Bean from its primary key, that is to say its id. |
java.util.Collection |
ejbFindBySeller(java.lang.Integer id)
This method is used to retrieve all OldItem Beans belonging to a seller. |
java.util.Collection |
ejbFindCurrentByCategory(java.lang.Integer id)
This method is used to retrieve OldItem Beans belonging to a specific category that are still to sell (auction end date is not passed). |
java.util.Collection |
ejbFindUserCurrentSellings(java.lang.Integer userId)
Get all the old items the user is currently selling. |
java.util.Collection |
ejbFindUserPastSellings(java.lang.Integer userId)
Get all the items the user sold in the last 30 days. |
void |
ejbLoad()
Read the reccord from the database and update the bean. |
void |
ejbPassivate()
|
void |
ejbPostCreate(java.lang.Integer itemId,
java.lang.String itemName,
java.lang.String itemDescription,
float itemInitialPrice,
int itemQuantity,
float itemReservePrice,
float itemBuyNow,
int duration,
java.lang.Integer itemSellerId,
java.lang.Integer itemCategoryId)
This method does currently nothing |
void |
ejbRemove()
This method delete the record from the database. |
void |
ejbStore()
Update the record. |
float |
getBuyNow()
Get item Buy Now price set by the seller. |
java.lang.Integer |
getCategoryId()
Give the category id of the item |
java.lang.String |
getCategoryName()
Get the category name by finding the Bean corresponding to the category Id. |
java.sql.Connection |
getConnection()
Retrieve a connection.. |
java.lang.String |
getDescription()
Get item description . |
java.lang.String |
getEndDate()
End date of the auction in the format 'YYYY-MM-DD hh:mm:ss' |
java.lang.Integer |
getId()
Get item id. |
float |
getInitialPrice()
Get item initial price set by the seller. |
float |
getMaxBid()
Get item maximum bid (if any) for this item. |
java.lang.String |
getName()
Get item name. |
int |
getNbOfBids()
Get number of bids for this item. |
int |
getQuantity()
Get how many of this item are to be sold. |
float |
getReservePrice()
Get item reserve price set by the seller. |
java.lang.Integer |
getSellerId()
Give the user id of the seller |
java.lang.String |
getSellerNickname()
Get the seller's nickname by finding the Bean corresponding to the user. |
java.lang.String |
getStartDate()
Start date of the auction in the format 'YYYY-MM-DD hh:mm:ss' |
void |
setBuyNow(float newBuyNow)
Set a new Buy Now price for the item |
void |
setCategoryId(java.lang.Integer id)
Set a new category identifier. |
void |
setDescription(java.lang.String newDescription)
Set a new item description |
void |
setEndDate(java.lang.String newDate)
Set a new ending date for the auction |
void |
setEntityContext(javax.ejb.EntityContext context)
Sets the associated entity context. |
void |
setId(java.lang.Integer newId)
Set a new item identifier |
void |
setInitialPrice(float newInitialPrice)
Set a new initial price for the item |
void |
setMaxBid(float newMaxBid)
Set item maximum bid. |
void |
setName(java.lang.String newName)
Set a new item name |
void |
setNbOfBids(int newNbOfBids)
Set the number of bids for this item |
void |
setQuantity(int qty)
Set a new item quantity |
void |
setReservePrice(float newReservePrice)
Set a new reserve price for the item |
void |
setSellerId(java.lang.Integer id)
Set a new seller identifier. |
void |
setStartDate(java.lang.String newDate)
Set a new beginning date for the auction |
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.String name
public java.lang.String description
public float initialPrice
public int quantity
public float reservePrice
public float buyNow
public int nbOfBids
public float maxBid
public java.lang.String startDate
public java.lang.String endDate
public java.lang.Integer sellerId
public java.lang.Integer categoryId
Constructor Detail |
public OldItemBean()
Method Detail |
public java.lang.Integer getId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getName() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getDescription() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getInitialPrice() 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 getReservePrice() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getBuyNow() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic float getMaxBid() throws java.rmi.RemoteException
SELECT MAX(bid) FROM bids WHERE item_id=?
java.rmi.RemoteException
- if an error occurspublic int getNbOfBids() throws java.rmi.RemoteException
SELECT COUNT(*) FROM bids WHERE item_id=?
java.rmi.RemoteException
- if an error occurspublic java.lang.String getStartDate() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getEndDate() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getSellerId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getCategoryId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getSellerNickname() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getCategoryName() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic void setId(java.lang.Integer newId) throws java.rmi.RemoteException
newId
- item identifierjava.rmi.RemoteException
- if an error occurspublic void setName(java.lang.String newName) throws java.rmi.RemoteException
newName
- item namejava.rmi.RemoteException
- if an error occurspublic void setDescription(java.lang.String newDescription) throws java.rmi.RemoteException
newDescription
- item descriptionjava.rmi.RemoteException
- if an error occurspublic void setInitialPrice(float newInitialPrice) throws java.rmi.RemoteException
newInitialPrice
- item initial pricejava.rmi.RemoteException
- if an error occurspublic void setQuantity(int qty) throws java.rmi.RemoteException
qty
- item quantityjava.rmi.RemoteException
- if an error occurspublic void setReservePrice(float newReservePrice) throws java.rmi.RemoteException
newReservePrice
- item reserve pricejava.rmi.RemoteException
- if an error occurspublic void setBuyNow(float newBuyNow) throws java.rmi.RemoteException
newBuyNow
- item Buy Now pricejava.rmi.RemoteException
- if an error occurspublic void setMaxBid(float newMaxBid) throws java.rmi.RemoteException
newMaxBid
- new maximum bidjava.rmi.RemoteException
- if an error occurspublic void setNbOfBids(int newNbOfBids) throws java.rmi.RemoteException
newNbOfBids
- new number of bidsjava.rmi.RemoteException
- if an error occurspublic void addOneBid() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic void setStartDate(java.lang.String newDate) throws java.rmi.RemoteException
newDate
- auction new beginning datejava.rmi.RemoteException
- if an error occurspublic void setEndDate(java.lang.String newDate) throws java.rmi.RemoteException
newDate
- auction new ending datejava.rmi.RemoteException
- if an error occurspublic void setSellerId(java.lang.Integer id) throws java.rmi.RemoteException
id
- seller idjava.rmi.RemoteException
- if an error occurspublic void setCategoryId(java.lang.Integer id) throws java.rmi.RemoteException
id
- category idjava.rmi.RemoteException
- if an error occurspublic java.sql.Connection getConnection() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic OldItemPK ejbFindByPrimaryKey(OldItemPK id) throws javax.ejb.FinderException, java.rmi.RemoteException
id
- OldItem id (primary key)javax.ejb.FinderException
- if an error occursjava.rmi.RemoteException
- if an error occurspublic java.util.Collection ejbFindBySeller(java.lang.Integer id) throws java.rmi.RemoteException, javax.ejb.FinderException
id
- User id of the sellerjava.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic java.util.Collection ejbFindByCategory(java.lang.Integer id) throws java.rmi.RemoteException, javax.ejb.FinderException
id
- Category idjava.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic java.util.Collection ejbFindCurrentByCategory(java.lang.Integer id) throws java.rmi.RemoteException, javax.ejb.FinderException
id
- Category idjava.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic java.util.Collection ejbFindUserCurrentSellings(java.lang.Integer userId) throws java.rmi.RemoteException, javax.ejb.FinderException
userId
- user idjava.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic java.util.Collection ejbFindUserPastSellings(java.lang.Integer userId) throws java.rmi.RemoteException, javax.ejb.FinderException
userId
- user idjava.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic java.util.Collection ejbFindAllOldItems() throws java.rmi.RemoteException, javax.ejb.FinderException
java.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic OldItemPK ejbCreate(java.lang.Integer itemId, java.lang.String itemName, java.lang.String itemDescription, float itemInitialPrice, int itemQuantity, float itemReservePrice, float itemBuyNow, int duration, java.lang.Integer itemSellerId, java.lang.Integer itemCategoryId) throws javax.ejb.CreateException, java.rmi.RemoteException, javax.ejb.RemoveException
itemId
- item identifieritemName
- short item designationitemDescription
- long item description, usually an HTML fileitemInitialPrice
- initial price fixed by the selleritemQuantity
- number to sell (of this item)itemReservePrice
- reserve price (minimum price the seller really wants to sell)itemBuyNow
- price if a user wants to buy the item immediatlyduration
- duration of the auction in days (start date is when the method is called and end date is computed according to the duration)itemSellerId
- seller id, must match the primary key of table usersitemCategoryId
- category id, must match the primary key of table categoriesjavax.ejb.CreateException
- if an error occursjava.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbPostCreate(java.lang.Integer itemId, java.lang.String itemName, java.lang.String itemDescription, float itemInitialPrice, int itemQuantity, float itemReservePrice, float itemBuyNow, int duration, java.lang.Integer itemSellerId, java.lang.Integer itemCategoryId)
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 |