OrderManagerDelegate.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.order;

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.order.OrderManagerBean}.
 *
 * @see org.andromda.demo.ejb3.order.OrderManagerBean
 */
public class OrderManagerDelegate
    extends ServiceDelegateBase
{
    /**
     * Default constructor
     */
    public OrderManagerDelegate()
    {
        super();
    }

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

    /**
     * Gets an instance of {@link OrderManagerRemote}
     */
    private OrderManagerRemote getOrderManagerRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_order_OrderManagerBean_Remote(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.order.OrderManagerBean#addOrder(OrderInfo)
     *
     * @param order
     * @return long
     * @throws OrderException
     */
    public long addOrder(OrderInfo order)
        throws OrderException
    {
        try
        {
            return getOrderManagerRemote().addOrder(order);
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new OrderManagerException(
                "Error performing 'org.andromda.demo.ejb3.order.OrderManager.addOrder(OrderInfo order)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.order.OrderManagerBean#getOrders(int)
     *
     * @param index
     * @return Collection
     * @throws OrderException
     */
    public Collection getOrders(int index)
        throws OrderException
    {
        try
        {
            return getOrderManagerRemote().getOrders(index);
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new OrderManagerException(
                "Error performing 'org.andromda.demo.ejb3.order.OrderManager.getOrders(int index)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.order.OrderManagerBean#getOrders(int, int)
     *
     * @param index
     * @param max
     * @return Collection
     * @throws OrderException
     */
    public Collection getOrders(int index, int max)
        throws OrderException
    {
        try
        {
            return getOrderManagerRemote().getOrders(index, max);
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new OrderManagerException(
                "Error performing 'org.andromda.demo.ejb3.order.OrderManager.getOrders(int index, int max)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.order.OrderManagerBean#getAllOrders()
     *
     * @return Collection
     * @throws OrderException
     */
    public Collection getAllOrders()
        throws OrderException
    {
        try
        {
            return getOrderManagerRemote().getAllOrders();
        }
        catch (OrderException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new OrderManagerException(
                "Error performing 'org.andromda.demo.ejb3.order.OrderManager.getAllOrders()' --> " + ex, ex);
        }
    }

}