Je mets entre parenthèse le nom de l'attribut à la suite de la sortie. sortie : <!-- test : java.lang.String = false/false --> (contactListTypeId) <!-- test : java.lang.String = false/false --> (contactMechTypeId) De plus, une recherche de "true/f" ne me renvoie aucun résultat dans le fichier généré. Le mardi 21 juillet 2009 à 16:39 +0200, Eric Chatellier a écrit :
Romain Manni-Bucau a écrit :
Je mets en PJ le modèle, l'objectmodel et voici le bout du template qui ne marche pas :
Ça reste un peu difficile à analyser.
Util : ------ public static Collection<ObjectModelAttribute> getPrimaryKeyAttributes(ObjectModelClass clazz) { ArrayList<ObjectModelAttribute> primaryKeyAttributes = new ArrayList<ObjectModelAttribute>(); for (ObjectModelAttribute attribute : clazz.getAttributes()) if (isPrimaryKey(attribute)) primaryKeyAttributes.add(attribute); return primaryKeyAttributes; }
ListPkAttribute : ----------------- ... protected List<ObjectModelAttribute> origAttr = new ArrayList<ObjectModelAttribute>(); ...
Constructeur (récursif) : ... for (Iterator iter=Util.getPrimaryKeyAttributes(clazz).iterator(); iter.hasNext(); ){ ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); ... this.origAttr.add(attribute); } ...
Générateur : ------------
ListPkAttribute listPrimaryKey = new ListPkAttribute(model, clazzAssociated, true); for(int i=0; i<listPrimaryKey.getName().size(); i++ ){ ObjectModelAttribute attributeI = listPrimaryKey.getOrigAttr().get(i); /*{<!-- agg ? <%=attributeI.isAggregate()%> -->}*/ // renvoie toujours false }
Êtes vous sur qu'il affiche "false" pour la bonne classe ?
Pouvez vous faire un test avec plus d'infos dans le template :
/*{<!-- test : <%=attributeI.getType()%> = <%=attributeI.isAggregate()%>/<%=attributeI.isComposite()%> -->}*/
Il devrait afficher : <!-- test : org.ofbiz.marketing.contact.entities.ContactList = true/false -->