FileDocCategorySizeDatePackage
CashierBean.javaAPI DocExample2633Sun Mar 02 09:43:00 GMT 2003com.mediamania.appserver

CashierBean

public class CashierBean extends Object implements javax.ejb.SessionBean

Fields Summary
private javax.ejb.SessionContext
context
private PersistenceManagerFactory
pmf
private PersistenceManager
pm
private String
pmfName
Constructors Summary
Methods Summary
public voidcheckout(java.lang.String lastName, java.lang.String firstName, java.util.Collection rentals, java.util.Collection purchases)

        PersistenceManager pm = pmf.getPersistenceManager();
        Customer customer = StoreQueries.getCustomer(pm, firstName, lastName);
        Iterator it = rentals.iterator();
        while (it.hasNext()) {
            RentalValueObject rvo = (RentalValueObject)it.next();
            RentalItem ri = StoreQueries.getRentalItem
                (pm, rvo.serialNumber);
            Rental rental = new Rental(customer, new Date(), ri);
            customer.addTransaction(rental);
            customer.addRental(rental);
        }
        it = purchases.iterator();
        while (it.hasNext()) {
            PurchaseValueObject pvo = (PurchaseValueObject)it.next();
            MediaItem mediaItem = StoreQueries.getMediaItem(
                pm, pvo.title, pvo.format);
            Purchase purchase = new Purchase(customer, new Date(), mediaItem);
            customer.addTransaction(purchase);
        }
        pm.close();
    
public voidejbActivate()

    
public voidejbCreate()

    
public voidejbPassivate()

    
public voidejbRemove()

    
public voidsetSessionContext(javax.ejb.SessionContext aContext)

see
javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)


           
        
        context = aContext;
        try {
            Context ic = new InitialContext();
            pmf = (PersistenceManagerFactory)ic.lookup(pmfName);
        } catch (NamingException ex) {
            throw new EJBException("setSessionContext", ex);
        }