Topia-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
June 2010
- 5 participants
- 63 discussions
r2018 - trunk/topia-persistence/src/main/java/org/nuiton/topia/framework
by fdesbois@users.nuiton.org 15 Jun '10
by fdesbois@users.nuiton.org 15 Jun '10
15 Jun '10
Author: fdesbois
Date: 2010-06-15 17:07:57 +0200 (Tue, 15 Jun 2010)
New Revision: 2018
Url: http://nuiton.org/repositories/revision/topia/2018
Log:
[TopiaQuery] Improve addFetch javadoc
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-15 08:24:25 UTC (rev 2017)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-15 15:07:57 UTC (rev 2018)
@@ -617,18 +617,22 @@
/**
* Used to load properties during query execution using FETCH keyword. This
* keyword is used in a JOIN, so the alias is needed to identify properties
- * to load. If no mainAlias is defined in the query, all properties will
- * automatically have a generated alias to identify them. Also an empty
- * SELECT statement will be defined to retrieve the correct entity depends
- * on the mainEntity type in the query. Carefull using addFetch, hibernate
- * doesn't support more than 3 or 4 join. In this case, you can use {@link
- * #addLoad(String...)} or load manually the entities wanted.
+ * to load.
+ * </p>
+ * Also an empty SELECT statement will be defined to retrieve the correct
+ * entity depends on the mainEntity type in the query. Carefull using
+ * addFetch, hibernate doesn't support more than 3 or 4 join. In this case,
+ * you can use {@link #addLoad(String...)} or load manually the entities
+ * wanted.
*
* @param properties Properties to load during query execution
* @return the TopiaQuery
*/
public TopiaQuery addFetch(String... properties) {
+ // Note : creating alias is not very efficient if other parameters is needed
+ // Maybe the solution is to throw an exception if no mainAlias is defined
+
// Check mainAlias, necessary to use join fetch
boolean needAlias = false;
if (StringUtils.isEmpty(mainAlias)) {
1
0
r2017 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by fdesbois@users.nuiton.org 15 Jun '10
by fdesbois@users.nuiton.org 15 Jun '10
15 Jun '10
Author: fdesbois
Date: 2010-06-15 10:24:25 +0200 (Tue, 15 Jun 2010)
New Revision: 2017
Url: http://nuiton.org/repositories/revision/topia/2017
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-15 08:24:20 UTC (rev 2016)
+++ trunk/pom.xml 2010-06-15 08:24:25 UTC (rev 2017)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.3.4</version>
+ <version>2.3.5-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
@@ -307,10 +307,10 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.3.4</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.3.4
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk
</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/topia/tags/topia-2.3.4</url>
+ <url>http://www.nuiton.org/repositories/browse/topia/trunk</url>
</scm>
</project>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2010-06-15 08:24:20 UTC (rev 2016)
+++ trunk/topia-persistence/pom.xml 2010-06-15 08:24:25 UTC (rev 2017)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.3.4</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2010-06-15 08:24:20 UTC (rev 2016)
+++ trunk/topia-service-migration/pom.xml 2010-06-15 08:24:25 UTC (rev 2017)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.3.4</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2010-06-15 08:24:20 UTC (rev 2016)
+++ trunk/topia-service-replication/pom.xml 2010-06-15 08:24:25 UTC (rev 2017)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.3.4</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2010-06-15 08:24:20 UTC (rev 2016)
+++ trunk/topia-service-security/pom.xml 2010-06-15 08:24:25 UTC (rev 2017)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.3.4</version>
+ <version>2.3.5-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: fdesbois
Date: 2010-06-15 10:24:20 +0200 (Tue, 15 Jun 2010)
New Revision: 2016
Url: http://nuiton.org/repositories/revision/topia/2016
Log:
[maven-release-plugin] copy for tag topia-2.3.4
Added:
tags/topia-2.3.4/
Property changes on: tags/topia-2.3.4
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
1
0
r2015 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by fdesbois@users.nuiton.org 15 Jun '10
by fdesbois@users.nuiton.org 15 Jun '10
15 Jun '10
Author: fdesbois
Date: 2010-06-15 10:24:18 +0200 (Tue, 15 Jun 2010)
New Revision: 2015
Url: http://nuiton.org/repositories/revision/topia/2015
Log:
[maven-release-plugin] prepare release topia-2.3.4
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-14 22:38:21 UTC (rev 2014)
+++ trunk/pom.xml 2010-06-15 08:24:18 UTC (rev 2015)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.3.4</version>
<modules>
<module>topia-persistence</module>
@@ -307,10 +307,10 @@
<!-- Source control management. -->
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.3.4</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.3.4
</developerConnection>
- <url>http://www.nuiton.org/repositories/browse/topia/trunk</url>
+ <url>http://www.nuiton.org/repositories/browse/topia/tags/topia-2.3.4</url>
</scm>
</project>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2010-06-14 22:38:21 UTC (rev 2014)
+++ trunk/topia-persistence/pom.xml 2010-06-15 08:24:18 UTC (rev 2015)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.3.4</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2010-06-14 22:38:21 UTC (rev 2014)
+++ trunk/topia-service-migration/pom.xml 2010-06-15 08:24:18 UTC (rev 2015)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.3.4</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2010-06-14 22:38:21 UTC (rev 2014)
+++ trunk/topia-service-replication/pom.xml 2010-06-15 08:24:18 UTC (rev 2015)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.3.4</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2010-06-14 22:38:21 UTC (rev 2014)
+++ trunk/topia-service-security/pom.xml 2010-06-15 08:24:18 UTC (rev 2015)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.4-SNAPSHOT</version>
+ <version>2.3.4</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: fdesbois
Date: 2010-06-15 00:38:21 +0200 (Tue, 15 Jun 2010)
New Revision: 2014
Url: http://nuiton.org/repositories/revision/topia/2014
Log:
Update TopiaQuery documentation
Modified:
trunk/topia-persistence/src/site/rst/TopiaQuery.rst
Modified: trunk/topia-persistence/src/site/rst/TopiaQuery.rst
===================================================================
--- trunk/topia-persistence/src/site/rst/TopiaQuery.rst 2010-06-14 21:50:20 UTC (rev 2013)
+++ trunk/topia-persistence/src/site/rst/TopiaQuery.rst 2010-06-14 22:38:21 UTC (rev 2014)
@@ -68,7 +68,7 @@
BoatDAO dao = ModelDAOHelper.getBoatDAO(transaction);
TopiaQuery query = dao.createQuery();
-ou Depuis un topiaContext ::
+ou depuis un topiaContext ::
TopiaContext transaction = rootContext.beginTransaction();
TopiaQuery query = transaction.createQuery(Boat.class, "B");
@@ -76,7 +76,7 @@
L'intérêt de passer par un DAO est de pouvoir par la suite executer la requête
avec ce même DAO. Il est également possible d'utiliser des alias pour l'élément
principal de la requête pour pouvoir plus facilement gérer les cas de jointure.
-Il suffit de préciser l'alias au moment de l'instantiation ::
+Il suffit de préciser l'alias au moment de l'instanciation ::
TopiaContext transaction = rootContext.beginTransaction();
BoatDAO dao = ModelDAOHelper.getBoatDAO(transaction);
@@ -85,7 +85,7 @@
Ajout d'éléments au WHERE
-------------------------
-Les méthodes de base nécessaire concerne l'ajout d'élements dans le WHERE de la
+Les méthodes de base nécessaires concernent l'ajout d'élements dans le WHERE de la
requête. Plusieurs méthodes sont disponibles suivant les besoins pour ajouter
simplement un élément au where ::
@@ -295,6 +295,15 @@
}
// Utilisation de la première requête comme sous-requête
+ query2.add("C2." + Contact.CREATION_DATE + " = (" + query1.fullQuery() + ")");
+ // Ajout des paramètres nécessaires de la première requête dans la deuxième
+ query2.addParams(query1.getParams());
+
+Depuis la 2.3.4, la méthode **addSubQuery(String statement, TopiaQuery subquery)**
+permet de faciliter l'injection d'une sous-requête notamment pour la gestion
+des paramètres automatiquement (avec prise en charge des doublons) ::
+
+ // Même chose que précédemment en utilisant la méthode addSubQuery
query2.addSubQuery("C2." + Contact.CREATION_DATE + " = (?)", query1);
La requête sous forme HQL ::
@@ -317,9 +326,8 @@
---------
Plusieurs méthodes sont disponibles pour récupérer les résultats de la requête.
-Pour chaque méthode, il est possible de l'appeler avec en paramètre le contexte
-topia ou directement, si la requête a été instancié avec un DAO qui contient
-lui même le contexte. La méthode de base est la méthode execute() qui renvoie
+Pour chaque méthode, il est nécessaire de l'appeler avec le contexte
+topia. La méthode de base est la méthode execute() qui renvoie
une liste non typé à l'instar de la méthode find(...) du TopiaContext. Il
est cependant possible de récupérer directement un objet, un entier (pour
un aggregat par exemple) ou une chaîne de caractères suivant le select de la
@@ -349,17 +357,60 @@
// résultats du 50ème au 60ème
query.setLimit(49, 59);
+// depuis 2.3.4
+
+Pour éviter d'embarquer ces paramètres à chaque fois qu'ils sont nécessaires
+lors d'un filtrage paginée, un bean, *EntityFilter* est disponible.
+Il contient les attributs suivants :
+
+- startIndex : index de début des résultats.
+
+- endIndex : index de fin des résultats.
+
+- orderBy : propriétés à ordonner (l'ajout des mots clés 'asc' et 'desc' est
+ possible).
+
+- referenceId : identifiant d'une référence utile à la requête.
+
+- referenceProperty : nom de la propriété correspondant à la valeur du referenceId.
+
+Exemple : Nous souhaitons les contacts 30 à 60 triés par 'creationDate' décroissant et
+'personName' croissant pour un navire donné par son topiaId ::
+
+ EntityFilter filter = new EntityFilter();
+ filter.setStartIndex(30);
+ filter.setEndIndex(60);
+ filter.setOrderBy("creationDate desc, personName");
+ filter.setReferenceId(boat.getTopiaId());
+ // ou filter.setReference(boat);
+ filter.setReferenceProperty("boat");
+
+ TopiaQuery query = contactDAO.createQuery().addFilter(filter);
+
+L'intérêt de l'EntityFilter est de pouvoir l'instancier et le manipuler directement
+depuis votre interface (Swing, Web, ...) et de l'utiliser sur une requête métier.
+La méthode **addFilter(EntityFilter filter)** permettra d'injecter les paramètres
+s'ils possèdent une valeur.
+
+Note
+ L'ordre définit par défaut est celui de création par ordre décroissant :
+ *topiaCreateDate desc*.
+
Utilisation des DAO
~~~~~~~~~~~~~~~~~~~
Les DAO fournissent également quelques méthodes permettant de récupérer plus
facilement les résultats avec le type souhaité :
+- **countByQuery(TopiaQuery query)** : compte le nombre de résultats de la
+ requête.
+- **existByQuery(TopiaQuery query)** : renvoie vrai si la requête à retourner
+ au moins 1 résultat.
- **findByQuery(TopiaQuery query)** : renvoie une entité (un seul résultat)
- **findAllByQuery(TopiaQuery query)** : renvoie une liste d'entités
- **findAllMappedByQuery(TopiaQuery query)** : renvoie une map d'entités avec
pour clé le topiaId de l'entité.
-- **findAllMappedByQuery(TopiaQuery, Class keyClass, String keyProperty)** :
+- **findAllMappedByQuery(TopiaQuery query, Class keyClass, String keyProperty)** :
renvoie une map d'entités avec pour clé la propriété passée en argument.
Exemple ::
@@ -368,6 +419,13 @@
BoatDAO dao = ModelDAOHelper.getBoatDAO(transaction);
TopiaQuery query = dao.createQuery();
...
+ // pour vérifier l'existance de résultat
+ boolean hasResult = dao.existByQuery(query);
+
+ // pour savoir le nombre de résultats
+ int count = dao.countByQuery(query);
+
+ // pour récupérer les résultats
Map<String, Boat> boatMap = dao.findAllMappedByQuery(query);
// ou
List<Boat> boatList = dao.findAllByQuery(query);
@@ -377,14 +435,16 @@
Map<Integer, Boat> boatMapImma = dao.findAllMappedByQuery(query,
Integer.class, Boat.IMMATRICULATION);
+
Résultats complexes
~~~~~~~~~~~~~~~~~~~
Certains cas de requête peuvent avoir des résultats plus complexes, notamment
-lorsqu'il s'agit de propriété de différentes entités ou avec des aggrégats (
-AVG, SUM, COUNT). Dans ce cas il faut utiliser la méthode de base **execute()**
-qui renvoie une liste non typée. Lorsqu'il y a plus d'un élément dans le select
-la liste renvoyée est une List<Object[]>, le tableau pour chaque ligne
+lorsqu'il s'agit de propriétés de différentes entités ou avec l'utilisation d'
+aggrégats (AVG, SUM, COUNT). Dans ce cas il faut utiliser la méthode de base
+**findByQuery(TopiaQuery query)** depuis une transaction
+qui renverra une liste non typée. Lorsqu'il y a plus d'un élément dans le
+select la liste renvoyée est une List<Object[]>, le tableau pour chaque ligne
correspondant aux valeurs des résultats. Exemple ::
TopiaContext transaction = rootContext.beginTransaction();
@@ -394,7 +454,7 @@
TopiaQuery query = dao.createQuery().
setSelect(boatImma, "COUNT(*)").addGroup(boatImma);
- List<Object[]> results = query.execute();
+ List<Object[]> results = transaction.findByQuery(query);
// Parcours des résultats
for (Object[] result : results) {
Integer immatriculation = (Integer)result[0];
@@ -407,8 +467,8 @@
Chargement des donnees
----------------------
-Généralement une fois la requête exécuté, la transaction utilisé est directement
-fermé (topiaContext.closeContext()). Dans ce cas, il est souvent nécessaire de
+Généralement une fois la requête exécutée, la transaction utilisée est directement
+fermée (topiaContext.closeContext()). Dans ce cas, il est souvent nécessaire de
charger certaines entités pour éviter les malencontreuses LazyException d'Hibernate.
Plusieurs possibilités s'offrent à vous :
@@ -422,6 +482,8 @@
myapp.entity.Contact.attribute.boat.tagvalue.lazy=false
+(*myapp.entity.Contact* étant le nom qualifié de la classe Contact)
+
Ainsi chaque contact récupéré aura automatiquement son navire associé de chargé.
**Attention** cependant, il ne faut pas abuser du tagvalue *lazy* car sinon Hibernate
@@ -447,7 +509,7 @@
modèle d'exemple, il est possible de charger le navire associé aux contacts en
utilisant : queryContact.addLoad(Contact.BOAT);
-Dans le cas du addLoad, plusieurs requêtes seront exécutés suivant le nombre
+Dans le cas du addLoad, plusieurs requêtes seront exécutées suivant le nombre
de Contact résultats. Il est dans ce cas plus judicieux d'utiliser le addFetch
qui chargera directement les Boat au moment de la récupération des Contact :
queryContact.addFetch(Contact.BOAT); L'alias peut s'avérer indispensable pour
@@ -474,8 +536,8 @@
- Si addLoad non utilisable (trop de chargement de collections) : effectuer un
chargement manuelle en parcourant les résultats. Pour le chargement d'une
entité simple, il suffit d'utiliser le getter correspondant pour la charger,
- tandis que pour une collection, l'appel à la méthode size permet de charger
- l'intégralité des éléments.
+ tandis que pour une collection, l'appel à la méthode size associée permet de
+ charger l'intégralité des éléments.
1
0
r2013 - in trunk/topia-persistence/src: main/java/org/nuiton/topia/framework site/rst
by fdesbois@users.nuiton.org 14 Jun '10
by fdesbois@users.nuiton.org 14 Jun '10
14 Jun '10
Author: fdesbois
Date: 2010-06-14 23:50:20 +0200 (Mon, 14 Jun 2010)
New Revision: 2013
Url: http://nuiton.org/repositories/revision/topia/2013
Log:
Update TopiaQuery documentation
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
trunk/topia-persistence/src/site/rst/TopiaQuery.rst
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-14 14:21:58 UTC (rev 2012)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-14 21:50:20 UTC (rev 2013)
@@ -615,10 +615,17 @@
}
/**
- * TODO-fdesbois-2010-06-02 : javadoc
+ * Used to load properties during query execution using FETCH keyword. This
+ * keyword is used in a JOIN, so the alias is needed to identify properties
+ * to load. If no mainAlias is defined in the query, all properties will
+ * automatically have a generated alias to identify them. Also an empty
+ * SELECT statement will be defined to retrieve the correct entity depends
+ * on the mainEntity type in the query. Carefull using addFetch, hibernate
+ * doesn't support more than 3 or 4 join. In this case, you can use {@link
+ * #addLoad(String...)} or load manually the entities wanted.
*
- * @param properties
- * @return
+ * @param properties Properties to load during query execution
+ * @return the TopiaQuery
*/
public TopiaQuery addFetch(String... properties) {
@@ -673,7 +680,7 @@
}
/**
- * @param where
+ * @param where Where statement to add
* @return TopiaQuery
* @deprecated since 2.3.4, use {@link #addWhere(String)} instead
*/
@@ -712,9 +719,9 @@
}
/**
- * @param paramName
- * @param constraint
- * @param paramValue
+ * @param paramName name of the parameter to add
+ * @param constraint constraint to use
+ * @param paramValue value of this parameter
* @return TopiaQuery
* @deprecated since 2.3.4, use {@link #addWhere(String, Op, Object)} instead
*/
@@ -771,8 +778,8 @@
}
/**
- * @param paramName
- * @param paramValue
+ * @param paramName name of the parameter to add
+ * @param paramValue value of this parameter
* @return TopiaQuery
* @since 2.3.1
* @deprecated since 2.3.4, use {@link #addEquals(String, Object...)} instead
@@ -847,7 +854,7 @@
}
/**
- * @param properties
+ * @param properties map of the properties to add
* @return TopiaQuery
* @deprecated since 2.3.4 use {@link #addEquals(Map)}
*/
Modified: trunk/topia-persistence/src/site/rst/TopiaQuery.rst
===================================================================
--- trunk/topia-persistence/src/site/rst/TopiaQuery.rst 2010-06-14 14:21:58 UTC (rev 2012)
+++ trunk/topia-persistence/src/site/rst/TopiaQuery.rst 2010-06-14 21:50:20 UTC (rev 2013)
@@ -62,25 +62,22 @@
Il y a plusieurs façons d'instancier la TopiaQuery :
-Directement en connaissant la classe de l'entité ::
-
- TopiaQuery query = new TopiaQuery(Boat.class);
-
Directement depuis un DAO ::
TopiaContext transaction = rootContext.beginTransaction();
BoatDAO dao = ModelDAOHelper.getBoatDAO(transaction);
TopiaQuery query = dao.createQuery();
+ou Depuis un topiaContext ::
+
+ TopiaContext transaction = rootContext.beginTransaction();
+ TopiaQuery query = transaction.createQuery(Boat.class, "B");
+
L'intérêt de passer par un DAO est de pouvoir par la suite executer la requête
avec ce même DAO. Il est également possible d'utiliser des alias pour l'élément
principal de la requête pour pouvoir plus facilement gérer les cas de jointure.
Il suffit de préciser l'alias au moment de l'instantiation ::
- TopiaQuery query = new TopiaQuery(Boat.class, "E");
-
-ou ::
-
TopiaContext transaction = rootContext.beginTransaction();
BoatDAO dao = ModelDAOHelper.getBoatDAO(transaction);
TopiaQuery query = dao.createQuery("E");
@@ -95,24 +92,40 @@
TopiaQuery query = boatDAO.createQuery();
// Recherche sur l'immatriculation du navire : immatriculation = 142154
- query.add("immatriculation", 142154);
+ query.addEquals("immatriculation", 142154);
// Recherche toutes les dates de construction < 2006
- query.add("buildYear", Op.LT, 2006);
+ query.addWhere("buildYear", Op.LT, 2006);
// Recherche des navires ayant un nom
query.addNotNull("name");
+ // depuis 2.3.4
// Recherche des navires n'ayant pas de nom
- query.add("name", Op.EQ, null);
+ query.addNull("name");
// Recherche des navires ayant une date de construction 2003, 2004 ou 2006
- query.add("buildYear", 2003, 2004, 2006);
+ query.addEquals("buildYear", 2003, 2004, 2006);
+ // depuis 2.3.4
+ // Recherche entre deux dates
+ TopiaQuery queryContact = contactDAO.createQuery();
+ Calendar dateBegin = new GregorianCalendar(2010,2,3);
+ Calendar dateEnd = new GregorianCalendar(2010,5,6);
+ queryContact.addBetween("creationDate", dateBegin.getTime(), dateEnd.getTime());
+
+ // depuis 2.3.4
+ // Utilisation d'une sous-requête (les paramètres de la sous-requête seront
+ // ajoutés automatiquement à la requête principale en gérant les doublons
+ // (sur la valeur et la clé)).
+ // Le ? correspond à l'endroit ou sera injecté la requête, attention aux
+ // parenthèses.
+ queryContact.addSubQuery("boat IN elements(?)", query);
+
Il est fortement conseillé d'utiliser les constantes des entités pour les noms
de leurs propriétés ::
- query.add(Boat.IMMATRICULATION, 142154);
+ query.addEquals(Boat.IMMATRICULATION, 142154);
query.addNotNull(Boat.NAME);
...
@@ -121,7 +134,7 @@
TopiaContext transaction = rootContext.beginTransaction();
BoatDAO dao = ModelDAOHelper.getBoatDAO(transaction);
- dao.createQuery().add(Boat.IMMATRICULATION, 142154).addNotNull(Boat.NAME);
+ dao.createQuery().addEquals(Boat.IMMATRICULATION, 142154).addNotNull(Boat.NAME);
Opérateurs
----------
@@ -146,11 +159,8 @@
~~~~~~~~~~~~~~~~~~~~~~~
Il est souvent nécessaire d'ajouter une autre entité au FROM de la requête,
-pour ce faire, il existe trois méthodes :
+pour ce faire, il existe deux méthodes :
-- addFrom(String str) : ajoute l'élément souhaité au FROM
- (Ex : addFrom(Contact.class.getName() + " C");)
-
- addFrom(Class entityClass) : ajoute une entité au FROM
(Ex : addFrom(Contact.class);)
@@ -160,6 +170,22 @@
C'est généralement la dernière méthode qui sera la plus utilisé, l'utilisation
des alias facilitant grandement les liaisons entre les entités.
+Depuis la 2.3.4, deux méthodes ont été rajoutés pour le cas des jointures :
+
+- addJoin(Class entityClass, String alias, boolean fetch) : utilise un inner
+ join pour lier une entité à celle de la requête. Concrètement l'opérateur
+ JOIN Hql sera utilisé : 'FROM Contact C JOIN C.boat' ::
+
+ TopiaContext transaction = rootContext.beginTransaction();
+ ContactDAO dao = ModelDAOHelper.getBoatDAO(transaction);
+ TopiaQuery query = dao.createQuery("C").addJoin("C.boat", null, false);
+
+- addLeftJoin(Class entityClass, String alias, boolean fetch) : même chose que
+ le addJoin sauf que l'opérateur LEFT JOIN Hql sera utilisé.
+
+
+Voir le `Chargement des donnees` pour l'utilisation du fetch.
+
Ajout d'élément au SELECT
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -232,7 +258,7 @@
Il peut être également utile d'utiliser une TopiaQuery comme sous-requête d'une
autre. De plus certains mots clés comme EXISTS ou encore l'utilisation de
méthode HQL ne possèdent pas leurs propres méthodes. Vous pouvez cependant
-utiliser la méthode de base **add(String str)** qui permet l'ajout au WHERE
+utiliser la méthode de base **addWhere(String str)** qui permet l'ajout au WHERE
directement (avec ajout automatique des parenthèses). Dans ce cas, il est
souvent nécessaire d'ajouter des paramètres HQL à la requête (:monParam) qui
devront être ajouté à la TopiaQuery en utilisant la méthode
@@ -243,7 +269,7 @@
Date beginDate = ...
Date endDate = ...
TopiaQuery query1 = dao.createQuery("C").
- add("C." + Contact.VALIDATION + " IS NOT NULL OR " +
+ addWhere("C." + Contact.VALIDATION + " IS NOT NULL OR " +
"C." + Contact.CREATION_DATE + " BETWEEN :begin AND :end").
addParam("begin", beginDate).addParam("end", endDate);
@@ -261,17 +287,15 @@
// sélection spécifique pour un navire
if (immatriculation != null) {
- query2.add("C2." + Contact.BOAT + "." + Boat.IMMATRICULATION,
+ query2.addEquals("C2." + Contact.BOAT + "." + Boat.IMMATRICULATION,
immatriculation);
// Ajout d'une condition sur le navire dans la première requête
- query1.add("C." + Contact.BOAT + " = C2." + Contact.BOAT);
+ query1.addWhere("C." + Contact.BOAT + " = C2." + Contact.BOAT);
}
// Utilisation de la première requête comme sous-requête
- query2.add("C2." + Contact.CREATION_DATE + " = (" + query1.fullQuery() + ")");
- // Ajout des paramètres nécessaires de la première requête dans la deuxième
- query2.addParams(query1.getParams());
+ query2.addSubQuery("C2." + Contact.CREATION_DATE + " = (?)", query1);
La requête sous forme HQL ::
@@ -283,10 +307,10 @@
AND C.boat = C2.boat);
Attention
- Il ne faut pas utiliser la méthode add(String str, Object value) pour
+ Il ne faut pas utiliser la méthode addEquals(String str, Object value) pour
une comparaison entre deux propriétés comme précédemment :
- *query1.add("C." + Contact.BOAT + " = C2." + Contact.BOAT)*.
- L'appel *query1.add("C." + Contact.BOAT, "C2." + Contact.BOAT)* ne
+ *query1.addWhere("C." + Contact.BOAT + " = C2." + Contact.BOAT)*.
+ L'appel *query1.addEquals("C." + Contact.BOAT, "C2." + Contact.BOAT)* ne
fonctionnera pas comme souhaité.
Résultats
@@ -380,4 +404,78 @@
Note
Les aggrégats renvoient principalement un type Long et non Integer.
+Chargement des donnees
+----------------------
+Généralement une fois la requête exécuté, la transaction utilisé est directement
+fermé (topiaContext.closeContext()). Dans ce cas, il est souvent nécessaire de
+charger certaines entités pour éviter les malencontreuses LazyException d'Hibernate.
+Plusieurs possibilités s'offrent à vous :
+
+Chargement automatique
+~~~~~~~~~~~~~~~~~~~~~~
+
+Hibernate permet de déclarer explicitement que certaines relations doivent se
+charger dès la récupération des entités. Il faut pour cela utiliser le tagValue
+*lazy* dans le fichier de properties du modèle. Par exemple pour charger
+le navire associé à chaque contact récupéré via une requête, il faut préciser ::
+
+ myapp.entity.Contact.attribute.boat.tagvalue.lazy=false
+
+Ainsi chaque contact récupéré aura automatiquement son navire associé de chargé.
+
+**Attention** cependant, il ne faut pas abuser du tagvalue *lazy* car sinon Hibernate
+risque de charger une bonne partie de votre base de données à chaque fois, ce qui
+peut s'avérer extrêment coûteux. Cette utilisation doit être limitée au cas d'une
+simple association comme c'est ici le cas, le Boat chargé étant **indispensable**
+à l'utilisation du Contact.
+
+Chargement manuelle
+~~~~~~~~~~~~~~~~~~~
+
+La TopiaQuery fournit deux méthodes intéressantes pour le chargement manuelle :
+
+ - addLoad(String...) : permet de charger les relations une fois la requête
+ exécutée.
+
+ - addFetch(String...) : permet de charger les relations directement au moment
+ de la requête en utilisant une jointure et le mot clé 'FETCH' Hql.
+
+Le addLoad est pour le moment limité à des relations unitaires (autant que votre
+modèle vous le permet, ex : entityA.entityB.entityC) ou à une seule relation
+multiple directe ou indirecte (entityA.entitiesB). Si nous prenons le cas du
+modèle d'exemple, il est possible de charger le navire associé aux contacts en
+utilisant : queryContact.addLoad(Contact.BOAT);
+
+Dans le cas du addLoad, plusieurs requêtes seront exécutés suivant le nombre
+de Contact résultats. Il est dans ce cas plus judicieux d'utiliser le addFetch
+qui chargera directement les Boat au moment de la récupération des Contact :
+queryContact.addFetch(Contact.BOAT); L'alias peut s'avérer indispensable pour
+l'utilisation du addFetch, voir la javadoc pour l'utilisation des arguments.
+
+Note
+ Les méthodes de jointures permettent de faire un fetch directement :
+ addJoin(String property, String alias, boolean fetch);
+ Voir la partie de la documentation concernant le FROM de la requête.
+
+Attention
+ Hibernate ne supporte pas plus de 3 ou 4 jointures suivant leurs complexités !
+ Il est donc important de limiter l'utilisation des fetch aux cas simples.
+
+Que choisir ?
+~~~~~~~~~~~~~
+
+- Relation unitaire (N-1) obligatoire : utiliser le tagValue *lazy*
+
+- Requête relativement simple (moins de deux jointures) : utiliser le addFetch
+
+- Requête complexe : utiliser le addLoad
+
+- Si addLoad non utilisable (trop de chargement de collections) : effectuer un
+ chargement manuelle en parcourant les résultats. Pour le chargement d'une
+ entité simple, il suffit d'utiliser le getter correspondant pour la charger,
+ tandis que pour une collection, l'appel à la méthode size permet de charger
+ l'intégralité des éléments.
+
+
+
1
0
r2012 - trunk/topia-persistence/src/main/java/org/nuiton/topia/framework
by fdesbois@users.nuiton.org 14 Jun '10
by fdesbois@users.nuiton.org 14 Jun '10
14 Jun '10
Author: fdesbois
Date: 2010-06-14 16:21:58 +0200 (Mon, 14 Jun 2010)
New Revision: 2012
Url: http://nuiton.org/repositories/revision/topia/2012
Log:
- Manage case of alias null
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-14 09:13:07 UTC (rev 2011)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-14 14:21:58 UTC (rev 2012)
@@ -384,7 +384,7 @@
* @return the TopiaQuery
*/
public TopiaQuery setFrom(Class<? extends TopiaEntity> mainEntityClass) {
- from = new StringBuilder(" FROM ").append(mainEntityClass.getName());
+ setFrom(mainEntityClass, null);
return this;
}
@@ -398,9 +398,11 @@
*/
public TopiaQuery setFrom(Class<? extends TopiaEntity> mainEntityClass,
String alias) {
- setFrom(mainEntityClass);
+ from = new StringBuilder(" FROM ").append(mainEntityClass.getName());
mainAlias = alias;
- from.append(' ').append(alias);
+ if (StringUtils.isNotEmpty(mainAlias)) {
+ from.append(' ').append(alias);
+ }
return this;
}
1
0
14 Jun '10
Author: tchemit
Date: 2010-06-14 11:13:07 +0200 (Mon, 14 Jun 2010)
New Revision: 2011
Url: http://nuiton.org/repositories/revision/topia/2011
Log:
add headers
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java
trunk/topia-persistence/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.event;
/**
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/EntityFilter.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.framework;
import java.beans.PropertyChangeListener;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFilter.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.framework;
import org.apache.commons.lang.StringUtils;
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
/* *##%
* ToPIA :: Persistence
* Copyright (C) 2004 - 2009 CodeLutin
Modified: trunk/topia-persistence/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topiatest/ExtraDAOEntityDAOImpl.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Persistence
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topiatest;
import org.nuiton.topia.TopiaException;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
import java.lang.reflect.Array;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
import org.nuiton.topia.persistence.TopiaEntity;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
import java.util.ArrayList;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
import java.util.ArrayList;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration;
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2010-06-13 18:18:35 UTC (rev 2010)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2010-06-14 09:13:07 UTC (rev 2011)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * ToPIA :: Service Migration
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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%
+ */
package org.nuiton.topia.migration.mappings;
import org.apache.commons.logging.Log;
1
0
Author: tchemit
Date: 2010-06-13 20:18:35 +0200 (Sun, 13 Jun 2010)
New Revision: 2010
Url: http://nuiton.org/repositories/revision/topia/2010
Log:
replace since 2.4 by 2.3.4
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaTransactionEvent.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/InterfaceTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/DatabaseManager.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationCallback.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationEngine.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationService.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallback.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationServiceImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/callback/MigrationCallbackHandler.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ExceptionAttributeUndefined.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapter.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterAdmin.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClass.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClassMapped.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClass.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClassMapped.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/BaseException.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationAdapter.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationHelper.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/DependenciesHelper.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/NullMigrationClass.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ObjectNotFound.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/Transformer.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/AbstractMigration.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/FinderMigration.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MapHelper.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/Migration.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationClass.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationNull.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaContextAdapter.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -7,7 +7,7 @@
* without to have to implements all methods.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
+ * @since 2.3.4
*/
public class TopiaContextAdapter implements TopiaContextListener {
@Override
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaTransactionEvent.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaTransactionEvent.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/event/TopiaTransactionEvent.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -99,7 +99,7 @@
/**
* @return the source context that fires the event
- * @deprecated since 2.4, prefer the overriden {@link #getSource()}.
+ * @deprecated since 2.3.4, prefer the overriden {@link #getSource()}.
*/
@Deprecated
public TopiaContext getTopiaContext() {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -122,7 +122,7 @@
/**
* @return a collection of {@link TopiaService}
- * @deprecated since 2.4 : useless method, use {@link #getServices()} instead
+ * @deprecated since 2.3.4 : useless method, use {@link #getServices()} instead
*/
@Deprecated
Collection<TopiaService> getAllServices();
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -272,7 +272,7 @@
protected String mainAlias;
/**
- * @deprecated since 2.4 : need calling right execute method directly from
+ * @deprecated since 2.3.4 : need calling right execute method directly from
* DAO
*/
@Deprecated
@@ -351,7 +351,7 @@
* added to the select part of the query if it is needed.
*
* @param dao DAO linked to the entity to threat
- * @deprecated since 2.4 : instantiate the query from DAO {@link
+ * @deprecated since 2.3.4 : instantiate the query from DAO {@link
* TopiaDAO#createQuery()}
*/
@Deprecated
@@ -367,7 +367,7 @@
*
* @param dao DAO linked to the entity to threat
* @param alias of the main entity in the query
- * @deprecated since 2.4 : instantiate the query from DAO {@link
+ * @deprecated since 2.3.4 : instantiate the query from DAO {@link
* TopiaDAO#createQuery(String)}
*/
@Deprecated
@@ -413,7 +413,7 @@
* @see #addFrom(Class, String)
* @see #addJoin(String, String, boolean)
* @see #addLeftJoin(String, String, boolean)
- * @deprecated since 2.4 use correct addFrom or addJoin or addLeftJoin
+ * @deprecated since 2.3.4 use correct addFrom or addJoin or addLeftJoin
*/
@Deprecated
public TopiaQuery addFrom(String str) {
@@ -428,7 +428,7 @@
* @param separator The separator to use before adding the element (if null
* the {@link #FROM_SEPARATOR_DEFAULT} will be used).
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
protected TopiaQuery addFrom(String separator, String property, String alias) {
if (!separator.equals(FROM_SEPARATOR_DEFAULT)) {
@@ -454,7 +454,7 @@
* @param fetch Add FETCH keyword to load the property in result (avoid
* lazy initialization)
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addJoin(String property, String alias, boolean fetch) {
return addFromJoin(FROM_SEPARATOR_JOIN, property, alias, fetch);
@@ -474,7 +474,7 @@
* @param fetch Add FETCH keyword to load the property in result (avoid
* lazy initialization)
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addLeftJoin(String property, String alias, boolean fetch) {
return addFromJoin(FROM_SEPARATOR_LEFT_JOIN, property, alias, fetch);
@@ -673,7 +673,7 @@
/**
* @param where
* @return TopiaQuery
- * @deprecated since 2.4, use {@link #addWhere(String)} instead
+ * @deprecated since 2.3.4, use {@link #addWhere(String)} instead
*/
@Deprecated
public TopiaQuery add(String where) {
@@ -686,7 +686,7 @@
*
* @param where element to add
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addWhere(String where) {
if (StringUtils.isEmpty(where)) {
@@ -714,7 +714,7 @@
* @param constraint
* @param paramValue
* @return TopiaQuery
- * @deprecated since 2.4, use {@link #addWhere(String, Op, Object)} instead
+ * @deprecated since 2.3.4, use {@link #addWhere(String, Op, Object)} instead
*/
@Deprecated
public TopiaQuery add(String paramName, Op constraint, Object paramValue) {
@@ -736,7 +736,7 @@
* @param paramValue the value of the parameter (an other entity, a String,
* ...)
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addWhere(String paramName, Op operator, Object paramValue) {
StringBuilder result = new StringBuilder(paramName).append(' ');
@@ -773,7 +773,7 @@
* @param paramValue
* @return TopiaQuery
* @since 2.3.1
- * @deprecated since 2.4, use {@link #addEquals(String, Object...)} instead
+ * @deprecated since 2.3.4, use {@link #addEquals(String, Object...)} instead
*/
public TopiaQuery add(String paramName, Object... paramValue) {
return addEquals(paramName, paramValue);
@@ -793,7 +793,7 @@
* @param paramValue values of the parameter
* @return the TopiaQuery
* @see TopiaQuery#addWhere(String, Op, Object)
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addEquals(String paramName, Object... paramValue) {
if (paramValue == null) {
@@ -847,7 +847,7 @@
/**
* @param properties
* @return TopiaQuery
- * @deprecated since 2.4 use {@link #addEquals(Map)}
+ * @deprecated since 2.3.4 use {@link #addEquals(Map)}
*/
@Deprecated
public TopiaQuery add(Map<String, Object> properties) {
@@ -862,7 +862,7 @@
*
* @param properties to add to the query
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addEquals(Map<String, Object> properties) {
for (String key : properties.keySet()) {
@@ -962,7 +962,7 @@
* @param elementProperty contains in containerProperty collection
* @param containerProperty collection which contains elementProperty
* @return the TopiaQuery
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addInElements(String elementProperty, String containerProperty) {
StringBuilder builder = new StringBuilder(elementProperty).
@@ -989,7 +989,7 @@
* @param subquery existing topiaQuery as subquery
* @return the TopiaQuery
* @see TopiaQuery#getValueName(String)
- * @since 2.4
+ * @since 2.3.4
*/
public TopiaQuery addSubQuery(String queryPart,
TopiaQuery subquery) {
@@ -1295,7 +1295,7 @@
* @return a List of results
* @throws TopiaException for error during execution
* @see #execute(TopiaContext)
- * @deprecated since 2.4, need transaction, use {@link #execute(TopiaContext)}
+ * @deprecated since 2.3.4, need transaction, use {@link #execute(TopiaContext)}
*/
@Deprecated
public List execute() throws TopiaException {
@@ -1458,7 +1458,7 @@
* @return an Object
* @throws TopiaException for error on query execution
* @see #executeToObject(TopiaContext, String)
- * @deprecated since 2.4, need transaction, use {@link #executeToObject(TopiaContext,
+ * @deprecated since 2.3.4, need transaction, use {@link #executeToObject(TopiaContext,
* String)}
*/
@Deprecated
@@ -1490,7 +1490,7 @@
* @return an Integer
* @throws TopiaException for error on query execution
* @see #executeToInteger(TopiaContext, String)
- * @deprecated since 2.4, need transaction, use {@link #executeToInteger(TopiaContext,
+ * @deprecated since 2.3.4, need transaction, use {@link #executeToInteger(TopiaContext,
* String)}
*/
@Deprecated
@@ -1521,7 +1521,7 @@
* @return a String result
* @throws TopiaException for error on query execution
* @see #executeToString(TopiaContext, String)
- * @deprecated since 2.4, need transaction, use {@link #executeToString(TopiaContext,
+ * @deprecated since 2.3.4, need transaction, use {@link #executeToString(TopiaContext,
* String)}
*/
@Deprecated
@@ -1568,7 +1568,7 @@
* @return an int corresponding to the number of result in the query
* @throws TopiaException for error on query execution
* @see #executeCount(TopiaContext)
- * @deprecated since 2.4, use {@link TopiaDAO#countByQuery(TopiaQuery)}
+ * @deprecated since 2.3.4, use {@link TopiaDAO#countByQuery(TopiaQuery)}
*/
@Deprecated
public int executeCount() throws TopiaException {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -83,7 +83,7 @@
* </ul>
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
+ * @since 2.3.4
* @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.topia.generator.EntityTransformer"
*/
public class EntityTransformer extends ObjectModelTransformerToJava {
@@ -466,7 +466,7 @@
ObjectModelOperation op = addOperation(output, "update", "void",
ObjectModelModifier.PUBLIC);
addException(op, TopiaException.class);
- setDocumentation(op,"@deprecated since 2.4, use the DAO api instead.");
+ setDocumentation(op,"@deprecated since 2.3.4, use the DAO api instead.");
addAnnotation(output, op, Deprecated.class.getSimpleName());
addAnnotation(output, op, Override.class.getSimpleName());
setOperationBody(op, ""
@@ -477,7 +477,7 @@
op = addOperation(output, "delete", "void", ObjectModelModifier.PUBLIC);
addException(op, TopiaException.class);
- setDocumentation(op,"@deprecated since 2.4, use the DAO api instead.");
+ setDocumentation(op,"@deprecated since 2.3.4, use the DAO api instead.");
addAnnotation(output, op, Deprecated.class.getSimpleName());
addAnnotation(output, op, Override.class.getSimpleName());
setOperationBody(op, ""
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/InterfaceTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/InterfaceTransformer.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/InterfaceTransformer.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -44,7 +44,7 @@
* @author fdesbois <fdesbois(a)codelutin.com>
* @version $Id$
* @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.topia.generator.InterfaceTransformer"
- * @deprecated since 2.4 use {@link org.nuiton.eugene.java.JavaInterfaceTransformer} instead
+ * @deprecated since 2.3.4 use {@link org.nuiton.eugene.java.JavaInterfaceTransformer} instead
*/
@Deprecated
public class InterfaceTransformer extends ObjectModelTransformerToJava {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -83,7 +83,7 @@
public static final String STEREOTYPE_DTO = "dto";
/**
* Stéréotype pour les objets devant être générées sous forme de bean
- * @deprecated since 2.4, prefer use the
+ * @deprecated since 2.3.4, prefer use the
* {@link JavaGeneratorUtil#STEREOTYPE_BEAN} method.
*/
@Deprecated
@@ -115,7 +115,7 @@
public static final String STEREOTYPE_ARRAY = "array";
/**
* dependency to add extra operations for entity dao.
- * @since 2.4
+ * @since 2.3.4
*/
public static final String DEPENDENCIES_DAO = "dao";
/**
@@ -587,7 +587,7 @@
*
* @param attr l'attribut a traiter
* @return le nom de l'attribut de classe d'association
- * @deprecated since 2.4, prefer use the
+ * @deprecated since 2.3.4, prefer use the
* {@link GeneratorUtil#getAssocAttrName(ObjectModelAttribute)}
*/
@Deprecated
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -112,7 +112,7 @@
* si l'une echoué les autres echoue aussi.
*
* @throws TopiaException if any pb while commit
- * @deprecated since 2.4 do nothing in dao implementation generated, not
+ * @deprecated since 2.3.4 do nothing in dao implementation generated, not
* well placed
*/
@Deprecated
@@ -122,7 +122,7 @@
* Appelé lorsque le context a eu un rollback de fait.
*
* @throws TopiaException if any pb while rollback
- * @deprecated since 2.4 do nothing in dao implementation generated, not
+ * @deprecated since 2.3.4 do nothing in dao implementation generated, not
* well placed
*/
@Deprecated
@@ -376,7 +376,7 @@
* @param id unique id of the entity to test existence.
* @return true if entity exists, false otherwise
* @throws TopiaException for Topia errors
- * @since 2.4
+ * @since 2.3.4
*/
boolean existByTopiaId(String id) throws TopiaException;
@@ -390,7 +390,7 @@
* @param others altern propertyName and propertyValue
* @return true if entity exists, false otherwise
* @throws TopiaException for Topia errors
- * @since 2.4
+ * @since 2.3.4
*/
boolean existByProperties(String propertyName, Object propertyValue,
Object... others) throws TopiaException;
@@ -402,7 +402,7 @@
* @param query query used to test existence
* @return true if entity exists, false otherwise
* @throws TopiaException
- * @since 2.4
+ * @since 2.3.4
*/
boolean existByQuery(TopiaQuery query) throws TopiaException;
@@ -411,7 +411,7 @@
*
* @return le nombre total d'entites existantes
* @throws TopiaException if any pb while getting datas
- * @deprecated since 2.4 ambiguous name, use {@link #count()} instead.
+ * @deprecated since 2.3.4 ambiguous name, use {@link #count()} instead.
*/
@Deprecated
long size() throws TopiaException;
@@ -421,7 +421,7 @@
*
* @return number of total entities
* @throws TopiaException if any pb while getting datas
- * @since 2.4
+ * @since 2.3.4
*/
int count() throws TopiaException;
@@ -430,7 +430,7 @@
*
* @return number of entities filtered by the query
* @throws TopiaException if any pb while getting datas
- * @since 2.4
+ * @since 2.3.4
*/
int countByQuery(TopiaQuery query) throws TopiaException;
@@ -466,7 +466,7 @@
* @param properties les proprietes a utiliser
* @return l'entité trouvé
* @throws TopiaException if any pb while getting datas
- * @deprecated since 2.4 strange method, not very useful, use {@link
+ * @deprecated since 2.3.4 strange method, not very useful, use {@link
* TopiaQuery} instead
*/
@Deprecated
@@ -482,7 +482,7 @@
* @param others les secondes valeurs ) tester
* @return l'entité trouvé
* @throws TopiaException if any pb while getting datas
- * @deprecated since 2.4 strange method, not very useful, use {@link
+ * @deprecated since 2.3.4 strange method, not very useful, use {@link
* TopiaQuery} instead
*/
@Deprecated
@@ -496,7 +496,7 @@
* @param properties les propriétés à tester
* @return l'entité trouvé
* @throws TopiaException if any pb while getting datas
- * @deprecated since 2.4 strange method, not very useful, use {@link
+ * @deprecated since 2.3.4 strange method, not very useful, use {@link
* TopiaQuery} instead
*/
@Deprecated
@@ -512,7 +512,7 @@
* @param others les secondes valeurs à tester
* @return l'entité trouvé
* @throws TopiaException if any pb while getting datas
- * @deprecated since 2.4 strange method, not very useful, use {@link
+ * @deprecated since 2.3.4 strange method, not very useful, use {@link
* TopiaQuery} instead
*/
@Deprecated
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -608,7 +608,7 @@
* Count number of existing entities using {@link TopiaQuery#executeCount(TopiaContext)}
*
* @return a long for the number of entities in database
- * @deprecated since 2.4 ambiguous name, use {@link #count()} instead.
+ * @deprecated since 2.3.4 ambiguous name, use {@link #count()} instead.
*/
@Override
@Deprecated
@@ -765,7 +765,7 @@
* @param properties
* @return the list of entities corresponding to the request
* @throws TopiaException if any pb
- * @deprecated since 2.4
+ * @deprecated since 2.3.4
*/
@Override
@Deprecated
@@ -800,7 +800,7 @@
return result;
}
- /** @deprecated since 2.4 */
+ /** @deprecated since 2.3.4 */
@Override
@Deprecated
public List<E> findAllContainsProperties(String propertyName,
@@ -837,7 +837,7 @@
* @param mode le FlushMode du Criteria
* @return le Criteria nouvellement créé
* @throws TopiaException if any pb
- * @deprecated since 2.4 Criteria is no longer used, prefer using {@link
+ * @deprecated since 2.3.4 Criteria is no longer used, prefer using {@link
* TopiaQuery}
*/
@Deprecated
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaEntity.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -139,7 +139,7 @@
* overide it to do something after creation
*
* @throws TopiaException if any pb
- * @deprecated since 2.4 : don't really know is concrete usage, the needed
+ * @deprecated since 2.3.4 : don't really know is concrete usage, the needed
* treatment can be directly done after creating the entity with
* {@link TopiaDAO#create(Object...)}
*/
@@ -148,7 +148,7 @@
/**
* @throws TopiaException if any pb
- * @deprecated since 2.4 : context will no longer be keeped by the entity,
+ * @deprecated since 2.3.4 : context will no longer be keeped by the entity,
* so it will be impossible to do such operation. Use {@link
* TopiaDAO#update(TopiaEntity)} instead.
*/
@@ -157,7 +157,7 @@
/**
* @throws TopiaException if any pb
- * @deprecated since 2.4 : context will no longer be keeped by the entity,
+ * @deprecated since 2.3.4 : context will no longer be keeped by the entity,
* so it will be impossible to do such operation. Use {@link
* TopiaDAO#delete(TopiaEntity)} instead.
*/
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/DatabaseManager.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/DatabaseManager.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/DatabaseManager.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -63,7 +63,7 @@
* @author Eon Sébastien
* @author Trève Vincent
* @version $Revision$
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class DatabaseManager {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationCallback.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationCallback.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationCallback.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -47,7 +47,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @version $Revision$
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationCallback}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationCallback}
*/
@Deprecated
public abstract class ManualMigrationCallback {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationEngine.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationEngine.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/ManualMigrationEngine.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -63,7 +63,7 @@
* Classe principale du projet.
*
* @author tchemit
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class ManualMigrationEngine //extends MigrationServiceImpl
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationService.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationService.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationService.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -38,7 +38,7 @@
* @version $Revision$
*
* Last update : $Date$
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface MigrationService {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceImpl.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -59,7 +59,7 @@
* @author Chevallereau Benjamin
* @author Eon S�bastien
* @author Tr�ve Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class MigrationServiceImpl implements MigrationService {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -27,7 +27,7 @@
/**
* update :
- * @deprecated since 2.4, use the DAO api instead.
+ * @deprecated since 2.3.4, use the DAO api instead.
* @throws TopiaException
*/
@@ -39,7 +39,7 @@
/**
* delete :
- * @deprecated since 2.4, use the DAO api instead.
+ * @deprecated since 2.3.4, use the DAO api instead.
* @throws TopiaException
*/
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallback.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallback.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallback.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -49,7 +49,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @version $Id$
- * @since 2.4
+ * @since 2.3.4
*/
public abstract class TopiaMigrationCallback {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -63,7 +63,7 @@
*
* @author tchemit
* @version $Id$
- * @since 2.4
+ * @since 2.3.4
*/
public class TopiaMigrationEngine implements TopiaMigrationService {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationServiceImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationServiceImpl.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationServiceImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -49,7 +49,7 @@
* @author Chevallereau Benjamin
* @author Eon S�bastien
* @author Tr�ve Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class TopiaMigrationServiceImpl extends MigrationServiceImpl implements TopiaMigrationService, TopiaContextListener, TopiaTransactionVetoable {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/callback/MigrationCallbackHandler.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/callback/MigrationCallbackHandler.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/callback/MigrationCallbackHandler.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -32,7 +32,7 @@
* MigrationCallBackHandler
*
* @author chatellier
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface MigrationCallbackHandler {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ExceptionAttributeUndefined.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ExceptionAttributeUndefined.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ExceptionAttributeUndefined.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -36,7 +36,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class ExceptionAttributeUndefined extends Exception {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapter.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapter.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapter.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -39,7 +39,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface MapAdapter {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterAdmin.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterAdmin.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterAdmin.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -40,7 +40,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface MapAdapterAdmin extends MapAdapter {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterImpl.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/MapAdapterImpl.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -44,7 +44,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class MapAdapterImpl implements MapAdapter, MapAdapterAdmin {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClass.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClass.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClass.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -36,7 +36,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface ProxyClass {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClassMapped.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClassMapped.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/ProxyClassMapped.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -39,7 +39,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface ProxyClassMapped {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClass.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClass.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClass.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -36,7 +36,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class SimpleProxyClass implements ProxyClass {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClassMapped.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClassMapped.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/common/SimpleProxyClassMapped.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -37,7 +37,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class SimpleProxyClassMapped implements ProxyClassMapped {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/BaseException.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/BaseException.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/BaseException.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -34,7 +34,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class BaseException extends Exception {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationAdapter.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationAdapter.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationAdapter.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -67,7 +67,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class ConfigurationAdapter {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationHelper.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationHelper.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ConfigurationHelper.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -61,7 +61,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class ConfigurationHelper {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/DependenciesHelper.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/DependenciesHelper.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/DependenciesHelper.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -59,7 +59,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class DependenciesHelper {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/NullMigrationClass.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/NullMigrationClass.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/NullMigrationClass.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -37,7 +37,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class NullMigrationClass extends MigrationClass {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ObjectNotFound.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ObjectNotFound.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/ObjectNotFound.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -34,7 +34,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class ObjectNotFound extends Exception {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/Transformer.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/Transformer.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/kernel/Transformer.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -56,7 +56,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class Transformer implements MapHelper {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -25,7 +25,7 @@
* TMSVersion DAO helper.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 2.4
+ * @since 2.3.4
*/
public class TMSVersionDAO {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/AbstractMigration.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/AbstractMigration.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/AbstractMigration.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -38,7 +38,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public abstract class AbstractMigration implements Migration {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/FinderMigration.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/FinderMigration.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/FinderMigration.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -38,7 +38,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class FinderMigration {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MapHelper.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MapHelper.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MapHelper.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -42,7 +42,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface MapHelper {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/Migration.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/Migration.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/Migration.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -38,7 +38,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public interface Migration {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationClass.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationClass.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationClass.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -37,7 +37,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class MigrationClass implements Comparable<MigrationClass> {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationNull.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationNull.java 2010-06-13 17:48:26 UTC (rev 2009)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/transformation/MigrationNull.java 2010-06-13 18:18:35 UTC (rev 2010)
@@ -35,7 +35,7 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @deprecated since 2.3.4, please use now the simplify service {@link TopiaMigrationEngine}
*/
@Deprecated
public class MigrationNull extends AbstractMigration {
1
0
r2009 - in trunk/topia-service-migration: . src/main/java/org/nuiton/topia/migration src/main/java/org/nuiton/topia/migration/mappings src/main/resources/org/nuiton/topia/migration src/main/resources/org/nuiton/topia/migration/mappings
by tchemit@users.nuiton.org 13 Jun '10
by tchemit@users.nuiton.org 13 Jun '10
13 Jun '10
Author: tchemit
Date: 2010-06-13 19:48:26 +0200 (Sun, 13 Jun 2010)
New Revision: 2009
Url: http://nuiton.org/repositories/revision/topia/2009
Log:
finalize migration of migration service (no more generation (all stuff was pushed back to source and will disappear soon)
Added:
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/TMSVersionImpl.hbm.xml
Modified:
trunk/topia-service-migration/pom.xml
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationService.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersion.java
trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/mappings/TMSVersion.hbm.xml
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2010-06-13 17:30:39 UTC (rev 2008)
+++ trunk/topia-service-migration/pom.xml 2010-06-13 17:48:26 UTC (rev 2009)
@@ -102,12 +102,12 @@
<resources>
- <resource>
+ <!--resource>
<directory>${maven.gen.dir}/java</directory>
<includes>
<include>**/*.hbm.xml</include>
</includes>
- </resource>
+ </resource-->
<resource>
<directory>${maven.src.dir}/main/resources</directory>
@@ -121,7 +121,7 @@
<plugins>
- <plugin>
+ <!--plugin>
<groupId>org.nuiton.eugene</groupId>
<artifactId>maven-eugene-plugin</artifactId>
<executions>
@@ -146,7 +146,7 @@
<scope>compile</scope>
</dependency>
</dependencies>
- </plugin>
+ </plugin-->
<plugin>
<groupId>org.nuiton.i18n</groupId>
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,267 @@
+package org.nuiton.topia.migration;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaEntityEnum;
+
+@Deprecated
+public class MigrationServiceDAOHelper {
+
+
+
+ public enum MigrationServiceEntityEnum implements TopiaEntityEnum {
+
+ TMSVersion(TMSVersion.class);
+ /**
+ * the contract of the entity
+ */
+ protected Class<? extends TopiaEntity> contract;
+ /**
+ * the fully qualified name of the implementation of the entity
+ */
+ protected String implementationFQN;
+ /**
+ * the implementation class of the entity (will be lazy computed at runtime)
+ */
+ protected Class<? extends TopiaEntity> implementation;
+ /**
+ * MigrationServiceEntityEnum :
+ * @param contract
+ */
+
+ MigrationServiceEntityEnum(Class<? extends TopiaEntity > contract) {
+ this.contract = contract;
+ this.implementationFQN = contract.getName()+"Impl";
+ }
+
+ /**
+ * getContract :
+ * @return Class<? extends TopiaEntity>
+ */
+
+ public Class<? extends TopiaEntity> getContract() {
+ return contract;
+ }
+
+ /**
+ * getImplementationFQN :
+ * @return String
+ */
+
+ public String getImplementationFQN() {
+ return implementationFQN;
+ }
+
+ /**
+ * setImplementationFQN :
+ * @param implementationFQN
+ */
+
+ public void setImplementationFQN(String implementationFQN) {
+ this.implementationFQN = implementationFQN;
+ this.implementation = null;
+ }
+
+ /**
+ * accept :
+ * @param klass
+ * @return boolean
+ */
+
+ public boolean accept(Class<? extends TopiaEntity> klass) {
+ return MigrationServiceDAOHelper.getContractClass(klass) == contract;
+ }
+
+ /**
+ * getImplementation :
+ * @return Class<? extends TopiaEntity>
+ */
+
+ public Class<? extends TopiaEntity> getImplementation() {
+ if (implementation == null) {
+ try {
+ implementation = (Class<? extends TopiaEntity>) Class.forName(implementationFQN);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("could not find class " + implementationFQN);
+ }
+ }
+ return implementation;
+ }
+
+ /**
+ * valueOf :
+ * @param entity
+ * @return MigrationServiceEntityEnum
+ */
+
+ public static MigrationServiceEntityEnum valueOf(TopiaEntity entity) {
+ return valueOf(entity.getClass());
+ }
+
+ /**
+ * valueOf :
+ * @param klass
+ * @return MigrationServiceEntityEnum
+ */
+
+ public static MigrationServiceEntityEnum valueOf(Class<?> klass) {
+ if (klass.isInterface()) {
+ return MigrationServiceEntityEnum.valueOf(klass.getSimpleName());
+ }
+ for (MigrationServiceEntityEnum entityEnum : MigrationServiceEntityEnum.values()) {
+ if (entityEnum.getContract().isAssignableFrom(klass)) {
+ //todo check it works for inheritance
+ return entityEnum;
+ }
+ }
+ throw new IllegalArgumentException("no entity defined for the class " + klass + " in : " + Arrays.toString(MigrationServiceEntityEnum.values()));
+ }
+
+
+ } //MigrationServiceEntityEnum
+ /**
+ * MigrationServiceDAOHelper :
+ */
+
+ protected MigrationServiceDAOHelper() { }
+
+ /**
+ * getModelVersion :
+ * @return String
+ */
+
+ public static String getModelVersion() {
+ return "1";
+ }
+
+ /**
+ * getModelName :
+ * @return String
+ */
+
+ public static String getModelName() {
+ return "MigrationService";
+ }
+
+ /**
+ * getTMSVersionDAO :
+ * @param context
+ * @return TMSVersionDAO
+ * @throws TopiaException
+ */
+
+ public static TMSVersionDAO getTMSVersionDAO(TopiaContext context) throws TopiaException {
+ TopiaContextImplementor ci = (TopiaContextImplementor) context;
+ TMSVersionDAO result = (TMSVersionDAO) ci.getDAO(TMSVersion.class);
+ return result;
+ }
+
+ /**
+ * getDAO :
+ * @param context
+ * @param klass
+ * @return <T extends TopiaEntity, D extends TopiaDAO<? super T>> D
+ * @throws TopiaException
+ */
+
+ public static <T extends TopiaEntity, D extends TopiaDAO<? super T>> D getDAO(TopiaContext context, Class<T> klass) throws TopiaException {
+ TopiaContextImplementor ci = (TopiaContextImplementor) context;
+ MigrationServiceEntityEnum constant = MigrationServiceEntityEnum.valueOf(klass);
+ D dao = (D) ci.getDAO(constant.getContract());
+ return dao;
+ }
+
+ /**
+ * getDAO :
+ * @param context
+ * @param entity
+ * @return <T extends TopiaEntity, D extends TopiaDAO<? super T>> D
+ * @throws TopiaException
+ */
+
+ public static <T extends TopiaEntity, D extends TopiaDAO<? super T>> D getDAO(TopiaContext context, T entity) throws TopiaException {
+ TopiaContextImplementor ci = (TopiaContextImplementor) context;
+ MigrationServiceEntityEnum constant = MigrationServiceEntityEnum.valueOf(entity);
+ D dao = (D) ci.getDAO(constant.getContract());
+ return dao;
+ }
+
+ /**
+ * getContractClass :
+ * @param klass
+ * @return <T extends TopiaEntity> Class<T>
+ */
+
+ public static <T extends TopiaEntity> Class<T> getContractClass(Class<T> klass) {
+ MigrationServiceEntityEnum constant = MigrationServiceEntityEnum.valueOf(klass);
+ return (Class<T>) constant.getContract();
+ }
+
+ /**
+ * getImplementationClass :
+ * @param klass
+ * @return <T extends TopiaEntity> Class<T>
+ */
+
+ public static <T extends TopiaEntity> Class<T> getImplementationClass(Class<T> klass) {
+ MigrationServiceEntityEnum constant = MigrationServiceEntityEnum.valueOf(klass);
+ return (Class<T>) constant.getImplementation();
+ }
+
+ /**
+ * getContractClasses :
+ * @return Class<? extends TopiaEntity>[]
+ */
+
+ public static Class<? extends TopiaEntity>[] getContractClasses() {
+ MigrationServiceEntityEnum[] values = MigrationServiceEntityEnum.values();
+ Class<? extends TopiaEntity>[] result = (Class<? extends TopiaEntity>[]) Array.newInstance(Class.class, values.length);
+ for (int i = 0; i < values.length; i++) {
+ result[i] = values[i].getContract();
+ }
+ return result;
+ }
+
+ /**
+ * getImplementationClasses :
+ * @return Class<? extends TopiaEntity>[]
+ */
+
+ public static Class<? extends TopiaEntity>[] getImplementationClasses() {
+ MigrationServiceEntityEnum[] values = MigrationServiceEntityEnum.values();
+ Class<? extends TopiaEntity>[] result = (Class<? extends TopiaEntity>[]) Array.newInstance(Class.class, values.length);
+ for (int i = 0; i < values.length; i++) {
+ result[i] = values[i].getImplementation();
+ }
+ return result;
+ }
+
+ /**
+ * getImplementationClassesAsString :
+ * @return String
+ */
+
+ public static String getImplementationClassesAsString() {
+ StringBuilder buffer = new StringBuilder();
+ for (Class<? extends TopiaEntity> aClass : getImplementationClasses()) {
+ buffer.append(',').append(aClass.getName());
+ }
+ return buffer.substring(1);
+ }
+
+ /**
+ * getContracts :
+ * @return MigrationServiceEntityEnum[]
+ */
+
+ public static MigrationServiceEntityEnum[] getContracts() {
+ return MigrationServiceEntityEnum.values();
+ }
+
+
+ } //MigrationServiceDAOHelper
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/MigrationServiceDAOHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,22 @@
+package org.nuiton.topia.migration;
+
+import org.nuiton.topia.persistence.TopiaEntity;
+
+@Deprecated
+public interface TMSVersion extends TopiaEntity { String VERSION = "version";
+ /**
+ * setVersion :
+ * @param version La valeur de l'attribut version à positionner.
+ */
+
+ void setVersion(String version);
+
+ /**
+ * getVersion :
+ * @return String
+ */
+
+ String getVersion();
+
+
+} //TMSVersion
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersion.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,143 @@
+package org.nuiton.topia.migration;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.persistence.EntityVisitor;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaEntityAbstract;
+
+@Deprecated
+public abstract class TMSVersionAbstract extends TopiaEntityAbstract implements TMSVersion {
+
+ protected String version;
+ /**
+ * getVersion :
+ * @return String
+ */
+
+ public String getVersion() {
+ fireOnPreRead(VERSION, version);
+ java.lang.String result = this.version;
+ fireOnPostRead(VERSION, version);
+ return result;
+}
+
+ /**
+ * update :
+ * @deprecated since 2.4, use the DAO api instead.
+ * @throws TopiaException
+ */
+
+ @Deprecated
+ @Override
+ public void update() throws TopiaException {
+ ((TopiaContextImplementor)getTopiaContext()).getDAO(TMSVersion.class).update(this);
+}
+
+ /**
+ * delete :
+ * @deprecated since 2.4, use the DAO api instead.
+ * @throws TopiaException
+ */
+
+ @Deprecated
+ @Override
+ public void delete() throws TopiaException {
+ ((TopiaContextImplementor)getTopiaContext()).getDAO(TMSVersion.class).delete(this);
+}
+
+ /**
+ * accept :
+ * Envoi via les methodes du visitor l'ensemble des champs de l'entity
+avec leur nom, type et valeur.
+ * @param visitor le visiteur de l'entite.
+ * @throws TopiaException
+ */
+
+ @Override
+ public void accept(EntityVisitor visitor) throws TopiaException {
+ visitor.start(this);
+ visitor.visit(this, VERSION, String.class, version);
+ visitor.end(this);
+}
+
+ /**
+ * getAggregate :
+ * @return List<TopiaEntity>
+ * @throws TopiaException
+ */
+
+ @Override
+ public List<TopiaEntity> getAggregate() throws TopiaException {
+ List<TopiaEntity> tmp = new ArrayList<TopiaEntity>();
+
+ // pour tous les attributs rechecher les composites et les class d'asso
+ // on les ajoute dans tmp
+
+ // on refait un tour sur chaque entity de tmp pour recuperer leur
+ // composite
+ List<TopiaEntity> result = new ArrayList<TopiaEntity>();
+ for (TopiaEntity entity : tmp) {
+ result.add(entity);
+ result.addAll(entity.getAggregate());
+ }
+
+ return result;
+}
+
+ /**
+ * getComposite :
+ * @return List<TopiaEntity>
+ * @throws TopiaException
+ */
+
+ @Override
+ public List<TopiaEntity> getComposite() throws TopiaException {
+ List<TopiaEntity> tmp = new ArrayList<TopiaEntity>();
+
+ // pour tous les attributs rechecher les composites et les class d'asso
+ // on les ajoute dans tmp
+
+ // on refait un tour sur chaque entity de tmp pour recuperer leur
+ // composite
+ List<TopiaEntity> result = new ArrayList<TopiaEntity>();
+ for (TopiaEntity entity : tmp) {
+ if (entity != null) {
+ result.add(entity);
+ result.addAll(entity.getComposite());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * setVersion :
+ * @param value
+ */
+
+ public void setVersion(String value) {
+ String _oldValue = this.version;
+ fireOnPreWrite(VERSION, _oldValue, value);
+ this.version = value;
+ fireOnPostWrite(VERSION, _oldValue, value);
+}
+
+ /**
+ * toString :
+ * @return String
+ */
+
+ @Override
+ public String toString() {
+ String result = new ToStringBuilder(this).
+ append(VERSION, this.version).
+ toString();
+ return result;
+}
+
+
+} //TMSVersionAbstract
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionAbstract.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,8 @@
+package org.nuiton.topia.migration;
+
+
+@Deprecated
+public class TMSVersionDAO extends TMSVersionDAOImpl<TMSVersion> {
+
+
+} //TMSVersionDAO
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAO.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,88 @@
+package org.nuiton.topia.migration;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.persistence.TopiaDAO;
+import org.nuiton.topia.persistence.TopiaDAOImpl;
+import org.nuiton.topia.persistence.TopiaEntity;
+
+@Deprecated
+public abstract class TMSVersionDAOAbstract<E extends TMSVersion> extends TopiaDAOImpl<E> implements TopiaDAO<E> {
+
+ /**
+ * getEntityClass :
+ * @return Class<E>
+ */
+
+ public Class<E> getEntityClass() {
+ return (Class<E>)TMSVersion.class;
+ }
+
+ /**
+ * delete :
+ * @param entity
+ * @throws TopiaException
+ */
+
+ public void delete(E entity) throws TopiaException {
+ super.delete(entity);
+ }
+
+ /**
+ * findByVersion :
+ * Retourne le premier élément trouvé ayant comme valeur pour l'attribut version le paramètre.
+ * @param v
+ * @return E
+ * @throws TopiaException
+ */
+
+ public E findByVersion(String v) throws TopiaException {
+ E result = findByProperty(TMSVersion.VERSION, v);
+ return result;
+ }
+
+ /**
+ * findAllByVersion :
+ * Retourne les éléments ayant comme valeur pour l'attribut version le paramètre.
+ * @param v
+ * @return List<E>
+ * @throws TopiaException
+ */
+
+ public List<E> findAllByVersion(String v) throws TopiaException {
+ List<E> result = findAllByProperty(TMSVersion.VERSION, v);
+ return result;
+ }
+
+ /**
+ * findUsages :
+ * @param type
+ * @param entity
+ * @return <U extends TopiaEntity> List<U>
+ * @throws TopiaException
+ */
+
+ @Override
+ public <U extends TopiaEntity> List<U> findUsages(Class<U> type, E entity) throws TopiaException {
+ return new ArrayList<U>();
+ }
+
+ /**
+ * findAllUsages :
+ * @param entity
+ * @return Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>>
+ * @throws TopiaException
+ */
+
+ @Override
+ public Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity) throws TopiaException {
+ return new HashMap<Class<? extends TopiaEntity>, List<? extends TopiaEntity>>();
+ }
+
+
+} //TMSVersionDAOAbstract<E extends TMSVersion>
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOAbstract.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,8 @@
+package org.nuiton.topia.migration;
+
+
+@Deprecated
+public class TMSVersionDAOImpl<E extends TMSVersion> extends TMSVersionDAOAbstract<E> {
+
+
+} //TMSVersionDAOImpl<E extends TMSVersion>
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,8 @@
+package org.nuiton.topia.migration;
+
+
+@Deprecated
+public class TMSVersionImpl extends TMSVersionAbstract {
+
+
+} //TMSVersionImpl
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TMSVersionImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java 2010-06-13 17:30:39 UTC (rev 2008)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -29,16 +29,18 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.Configuration;
-import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.event.TopiaContextAdapter;
import org.nuiton.topia.event.TopiaContextEvent;
import org.nuiton.topia.event.TopiaContextListener;
import org.nuiton.topia.event.TopiaTransactionEvent;
import org.nuiton.topia.event.TopiaTransactionVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaUtil;
+import org.nuiton.topia.migration.mappings.TMSVersion;
+import org.nuiton.topia.migration.mappings.TMSVersionDAO;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
import org.nuiton.util.VersionUtil.VersionComparator;
@@ -74,6 +76,12 @@
/** Un drapeau pour savoir si la table version existe en base (initialise en pre-init) */
protected boolean versionTableExist;
+ /** Configuration hibernate ne mappant que l'entite version de l'ancien systeme de migration (initialise en pre-init) */
+ protected Configuration legacyVersionConfiguration;
+
+ /** Un drapeau pour savoir si la table version (de l'ancien service Manual) existe en base (initialise en pre-init) */
+ protected boolean legacyVersionTableExist;
+
/** Version courante de la base (initialise en pre-init) */
protected Version dbVersion;
@@ -92,6 +100,13 @@
/** Un drapeau pour savoir si le service a bien ete initialise (i.e a bien fini la methode preInit) */
protected boolean init;
+ /**
+ * A flag to check if version was detected in database.
+ * <p/>
+ * This flag is set to {@code true} at the end of method {@link #detectDbVersion()}.
+ */
+ protected boolean versionDetected;
+
/** Un drapeau pour afficher les requetes sql executees */
protected boolean showSql;
@@ -99,18 +114,66 @@
protected boolean showProgression;
/** delegate context listener. */
- protected TopiaContextListener contextListener;
+ protected final TopiaContextListener contextListener;
/** delgate transaction listener */
- protected TopiaTransactionVetoable transactionVetoable;
+ protected final TopiaTransactionVetoable transactionVetoable;
+ public TopiaMigrationEngine() {
+
+ transactionVetoable = new TopiaTransactionVetoable() {
+ @Override
+ public void beginTransaction(TopiaTransactionEvent event) {
+
+ TopiaContextImplementor context =
+ (TopiaContextImplementor) event.getSource();
+
+ // add topia context listener
+ context.addTopiaContextListener(contextListener);
+
+ }
+ };
+ contextListener = new TopiaContextAdapter() {
+
+ @Override
+ public void postCreateSchema(TopiaContextEvent event) {
+ if (log.isDebugEnabled()) {
+ log.debug("postCreateSchema event called : will save version in database");
+ }
+ saveApplicationVersion();
+ }
+
+ @Override
+ public void postUpdateSchema(TopiaContextEvent event) {
+ if (log.isDebugEnabled()) {
+ log.debug("postUpdateSchema event called : will save version in database");
+ }
+ saveApplicationVersion();
+ }
+
+ @Override
+ public void postRestoreSchema(TopiaContextEvent event) {
+ if (log.isDebugEnabled()) {
+ log.debug("postRestoreSchema event detected, redo, schema migration");
+ }
+ try {
+ doMigrateSchema();
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("postRestoreSchema schema migration failed for reason " + e.getMessage(), e);
+ }
+ }
+ }
+ };
+ }
+
//--------------------------------------------------------------------------
//-- TopiaService implementation
//--------------------------------------------------------------------------
@Override
public Class<?>[] getPersistenceClasses() {
- return new Class<?>[]{TMSVersionImpl.class};
+ return new Class<?>[]{TMSVersion.class};
}
@Override
@@ -154,27 +217,21 @@
// creation de la configuration hibernate ne concernant que l'entite Version
// afin de pouvoir creer la table via un schemaExport si necessaire
- versionConfiguration = new Configuration();
+ Configuration configuration = new Configuration();
+ configuration.addXML(TMSVersionDAO.MAPPING);
- for (Class<?> clazz : getPersistenceClasses()) {
- if (log.isDebugEnabled()) {
- log.debug("addClass " + clazz);
- }
- versionConfiguration.addClass(clazz);
- }
+ versionConfiguration = creaHibernateConfiguration(configuration);
- Properties prop = new Properties();
- prop.putAll(versionConfiguration.getProperties());
- prop.putAll(config);
-
- versionConfiguration.setProperties(prop);
-
init = true;
// add topia context listener
- context.addTopiaContextListener(getContextListener());
- context.addTopiaTransactionVetoable(getTransactionVetoable());
+ context.addTopiaContextListener(contextListener);
+ context.addTopiaTransactionVetoable(transactionVetoable);
+ if (log.isDebugEnabled()) {
+ log.debug("Service [" + this + "] is init.");
+ }
+
if (migrateOnInit) {
try {
@@ -188,15 +245,15 @@
}
} else {
if (log.isDebugEnabled()) {
- log.debug("migration service, skip migration on init");
+ log.debug("Service [" + this + "] skip migration on init as required");
}
}
-
return true;
}
@Override
public boolean postInit(TopiaContextImplementor context) {
+ // nothing to do in post-init
return true;
}
@@ -211,35 +268,38 @@
}
}
+ //--------------------------------------------------------------------------
+ //-- TopiaMigrationService implementation
+ //--------------------------------------------------------------------------
+
@Override
public boolean migrateSchema() throws MigrationServiceException {
checkInit();
- if (dbVersion == null || !migrateOnInit) {
+ detectDbVersion();
- // no db version was setted or service was not init on int
- // force detection of version to be safe
- if (log.isDebugEnabled()) {
- log.debug("Will detects db version...");
- }
- detectDbVersion();
- }
+// if (dbVersion == null || !migrateOnInit) {
+//
+// // no db version was setted or service was not init on int
+// // force detection of version to be safe
+// if (log.isDebugEnabled()) {
+// log.debug("Will detects db version...");
+// }
+// detectDbVersion();
+// }
- Version applicationVersion = callback.getApplicationVersion();
+ Version version = callback.getApplicationVersion();
- log.info(_("topia.migration.start.migration", applicationVersion.getVersion(), dbVersion.getVersion()));
+ log.info(_("topia.migration.start.migration", version.getVersion(), dbVersion.getVersion()));
- // tell if migration is needed
- boolean bMigrationNeeded = false;
-
if (log.isDebugEnabled()) {
- log.debug("Migrate schema start version = " + dbVersion +
- " _ not versioned = " + dbNotVersioned +
- " _ TMSVersion exists = " + versionTableExist);
+ log.debug("Migrate schema to version = " + dbVersion);
+ log.debug("is db not versionned ? = " + dbNotVersioned);
+ log.debug("TMSVersion exists = " + versionTableExist);
}
- if (versionTableExist && dbVersion.equals(applicationVersion)) {
+ if (versionTableExist && dbVersion.equals(version)) {
log.info(_("topia.migration.skip.migration.db.is.up.to.date"));
// la base est a jour
return true;
@@ -254,18 +314,31 @@
return true;
}
+ if (legacyVersionTableExist && dbVersion.equals(version)) {
+
+ // on a trouvee une table depreciee tmsVersion avec la bonne version de base
+ // il suffit donc d'enregister la version dans la nouvelle table
+ log.info(_("topia.migration.skip.migration.db.is.up.to.date"));
+ // la base est a jour mais il faut migrer la table
+ saveApplicationVersion();
+ return true;
+ }
+
SortedSet<Version> allVersions =
new TreeSet<Version>(new VersionComparator());
allVersions.addAll(Arrays.asList(callback.getAvailableVersions()));
log.info(_("topia.migration.available.versions", allVersions));
- if (dbVersion.before(applicationVersion)) {
+ // tell if migration is needed
+ boolean needToMigrate = false;
+ if (dbVersion.before(version)) {
+
// on filtre les versions a appliquer
List<Version> versionsToApply =
VersionUtil.filterVersions(allVersions,
dbVersion,
- applicationVersion,
+ version,
false,
true
);
@@ -275,16 +348,16 @@
} else {
log.info(_("topia.migration.migrate.versions", versionsToApply));
// ask handler for migration
- bMigrationNeeded = callback.doMigration(rootContext,
- dbVersion,
- showSql,
- showProgression,
- versionsToApply);
+ needToMigrate = callback.doMigration(rootContext,
+ dbVersion,
+ showSql,
+ showProgression,
+ versionsToApply);
if (log.isDebugEnabled()) {
- log.debug("Handler choose : " + bMigrationNeeded);
+ log.debug("Handler choose : " + needToMigrate);
}
- if (!bMigrationNeeded) {
+ if (!needToMigrate) {
// l'utilisateur a annule la migration
return false;
}
@@ -292,10 +365,10 @@
}
// on sauvegarde la version si necessaire (base non versionnee ou migration realisee)
- if (!versionTableExist || bMigrationNeeded) {
+ if (!versionTableExist || needToMigrate) {
if (log.isDebugEnabled()) {
- log.debug("Set application version in database to " + applicationVersion);
+ log.debug("Set application version in database to " + version);
}
// put version in database and create table if required
@@ -308,25 +381,28 @@
return true;
}
+ //--------------------------------------------------------------------------
+ //-- Internal methods
+ //--------------------------------------------------------------------------
+
/**
* Enregistre la version donnee en base avec creation de la table
* si elle n'existe pas.
*/
- public void saveApplicationVersion() {
+ protected void saveApplicationVersion() {
checkInit();
Version version = callback.getApplicationVersion();
+ detectDbVersion();
+
if (log.isDebugEnabled()) {
- log.debug("Save version = " + version +
- " _ table exists = " + versionTableExist);
+ log.debug("Save version = " + version);
+ log.debug("table exists = " + versionTableExist);
+ log.debug("Detected version = " + dbVersion);
}
- if (dbVersion == null) {
- detectDbVersion();
- }
-
try {
boolean createTable = !versionTableExist;
@@ -336,36 +412,34 @@
// si la base n'etait pas versionnee, la table version n'existe pas
// creation
if (log.isDebugEnabled()) {
- log.debug("Adding table to put version");
+ log.debug("Adding tms_version table");
}
// creer le schema en base
// dans la configuration versionConfiguration, il n'y a que la table version
- SchemaExport schemaExport = new SchemaExport(versionConfiguration);
- schemaExport.create(log.isDebugEnabled(), true);
+ TMSVersionDAO.createTable(versionConfiguration);
if (log.isDebugEnabled()) {
log.debug("Table for " + TMSVersion.class.getSimpleName() + " created");
}
+ }
- }
- // Changement de la version en base
+ // Set new version in database
TopiaContext tx = rootContext.beginTransaction();
try {
- TMSVersionDAO dao = MigrationServiceDAOHelper.getTMSVersionDAO(tx);
+ // delete all previous data in table
+ TMSVersionDAO.deleteAll(tx);
- //FIXME on supprime toues les versions precedentes ???
- //FIXME il serait mieux de conserver toutes les versions je pense...
- //FIXME on pourrait conserver l'information sur les date de mise a jour
- List<TMSVersion> toDelete = dao.findAll();
- for (TMSVersion v : toDelete) {
- dao.delete(v);
+ log.info(_("topia.migration.saving.db.version", version));
+
+ // create new version and store it in table
+ TMSVersion tmsVersion =
+ TMSVersionDAO.create(tx, version.getVersion());
+ if (log.isDebugEnabled()) {
+ log.debug("Created version : " + tmsVersion.getVersion());
}
- log.info(_("topia.migration.saving.db.version", version));
- dao.create(TMSVersion.VERSION, version.getVersion());
-
tx.commitTransaction();
} catch (TopiaException e) {
if (tx != null) {
@@ -377,6 +451,15 @@
tx.closeContext();
}
}
+
+ if (legacyVersionTableExist) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Will drop legacy tmsVersion table");
+ }
+ // on supprime l'ancienne table
+ TMSVersionDAO.dropTable(legacyVersionConfiguration);
+ }
} catch (TopiaException e) {
throw new TopiaRuntimeException(e);
}
@@ -388,128 +471,106 @@
dbVersion = version;
}
+ /**
+ * Recupere depuis la base les états internes du service :
+ * <p/>
+ * <ul>
+ * <li>versionTableExist</li>
+ * <li>dbVersion</li>
+ * </ul>
+ */
+ protected void detectDbVersion() {
- protected TopiaContextListener getContextListener() {
- if (contextListener == null) {
- contextListener = new TopiaContextListener() {
- @Override
- public void preCreateSchema(TopiaContextEvent event) {
- }
+ if (versionDetected) {
- @Override
- public void postCreateSchema(TopiaContextEvent event) {
- if (log.isDebugEnabled()) {
- log.debug("postCreateSchema event called : will save version in database");
- }
+ // this method was already invoked
+ if (log.isDebugEnabled()) {
+ log.debug("version was already detected : " + dbVersion);
+ }
+ return;
+ }
- saveApplicationVersion();
- }
+ Version v = null;
+ try {
- @Override
- public void preUpdateSchema(TopiaContextEvent event) {
+ // on detecte si la table de versionning existe
+ versionTableExist =
+ TopiaUtil.isSchemaExist(versionConfiguration,
+ TMSVersion.class.getName());
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Table " + TMSVersionDAO.TABLE_NAME + " exist = " + versionTableExist);
+ }
- @Override
- public void postUpdateSchema(TopiaContextEvent event) {
- if (log.isDebugEnabled()) {
- log.debug("postUpdateSchema event called : will save version in database");
- }
+ if (versionTableExist) {
- saveApplicationVersion();
- }
+ // recuperation de la version de la base
+ v = getVersion(versionTableExist, TMSVersionDAO.TABLE_NAME);
+ return;
+ }
- @Override
- public void preRestoreSchema(TopiaContextEvent event) {
- }
+ // try with legacy table tmsVersion
+ Configuration conf = new Configuration();
+ conf.addXML(TMSVersionDAO.LEGACY_MAPPING);
- @Override
- public void postRestoreSchema(TopiaContextEvent event) {
- if (log.isDebugEnabled()) {
- log.debug("postRestoreSchema event detected, redo, schema migration");
- }
- try {
+ legacyVersionConfiguration = creaHibernateConfiguration(conf);
+ legacyVersionTableExist =
+ TopiaUtil.isSchemaExist(legacyVersionConfiguration,
+ TMSVersion.class.getName());
- doMigrateSchema();
+ if (legacyVersionTableExist) {
- } catch (Exception e) {
- if (log.isErrorEnabled()) {
- log.error("postRestoreSchema schema migration failed for reason " + e.getMessage(), e);
- }
- }
+ if (log.isDebugEnabled()) {
+ log.debug("Legacy : detected " + TMSVersionDAO.LEGACY_TABLE_NAME + " table");
}
- };
- }
- return contextListener;
- }
- protected TopiaTransactionVetoable getTransactionVetoable() {
- if (transactionVetoable == null) {
- transactionVetoable = new TopiaTransactionVetoable() {
- @Override
- public void beginTransaction(TopiaTransactionEvent event) {
+ // recuperation de la version de la base
+ v = getVersion(legacyVersionTableExist, TMSVersionDAO.LEGACY_TABLE_NAME);
- TopiaContextImplementor context = (TopiaContextImplementor) event.getSource();
+ if (v != null) {
- // add topia context listener
- context.addTopiaContextListener(contextListener);
+ if (log.isDebugEnabled()) {
+ log.debug("Legacy : " + _("topia.migration.detected.db.version", v));
+ }
+ }
+ }
+ } finally {
- }
- };
+ if (v == null) {
+ // la base dans ce cas n'est pas versionee.
+ // On dit que la version de la base est 0
+ // et les schema de cette version 0 doivent
+ // etre detenu en local
+ v = Version.VZERO;
+ dbNotVersioned = true;
+ log.info(_("topia.migration.db.not.versionned"));
+ } else {
+ log.info(_("topia.migration.detected.db.version", v));
+ }
+ dbVersion = v;
+ versionDetected = true;
}
- return transactionVetoable;
}
- /**
- * Recupere depuis la base les états internes du service :
- * <p/>
- * <ul>
- * <li>versionTableExist</li>
- * <li>dbVersion</li>
- * </ul>
- */
- protected void detectDbVersion() {
+ protected Version getVersion(boolean versionTableExist, String tableName) {
+ if (!versionTableExist) {
- // on detecte si la table de versionning existe
- versionTableExist = TopiaUtil.isSchemaExist(versionConfiguration, TMSVersionImpl.class.getName());
-
- if (log.isDebugEnabled()) {
- log.debug("Table TMSVersion exist = " + versionTableExist);
+ // table does not exist, version is null
+ return null;
}
- // recuperation de la version de la base
- Version v = null;
try {
- if (versionTableExist) {
- TopiaContext tx = null;
- try {
- tx = rootContext.beginTransaction();
- TMSVersionDAO dao = MigrationServiceDAOHelper.getTMSVersionDAO(tx);
- List<TMSVersion> versionsInDB = dao.findAll();
- if (!versionsInDB.isEmpty()) {
- v = VersionUtil.valueOf(versionsInDB.get(0).getVersion());
- }
- } finally {
- if (tx != null) {
- tx.closeContext();
- }
+ TopiaContext tx = rootContext.beginTransaction();
+ try {
+ Version v = TMSVersionDAO.getVersion(tx, tableName);
+ return v;
+ } finally {
+ if (tx != null) {
+ tx.closeContext();
}
}
} catch (TopiaException e) {
throw new TopiaRuntimeException("Can't obtain dbVersion for reason " + e.getMessage(), e);
}
-
- if (v == null) {
- // la base dans ce cas n'est pas versionee.
- // On dit que la version de la base est 0
- // et les schema de cette version 0 doivent
- // etre detenu en local
- v = Version.VZERO;
- dbNotVersioned = true;
- log.info(_("topia.migration.db.not.versionned"));
- } else {
- log.info(_("topia.migration.detected.db.version", v));
- }
- dbVersion = v;
}
protected String getSafeParameter(Properties config, String key) {
@@ -525,4 +586,18 @@
throw new IllegalStateException("le service n'est pas initialisé!");
}
}
+
+ protected Configuration creaHibernateConfiguration(Configuration configuration) {
+ Properties config = rootContext.getConfig();
+
+ Properties prop = new Properties();
+ prop.putAll(configuration.getProperties());
+ prop.putAll(config);
+
+ configuration.setProperties(prop);
+ return configuration;
+
+ }
+
+
}
\ No newline at end of file
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationService.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationService.java 2010-06-13 17:30:39 UTC (rev 2008)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationService.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -37,7 +37,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @version $Id$
*/
-public interface TopiaMigrationService extends TopiaService{ //}, TopiaContextListener, TopiaTransactionVetoable {
+public interface TopiaMigrationService extends TopiaService {
/** Nom du service */
String SERVICE_NAME = "migration";
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersion.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersion.java 2010-06-13 17:30:39 UTC (rev 2008)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersion.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -25,8 +25,12 @@
package org.nuiton.topia.migration.mappings;
-import org.nuiton.topia.migration.TopiaMigrationEngine;
+import org.apache.commons.lang.StringUtils;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
+import java.io.Serializable;
+
/**
* TMSVersion.java
*
@@ -34,46 +38,45 @@
* @author Chevallereau Benjamin
* @author Eon Sébastien
* @author Trève Vincent
- * @deprecated since 2.4, please use now the simplify service {@link TopiaMigrationEngine}
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
*/
-@Deprecated
-public class TMSVersion {
+public class TMSVersion implements Serializable {
- /**
- * La version.
- *
- * String (gere les cas 1.0.2 par exemple)
- */
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_VERSION = "version";
+
+ public static TMSVersion valueOf(Version version) {
+ return new TMSVersion(version.toString());
+ }
+
+ public static TMSVersion valueOf(String version) {
+ return new TMSVersion(version);
+ }
+
+ /** La version. */
private String version;
- /**
- * Constructeur
- */
- private TMSVersion() {
+ public TMSVersion() {
}
- /**
- * Constructeur
- * @param version la version
- */
public TMSVersion(String version) {
- this();
+ if (StringUtils.isEmpty(version)) {
+ throw new IllegalArgumentException("version parameter can not be null nor empty.");
+ }
this.version = version;
}
- /**
- * Retourne la version
- * @return la version
- */
public String getVersion() {
return version;
}
- /**
- * Change la version
- * @param version
- */
public void setVersion(String version) {
this.version = version;
}
+
+ public Version toVersion() {
+ return StringUtils.isEmpty(version) ? null : VersionUtil.valueOf(version);
+ }
}
Added: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java (rev 0)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,161 @@
+package org.nuiton.topia.migration.mappings;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.jdbc.Work;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.util.Version;
+import org.nuiton.util.VersionUtil;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * TMSVersion DAO helper.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.4
+ */
+public class TMSVersionDAO {
+
+ /** logger */
+ private final static Log log = LogFactory.getLog(TMSVersionDAO.class);
+
+ public static final String LEGACY_TABLE_NAME = "tmsVersion";
+
+ public static final String TABLE_NAME = "tms_version";
+
+ public static TMSVersion get(TopiaContext tx) throws TopiaException {
+
+ try {
+ Session session = ((TopiaContextImplementor) tx).getHibernate();
+ Criteria criteria = session.createCriteria(TMSVersion.class);
+ List<?> list = criteria.list();
+ TMSVersion result = list.isEmpty() ? null : (TMSVersion) list.get(0);
+ return result;
+ } catch (HibernateException e) {
+ throw new TopiaException("Could not obtain version", e);
+ }
+ }
+
+ public static void createTable(Configuration configuration) {
+ // creer le schema en base
+ // dans la configuration il n'y a que la table version
+ SchemaExport schemaExport = new SchemaExport(configuration);
+ schemaExport.create(log.isDebugEnabled(), true);
+ }
+
+ public static void dropTable(Configuration configuration) {
+ // supprimer le schema en base
+ // dans la configuration il n'y a que la table version
+ SchemaExport schemaExport = new SchemaExport(configuration);
+ schemaExport.drop(log.isDebugEnabled(), true);
+ }
+
+ public static TMSVersion create(TopiaContext tx, String version) throws TopiaException {
+
+ try {
+ Session session = ((TopiaContextImplementor) tx).getHibernate();
+
+ TMSVersion result = TMSVersion.valueOf(version);
+ // save entity
+ session.save(result);
+ return result;
+ } catch (HibernateException e) {
+ throw new TopiaException("Could not create version " + version, e);
+ }
+ }
+
+ public static void update(TopiaContext tx, TMSVersion version) throws TopiaException {
+ try {
+ Session session = ((TopiaContextImplementor) tx).getHibernate();
+ session.saveOrUpdate(version);
+ tx.commitTransaction();
+ } catch (HibernateException e) {
+ throw new TopiaException("Could not update version " + version, e);
+ }
+ }
+
+ public static void deleteAll(TopiaContext tx) throws TopiaException {
+ try {
+ Session session = ((TopiaContextImplementor) tx).getHibernate();
+ Criteria criteria = session.createCriteria(TMSVersion.class);
+ List<?> list = criteria.list();
+ for (Object o : list) {
+ session.delete(o);
+ }
+ } catch (HibernateException e) {
+ throw new TopiaException("Could not delete all versions", e);
+ }
+ }
+
+ public static final String MAPPING =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE hibernate-mapping PUBLIC \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +
+ "<hibernate-mapping>\n" +
+ " <class name=\"org.nuiton.topia.migration.mappings.TMSVersion\" table=\"" + TABLE_NAME + "\">\n" +
+ " <id column=\"version\" name=\"version\"/>\n" +
+ " </class>\n" +
+ "</hibernate-mapping>";
+
+ public static final String LEGACY_MAPPING =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<!DOCTYPE hibernate-mapping PUBLIC \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" +
+ "<hibernate-mapping>\n" +
+ " <class name=\"org.nuiton.topia.migration.mappings.TMSVersion\" table=\"" + LEGACY_TABLE_NAME + "\">\n" +
+ " <id column=\"version\" name=\"version\"/>\n" +
+ " </class>\n" +
+ "</hibernate-mapping>";
+
+ public static Version getVersion(TopiaContext tx, String tableName) {
+ try {
+ GetVersionWork work = new GetVersionWork(tableName);
+ ((TopiaContextImplementor) tx).getHibernate().doWork(work);
+ Version v = work.getVersion();
+ return v;
+ } catch (TopiaException e) {
+ throw new TopiaRuntimeException("Can't obtain dbVersion for reason " + e.getMessage(), e);
+ }
+ }
+
+ public static class GetVersionWork implements Work {
+
+ Version version;
+
+ private final String tableName;
+
+ public GetVersionWork(String tableName) {
+ this.tableName = tableName;
+ }
+
+ @Override
+ public void execute(Connection connection) throws SQLException {
+ PreparedStatement st = connection.prepareStatement("select " + TMSVersion.PROPERTY_VERSION + " from " + tableName + ";");
+ try {
+ ResultSet set = st.executeQuery();
+
+ if (set.next()) {
+ version = VersionUtil.valueOf(set.getString(1));
+ }
+ } finally {
+
+ st.close();
+ }
+ }
+
+ public Version getVersion() {
+ return version;
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/TMSVersionImpl.hbm.xml
===================================================================
--- trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/TMSVersionImpl.hbm.xml (rev 0)
+++ trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/TMSVersionImpl.hbm.xml 2010-06-13 17:48:26 UTC (rev 2009)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!-- ce fichier de mapping sera supprimee apres la version 2.4 car plus utilise -->
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping default-access="field" auto-import="true" package="org.nuiton.topia.migration">
+ <class name="org.nuiton.topia.migration.TMSVersionImpl" table="tMSVersion" node="org.nuiton.topia.migration.TMSVersionImpl" abstract="false" proxy="org.nuiton.topia.migration.TMSVersion" >
+ <id name="topiaId" type="string" length="255" node="@topiaId"/>
+ <version name="topiaVersion" type="long" node="@topiaVersion"/>
+ <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/>
+ <property name="version" type="java.lang.String" access="field" column="version" node="version"/>
+ </class>
+</hibernate-mapping>
Property changes on: trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/TMSVersionImpl.hbm.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/mappings/TMSVersion.hbm.xml
===================================================================
--- trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/mappings/TMSVersion.hbm.xml 2010-06-13 17:30:39 UTC (rev 2008)
+++ trunk/topia-service-migration/src/main/resources/org/nuiton/topia/migration/mappings/TMSVersion.hbm.xml 2010-06-13 17:48:26 UTC (rev 2009)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+ <!-- ce fichier de mapping sera supprimee apres la version 2.4 car plus utilise -->
<hibernate-mapping>
<class name="org.nuiton.topia.migration.mappings.TMSVersion" table="tms_version">
<id column="version" name="version"/>
1
0