Author: tchemit Date: 2008-10-20 22:56:56 +0000 (Mon, 20 Oct 2008) New Revision: 1167 Added: topia/tags/2.0.27/ topia/tags/2.0.27/changelog topia/tags/2.0.27/pom.xml topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java topia/tags/2.0.27/src/site/site.xml Removed: topia/tags/2.0.27/changelog topia/tags/2.0.27/pom.xml topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java topia/tags/2.0.27/src/site/site.xml Log: [maven-release-plugin] copy for tag 2.0.27 Copied: topia/tags/2.0.27 (from rev 1157, topia/trunk) Deleted: topia/tags/2.0.27/changelog =================================================================== --- topia/trunk/changelog 2008-10-13 13:11:31 UTC (rev 1157) +++ topia/tags/2.0.27/changelog 2008-10-20 22:56:56 UTC (rev 1167) @@ -1,128 +0,0 @@ -ver-2-0-27 ?? 2008?? - * 20080922 [thimel] Switched to lutinproject 3.0 - * 20080922 [thimel] Sources are correctly maven2 structuted (src/main/xxx) - * 20080922 [thimel] Fixed maven-processor-plugin usage - * 20080922 [thimel] License switched to LGPL - -ver-2-0-26 thimel 20080922 - * 20080922 [thimel] Last version with lutinproject 2.2 - * 20082608 [chemit] permettre de recuperer uniquement une fenetre de resultat en hql (TopiaContext#find(String hql,int startIndex,int endIndex, Object ... args) - * 20082907 [chemit] Suppression des dependances en dur sur les implantations d'entites - * 20072012 [thimel] Support des index sur les attibuts - * 20072012 [ruchaud] Récupération des classes persistées - * 20072012 [ruchaud] Création d'un vetoable sur les finds - -ver-2-0-25 poussin 20071214 - - * 20071120 [chatellier] modify service init methods, return boolean to stay - activated - * 20071116 [chatellier] add support for topia context listeners - * 20071114 [chatellier] add support for service without persitent classes - * 20071109 [chatellier] add type="string" on topiaId in templates - - update hibernate version to 3.2.5.ga (event patch) - - jetty version 5.1.10 (better pom.xml) - * 20071001 [chatellier] move tapestry version to 5.0.5 - * 20070528 [chatellier] add stateModel generation support - - tapestry generation templates - - tapestry 5.0.4 dependency - - * 20071106 [poussin] add removeContext on TopiaContextFactory and call it - in TopiaContextImpl.closeContext(). - - * 20071107 [thimel] add db schema support - * 20071107 [thimel] several .hbm.xml refactoring - * 20071108 [thimel] add DTO generator - * 20071108 [thimel] add copyright support in generators - * 20071108 [thimel] add serialVersionUID support in EntityAbstractGenerator - -ver-2-0-24 poussin 20070425 - - * 20070420 [chatellier] add services interfaces generation (stereotype=service) - * 20070420 [chatellier] add topia services support - * 20070330 [poussin] TopiaContextFactory return new TopiaContext if context is closed - * 20070331 [poussin] change many string argument to class argument - * 20070331 [poussin] add getService(Class) method on TopiaContext - * 20070331 [poussin] remove helper in service that only return service instant - * 20070331 [poussin] add Devel.rst documentation - * 20070402 [poussin] replace init to preInit and postInit in TopiaService - -ver-2-0-22 ruchaud 20061023 - - * 20061023 [ruchaud][improve] manage events - * 20061023 [ruchaud][bug fix] in generator of DAO Abstract on delete - -ver-2-0-21 poussin 20061019 - - * add support for auto-import entities for hql - * add getComposite and getAggregate on TopiaEntity - * bug fix for association hibernate mapping wit have attributeh - cascade="delete" for not navigable link to prevent constraint exception - * bug fix in delete, remove link before do delete - -ver-2-0-20 poussin 20061017 - - * add support for TopiaService mechanisme - -ver-2-0-16 poussin 20060907 - - * Implantation des méthodes update et delete sur les TopiaUserImpl et TopiaEntityPermissionImpl - * add backup/restore method on TopiaContext (backup only works for h2) - * TopiaContext is set in Entity during preload - * add updateSchema in TopiaContext interface - * add methods update et delete on TopiaUserImpl and TopiaEntityPermissionImpl - -ver-2-0-13 thimel 20060822 - - * [Secu] ajout d'un champ notes sur les TopiaUser - * [Secu] ajout d'un champ linkApplication sur les TopiaUser (permettant de faire le lien avec une application externe) - * [Secu] ajout de commits et rollbacks sur les Manager - * [Secu] ajout d'un setPassword (sans verification ancien mdp) sur les TopiaUser - -ver-2-0-12 thimel 20060721 - - * ajout des projections sur les DAO - * positionnement unique des userManager et permissionManager au niveau du contexte racine - * ajout de la possibilite de tester des permissions sur le permissionManager - -ver-2-0-11 thimel 20060703 - - * support de la fermeture d'un contexte - * support de la recherche sur tous les attributs d'une entite / annotation sur les interfaces - -ver-2-0-8 thimel 20060606 - - * amelioration detection des classes abstraites - * correction du polymorphisme avec les proxies d'Hibernate - * Hibernate 3.2 - -ver-2-0-7 thimel 20060523 - - * import/export XML "experimental" - * one-to-one transformes en many-to-one + unique="true" - * bug au niveau de la detection des parents abstract - -ver-2-0-6 thimel 20060504 - - * support des annotations sur les attributs des XXXAbstract - * re-correction du support des relations unidirectionnelles 1-n avec classes d'heritage du cote n - * ajout de la validation pour les attributs sans inverses (pour les objectmodel faits a la main) - -ver-2-0-5 thimel 20060427 - - * isIndexed remplace isOrdered dans le mapping hibernate - * add postCreate and postLoad on AbstractTopiaEntity - * findContains sur les DAO (implante hors Hibernate pour l'instant) - * support plus coherent des classes abstraites - * projet compatible maven2 - * correction du support des relations unidirectionnelles 1-n avec classes d'heritage du cote n - -ver-2-0-4 thimel 20060303 - - * Correction du support des interfaces et classes abstraites (conjointement a LutinGenerator 0.30) - * Ajout des exceptions sur le operations (conjointement a LutinGenerator 0.30) - -ver-2-0-3 thimel 20060228 - - * Correction du support des classes d'associations (mauvais mapping Hibernate) - * Support de super classes pour les classes d'association (LutinGenerator 0.29) - \ No newline at end of file Copied: topia/tags/2.0.27/changelog (from rev 1163, topia/trunk/changelog) =================================================================== --- topia/tags/2.0.27/changelog (rev 0) +++ topia/tags/2.0.27/changelog 2008-10-20 22:56:56 UTC (rev 1167) @@ -0,0 +1,129 @@ +ver-2-0-27 ?? 2008?? + * 20081021 [chemit] clean pom, use lutingenerator 0.60 + * 20080922 [thimel] Switched to lutinproject 3.0 + * 20080922 [thimel] Sources are correctly maven2 structuted (src/main/xxx) + * 20080922 [thimel] Fixed maven-processor-plugin usage + * 20080922 [thimel] License switched to LGPL + +ver-2-0-26 thimel 20080922 + * 20080922 [thimel] Last version with lutinproject 2.2 + * 20082608 [chemit] permettre de recuperer uniquement une fenetre de resultat en hql (TopiaContext#find(String hql,int startIndex,int endIndex, Object ... args) + * 20082907 [chemit] Suppression des dependances en dur sur les implantations d'entites + * 20072012 [thimel] Support des index sur les attibuts + * 20072012 [ruchaud] Récupération des classes persistées + * 20072012 [ruchaud] Création d'un vetoable sur les finds + +ver-2-0-25 poussin 20071214 + + * 20071120 [chatellier] modify service init methods, return boolean to stay + activated + * 20071116 [chatellier] add support for topia context listeners + * 20071114 [chatellier] add support for service without persitent classes + * 20071109 [chatellier] add type="string" on topiaId in templates + - update hibernate version to 3.2.5.ga (event patch) + - jetty version 5.1.10 (better pom.xml) + * 20071001 [chatellier] move tapestry version to 5.0.5 + * 20070528 [chatellier] add stateModel generation support + - tapestry generation templates + - tapestry 5.0.4 dependency + + * 20071106 [poussin] add removeContext on TopiaContextFactory and call it + in TopiaContextImpl.closeContext(). + + * 20071107 [thimel] add db schema support + * 20071107 [thimel] several .hbm.xml refactoring + * 20071108 [thimel] add DTO generator + * 20071108 [thimel] add copyright support in generators + * 20071108 [thimel] add serialVersionUID support in EntityAbstractGenerator + +ver-2-0-24 poussin 20070425 + + * 20070420 [chatellier] add services interfaces generation (stereotype=service) + * 20070420 [chatellier] add topia services support + * 20070330 [poussin] TopiaContextFactory return new TopiaContext if context is closed + * 20070331 [poussin] change many string argument to class argument + * 20070331 [poussin] add getService(Class) method on TopiaContext + * 20070331 [poussin] remove helper in service that only return service instant + * 20070331 [poussin] add Devel.rst documentation + * 20070402 [poussin] replace init to preInit and postInit in TopiaService + +ver-2-0-22 ruchaud 20061023 + + * 20061023 [ruchaud][improve] manage events + * 20061023 [ruchaud][bug fix] in generator of DAO Abstract on delete + +ver-2-0-21 poussin 20061019 + + * add support for auto-import entities for hql + * add getComposite and getAggregate on TopiaEntity + * bug fix for association hibernate mapping wit have attributeh + cascade="delete" for not navigable link to prevent constraint exception + * bug fix in delete, remove link before do delete + +ver-2-0-20 poussin 20061017 + + * add support for TopiaService mechanisme + +ver-2-0-16 poussin 20060907 + + * Implantation des méthodes update et delete sur les TopiaUserImpl et TopiaEntityPermissionImpl + * add backup/restore method on TopiaContext (backup only works for h2) + * TopiaContext is set in Entity during preload + * add updateSchema in TopiaContext interface + * add methods update et delete on TopiaUserImpl and TopiaEntityPermissionImpl + +ver-2-0-13 thimel 20060822 + + * [Secu] ajout d'un champ notes sur les TopiaUser + * [Secu] ajout d'un champ linkApplication sur les TopiaUser (permettant de faire le lien avec une application externe) + * [Secu] ajout de commits et rollbacks sur les Manager + * [Secu] ajout d'un setPassword (sans verification ancien mdp) sur les TopiaUser + +ver-2-0-12 thimel 20060721 + + * ajout des projections sur les DAO + * positionnement unique des userManager et permissionManager au niveau du contexte racine + * ajout de la possibilite de tester des permissions sur le permissionManager + +ver-2-0-11 thimel 20060703 + + * support de la fermeture d'un contexte + * support de la recherche sur tous les attributs d'une entite / annotation sur les interfaces + +ver-2-0-8 thimel 20060606 + + * amelioration detection des classes abstraites + * correction du polymorphisme avec les proxies d'Hibernate + * Hibernate 3.2 + +ver-2-0-7 thimel 20060523 + + * import/export XML "experimental" + * one-to-one transformes en many-to-one + unique="true" + * bug au niveau de la detection des parents abstract + +ver-2-0-6 thimel 20060504 + + * support des annotations sur les attributs des XXXAbstract + * re-correction du support des relations unidirectionnelles 1-n avec classes d'heritage du cote n + * ajout de la validation pour les attributs sans inverses (pour les objectmodel faits a la main) + +ver-2-0-5 thimel 20060427 + + * isIndexed remplace isOrdered dans le mapping hibernate + * add postCreate and postLoad on AbstractTopiaEntity + * findContains sur les DAO (implante hors Hibernate pour l'instant) + * support plus coherent des classes abstraites + * projet compatible maven2 + * correction du support des relations unidirectionnelles 1-n avec classes d'heritage du cote n + +ver-2-0-4 thimel 20060303 + + * Correction du support des interfaces et classes abstraites (conjointement a LutinGenerator 0.30) + * Ajout des exceptions sur le operations (conjointement a LutinGenerator 0.30) + +ver-2-0-3 thimel 20060228 + + * Correction du support des classes d'associations (mauvais mapping Hibernate) + * Support de super classes pour les classes d'association (LutinGenerator 0.29) + \ No newline at end of file Deleted: topia/tags/2.0.27/pom.xml =================================================================== --- topia/trunk/pom.xml 2008-10-13 13:11:31 UTC (rev 1157) +++ topia/tags/2.0.27/pom.xml 2008-10-20 22:56:56 UTC (rev 1167) @@ -1,188 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <!--The version of maven's project object model--> - <modelVersion>4.0.0</modelVersion> - - <!--lutinproject.xml--> - <parent> - <groupId>org.codelutin</groupId> - <artifactId>lutinproject</artifactId> - <version>3.0</version> - </parent> - - <!--A unique name for this project--> - <groupId>org.codelutin</groupId> - <artifactId>topia</artifactId> - <name>ToPIA - Tools for Portable and Independent Architecture</name> - - <!--ejb, jar, war...--> - <packaging>jar</packaging> - - <!--Version--> - <version>2.0.27-SNAPSHOT</version> - - <!--Description--> - <description> - Framework de persistance et de distribution d'application. - </description> - <inceptionYear>2004</inceptionYear> - - <properties> - <!-- id du projet du labs --> - <labs.id>21</labs.id> - - <!-- nom du projet sur le labs --> - <labs.project>topia</labs.project> - - <!-- Test --> - <maven.test.skip>true</maven.test.skip> - </properties> - - <!-- Additionnals repositories --> - <repositories> - <!-- JBoss for hibernate --> - <repository> - <id>jboss-repository</id> - <url>http://repository.jboss.com/maven2</url> - </repository> - </repositories> - - <scm> - <connection>${maven.scm.connection}</connection> - <developerConnection>${maven.scm.developerConnection}</developerConnection> - <url>${maven.scm.url}</url> - </scm> - - <build> - <plugins> - <!--Attaching processor plugin to the Build Lifecycle--> - <plugin> - <groupId>org.codelutin</groupId> - <artifactId>maven-processor-plugin</artifactId> - <version>0.15</version> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>process</goal> - </goals> - </execution> - </executions> - <configuration> - <!-- You might change defaut directories --> - <!-- srcDir>${basedir}/src/main/java</srcDir> - <destDir>${basedir}/target/processed-sources/java</destDir--> - <addCompileDirectory>true</addCompileDirectory> - <includes> - <include>**/*.java</include> - </includes> - <filters> - org.codelutin.processor.filters.GeneratorTemplatesFilter, - org.codelutin.processor.filters.ActiveLogsCodeFilter - </filters> - <verbose>${maven.verbose}</verbose> - </configuration> - </plugin> - </plugins> - </build> - - <!--Librairies--> - <dependencies> - <!--Compile--> - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>lutinutil</artifactId> - <version>0.31</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>lutingenerator</artifactId> - <version>0.51-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - <version>3.2.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <version>3.3.1.GA</version> - <scope>compile</scope> - </dependency> - - <!--Test--> - <dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>8.2-507.jdbc4</version> - <scope>test</scope> - </dependency> - - <!-- <dependency> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - <version>5.1.5</version> - <scope>test</scope> - </dependency> --> - - <!-- Dependencies for services --> - <dependency> - <groupId>org.apache.xmlrpc</groupId> - <artifactId>xmlrpc-server</artifactId> - <version>3.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.xmlrpc</groupId> - <artifactId>xmlrpc-client</artifactId> - <version>3.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>3.1</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.codehaus.xfire</groupId> - <artifactId>xfire-java5</artifactId> - <version>1.2.6</version> - </dependency> - - <!-- branch 5.1 : ne fonctionne pas en 6+ --> - <dependency> - <groupId>jetty</groupId> - <artifactId>jetty</artifactId> - <version>5.1.10</version> - </dependency> - - <!-- Dependencies for class generation --> - <dependency> - <groupId>asm</groupId> - <artifactId>asm</artifactId> - <version>1.5.3</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.tapestry</groupId> - <artifactId>tapestry-core</artifactId> - <version>5.0.7</version> - <scope>compile</scope> - </dependency> - </dependencies> - -</project> Copied: topia/tags/2.0.27/pom.xml (from rev 1166, topia/trunk/pom.xml) =================================================================== --- topia/tags/2.0.27/pom.xml (rev 0) +++ topia/tags/2.0.27/pom.xml 2008-10-20 22:56:56 UTC (rev 1167) @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinproject</artifactId> + <version>3.0</version> + </parent> + + <artifactId>topia</artifactId> + + <dependencies> + <!--Compile--> + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutinutil</artifactId> + <version>0.31</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutingenerator</artifactId> + <version>0.60</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>3.3.1.GA</version> + <scope>compile</scope> + </dependency> + + <!--Test--> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>8.2-507.jdbc4</version> + <scope>test</scope> + </dependency> + + <!-- <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.5</version> + <scope>test</scope> + </dependency> --> + + <!-- Dependencies for services --> + <dependency> + <groupId>org.apache.xmlrpc</groupId> + <artifactId>xmlrpc-server</artifactId> + <version>3.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.xmlrpc</groupId> + <artifactId>xmlrpc-client</artifactId> + <version>3.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>3.1</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.codehaus.xfire</groupId> + <artifactId>xfire-java5</artifactId> + <version>1.2.6</version> + </dependency> + + <!-- branch 5.1 : ne fonctionne pas en 6+ --> + <dependency> + <groupId>jetty</groupId> + <artifactId>jetty</artifactId> + <version>5.1.10</version> + </dependency> + + <!-- Dependencies for class generation --> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>1.5.3</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.tapestry</groupId> + <artifactId>tapestry-core</artifactId> + <version>5.0.7</version> + <scope>compile</scope> + </dependency> + + <!--BD H2 pour le test--> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>1.0.79</version> + <scope>test</scope> + </dependency> + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + + <name>ToPIA - Tools for Portable and Independent Architecture</name> + <version>2.0.27</version> + <description>Framework de persistance et de distribution d'application.</description> + <inceptionYear>2004</inceptionYear> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + + <packaging>jar</packaging> + + <properties> + <!-- id du projet du labs --> + <labs.id>21</labs.id> + + <!-- nom du projet sur le labs --> + <labs.project>topia</labs.project> + + <!-- Test FIXME : --> + <maven.test.skip>true</maven.test.skip> + </properties> + + <build> + <plugins> + <!--Attaching processor plugin to the Build Lifecycle--> + <plugin> + <groupId>org.codelutin</groupId> + <artifactId>maven-processor-plugin</artifactId> + <version>0.16</version> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>process</goal> + </goals> + </execution> + </executions> + <configuration> + <!-- You might change defaut directories --> + <!-- srcDir>${basedir}/src/main/java</srcDir> + <destDir>${basedir}/target/processed-sources/java</destDir--> + <addCompileDirectory>true</addCompileDirectory> + <includes> + <include>**/*.java</include> + </includes> + <filters> + org.codelutin.processor.filters.GeneratorTemplatesFilter, + org.codelutin.processor.filters.ActiveLogsCodeFilter + </filters> + <verbose>${maven.verbose}</verbose> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + </plugin> + + </plugins> + </build> + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + + <repositories> + <!-- JBoss for hibernate --> + <repository> + <id>jboss-repository</id> + <url>http://repository.jboss.com/maven2</url> + </repository> + </repositories> + + <scm> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/topia/topia/tags/2.0.27</connection> + <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/topia/topia/tags/2.0.27</developerConnection> + <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/topia/tags/2.0.27?root=topia</url> + </scm> + +</project> Deleted: topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java =================================================================== --- topia/trunk/src/main/java/org/codelutin/topia/generator/DTOGenerator.java 2008-10-13 13:11:31 UTC (rev 1157) +++ topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java 2008-10-20 22:56:56 UTC (rev 1167) @@ -1,413 +0,0 @@ -/* *##% ToPIA - Tools for Portable and Independent Architecture - * Copyright (C) 2004 - 2008 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>. ##%*/ - -/* * -* EntityAbstractGenerator.java -* -* Created: 12 déc. 2005 -* -* @author Arnaud Thimel <thimel@codelutin.com> -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - -package org.codelutin.topia.generator; - -import static org.codelutin.topia.generator.GeneratorUtil.TAG_ANNOTATION; -import static org.codelutin.topia.generator.GeneratorUtil.hasUnidirectionalRelationOnAbstractType; - -import java.io.File; -import java.io.IOException; -import java.io.Writer; -import java.util.Iterator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.generator.ObjectModelGenerator; -import org.codelutin.generator.Util; -import org.codelutin.generator.models.object.ObjectModelAssociationClass; -import org.codelutin.generator.models.object.ObjectModelAttribute; -import org.codelutin.generator.models.object.ObjectModelClass; -import org.codelutin.generator.models.object.ObjectModelClassifier; -import org.codelutin.generator.models.object.ObjectModelInterface; - -/** - * DTO generator - */ -public class DTOGenerator extends ObjectModelGenerator { - - /** - * Logger for this class - */ - private static final Log log = LogFactory - .getLog(DTOGenerator.class); - - public DTOGenerator() { - super(); - } - - @Override - public String getFilenameForClass(ObjectModelClass clazz) { - return clazz.getQualifiedName().replace('.', File.separatorChar) + "DTO.java"; - } - - public boolean isDTO(String type) { - ObjectModelClassifier clazz = model.getClassifier(type); - if (clazz == null) { - return false; - } - return clazz.hasStereotype(GeneratorUtil.STEREOTYPE_DTO); - } - - @Override - public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { - if (!clazz.hasStereotype(GeneratorUtil.STEREOTYPE_DTO)) { - return; - } - String copyright = GeneratorUtil.getCopyright(model); - if (GeneratorUtil.notEmpty(copyright)) { -/*{<%=copyright%> -}*/ - } -/*{package <%=clazz.getPackageName()%>; - -import org.apache.commons.lang.builder.ToStringBuilder; - -/** - * DTO implantation for <%=Util.capitalize(clazz.getName())%> entity. - *) -public class <%=clazz.getName()%>DTO }*/ - -/* - * Définition de la super classe : il ne doit y avoir qu'une - */ - - String extendClass = ""; - Iterator<ObjectModelClass> j = clazz.getSuperclasses().iterator(); - if (j.hasNext()) { - ObjectModelClassifier parent = j.next(); - if (parent.hasStereotype(GeneratorUtil.STEREOTYPE_DTO)) { - extendClass += parent.getName() + "DTO"; - } else { - extendClass += parent.getName(); - } - } - - if (extendClass.length() > 0) { - /*{extends <%=extendClass%> }*/ - } -/* - * Définition des interfaces - */ - /*{implements java.io.Serializable }*/ - String implInterface = ""; - for (Iterator<ObjectModelInterface> i=clazz.getInterfaces().iterator(); i.hasNext();) { - ObjectModelClassifier parentInterface = i.next(); - if (parentInterface.hasStereotype(GeneratorUtil.STEREOTYPE_DTO)) { - implInterface += parentInterface.getName() + "DTO"; - } else { - implInterface += parentInterface.getName(); - } - - if (i.hasNext()) { - implInterface += ", "; - } - } - if (implInterface.length() > 0) { - /*{,<%=implInterface%> { - -}*/ - } else { - /*{ { - -}*/ - } - - String svUID = GeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model); - if (svUID != null) { -/*{ public static final long serialVersionUID = <%=svUID%>; - -}*/ - } -/* - * Définition des attributs - */ - for (ObjectModelAttribute attr : clazz.getAttributes()) { - ObjectModelAttribute reverse = attr.getReverseAttribute(); - - if (!(attr.isNavigable() - || attr.hasAssociationClass())) { - continue; - } - - if (GeneratorUtil.hasDocumentation(attr)) { -/*{ /** - * <%=attr.getDocumentation()%> - *) -}*/ - } - String annotation = attr.getTagValue(TAG_ANNOTATION); - if (annotation != null && annotation.length() > 0) { -/*{ <%=annotation%> -}*/ - } - if (!Util.isNMultiplicity(attr)) { - if (!attr.hasAssociationClass()) { -/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>; -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{ <%=attr.getVisibility()%> <%=attr.getAssociationClass().getQualifiedName()%>DTO <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; -}*/ - } - } else { - if (!attr.hasAssociationClass()) { -/*{ <%=attr.getVisibility()%> <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> <%=attr.getName()%>; -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{ <%=attr.getVisibility()%> <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; -}*/ - } - } - } /* end for*/ - - //Déclaration des attributs d'une classe d'associations - if (clazz instanceof ObjectModelAssociationClass) { - ObjectModelAssociationClass assoc = (ObjectModelAssociationClass)clazz; - for (Iterator i = assoc.getParticipantsAttributes().iterator(); i.hasNext(); ) { - ObjectModelAttribute attr = (ObjectModelAttribute) i.next(); - if (attr != null) { -/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=Util.toLowerCaseFirstLetter(attr.getName())%>; -}*/ - } - } - } -/*{ -}*/ - -/*{ /** - * Default constructor of <%=clazz.getName()%>DTO. - *) - public <%=clazz.getName()%>DTO() {} - -}*/ - -/*{ /** - * Constructor of <%=clazz.getName()%>DTO with all parameters. - *) - public <%=clazz.getName()%>DTO(}*/ - - boolean une_fois = true; - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); - - if (!(attr.isNavigable() - || attr.hasAssociationClass())) { - continue; - } - - if (une_fois) { - une_fois = false; - } else { - /*{, }*/ - } - - if (!Util.isNMultiplicity(attr)) { - if (!attr.hasAssociationClass()) { -/*{<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{<%=attr.getAssociationClass().getQualifiedName()%>DTO <%=Util.toLowerCaseFirstLetter(assocAttrName)%>}*/ - } - } else { - if (!attr.hasAssociationClass()) { -/*{<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> <%=attr.getName()%>}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> <%=Util.toLowerCaseFirstLetter(assocAttrName)%>}*/ - } - } - - - } // end for - - /*{ ) { -}*/ - - - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); - - if (!(attr.isNavigable() - || attr.hasAssociationClass())) { - continue; - } - - if (!Util.isNMultiplicity(attr)) { - if (!attr.hasAssociationClass()) { -/*{ this.<%=attr.getName()%> = <%=attr.getName()%>; -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{ this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; -}*/ - } - } else { - if (!attr.hasAssociationClass()) { -/*{ this.<%=attr.getName()%> = <%=attr.getName()%>; -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{ this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; -}*/ - } - } - } -/*{ } - -}*/ - - - /* - * Définition des getteurs et setteurs - */ - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); - ObjectModelAttribute reverse = attr.getReverseAttribute(); - - if (!attr.isNavigable()) { - continue; - } - if (!Util.isNMultiplicity(attr)) { - if (!attr.hasAssociationClass()) { -/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> value) { - this.<%=attr.getName()%> = value; - } - - public <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> get<%=Util.capitalize(attr.getName())%>() { - return <%=attr.getName()%>; - } - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); - if (log.isTraceEnabled()) { log.trace("assocAttrName: " + assocAttrName); } -/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=attr.getAssociationClass().getQualifiedName()%>DTO association) { - this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = association; - } - - public <%=attr.getAssociationClass().getQualifiedName()%>DTO get<%=Util.capitalize(assocAttrName)%>() { - return <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; - } - -}*/ - } - } else { //NMultiplicity - if (!attr.hasAssociationClass()) { //Méthodes remplacées par des accesseurs sur les classes d'assoc -/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> values) { - this.<%=attr.getName()%> = values; - } - -}*/ - - //AddChild -/*{ public <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> addChild(<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>) { - this.<%=attr.getName()%>.add(<%=attr.getName()%>); -}*/ - if (reverse.isNavigable()) { -/*{ <%=attr.getName()%>.set<%=Util.capitalize(reverse.getName())%>(this); -}*/ - } -/*{ return <%=attr.getName()%>; - } - -}*/ - //RemoveChild -/*{ public void removeChild(<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>) { - this.<%=attr.getName()%>.remove(<%=attr.getName()%>); -}*/ - if (reverse.isNavigable()) { -/*{ <%=attr.getName()%>.set<%=Util.capitalize(reverse.getName())%>(null); -}*/ - } -/*{ } - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); - if (log.isTraceEnabled()) { log.trace("assocAttrName: " + assocAttrName); } -/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> values) { - this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = values; - } - -}*/ - } - if (!attr.hasAssociationClass()) { -/*{ public <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> get<%=Util.capitalize(attr.getName())%>() { - return this.<%=attr.getName()%>; - } - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); - if (log.isTraceEnabled()) { log.trace("assocAttrName: " + assocAttrName); } -/*{ public <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> get<%=Util.capitalize(assocAttrName)%>() { - return this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; - } - -}*/ - } - } - } - -/*{ /* (non-Javadoc) - * @see java.lang.Object#toString() - *) - @Override - public String toString() { - String result = new ToStringBuilder(this). -}*/ - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); - if (!(attr.isNavigable() - || attr.hasAssociationClass())) { - continue; - } - //FIXME possibilité de boucles (non directes) - ObjectModelClass attrEntity = null; - if (model.hasClass(attr.getType())) { - attrEntity = model.getClass(attr.getType()); - } - boolean isDTO = (attrEntity != null && attrEntity.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY)); - ObjectModelAttribute reverse = attr.getReverseAttribute(); - if ((isDTO && (reverse == null || !reverse.isNavigable()) && !attr.hasAssociationClass()) || (!isDTO)) { -/*{ append("<%=attr.getName()%>", this.<%=attr.getName()%>). -}*/ - } - } -/*{ toString(); - return result; - } - -} //<%=clazz.getName()%>DTO -}*/ - } - -} //EntityDTOGenerator Copied: topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java (from rev 1158, topia/trunk/src/main/java/org/codelutin/topia/generator/DTOGenerator.java) =================================================================== --- topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java (rev 0) +++ topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/DTOGenerator.java 2008-10-20 22:56:56 UTC (rev 1167) @@ -0,0 +1,441 @@ +/* *##% ToPIA - Tools for Portable and Independent Architecture + * Copyright (C) 2004 - 2008 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>. ##%*/ + +/* * +* EntityAbstractGenerator.java +* +* Created: 12 déc. 2005 +* +* @author Arnaud Thimel <thimel@codelutin.com> +* @version $Revision$ +* +* Mise a jour: $Date$ +* par : $Author$ +*/ + +package org.codelutin.topia.generator; + +import static org.codelutin.topia.generator.GeneratorUtil.TAG_ANNOTATION; + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.util.Iterator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.Util; +import org.codelutin.generator.models.object.ObjectModelAssociationClass; +import org.codelutin.generator.models.object.ObjectModelAttribute; +import org.codelutin.generator.models.object.ObjectModelClass; +import org.codelutin.generator.models.object.ObjectModelClassifier; +import org.codelutin.generator.models.object.ObjectModelInterface; + +/** + * DTO generator + */ +public class DTOGenerator extends ObjectModelGenerator { + + /** + * Logger for this class + */ + private static final Log log = LogFactory + .getLog(DTOGenerator.class); + + public DTOGenerator() { + super(); + } + + @Override + public String getFilenameForClass(ObjectModelClass clazz) { + return clazz.getQualifiedName().replace('.', File.separatorChar) + "DTO.java"; + } + + public boolean isDTO(String type) { + ObjectModelClassifier clazz = model.getClassifier(type); + return clazz != null && clazz.hasStereotype(GeneratorUtil.STEREOTYPE_DTO); + } + + @Override + public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { + if (!clazz.hasStereotype(GeneratorUtil.STEREOTYPE_DTO)) { + return; + } + String copyright = GeneratorUtil.getCopyright(model); + if (GeneratorUtil.notEmpty(copyright)) { +/*{<%=copyright%> +}*/ + } +/*{package <%=clazz.getPackageName()%>; + +import org.apache.commons.lang.builder.ToStringBuilder; +import java.beans.PropertyChangeListener; + +/** + * DTO implantation for <%=Util.capitalize(clazz.getName())%> entity. + *) +public class <%=clazz.getName()%>DTO }*/ + +/* + * Définition de la super classe : il ne doit y avoir qu'une + */ + + String extendClass = ""; + Iterator<ObjectModelClass> j = clazz.getSuperclasses().iterator(); + if (j.hasNext()) { + ObjectModelClassifier parent = j.next(); + if (parent.hasStereotype(GeneratorUtil.STEREOTYPE_DTO)) { + extendClass += parent.getName() + "DTO"; + } else { + extendClass += parent.getName(); + } + } + + if (extendClass.length() > 0) { + /*{extends <%=extendClass%> }*/ + } +/* + * Définition des interfaces + */ + /*{implements java.io.Serializable }*/ + String implInterface = ""; + for (Iterator<ObjectModelInterface> i=clazz.getInterfaces().iterator(); i.hasNext();) { + ObjectModelClassifier parentInterface = i.next(); + if (parentInterface.hasStereotype(GeneratorUtil.STEREOTYPE_DTO)) { + implInterface += parentInterface.getName() + "DTO"; + } else { + implInterface += parentInterface.getName(); + } + + if (i.hasNext()) { + implInterface += ", "; + } + } + if (implInterface.length() > 0) { + /*{,<%=implInterface%> { + +}*/ + } else { + /*{ { + +}*/ + } + + String svUID = GeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model); + if (svUID != null) { +/*{ public static final long serialVersionUID = <%=svUID%>; + +}*/ + } +/* + * Définition des attributs + */ + for (ObjectModelAttribute attr : clazz.getAttributes()) { + ObjectModelAttribute reverse = attr.getReverseAttribute(); + + if (!(attr.isNavigable() + || attr.hasAssociationClass())) { + continue; + } + + if (GeneratorUtil.hasDocumentation(attr)) { +/*{ /** + * <%=attr.getDocumentation()%> + *) +}*/ + } + String annotation = attr.getTagValue(TAG_ANNOTATION); + if (annotation != null && annotation.length() > 0) { +/*{ <%=annotation%> +}*/ + } + if (!Util.isNMultiplicity(attr)) { + if (!attr.hasAssociationClass()) { +/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>; +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{ <%=attr.getVisibility()%> <%=attr.getAssociationClass().getQualifiedName()%>DTO <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; +}*/ + } + } else { + if (!attr.hasAssociationClass()) { +/*{ <%=attr.getVisibility()%> <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> <%=attr.getName()%>; +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{ <%=attr.getVisibility()%> <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; +}*/ + } + } + } /* end for*/ + + //Déclaration des attributs d'une classe d'associations + if (clazz instanceof ObjectModelAssociationClass) { + ObjectModelAssociationClass assoc = (ObjectModelAssociationClass)clazz; + for (Object o : assoc.getParticipantsAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + if (attr != null) { +/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=Util.toLowerCaseFirstLetter(attr.getName())%>; +}*/ + } + } + } +/*{ + protected java.beans.PropertyChangeSupport p; + +}*/ + +/*{ /** + * Default constructor of <%=clazz.getName()%>DTO. + *) + public <%=clazz.getName()%>DTO() { p = new java.beans.PropertyChangeSupport(this); } + +}*/ + +/*{ /** + * Constructor of <%=clazz.getName()%>DTO with all parameters. + *) + public <%=clazz.getName()%>DTO(}*/ + + boolean une_fois = true; + for (Object o : clazz.getAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + + if (!(attr.isNavigable() + || attr.hasAssociationClass())) { + continue; + } + + if (une_fois) { + une_fois = false; + } else { + /*{, }*/ + } + + if (!Util.isNMultiplicity(attr)) { + if (!attr.hasAssociationClass()) { +/*{<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{<%=attr.getAssociationClass().getQualifiedName()%>DTO <%=Util.toLowerCaseFirstLetter(assocAttrName)%>}*/ + } + } else { + if (!attr.hasAssociationClass()) { +/*{<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> <%=attr.getName()%>}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> <%=Util.toLowerCaseFirstLetter(assocAttrName)%>}*/ + } + } + + + } // end for + + /*{ ) { + this(); +}*/ + + + for (Object o : clazz.getAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + + if (!(attr.isNavigable() + || attr.hasAssociationClass())) { + continue; + } + + if (!Util.isNMultiplicity(attr)) { + if (!attr.hasAssociationClass()) { +/*{ this.<%=attr.getName()%> = <%=attr.getName()%>; +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{ this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; +}*/ + } + } else { + if (!attr.hasAssociationClass()) { +/*{ this.<%=attr.getName()%> = <%=attr.getName()%>; +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{ this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; +}*/ + } + } + } +/*{ } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + p.addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + p.removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.removePropertyChangeListener(propertyName, listener); + } + +}*/ + + + /* + * Définition des getteurs et setteurs + */ + for (Object o : clazz.getAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + ObjectModelAttribute reverse = attr.getReverseAttribute(); + + if (!attr.isNavigable()) { + continue; + } + if (!Util.isNMultiplicity(attr)) { + if (!attr.hasAssociationClass()) { +/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> value) { + <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> oldValue = this.<%=attr.getName()%>; + this.<%=attr.getName()%> = value; + p.firePropertyChange("<%=attr.getName()%>", oldValue, value); + } + + public <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> get<%=Util.capitalize(attr.getName())%>() { + return <%=attr.getName()%>; + } + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); + if (log.isTraceEnabled()) { + log.trace("assocAttrName: " + assocAttrName); + } +/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=attr.getAssociationClass().getQualifiedName()%>DTO association) { + <%=attr.getAssociationClass().getQualifiedName()%>DTO oldAssocation= this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = association; + p.firePropertyChange("<%=attr.getName()%>", oldAssocation, assocation); + } + + public <%=attr.getAssociationClass().getQualifiedName()%>DTO get<%=Util.capitalize(assocAttrName)%>() { + return <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + } + +}*/ + } + } else { //NMultiplicity + if (!attr.hasAssociationClass()) { //Méthodes remplacées par des accesseurs sur les classes d'assoc +/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> values) { + <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> oldValues = this.<%=attr.getName()%>; + this.<%=attr.getName()%> = values; + p.firePropertyChange("<%=attr.getName()%>", oldValues, values); + } + +}*/ + + //AddChild +/*{ public <%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> addChild(<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>) { + this.<%=attr.getName()%>.add(<%=attr.getName()%>); +}*/ + if (reverse.isNavigable()) { +/*{ <%=attr.getName()%>.set<%=Util.capitalize(reverse.getName())%>(this); +}*/ + } +/*{ return <%=attr.getName()%>; + } + +}*/ + //RemoveChild +/*{ public void removeChild(<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%> <%=attr.getName()%>) { + this.<%=attr.getName()%>.remove(<%=attr.getName()%>); +}*/ + if (reverse.isNavigable()) { +/*{ <%=attr.getName()%>.set<%=Util.capitalize(reverse.getName())%>(null); +}*/ + } +/*{ } + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); + if (log.isTraceEnabled()) { + log.trace("assocAttrName: " + assocAttrName); + } +/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> values) { + <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> oldValues =this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = values; + p.firePropertyChange("<%=attr.getName()%>", oldValues, values); + } + +}*/ + } + if (!attr.hasAssociationClass()) { +/*{ public <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getType()%><%=(isDTO(attr.getType())?"DTO":"")%>> get<%=Util.capitalize(attr.getName())%>() { + return this.<%=attr.getName()%>; + } + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); + if (log.isTraceEnabled()) { + log.trace("assocAttrName: " + assocAttrName); + } +/*{ public <%=((attr.isOrdered())?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>DTO> get<%=Util.capitalize(assocAttrName)%>() { + return this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + } + +}*/ + } + } + } + +/*{ + @Override + public String toString() { + String result = new ToStringBuilder(this). +}*/ + for (Object o : clazz.getAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + if (!(attr.isNavigable() + || attr.hasAssociationClass())) { + continue; + } + //FIXME possibilité de boucles (non directes) + ObjectModelClass attrEntity = null; + if (model.hasClass(attr.getType())) { + attrEntity = model.getClass(attr.getType()); + } + boolean isDTO = (attrEntity != null && attrEntity.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY)); + ObjectModelAttribute reverse = attr.getReverseAttribute(); + if ((isDTO && (reverse == null || !reverse.isNavigable()) && !attr.hasAssociationClass()) || (!isDTO)) { +/*{ append("<%=attr.getName()%>", this.<%=attr.getName()%>). +}*/ + } + } +/*{ toString(); + return result; + } + +} //<%=clazz.getName()%>DTO +}*/ + } + +} //EntityDTOGenerator Deleted: topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java =================================================================== --- topia/trunk/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java 2008-10-13 13:11:31 UTC (rev 1157) +++ topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java 2008-10-20 22:56:56 UTC (rev 1167) @@ -1,280 +0,0 @@ -/* *##% ToPIA - Tools for Portable and Independent Architecture - * Copyright (C) 2004 - 2008 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>. ##%*/ - -/* * -* EntityAbstractGenerator.java -* -* Created: 12 déc. 2005 -* -* @author Arnaud Thimel <thimel@codelutin.com> -* @version $Revision$ -* -* Mise a jour: $Date$ -* par : $Author$ -*/ - -package org.codelutin.topia.generator; - -import static org.codelutin.topia.generator.GeneratorUtil.TAG_ANNOTATION; -import static org.codelutin.topia.generator.GeneratorUtil.hasUnidirectionalRelationOnAbstractType; - -import java.io.File; -import java.io.IOException; -import java.io.Writer; -import java.util.Iterator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.codelutin.generator.ObjectModelGenerator; -import org.codelutin.generator.Util; -import org.codelutin.generator.models.object.ObjectModelAssociationClass; -import org.codelutin.generator.models.object.ObjectModelAttribute; -import org.codelutin.generator.models.object.ObjectModelClass; -import org.codelutin.generator.models.object.ObjectModelClassifier; - -/** - * Generateur d'entites abstraites. Il s'agit de l'implatation par defaut d'une - * entite. Les classes generees sont surchargees par un XXXImpl lorsque l'entite - * n'est pas abstraite. La surcharge peut etre ecrite par l'utilisateur. - */ -public class EntityDTOGenerator extends ObjectModelGenerator { - - /** - * Logger for this class - */ - private static final Log log = LogFactory - .getLog(EntityDTOGenerator.class); - - public EntityDTOGenerator() { - super(); - } - - @Override - public String getFilenameForClass(ObjectModelClass clazz) { - return clazz.getQualifiedName().replace('.', File.separatorChar) + "DTO.java"; - } - - public boolean isEntity(String type) { - ObjectModelClassifier clazz = model.getClassifier(type); - if (clazz == null) { - return false; - } - return clazz.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY); - } - - @Override - public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { - if (!clazz.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY)) { - return; - } - String copyright = GeneratorUtil.getCopyright(model); - if (GeneratorUtil.notEmpty(copyright)) { -/*{<%=copyright%> -}*/ - } -/*{package <%=clazz.getPackageName()%>; - -import org.apache.commons.lang.builder.ToStringBuilder; - -/** - * Implantation DTO pour l'entité <%=Util.capitalize(clazz.getName())%>. - *) -public class <%=clazz.getName()%>DTO }*/ - String extendClass = ""; - for (Iterator i=clazz.getSuperclasses().iterator(); i.hasNext();) { - ObjectModelClassifier parent = (ObjectModelClassifier)i.next(); - extendClass += parent.getQualifiedName() + "DTO"; - if (i.hasNext()) { - extendClass += ", "; - } - } - if (extendClass.length() > 0) { - /*{extends <%=extendClass%> }*/ - } - - /*{implements java.io.Serializable { - -}*/ - - String svUID = GeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model); - if (svUID != null) { -/*{ public static final long serialVersionUID = <%=svUID%>; - -}*/ - } - for (ObjectModelAttribute attr : clazz.getAttributes()) { - ObjectModelAttribute reverse = attr.getReverseAttribute(); - - // pour les asso quoi qu'il arrive il faut les lier des 2 cotes - // pour pouvoir supprimer en cascade l'asso lors de la suppression - // d'un des cotes - if (!(attr.isNavigable() - || hasUnidirectionalRelationOnAbstractType(reverse, model) - || attr.hasAssociationClass())) { - continue; - } - if (GeneratorUtil.hasDocumentation(attr)) { -/*{ /** - * <%=attr.getDocumentation()%> - *) -}*/ - } - String annotation = attr.getTagValue(TAG_ANNOTATION); - if (annotation != null && annotation.length() > 0) { -/*{ <%=annotation%> -}*/ - } - if (!Util.isNMultiplicity(attr)) { - if (!attr.hasAssociationClass()) { -/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> <%=attr.getName()%>; - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{ <%=attr.getVisibility()%> <%=attr.getAssociationClass().getQualifiedName()%>DTO <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; - -}*/ - } - } else { - if (!attr.hasAssociationClass()) { -/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] <%=attr.getName()%>; - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); -/*{ <%=attr.getVisibility()%> <%=attr.getAssociationClass().getQualifiedName()%>DTO[] <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; - -}*/ - } - } - } - - //Déclaration des attributs d'une classe d'associations - if (clazz instanceof ObjectModelAssociationClass) { - ObjectModelAssociationClass assoc = (ObjectModelAssociationClass)clazz; - for (Iterator i = assoc.getParticipantsAttributes().iterator(); i.hasNext(); ) { - ObjectModelAttribute attr = (ObjectModelAttribute) i.next(); - if (attr != null) { -/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> <%=Util.toLowerCaseFirstLetter(attr.getName())%>; - -}*/ - } - } - } - -/*{ /** - * Constructeur de <%=clazz.getName()%>DTO par défaut. - *) - public <%=clazz.getName()%>DTO() {} - -}*/ - - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); - ObjectModelAttribute reverse = attr.getReverseAttribute(); - - if (!(attr.isNavigable() - || hasUnidirectionalRelationOnAbstractType(reverse, model))) { - continue; - } - if (!Util.isNMultiplicity(attr)) { - if (!attr.hasAssociationClass()) { -/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> value) { - this.<%=attr.getName()%> = value; - } - - public <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> get<%=Util.capitalize(attr.getName())%>() { - return <%=attr.getName()%>; - } - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); - if (log.isTraceEnabled()) { log.trace("assocAttrName: " + assocAttrName); } -/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=attr.getAssociationClass().getQualifiedName()%>DTO association) { - this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = association; - } - - public <%=attr.getAssociationClass().getQualifiedName()%>DTO get<%=Util.capitalize(assocAttrName)%>() { - return <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; - } - -}*/ - } - } else { //NMultiplicity - if (!attr.hasAssociationClass()) { //Méthodes remplacées par des accesseurs sur les classes d'assoc -/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] values) { - this.<%=attr.getName()%> = values; - } - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); - if (log.isTraceEnabled()) { log.trace("assocAttrName: " + assocAttrName); } -/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=attr.getAssociationClass().getQualifiedName()%>DTO[] values) { - this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = values; - } - -}*/ - } - if (!attr.hasAssociationClass()) { -/*{ public <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] get<%=Util.capitalize(attr.getName())%>() { - return this.<%=attr.getName()%>; - } - -}*/ - } else { - String assocAttrName = GeneratorUtil.getAssocAttrName(attr); - if (log.isTraceEnabled()) { log.trace("assocAttrName: " + assocAttrName); } -/*{ public <%=attr.getAssociationClass().getQualifiedName()%>DTO[] get<%=Util.capitalize(assocAttrName)%>() { - return this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; - } - -}*/ - } - } - } - -/*{ /* (non-Javadoc) - * @see java.lang.Object#toString() - *) - public String toString() { - String result = new ToStringBuilder(this). -}*/ - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); - //FIXME possibilité de boucles (non directes) - ObjectModelClass attrEntity = null; - if (model.hasClass(attr.getType())) { - attrEntity = model.getClass(attr.getType()); - } - boolean isEntity = (attrEntity != null && attrEntity.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY)); - ObjectModelAttribute reverse = attr.getReverseAttribute(); - if ((isEntity && (reverse == null || !reverse.isNavigable()) && !attr.hasAssociationClass()) || (!isEntity)) { -/*{ append("<%=attr.getName()%>", this.<%=attr.getName()%>). -}*/ - } - } -/*{ toString(); - return result; - } - -} //<%=clazz.getName()%>DTO -}*/ - } - -} //EntityDTOGenerator Copied: topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java (from rev 1158, topia/trunk/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java) =================================================================== --- topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java (rev 0) +++ topia/tags/2.0.27/src/main/java/org/codelutin/topia/generator/EntityDTOGenerator.java 2008-10-20 22:56:56 UTC (rev 1167) @@ -0,0 +1,312 @@ +/* *##% ToPIA - Tools for Portable and Independent Architecture + * Copyright (C) 2004 - 2008 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>. ##%*/ + +/* * +* EntityAbstractGenerator.java +* +* Created: 12 déc. 2005 +* +* @author Arnaud Thimel <thimel@codelutin.com> +* @version $Revision$ +* +* Mise a jour: $Date$ +* par : $Author$ +*/ + +package org.codelutin.topia.generator; + +import static org.codelutin.topia.generator.GeneratorUtil.TAG_ANNOTATION; +import static org.codelutin.topia.generator.GeneratorUtil.hasUnidirectionalRelationOnAbstractType; + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.util.Iterator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.Util; +import org.codelutin.generator.models.object.ObjectModelAssociationClass; +import org.codelutin.generator.models.object.ObjectModelAttribute; +import org.codelutin.generator.models.object.ObjectModelClass; +import org.codelutin.generator.models.object.ObjectModelClassifier; + +/** + * Generateur d'entites abstraites. Il s'agit de l'implatation par defaut d'une + * entite. Les classes generees sont surchargees par un XXXImpl lorsque l'entite + * n'est pas abstraite. La surcharge peut etre ecrite par l'utilisateur. + */ +public class EntityDTOGenerator extends ObjectModelGenerator { + + /** + * Logger for this class + */ + private static final Log log = LogFactory + .getLog(EntityDTOGenerator.class); + + public EntityDTOGenerator() { + super(); + } + + @Override + public String getFilenameForClass(ObjectModelClass clazz) { + return clazz.getQualifiedName().replace('.', File.separatorChar) + "DTO.java"; + } + + public boolean isEntity(String type) { + ObjectModelClassifier clazz = model.getClassifier(type); + return clazz != null && clazz.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY); + } + + @Override + public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { + if (!clazz.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY)) { + return; + } + String copyright = GeneratorUtil.getCopyright(model); + if (GeneratorUtil.notEmpty(copyright)) { +/*{<%=copyright%> +}*/ + } +/*{package <%=clazz.getPackageName()%>; + +import org.apache.commons.lang.builder.ToStringBuilder; +import java.beans.PropertyChangeListener; + +/** + * Implantation DTO pour l'entité <%=Util.capitalize(clazz.getName())%>. + *) +public class <%=clazz.getName()%>DTO }*/ + String extendClass = ""; + for (Iterator i=clazz.getSuperclasses().iterator(); i.hasNext();) { + ObjectModelClassifier parent = (ObjectModelClassifier)i.next(); + extendClass += parent.getQualifiedName() + "DTO"; + if (i.hasNext()) { + extendClass += ", "; + } + } + if (extendClass.length() > 0) { + /*{extends <%=extendClass%> }*/ + } + + /*{implements java.io.Serializable { + +}*/ + + String svUID = GeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model); + if (svUID != null) { +/*{ public static final long serialVersionUID = <%=svUID%>; + +}*/ + } + for (ObjectModelAttribute attr : clazz.getAttributes()) { + ObjectModelAttribute reverse = attr.getReverseAttribute(); + + // pour les asso quoi qu'il arrive il faut les lier des 2 cotes + // pour pouvoir supprimer en cascade l'asso lors de la suppression + // d'un des cotes + if (!(attr.isNavigable() + || hasUnidirectionalRelationOnAbstractType(reverse, model) + || attr.hasAssociationClass())) { + continue; + } + if (GeneratorUtil.hasDocumentation(attr)) { +/*{ /** + * <%=attr.getDocumentation()%> + *) +}*/ + } + String annotation = attr.getTagValue(TAG_ANNOTATION); + if (annotation != null && annotation.length() > 0) { +/*{ <%=annotation%> +}*/ + } + if (!Util.isNMultiplicity(attr)) { + if (!attr.hasAssociationClass()) { +/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> <%=attr.getName()%>; + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{ <%=attr.getVisibility()%> <%=attr.getAssociationClass().getQualifiedName()%>DTO <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + +}*/ + } + } else { + if (!attr.hasAssociationClass()) { +/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] <%=attr.getName()%>; + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); +/*{ <%=attr.getVisibility()%> <%=attr.getAssociationClass().getQualifiedName()%>DTO[] <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + +}*/ + } + } + } + + //Déclaration des attributs d'une classe d'associations + if (clazz instanceof ObjectModelAssociationClass) { + ObjectModelAssociationClass assoc = (ObjectModelAssociationClass)clazz; + for (Object o : assoc.getParticipantsAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + if (attr != null) { +/*{ <%=attr.getVisibility()%> <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> <%=Util.toLowerCaseFirstLetter(attr.getName())%>; + +}*/ + } + } + } + +/*{ + protected java.beans.PropertyChangeSupport p; + +}*/ + +/*{ /** + * Constructeur de <%=clazz.getName()%>DTO par défaut. + *) + public <%=clazz.getName()%>DTO() { p = new java.beans.PropertyChangeSupport(this); } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + p.addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + p.removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.removePropertyChangeListener(propertyName, listener); + } + +}*/ + + for (Object o : clazz.getAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + ObjectModelAttribute reverse = attr.getReverseAttribute(); + + if (!(attr.isNavigable() + || hasUnidirectionalRelationOnAbstractType(reverse, model))) { + continue; + } + if (!Util.isNMultiplicity(attr)) { + if (!attr.hasAssociationClass()) { +/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> value) { + <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> oldValue = this.<%=attr.getName()%>; + this.<%=attr.getName()%> = value; + p.firePropertyChange("<%=attr.getName()%>", oldValue, value); + } + + public <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%> get<%=Util.capitalize(attr.getName())%>() { + return <%=attr.getName()%>; + } + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); + if (log.isTraceEnabled()) { + log.trace("assocAttrName: " + assocAttrName); + } +/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=attr.getAssociationClass().getQualifiedName()%>DTO association) { + <%=attr.getAssociationClass().getQualifiedName()%>DTO oldAssocation= this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = association; + p.firePropertyChange("<%=attr.getName()%>", oldAssocation, assocation); + } + + public <%=attr.getAssociationClass().getQualifiedName()%>DTO get<%=Util.capitalize(assocAttrName)%>() { + return <%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + } + +}*/ + } + } else { //NMultiplicity + if (!attr.hasAssociationClass()) { //Méthodes remplacées par des accesseurs sur les classes d'assoc +/*{ public void set<%=Util.capitalize(attr.getName())%>(<%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] values) { + <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] oldValues = this.<%=attr.getName()%>; + this.<%=attr.getName()%> = values; + p.firePropertyChange("<%=attr.getName()%>", oldValues, values); + } + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); + if (log.isTraceEnabled()) { + log.trace("assocAttrName: " + assocAttrName); + } +/*{ public void set<%=Util.capitalize(assocAttrName)%>(<%=attr.getAssociationClass().getQualifiedName()%>DTO[] values) { + <%=attr.getAssociationClass().getQualifiedName()%>DTO[] oldValues = this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%> = values; + p.firePropertyChange("<%=attr.getName()%>", oldValues, values); + } + +}*/ + } + if (!attr.hasAssociationClass()) { +/*{ public <%=attr.getType()%><%=(isEntity(attr.getType())?"DTO":"")%>[] get<%=Util.capitalize(attr.getName())%>() { + return this.<%=attr.getName()%>; + } + +}*/ + } else { + String assocAttrName = GeneratorUtil.getAssocAttrName(attr); + if (log.isTraceEnabled()) { + log.trace("assocAttrName: " + assocAttrName); + } +/*{ public <%=attr.getAssociationClass().getQualifiedName()%>DTO[] get<%=Util.capitalize(assocAttrName)%>() { + return this.<%=Util.toLowerCaseFirstLetter(assocAttrName)%>; + } + +}*/ + } + } + } + +/*{ + @Override + public String toString() { + String result = new ToStringBuilder(this). +}*/ + for (Object o : clazz.getAttributes()) { + ObjectModelAttribute attr = (ObjectModelAttribute) o; + //FIXME possibilité de boucles (non directes) + ObjectModelClass attrEntity = null; + if (model.hasClass(attr.getType())) { + attrEntity = model.getClass(attr.getType()); + } + boolean isEntity = (attrEntity != null && attrEntity.hasStereotype(GeneratorUtil.STEREOTYPE_ENTITY)); + ObjectModelAttribute reverse = attr.getReverseAttribute(); + if ((isEntity && (reverse == null || !reverse.isNavigable()) && !attr.hasAssociationClass()) || (!isEntity)) { +/*{ append("<%=attr.getName()%>", this.<%=attr.getName()%>). +}*/ + } + } +/*{ toString(); + return result; + } + +} //<%=clazz.getName()%>DTO +}*/ + } + +} //EntityDTOGenerator Deleted: topia/tags/2.0.27/src/site/site.xml =================================================================== --- topia/trunk/src/site/site.xml 2008-10-13 13:11:31 UTC (rev 1157) +++ topia/tags/2.0.27/src/site/site.xml 2008-10-20 22:56:56 UTC (rev 1167) @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="Topia"> - - <skin> - <groupId>org.codelutin</groupId> - <artifactId>maven-lutin-skin</artifactId> - <version>0.2</version> - </skin> - - <bannerLeft> - <name>Topia</name> - </bannerLeft> - - <bannerRight> - <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> - <href>http://www.codelutin.com</href> - </bannerRight> - - <poweredBy> - <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> - <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> - <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" img="images/restructuredtext-logo.png"/> - </poweredBy> - - <body> - <links> - <item name="ToPIA Service" href="http://topia.labs.libre-entreprise.org/topia-service"/> - <item name="Labs" href="http://labs.libre-entreprise.org/"/> - <item name="Code Lutin" href="http://www.codelutin.com/"/> - </links> - - <menu name="Utilisateur"> - <item href="/index.html" name="Accueil"></item> - <item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/org/codelutin/topia/" name="Téléchargement"/> - </menu> - - <menu name="Developpeur"> - <item name="Todo" href="Todo.html"/> - <item name="Mapping hibernate" href="HibernateMapping.html"/> - <item name="Gestion des evenements" href="event.html"/> - <item name="Isolation" href="Isolation.html"/> - <item name="Schema migration" href="SchemaMigration.html"/> - <item name="Securité" href="security.html"/> - </menu> - - ${reports} - - </body> -</project> Copied: topia/tags/2.0.27/src/site/site.xml (from rev 1158, topia/trunk/src/site/site.xml) =================================================================== --- topia/tags/2.0.27/src/site/site.xml (rev 0) +++ topia/tags/2.0.27/src/site/site.xml 2008-10-20 22:56:56 UTC (rev 1167) @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="${project.name}"> + + <publishDate format="dd/MM/yyyy"/> + + <skin> + <groupId>org.codelutin</groupId> + <artifactId>maven-lutin-skin</artifactId> + <version>0.2.1</version> + </skin> + + <bannerLeft> + <name>${project.name}</name> + <!--src>http://buix.labs.libre-entreprise.org/lutinjaxx/jaxx.png</src--> + <href>index.html</href> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>${project.organization.url}</href> + </bannerRight> + + <poweredBy> + <logo href="http://maven.apache.org" name="Maven" img="images/logos/maven-feather.png"/> + <logo href="http://jrst.labs.libre-entreprise.org" name="JRst" img="images/jrst-logo.png"/> + <logo href="http://docutils.sourceforge.net/rst.html" name="ReStructuredText" + img="images/restructuredtext-logo.png"/> + </poweredBy> + + <body> + <links> + <item name="ToPIA Service" href="http://topia.labs.libre-entreprise.org/topia-service"/> + <item name="Labs" href="http://labs.libre-entreprise.org/"/> + <item name="Code Lutin" href="http://www.codelutin.com/"/> + </links> + + <menu ref="parent"/> + + <menu name="Utilisateur"> + <item href="/index.html" name="Accueil"/> + <!--item href="http://lutinbuilder.labs.libre-entreprise.org/maven2/org/codelutin/topia/" + name="Téléchargement"/--> + </menu> + + <menu name="Téléchargement"> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}/${project.version}" + name="Télécharger la dernière version"/> + <item href="${labs.builder.url}/org/codelutin/${project.artifactId}" + name="Voir toutes les versions"/> + </menu> + + <menu name="Developpeur"> + <item name="Todo" href="Todo.html"/> + <item name="Mapping hibernate" href="HibernateMapping.html"/> + <item name="Gestion des evenements" href="event.html"/> + <item name="Isolation" href="Isolation.html"/> + <item name="Schema migration" href="SchemaMigration.html"/> + <item name="Securité" href="security.html"/> + </menu> + + <menu ref="reports"/> + + </body> +</project>