CameraManagerBase.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.camera;

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 CameraManagerBean 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 CameraManager
 * </p>
 */
public abstract class CameraManagerBase
    implements CameraManager
{
    // ------ 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 CameraDao
     */
    @EJB
    private CameraDao cameraDao;

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

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

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

    /**
     * Get the injected DAO CameraDao
     * @return CameraDao
     */
    protected CameraDao getCameraDao()
    {
        return this.cameraDao;
    }

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

    /**
     * <p>
     * TODO: Model Documentation for addCamera
     * </p>
     * @param camera
     * @throws CameraException
     */
    public void addCamera(Camera camera)
        throws CameraException
    {
        if (camera == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.camera.CameraManagerBean.addCamera(Camera camera) - 'camera' can not be null");
        }
        try
        {
            this.handleAddCamera(camera);
        }
        catch (CameraException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new CameraManagerException(
                "Error performing 'CameraManager.addCamera(Camera camera)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addCamera(Camera)}
     * @param camera
     * @throws Exception
     */
    protected abstract void handleAddCamera(Camera camera)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getCamera
     * </p>
     * @param make
     * @param model
     * @return Camera
     * @throws CameraException
     */
    public Camera getCamera(String make, String model)
        throws CameraException
    {
        if (make == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.camera.CameraManagerBean.getCamera(String make, String model) - 'make' can not be null");
        }
        if (model == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.camera.CameraManagerBean.getCamera(String make, String model) - 'model' can not be null");
        }
        try
        {
            return this.handleGetCamera(make, model);
        }
        catch (CameraException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new CameraManagerException(
                "Error performing 'CameraManager.getCamera(String make, String model)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getCamera(String, String)}
     * @param make
     * @param model
     * @return Camera
     * @throws Exception
     */
    protected abstract Camera handleGetCamera(String make, String model)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for deleteCamera
     * </p>
     * @param make
     * @param model
     * @throws CameraException
     */
    public void deleteCamera(String make, String model)
        throws CameraException
    {
        if (make == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.camera.CameraManagerBean.deleteCamera(String make, String model) - 'make' can not be null");
        }
        if (model == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.camera.CameraManagerBean.deleteCamera(String make, String model) - 'model' can not be null");
        }
        try
        {
            this.handleDeleteCamera(make, model);
        }
        catch (CameraException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new CameraManagerException(
                "Error performing 'CameraManager.deleteCamera(String make, String model)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #deleteCamera(String, String)}
     * @param make
     * @param model
     * @throws Exception
     */
    protected abstract void handleDeleteCamera(String make, String model)
        throws Exception;


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

}