Index: topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java diff -u topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java:1.7 topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java:1.8 --- topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java:1.7 Wed Jun 15 16:52:29 2005 +++ topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java Tue Jun 28 14:08:34 2005 @@ -23,10 +23,10 @@ * Created: Jul 30, 2004 * * @author Cédric Pineau - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * - * Last update : $Date: 2005/06/15 16:52:29 $ - * by : $Author: thimel $ + * Last update : $Date: 2005/06/28 14:08:34 $ + * by : $Author: bpoussin $ */ package org.codelutin.topia.persistence; @@ -75,6 +75,18 @@ } public void destroy() { } - + + public void beginTransaction() throws TopiaException { + throw new TopiaException("Transaction not supported"); + } + + public void commitTransaction() throws TopiaException { + throw new TopiaException("Transaction not supported"); + } + + public void rollbackTransaction() throws TopiaException { + throw new TopiaException("Transaction not supported"); + } + } // AbstractPersistenceHelper Index: topia/src/java/org/codelutin/topia/persistence/PersistenceHelper.java diff -u topia/src/java/org/codelutin/topia/persistence/PersistenceHelper.java:1.7 topia/src/java/org/codelutin/topia/persistence/PersistenceHelper.java:1.8 --- topia/src/java/org/codelutin/topia/persistence/PersistenceHelper.java:1.7 Fri Jun 10 17:16:38 2005 +++ topia/src/java/org/codelutin/topia/persistence/PersistenceHelper.java Tue Jun 28 14:08:34 2005 @@ -23,10 +23,10 @@ * Created: Aug 1, 2004 * * @author Cédric Pineau - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * - * Last update : $Date: 2005/06/10 17:16:38 $ - * by : $Author: thimel $ + * Last update : $Date: 2005/06/28 14:08:34 $ + * by : $Author: bpoussin $ */ package org.codelutin.topia.persistence; @@ -70,7 +70,7 @@ public AsynchronousLoader findAsynchronously(TopiaQuery query) throws TopiaException; /** - * Get a list of objects within a range for the given query. + * Get a list of objects within a range for the given query. * @param query request to execute * @param startIndex index of the first element to return * @param endIndex index of the last element to return @@ -79,7 +79,7 @@ public List findInRange(TopiaQuery query, int startIndex, int endIndex) throws TopiaException; /** - * Get an asynchronous loader of objects within a range for the given query. + * Get an asynchronous loader of objects within a range for the given query. * @param query request to execute * @param startIndex index of the first element to return * @param endIndex index of the last element to return @@ -107,5 +107,22 @@ public TopiaEntity findByTopiaId(String id) throws TopiaException; public void destroy(); - + + /** + * Ouvre une transaction pour le thread courant + * @throws TopiaException si le PersistenceHelper ne supporte pas les transaction + */ + public void beginTransaction() throws TopiaException; + + /** + * Commit les changements fait durant la transaction + * @throws TopiaException si aucune transaction ouverte pour le thread courant + */ + public void commitTransaction() throws TopiaException; + + /** + * Rollback les changements fait durant la transaction + * @throws TopiaException si aucune transaction ouverte pour le thread courant + */ + public void rollbackTransaction() throws TopiaException; } Index: topia/src/java/org/codelutin/topia/persistence/TopiaCollectionQueryHelper.java diff -u topia/src/java/org/codelutin/topia/persistence/TopiaCollectionQueryHelper.java:1.4 topia/src/java/org/codelutin/topia/persistence/TopiaCollectionQueryHelper.java:1.5 --- topia/src/java/org/codelutin/topia/persistence/TopiaCollectionQueryHelper.java:1.4 Tue Jun 21 17:00:43 2005 +++ topia/src/java/org/codelutin/topia/persistence/TopiaCollectionQueryHelper.java Tue Jun 28 14:08:34 2005 @@ -24,12 +24,14 @@ * Created: 13 juin 2005 * * @author Arnaud Thimel -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ */ package org.codelutin.topia.persistence; +import bsh.EvalError; +import bsh.Interpreter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -38,11 +40,12 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; -import java.util.Map; +import java.util.logging.Level; import java.util.logging.Logger; - +import java.util.Map; import org.codelutin.queryparser.Constraint; import org.codelutin.queryparser.DefaultQueryVisitorUnsupportedOperation; import org.codelutin.queryparser.FieldPath; @@ -55,9 +58,6 @@ import org.codelutin.queryparser.Select; import org.codelutin.queryparser.Where; -import bsh.EvalError; -import bsh.Interpreter; - /** * Cette classe permet d'effectuer des requêtes de type Query sur une * Collection d'objet par introspection. @@ -69,24 +69,24 @@ public class TopiaCollectionQueryHelper extends QueryHelper { /** to use log facility, just put in your code: log.info("..."); */ - static private Logger log = + static private Logger log = Logger.getLogger("org.codelutin.topia.TopiaCollectionQueryHelper"); - + protected TopiaCollectionQueryBuilder queryBuilder; protected Collection datas; protected Interpreter inter; - + public TopiaCollectionQueryHelper(Collection datas) { this.datas = datas; } - + public void setQuery(Query query) { super.setQuery(query); queryBuilder = null; HashMap fields = getQuery().getSelect().getFields(); if(fields.size() != 1) throw new IllegalArgumentException("Select statement must " + - "have one field only. "+fields); + "have one field only. "+fields); } /* (non-Javadoc) @@ -96,7 +96,7 @@ //System.out.println("Query : " + query); if (getQuery() == null) throw new QueryHelperException("Please use setQuery(...) " + - "before execute()"); + "before execute()"); // Préparation de la requete pour BSH if (queryBuilder == null) { @@ -107,45 +107,44 @@ for(int i=0; i