Author: thimel Date: 2009-01-29 11:46:59 +0000 (Thu, 29 Jan 2009) New Revision: 1330 Modified: topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceAbstractGenerator.java topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceImplGenerator.java Log: Refactored ServiceImpl and ServiceAbstract generators Modified: topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceAbstractGenerator.java =================================================================== --- topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceAbstractGenerator.java 2009-01-29 11:22:36 UTC (rev 1329) +++ topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceAbstractGenerator.java 2009-01-29 11:46:59 UTC (rev 1330) @@ -105,6 +105,7 @@ private void generateInterfaceHeader(Writer output, ObjectModelClassifier classifier) throws IOException { String copyright = TopiaGeneratorUtil.getCopyright(model); + String classifierName = classifier.getName(); if (TopiaGeneratorUtil.notEmpty(copyright)) { /*{<%=copyright%> }*/ @@ -117,13 +118,11 @@ import org.codelutin.topia.service.TopiaApplicationServiceAbstract; import org.codelutin.topia.framework.TopiaContextImplementor;}*/ - // <%=clazz.getName()%>DAOAbstract classifier.getInterfaces(); // ajouter les imports des interfaces de DAO - for (Iterator i=classifier.getInterfaces().iterator(); i.hasNext();) { - ObjectModelClassifier parent = (ObjectModelClassifier)i.next(); + for (ObjectModelInterface parent : classifier.getInterfaces()) { if(parent.hasStereotype(TopiaGeneratorUtil.STEREOTYPE_DAO)){ - // r�cup�rer la classe de l'object model correspondant � la DAO + // récupérer la classe de l'object model correspondant à la DAO String className = parent.getQualifiedName().replace("DAO", ""); String interfaceName = parent.getQualifiedName()+"Abstract"; /*{ @@ -133,7 +132,6 @@ } if (TopiaGeneratorUtil.hasDocumentation(classifier)) { - /*{ /** * @@ -143,49 +141,53 @@ } /*{ -public abstract class <%=classifier.getName()+"Abstract"%> extends TopiaApplicationServiceAbstract implements <%=classifier.getName()%>{ }*/ +public abstract class <%=classifierName%>Abstract extends TopiaApplicationServiceAbstract implements <%=classifierName%>{ }*/ } private void generateMethodsGetter(Writer output, ObjectModelClassifier classifier) throws IOException { /*{ public String[] getMethods(){ return methods; } -}*/ +}*/ } private void generateInterfaceOperations(Writer output, ObjectModelClassifier classifier) throws IOException { - for (Iterator it = classifier.getOperations().iterator(); it.hasNext();) { - ObjectModelOperation op = (ObjectModelOperation)it.next(); + for (ObjectModelOperation op : classifier.getOperations()) { + String opName = op.getName(); + String opVisibility = op.getVisibility(); + String opType = op.getReturnType(); /*{ /** * Implementation a la charge du developpeur }*/ if (TopiaGeneratorUtil.hasDocumentation(op)) { -/*{ * <%=op.getName()%> : <%=op.getDocumentation()%> + String opDocumentation = op.getDocumentation(); +/*{ * <%=opName%> : <%=opDocumentation%> }*/ } Collection<ObjectModelParameter> params = (Collection<ObjectModelParameter>)op.getParameters(); for(ObjectModelParameter param : params) { - if(log.isTraceEnabled()) {log.trace("Param" + param);} -/*{ * @param <%=param.getName()%> <%=param.getDocumentation()%> + String paramName = param.getName(); + String paramDocumentation = param.getDocumentation(); +/*{ * @param <%=paramName%> <%=paramDocumentation%> }*/ } /*{ *) - <%=op.getVisibility()%> abstract <%=op.getReturnType()%> <%=op.getName()%>(}*/ - String vir = ""; + <%=opVisibility%> abstract <%=opType%> <%=opName%>(}*/ + String comma = ""; for(ObjectModelParameter param : params){ - if(log.isTraceEnabled()) {log.trace("Param" + param + " vir" + vir);} -/*{<%=vir%><%=param.getType()%> <%=param.getName()%>}*/ - vir = ", "; + String paramName = param.getName(); + String paramType = param.getType(); +/*{<%=comma%><%=paramType%> <%=paramName%>}*/ + comma = ", "; } /*{)}*/ Set<String> exceptions = (Set<String>)op.getExceptions(); - vir = " throws "; + comma = " throws "; for (String exception : exceptions) { - if(log.isTraceEnabled()) {log.trace("exception" + exception + " vir" + vir);} -/*{<%=vir%><%=exception%>}*/ - vir = ", "; +/*{<%=comma%><%=exception%>}*/ + comma = ", "; } /*{; @@ -195,76 +197,76 @@ private void generateInheritedInterfaceOperations(Writer output, ObjectModelClassifier classifier) throws IOException { - for (Iterator i=classifier.getInterfaces().iterator(); i.hasNext();) { - ObjectModelClassifier parent = (ObjectModelClassifier)i.next(); + for (ObjectModelInterface parent : classifier.getInterfaces()) { // pour tous les DAOInterface if(parent.hasStereotype(TopiaGeneratorUtil.STEREOTYPE_DAO)){ - // r�cup�rer la classe de l'object model correspondant � la DAO + // récupérer la classe de l'object model correspondant à la DAO String entityClassName = parent.getQualifiedName().replace("DAO", ""); if(getModel().hasClass(entityClassName)){ ObjectModelClass clazz = getModel().getClass(entityClassName); + String clazzName = clazz.getName(); + String clazzFQN = clazz.getQualifiedName(); if (!clazz.hasStereotype(TopiaGeneratorUtil.STEREOTYPE_ENTITY)) { return; } /*{ /** - * Supprime l'entite <%=clazz.getName()%> passee en parametre + * Supprime l'entite <%=clazzName%> passee en parametre * @param entity l'entite a supprimer *) - public void delete<%=clazz.getName()%>(<%=clazz.getQualifiedName()%> entity) throws TopiaException{ + public void delete<%=clazzName%>(<%=clazzFQN%> entity) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); dao.delete(entity); } /** - * Creer l'entite <%=clazz.getName()%> avec les proprietes passees en parametre + * Creer l'entite <%=clazzName%> avec les proprietes passees en parametre * @param properties les proprietes de l'entite a creer *) - public <%=clazz.getQualifiedName()%> create<%=clazz.getName()%>(Object ... properties) throws TopiaException{ + public <%=clazzFQN%> create<%=clazzName%>(Object ... properties) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>) dao.create(properties); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>) dao.create(properties); return entity; } /** - * Mise a jour de l'entite <%=clazz.getName()%> passee en parametre + * Mise a jour de l'entite <%=clazzName%> passee en parametre * @param entity l'entite a mettre a jour *) - public <%=clazz.getQualifiedName()%> update<%=clazz.getName()%>(<%=clazz.getQualifiedName()%> entity) throws TopiaException{ + public <%=clazzFQN%> update<%=clazzName%>(<%=clazzFQN%> entity) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entit = (<%=clazz.getName()%>) dao.update(entity); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entit = (<%=clazzName%>) dao.update(entity); return entit; } /** - * Retourne tous les <%=clazz.getName()%> + * Retourne tous les <%=clazzName%> * @return une liste *) - public List<<%=clazz.getQualifiedName()%>> findAll<%=clazz.getName()%>() throws TopiaException { + public List<<%=clazzFQN%>> findAll<%=clazzName%>() throws TopiaException { TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - List<<%=clazz.getName()%>> result = dao.findAll(); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + List<<%=clazzName%>> result = dao.findAll(); return result; } /** - * Retourne le <%=clazz.getName()%> par son TopiaId - * @return le <%=clazz.getName()%> + * Retourne le <%=clazzName%> par son TopiaId + * @return le <%=clazzName%> *) - public <%=clazz.getQualifiedName()%> find<%=clazz.getName()%>ByTopiaId(String v) throws TopiaException { + public <%=clazzFQN%> find<%=clazzName%>ByTopiaId(String v) throws TopiaException { TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(v); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(v); return entity; } }*/ - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); + for (ObjectModelAttribute attr : clazz.getAttributes()) { if (!attr.isNavigable()) { continue; } @@ -278,9 +280,7 @@ if (clazz instanceof ObjectModelAssociationClass) { ObjectModelAssociationClass assocClass = (ObjectModelAssociationClass)clazz; - Iterator it = assocClass.getParticipantsAttributes().iterator(); - while (it.hasNext()) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); + for (ObjectModelAttribute attr : assocClass.getParticipantsAttributes()) { if (attr != null) { if (!GeneratorUtil.isNMultiplicity(attr)) { generateNoNMultiplicity(output, attr, clazz, true); @@ -300,6 +300,8 @@ if (!isAssoc && attr.hasAssociationClass()) { propertyName = TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName()) + "." + propertyName; } + String clazzName = clazz.getName(); + String clazzFQN = clazz.getQualifiedName(); /*{ /** * Retourne le premier element trouve ayant comme valeur pour l'attribut @@ -307,10 +309,10 @@ * @param v la valeur que doit avoir <%=attr.getName()%> * @return un element ou null *) - public <%=clazz.getQualifiedName()%> find<%=clazz.getName()%>By<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> v) throws TopiaException{ + public <%=clazzFQN%> find<%=clazzName%>By<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> v) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = dao.findBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = dao.findBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); return entity; }; @@ -320,10 +322,10 @@ * @param v la valeur que doit avoir <%=attr.getName()%> * @return une liste *) - public List<<%=clazz.getQualifiedName()%>> findAll<%=clazz.getName()%>By<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> v) throws TopiaException{ + public List<<%=clazzFQN%>> findAll<%=clazzName%>By<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> v) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - List<<%=clazz.getName()%>> entityList = dao.findAllBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + List<<%=clazzName%>> entityList = dao.findAllBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); return entityList; }; }*/ @@ -335,10 +337,10 @@ * @param value la valeur que doit avoir <%=TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> * @return un element ou null *) - public <%=clazz.getQualifiedName()%> find<%=clazz.getName()%>By<%=TopiaGeneratorUtil.capitalize(attr.getAssociationClass().getName())%>(<%=attr.getAssociationClass().getQualifiedName()%> value) throws TopiaException{ + public <%=clazzFQN%> find<%=clazzName%>By<%=TopiaGeneratorUtil.capitalize(attr.getAssociationClass().getName())%>(<%=attr.getAssociationClass().getQualifiedName()%> value) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = dao.findBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = dao.findBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); return entity; }; @@ -348,10 +350,10 @@ * @param value la valeur que doit avoir <%=TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> * @return une liste *) - public List<<%=clazz.getQualifiedName()%>> findAll<%=clazz.getName()%>By<%=TopiaGeneratorUtil.capitalize(attr.getAssociationClass().getName())%>(<%=attr.getAssociationClass().getQualifiedName()%> value) throws TopiaException{ + public List<<%=clazzFQN%>> findAll<%=clazzName%>By<%=TopiaGeneratorUtil.capitalize(attr.getAssociationClass().getName())%>(<%=attr.getAssociationClass().getQualifiedName()%> value) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - List<<%=clazz.getName()%>> entityList = dao.findAllBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + List<<%=clazzName%>> entityList = dao.findAllBy<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(v); return entityList; }; }*/ @@ -359,6 +361,8 @@ } protected void generateNMultiplicity(Writer output, ObjectModelAttribute attr, ObjectModelClass clazz, boolean isAssoc) throws IOException { + String clazzName = clazz.getName(); + String clazzFQN = clazz.getQualifiedName(); /*{ /** * Retourne le premier element trouve dont l'attribut @@ -366,10 +370,10 @@ * @param v la valeur que doit contenir <%=attr.getName()%> * @return un element ou null *) - public <%=clazz.getQualifiedName()%> find<%=clazz.getName()%>Contains<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> ... v) throws TopiaException{ + public <%=clazzFQN%> find<%=clazzName%>Contains<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> ... v) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>) dao.findContainsProperties("<%=TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>", Arrays.asList(v)); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>) dao.findContainsProperties("<%=TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>", Arrays.asList(v)); return entity; }; @@ -379,10 +383,10 @@ * @param v la valeur que doit contenir <%=attr.getName()%> * @return une liste *) - public List<<%=clazz.getQualifiedName()%>> findAll<%=clazz.getName()%>Contains<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> ... v) throws TopiaException{ + public List<<%=clazzFQN%>> findAll<%=clazzName%>Contains<%=TopiaGeneratorUtil.capitalize(attr.getName())%>(<%=attr.getType()%> ... v) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - List<<%=clazz.getName()%>> entityList = dao.findAllContainsProperties("<%=TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>", Arrays.asList(v)); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + List<<%=clazzName%>> entityList = dao.findAllContainsProperties("<%=TopiaGeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>", Arrays.asList(v)); return entityList; }; }*/ @@ -390,8 +394,7 @@ private void generateAssociatedClassOperations(Writer output, ObjectModelClassifier classifier) throws IOException { - for (Iterator i=classifier.getInterfaces().iterator(); i.hasNext();) { - ObjectModelClassifier parent = (ObjectModelClassifier)i.next(); + for (ObjectModelInterface parent : classifier.getInterfaces()) { // pour tous les DAOInterface if(parent.hasStereotype(TopiaGeneratorUtil.STEREOTYPE_DAO)){ @@ -411,8 +414,10 @@ return; } - for (Iterator it = clazz.getAttributes().iterator(); it.hasNext();) { - ObjectModelAttribute attr = (ObjectModelAttribute)it.next(); + String clazzName = clazz.getName(); + String clazzFQN = clazz.getQualifiedName(); + + for (ObjectModelAttribute attr : clazz.getAttributes()) { ObjectModelAttribute reverse = attr.getReverseAttribute(); if (!attr.isNavigable() && !hasUnidirectionalRelationOnAbstractType(reverse, model)) { @@ -428,10 +433,10 @@ } /*{ * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%> La valeur de l'attribut <%=attr.getName()%> � positionner. *) - public void set<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getType()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ + public void set<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId, <%=attr.getType()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.set<%=GeneratorUtil.capitalize(attr.getName())%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>); usedContextImpl.commitTransaction(); } @@ -445,10 +450,10 @@ } /*{ * @return La valeur de l'attribut <%=attr.getName()%>. *) - public <%=attr.getType()%> get<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public <%=attr.getType()%> get<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.get<%=GeneratorUtil.capitalize(attr.getName())%>(); } @@ -459,20 +464,20 @@ /*{ /** * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> La valeur de l'attribut <%=attr.getAssociationClass().getName()%> � positionner. *) - public void set<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getAssociationClass().getQualifiedName()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ + public void set<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId, <%=attr.getAssociationClass().getQualifiedName()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.set<%=GeneratorUtil.capitalize(assocAttrName)%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>); } /** * @return La valeur de l'attribut <%=attr.getAssociationClass().getName()%>. *) - public <%=attr.getAssociationClass().getQualifiedName()%> get<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public <%=attr.getAssociationClass().getQualifiedName()%> get<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.get<%=GeneratorUtil.capitalize(assocAttrName)%>(); } @@ -488,10 +493,10 @@ } /*{ * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%> L'instance de <%=attr.getName()%> � ajouter. *) - public void add<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getType()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ + public void add<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId, <%=attr.getType()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.add<%=GeneratorUtil.capitalize(attr.getName())%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>); } @@ -503,10 +508,10 @@ } /*{ * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%> Les instances de <%=attr.getName()%> � ajouter. *) - public void addAll<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getType()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ + public void addAll<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getType()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.addAll<%=GeneratorUtil.capitalize(attr.getName())%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>); } @@ -518,10 +523,10 @@ } /*{ * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%> La Collection de <%=attr.getName()%> � positionner. *) - public void set<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getType()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ + public void set<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getType()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.set<%=GeneratorUtil.capitalize(attr.getName())%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>); } @@ -533,10 +538,10 @@ } /*{ * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%> L'instance de <%=attr.getName()%> � retirer. *) - public void remove<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getType()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ + public void remove<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId, <%=attr.getType()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.remove<%=GeneratorUtil.capitalize(attr.getName())%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getName())%>); } @@ -548,10 +553,10 @@ } /*{ * Vide la Collection de <%=attr.getName()%>. *) - public void clear<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public void clear<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.clear<%=GeneratorUtil.capitalize(attr.getName())%>(); } @@ -562,50 +567,50 @@ /*{ /** * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> L'instance de <%=attr.getAssociationClass().getName()%> � ajouter. *) - public void add<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getAssociationClass().getQualifiedName()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ + public void add<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId, <%=attr.getAssociationClass().getQualifiedName()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.add<%=GeneratorUtil.capitalize(assocAttrName)%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>); } /** * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> Les instances de <%=attr.getAssociationClass().getName()%> � ajouter. *) - public void addAll<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ + public void addAll<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.addAll<%=GeneratorUtil.capitalize(assocAttrName)%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>); } /** * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> La Collection de <%=attr.getAssociationClass().getName()%> � positionner. *) - public void set<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ + public void set<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId, <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.set<%=GeneratorUtil.capitalize(assocAttrName)%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>); } /** * @param <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%> L'instance de <%=attr.getAssociationClass().getName()%> � retirer. *) - public void remove<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getAssociationClass().getQualifiedName()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ + public void remove<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId, <%=attr.getAssociationClass().getQualifiedName()%> <%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.remove<%=GeneratorUtil.capitalize(assocAttrName)%>(<%=GeneratorUtil.toLowerCaseFirstLetter(attr.getAssociationClass().getName())%>); } /** * Vide la Collection de <%=attr.getAssociationClass().getName()%>. *) - public void clear<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public void clear<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); entity.clear<%=GeneratorUtil.capitalize(assocAttrName)%>(); } @@ -621,20 +626,20 @@ } /*{ * @return La Liste de <%=attr.getName()%>. *) - public <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getType()%>> get<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getType()%>> get<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.get<%=GeneratorUtil.capitalize(attr.getName())%>(); } /** * @return Le nombre d'�l�ments de la collection <%=attr.getName()%>. *) - public int size<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public int size<%=GeneratorUtil.capitalize(attr.getName())%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.size<%=GeneratorUtil.capitalize(attr.getName())%>(); } @@ -645,30 +650,30 @@ /*{ /** * @return La liste des attributs <%=attr.getAssociationClass().getName()%>. *) - public <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>> get<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public <%=(attr.isOrdered()?"java.util.List":"java.util.Collection")%><<%=attr.getAssociationClass().getQualifiedName()%>> get<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.get<%=GeneratorUtil.capitalize(assocAttrName)%>(); } /** * @return L'attribut <%=attr.getAssociationClass().getName()%> associ� � la valeur <code>value</code> de l'attribut <%=attr.getName()%>. *) - public <%=attr.getAssociationClass().getQualifiedName()%> get<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId, <%=attr.getType()%> value) throws TopiaException{ + public <%=attr.getAssociationClass().getQualifiedName()%> get<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId, <%=attr.getType()%> value) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.get<%=GeneratorUtil.capitalize(assocAttrName)%>((<%=attr.getType()%>) value); } /** * @return Le nombre d'�l�ments de la collection <%=attr.getName()%>. *) - public int size<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ + public int size<%=GeneratorUtil.capitalize(assocAttrName)%>Of<%=clazzName%>(String topiaId) throws TopiaException{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); return entity.size<%=GeneratorUtil.capitalize(assocAttrName)%>(); } @@ -700,52 +705,56 @@ } private void generateInterfaceOperationsOfClass(Writer output, ObjectModelClassifier classifier) throws IOException { - for (Iterator it = classifier.getOperations().iterator(); it.hasNext();) { - ObjectModelOperation op = (ObjectModelOperation)it.next(); + String classifierName = classifier.getName(); + for (ObjectModelOperation op : classifier.getOperations()) { + String opName = op.getName(); + String opVisibility = op.getVisibility(); + String opType = op.getReturnType(); /*{ /** }*/ if (TopiaGeneratorUtil.hasDocumentation(op)) { -/*{ * <%=op.getName()%> : <%=op.getDocumentation()%> +/*{ * <%=opName%> : <%=op.getDocumentation()%> }*/ } Collection<ObjectModelParameter> params = (Collection<ObjectModelParameter>)op.getParameters(); for(ObjectModelParameter param : params) { - if(log.isTraceEnabled()) {log.trace("Param" + param);} -/*{ * @param <%=param.getName()%> <%=param.getDocumentation()%> + String paramName = param.getName(); + String paramDocumentation = param.getDocumentation(); +/*{ * @param <%=paramName%> <%=paramDocumentation%> }*/ } /*{ *) - <%=op.getVisibility()%> <%=op.getReturnType()%> <%=op.getName()%>Of<%=classifier.getName()%>(String topiaId}*/ - String vir = ","; + <%=opVisibility%> <%=opType%> <%=opName%>Of<%=classifierName%>(String topiaId}*/ + String comma = ","; for(ObjectModelParameter param : params){ - if(log.isTraceEnabled()) {log.trace("Param" + param + " vir" + vir);} -/*{<%=vir%><%=param.getType()%> <%=param.getName()%>}*/ + String paramName = param.getName(); + String paramType = param.getType(); +/*{<%=comma%><%=paramType%> <%=paramName%>}*/ } /*{)}*/ Set<String> exceptions = (Set<String>)op.getExceptions(); if(exceptions.isEmpty()){ /*{throws TopiaException}*/ } - vir = " throws "; + comma = " throws "; for (String exception : exceptions) { - if(log.isTraceEnabled()) {log.trace("exception" + exception + " vir" + vir);} -/*{<%=vir%><%=exception%>}*/ - vir = ", "; +/*{<%=comma%><%=exception%>}*/ + comma = ", "; } /*{{ TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=classifier.getName()%>DAOAbstract dao = (<%=classifier.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=classifier.getName()%>.class); - <%=classifier.getName()%> entity = (<%=classifier.getName()%>)dao.findByTopiaId(topiaId); + <%=classifierName%>DAOAbstract dao = (<%=classifierName%>DAOAbstract)usedContextImpl.getDAO(<%=classifierName%>.class); + <%=classifierName%> entity = (<%=classifierName%>)dao.findByTopiaId(topiaId); }*/ if(!op.getReturnType().toString().equalsIgnoreCase("void")){ /*{ return }*/ } -/*{ entity.<%=op.getName()%>(}*/ - vir = ""; +/*{ entity.<%=opName%>(}*/ + comma = ""; for(ObjectModelParameter param : params){ - if(log.isTraceEnabled()) {log.trace("Param" + param + " vir" + vir);} -/*{<%=vir%><%=param.getName()%>}*/ - vir = ", "; + String paramName = param.getName(); +/*{<%=comma%><%=paramName%>}*/ + comma = ", "; } /*{); } @@ -758,27 +767,28 @@ } private void generateAssociationAccessors(Writer output, ObjectModelClass clazz, String name, String type) throws IOException { - /*{ /** - * @param value La valeur de l'attribut <%=name%> � positionner. - *) - public void set<%=GeneratorUtil.capitalize(name)%>Of<%=clazz.getName()%>(String topiaId, <%=type%> value) throws TopiaException{ - TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); - entity.set<%=GeneratorUtil.capitalize(name)%>( value); - } + String clazzName = clazz.getName(); +/*{ /** + * @param value La valeur de l'attribut <%=name%> à positionner. + *) + public void set<%=GeneratorUtil.capitalize(name)%>Of<%=clazzName%>(String topiaId, <%=type%> value) throws TopiaException{ + TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); + entity.set<%=GeneratorUtil.capitalize(name)%>( value); + } - /** - * @return La valeur de l'attribut <%=name%>. - *) - public <%=type%> get<%=GeneratorUtil.capitalize(name)%>Of<%=clazz.getName()%>(String topiaId) throws TopiaException{ - TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; - <%=clazz.getName()%>DAOAbstract dao = (<%=clazz.getName()%>DAOAbstract)usedContextImpl.getDAO(<%=clazz.getName()%>.class); - <%=clazz.getName()%> entity = (<%=clazz.getName()%>)dao.findByTopiaId(topiaId); - return entity.get<%=GeneratorUtil.capitalize(name)%>(); - } + /** + * @return La valeur de l'attribut <%=name%>. + *) + public <%=type%> get<%=GeneratorUtil.capitalize(name)%>Of<%=clazzName%>(String topiaId) throws TopiaException{ + TopiaContextImplementor usedContextImpl = (TopiaContextImplementor) topiaContext; + <%=clazzName%>DAOAbstract dao = (<%=clazzName%>DAOAbstract)usedContextImpl.getDAO(<%=clazzName%>.class); + <%=clazzName%> entity = (<%=clazzName%>)dao.findByTopiaId(topiaId); + return entity.get<%=GeneratorUtil.capitalize(name)%>(); + } - }*/ +}*/ } } //ServiceAbstractGenerator Modified: topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceImplGenerator.java =================================================================== --- topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceImplGenerator.java 2009-01-29 11:22:36 UTC (rev 1329) +++ topia/branches/generators-refactoring/topia-soa/src/main/java/org/codelutin/topia/generator/ServiceImplGenerator.java 2009-01-29 11:46:59 UTC (rev 1330) @@ -110,6 +110,7 @@ private void generateInterfaceHeader(Writer output, ObjectModelClassifier classifier) throws IOException { String copyright = TopiaGeneratorUtil.getCopyright(model); + String classifierName = classifier.getName(); if (TopiaGeneratorUtil.notEmpty(copyright)) { /*{<%=copyright%> }*/ @@ -117,7 +118,6 @@ /*{package <%=classifier.getPackageName()%>;}*/ if (TopiaGeneratorUtil.hasDocumentation(classifier)) { - /*{ /** * @@ -127,7 +127,7 @@ } /*{ -public class <%=classifier.getName()+"Impl"%> extends <%=classifier.getName()+"Abstract"%>{ }*/ +public class <%=classifierName%>Impl extends <%=classifierName%>Abstract { }*/ } } //ServiceImplGenerator
participants (1)
-
thimel@users.labs.libre-entreprise.org