Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java:1.17 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java:1.18 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java:1.17 Wed May 19 10:33:03 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityDOClassGenerator.java Fri May 28 15:40:16 2004 @@ -97,7 +97,7 @@ } else { ObjectModelClassifier classifier = attribute.getClassifier(); /*{ - <%=attribute.getVisibility()%> <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>; + <%=attribute.getVisibility()%> <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>DO; }*/ } } @@ -107,7 +107,9 @@ protected java.util.Date _lastUpdateDate; protected TopiaUser _lastUpdateUser; - public <%=clazz.getName()%>JDODO() { } + public <%=clazz.getName()%>JDODO() { super(); + + } }*/ @@ -133,35 +135,49 @@ } // Not a derived attribute : + + if (!Util.isReadOnly(attribute)) { + if ((attribute.getMaxMultiplicity() == -1) || (attribute.getMaxMultiplicity()>1)) { /*{ public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { return <%=attribute.getName()%>; } -}*/ - if (!Util.isReadOnly(attribute)) { -/*{ public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { -}*/ - if ((attribute.getMaxMultiplicity() == -1) || (attribute.getMaxMultiplicity()>1)) { -/*{ this.<%=attribute.getName()%> = (<%=attribute.getName()%> == null)?<%=Util.getAttributeInitValue(attribute)%>:<%=attribute.getName()%>; + } + }*/ - } else { - ObjectModelClassifier classifier = attribute.getClassifier(); - if (classifier != null) { + } else { + ObjectModelClassifier classifier = attribute.getClassifier(); + if (classifier == null) { +// /*{ - this.<%=attribute.getName()%> = (<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO) <%=attribute.getName()%>; + public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { + return <%=attribute.getName()%>; + } + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { + this.<%=attribute.getName()%> = <%=attribute.getName()%>; + } + }*/ } else { /*{ - this.<%=attribute.getName()%> = <%=attribute.getName()%>; + public <%=Util.getAttributeType(attribute)%> get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>() throws TopiaException { + return <%=attribute.getName()%>DO; + } + public <%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO() throws TopiaException { + return <%=attribute.getName()%>DO; + } + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> <%=attribute.getName()%>) throws TopiaException { + set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO((<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO) <%=attribute.getName()%>); + } + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>DO(<%=classifier.getPackageName()+".persistence."+classifier.getName()%>JDODO <%=attribute.getName()%>DO) throws TopiaException { + this.<%=attribute.getName()%>DO = <%=attribute.getName()%>DO; + } + }*/ } - } -/*{ - } -}*/ } /*{ Index: topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java:1.3 topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java:1.4 --- topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java:1.3 Wed May 19 10:33:03 2004 +++ topia/src/java/org/codelutin/topia/generators/jdo/ObjectModelToEntityPersistenceServiceClassGenerator.java Fri May 28 15:40:16 2004 @@ -23,9 +23,9 @@ * * @author Cédric Pineau * Copyright Code Lutin -* @version $Revision: 1.3 $ +* @version $Revision: 1.4 $ * -* Last update : $Date: 2004/05/19 10:33:03 $ +* Last update : $Date: 2004/05/28 15:40:16 $ * by : $Author: pineau $ */ package org.codelutin.topia.generators.jdo; @@ -36,10 +36,11 @@ import java.util.Iterator; import org.codelutin.generator.ObjectModelGenerator; -import org.codelutin.topia.Util; 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; +import org.codelutin.topia.Util; /** * @author cedric @@ -103,8 +104,8 @@ * * @return the transient transferable <%=clazz.getName()%>. *) - public final TopiaEntity create() throws TopiaException { - return getContext().getEntity(<%=clazz.getName()%>.class); + public final <%=clazz.getName()%> create() throws TopiaException { + return (<%=clazz.getName()%>) super.create(<%=clazz.getName()%>.class); } public <%=clazz.getName()%> makePersistent(<%=clazz.getName()%> <%=Util.toLowerCaseFirstLetter(clazz.getName())%>) throws TopiaException { @@ -332,9 +333,22 @@ _do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(_to.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>()); }*/ } else { + ObjectModelClassifier classifier = (ObjectModelClassifier) attribute.getClassifier(); /*{ - // TODO Recherche par le context _do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(<%=attribute.getType()%>DAO.getInstance().toDO(<%=Util.toLowerCaseFirstLetter(clazz.getName())%>DTO.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(), pendingDOs)); + { <%=Util.getParentPackageName(classifier.getPackageName())+".services.jdo."+classifier.getName()%>JDOPersistenceService <%=Util.toUpperCaseFirstLetter(classifier.getName())%>PersistenceService = (<%=Util.getParentPackageName(classifier.getPackageName())+".services.jdo."+classifier.getName()%>JDOPersistenceService) getContext().getToto(<%=Util.getParentPackageName(classifier.getPackageName())+".services."+classifier.getName()%>PersistenceService.class); +}*/ + if ((attribute.getMaxMultiplicity() > 1) || (attribute.getMaxMultiplicity( )== -1)) { +/*{ + //_do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>((<%=Util.getAttributeType(attribute)%>) <%=Util.toUpperCaseFirstLetter(classifier.getName())%>PersistenceService.toDO((<%=Util.getAttributeType(attribute)%>) _to.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(), pendingDOs)); +} }*/ + } else { +/*{ + _do.set<%=Util.toUpperCaseFirstLetter(attribute.getName())%>((<%=classifier.getPackageName()%>.persistence.<%=classifier.getName()%>JDODO) <%=Util.toUpperCaseFirstLetter(classifier.getName())%>PersistenceService.toDO((<%=classifier.getPackageName()%>.transfer.<%=classifier.getName()%>TO) _to.get<%=Util.toUpperCaseFirstLetter(attribute.getName())%>(), pendingDOs)); +} +}*/ + } + } } /*{ @@ -454,7 +468,7 @@ * * @return the transient transferable TopiaEntity. *) - public TopiaEntity create() throws TopiaException { + public <%=interfacez.getName()%> create() throws TopiaException { throw new TopiaException("You can't create an instance of <%=interfacez.getName()%> as it is an interface"); }