Index: topia/src/java/org/codelutin/topia/AbstractTopiaEntity.java diff -u topia/src/java/org/codelutin/topia/AbstractTopiaEntity.java:1.7 topia/src/java/org/codelutin/topia/AbstractTopiaEntity.java:1.8 --- topia/src/java/org/codelutin/topia/AbstractTopiaEntity.java:1.7 Wed Jun 15 16:52:29 2005 +++ topia/src/java/org/codelutin/topia/AbstractTopiaEntity.java Fri Jul 22 16:57:57 2005 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * - * Mise a jour: $Date: 2005/06/15 16:52:29 $ + * Mise a jour: $Date: 2005/07/22 16:57:57 $ * par : $Author: thimel $ */ @@ -45,7 +45,7 @@ protected Date _topiaLastUpdateDate_; protected TopiaUser _topiaLastUpdateUser_; - protected Collection _dependentEntities; + protected Collection _dependentEntities; //TODO ??? Arno : Faut-il sécuriser ces méthodes ? //Réponse : Après discussion avec et selon Benjamin : non ! @@ -126,20 +126,20 @@ public boolean add_dependentEntities_(TopiaEntity entity) throws TopiaException { if (this._dependentEntities == null) - this._dependentEntities = new java.util.ArrayList(); + this._dependentEntities = new java.util.ArrayList(); return this._dependentEntities.add(entity); } public void remove_dependentEntities_(TopiaEntity entity) throws TopiaException { if (this._dependentEntities == null) - this._dependentEntities = new java.util.ArrayList(); + this._dependentEntities = new java.util.ArrayList(); else this._dependentEntities.remove(entity); } - public Iterator iterator_dependentEntities_() throws TopiaException { + public Iterator iterator_dependentEntities_() throws TopiaException { if (this._dependentEntities == null) - this._dependentEntities = new java.util.ArrayList(); + this._dependentEntities = new java.util.ArrayList(); return _dependentEntities.iterator(); } Index: topia/src/java/org/codelutin/topia/ContextHelper.java diff -u topia/src/java/org/codelutin/topia/ContextHelper.java:1.4 topia/src/java/org/codelutin/topia/ContextHelper.java:1.5 --- topia/src/java/org/codelutin/topia/ContextHelper.java:1.4 Wed Jul 20 12:49:52 2005 +++ topia/src/java/org/codelutin/topia/ContextHelper.java Fri Jul 22 16:57:57 2005 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * - * Mise a jour: $Date: 2005/07/20 12:49:52 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2005/07/22 16:57:57 $ + * par : $Author: thimel $ */ package org.codelutin.topia; @@ -94,7 +94,7 @@ } // load properties for helper - String propertiesFilename = properties.getProperty(propertyId+".properties"); + String propertiesFilename = properties.getProperty(propertyId+".properties");/* TODO .file ??? */ properties = new Properties(properties); if (propertiesFilename != null && !propertiesFilename.equals("")) { try { Index: topia/src/java/org/codelutin/topia/TopiaContext.java diff -u topia/src/java/org/codelutin/topia/TopiaContext.java:1.40 topia/src/java/org/codelutin/topia/TopiaContext.java:1.41 --- topia/src/java/org/codelutin/topia/TopiaContext.java:1.40 Thu Jul 21 17:10:38 2005 +++ topia/src/java/org/codelutin/topia/TopiaContext.java Fri Jul 22 16:57:57 2005 @@ -23,15 +23,16 @@ * * @author Benjamin Poussin * Copyright Code Lutin -* @version $Revision: 1.40 $ +* @version $Revision: 1.41 $ * -* Mise a jour: $Date: 2005/07/21 17:10:38 $ +* Mise a jour: $Date: 2005/07/22 16:57:57 $ * par : $Author: thimel $ */ package org.codelutin.topia; import java.util.HashMap; +import java.util.logging.Level; import java.util.logging.Logger; import java.util.Properties; @@ -84,6 +85,8 @@ protected HashMap cacheService = new HashMap(); + public abstract String getContextName(); + /** * Constructeur du context. Il est protégé car les contexts doivent-être * construit par {@TopiaContextFactory} @@ -94,7 +97,8 @@ try { getSecurityHelper(); } catch (Exception eee) { - eee.printStackTrace(); + log.log(Level.SEVERE, "Aucun SecurityHelper trouvé, sécurité" + + " non opérationnelle"); } } @@ -314,12 +318,31 @@ return contextHelper; } + /** + * Pour simplifier la procédure de login, l'utilisateur donne le login et + * le mot de passe et on lui renvoie le LoginContext une fois l'utilisateur + * loggué + * @param login + * @param password + * @return Le LoginContext instancé pour la procédure de login + * @throws LoginException Si une erreur survient pendant le login + * @throws TopiaNotFoundException Si le SeucrityHelper n'est pas trouvé + */ public LoginContext login(String login, String password) throws LoginException, TopiaNotFoundException { return getSecurityHelper().login(login, password); } - public LoginContext login(CallbackHandler callbackHandler) + /** + * Pour simplifier la procédure de login, l'utilisateur donne le + * callbackHendler et on lui renvoie le LoginContext une fois l'utilisateur + * loggué + * @param callbackHandler pour récupérer les paramètres d'authentification + * @return Le LoginContext instancé pour la procédure de login + * @throws LoginException Si une erreur survient pendant le login + * @throws TopiaNotFoundException Si le SeucrityHelper n'est pas trouvé + */ + public LoginContext login(CallbackHandler callbackHandler) throws LoginException, TopiaNotFoundException { return getSecurityHelper().login(callbackHandler); } Index: topia/src/java/org/codelutin/topia/AbstractTopiaPersistenceService.java diff -u topia/src/java/org/codelutin/topia/AbstractTopiaPersistenceService.java:1.9 topia/src/java/org/codelutin/topia/AbstractTopiaPersistenceService.java:1.10 --- topia/src/java/org/codelutin/topia/AbstractTopiaPersistenceService.java:1.9 Thu Jul 21 12:52:54 2005 +++ topia/src/java/org/codelutin/topia/AbstractTopiaPersistenceService.java Fri Jul 22 16:57:57 2005 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ * - * Mise a jour: $Date: 2005/07/21 12:52:54 $ + * Mise a jour: $Date: 2005/07/22 16:57:57 $ * par : $Author: thimel $ */ @@ -108,6 +108,15 @@ } /** + * Return the entity having the given topiaId + */ + public Entity findBy_TopiaId_(String topiaId) throws TopiaException { + // TODO Arno : Tester le topiaId avant de faire le find !!! (doit etre du type de ) + return (Entity)getContext().getPersistenceHelper().findByTopiaId(topiaId); + } + + + /** * Returns all TopiaEntity related to this CRUD according to the given TopiaQuery. * If topiaQuery is null, acts as findAll(). * @param topiaQuery - the TopiaQuery to process. Query contains where clause only or it must be create with {@link #newQuery()} @@ -162,6 +171,19 @@ } return result; } + + /** + * Return the Entity corresponding to the given XML representation + */ +/* public Entity fromXML(String entityXML) throws TopiaException { + Entity entity = (Entity) EntitiesHelper.fromXML(entityXML); + if (! (entity instanceof Entity)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + return entity; + } +*/ + } // AbstractTopiaPersistenceService