Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityOperationRouterGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityOperationRouterGenerator.java:1.1 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityOperationRouterGenerator.java:1.2 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityOperationRouterGenerator.java:1.1 Fri Jul 30 14:38:58 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityOperationRouterGenerator.java Tue Aug 3 16:07:14 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/07/30 14:38:58 $ - * par : $Author: pineau $ + * Mise a jour: $Date: 2004/08/03 16:07:14 $ + * par : $Author: bpoussin $ */ package org.codelutin.topia.generators; @@ -51,19 +51,29 @@ } public boolean accept(ObjectModelClassifier clazz){ - return Util.isEntity(clazz); + return Util.isEntity(clazz) && clazz instanceof ObjectModelClass; } ////////////////////////////////////////////////////////////////////// // C L A S S D E C L A R A T I O N ////////////////////////////////////////////////////////////////////// - public void generateClassDeclaration(Writer output, ObjectModelClassifier clazz) throws IOException { + public void generateClassDeclaration(Writer output, ObjectModelClassifier clazzifier) throws IOException { + ObjectModelClass clazz = (ObjectModelClass)clazzifier; /*{ /** <%=clazz.getDocumentation()%> *) -public class <%=clazz.getName()%>OperationRouter extends AbstractTopiaElement implements <%=clazz.getName()%>Operation}*/ +public class <%=clazz.getName()%>OperationRouter}*/ + Iterator i = clazz.getSuperclasses().iterator(); + if (i.hasNext()) { + ObjectModelClass superclass = (ObjectModelClass) i.next(); +/*{ extends <%=superclass.getName() + "OperationRouter"%>}*/ + } else { +/*{ extends AbstractTopiaElement}*/ + } + + /*{ implements <%=clazz.getName()%>Operation}*/ } ////////////////////////////////////////////////////////////////////// Index: topia/src/java/org/codelutin/topia/generators/OjectModelToEntityPersistenceServiceImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/OjectModelToEntityPersistenceServiceImplGenerator.java:1.1 topia/src/java/org/codelutin/topia/generators/OjectModelToEntityPersistenceServiceImplGenerator.java:1.2 --- topia/src/java/org/codelutin/topia/generators/OjectModelToEntityPersistenceServiceImplGenerator.java:1.1 Fri Jul 30 14:38:58 2004 +++ topia/src/java/org/codelutin/topia/generators/OjectModelToEntityPersistenceServiceImplGenerator.java Tue Aug 3 16:07:14 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/07/30 14:38:58 $ - * par : $Author: pineau $ + * Mise a jour: $Date: 2004/08/03 16:07:14 $ + * par : $Author: bpoussin $ */ package org.codelutin.topia.generators; @@ -67,7 +67,7 @@ /** <%=clazz.getDocumentation()%> *) -public <%=(operations.size()==0?"":"abstract ")%>class <%=clazz.getName() + "PersistenceServiceImpl"%> extends }*/ +public class <%=clazz.getName() + "PersistenceServiceImpl"%> extends }*/ if(clazz instanceof ObjectModelClass){ Iterator i=((ObjectModelClass)clazz).getSuperclasses().iterator(); if (i.hasNext()) { @@ -123,7 +123,11 @@ * Return new entity *) public <%=clazz.getName()%> create<%=clazz.getName()%>() throws TopiaException { + <% if(((ObjectModelClass)clazz).isAbstract()){ %> + throw new TopiaException("Abstract entity can't be instanciate"); + <% } else { %> return (<%=clazz.getName()%>)super.create(); + <% } %> } public <%=clazz.getName()%> makePersistent(<%=clazz.getName()%> entity) throws TopiaException{