EmployeeServiceBase.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.employee;
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 EmployeeServiceBean 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 EmployeeService
* </p>
*/
public abstract class EmployeeServiceBase
implements EmployeeService
{
// ------ 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 EmployeeDao
*/
@EJB
private EmployeeDao employeeDao;
// --------------- Constructors ---------------
/**
* Default constructor method with no arguments.
*/
public EmployeeServiceBase()
{
super();
}
// ------ DAO Getters --------
/**
* Get the injected DAO EmployeeDao
* @return EmployeeDao
*/
protected EmployeeDao getEmployeeDao()
{
return this.employeeDao;
}
// -------- Business Methods --------------
/**
* <p>
* TODO: Model Documentation for addEmployee
* </p>
* @param employee
* @return int
* @throws EmployeeException
*/
public int addEmployee(Employee employee)
throws EmployeeException
{
if (employee == null)
{
throw new IllegalArgumentException(
"org.andromda.demo.ejb3.employee.EmployeeServiceBean.addEmployee(Employee employee) - 'employee' can not be null");
}
try
{
return this.handleAddEmployee(employee);
}
catch (EmployeeException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new EmployeeServiceException(
"Error performing 'EmployeeService.addEmployee(Employee employee)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #addEmployee(Employee)}
* @param employee
* @return int
* @throws Exception
*/
protected abstract int handleAddEmployee(Employee employee)
throws Exception;
/**
* <p>
* TODO: Model Documentation for getEmployee
* </p>
* @param id
* @return Employee
* @throws EmployeeException
*/
public Employee getEmployee(int id)
throws EmployeeException
{
try
{
return this.handleGetEmployee(id);
}
catch (EmployeeException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new EmployeeServiceException(
"Error performing 'EmployeeService.getEmployee(int id)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getEmployee(int)}
* @param id
* @return Employee
* @throws Exception
*/
protected abstract Employee handleGetEmployee(int id)
throws Exception;
/**
* <p>
* TODO: Model Documentation for getAllEmployees
* </p>
* @return Collection
* @throws EmployeeException
*/
public Collection getAllEmployees()
throws EmployeeException
{
try
{
return this.handleGetAllEmployees();
}
catch (EmployeeException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new EmployeeServiceException(
"Error performing 'EmployeeService.getAllEmployees()' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getAllEmployees()}
* @return Collection
* @throws Exception
*/
protected abstract Collection handleGetAllEmployees()
throws Exception;
/**
* <p>
* TODO: Model Documentation for getEmployeesByContract
* </p>
* @param contractType
* @return Collection
* @throws EmployeeException
*/
public Collection getEmployeesByContract(EmployeeContractType contractType)
throws EmployeeException
{
if (contractType == null)
{
throw new IllegalArgumentException(
"org.andromda.demo.ejb3.employee.EmployeeServiceBean.getEmployeesByContract(EmployeeContractType contractType) - 'contractType' can not be null");
}
try
{
return this.handleGetEmployeesByContract(contractType);
}
catch (EmployeeException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new EmployeeServiceException(
"Error performing 'EmployeeService.getEmployeesByContract(EmployeeContractType contractType)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getEmployeesByContract(EmployeeContractType)}
* @param contractType
* @return Collection
* @throws Exception
*/
protected abstract Collection handleGetEmployeesByContract(EmployeeContractType contractType)
throws Exception;
// -------- Lifecycle Callbacks --------------
}