FileDocCategorySizeDatePackage
ReservationBean.javaAPI DocExample4226Mon Sep 30 09:31:54 BST 2002com.titan.reservation

ReservationBean

public abstract class ReservationBean extends Object implements javax.ejb.EntityBean

Fields Summary
private static final int
IDGEN_START
private static int
idgen
Constructors Summary
Methods Summary
public voidejbActivate()

public java.lang.ObjectejbCreate(com.titan.cruise.CruiseLocal cruise, java.util.Collection customers)

         
      
   
      System.out.println ("ReservationBean::ejbCreate");
      setId(new Integer(idgen++));
      return null;
   
public java.lang.IntegerejbCreate(com.titan.customer.CustomerRemote customer, com.titan.cruise.CruiseLocal cruise, com.titan.cabin.CabinLocal cabin, double price, java.util.Date dateBooked)

      System.out.println ("ReservationBean::ejbCreate");
      setId(new Integer(idgen++));
      setAmountPaid (price);
      setDate (dateBooked);
      return null;
   
public voidejbLoad()

public voidejbPassivate()

public voidejbPostCreate(com.titan.cruise.CruiseLocal cruise, java.util.Collection customers)

      System.out.println ("ReservationBean::ejbPostCreate");
      setCruise (cruise);
      Collection myCustomers = this.getCustomers ();
      myCustomers.addAll (customers);
   
public voidejbPostCreate(com.titan.customer.CustomerRemote customer, com.titan.cruise.CruiseLocal cruise, com.titan.cabin.CabinLocal cabin, double price, java.util.Date dateBooked)

      
      System.out.println ("ReservationBean::ejbPostCreate");
      setCruise (cruise);
      // Our bean has many cabins, use the cmr set method here..
      Set cabins = new HashSet ();
      cabins.add (cabin);
      this.setCabins (cabins);
      
      try
      {
         Integer primKey = (Integer)customer.getPrimaryKey ();
         javax.naming.Context jndiContext = new InitialContext ();
         CustomerHomeLocal home = (CustomerHomeLocal)
         jndiContext.lookup ("java:comp/env/ejb/CustomerHomeLocal");  // get local interface
         
         CustomerLocal custL = home.findByPrimaryKey (primKey);
         // Our bean has many customers, use the cmr set method here..
         Set customers = new HashSet ();
         customers.add (custL);
         this.setCustomers (customers);
      } 
      catch (RemoteException re)
      {
         throw new CreateException ("Invalid Customer - Bad Remote Reference");
      } 
      catch (FinderException fe)
      {
         throw new CreateException ("Invalid Customer - Unable to Find Local Reference");
      } 
      catch (NamingException ne)
      {
         throw new CreateException ("Invalid Customer - Unable to find CustomerHomeLocal Reference");
      }
   
public voidejbRemove()

public voidejbStore()

public abstract doublegetAmountPaid()

public abstract java.util.SetgetCabins()

public abstract com.titan.cruise.CruiseLocalgetCruise()

public abstract java.util.SetgetCustomers()

public abstract java.util.DategetDate()

public abstract java.lang.IntegergetId()

public abstract voidsetAmountPaid(double amount)

public abstract voidsetCabins(java.util.Set cabins)

public abstract voidsetCruise(com.titan.cruise.CruiseLocal cruise)

public abstract voidsetCustomers(java.util.Set customers)

public abstract voidsetDate(java.util.Date date)

public voidsetEntityContext(javax.ejb.EntityContext ec)

public abstract voidsetId(java.lang.Integer id)

public voidunsetEntityContext()