BicycleServiceBase.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by SessionBeanBase.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:04.
//
package org.andromda.demo.ejb3.bicycle;
import java.util.Collection;
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.ejb.SessionContext;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* Autogenerated EJB3 session bean base class BicycleServiceBean which contains
* method level annotations for the session bean. All method level annotations
* are inherited by the extending session bean class.
* <p>
* TODO: Model Documentation for BicycleService
* </p>
*/
public abstract class BicycleServiceBase
implements BicycleService
{
// ------ Session Context Injection ------
/**
* SessionContext Injection
*/
@Resource
protected SessionContext context;
// ------ Persistence Context Definitions --------
/**
* Inject persistence context demo-ejb3
*/
@PersistenceContext(unitName = "demo-ejb3")
protected EntityManager emanager;
// ------ DAO Injection Definitions --------
/**
* Inject DAO BicycleDao
*/
@EJB
private BicycleDao bicycleDao;
// --------------- Constructors ---------------
/**
* Default constructor method with no arguments.
*/
public BicycleServiceBase()
{
super();
}
// ------ DAO Getters --------
/**
* Get the injected DAO BicycleDao
* @return BicycleDao
*/
protected BicycleDao getBicycleDao()
{
return this.bicycleDao;
}
// -------- Business Methods --------------
/**
* <p>
* TODO: Model Documentation for addBicycle
* </p>
* @param bicycle
* @throws BicycleException
*/
public void addBicycle(Bicycle bicycle)
throws BicycleException
{
if (bicycle == null)
{
throw new IllegalArgumentException(
"org.andromda.demo.ejb3.bicycle.BicycleServiceBean.addBicycle(Bicycle bicycle) - 'bicycle' can not be null");
}
try
{
this.handleAddBicycle(bicycle);
}
catch (BicycleException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new BicycleServiceException(
"Error performing 'BicycleService.addBicycle(Bicycle bicycle)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #addBicycle(Bicycle)}
* @param bicycle
* @throws Exception
*/
protected abstract void handleAddBicycle(Bicycle bicycle)
throws Exception;
/**
* <p>
* TODO: Model Documentation for getBicycle
* </p>
* @param id
* @return Bicycle
* @throws BicycleException
*/
public Bicycle getBicycle(long id)
throws BicycleException
{
try
{
return this.handleGetBicycle(id);
}
catch (BicycleException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new BicycleServiceException(
"Error performing 'BicycleService.getBicycle(long id)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getBicycle(long)}
* @param id
* @return Bicycle
* @throws Exception
*/
protected abstract Bicycle handleGetBicycle(long id)
throws Exception;
/**
* <p>
* TODO: Model Documentation for getAllBicycles
* </p>
* @return Collection
* @throws BicycleException
*/
public Collection getAllBicycles()
throws BicycleException
{
try
{
return this.handleGetAllBicycles();
}
catch (BicycleException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new BicycleServiceException(
"Error performing 'BicycleService.getAllBicycles()' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getAllBicycles()}
* @return Collection
* @throws Exception
*/
protected abstract Collection handleGetAllBicycles()
throws Exception;
// -------- Lifecycle Callbacks --------------
}