Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java:1.16 topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java:1.17 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java:1.16 Wed Aug 3 16:50:05 2005 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToContextPropertiesGenerator.java Fri Aug 19 14:52:47 2005 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.16 $ + * @version $Revision: 1.17 $ * - * Mise a jour: $Date: 2005/08/03 16:50:05 $ - * par : $Author: thimel $ + * Mise a jour: $Date: 2005/08/19 14:52:47 $ + * par : $Author: bpoussin $ */ package org.codelutin.topia.generators; @@ -40,7 +40,7 @@ import org.codelutin.generator.models.object.ObjectModel; import org.codelutin.generator.models.object.ObjectModelClass; import org.codelutin.generator.models.object.ObjectModelClassifier; -import org.codelutin.topia.TopiaConst; +import org.codelutin.topia.TopiaConst; import org.codelutin.topia.generators.Util; public class ObjectModelToContextPropertiesGenerator extends ObjectModelGenerator { // ObjectModelToContextPropertiesGenerator @@ -74,7 +74,16 @@ #context.helper.persistence.properties.file=<%=model.getName()%>JDOPersistenceHelper.properties #context.helper.distribution=org.codelutin.topia.distribution.LocalDistributionHelper +//Secuity Variables +topia.auth.loginEntry=<%=model.getName()%> +topia.auth.type=simple +topia.auth.simple.file.login=passwords.file +#topia.auth.simple.hash=SHA +topia.auth.simple.file.groups=groups.file + }*/ + +/* Plus besoin de generer les proprietes suivantes for(Iterator i=model.getClassifiers().iterator(); i.hasNext();){ ObjectModelClassifier clazz = (ObjectModelClassifier)i.next(); if(Util.isEntity(clazz)){ @@ -89,14 +98,7 @@ }*/ } } -//Secuity Variables -/*{ -topia.auth.loginEntry=<%=model.getName()%> -topia.auth.type=simple -topia.auth.simple.file.login=passwords.file -#topia.auth.simple.hash=SHA -topia.auth.simple.file.groups=groups.file -}*/ + */ } } // ObjectModelToContextPropertiesGenerator Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.15 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.16 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.15 Tue Aug 16 22:19:33 2005 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java Fri Aug 19 14:52:47 2005 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ * - * Mise a jour: $Date: 2005/08/16 22:19:33 $ + * Mise a jour: $Date: 2005/08/19 14:52:47 $ * par : $Author: bpoussin $ */ @@ -126,6 +126,7 @@ * @return an entity *) public <%=currentClazz.getName()%> findBy<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException{ + // FIXME il faut une requete du genre TopiaQuery query = new TopiaQuery().select("A").from("asso").where("B=?"); <%=attribute.getAssociationClass().getQualifiedName()%>PersistenceService ps = ((<%=getProperty("defaultPackage") + "." + model.getName()%>Context)getContext()).get<%=associationClassName%>PersistenceService(); List result = ps.find(ps.newQuery().where("<%=attribute.getName()%> = ?").limit(0,1).addArg(value)); if(result.size() == 0){ @@ -138,6 +139,7 @@ * @return an unmodifiable collection *) public List findAllBy<%=Util.capitalize(attribute.getName())%>(<%=attribute.getType()%> value) throws TopiaException{ + // FIXME idem findBy <%=attribute.getAssociationClass().getQualifiedName()%>PersistenceService ps = ((<%=getProperty("defaultPackage") + "." + model.getName()%>Context)getContext()).get<%=associationClassName%>PersistenceService(); return ps.find(ps.newQuery().where("<%=attribute.getName()%> = ?").addArg(value)); } @@ -202,17 +204,17 @@ ObjectModelClass clazz = (ObjectModelClass)clazzifier; generateAllOtherAttributeDeclaration(output, clazz); /*{ -// /** -// * 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(); -// <% } %> -// } -// + /** + * Return new entity + *) + public <%=clazz.getName()%> create() 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 { // if (! (entity instanceof <%=clazz.getName()%>)) { // throw new TopiaException("Wrong persistence service. You should use the entity related persistence service");