OrderManagerBase.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.order;

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 OrderManagerBean 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 OrderManager
 * </p>
 */
public abstract class OrderManagerBase
    implements OrderManager
{
    // ------ 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 OrderInfoDao
     */
    @EJB
    private OrderInfoDao orderInfoDao;

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

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

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

    /**
     * Get the injected DAO OrderInfoDao
     * @return OrderInfoDao
     */
    protected OrderInfoDao getOrderInfoDao()
    {
        return this.orderInfoDao;
    }

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

    /**
     * <p>
     * TODO: Model Documentation for addOrder
     * </p>
     * @param order
     * @return long
     * @throws OrderException
     */
    public long addOrder(OrderInfo order)
        throws OrderException
    {
        if (order == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.order.OrderManagerBean.addOrder(OrderInfo order) - 'order' can not be null");
        }
        try
        {
            return this.handleAddOrder(order);
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new OrderManagerException(
                "Error performing 'OrderManager.addOrder(OrderInfo order)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addOrder(OrderInfo)}
     * @param order
     * @return long
     * @throws Exception
     */
    protected abstract long handleAddOrder(OrderInfo order)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getOrders
     * </p>
     * @param index
     * @return Collection
     * @throws OrderException
     */
    public Collection getOrders(int index)
        throws OrderException
    {
        try
        {
            return this.handleGetOrders(index);
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new OrderManagerException(
                "Error performing 'OrderManager.getOrders(int index)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getOrders(int)}
     * @param index
     * @return Collection
     * @throws Exception
     */
    protected abstract Collection handleGetOrders(int index)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getOrders
     * </p>
     * @param index
     * @param max
     * @return Collection
     * @throws OrderException
     */
    public Collection getOrders(int index, int max)
        throws OrderException
    {
        try
        {
            return this.handleGetOrders(index, max);
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new OrderManagerException(
                "Error performing 'OrderManager.getOrders(int index, int max)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getOrders(int, int)}
     * @param index
     * @param max
     * @return Collection
     * @throws Exception
     */
    protected abstract Collection handleGetOrders(int index, int max)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getAllOrders
     * </p>
     * @return Collection
     * @throws OrderException
     */
    public Collection getAllOrders()
        throws OrderException
    {
        try
        {
            return this.handleGetAllOrders();
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new OrderManagerException(
                "Error performing 'OrderManager.getAllOrders()' --> " + th,
                th);
        }
    }

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


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

}