RentalServiceDelegate.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.rental;

import java.util.List;
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.rental.RentalServiceBean}.
 *
 * @see org.andromda.demo.ejb3.rental.RentalServiceBean
 */
public class RentalServiceDelegate
    extends ServiceDelegateBase
{
    /**
     * Default constructor
     */
    public RentalServiceDelegate()
    {
        super();
    }

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

    /**
     * Gets an instance of {@link RentalServiceRemote}
     */
    private RentalServiceRemote getRentalServiceRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_rental_RentalServiceBean_Remote(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.rental.RentalServiceBean#addCar(RentalCar)
     *
     * @param car
     */
    public void addCar(RentalCar car)
    {
        try
        {
            getRentalServiceRemote().addCar(car);
        }
        catch (NamingException ex)
        {
            throw new RentalServiceException(
                "Error performing 'org.andromda.demo.ejb3.rental.RentalService.addCar(RentalCar car)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.rental.RentalServiceBean#getAllCars()
     *
     * @return List
     */
    public List getAllCars()
    {
        try
        {
            return getRentalServiceRemote().getAllCars();
        }
        catch (NamingException ex)
        {
            throw new RentalServiceException(
                "Error performing 'org.andromda.demo.ejb3.rental.RentalService.getAllCars()' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.rental.RentalServiceBean#getCustomersByName(String)
     *
     * @param name
     * @return List
     */
    public List getCustomersByName(String name)
    {
        try
        {
            return getRentalServiceRemote().getCustomersByName(name);
        }
        catch (NamingException ex)
        {
            throw new RentalServiceException(
                "Error performing 'org.andromda.demo.ejb3.rental.RentalService.getCustomersByName(String name)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.rental.RentalServiceBean#processRental(RentalCar, int)
     *
     * @param car
     * @param leasePeriod
     */
    public void processRental(RentalCar car, int leasePeriod)
    {
        try
        {
            getRentalServiceRemote().processRental(car, leasePeriod);
        }
        catch (NamingException ex)
        {
            throw new RentalServiceException(
                "Error performing 'org.andromda.demo.ejb3.rental.RentalService.processRental(RentalCar car, int leasePeriod)' --> " + ex, ex);
        }
    }

}