UserServiceBase.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by SessionBeanBase.vsl in andromda-ejb3-cartridge on 09/18/2014 12:09:10.
//
package org.andromda.timetracker.service;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.ejb.EJB;
import javax.ejb.SessionContext;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.andromda.timetracker.domain.UserDao;
import org.andromda.timetracker.vo.UserDetailsVO;
import org.andromda.timetracker.vo.UserVO;
/**
* Autogenerated EJB3 session bean base class UserServiceBean 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 UserService
* </p>
*/
public abstract class UserServiceBase
implements UserService
{
// ------ Session Context Injection ------
/**
* SessionContext Injection
*/
@Resource
protected SessionContext context;
// ------ Persistence Context Definitions --------
/**
* Inject persistence context timetracker-ejb3
*/
@PersistenceContext(unitName = "timetracker-ejb3")
protected EntityManager emanager;
// ------ DAO Injection Definitions --------
/**
* Inject DAO UserDao
*/
@EJB
private UserDao userDao;
// --------------- Constructors ---------------
/**
* Default constructor method with no arguments.
*/
public UserServiceBase()
{
super();
}
// ------ DAO Getters --------
/**
* Get the injected DAO UserDao
* @return UserDao
*/
protected UserDao getUserDao()
{
return this.userDao;
}
// -------- Business Methods --------------
/**
* <p>
* TODO: Model Documentation for getUser
* </p>
* @param username
* @return UserVO
* @throws UserDoesNotExistException
*/
@PermitAll
public UserVO getUser(String username)
throws UserDoesNotExistException
{
if (username == null)
{
throw new IllegalArgumentException(
"org.andromda.timetracker.service.UserServiceBean.getUser(String username) - 'username' can not be null");
}
try
{
return this.handleGetUser(username);
}
catch (UserDoesNotExistException ex)
{
throw ex;
}
catch (Throwable th)
{
throw new UserServiceException(
"Error performing 'UserService.getUser(String username)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getUser(String)}
* @param username
* @return UserVO
* @throws Exception
*/
protected abstract UserVO handleGetUser(String username)
throws Exception;
/**
* <p>
* TODO: Model Documentation for registerUser
* </p>
* @param userDetailVO
* @return UserDetailsVO
*/
@PermitAll
public UserDetailsVO registerUser(UserDetailsVO userDetailVO)
{
if (userDetailVO == null)
{
throw new IllegalArgumentException(
"org.andromda.timetracker.service.UserServiceBean.registerUser(UserDetailsVO userDetailVO) - 'userDetailVO' can not be null");
}
try
{
return this.handleRegisterUser(userDetailVO);
}
catch (Throwable th)
{
throw new UserServiceException(
"Error performing 'UserService.registerUser(UserDetailsVO userDetailVO)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #registerUser(UserDetailsVO)}
* @param userDetailVO
* @return UserDetailsVO
* @throws Exception
*/
protected abstract UserDetailsVO handleRegisterUser(UserDetailsVO userDetailVO)
throws Exception;
/**
* <p>
* TODO: Model Documentation for getAllUsers
* </p>
* @return UserVO[]
*/
@PermitAll
public UserVO[] getAllUsers()
{
try
{
return this.handleGetAllUsers();
}
catch (Throwable th)
{
throw new UserServiceException(
"Error performing 'UserService.getAllUsers()' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #getAllUsers()}
* @return UserVO[]
* @throws Exception
*/
protected abstract UserVO[] handleGetAllUsers()
throws Exception;
/**
* <p>
* TODO: Model Documentation for removeUser
* </p>
* @param userVO
*/
@PermitAll
public void removeUser(UserVO userVO)
{
if (userVO == null)
{
throw new IllegalArgumentException(
"org.andromda.timetracker.service.UserServiceBean.removeUser(UserVO userVO) - 'userVO' can not be null");
}
try
{
this.handleRemoveUser(userVO);
}
catch (Throwable th)
{
throw new UserServiceException(
"Error performing 'UserService.removeUser(UserVO userVO)' --> " + th,
th);
}
}
/**
* Performs the core logic for {@link #removeUser(UserVO)}
* @param userVO
* @throws Exception
*/
protected abstract void handleRemoveUser(UserVO userVO)
throws Exception;
// -------- Lifecycle Callbacks --------------
}