package org.jboss.test.bankiiop.ejb;
import java.io.ObjectStreamException;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import org.jboss.test.bankiiop.interfaces.AccountData;
import org.jboss.test.bankiiop.interfaces.Customer;
public class AccountBeanCMP
extends AccountBean
{
public String id;
public float balance;
public Customer owner;
private boolean dirty;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
dirty = true;
}
public float getBalance()
{
return balance;
}
public void setBalance(float balance)
{
this.balance = balance;
dirty = true;
}
public Customer getOwner()
{
return owner;
}
public void setOwner(Customer owner)
{
this.owner = owner;
dirty = true;
}
public void setData(AccountData data)
{
setBalance(data.getBalance());
setOwner(data.getOwner());
}
public AccountData getData()
{
AccountData data = new AccountData();
data.setId(id);
data.setBalance(balance);
data.setOwner(owner);
return data;
}
public boolean isModified()
{
return dirty;
}
public String ejbCreate(AccountData data)
throws RemoteException, CreateException
{
setId(data.id);
setData(data);
dirty = false;
return null;
}
public void ejbPostCreate(AccountData data)
throws RemoteException, CreateException
{
}
public void ejbLoad()
throws RemoteException
{
super.ejbLoad();
dirty = false;
}
}