UserManagerDelegate.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.user;

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

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

    /**
     * Gets an instance of {@link UserManagerRemote}
     */
    private UserManagerRemote getUserManagerRemote()
        throws NamingException
    {
        return ServiceLocator.getInstance().get_org_andromda_demo_ejb3_user_UserManagerBean_Remote(getProperties());
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.user.UserManagerBean#addUser(User)
     *
     * @param user
     * @throws UserException
     */
    public void addUser(User user)
        throws UserException
    {
        try
        {
            getUserManagerRemote().addUser(user);
        }
        catch (UserException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new UserManagerException(
                "Error performing 'org.andromda.demo.ejb3.user.UserManager.addUser(User user)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.user.UserManagerBean#getUser(String)
     *
     * @param principalId
     * @return User
     * @throws UserException
     */
    public User getUser(String principalId)
        throws UserException
    {
        try
        {
            return getUserManagerRemote().getUser(principalId);
        }
        catch (UserException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new UserManagerException(
                "Error performing 'org.andromda.demo.ejb3.user.UserManager.getUser(String principalId)' --> " + ex, ex);
        }
    }

    /**
     * Call the session bean operation using appropriate view type
     * @see org.andromda.demo.ejb3.user.UserManagerBean#deleteUser(String)
     *
     * @param principalId
     * @throws UserException
     */
    public void deleteUser(String principalId)
        throws UserException
    {
        try
        {
            getUserManagerRemote().deleteUser(principalId);
        }
        catch (UserException ex)
        {
            throw ex;
        }
        catch (NamingException ex)
        {
            throw new UserManagerException(
                "Error performing 'org.andromda.demo.ejb3.user.UserManager.deleteUser(String principalId)' --> " + ex, ex);
        }
    }

}