ejb.reserving
Class ReserveAndBuyBean
java.lang.Object
|
+--ejb.reserving.ReserveAndBuyBean
- All Implemented Interfaces:
- EnterpriseBean, Serializable, SessionBean
- public class ReserveAndBuyBean
- extends Object
- implements SessionBean
This is the bean class for the ReserveAndBuy stateless session bean.
For information about the ReserveAndBuy component, its behavior and
exception handling, please see ReserveAndBuy.
- Version:
- 1.0
- Author:
- Team Two: Matthew Bass, Vijay Sai, Mannik Bhojwani, Paulo Merson
- See Also:
ReserveAndBuy
, Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
context
public SessionContext context
ReserveAndBuyBean
public ReserveAndBuyBean()
setSessionContext
public void setSessionContext(SessionContext context)
throws EJBException,
RemoteException
- Specified by:
setSessionContext
in interface SessionBean
- See Also:
SessionBean.setSessionContext(javax.ejb.SessionContext)
ejbRemove
public void ejbRemove()
throws EJBException,
RemoteException
- Specified by:
ejbRemove
in interface SessionBean
- See Also:
SessionBean.ejbRemove()
ejbActivate
public void ejbActivate()
throws EJBException,
RemoteException
- Specified by:
ejbActivate
in interface SessionBean
- See Also:
SessionBean.ejbActivate()
ejbPassivate
public void ejbPassivate()
throws EJBException,
RemoteException
- Specified by:
ejbPassivate
in interface SessionBean
- See Also:
SessionBean.ejbPassivate()
ejbCreate
public void ejbCreate()
throws EJBException,
RemoteException
- See Also:
SessionBean.ejbPassivate()
makeReservation
public int makeReservation(FlightSelection selection,
String[] passengers,
CreditCardValue creditCard,
long transId)
throws ValidationException
- Adds a reservation to the database. The steps in the operation are:
- Get the reservation id
- Get the next passenger id
- Start the transaction
- Insert an entry into the ARS_RESERVATION table
- Insert all entries into the ARS_FLIGHTS_RESERVATION table
- Insert all entries into the ARS_PASSENGERS table
- End the transaction
- Return the reservation id
- Parameters:
selection
- - the flight selections made by the customerpassengers
- - a list of passengers taking the flight(s)creditCard
- - the booking credit card- Returns:
- int - the reservation id; 0 if a failure occurs
- Throws:
ValidationException
- - See Also:
ReserveAndBuy.makeReservation(common.FlightSelection, java.lang.String[], vo.CreditCardValue, long)
cancelReservation
public void cancelReservation(int reservationId,
long transId)
throws ValidationException
- Removes a reservation from the database. The steps in the operation are:
- Start the transaction
- Delete the entry in the ARS_RESERVATIONS table - if found
- Delete all entries in the ARS_FLIGHTS_RESERVATIONS table
- Delete all entries in the ARS_PASSENGERS table
- End the transaction
If the reservation cannot be found in the database then the cancellation
may be a repeat/recovery from a failed repsonse to a client request (in
which case it can be ignored) or it may be an erroneous request (in which
case an exception needs to be generated) - this is determined by examining
the last transaction id in the ARS_USERS table.
All (non ARS_USERS) table entries are determined by the reservationId.
- Parameters:
reservationId
- - the id of the reservation to be cancelled- Throws:
ValidationException
- - See Also:
ReserveAndBuy.cancelReservation(int, long)
buyTickets
public void buyTickets(int reservationId,
CreditCardValue creditCard,
long transId)
throws ValidationException
- See Also:
ReserveAndBuy.buyTickets(int, vo.CreditCardValue, long)
readReservation
public ReservationValue readReservation(int reservationId)
- See Also:
ReserveAndBuy.readReservation(int)
Copyright © 2003 Team Two.