AccountManagerDelegate.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.account;

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

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

    /**
     * Gets an instance of {@link AccountManagerRemote}
     */
    private AccountManagerRemote getAccountManagerRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_account_AccountManagerBean_Remote(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.account.AccountManagerBean#addAccount(Account)
     *
     * @param account
     * @return long
     * @throws AccountException
     */
    public long addAccount(Account account)
        throws AccountException
    {
        try
        {
            return getAccountManagerRemote().addAccount(account);
        }
        catch (AccountException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new AccountManagerException(
                "Error performing 'org.andromda.demo.ejb3.account.AccountManager.addAccount(Account account)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.account.AccountManagerBean#getAccount(long)
     *
     * @param id
     * @return Account
     * @throws AccountException
     */
    public Account getAccount(long id)
        throws AccountException
    {
        try
        {
            return getAccountManagerRemote().getAccount(id);
        }
        catch (AccountException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new AccountManagerException(
                "Error performing 'org.andromda.demo.ejb3.account.AccountManager.getAccount(long id)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.account.AccountManagerBean#deleteAccount(long)
     *
     * @param id
     * @throws AccountException
     */
    public void deleteAccount(long id)
        throws AccountException
    {
        try
        {
            getAccountManagerRemote().deleteAccount(id);
        }
        catch (AccountException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new AccountManagerException(
                "Error performing 'org.andromda.demo.ejb3.account.AccountManager.deleteAccount(long id)' --> " + ex, ex);
        }
    }

}