Index: topia/src/java/org/codelutin/topia/persistence/LazyEntityGenerator.java diff -u topia/src/java/org/codelutin/topia/persistence/LazyEntityGenerator.java:1.4 topia/src/java/org/codelutin/topia/persistence/LazyEntityGenerator.java:1.5 --- topia/src/java/org/codelutin/topia/persistence/LazyEntityGenerator.java:1.4 Sat Feb 5 10:47:09 2005 +++ topia/src/java/org/codelutin/topia/persistence/LazyEntityGenerator.java Fri Jun 10 08:21:58 2005 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * - * Mise a jour: $Date: 2005/02/05 10:47:09 $ - * par : $Author: pineau $ + * Mise a jour: $Date: 2005/06/10 08:21:58 $ + * par : $Author: thimel $ */ package org.codelutin.topia.persistence; @@ -94,7 +94,7 @@ Iterator i = clazz.getSuperclasses().iterator(); if (i.hasNext()) { ObjectModelClass superclass = (ObjectModelClass) i.next(); -/*{ extends <%=superclass.getName()%>Lazy}*/ +/*{ extends <%=superclass.getPackageName()%>.persistence.jdo.<%=superclass.getName()%>Lazy}*/ } else { /*{ extends AbstractLazyEntity}*/ } @@ -102,7 +102,7 @@ /*{ extends AbstractLazyEntity}*/ } - /*{ implements <%=clazzifier.getQualifiedName()%>}*/ + /*{ implements <%=clazzifier.getName()%>}*/ } ////////////////////////////////////////////////////////////////////// @@ -126,6 +126,14 @@ return getTypedEntity().get<%=Util.capitalize(attribute.getName())%>(); } }*/ + if (attribute.hasAssociationClass()) { +/*{ + public <%=attribute.getAssociationClass().getQualifiedName()%> get<%=attribute.getAssociationClass().getName()%>() throws TopiaException { + load(); + return getTypedEntity().get<%=attribute.getAssociationClass().getName()%>(); + } +}*/ + } } public void generateGetNormalNMultiplicityAttributeAccessor(Writer output, ObjectModelAttribute attribute) @@ -138,9 +146,45 @@ load(); return getTypedEntity().get<%=Util.capitalize(attribute.getName())%>(); } + + public int sizeOf<%=Util.capitalize(attribute.getName())%>() throws TopiaException { + load(); + return getTypedEntity().sizeOf<%=Util.capitalize(attribute.getName())%>(); + } + + public Iterator iteratorOn<%=Util.capitalize(attribute.getName())%>() throws TopiaException { + load(); + return getTypedEntity().iteratorOn<%=Util.capitalize(attribute.getName())%>(); + } + + public boolean containsIn<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException { + load(); + return getTypedEntity().containsIn<%=Util.capitalize(attribute.getName())%>(value); + } + + public boolean containsAllIn<%=Util.capitalize(attribute.getName())%>(java.util.Collection values) throws TopiaException { + load(); + return getTypedEntity().containsAllIn<%=Util.capitalize(attribute.getName())%>(values); + } + + public <%=attribute.getType()%> get<%=Util.capitalize(attribute.getName())%>(int index) throws TopiaException { + load(); + return getTypedEntity().get<%=Util.capitalize(attribute.getName())%>(index); + } + }*/ } + public void generateGetAssociationAttributeAccessor(Writer output, ObjectModelAttribute attribute) throws IOException { +/*{ + public <%=attribute.getType()%> get<%=Util.capitalize(attribute.getName())%>() throws TopiaException { + load(); + return getTypedEntity().get<%=Util.capitalize(attribute.getName())%>(); + } +}*/ + } + + ////////////////////////////////////////////////////////////////////// // S E T A T T R I B U T E S A C C E S S O R S ////////////////////////////////////////////////////////////////////// @@ -158,20 +202,32 @@ public void generateSetNormalAttributeAccessor(Writer output, ObjectModelAttribute attribute) throws IOException { + if (!attribute.hasAssociationClass()) { /*{ public void set<%=Util.capitalize(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> value) throws TopiaException { getTypedEntity().set<%=Util.capitalize(attribute.getName())%>(value); } }*/ + } else { +/*{ + public void set<%=Util.capitalize(attribute.getName())%>(<%=attribute.getAssociationClass().getQualifiedName()%> association) throws TopiaException { + getTypedEntity().set<%=Util.capitalize(attribute.getName())%>(association); + } + + public void set<%=Util.capitalize(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> value, <%=attribute.getAssociationClass().getQualifiedName()%> association) throws TopiaException { + getTypedEntity().set<%=Util.capitalize(attribute.getName())%>(value, association); + } +}*/ + } } public void generateSetNormalNMultiplicityAttributeAccessor(Writer output, ObjectModelAttribute attribute) throws IOException { /*{ - public void add<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException { - getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(value); + public void set<%=Util.capitalize(attribute.getName())%>(int index, <%=attribute.getType()%> value) throws TopiaException { + getTypedEntity().set<%=Util.capitalize(attribute.getName())%>(index, value); } - + public void remove<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException { getTypedEntity().remove<%=Util.capitalize(attribute.getName())%>(value); } @@ -179,16 +235,53 @@ public void clear<%=Util.capitalize(attribute.getName())%>() throws TopiaException { getTypedEntity().clear<%=Util.capitalize(attribute.getName())%>(); } +}*/ + if (!attribute.hasAssociationClass()) { +/*{ + public void add<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException { + getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(value); + } - public void add<%=Util.capitalize(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> list) throws TopiaException{ + public void add<%=Util.capitalize(attribute.getName())%>(/*<%=Util.getAttributeType(attribute)%>*)java.util.Collection list) throws TopiaException { getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(list); + } + + public void add<%=Util.capitalize(attribute.getName())%>(/*<%=Util.getAttributeType(attribute)%>*)java.util.Collection list, boolean duplicate) throws TopiaException { + getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(list, duplicate); + } +}*/ + } else { +/*{ + public void set<%=Util.capitalize(attribute.getName())%>(int index, <%=attribute.getAssociationClass().getQualifiedName()%> value) throws TopiaException { + getTypedEntity().set<%=Util.capitalize(attribute.getName())%>(index, value); } - public void add<%=Util.capitalize(attribute.getName())%>(<%=Util.getAttributeType(attribute)%> list, boolean duplicate) throws TopiaException{ - getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(list, duplicate); + public void add<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value, <%=attribute.getAssociationClass().getQualifiedName()%> association) throws TopiaException { + getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(value, association); + } + + public void add<%=Util.capitalize(attribute.getName())%>(<%=attribute.getAssociationClass().getQualifiedName()%> association) throws TopiaException { + getTypedEntity().add<%=Util.capitalize(attribute.getName())%>(association); + } + + public void remove<%=Util.capitalize(attribute.getName())%>(<%=attribute.getAssociationClass().getQualifiedName()%> value) throws TopiaException { + getTypedEntity().remove<%=Util.capitalize(attribute.getName())%>(value); } }*/ + } + + + } + + public void generateSetAssociationAttributeAccessor(Writer output, ObjectModelAttribute attribute) + throws IOException { +/*{ + public void set<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException { + getTypedEntity().set<%=Util.capitalize(attribute.getName())%>(value); + } +}*/ +} ////////////////////////////////////////////////////////////////////// // O P E R A T I O N