/*
 * JOnAS: Java(TM) Open Application Server
 * Copyright (C) 1999 Bull S.A.
 * Contact: jonas-team@objectweb.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */

package org.objectweb.jonas.jtests.beans.relation.omb;

import javax.ejb.EJBObject;
import javax.ejb.FinderException;

import java.rmi.RemoteException;

/**
 * @author S.Chassande-Barrioz, Helene Joanin
 */
public interface BRemote extends EJBObject {

    String getId() throws RemoteException;

    /**
     * It replaces the referenced element of the relation by the element specified.
     * This method has the transactional attribut TX_SUPPORTS.
     * @param c is a primary key of the bean 'A' or null to clear the relation.
     * @throw a FinderException if among the primary key does not match to a bean.
     */
    void assignA(String pkA) throws FinderException, RemoteException;

    /**
     * It replaces the referenced element of the relation by the element specified.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @param c is a primary key of the bean 'A' or null to clear the relation.
     * @throw a FinderException if among the primary key does not match to a bean.
     */
    void assignAInNewTx(String pkA) throws FinderException, RemoteException;

    /**
     * It returns the primary key of the referenced element.
     * This method has the transactional attribut TX_SUPPORTS.
     * @return the primary key of the referenced bean 'A' or null if there
     *         is no referenced bean.
     */
    String retrieveA() throws RemoteException;

    /**
     * It returns the primary key of the referenced element.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @return the primary key of the referenced bean 'A' or null if there
     *         is no referenced bean..
     */
    String retrieveAInNewTx() throws RemoteException;

    /**
     * It returns true if relation is the bean A defined
     * by the primary key specified by the parameter.
     * If pkb is null, return true if there is no relation
     * This method has the transactional attribut TX_SUPPORTS.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    boolean equalsRelA(String pka) throws FinderException, RemoteException;

    void m1() throws RemoteException;

}
