Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java:1.6 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java:1.7 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java:1.6 Fri Sep 17 16:02:49 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java Fri Dec 17 16:13:51 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ * - * Mise a jour: $Date: 2004/09/17 16:02:49 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2004/12/17 16:13:51 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators; @@ -297,10 +297,10 @@ }else{ /*{ this._topiaId_ = entity.get_topiaId_(); - this._version_ = entity.get_version_(); - this._creationDate_ = entity.get_creationDate_(); - this._lastUpdateDate_ = entity.get_lastUpdateDate_(); - this._lastUpdateUser_ = entity.get_lastUpdateUser_(); + this._topiaVersion_ = entity.get_topiaVersion_(); + this._topiaCreationDate_ = entity.get_topiaCreationDate_(); + this._topiaLastUpdateDate_ = entity.get_topiaLastUpdateDate_(); + this._topiaLastUpdateUser_ = entity.get_topiaLastUpdateUser_(); }*/ } Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java:1.4 topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java:1.5 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java:1.4 Wed Sep 22 15:46:30 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java Fri Dec 17 16:13:51 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * - * Mise a jour: $Date: 2004/09/22 15:46:30 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2004/12/17 16:13:51 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators; @@ -39,6 +39,7 @@ import org.codelutin.generator.ObjectModelGenerator; import org.codelutin.generator.models.object.ObjectModel; import org.codelutin.generator.models.object.ObjectModelClass; +import org.codelutin.generator.models.object.ObjectModelClassifier; import org.codelutin.topia.generators.Util; public class ObjectModelToContextPropertiesGenerator extends ObjectModelGenerator { // ObjectModelToContextPropertiesGenerator @@ -64,8 +65,8 @@ context.helper.hook=org.codelutin.topia.hook.DefaultHookHelper }*/ - for(Iterator i=model.getClasses().iterator(); i.hasNext();){ - ObjectModelClass clazz = (ObjectModelClass)i.next(); + for(Iterator i=model.getClassifiers().iterator(); i.hasNext();){ + ObjectModelClassifier clazz = (ObjectModelClassifier)i.next(); if(Util.isEntity(clazz)){ /*{mapping.implementation.<%=clazz.getQualifiedName()%>Operation=<%=clazz.getQualifiedName()%>OperationImpl mapping.distribution.<%=clazz.getQualifiedName()%>Operation=<%=clazz.getQualifiedName()%>OperationRouter Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.3 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.4 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.3 Wed Sep 15 14:36:04 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java Fri Dec 17 16:13:51 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Mise a jour: $Date: 2004/09/15 14:36:04 $ + * Mise a jour: $Date: 2004/12/17 16:13:51 $ * par : $Author: pineau $ */ @@ -43,6 +43,7 @@ import org.codelutin.generator.models.object.ObjectModelClassifier; import org.codelutin.generator.models.object.ObjectModelInterface; import org.codelutin.generator.models.object.ObjectModelOperation; +import org.codelutin.topia.TopiaException; import org.codelutin.topia.generators.Util; import java.util.LinkedList; @@ -61,7 +62,8 @@ } public boolean accept(ObjectModelClassifier clazz){ - return Util.isEntity(clazz) && clazz instanceof ObjectModelClass; +// return Util.isEntity(clazz) && clazz instanceof ObjectModelClass; + return Util.isEntity(clazz); } ////////////////////////////////////////////////////////////////////// @@ -85,6 +87,8 @@ }else{ /*{AbstractTopiaPersistenceService}*/ } + }else{ + /*{AbstractTopiaPersistenceService}*/ } /*{ implements <%=clazz.getName()%>PersistenceService}*/ @@ -126,7 +130,8 @@ ////////////////////////////////////////////////////////////////////// public void generateOther(Writer output, ObjectModelClassifier clazzifier) throws IOException { - ObjectModelClass clazz = (ObjectModelClass)clazzifier; + if(clazzifier instanceof ObjectModelClass){ + ObjectModelClass clazz = (ObjectModelClass)clazzifier; /*{ /** @@ -190,7 +195,61 @@ } }*/ + } else { + ObjectModelInterface interfacz = (ObjectModelInterface)clazzifier; +/*{ + + /** + * Return new entity + *) + public <%=interfacz.getName()%> create<%=interfacz.getName()%>() throws TopiaException { + throw new TopiaException("Interface entity can't be instanciate"); + } + + public <%=interfacz.getName()%> makePersistent(<%=interfacz.getName()%> entity) throws TopiaException { + if (! (entity instanceof <%=interfacz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + return (<%=interfacz.getName()%>)super.makePersistent(entity); + } + + public <%=interfacz.getName()%> update(<%=interfacz.getName()%> entity) throws TopiaException { + if (! (entity instanceof <%=interfacz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + return (<%=interfacz.getName()%>)super.update(entity); + } + + public void delete(<%=interfacz.getName()%> entity) throws TopiaException { + if (! (entity instanceof <%=interfacz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + super.delete(entity); + } + + /** + * Return entity Class managed by this service + *) + public Class getEntityClass(){ + return <%=interfacz.getName()%>.class; + } + + /** + * Retourne le context d'application associe a cette entite + *) + public <%=model.getName()%>Context getAppContext(){ + <%=model.getName()%>Context context = (<%=model.getName()%>Context)getContext(); + return context; } + public String [] getFieldNames() throws TopiaException { + throw new TopiaException("There is no field on a Interface entity !"); + } + +}*/ + + } + + } } // OjectModelToEntityPersistenceServiceImplGenerator