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 --> -- Éric <chatellier@codelutin.com> Tel: 02 40 50 29 28 http://www.codelutin.com