Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java:1.7 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java:1.8 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java:1.7 Mon Jun 28 23:04:22 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java Tue Jul 6 09:22:07 2004 @@ -28,7 +28,7 @@ //System.out.println("XXXXXXXX1Debug clazz.getName="+clazz.getName()); /*{ -// $Id: GeneratorEditBsh.java,v 1.7 2004/06/28 23:04:22 holivier Exp $ +// $Id: GeneratorEditBsh.java,v 1.8 2004/07/06 09:22:07 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 @@ -48,7 +48,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // @author Olivier.Heintz@nereide.biz -// @version $Revision: 1.7 $ +// @version $Revision: 1.8 $ // @since 3.1 // // @@ -86,7 +86,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(); @@ -169,15 +169,17 @@ }*/ } 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%>") ); + GenericValue <%=attributeName%> = <%=Util.toLowerCaseFirstLetter(entityName)%>.getRelatedOne("<%=relationName%>"); + if (<%=attributeName%> != null){ + formsData.put("<%=attributeName%>Description", <%=attributeName%>.get("<%=descriptionFieldName%>") ); + formsData.put("<%=attributeName%>Name", <%=attributeName%>.get("<%=idNameFieldName%>") ); } }*/ 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.29 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.30 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.29 Mon Jul 5 22:26:16 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java Tue Jul 6 09:22:07 2004 @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.Writer; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -80,6 +81,27 @@ // =============================================================================== /** + * get the fieldName list for hidden field in subList or subEdit. + * It's the list of the ReverseclassAssociated PK. + * @param _attrEditAssoc + * @param _reverseAttribute + * @return list of String FieldName used for define } @@ -147,7 +169,9 @@ default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext"> }*/ + ObjectModelAttribute attrEditAssocReverse = null; if (attrEditAssoc != null){ + attrEditAssocReverse = attrEditAssoc.getReverseAttribute(); /*{ }*/ } @@ -201,39 +225,34 @@ } } } - } 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(); - if (attribute.referenceClassifier() ){ - String classAssociatedName = Util.toLowerCaseFirstLetter(attribute.getClassifier().getName()); - if (Util.hasGuiShow((ObjectModelClass) attribute.getClassifier() ) ){ - String call = getCallForAssociation( attribute ); + if ( ! attribute.equals(attrEditAssocReverse ) ){ + if (attribute.referenceClassifier() ){ + if (Util.hasGuiShow((ObjectModelClass) attribute.getClassifier() ) ){ + String call = getCallForAssociation( attribute ); /*{ + description="[${<%=attribute.getName()%>Name}] ${<%=attribute.getName()%>Description}"/> }*/ - } else{ + } else{ /*{ - + }*/ - } - }else { + } + }else { /*{ }*/ + } } } listValAtt = ""; @@ -261,7 +280,9 @@ /*{ default-title-style="tableheadtext" default-widget-style="tabletext" default-tooltip-style="tabletext"> }*/ + ObjectModelAttribute attrEditAssocReverse = null; if (attrEditAssoc != null){ + attrEditAssocReverse = attrEditAssoc.getReverseAttribute(); /*{ }*/ } @@ -321,7 +342,13 @@ } for ( Iterator iter = clazz.getAttributes().iterator(); iter.hasNext(); ){ ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); - if (! Util.hasGuiHidden(attribute) ){ + if ( attribute.equals(attrEditAssocReverse ) ){ + for (Iterator iterFN=getListFieldNamePKReverse(attrEditAssoc, attrEditAssocReverse).iterator(); iterFN.hasNext(); ){ + String fieldName = (String) iterFN.next(); +/*{ +}*/ + } + } else if (! Util.hasGuiHidden(attribute) ){ if (Util.hasGuiCalculated(attribute) ){ /*{ }*/ @@ -356,7 +383,7 @@ }*/ } /*{ - + }*/ } } @@ -427,7 +454,7 @@ * *@author Olivier.Heintz@nereide.biz *@author malin.nicolas@nereide.biz -*@version $Revision: 1.29 $ +*@version $Revision: 1.30 $ *@since 3.1 * * This file has been generated, and will be re-generated, Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java:1.24 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java:1.25 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java:1.24 Tue Jun 29 10:23:26 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java Tue Jul 6 09:22:07 2004 @@ -28,9 +28,9 @@ * Copyright Code Lutin * Copyright Nereide * Copyright Neogia -* @version $Revision: 1.24 $ +* @version $Revision: 1.25 $ * -* Last update : $Date: 2004/06/29 10:23:26 $ +* Last update : $Date: 2004/07/06 09:22:07 $ * by : $Author: holivier $ */ package org.nereide.ofbiz.neogia.generators; @@ -436,6 +436,24 @@ */ public static Map getRelationOneFieldName(ObjectModel model, ObjectModelAttribute attribute){ return getRelationOneFieldName(model,attribute, (ObjectModelClass) null); + } + + /** + * Get the associationClass if exist _attribute.getClassifier() otherwise. + */ + public static ObjectModelClass getAssociatedOrAssociationClass( ObjectModelAttribute _attribute){ + return (_attribute.hasAssociationClass() ) ? + _attribute.getAssociationClass() : + (ObjectModelClass) _attribute.getClassifier(); + } + + /** + * Get the RelationName to put in XXX.getRelatedOne(), for an _attribute which is classifer. + */ + public static String getRelationNameForGetRelatedOne( ObjectModelAttribute _attribute, ObjectModelClass _associatedClass){ + return (_attribute.getName().equals(Util.toLowerCaseFirstLetter(_attribute.getClassifier().getName() ) ) ) ? + _associatedClass.getName() : + Util.toUpperCaseFirstLetter(_attribute.getName()) + _associatedClass.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.9 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java:1.10 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java:1.9 Mon Jul 5 22:26:16 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java Tue Jul 6 09:22:07 2004 @@ -63,7 +63,7 @@ /*{ -// $Id: GeneratorEditAssocBsh.java,v 1.9 2004/07/05 22:26:16 holivier Exp $ +// $Id: GeneratorEditAssocBsh.java,v 1.10 2004/07/06 09:22:07 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.9 $ +// @version $Revision: 1.10 $ // @since 3.1 // // Calls Find on a dynamiqueView to return an EntityListIterator of the @@ -235,13 +235,9 @@ } for (int i=0; i = <%=Util.toLowerCaseFirstLetter(entityName)%>.getRelatedOne("<%=relationName%>"); @@ -325,7 +321,7 @@ String relationName = attribute.getName(); if (Util.toUpperCaseFirstLetter(relationName).equals(clazzAssoc.getName())) relationName = Util.getClassShortName(clazzAssoc ); /*{ - // Associated entities + // Association Class member associated entities dynamicView.addMemberEntity("E<%=String.valueOf(nbAssoc)%>", "<%=Util.toUpperCaseFirstLetter(relationName)%>"); dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=relationName%>Name","<%=Util.getAttributeName(clazzAssoc)%>",null,null,null,null); dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=relationName%>Description","<%=Util.getAttributeDescription(clazzAssoc)%>",null,null,null,null); @@ -366,53 +362,51 @@ ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); Map relationKeyName = Util.getRelationOneFieldName(model, attribute); ObjectModelClass clazzAssoc = (ObjectModelClass) relationKeyName.get("clazzAssociated"); - if (Util.hasGuiShow(clazzAssoc) ){ - String relationName = clazzAssoc.getName(); + String relationName = clazzAssoc.getName(); /*{ // Associated entities dynamicView.addMemberEntity("E<%=String.valueOf(nbAssoc)%>", "<%=relationName%>"); - dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=Util.toLowerCaseFirstLetter(relationName)%>Name","<%=Util.getAttributeName(clazzAssoc)%>",null,null,null,null); - dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=Util.toLowerCaseFirstLetter(relationName)%>Description","<%=Util.getAttributeDescription(clazzAssoc)%>",null,null,null,null); + dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=attribute.getName()%>Name","<%=Util.getAttributeName(clazzAssoc)%>",null,null,null,null); + dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=attribute.getName()%>Description","<%=Util.getAttributeDescription(clazzAssoc)%>",null,null,null,null); }*/ - if (Util.hasGuiIndexed(attribute) ){ - attributesIndexed.add(Util.toLowerCaseFirstLetter(relationName)+"Name"); - attributesIndexed.add(Util.toLowerCaseFirstLetter(relationName)+"Description"); - } - - // check and add if necessary, the field relation maker - List listName = (List) relationKeyName.get("listName"); - for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ - Map relationItem = (Map) iterList.next(); - String fieldName = (String) relationItem.get("fieldName"); - if (listAttributeName.indexOf(fieldName) == -1){ // adding the field in the dynamicView - listAttributeName.add(fieldName); + if (Util.hasGuiIndexed(attribute) ){ + attributesIndexed.add(attribute.getName()+"Name"); + attributesIndexed.add(attribute.getName()+"Description"); + } + + // check and add if necessary, the field relation maker + List listName = (List) relationKeyName.get("listName"); + for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ + Map relationItem = (Map) iterList.next(); + String fieldName = (String) relationItem.get("fieldName"); + if (listAttributeName.indexOf(fieldName) == -1){ // adding the field in the dynamicView + listAttributeName.add(fieldName); /*{ dynamicView.addAlias("EE", "<%=fieldName%>"); }*/ - } } - // Add the classAssoc attributes with the tag gui listInAssoc - for (Iterator iterAssocB=clazzAssoc.getAttributes().iterator(); iterAssocB.hasNext(); ){ - ObjectModelAttribute attributeAssoc = (ObjectModelAttribute) iterAssocB.next(); - if ( Util.hasGuiListInAssoc(attributeAssoc) ){ + } + // Add the classAssoc attributes with the tag gui listInAssoc + for (Iterator iterAssocB=clazzAssoc.getAttributes().iterator(); iterAssocB.hasNext(); ){ + ObjectModelAttribute attributeAssoc = (ObjectModelAttribute) iterAssocB.next(); + if ( Util.hasGuiListInAssoc(attributeAssoc) ){ /*{ dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=Util.toLowerCaseFirstLetter(relationName)%><%=Util.toUpperCaseFirstLetter(attributeAssoc.getName())%>","<%=attributeAssoc.getName()%>",null,null,null,null); }*/ - } } + } /*{ dynamicView.addViewLink("EE", "E<%=String.valueOf(nbAssoc)%>", Boolean.TRUE, ModelKeyMap.makeKeyMapList( }*/ - boolean first = true; - for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ - Map relationItem = (Map) iterList.next(); - if ( ! first ){ + boolean first = true; + for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ + Map relationItem = (Map) iterList.next(); + if ( ! first ){ /*{, }*/ - } -/*{"<%=(String) relationItem.get("fieldName")%>", "<%=(String) relationItem.get("relFieldName")%>"}*/ - first = false; } +/*{"<%=(String) relationItem.get("fieldName")%>", "<%=(String) relationItem.get("relFieldName")%>"}*/ + first = false; + } /*{ )); }*/ - nbAssoc += 1; - } + nbAssoc += 1; } /*{ // read and analyse the inputFields @@ -476,7 +470,7 @@ if (attribute.referenceClassifier() ){ if (attribute.getMaxMultiplicity() == 1){ Map relationKeyName = Util.getRelationOneFieldName(model, attribute); - listAttAssocB.add(relationKeyName); + listAttAssocB.add(attribute); List listName = (List) relationKeyName.get("listName"); for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ Map fieldNameMap = (Map) iterList.next(); @@ -495,7 +489,7 @@ for(int j=0; j = request.getParameter("<%=attributeKeyName%>"); - context.put("<%=attributeKeyName%>", <%=attributeKeyName%>); + context.put("<%=association.getName()%><%=attributeKeyName%>", <%=attributeKeyName%>); <%=association.getName()%>FD.put("<%=attributeKeyName%>",<%=attributeKeyName%>); }*/ @@ -544,14 +538,16 @@ }*/ } for (int i=0; i = <%=Util.toLowerCaseFirstLetter(classAssociated.getName())%>.getRelatedOne("<%=relationName%>"); - if (<%=Util.toLowerCaseFirstLetter(relationName )%> != null){ - <%=association.getName()%>FD.put("<%=Util.toLowerCaseFirstLetter(relationName )%>Description", <%=Util.toLowerCaseFirstLetter(relationName )%>.get("<%=descriptionFieldName%>") ); - <%=association.getName()%>FD.put("<%=Util.toLowerCaseFirstLetter(relationName )%>Name", <%=Util.toLowerCaseFirstLetter(relationName )%>.get("<%=idNameFieldName%>") ); +/*{ GenericValue <%=attributeName%> = <%=Util.toLowerCaseFirstLetter(classAssociated.getName())%>.getRelatedOne("<%=relationName%>"); + if (<%=attributeName%> != null){ + <%=association.getName()%>FD.put("<%=attributeName%>Description", <%=attributeName%>.get("<%=descriptionFieldName%>") ); + <%=association.getName()%>FD.put("<%=attributeName%>Name", <%=attributeName%>.get("<%=idNameFieldName%>") ); } }*/ Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFindBsh.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFindBsh.java:1.6 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFindBsh.java:1.7 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFindBsh.java:1.6 Mon Jun 28 23:04:22 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFindBsh.java Tue Jul 6 09:22:07 2004 @@ -27,7 +27,7 @@ //System.out.println("XXXXXXXX1Debug clazz.getName="+clazz.getName()); /*{ -// $Id: GeneratorFindBsh.java,v 1.6 2004/06/28 23:04:22 holivier Exp $ +// $Id: GeneratorFindBsh.java,v 1.7 2004/07/06 09:22:07 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 @@ -47,7 +47,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // @author Olivier.Heintz@nereide.biz -// @version $Revision: 1.6 $ +// @version $Revision: 1.7 $ // @since 3.1 // // Calls Find on a dynamiqueView to return an EntityListIterator of the @@ -141,13 +141,13 @@ // Associated entities dynamicView.addMemberEntity("E<%=String.valueOf(nbAssoc)%>", "<%=relationName%>"); - dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=Util.toLowerCaseFirstLetter(relationName)%>Name","<%=Util.getAttributeName(clazzAssoc)%>",null,null,null,null); - dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=Util.toLowerCaseFirstLetter(relationName)%>Description","<%=Util.getAttributeDescription(clazzAssoc)%>",null,null,null,null); + dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=attribute.getName()%>Name","<%=Util.getAttributeName(clazzAssoc)%>",null,null,null,null); + dynamicView.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=attribute.getName()%>Description","<%=Util.getAttributeDescription(clazzAssoc)%>",null,null,null,null); }*/ if (Util.hasGuiIndexed(attribute) ){ - attributesIndexed.add(Util.toLowerCaseFirstLetter(relationName)+"Name"); - attributesIndexed.add(Util.toLowerCaseFirstLetter(relationName)+"Description"); + attributesIndexed.add(attribute.getName()+"Name"); + attributesIndexed.add(attribute.getName()+"Description"); } // check and add if necessary, the field relation maker Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocFtl.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocFtl.java:1.3 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocFtl.java:1.4 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocFtl.java:1.3 Fri Jun 25 19:55:10 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocFtl.java Tue Jul 6 09:22:07 2004 @@ -59,7 +59,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * @author Olivier.Heintz@nereide.biz - *@version $Revision: 1.3 $ + *@version $Revision: 1.4 $ *@since 3.1 * * This file has been generated, and will be re-generated, @@ -100,7 +100,7 @@ String primaryKeysAssoc = ""; for(int i=0; i