package com.alodar.example.ejb;
public class CustomerBOBean implements javax.ejb.SessionBean
{
public String echo(String value)
{
return value;
}
public String test(com.alodar.example.interfaces.CustomerData customerData)
{
return customerData.toString();
}
public com.alodar.example.interfaces.CustomerData get(int key) throws CustomerBOException
{
try
{
com.alodar.example.interfaces.CustomerLocalHome customerHome =
(com.alodar.example.interfaces.CustomerLocalHome)com.alodar.example.interfaces.CustomerUtil.getLocalHome();
com.alodar.example.interfaces.CustomerLocal customer =
customerHome.findByPrimaryKey(new com.alodar.example.interfaces.CustomerPK(new Integer(key)));
return customer.getData();
}
catch(Exception e)
{
throw new CustomerBOException(e.getMessage());
}
}
public void create(com.alodar.example.interfaces.CustomerData customerData)
throws CustomerBOException
{
try
{
com.alodar.example.interfaces.CustomerLocalHome customerHome =
(com.alodar.example.interfaces.CustomerLocalHome)com.alodar.example.interfaces.CustomerUtil.getLocalHome();
customerHome.create(customerData);
}
catch(Exception e)
{
throw new CustomerBOException(e.getMessage());
}
}
public void addItem(com.alodar.example.interfaces.ItemData itemData,
int key) throws CustomerBOException
{
try
{
com.alodar.example.interfaces.CustomerLocalHome customerHome =
(com.alodar.example.interfaces.CustomerLocalHome)com.alodar.example.interfaces.CustomerUtil.getLocalHome();
com.alodar.example.interfaces.CustomerLocal customer =
customerHome.findByPrimaryKey(new com.alodar.example.interfaces.CustomerPK(new Integer(key)));
customer.addItem(itemData);
}
catch(Exception e)
{
throw new CustomerBOException(e.getMessage());
}
}
public void setAddress(com.alodar.example.interfaces.AddressData addressData,
int key) throws CustomerBOException
{
try
{
com.alodar.example.interfaces.CustomerLocalHome customerHome =
(com.alodar.example.interfaces.CustomerLocalHome)com.alodar.example.interfaces.CustomerUtil.getLocalHome();
com.alodar.example.interfaces.CustomerLocal customer =
customerHome.findByPrimaryKey(new com.alodar.example.interfaces.CustomerPK(new Integer(key)));
customer.setAddress(addressData);
}
catch(Exception e)
{
throw new CustomerBOException(e.getMessage());
}
}
public void update(com.alodar.example.interfaces.CustomerData customerData)
throws CustomerBOException
{
try
{
com.alodar.example.interfaces.CustomerLocalHome customerHome =
(com.alodar.example.interfaces.CustomerLocalHome)com.alodar.example.interfaces.CustomerUtil.getLocalHome();
com.alodar.example.interfaces.CustomerLocal customer =
customerHome.findByPrimaryKey(new com.alodar.example.interfaces.CustomerPK(customerData.getCustomerId()));
customer.setData(customerData);
}
catch(Exception e)
{
throw new CustomerBOException(e.getMessage());
}
}
public void ejbActivate()
{
}
public void ejbPassivate()
{
}
public void ejbRemove()
{
}
public void setSessionContext(javax.ejb.SessionContext sessionContext) {}
}