MobileServiceBase.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.mobile;

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 MobileServiceBean 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 MobileService
 * </p>
 */
public abstract class MobileServiceBase
    implements MobileService
{
    // ------ 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 MobileDao
     */
    @EJB
    private MobileDao mobileDao;

    // ---------- Env Entry Injection -----------

    /**
     * The minMobileLength resource injection
     */
    @Resource(name = "minMobileLength")
    protected int minMobileLength;

    /**
     * The maxMobileLength resource injection
     */
    @Resource(name = "maxMobileLength")
    protected int maxMobileLength;

    /**
     * The defaultNetwork resource injection
     */
    @Resource(name = "defaultNetwork")
    protected String defaultNetwork;


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

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

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

    /**
     * Get the injected DAO MobileDao
     * @return MobileDao
     */
    protected MobileDao getMobileDao()
    {
        return this.mobileDao;
    }

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

    /**
     * <p>
     * TODO: Model Documentation for addMobile
     * </p>
     * @param mobile
     * @throws MobileException
     */
    public void addMobile(Mobile mobile)
        throws MobileException
    {
        if (mobile == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.mobile.MobileServiceBean.addMobile(Mobile mobile) - 'mobile' can not be null");
        }
        try
        {
            this.handleAddMobile(mobile);
        }
        catch (MobileException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new MobileServiceException(
                "Error performing 'MobileService.addMobile(Mobile mobile)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #addMobile(Mobile)}
     * @param mobile
     * @throws Exception
     */
    protected abstract void handleAddMobile(Mobile mobile)
        throws Exception;

    /**
     * <p>
     * TODO: Model Documentation for getMobile
     * </p>
     * @param number
     * @return Mobile
     * @throws MobileException
     */
    public Mobile getMobile(String number)
        throws MobileException
    {
        if (number == null)
        {
            throw new IllegalArgumentException(
                "org.andromda.demo.ejb3.mobile.MobileServiceBean.getMobile(String number) - 'number' can not be null");
        }
        try
        {
            return this.handleGetMobile(number);
        }
        catch (MobileException ex)
        {
            throw ex;
        }
        catch (Throwable th)
        {
            throw new MobileServiceException(
                "Error performing 'MobileService.getMobile(String number)' --> " + th,
                th);
        }
    }

    /**
     * Performs the core logic for {@link #getMobile(String)}
     * @param number
     * @return Mobile
     * @throws Exception
     */
    protected abstract Mobile handleGetMobile(String number)
        throws Exception;


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

}