BicycleServiceDelegate.java

// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by ServiceDelegate.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:05.
//
package org.andromda.demo.ejb3.bicycle;

import java.util.Collection;
import java.util.Properties;
import javax.naming.NamingException;
import org.andromda.demo.ejb3.ServiceDelegateBase;
import org.andromda.demo.ejb3.ServiceLocator;

/**
 * Web service delegator for {@link org.andromda.demo.ejb3.bicycle.BicycleServiceBean}.
 *
 * @see org.andromda.demo.ejb3.bicycle.BicycleServiceBean
 */
public class BicycleServiceDelegate
    extends ServiceDelegateBase
{
    /**
     * Default constructor
     */
    public BicycleServiceDelegate()
    {
        super();
    }

    /**
     * Constructor setting the environment properties.
     *
     * @param properties
     */
    public BicycleServiceDelegate(Properties properties)
    {
        super(properties);
    }

    /**
     * Gets an instance of {@link BicycleServiceRemote}
     */
    private BicycleServiceRemote getBicycleServiceRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_bicycle_BicycleServiceBean_Remote(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.bicycle.BicycleServiceBean#addBicycle(Bicycle)
     *
     * @param bicycle
     * @throws BicycleException
     */
    public void addBicycle(Bicycle bicycle)
        throws BicycleException
    {
        try
        {
            getBicycleServiceRemote().addBicycle(bicycle);
        }
        catch (BicycleException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new BicycleServiceException(
                "Error performing 'org.andromda.demo.ejb3.bicycle.BicycleService.addBicycle(Bicycle bicycle)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.bicycle.BicycleServiceBean#getBicycle(long)
     *
     * @param id
     * @return Bicycle
     * @throws BicycleException
     */
    public Bicycle getBicycle(long id)
        throws BicycleException
    {
        try
        {
            return getBicycleServiceRemote().getBicycle(id);
        }
        catch (BicycleException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new BicycleServiceException(
                "Error performing 'org.andromda.demo.ejb3.bicycle.BicycleService.getBicycle(long id)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.bicycle.BicycleServiceBean#getAllBicycles()
     *
     * @return Collection
     * @throws BicycleException
     */
    public Collection getAllBicycles()
        throws BicycleException
    {
        try
        {
            return getBicycleServiceRemote().getAllBicycles();
        }
        catch (BicycleException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new BicycleServiceException(
                "Error performing 'org.andromda.demo.ejb3.bicycle.BicycleService.getAllBicycles()' --> " + ex, ex);
        }
    }

}