FileDocCategorySizeDatePackage
CustomerBean.javaAPI DocExample5111Mon Aug 13 10:41:58 BST 2001com.titan.customer

CustomerBean

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

Fields Summary
Constructors Summary
Methods Summary
public voidaddPhoneNumber(java.lang.String number, byte type)


        InitialContext jndiEnc = new InitialContext( );
        PhoneHomeLocal phoneHome = (PhoneHomeLocal)(jndiEnc.lookup("PhoneHomeLocal")); 

        PhoneLocal phone = phoneHome.create(number,type);
        
        Collection phoneNumbers = this.getPhoneNumbers( );
        phoneNumbers.add(phone);

	
public voidejbActivate()

public java.lang.IntegerejbCreate(java.lang.Integer id)

		this.setId(id);
		return null;
	
public voidejbLoad()

public voidejbPassivate()

public voidejbPostCreate(java.lang.Integer id)

	
public voidejbRemove()

public voidejbStore()

public AddressDOgetAddress()

		
        AddressLocal addrLocal = this.getHomeAddress();

        String street = addrLocal.getStreet();
        String city = addrLocal.getCity();
        String state = addrLocal.getState();
        String zip = addrLocal.getZip();
        AddressDO addrValue = new AddressDO(street,city,state,zip);		
        return addrValue;
    
public abstract CreditCardLocalgetCreditCard()

public abstract java.lang.StringgetFirstName()

public abstract booleangetHasGoodCredit()

public abstract AddressLocalgetHomeAddress()

public abstract java.lang.IntegergetId()

public abstract java.lang.StringgetLastName()

public NamegetName()

        Name name = new Name(getLastName(),getFirstName());
        return name;
    
public java.util.VectorgetPhoneList()


		Vector vv = new Vector();
		Collection phoneNumbers = this.getPhoneNumbers();
        Iterator iterator = phoneNumbers.iterator();
        while(iterator.hasNext()) {
			PhoneLocal phone = (PhoneLocal)iterator.next();
			String ss = "Type="+phone.getType()+"  Number="+phone.getNumber();
			vv.add(ss);
		}
		return vv;
	
public abstract java.util.CollectiongetPhoneNumbers()

public abstract java.util.CollectiongetReservations()

public voidremovePhoneNumber(byte typeToRemove)


        Collection phoneNumbers = this.getPhoneNumbers( );
        Iterator iterator = phoneNumbers.iterator();

        while(iterator.hasNext()){
           PhoneLocal phone = (PhoneLocal)iterator.next();
           if (phone.getType() == typeToRemove) {
                phoneNumbers.remove(phone);	
                break;
           }

        }
    
public voidsetAddress(AddressDO addrValue)

		

        String street = addrValue.getStreet();
        String city = addrValue.getCity();
        String state = addrValue.getState();
        String zip = addrValue.getZip();

		setAddress(street,city,state,zip);		
	
public voidsetAddress(java.lang.String street, java.lang.String city, java.lang.String state, java.lang.String zip)


		AddressLocal addr = this.getHomeAddress( );

        if (addr == null) {
			// Customer doesn't have an address yet. Create a new one.
			InitialContext cntx = new InitialContext( );
			AddressHomeLocal addrHome = 
                          (AddressHomeLocal)cntx.lookup("AddressHomeLocal");		
        	addr = addrHome.createAddress(street, city, state, zip);
			this.setHomeAddress(addr);
        } else {
           // Customer already has an address. Change its fields
           addr.setStreet(street);
           addr.setCity(city);
           addr.setState(state);
           addr.setZip(zip);
        }
    
public abstract voidsetCreditCard(CreditCardLocal card)

public voidsetEntityContext(javax.ejb.EntityContext ec)

public abstract voidsetFirstName(java.lang.String fname)

public abstract voidsetHasGoodCredit(boolean flag)

public abstract voidsetHomeAddress(AddressLocal address)

public abstract voidsetId(java.lang.Integer id)

public abstract voidsetLastName(java.lang.String lname)

public voidsetName(Name name)

        setLastName(name.getLastName());
        setFirstName(name.getFirstName());
    
public abstract voidsetPhoneNumbers(java.util.Collection phones)

public abstract voidsetReservations(java.util.Collection reservations)

public voidunsetEntityContext()

public voidupdatePhoneNumber(java.lang.String number, byte typeToUpdate)

 

        Collection phoneNumbers = this.getPhoneNumbers( );
        Iterator iterator = phoneNumbers.iterator();
        while(iterator.hasNext()){
			PhoneLocal phone = (PhoneLocal)iterator.next();
			if (phone.getType() == typeToUpdate) {
                phone.setNumber(number);
                break;
			}
        }