/*
 * 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.mnb;

import java.util.Collection;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
import javax.ejb.FinderException;

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

    String getId() throws RemoteException;
    void m1() throws RemoteException;

    /**
     * It replaces the referenced elements of the relation by the element of the
     * collection specified.
     * This method has the transactional attribut TX_SUPPORTS.
     * @param c is a collection of the primary key of the bean 'A'. Then the
     * elements are java.lang.String objects.
     * @throw a FinderException if among the collection a primary key does not
     * match to a bean.
     */
    void assignA(Collection c) throws FinderException, RemoteException;

    /**
     * It replaces the referenced elements of the relation by the element of the
     * collection specified.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @param c is a collection of the primary key of the bean 'A'. Then the
     * elements are java.lang.String objects.
     * @throw a FinderException if among the collection a primary key does not
     * match to a bean.
     */
    void assignAInNewTx(Collection c) throws FinderException, RemoteException;


    /**
     * It returns the primary key of the referenced elements.
     * This method has the transactional attribut TX_SUPPORTS.
     * @return a collection of the primary key of the bean 'A'. Then the
     * elements are java.lang.String objects.
     */
    Collection retrieveA() throws RemoteException;

    /**
     * It returns the primary key of the referenced elements.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @return a collection of the primary key of the bean 'A'. Then the
     * elements are java.lang.String objects.
     */
    Collection retrieveAInNewTx() throws RemoteException;


    /**
     * It adds in the multivalued relation the bean A defined by the primary
     * keys specified by the parameter.
     * This method has the transactional attribut TX_SUPPORTS.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    void addAllInA(Collection pkbs) throws FinderException, RemoteException;

    /**
     * It adds in the multivalued relation the beans A defined by the primary
     * keys specified by the parameter.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    void addAllInAInNewTx(Collection pkbs) throws FinderException, RemoteException;


    /**
     * It adds in the multivalued relation the bean A defined by its primary
     * key specified by the parameter.
     * This method has the transactional attribut TX_SUPPORTS.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    void addInA(String pkb) throws FinderException, RemoteException;

    /**
     * It adds in the multivalued relation the bean A defined by its primary
     * key specified by the parameter.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    void addInAInNewTx(String pkb) throws FinderException, RemoteException;


    /**
     * It removes from the multivalued relation the bean A defined by its primary
     * key specified by the parameter.
     * This method has the transactional attribut TX_SUPPORTS.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    void removeFromA(String pkb) throws FinderException, RemoteException;

    /**
     * It removes from the multivalued relation the bean A defined by its primary
     * key specified by the parameter.
     * This method has the transactional attribut TX_REQUIRES_NEW.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    void removeFromAInNewTx(String pkb) throws FinderException, RemoteException;


    /**
     * It clear the multivalued relation
     * This method has the transactional attribut TX_SUPPORTS.
     */
    void clearA() throws RemoteException;

    /**
     * It clear the multivalued relation
     * This method has the transactional attribut TX_REQUIRES_NEW.
     */
    void clearAInNewTx() throws RemoteException;

    /**
     * It returns true the multivalued relation contains all the bean A defined
     * by the primary keys specified by the parameter.
     * This method has the transactional attribut TX_SUPPORTS.
     * @throw a FinderException if a primary key does not match to a bean.
     */
    boolean containAllInA(Collection pkbs) throws FinderException, RemoteException;


    /**
     * It returns true the multivalued relation contains the bean A defined
     * by the primary key specified by the parameter.
     * This method has the transactional attribut TX_SUPPORTS.
     * @throw a FinderException if the primary key does not match to a bean.
     */
    boolean containInA(String pkb) throws FinderException, RemoteException;

}
