Index: topia/src/java/org/codelutin/topia/generators/commons/ObjectModelToEntityPersistenceServiceInterfaceGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/commons/ObjectModelToEntityPersistenceServiceInterfaceGenerator.java:1.3 topia/src/java/org/codelutin/topia/generators/commons/ObjectModelToEntityPersistenceServiceInterfaceGenerator.java:1.4 --- topia/src/java/org/codelutin/topia/generators/commons/ObjectModelToEntityPersistenceServiceInterfaceGenerator.java:1.3 Fri May 28 15:40:16 2004 +++ topia/src/java/org/codelutin/topia/generators/commons/ObjectModelToEntityPersistenceServiceInterfaceGenerator.java Wed Jun 2 09:33:08 2004 @@ -29,84 +29,58 @@ extends ObjectModelGenerator { public String getFilenameForClass(ObjectModelClass clazz) { - return (Util.getParentPackageName(clazz.getPackageName())+".services.").replace('.', File.separatorChar)+clazz.getName()+ "PersistenceService.java"; + return (Util.getParentPackageName(clazz.getPackageName())+".services.").replace('.', File.separatorChar)+clazz.getName()+ "PersistenceService.java"; } - public void generateFromClass(Writer output, ObjectModelClass clazz) - throws IOException { + public void generateFromClass(Writer output, ObjectModelClass clazz) + throws IOException { - // Consider only entities, return immediately if not an entity - if (! Util.isEntity(clazz)) return; + // Consider only entities, return immediately if not an entity + if (! Util.isEntity(clazz)) return; - // ------------- File Header - if (!"".equals(clazz.getPackageName())) { + // ------------- File Header + if (!"".equals(clazz.getPackageName())) { /*{ package <%=Util.getParentPackageName(clazz.getPackageName())%>.services; }*/ - } + } - // ------------- Imports + // ------------- Imports /*{ import org.codelutin.topia.TopiaEntityListener; -import org.codelutin.topia.TopiaQuery; import org.codelutin.topia.TopiaException; import <%=clazz.getQualifiedName()%>; import java.util.List; import org.codelutin.topia.TopiaPersistenceService; }*/ - + /*{ public interface <%=clazz.getName()%>PersistenceService extends TopiaPersistenceService { - /** - * Adds a new TopiaEntityListener to the subscribers list. - * @param topiaEntityListener - the TopiaEntityListener to add to the subscribers list. - *) - public void addTopiaEntityListener(TopiaEntityListener topiaEntityListener) throws TopiaException; - - /** - * Creates a transient tranferable <%=clazz.getName()%>. - * - * @return the transient transferable <%=clazz.getName()%>. - *) - public <%=clazz.getName()%> create() throws TopiaException; - - /** - * Removes a TopiaEntityListener from the subscribers list. - * @param topiaEntityListener - the TopiaEntityListener to remove from the subscribers. - *) - public void removeTopiaEntityListener(TopiaEntityListener topiaEntityListener) throws TopiaException; - public <%=clazz.getName()%> makePersistent(<%=clazz.getName()%> <%=Util.toLowerCaseFirstLetter(clazz.getName())%>) throws TopiaException; - + public <%=clazz.getName()%> findByPrimaryKey(}*/ - // Iterate on each attribute to declare accessors - for (Iterator i = Util.getPrimaryKeyAttributes(clazz).iterator(); i.hasNext();) { - ObjectModelAttribute primaryKeyAttribute = (ObjectModelAttribute) i.next(); + // Iterate on each attribute to declare accessors + for (Iterator i = Util.getPrimaryKeyAttributes(clazz).iterator(); i.hasNext();) { + ObjectModelAttribute primaryKeyAttribute = (ObjectModelAttribute) i.next(); /*{<%=Util.getAttributeType(primaryKeyAttribute)%> <%=primaryKeyAttribute.getName()%>}*/ if (i.hasNext()) { /*{, }*/ } } -/*{ +/*{ ) throws TopiaException; - public List findAll() throws TopiaException; - public List find(TopiaQuery query) throws TopiaException; - - public int size() throws TopiaException; - public int size(TopiaQuery query) throws TopiaException; - public void update(<%=clazz.getName()%> <%=Util.toLowerCaseFirstLetter(clazz.getName())%>) throws TopiaException; public void delete(<%=clazz.getName()%> <%=Util.toLowerCaseFirstLetter(clazz.getName())%>) throws TopiaException; - + } }*/ - } + } public String getFilenameForInterface(ObjectModelInterface interfacez) { - return (Util.getParentPackageName(interfacez.getPackageName())+".services.").replace('.', File.separatorChar)+interfacez.getName()+ "PersistenceService.java"; + return (Util.getParentPackageName(interfacez.getPackageName())+".services.").replace('.', File.separatorChar)+interfacez.getName()+ "PersistenceService.java"; } public void generateFromInterface( @@ -114,45 +88,38 @@ ObjectModelInterface interfacez) throws IOException { - // Consider only entities, return immediately if not an entity - if (! Util.isEntity(interfacez)) return; + // Consider only entities, return immediately if not an entity + if (! Util.isEntity(interfacez)) return; - // ------------- File Header - if (!"".equals(interfacez.getPackageName())) { + // ------------- File Header + if (!"".equals(interfacez.getPackageName())) { /*{ package <%=Util.getParentPackageName(interfacez.getPackageName())%>.services; }*/ - } + } - // ------------- Imports + // ------------- Imports /*{ import org.codelutin.topia.TopiaEntityListener; -import org.codelutin.topia.TopiaQuery; import org.codelutin.topia.TopiaException; import <%=interfacez.getQualifiedName()%>; import java.util.List; import org.codelutin.topia.TopiaPersistenceService; }*/ - + /*{ public interface <%=interfacez.getName()%>PersistenceService extends TopiaPersistenceService { - - public <%=interfacez.getName()%> makePersistent(<%=interfacez.getName()%> <%=Util.toLowerCaseFirstLetter(interfacez.getName())%>) throws TopiaException; - public List findAll() throws TopiaException; - public List find(TopiaQuery query) throws TopiaException; + public <%=interfacez.getName()%> makePersistent(<%=interfacez.getName()%> <%=Util.toLowerCaseFirstLetter(interfacez.getName())%>) throws TopiaException; - public int size() throws TopiaException; - public int size(TopiaQuery query) throws TopiaException; + public void update(<%=interfacez.getName()%> <%=Util.toLowerCaseFirstLetter(interfacez.getName())%>) throws TopiaException; + public void delete(<%=interfacez.getName()%> <%=Util.toLowerCaseFirstLetter(interfacez.getName())%>) throws TopiaException; - public void update(<%=interfacez.getName()%> <%=Util.toLowerCaseFirstLetter(interfacez.getName())%>) throws TopiaException; - public void delete(<%=interfacez.getName()%> <%=Util.toLowerCaseFirstLetter(interfacez.getName())%>) throws TopiaException; - } }*/ - } + } }