Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityGenerator.java:1.2 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityGenerator.java:1.3 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityGenerator.java:1.2 Fri Aug 6 17:48:52 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityGenerator.java Thu Sep 16 14:07:45 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/08/06 17:48:52 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2004/09/16 14:07:45 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators.jdo; @@ -43,8 +43,11 @@ import org.codelutin.generator.models.object.ObjectModelClassifier; import org.codelutin.generator.models.object.ObjectModelInterface; import org.codelutin.generator.models.object.ObjectModelOperation; + import java.io.File; +import javax.jdo.PersistenceManager; + public class ObjectModelToJDOEntityGenerator extends TopiaAbstractObjectModelGenerator { // ObjectModelToJDOEntityGenerator public ObjectModelToJDOEntityGenerator(){ @@ -146,6 +149,9 @@ public void generateOther(Writer output, ObjectModelClassifier clazzifier) throws IOException { if(!(clazzifier instanceof ObjectModelClass)){ +/*{ + public TopiaEntity getLazy(TopiaContext context) throws TopiaException; +}*/ return; } @@ -180,7 +186,7 @@ * d'update sur les Entities elle meme modifié. * @param topiaEntity une vrai entity et pas un Lazy *) - public void update(TopiaEntity topiaEntity, HashSet done) throws TopiaException { + public void update(TopiaEntity topiaEntity, HashSet done, PersistenceManager pm) throws TopiaException { <%=clazz.getQualifiedName()%>Impl entity = (<%=clazz.getQualifiedName()%>Impl)topiaEntity; this._topiaId_ = entity.get_topiaId_(); @@ -207,7 +213,7 @@ /*{ TopiaEntity te = (TopiaEntity)entity.get<%=Util.capitalize(attribute.getName())%>(); if (te != null){ - JDOEntity tejdo = getPersistenceHelper().update(te, done); + JDOEntity tejdo = getPersistenceHelper().update(te, done, pm); this.<%=attribute.getName()%> = (<%=Util.getJDOClassName(Util.getAttributeType(attribute))%>)tejdo; }else{ this.<%=attribute.getName()%> = null; @@ -273,7 +279,8 @@ if(<%=attribute.getName()%> == null){ entity.set<%=Util.capitalize(attribute.getName())%>(null); }else{ - entity.set<%=Util.capitalize(attribute.getName())%>(new <%=Util.getLazyClassName(attribute.getType())%>(getContext(), <%=attribute.getName()%>.get_topiaId_(), <%=attribute.getName()%>.get_version_())); + entity.set<%=Util.capitalize(attribute.getName())%>((<%=attribute.getType()%>) <%=attribute.getName()%>.getLazy(getContext())); + // TODO entity.set<%=Util.capitalize(attribute.getName())%>(new <%=Util.getLazyClassName(attribute.getType())%>(getContext(), <%=attribute.getName()%>.get_topiaId_(), <%=attribute.getName()%>.get_version_())); } }*/ } @@ -288,7 +295,8 @@ /*{ for(Iterator i=<%=attribute.getName()%>.iterator(); i.hasNext();){ JDOEntity e = (JDOEntity)i.next(); - entity.add<%=Util.capitalize(attribute.getName())%>(new <%=Util.getLazyClassName(attribute.getType())%>(getContext(), e.get_topiaId_(), e.get_version_())); + entity.add<%=Util.capitalize(attribute.getName())%>((<%=attribute.getType()%>) e.getLazy(getContext())); + // TODO entity.add<%=Util.capitalize(attribute.getName())%>(new <%=Util.getLazyClassName(attribute.getType())%>(getContext(), e.get_topiaId_(), e.get_version_())); } }*/ } @@ -302,6 +310,9 @@ return new <%=clazz.getName()%>Lazy(getContext(), result); } + public TopiaEntity getLazy(TopiaContext context) throws TopiaException { + return new <%=clazzifier.getName()%>Lazy(context, get_topiaId_(), get_version_()); + } ////////////////////////////////////////////////////////////////////// // all next method are in abstract class before Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityMetaDataGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityMetaDataGenerator.java:1.1 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityMetaDataGenerator.java:1.2 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityMetaDataGenerator.java:1.1 Fri Aug 6 17:48:52 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToJDOEntityMetaDataGenerator.java Thu Sep 16 14:07:45 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/08/06 17:48:52 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2004/09/16 14:07:45 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators.jdo; @@ -57,7 +57,7 @@ } protected boolean isTJDO(){ - return "tjdo".equals(getProperty("jdo.implementation")); + return true; // TODO "tjdo".equals(getProperty("jdo.implementation")); } public String getFilenameForClass(ObjectModelClass clazz) { @@ -72,7 +72,7 @@ // ------------- XML header /*{ - + }*/ // ------------- JDO start