RiderServiceBase.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.rider;

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 RiderServiceBean 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 RiderService
 * </p>
 */
public abstract class RiderServiceBase
    implements RiderService
{
    // ------ 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 RiderDao
     */
    @EJB
    private RiderDao riderDao;

    // --------------- Constructors ---------------

    /**
     * Default constructor method with no arguments.
     */
    public RiderServiceBase()
    {
        super();
    }

    // ------ DAO Getters --------

    /**
     * Get the injected DAO RiderDao
     * @return RiderDao
     */
    protected RiderDao getRiderDao()
    {
        return this.riderDao;
    }

    // -------- Business Methods  --------------

    /**
     * <p>
     * TODO: Model Documentation for addRider
     * </p>
     * @param rider
     * @throws RiderException
     */
    public void addRider(Rider rider)
        throws RiderException
    {
        if (rider == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.rider.RiderServiceBean.addRider(Rider rider) - 'rider' can not be null");
        }
        try
        {
            this.handleAddRider(rider);
        }
        catch (RiderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new RiderServiceException(
                "Error performing 'RiderService.addRider(Rider rider)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addRider(Rider)}
     * @param rider
     * @throws Exception
     */
    protected abstract void handleAddRider(Rider rider)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getRider
     * </p>
     * @param id
     * @return Rider
     * @throws RiderException
     */
    public Rider getRider(long id)
        throws RiderException
    {
        try
        {
            return this.handleGetRider(id);
        }
        catch (RiderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new RiderServiceException(
                "Error performing 'RiderService.getRider(long id)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getRider(long)}
     * @param id
     * @return Rider
     * @throws Exception
     */
    protected abstract Rider handleGetRider(long id)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getAllRiders
     * </p>
     * @return Collection
     * @throws RiderException
     */
    public Collection getAllRiders()
        throws RiderException
    {
        try
        {
            return this.handleGetAllRiders();
        }
        catch (RiderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new RiderServiceException(
                "Error performing 'RiderService.getAllRiders()' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getAllRiders()}
     * @return Collection
     * @throws Exception
     */
    protected abstract Collection handleGetAllRiders()
        throws Exception;


    // -------- Lifecycle Callbacks --------------

}