edu.rice.rubis.beans
Class QueryBean

java.lang.Object
  |
  +--edu.rice.rubis.beans.QueryBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, javax.ejb.SessionBean

public class QueryBean
extends java.lang.Object
implements javax.ejb.SessionBean

MySQL version of Query Bean: QueryBean is a stateless session bean used to perform requests on the RUBiS database as described in rubis.sql.

Version:
1.1
Author:
Emmanuel Cecchet and Julie Marguerite
See Also:
Serialized Form

Field Summary
protected  javax.sql.DataSource dataSource
           
protected  javax.ejb.SessionContext sessionContext
           
 
Constructor Summary
QueryBean()
           
 
Method Summary
 void ejbActivate()
          This method is empty for a stateless session bean
 void ejbCreate()
          This method is empty for a stateless session bean
 void ejbPassivate()
          This method is empty for a stateless session bean
 void ejbRemove()
          This method is empty for a stateless session bean
 java.util.Vector getCurrentItemsInCategory(java.lang.Integer categoryId, int startingRow, int nbOfRows)
          Get all the items that match a specific category and that are still to sell (auction end date is not passed).
 java.util.Vector getCurrentItemsInCategoryAndRegion(java.lang.Integer categoryId, java.lang.Integer regionId, int startingRow, int nbOfRows)
          Get all the items that match a specific category and region and that are still to sell (auction end date is not passed).
 java.util.Vector getItemBidHistory(java.lang.Integer itemId)
          Get the bid history for an item sorted from the last bid to the first bid (oldest one).
 float getItemMaxBid(java.lang.Integer itemId)
          Get the maximum bid (winning bid) for an item.
 int getItemNbOfBids(java.lang.Integer itemId)
          Get the number of bids for an item.
 java.util.Vector getItemQtyMaxBid(int maxToCollect, java.lang.Integer itemId)
          Get the first maxToCollect bids for an item sorted from the maximum to the minimum.
 java.util.Vector getUserBids(java.lang.Integer userId)
          Get all the maximum bids for each item the user has bid on in the last 30 days.
 java.util.Vector getUserWonItems(java.lang.Integer userId)
          Get all the items the user won in the last 30 days.
 void setSessionContext(javax.ejb.SessionContext sessionContext)
          Sets the associated session context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionContext

protected javax.ejb.SessionContext sessionContext

dataSource

protected javax.sql.DataSource dataSource
Constructor Detail

QueryBean

public QueryBean()
Method Detail

getCurrentItemsInCategory

public java.util.Vector getCurrentItemsInCategory(java.lang.Integer categoryId,
                                                  int startingRow,
                                                  int nbOfRows)
                                           throws java.rmi.RemoteException
Get all the items that match a specific category and that are still to sell (auction end date is not passed). You must select the starting row and number of rows to fetch from the database to get only a limited number of items. For example, returns 25 Books.
Parameters:
categoryId - id of the category you are looking for
regionId - id of the region you are looking for
startingRow - row where result starts (0 if beginning)
nbOfRows - number of rows to get
Returns:
Vector of items primary keys
Since:
1.1

getCurrentItemsInCategoryAndRegion

public java.util.Vector getCurrentItemsInCategoryAndRegion(java.lang.Integer categoryId,
                                                           java.lang.Integer regionId,
                                                           int startingRow,
                                                           int nbOfRows)
                                                    throws java.rmi.RemoteException
Get all the items that match a specific category and region and that are still to sell (auction end date is not passed). You must select the starting row and number of rows to fetch from the database to get only a limited number of items. For example, returns 25 Books to sell in Houston.
Parameters:
categoryId - id of the category you are looking for
regionId - id of the region you are looking for
startingRow - row where result starts (0 if beginning)
nbOfRows - number of rows to get
Returns:
Vector of items primary keys
Since:
1.1

getItemMaxBid

public float getItemMaxBid(java.lang.Integer itemId)
                    throws java.rmi.RemoteException
Get the maximum bid (winning bid) for an item.
Parameters:
itemId - item id
Returns:
maximum bid or 0 if no bid
Throws:
java.rmi.RemoteException - if an error occurs
Since:
1.0

getItemQtyMaxBid

public java.util.Vector getItemQtyMaxBid(int maxToCollect,
                                         java.lang.Integer itemId)
                                  throws java.rmi.RemoteException
Get the first maxToCollect bids for an item sorted from the maximum to the minimum.
Parameters:
maxToCollect - number of bids to collect
itemId - item id
Returns:
Vector of bids primary keys (can be less than maxToCollect)
Throws:
java.rmi.RemoteException - if an error occurs
Since:
1.0

getItemNbOfBids

public int getItemNbOfBids(java.lang.Integer itemId)
                    throws java.rmi.RemoteException
Get the number of bids for an item.
Parameters:
itemId - item id
Returns:
number of bids or 0 if no bid
Throws:
java.rmi.RemoteException - if an error occurs
Since:
1.0

getItemBidHistory

public java.util.Vector getItemBidHistory(java.lang.Integer itemId)
                                   throws java.rmi.RemoteException
Get the bid history for an item sorted from the last bid to the first bid (oldest one).
Parameters:
itemId - item id
Returns:
Vector of bids primary keys or null if no bids
Throws:
java.rmi.RemoteException - if an error occurs
Since:
1.0

getUserWonItems

public java.util.Vector getUserWonItems(java.lang.Integer userId)
                                 throws java.rmi.RemoteException
Get all the items the user won in the last 30 days.
Parameters:
userId - user id
Returns:
Vector of items primary keys (can be less than maxToCollect)
Throws:
java.rmi.RemoteException - if an error occurs
Since:
1.0

getUserBids

public java.util.Vector getUserBids(java.lang.Integer userId)
                             throws java.rmi.RemoteException
Get all the maximum bids for each item the user has bid on in the last 30 days.
Parameters:
userId - user id
Returns:
Vector of bids primary keys (can be less than maxToCollect)
Throws:
java.rmi.RemoteException - if an error occurs

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException,
                      java.rmi.RemoteException
This method is empty for a stateless session bean

ejbActivate

public void ejbActivate()
                 throws java.rmi.RemoteException
This method is empty for a stateless session bean
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
                  throws java.rmi.RemoteException
This method is empty for a stateless session bean
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

ejbRemove

public void ejbRemove()
               throws java.rmi.RemoteException
This method is empty for a stateless session bean
Specified by:
ejbRemove in interface javax.ejb.SessionBean

setSessionContext

public void setSessionContext(javax.ejb.SessionContext sessionContext)
                       throws java.rmi.RemoteException
Sets the associated session context. The container calls this method after the instance creation. This method is called with no transaction context. We also retrieve the Home interfaces of all RUBiS's beans.
Specified by:
setSessionContext in interface javax.ejb.SessionBean
Parameters:
sessionContext - - A SessionContext interface for the instance.
Throws:
java.rmi.RemoteException - - Thrown if the instance could not perform the function requested by the container because of a system-level error.


Copyright © 2003 - ObjectWeb Consortium - All Rights Reserved.