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

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

/**
 * @author J.Camilleri
 */
public interface ARemote extends EJBObject {

    PK getId() 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 'B'. 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 assignB(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 'B'. 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 assignBInNewTx(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 'B'. Then the
     * elements are java.lang.String objects.
     */
    Collection retrieveB() 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 'B'. Then the
     * elements are java.lang.String objects.
     */
    Collection retrieveBInNewTx() throws RemoteException;


    /**
     * It adds in the multivalued relation the bean B 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 addAllInB(Collection pkbs) throws FinderException, RemoteException;

    /**
     * It adds in the multivalued relation the beans B 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 addAllInBInNewTx(Collection pkbs) throws FinderException, RemoteException;


    /**
     * It adds in the multivalued relation the bean B 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 addInB(PK pkb) throws FinderException, RemoteException;

    /**
     * It adds in the multivalued relation the bean B 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 addInBInNewTx(PK pkb) throws FinderException, RemoteException;


    /**
     * It removes from the multivalued relation the bean B 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 removeFromB(PK pkb) throws FinderException, RemoteException;

    /**
     * It removes from the multivalued relation the bean B 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 removeFromBInNewTx(PK pkb) throws FinderException, RemoteException;


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

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

    /**
     * It returns true the multivalued relation contains all the bean B 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 containAllInB(Collection pkbs) throws FinderException, RemoteException;


    /**
     * It returns true the multivalued relation contains the bean B 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 containInB(PK pkb) throws FinderException, RemoteException;
}
