BioServiceBase.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.bio;

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 BioServiceBean 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 BioService
 * </p>
 */
public abstract class BioServiceBase
    implements BioService
{
    // ------ 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 BioDao
     */
    @EJB
    private BioDao bioDao;

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

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

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

    /**
     * Get the injected DAO BioDao
     * @return BioDao
     */
    protected BioDao getBioDao()
    {
        return this.bioDao;
    }

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

    /**
     * <p>
     * TODO: Model Documentation for addBio
     * </p>
     * @param bio
     * @throws BioException
     */
    public void addBio(Bio bio)
        throws BioException
    {
        if (bio == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.bio.BioServiceBean.addBio(Bio bio) - 'bio' can not be null");
        }
        try
        {
            this.handleAddBio(bio);
        }
        catch (BioException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new BioServiceException(
                "Error performing 'BioService.addBio(Bio bio)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addBio(Bio)}
     * @param bio
     * @throws Exception
     */
    protected abstract void handleAddBio(Bio bio)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getBio
     * </p>
     * @param id
     * @return Bio
     * @throws BioException
     */
    public Bio getBio(Long id)
        throws BioException
    {
        if (id == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.bio.BioServiceBean.getBio(Long id) - 'id' can not be null");
        }
        try
        {
            return this.handleGetBio(id);
        }
        catch (BioException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new BioServiceException(
                "Error performing 'BioService.getBio(Long id)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getBio(Long)}
     * @param id
     * @return Bio
     * @throws Exception
     */
    protected abstract Bio handleGetBio(Long id)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getAllBios
     * </p>
     * @return Collection
     * @throws BioException
     */
    public Collection getAllBios()
        throws BioException
    {
        try
        {
            return this.handleGetAllBios();
        }
        catch (BioException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new BioServiceException(
                "Error performing 'BioService.getAllBios()' --> " + th,
                th);
        }
    }

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


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

}