Index: topia/src/java/org/codelutin/topia/PrivateTopiaEntity.java diff -u topia/src/java/org/codelutin/topia/PrivateTopiaEntity.java:1.1 topia/src/java/org/codelutin/topia/PrivateTopiaEntity.java:1.2 --- topia/src/java/org/codelutin/topia/PrivateTopiaEntity.java:1.1 Wed Jun 16 09:41:26 2004 +++ topia/src/java/org/codelutin/topia/PrivateTopiaEntity.java Fri Jun 18 18:29:19 2004 @@ -23,14 +23,16 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/06/16 09:41:26 $ + * Mise a jour: $Date: 2004/06/18 18:29:19 $ * par : $Author: bpoussin $ */ package org.codelutin.topia; +import java.util.HashSet; + /** * Methode utilisée par le framework, elles se retrouvent sur les TO et les DO */ @@ -40,14 +42,6 @@ public void set_creationDate_(java.util.Date creationDate) throws TopiaException; public void set_lastUpdateDate_(java.util.Date lastUpdateDate) throws TopiaException; public void set_lastUpdateUser_(TopiaUser lastUpdateUser) throws TopiaException; - - /** - * Permet de modifier toutes les proprietes de l'objet, Id compris en - * copiant les informations de l'entity passé en paramètre. - * @param entity une entity respectant l'interface de l'objet ou un enfant - * de cette interface. - */ - public void set_allProperties_(TopiaEntity enity) throws TopiaException; } // PrivateTopiaEntity Index: topia/src/java/org/codelutin/topia/PrivateTopiaPersistenceService.java diff -u topia/src/java/org/codelutin/topia/PrivateTopiaPersistenceService.java:1.2 topia/src/java/org/codelutin/topia/PrivateTopiaPersistenceService.java:1.3 --- topia/src/java/org/codelutin/topia/PrivateTopiaPersistenceService.java:1.2 Wed Jun 16 09:41:26 2004 +++ topia/src/java/org/codelutin/topia/PrivateTopiaPersistenceService.java Fri Jun 18 18:29:19 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/06/16 09:41:26 $ + * Mise a jour: $Date: 2004/06/18 18:29:19 $ * par : $Author: bpoussin $ */ @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.List; +import java.util.HashSet; /** * Regroupement de tout les méthodes du framework pour les services de @@ -43,8 +44,8 @@ // pas besoin de donner le type exacte (DO ou TO) TopiaEntity suffit car // la première chose que l'on fait est un cast dans l'implantation. // et ces méthodes ne doivent être utilisé que par le framework - public TopiaEntityTO toTO(TopiaEntity _do) throws TopiaException; - public TopiaEntityDO toDO(TopiaEntity _to) throws TopiaException; + public TopiaEntityTO toTO(TopiaEntityDO _do) throws TopiaException; + public TopiaEntityDO toDO(TopiaEntityTO _to, HashSet done) throws TopiaException; public TopiaEntityDO findDOByTopiaId(Object id) throws TopiaException; public TopiaEntityTO findByTopiaId(Object id) throws TopiaException; /** Index: topia/src/java/org/codelutin/topia/TopiaEntity.java diff -u topia/src/java/org/codelutin/topia/TopiaEntity.java:1.11 topia/src/java/org/codelutin/topia/TopiaEntity.java:1.12 --- topia/src/java/org/codelutin/topia/TopiaEntity.java:1.11 Wed Jun 16 09:41:26 2004 +++ topia/src/java/org/codelutin/topia/TopiaEntity.java Fri Jun 18 18:29:19 2004 @@ -23,9 +23,9 @@ * * @author Cédric Pineau * Copyright Code Lutin -* @version $Revision: 1.11 $ +* @version $Revision: 1.12 $ * -* Last update : $Date: 2004/06/16 09:41:26 $ +* Last update : $Date: 2004/06/18 18:29:19 $ * by : $Author: bpoussin $ */ package org.codelutin.topia; @@ -40,5 +40,6 @@ public java.util.Date get_creationDate_() throws TopiaException; public java.util.Date get_lastUpdateDate_() throws TopiaException; public TopiaUser get_lastUpdateUser_() throws TopiaException; + public Class getEntityClass(); } // TopiaEntity Index: topia/src/java/org/codelutin/topia/TopiaEntityDO.java diff -u topia/src/java/org/codelutin/topia/TopiaEntityDO.java:1.6 topia/src/java/org/codelutin/topia/TopiaEntityDO.java:1.7 --- topia/src/java/org/codelutin/topia/TopiaEntityDO.java:1.6 Wed Jun 16 09:41:26 2004 +++ topia/src/java/org/codelutin/topia/TopiaEntityDO.java Fri Jun 18 18:29:19 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ * - * Mise a jour: $Date: 2004/06/16 09:41:26 $ + * Mise a jour: $Date: 2004/06/18 18:29:19 $ * par : $Author: bpoussin $ */ @@ -36,6 +36,6 @@ * Interface que doivent implanter tous les objets de type DO (Data Object) qui * sont les objets r?ellement stock?. */ -public interface TopiaEntityDO extends TopiaEntity, PrivateTopiaEntity { +public interface TopiaEntityDO extends TopiaEntity, PrivateTopiaEntityDO { } Index: topia/src/java/org/codelutin/topia/TopiaEntityTO.java diff -u topia/src/java/org/codelutin/topia/TopiaEntityTO.java:1.6 topia/src/java/org/codelutin/topia/TopiaEntityTO.java:1.7 --- topia/src/java/org/codelutin/topia/TopiaEntityTO.java:1.6 Wed Jun 16 09:41:26 2004 +++ topia/src/java/org/codelutin/topia/TopiaEntityTO.java Fri Jun 18 18:29:19 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ * - * Mise a jour: $Date: 2004/06/16 09:41:26 $ + * Mise a jour: $Date: 2004/06/18 18:29:19 $ * par : $Author: bpoussin $ */ @@ -39,7 +39,7 @@ * qui sont les objects qui servent réellemnt dans l'application. Ces objets * doivent être serializable */ -public interface TopiaEntityTO extends TopiaEntity, PrivateTopiaEntity, Serializable { // TopiaEntityTO +public interface TopiaEntityTO extends TopiaEntity, PrivateTopiaEntityTO, Serializable { // TopiaEntityTO public void set_topiaId_(Object topiaId) throws TopiaException; Index: topia/src/java/org/codelutin/topia/Util.java diff -u topia/src/java/org/codelutin/topia/Util.java:1.6 topia/src/java/org/codelutin/topia/Util.java:1.7 --- topia/src/java/org/codelutin/topia/Util.java:1.6 Wed Jun 16 09:41:26 2004 +++ topia/src/java/org/codelutin/topia/Util.java Fri Jun 18 18:29:19 2004 @@ -23,9 +23,9 @@ * * @author Cédric Pineau * Copyright Code Lutin -* @version $Revision: 1.6 $ +* @version $Revision: 1.7 $ * -* Last update : $Date: 2004/06/16 09:41:26 $ +* Last update : $Date: 2004/06/18 18:29:19 $ * by : $Author: bpoussin $ */ package org.codelutin.topia; @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.Iterator; +import org.codelutin.generator.models.object.ObjectModelParameter; import org.codelutin.generator.models.object.ObjectModelAttribute; import org.codelutin.generator.models.object.ObjectModelClass; import org.codelutin.generator.models.object.ObjectModelClassifier; @@ -189,6 +190,17 @@ public static boolean isVersioned(ObjectModelAttribute attribute) { String value = attribute.getTagValue("versioned"); return "true".equals(value); + } + + public static String getAttributeTypeForDO(ObjectModelParameter attribute) { + String result; + if (attribute instanceof ObjectModelAttribute + && isNMultiplicity((ObjectModelAttribute)attribute)){ + result = "java.util.List"; + }else{ + result = attribute.getType(); + } + return result; } /** Index: topia/src/java/org/codelutin/topia/AbstractTopiaEntityDO.java diff -u /dev/null topia/src/java/org/codelutin/topia/AbstractTopiaEntityDO.java:1.1 --- /dev/null Fri Jun 18 18:29:25 2004 +++ topia/src/java/org/codelutin/topia/AbstractTopiaEntityDO.java Fri Jun 18 18:29:19 2004 @@ -0,0 +1,37 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * AbstractTopiaEntityDO.java + * + * Created: 18 juin 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/06/18 18:29:19 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.topia; + +public abstract class AbstractTopiaEntityDO extends AbstractTopiaEntity implements TopiaEntityDO { // AbstractTopiaEntityDO + +} // AbstractTopiaEntityDO + Index: topia/src/java/org/codelutin/topia/AbstractTopiaEntityTO.java diff -u /dev/null topia/src/java/org/codelutin/topia/AbstractTopiaEntityTO.java:1.1 --- /dev/null Fri Jun 18 18:29:25 2004 +++ topia/src/java/org/codelutin/topia/AbstractTopiaEntityTO.java Fri Jun 18 18:29:19 2004 @@ -0,0 +1,45 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * AbstractTopiaEntityTO.java + * + * Created: 18 juin 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/06/18 18:29:19 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.topia; + +import java.util.HashSet; + +public abstract class AbstractTopiaEntityTO extends AbstractTopiaEntity implements TopiaEntityTO { // AbstractTopiaEntityTO + + public TopiaEntityDO toDO(HashSet done) throws TopiaException { + PrivateTopiaPersistenceService ptps = (PrivateTopiaPersistenceService) + getContext().getPersistenceService(getEntityClass()); + return ptps.toDO(this, done); + } + +} // AbstractTopiaEntityTO + Index: topia/src/java/org/codelutin/topia/PrivateTopiaEntityDO.java diff -u /dev/null topia/src/java/org/codelutin/topia/PrivateTopiaEntityDO.java:1.1 --- /dev/null Fri Jun 18 18:29:25 2004 +++ topia/src/java/org/codelutin/topia/PrivateTopiaEntityDO.java Fri Jun 18 18:29:19 2004 @@ -0,0 +1,46 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PrivateTopiaEntityDO.java + * + * Created: 17 juin 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/06/18 18:29:19 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.topia; + +import java.util.HashSet; + +public interface PrivateTopiaEntityDO extends PrivateTopiaEntity { // PrivateTopiaEntityDO + /** + * Permet de modifier toutes les proprietes de l'objet, Id compris en + * copiant les informations de l'entity passé en paramètre. + * @param entity une entity respectant l'interface de l'objet ou un enfant + * de cette interface. + */ + public void set_allProperties_(TopiaEntityTO enity, HashSet done) throws TopiaException; + +} // PrivateTopiaEntityDO + Index: topia/src/java/org/codelutin/topia/PrivateTopiaEntityTO.java diff -u /dev/null topia/src/java/org/codelutin/topia/PrivateTopiaEntityTO.java:1.1 --- /dev/null Fri Jun 18 18:29:25 2004 +++ topia/src/java/org/codelutin/topia/PrivateTopiaEntityTO.java Fri Jun 18 18:29:19 2004 @@ -0,0 +1,48 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * PrivateTopiaEntityTO.java + * + * Created: 17 juin 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2004/06/18 18:29:19 $ + * par : $Author: bpoussin $ + */ + +package org.codelutin.topia; + +import java.util.HashSet; + +public interface PrivateTopiaEntityTO extends PrivateTopiaEntity { // PrivateTopiaEntityTO + /** + * Permet de modifier toutes les proprietes de l'objet, Id compris en + * copiant les informations de l'entity passé en paramètre. + * @param entity une entity respectant l'interface de l'objet ou un enfant + * de cette interface. + */ + public void set_allProperties_(TopiaEntity enity) throws TopiaException; + + public TopiaEntityDO toDO(HashSet done) throws TopiaException; + +} // PrivateTopiaEntityTO +