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.27 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.27 Mon Jun 28 23:04:22 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java Thu Jul 1 12:36:04 2004 @@ -102,16 +102,18 @@ //=============================================================================== /** * create the parameters which is needed to be able to call the Show( associationClass). - * @param _attribute + * @param _attributeName + * @param _participantClass * @return string to put after the begining of the URI ex: /Show<%=getCallForAssociationClass(clazz)%>} */ - private String getCallForAssociationClass( ObjectModelClass _participantClass ){ - String relationName = _participantClass.getName(); - String stringReturn = relationName + "?"; + private String getCallForAssociationClass(String _participantName, ObjectModelClass _participantClass ){ + String relationName = _participantName ; + if (Util.toUpperCaseFirstLetter( relationName).equals(_participantClass.getName())) relationName = Util.getClassShortName(_participantClass ); + String stringReturn = Util.toUpperCaseFirstLetter(relationName) + "?"; ListPkAttribute listPrimaryKey = new ListPkAttribute(model, _participantClass, false); for(Iterator iterList=listPrimaryKey.getName().iterator(); iterList.hasNext(); ){ String fieldName = (String) iterList.next(); - stringReturn += fieldName + "=${" + fieldName; + stringReturn += fieldName + "=${" +relationName + Util.toUpperCaseFirstLetter(fieldName); if( iterList.hasNext() ) stringReturn += stringReturn + "}&"; } @@ -184,12 +186,19 @@ }*/ } if (! participantClass.equals((ObjectModelClass) attrEditAssoc.getDeclaringElement() ) ){ - String call = getCallForAssociationClass( participantClass ); + if (Util.hasGuiShow(participantClass) ){ + String call = getCallForAssociationClass(participantName, participantClass ); /*{ }*/ + }else{ +/*{ + + +}*/ + } } } } @@ -406,7 +415,7 @@ * *@author Olivier.Heintz@nereide.biz *@author malin.nicolas@nereide.biz -*@version $Revision: 1.27 $ +*@version $Revision: 1.28 $ *@since 3.1 * * This file has been generated, and will be re-generated, 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.7 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.7 Thu Jul 1 07:39:41 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditAssocBsh.java Thu Jul 1 12:36:04 2004 @@ -8,6 +8,7 @@ import java.util.Map; import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModelAssociationClass; import org.codelutin.generator.models.object.ObjectModelAttribute; import org.codelutin.generator.models.object.ObjectModelClass; @@ -62,7 +63,7 @@ /*{ -// $Id: GeneratorEditAssocBsh.java,v 1.7 2004/07/01 07:39:41 holivier Exp $ +// $Id: GeneratorEditAssocBsh.java,v 1.8 2004/07/01 12:36:04 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 @@ -82,7 +83,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 // // Calls Find on a dynamiqueView to return an EntityListIterator of the @@ -311,57 +312,102 @@ } } - // add in the dynamicView all the associated entity + // if there is an association class add in the dynamicView for the other association Class participant int nbAssoc = 1; - for (Iterator iter=listAssoc.iterator(); iter.hasNext(); ){ - ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); - Map relationKeyName = Util.getRelationOneFieldName(model, attribute); - ObjectModelClass clazzAssoc = (ObjectModelClass) relationKeyName.get("clazzAssociated"); - String relationName = clazzAssoc.getName(); + if (classAssociated instanceof ObjectModelAssociationClass && Util.hasGuiShow((ObjectModelClass)association.getClassifier() ) ) { + ObjectModelClass clazzAssoc = (ObjectModelClass)association.getClassifier(); + ObjectModelAttribute attribute = association; + String relationName = attribute.getName(); + if (Util.toUpperCaseFirstLetter(relationName).equals(clazzAssoc.getName())) relationName = Util.getClassShortName(clazzAssoc ); /*{ // 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.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); }*/ 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); -/*{ dynamicView.addAlias("EE", "<%=fieldName%>"); -}*/ - } + attributesIndexed.add(relationName+"Name"); + attributesIndexed.add(relationName+"Description"); } + // 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.addAlias("E<%=String.valueOf(nbAssoc)%>", "<%=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(); + ListPkAttribute listPrimaryKeyClazzAssoc = new ListPkAttribute(model, clazzAssoc, true); + for (int iCassoc=0; iCassoc", "<%=(String) relationItem.get("relFieldName")%>"}*/ +/*{"<%=fieldName%>", "<%=relFieldName%>"}*/ first = false; } /*{ )); }*/ nbAssoc += 1; + } + + // add in the dynamicView all the associated entity + for (Iterator iter=listAssoc.iterator(); iter.hasNext(); ){ + 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(); +/*{ + // 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); + +}*/ + 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); +/*{ 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) ){ +/*{ 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 ){ +/*{, }*/ + } +/*{"<%=(String) relationItem.get("fieldName")%>", "<%=(String) relationItem.get("relFieldName")%>"}*/ + first = false; + } +/*{ )); +}*/ + nbAssoc += 1; + } } /*{ // read and analyse the inputFields Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntitymodelXml.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntitymodelXml.java:1.10 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntitymodelXml.java:1.11 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntitymodelXml.java:1.10 Mon Jun 28 23:04:22 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntitymodelXml.java Thu Jul 1 12:36:04 2004 @@ -55,7 +55,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *@author Olivier.Heintz@nereide.biz - *@version $Revision: 1.10 $ + *@version $Revision: 1.11 $ *@since 3.1 * * This file has been generated, and will be re-generated, @@ -194,10 +194,9 @@ }*/ String participantName = (String) ((List) participantsWithName.get("attributeParticipants")).get(i); if (Util.toUpperCaseFirstLetter(participantName).equals(participantClass.getName())) participantName = Util.getClassShortName(participantClass); - listPrimaryKeyName.clear(); listPrimaryKeyType.clear(); - Util.getListPrimaryKeyAttr(model, participantClass, listPrimaryKeyName, listPrimaryKeyType); - for(int j=0; j }*/ } @@ -211,10 +210,16 @@ if (attribute.referenceClassifier()){ Map relationKeyName = Util.getRelationOneFieldName(model, attribute); String relationName = ((ObjectModelClass) relationKeyName.get("clazzAssociated")).getName(); + boolean ifTitle = ! (Util.toUpperCaseFirstLetter( attribute.getName() ).equals( attribute.getClassifier().getName() ) ); if (attribute.getMaxMultiplicity() == 1){ + if (ifTitle){ +/*{ +}*/ + }else{ /*{ }*/ + } List listName = (List) relationKeyName.get("listName"); for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ Map fieldName = (Map) iterList.next(); @@ -222,8 +227,13 @@ }*/ } } else { + if (ifTitle){ +/*{ +}*/ + }else{ /*{ }*/ + } String reverseAttributeName = ( attribute.getReverseAttribute() != null ) ? Util.getAttributeShortName(attribute.getReverseAttribute()) : Util.getClassShortName(clazz);