BookManagerBase.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.book;

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 BookManagerBean 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 BookManager
 * </p>
 */
public abstract class BookManagerBase
    implements BookManager
{
    // ------ 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 BookDao
     */
    @EJB
    private BookDao bookDao;

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

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

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

    /**
     * Get the injected DAO BookDao
     * @return BookDao
     */
    protected BookDao getBookDao()
    {
        return this.bookDao;
    }

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

    /**
     * <p>
     * TODO: Model Documentation for getAllBooks
     * </p>
     * @return Collection
     * @throws BookException
     */
    public Collection getAllBooks()
        throws BookException
    {
        try
        {
            return this.handleGetAllBooks();
        }
        catch (BookException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new BookManagerException(
                "Error performing 'BookManager.getAllBooks()' --> " + th,
                th);
        }
    }

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


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

}