MobileServiceBean.java

// license-header java merge-point
//
// Generated by SessionBeanImpl.vsl in andromda-ejb3-cartridge on 08/06/2014 10:56:22.
// Modify as necessary. If deleted it will be regenerated.
//
package org.andromda.demo.ejb3.mobile;

/**
 * @see MobileServiceBase
 *
 * Remember to manually configure the local business interface this bean implements if originally you only
 * defined the remote business interface.  However, this change is automatically reflected in the ejb-jar.xml.
 *
 * Do not specify the javax.ejb.Stateless annotation
 * Instead, the session bean is defined in the ejb-jar.xml descriptor.
 */
// Uncomment to enable webservices for MobileServiceBean
// @javax.jws.WebService(endpointInterface = "org.andromda.demo.ejb3.mobile.MobileServiceWSInterface", serviceName = "MobileService")
public class MobileServiceBean
    extends MobileServiceBase
    implements MobileServiceRemote
{
    // --------------- Constructors ---------------

    /**
     * Default constructor extending base class default constructor
     */
    public MobileServiceBean()
    {
        super();
    }

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

    /**
     * @see MobileServiceBase#addMobile(Mobile)
     */
    @Override
    protected void handleAddMobile(Mobile mobile)
        throws Exception
    {
        System.out.println("min length = " + minMobileLength + " max length = " + maxMobileLength);
        if (mobile.getNumber().length() > minMobileLength && mobile.getNumber().length() < maxMobileLength)
        {
            getMobileDao().create(mobile);
            if (mobile.getNetwork().equalsIgnoreCase(defaultNetwork))
            {
                System.out.println("Got one on the default network");
            }
        }
        else
        {
            System.out.println("Mobile length is invalid");
        }
    }

    /**
     * @see MobileServiceBase#getMobile(String)
     */
    @Override
    protected Mobile handleGetMobile(String number)
        throws Exception
    {
        return getMobileDao().load(number);
    }

    // -------- Lifecycle Callback Implementation --------------
}