Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.28 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.29 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.28 Thu Jul 1 12:36:04 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java Mon Jul 5 22:26:16 2004 @@ -201,6 +201,18 @@ } } } + } else if ( attrEditAssoc != null && attrEditAssoc.getReverseAttribute() != null ){ + ObjectModelAttribute attrEditAssocReverse = attrEditAssoc.getReverseAttribute(); + ObjectModelClass classAssociated = (ObjectModelClass) attrEditAssoc.getDeclaringElement(); + String relationName = (attrEditAssocReverse.getName().equals(Util.toLowerCaseFirstLetter(classAssociated.getName())) ) ? + Util.toLowerCaseFirstLetter(classAssociated.getName()) : + attrEditAssocReverse.getName(); + ListPkAttribute listPrimaryKey = new ListPkAttribute(model, classAssociated, false); + for(int i=0; i +}*/ + } } for (Iterator iter = listAttList.iterator(); iter.hasNext(); ){ ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); @@ -415,7 +427,7 @@ * *@author Olivier.Heintz@nereide.biz *@author malin.nicolas@nereide.biz -*@version $Revision: 1.28 $ +*@version $Revision: 1.29 $ *@since 3.1 * * This file has been generated, and will be re-generated, @@ -609,10 +621,8 @@ } else if (attribute.referenceClassifier() ){ if (attribute.getMaxMultiplicity() == 1 ){ Map relationKeyName = Util.getRelationOneFieldName(model, attribute); - ObjectModelClass clazzAssociated = (ObjectModelClass) relationKeyName.get("clazzAssociated"); - String relationName = Util.toLowerCaseFirstLetter(clazzAssociated.getName() ); /*{ - + }*/ } Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java:1.8 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java:1.9 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java:1.8 Thu Jul 1 12:36:04 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java Mon Jul 5 22:26:16 2004 @@ -47,7 +47,7 @@ if (attribute.referenceClassifier() ){ if (attribute.getMaxMultiplicity() == 1){ Map relationKeyName = Util.getRelationOneFieldName(model, attribute); - listAttAssoc.add(relationKeyName); + listAttAssoc.add(attribute); List listName = (List) relationKeyName.get("listName"); for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ Map fieldNameMap = (Map) iterList.next(); @@ -63,7 +63,7 @@ /*{ -// $Id: GeneratorEditAssocBsh.java,v 1.8 2004/07/01 12:36:04 holivier Exp $ +// $Id: GeneratorEditAssocBsh.java,v 1.9 2004/07/05 22:26:16 holivier Exp $ // Copyright (c) 2004 Olivier Heintz - olivier.heintz@nereide.biz // Copyright (c) 2004 Nereide - www.nereide.biz // Copyright (c) 2004 Neogia - www.neogia.org @@ -83,7 +83,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // @author Olivier.Heintz@nereide.biz -// @version $Revision: 1.8 $ +// @version $Revision: 1.9 $ // @since 3.1 // // Calls Find on a dynamiqueView to return an EntityListIterator of the @@ -142,27 +142,34 @@ primaryKeysEmpty += ") || UtilValidate.isEmpty("; primaryKeysMap += ",\""; } -/*{String <%=attributeKeyName%> = request.getParameter("<%=attributeKeyName%>"); +/*{String <%=attributeKeyName%> = null; }*/ } primaryKeysEmpty += ")"; -/*{if (<%=primaryKeysEmpty%>) { -}*/ for (Iterator iter=associationList.iterator(); iter.hasNext(); ){ ObjectModelAttribute association = (ObjectModelAttribute) iter.next(); -/*{ if (association.equals("<%=association.getName()%>") ){ +/*{ +if (association.equals("<%=association.getName()%>") ){ }*/ String reverseAttributeName = ( association.getReverseAttribute() != null ) ? Util.getAttributeShortName(association.getReverseAttribute()) : Util.getClassShortName(clazz); for(int i=0; i = request.getParameter("<%=reverseAttributeName%><%=Util.toUpperCaseFirstLetter(attributeKeyName)%>"); +/*{ <%=attributeKeyName%> = request.getParameter("<%=reverseAttributeName%><%=Util.toUpperCaseFirstLetter(attributeKeyName)%>"); }*/ } -/*{ } +/*{} }*/ } +/*{ +if (<%=primaryKeysEmpty%>) { +}*/ + for(int i=0; i = request.getParameter("<%=attributeKeyName%>"); +}*/ + } /*{} }*/ for (Iterator iter=associationList.iterator(); iter.hasNext(); ){ @@ -227,14 +234,20 @@ }*/ } for (int i=0; i = <%=Util.toLowerCaseFirstLetter(entityName)%>.getRelatedOne("<%=relationName%>"); - if (<%=Util.toLowerCaseFirstLetter(relationName )%> != null){ - formsData.put("<%=Util.toLowerCaseFirstLetter(relationName )%>Description", <%=Util.toLowerCaseFirstLetter(relationName )%>.get("<%=descriptionFieldName%>") ); - formsData.put("<%=Util.toLowerCaseFirstLetter(relationName )%>Name", <%=Util.toLowerCaseFirstLetter(relationName )%>.get("<%=idNameFieldName%>") ); + ObjectModelAttribute attrAssociated = (ObjectModelAttribute) listAttAssoc.get(i) ; + ObjectModelClass classAssociated = (attrAssociated.hasAssociationClass() ) ? + attrAssociated.getAssociationClass() : + (ObjectModelClass) attrAssociated.getClassifier(); + String attributeName = attrAssociated.getName(); + String relationName = (attrAssociated.getName().equals(Util.toLowerCaseFirstLetter(attrAssociated.getClassifier().getName() ) ) ) ? + classAssociated.getName() : + Util.toUpperCaseFirstLetter(attributeName) + classAssociated.getName(); + String idNameFieldName = Util.getAttributeName(classAssociated ); + String descriptionFieldName = Util.getAttributeDescription(classAssociated ); +/*{ GenericValue <%=attributeName%> = <%=Util.toLowerCaseFirstLetter(entityName)%>.getRelatedOne("<%=relationName%>"); + if (<%=attributeName%> != null){ + formsData.put("<%=attributeName%>Description", <%=attributeName%>.get("<%=descriptionFieldName%>") ); + formsData.put("<%=attributeName%>Name", <%=attributeName%>.get("<%=idNameFieldName%>") ); } }*/ @@ -292,20 +305,12 @@ List listAssoc = new ArrayList(); List attributesListOrIndexed = Util.getAttributesList(classAssociated); List attributesIndexed = new ArrayList(); - // add attributes with gui indexed if there are not already in the list - for (Iterator iter=classAssociated.getAttributes().iterator(); iter.hasNext(); ){ - ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); - if (Util.hasGuiIndexed(attribute)){ - if (! attribute.referenceClassifier()) attributesIndexed.add(attribute.getName()); - if (attributesListOrIndexed.indexOf(attribute) == -1) attributesListOrIndexed.add(attribute); - } - } List listAttNameAssoc = new ArrayList(); for (Iterator iter=attributesListOrIndexed.iterator(); iter.hasNext(); ){ ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); if ( attribute.referenceClassifier() ){ if ( attribute.getMaxMultiplicity() == 1 ) listAssoc.add(attribute); - } else{ + } else if (! Util.isPrimaryKey(attribute) ){ listAttNameAssoc.add(attribute.getName()); /*{ dynamicView.addAlias("EE", "<%=attribute.getName()%>"); }*/