VehicleManagerBase.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.vehicle;

import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.ejb.SessionContext;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.andromda.demo.ejb3.account.AccountManagerRemote;

/**
 * Autogenerated EJB3 session bean base class VehicleManagerBean 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 VehicleManager
 * </p>
 */
public abstract class VehicleManagerBase
    implements VehicleManager
{
    // ------ Session Context Injection ------

    /**
     * SessionContext Injection
     */
    @Resource
    protected SessionContext context;

    // ------ Persistence Context Definitions --------
    /**
     * Inject persistence context demo-ejb3
     */
    @PersistenceContext(unitName = "demo-ejb3")
    protected EntityManager emanager;

    // ------ EJB Injection Definitions --------

    /**
     * Inject session EJB AccountManager
     */
    @EJB
    protected AccountManagerRemote accountManager;

    // ------ DAO Injection Definitions --------

    /**
     * Inject DAO VehicleDao
     */
    @EJB
    private VehicleDao vehicleDao;

    /**
     * Inject DAO MotocycleDao
     */
    @EJB
    private MotocycleDao motocycleDao;

    /**
     * Inject DAO CarDao
     */
    @EJB
    private CarDao carDao;

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

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

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

    /**
     * Get the injected DAO VehicleDao
     * @return VehicleDao
     */
    protected VehicleDao getVehicleDao()
    {
        return this.vehicleDao;
    }

    /**
     * Get the injected DAO MotocycleDao
     * @return MotocycleDao
     */
    protected MotocycleDao getMotocycleDao()
    {
        return this.motocycleDao;
    }

    /**
     * Get the injected DAO CarDao
     * @return CarDao
     */
    protected CarDao getCarDao()
    {
        return this.carDao;
    }

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

    /**
     * <p>
     * TODO: Model Documentation for addMotorcycle
     * </p>
     * @param mc
     * @throws VehicleException
     */
    public void addMotorcycle(Motocycle mc)
        throws VehicleException
    {
        if (mc == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.vehicle.VehicleManagerBean.addMotorcycle(Motocycle mc) - 'mc' can not be null");
        }
        try
        {
            this.handleAddMotorcycle(mc);
        }
        catch (VehicleException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new VehicleManagerException(
                "Error performing 'VehicleManager.addMotorcycle(Motocycle mc)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addMotorcycle(Motocycle)}
     * @param mc
     * @throws Exception
     */
    protected abstract void handleAddMotorcycle(Motocycle mc)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for addCar
     * </p>
     * @param car
     * @throws VehicleException
     */
    public void addCar(Car car)
        throws VehicleException
    {
        if (car == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.vehicle.VehicleManagerBean.addCar(Car car) - 'car' can not be null");
        }
        try
        {
            this.handleAddCar(car);
        }
        catch (VehicleException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new VehicleManagerException(
                "Error performing 'VehicleManager.addCar(Car car)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addCar(Car)}
     * @param car
     * @throws Exception
     */
    protected abstract void handleAddCar(Car car)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for addVehicle
     * </p>
     * @param vehicle
     * @throws VehicleException
     */
    public void addVehicle(Vehicle vehicle)
        throws VehicleException
    {
        if (vehicle == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.vehicle.VehicleManagerBean.addVehicle(Vehicle vehicle) - 'vehicle' can not be null");
        }
        try
        {
            this.handleAddVehicle(vehicle);
        }
        catch (VehicleException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new VehicleManagerException(
                "Error performing 'VehicleManager.addVehicle(Vehicle vehicle)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addVehicle(Vehicle)}
     * @param vehicle
     * @throws Exception
     */
    protected abstract void handleAddVehicle(Vehicle vehicle)
        throws Exception;


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

}