Index: topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSBHome.java diff -u /dev/null topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSBHome.java:1.1 --- /dev/null Sun Aug 1 14:52:37 2004 +++ topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSBHome.java Sun Aug 1 14:52:32 2004 @@ -0,0 +1,43 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PersistenceHelperSBHome.java + * + * Created: Aug 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/08/01 14:52:32 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia.ejb; + +import javax.ejb.EJBHome; + +/** + * + */ +public interface PersistenceHelperSBHome extends EJBHome { + + PersistenceHelperSB create() throws javax.ejb.CreateException,java.rmi.RemoteException; + +} Index: topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSBBean.java diff -u /dev/null topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSBBean.java:1.1 --- /dev/null Sun Aug 1 14:52:37 2004 +++ topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSBBean.java Sun Aug 1 14:52:32 2004 @@ -0,0 +1,101 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PersistenceHelperSBBean.java + * + * Created: Aug 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/08/01 14:52:32 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia.ejb; + +import java.util.List; + +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; + +import org.codelutin.topia.TopiaArgument; +import org.codelutin.topia.TopiaContext; +import org.codelutin.topia.TopiaEntity; +import org.codelutin.topia.TopiaException; +import org.codelutin.topia.TopiaQuery; +import org.codelutin.topia.persistence.AbstractPersistenceHelper; +import org.codelutin.topia.persistence.PersistenceHelper; + +/** + * + */ +public class PersistenceHelperSBBean implements SessionBean { + + protected SessionContext sessionContext; + protected TopiaContext topiaContext; + + public void setSessionContext(SessionContext sessionContext) { + this.sessionContext = sessionContext; + } + + public void ejbCreate() { + // Get a context + // TODO + System.out.println("ejbCreate PHSB"); // TODO remove this + } + + public void ejbRemove() {} + + public void ejbActivate() {} + + public void ejbPassivate() {} + + public TopiaEntity makePersistent(TopiaEntity entity) throws TopiaException { + System.out.println("makePersistent PHSB"); // TODO remove this + return topiaContext.getPersistenceHelper().makePersistent(entity); + } + + public TopiaEntity update(TopiaEntity entity) throws TopiaException { + return topiaContext.getPersistenceHelper().update(entity); + } + + public void delete(TopiaEntity entity) throws TopiaException { + topiaContext.getPersistenceHelper().delete(entity); + } + + /** + * Permet de récupéré une liste d'objet par rapport a une requete. + * @param query la requete a executer + * @return une List d'objets + */ + public List find(TopiaQuery query) throws TopiaException { + return topiaContext.getPersistenceHelper().find(query); + } + + public int size(TopiaQuery query) throws TopiaException { + return topiaContext.getPersistenceHelper().size(query); + } + + public TopiaEntity findByTopiaId(String id) throws TopiaException { + return ((AbstractPersistenceHelper) topiaContext.getPersistenceHelper()).findByTopiaId(id); + } + +} Index: topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSB.java diff -u /dev/null topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSB.java:1.1 --- /dev/null Sun Aug 1 14:52:37 2004 +++ topia/src/java/org/codelutin/topia/ejb/PersistenceHelperSB.java Sun Aug 1 14:52:32 2004 @@ -0,0 +1,66 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PersistenceHelperSB.java + * + * Created: Aug 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/08/01 14:52:32 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia.ejb; + +import java.rmi.RemoteException; +import java.util.List; + +import javax.ejb.EJBObject; + +import org.codelutin.topia.TopiaEntity; +import org.codelutin.topia.TopiaException; +import org.codelutin.topia.TopiaQuery; + +/** + * + */ +public interface PersistenceHelperSB extends EJBObject { + + public TopiaEntity makePersistent(TopiaEntity entity) + throws TopiaException, RemoteException; + + public TopiaEntity update(TopiaEntity entity) + throws TopiaException, RemoteException; + + public void delete(TopiaEntity entity) throws TopiaException, RemoteException; + + /** + * Permet de récupéré une liste d'objet par rapport a une requete. + * + * @param query + * la requete a executer + * @return une List d'objets + */ + public List find(TopiaQuery query) throws TopiaException, RemoteException; + + public int size(TopiaQuery query) throws TopiaException, RemoteException; +}