Author: athimel Date: 2013-10-11 16:16:48 +0200 (Fri, 11 Oct 2013) New Revision: 2835 Url: http://nuiton.org/projects/topia/repository/revisions/2835 Log: Introduce HibernateProvider in order to create Hibernate's Configuration and SessionFactory Added: trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 13:46:24 UTC (rev 2834) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -65,10 +65,10 @@ protected TopiaServiceSupport topiaServiceSupport; + protected HibernateProvider hibernateProvider; + public abstract K newPersistenceContext(); - public abstract Properties getConfig(); - public AbstractTopiaApplicationContext(Properties properties) { // TODO arnaud 11/10/13 vérifier le comportement this((Map) ImmutableMap.copyOf(properties)); @@ -93,8 +93,15 @@ this.configuration = ImmutableMap.copyOf(configurationCopy); } + protected HibernateProvider getHibernateProvider() { + if (hibernateProvider == null) { + hibernateProvider = new HibernateProvider(); + } + return hibernateProvider; + } + protected SessionFactory getSessionFactory() { - throw new UnsupportedOperationException(); + return getHibernateProvider().getSessionFactory(); } protected TopiaListenableSupport getTopiaListenableSupport() { Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 13:46:24 UTC (rev 2834) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -30,6 +30,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.HibernateException; +import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.tool.hbm2ddl.SchemaExport; @@ -71,7 +72,7 @@ protected TopiaFiresSupport firesSupport; // TODO AThimel 27/09/13 Javadoc - protected TopiaHibernateSupport hibernateSupport; + protected InternalTopiaHibernateSupport hibernateSupport; // TODO AThimel 27/09/13 Javadoc protected TopiaJpaSupport jpaSupport; @@ -89,27 +90,60 @@ */ protected TopiaIdFactory topiaIdFactory; +// /** +// * Current context configuration +// */ +// protected Properties config; + /** - * Current context configuration + * Creating a new TopiaPersistenceContext is equivalent to creating a new transaction + * + * @param hibernateProvider + * @param sqlSupport + * @param listenableSupport + * @param topiaIdFactory +// * @param config */ - protected Properties config; - - public AbstractTopiaPersistenceContext(TopiaHibernateSupport hibernateSupport, + public AbstractTopiaPersistenceContext(HibernateProvider hibernateProvider, TopiaSqlSupport sqlSupport, TopiaListenableSupport listenableSupport, - TopiaIdFactory topiaIdFactory, - Properties config) { - this.hibernateSupport = hibernateSupport; + TopiaIdFactory topiaIdFactory) { + + this.hibernateSupport = new InternalTopiaHibernateSupport(hibernateProvider); this.sqlSupport = sqlSupport; this.listenableSupport = listenableSupport; this.topiaIdFactory = topiaIdFactory; - this.config = config; +// this.config = config; this.firesSupport = new TopiaFiresSupport(); this.jpaSupport = new HibernateTopiaJpaSupport(hibernateSupport, firesSupport); } + protected class InternalTopiaHibernateSupport implements TopiaHibernateSupport { + + protected HibernateProvider hibernateProvider; + + protected InternalTopiaHibernateSupport(HibernateProvider hibernateProvider) { + this.hibernateProvider = hibernateProvider; + } + + @Override + public Session getHibernateSession() { + return null; + } + + @Override + public SessionFactory getHibernateFactory() { + return hibernateProvider.getSessionFactory(); + } + + @Override + public Configuration getHibernateConfiguration() { + return hibernateProvider.getHibernateConfiguration(); + } + } + protected void checkClosed() throws TopiaException { // TODO AThimel 27/09/13 IS it still useful ? // if (closed) { @@ -152,10 +186,10 @@ return null; // TODO AThimel 27/09/13 May be moved to TopiaHibernateSupport ? } - @Override - public Properties getConfig() { - return config; - } +// @Override +// public Properties getConfig() { +// return config; +// } @Override public <E extends TopiaEntity> TopiaDAO<E> getDAO(Class<E> entityClass) { Added: trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java (rev 0) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,214 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.event.service.spi.EventListenerRegistry; +import org.hibernate.event.spi.EventType; +import org.hibernate.service.ServiceRegistry; +import org.hibernate.service.ServiceRegistryBuilder; +import org.nuiton.topia.framework.TopiaFiresSupport; +import org.nuiton.topia.framework.TopiaService; +import org.nuiton.topia.framework.TopiaUtil; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public class HibernateProvider { + + private static final Log log = LogFactory.getLog(HibernateProvider.class); + + protected SessionFactory hibernateSessionFactory; + protected Configuration hibernateConfiguration; + + protected ImmutableMap<String, String> configuration; + protected TopiaServiceSupport topiaServiceSupport; + + /** + * List of persistent classes + */ + protected List<Class<?>> persistentClasses = Lists.newArrayList(); + + protected String getProperty(String key) { + return getProperty(key, null); + } + + protected String getProperty(String key, String defaultValue) { + String result = defaultValue; + if (configuration.containsKey(key)) { + result = configuration.get(key); + } + + return result; + } + + public Configuration getHibernateConfiguration() { + if (hibernateConfiguration == null) { + hibernateConfiguration = new Configuration(); + + // ajout des repertoires contenant les mappings hibernate + String[] dirs = getProperty( + TopiaContextFactory.CONFIG_PERSISTENCE_DIRECTORIES, "").split(","); + for (String dir : dirs) { + dir = dir.trim(); + if (StringUtils.isNotEmpty(dir)) { + if (log.isDebugEnabled()) { + log.debug("Load persistence from dir : " + dir); + } + hibernateConfiguration.addDirectory(new File(dir)); + } + } + + // ajout des classes dites persistentes + Set<Class<?>> hibernatePersistanceClasses = new HashSet<Class<?>>(); + for (TopiaService service : topiaServiceSupport.getServices().values()) { + Class<?>[] classes = service.getPersistenceClasses(); + + // certains service n'ont pas de classe persistantes + if (classes != null) { + // sletellier 20110411 : http://www.nuiton.org/issues/show/1454 + hibernatePersistanceClasses.addAll(Arrays.asList(classes)); +// for (Class<?> clazz : classes) { +// hibernateConfiguration.addClass(clazz); +// } + } + } + + String listPersistenceClasses = getProperty( + TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, ""); + + String[] classes = listPersistenceClasses.split(","); + for (String classname : classes) { + classname = classname.trim(); + if (StringUtils.isNotEmpty(classname)) { + if (log.isDebugEnabled()) { + log.debug("Load persistent class : " + classname); + } + + // XXX echatellier 20111007 ce qui est dommage ici, c'est + // la definition de cette classe ne sert a rien (apart security) + // car pour hibernate hibernateConfiguration.addClass(persistanceClass) + // il ne se sert pas de la classe en fait et fait seulement + // un classname.replace( '.', '/' ) + ".hbm.xml"; + // pour obtenir le mapping et la reinstancier ensuite + + Class<?> clazz; + try { + clazz = Class.forName(classname); + } catch (ClassNotFoundException eee) { + if (log.isDebugEnabled()) { + log.debug("Class " + classname + " not found"); + } + throw new TopiaNotFoundException( + String.format("Persistence class %1$s not found", + classname)); + } + persistentClasses.add(clazz); + + // sletellier 20110411 : http://www.nuiton.org/issues/show/1454 +// hibernateConfiguration.addClass(clazz); + hibernatePersistanceClasses.add(clazz); + } + } + + // sletellier 20110411 : http://www.nuiton.org/issues/show/1454 + // Add persistance classes in hibernate config + for (Class<?> persistanceClass : hibernatePersistanceClasses) { + hibernateConfiguration.addClass(persistanceClass); + } + + Properties prop = new Properties(); + prop.putAll(hibernateConfiguration.getProperties()); + prop.putAll(configuration); + + // Strange behavior, all properties are already loaded from + // constructor. Difficult to use this behavior, need to have + // TOPIA_PERSISTENCE_PROPERTIES_FILE in config. + Properties propertiesFromClasspath = + TopiaUtil.getProperties(getProperty(TopiaContextFactory.CONFIG_PERSISTENCE_PROPERTIES_FILE)); + + if (!propertiesFromClasspath.isEmpty()) { + if (log.isDebugEnabled()) { + log.debug("Load properties from file : " + + propertiesFromClasspath); + } + prop.putAll(propertiesFromClasspath); + } + + hibernateConfiguration.setProperties(prop); + + // tchemit 2011-05-26 When using hibernate > 3.3, need to make sure all mappings are loaded (the one from directory files are not still done). + hibernateConfiguration.buildMappings(); + } + return hibernateConfiguration; + } + + public SessionFactory getSessionFactory() { + + if (hibernateSessionFactory == null) { + + // init service registry + ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings( + getHibernateConfiguration().getProperties()).buildServiceRegistry(); + + hibernateSessionFactory = getHibernateConfiguration().buildSessionFactory(serviceRegistry); + + // we can't reuse original serviceRegistry instance + // we must call getServiceRegistry on factory to get a working one + ServiceRegistry serviceRegistryInit = ((SessionFactoryImplementor) hibernateSessionFactory).getServiceRegistry(); + EventListenerRegistry eventListenerRegistry = serviceRegistryInit.getService(EventListenerRegistry.class); +// TopiaFiresSupport.TopiaHibernateEvent listener = new TopiaFiresSupport.TopiaHibernateEvent(this); + TopiaFiresSupport.TopiaHibernateEvent listener = new TopiaFiresSupport.TopiaHibernateEvent(null); // FIXME AThimel 11/10/13 Give a correct instance + eventListenerRegistry.appendListeners(EventType.PRE_INSERT, listener); + eventListenerRegistry.appendListeners(EventType.PRE_LOAD, listener); + eventListenerRegistry.appendListeners(EventType.PRE_UPDATE, listener); + eventListenerRegistry.appendListeners(EventType.PRE_DELETE, listener); + eventListenerRegistry.appendListeners(EventType.POST_INSERT, listener); + eventListenerRegistry.appendListeners(EventType.POST_LOAD, listener); + eventListenerRegistry.appendListeners(EventType.POST_UPDATE, listener); + eventListenerRegistry.appendListeners(EventType.POST_DELETE, listener); + + // following listeners must be called before hibernate + eventListenerRegistry.prependListeners(EventType.SAVE_UPDATE, listener); + } + return hibernateSessionFactory; + } + +} Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java 2013-10-11 13:46:24 UTC (rev 2834) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -1,5 +1,29 @@ package org.nuiton.topia; +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2013-10-11 13:46:24 UTC (rev 2834) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -1,5 +1,29 @@ package org.nuiton.topia.persistence; +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,33 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import org.nuiton.topiatest.Employe; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public abstract class AbstractEmployeTopiaDao<E extends Employe> extends GeneratedEmployeeTopiaDao<E> { +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,34 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import org.nuiton.topiatest.Personne; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public abstract class AbstractPersonneTopiaDao<E extends Personne> extends GeneratedPersonneTopiaDao<E> { + +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,42 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import java.util.List; + +import org.nuiton.topiatest.Employe; +import org.nuiton.topiatest.Personne; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public class EmployeTopiaDao extends AbstractEmployeTopiaDao<Employe> { + + @Override + public List<Personne> findAllPersonnesByXAndY(int x, int y) { + return null; + } + +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,31 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public interface EmployeeDao { +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,33 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import org.nuiton.topiatest.Employe; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public abstract class GeneratedEmployeeTopiaDao<E extends Employe> extends AbstractPersonneTopiaDao<E> { +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,60 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import java.util.List; +import java.util.Map; + +import org.nuiton.topia.persistence.AbstractTopiaDAO; +import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaEntityEnum; +import org.nuiton.topiatest.Personne; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public abstract class GeneratedPersonneTopiaDao<E extends Personne> extends AbstractTopiaDAO<E> implements PersonneDao { + + @Override + public TopiaEntityEnum getTopiaEntityEnum() { + return null; + } + + @Override + public <R extends TopiaEntity> List<R> findUsages(Class<R> type, E entity) throws TopiaException { + return null; + } + + @Override + public Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity) throws TopiaException { + return null; + } + + @Override + public Class<E> getEntityClass() { + return null; + } + +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,38 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import java.util.List; + +import org.nuiton.topiatest.Personne; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public interface PersonneDao { + + List<Personne> findAllPersonnesByXAndY(int x, int y); + +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java (rev 0) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -0,0 +1,41 @@ +package org.nuiton.topia; + +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import java.util.List; + +import org.nuiton.topiatest.Personne; + +/** + * @author Arnaud Thimel <thimel@codelutin.com> + */ +public class PersonneTopiaDao extends AbstractPersonneTopiaDao<Personne> { + + @Override + public List<Personne> findAllPersonnesByXAndY(int x, int y) { + return null; + } + +} Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java =================================================================== --- trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java 2013-10-11 13:46:24 UTC (rev 2834) +++ trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java 2013-10-11 14:16:48 UTC (rev 2835) @@ -1,5 +1,29 @@ package org.nuiton.topia.persistence; +/* + * #%L + * ToPIA :: Persistence + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2004 - 2013 CodeLutin + * %% + * This program 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 3 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + import org.junit.Assert; import org.junit.Test; Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native