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.17 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.18 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java:1.17 Fri May 28 20:45:25 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorFormsXml.java Wed Jun 2 00:09:26 2004 @@ -109,6 +109,9 @@ private String uiLabel( ObjectModelAttribute _attribute ){ return "${uiLabelMap." + packageName + Util.toUpperCaseFirstLetter( _attribute.getName() )+ "}"; } + private String uiLabel( String _attributeName ){ + return "${uiLabelMap." + packageName + Util.toUpperCaseFirstLetter( _attributeName )+ "}"; + } @@ -151,7 +154,7 @@ * *@author Olivier.Heintz@nereide.biz *@author malin.nicolas@nereide.biz -*@version $Revision: 1.17 $ +*@version $Revision: 1.18 $ *@since 3.1 * * This file has been generated, and will be re-generated, @@ -184,7 +187,7 @@ att = (ObjectModelAttribute) iter.next(); /*{ }*/ - if( att.getType().equals( "Date" ) ){ + if( att.getType().equals( "java.util.Date" ) ){ /*{}*/ } else if(! putLookup( output, att ) ); /*{}*/ @@ -309,8 +312,10 @@
+ }*/ for ( iter = listAttList.iterator(); iter.hasNext(); ){ att = (ObjectModelAttribute) iter.next(); @@ -359,47 +364,80 @@ - + }*/ - listValAtt = ""; - for ( iter = listAttEdit.iterator(); iter.hasNext(); ){ - att = (ObjectModelAttribute) iter.next(); - System.out.println( " Boucle " + att.getName() + " suivant? " + iter.hasNext() ); - -/*{ - }*/ - System.out.println( " Class Associée " ); - ObjectModelClass associatClazz = att.getAssociationClass(); - System.out.println( " associatClazz " + associatClazz.getName() ); - if( Util.hasGuiDropDown( associatClazz ) ){ -/*{ + for ( iter = clazz.getAttributes().iterator(); iter.hasNext(); ){ + ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); + System.out.println( " Boucle " + attribute.getName() + " suivant? " + iter.hasNext() ); + if (! Util.hasGuiHidden(attribute) ){ + if (Util.hasGuiCalculated(attribute) ){ +/*{ + +}*/ + } else if (attribute.referenceClassifier() ){ + if (attribute.getMaxMultiplicity() == 1 ){ + Map relationKeyName = Util.getRelationOneFieldName(model, attribute); + ObjectModelClass clazzAssociated = (ObjectModelClass) relationKeyName.get("clazzAssociated"); + String relationName = clazzAssociated.getName(); + String descriptionFieldName = Util.getAttributeDescription(clazzAssociated); + String iDFieldName = Util.getAttributeName(clazzAssociated); + List listName = (List) relationKeyName.get("listName"); + for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ + Map fieldNameMap = (Map) iterList.next(); + String attributeKeyName = (String) fieldNameMap.get("fieldName"); + String relAttributeKeyName = (String) fieldNameMap.get("relFieldName"); +/*{ + +}*/ + if (Util.hasGuiDropDown(clazzAssociated) ){ +/*{ - - + + - + }*/ + } else { + if (Util.hasGuiLookup(clazzAssociated) ){ +/*{ + +}*/ + } else { +/*{ + +}*/ + } +/*{ + + +}*/ + } + } } - } - else { /*{>}*/ } - - if( putLookup( output, att ) ){ } - - /*{ - + } else if (Util.isPrimaryKey(attribute) ){ +/*{ + }*/ + if (Util.isDate(attribute.getType() ) ) { /*{}*/ } + else { /*{}*/ } + /*{ + + +}*/ + } else { // a standard edit attribute +/*{ + }*/ + if (Util.isDate(attribute.getType() ) ) { /*{}*/ } + else { /*{}*/ } + /*{ }*/ - listValAtt = listValAtt + att.getName() + "=${" + att.getName() + "}&"; - } + } + } + } /*{ - - -
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.15 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java:1.16 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java:1.15 Fri May 28 20:45:25 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/Util.java Wed Jun 2 00:09:26 2004 @@ -28,9 +28,9 @@ * Copyright Code Lutin * Copyright Nereide * Copyright Neogia -* @version $Revision: 1.15 $ +* @version $Revision: 1.16 $ * -* Last update : $Date: 2004/05/28 20:45:25 $ +* Last update : $Date: 2004/06/02 00:09:26 $ * by : $Author: holivier $ */ package org.nereide.ofbiz.neogia.generators; @@ -226,9 +226,10 @@ * @param clazz * @param listPrimaryKeyName return list, (List of String) * @param listPrimaryKeyType return list, (List of String) + * @param entity to say if the ofbizType is an entity OfbizType (true) or java OfbizType (false) * @return */ - public static void getListPrimaryKeyAttr(ObjectModel model, ObjectModelClass clazz, List listPrimaryKeyName, List listPrimaryKeyType){ + public static void getListPrimaryKeyAttr(ObjectModel model, ObjectModelClass clazz, List listPrimaryKeyName, List listPrimaryKeyType, boolean entity){ System.out.println("XXXXXXX-getMapPrimaryKeyAttr1-Debug clazz="+clazz.getName()); // search for non navigable association and composite List classAssocWithoutNav = Util.getClassAssocWithoutNav(model, clazz); @@ -300,11 +301,22 @@ for (Iterator iter=org.codelutin.topia.Util.getPrimaryKeyAttributes(clazz).iterator(); iter.hasNext(); ){ ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); listPrimaryKeyName.add(attribute.getName()); - listPrimaryKeyType.add(Util.getOfbizType(attribute)); + if (entity) listPrimaryKeyType.add(Util.getOfbizType(attribute) ); + else listPrimaryKeyType.add(Util.getOfbizJavaType(attribute) ); } System.out.println("XXXXXXX-getMapPrimaryKeyAttr5-Debug class="+clazz.getName()+" listPrimaryKeys="+listPrimaryKeyName); return; } + /** + * call the same methode with true for the entity parameters, so return entity Ofbiz Type + * @param model + * @param clazz + * @param listPrimaryKeyName + * @param listPrimaryKeyType + */ + public static void getListPrimaryKeyAttr(ObjectModel model, ObjectModelClass clazz, List listPrimaryKeyName, List listPrimaryKeyType){ + getListPrimaryKeyAttr( model, clazz, listPrimaryKeyName, listPrimaryKeyType, true); + } /** * Give the class associated for the attribute, if maxMultiplicity==1, @@ -416,7 +428,7 @@ public static boolean hasGuiDropDown( ObjectModelClass _clazz ){ StringTokenizer guiTag = new StringTokenizer( _clazz.getTagValue( "gui" ) != null ? _clazz.getTagValue( "gui" ) : "" ); for( ; guiTag.hasMoreTokens(); ) - if( guiTag.nextToken().equals( "dropDown" )) + if( guiTag.nextToken().equals( "drop-down" )) return true; return false; } @@ -579,7 +591,7 @@ } /** - * return the available type in OFBiz for an attribute. + * return the available entity type in OFBiz for an attribute. * print a message if the type does'nt exist. * @param attribute * @return a String with the Ofbiz type or "name" if there is non corresponding type. @@ -598,6 +610,37 @@ attributeType = "name"; } return attributeType; + } + + /** + * return the available java type in OFBiz for an attribute. + * print a message if the type does'nt exist. + * @param attribute + * @return a String with the Ofbiz type or "String" if there is non corresponding type. + */ + public static String getOfbizJavaType(ObjectModelAttribute attribute){ + Map typeOfbiz = new HashMap(); + typeOfbiz.put("java.lang.String","String"); + typeOfbiz.put("java.lang.Long","Long"); + typeOfbiz.put("double","Double"); + typeOfbiz.put("java.util.Date","Timestamp"); + typeOfbiz.put("int","Long"); + typeOfbiz.put("boolean","Boolean"); + String attributeType = (String) typeOfbiz.get(attribute.getType()); + if (attributeType == null){ + System.out.println("UML MODEL ERROR Ofbiz type not define for type="+attribute.getType()+" in entity="+attribute.getDeclaringElement().getName()); + attributeType = "String"; + } + return attributeType; + } + + /** + * use to test if the attribute.getType == java.util.Date + * @param type + * @return type.equals("java.util.Date" ); + */ + public static boolean isDate(String type){ + return type.equals("java.util.Date" ); } /** Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorControlerXml.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorControlerXml.java:1.5 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorControlerXml.java:1.6 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorControlerXml.java:1.5 Fri May 28 20:45:25 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorControlerXml.java Wed Jun 2 00:09:26 2004 @@ -49,7 +49,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * *@author Olivier.Heintz@nereide.biz - *@version $Revision: 1.5 $ + *@version $Revision: 1.6 $ *@since 3.1 * * This file has been generated, and will be re-generated, @@ -83,10 +83,15 @@ } if (Util.hasGuiEdit(clazz)){ /*{ + + + + + - + Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorUiLabelProperties.java diff -u ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorUiLabelProperties.java:1.1 ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorUiLabelProperties.java:1.2 --- ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorUiLabelProperties.java:1.1 Fri May 28 20:45:25 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorUiLabelProperties.java Wed Jun 2 00:09:26 2004 @@ -76,7 +76,7 @@ #* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #* # *@author Olivier.Heintz@nereide.biz -# *@version $Revision: 1.1 $ +# *@version $Revision: 1.2 $ # *@since 3.1 # * # * This file has been generated, and will be re-generated, @@ -104,7 +104,10 @@ # <%=entityName%> #<%=Util.toUpperCaseFirstLetter(packageName)%>List<%=entityName%>=List <%=entityName%> +#<%=Util.toUpperCaseFirstLetter(packageName)%>Edit<%=entityName%>=Edit <%=entityName%> #<%=Util.toUpperCaseFirstLetter(packageName)%>New<%=entityName%>=New <%=entityName%> +#<%=Util.toUpperCaseFirstLetter(packageName)%><%=entityName%>Creation=<%=entityName%> Creation +#<%=Util.toUpperCaseFirstLetter(packageName)%><%=entityName%>Id=<%=entityName%> Id }*/ // all the primaryKeys Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java diff -u /dev/null ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java:1.1 --- /dev/null Wed Jun 2 00:09:31 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditBsh.java Wed Jun 2 00:09:26 2004 @@ -0,0 +1,187 @@ +package org.nereide.ofbiz.neogia.generators; + +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModelAttribute; +import org.codelutin.generator.models.object.ObjectModelClass; + +public class GeneratorEditBsh extends ObjectModelGenerator { + + + public String getFilenameForClass(ObjectModelClass clazz){ + Map nameMap = Util.initPackageName(clazz); + return ((String)nameMap.get("packageName"))+"/webapp/"+((String)nameMap.get("packageName"))+"/WEB-INF/actions/"+((String)nameMap.get("subpackageName"))+"/Edit"+clazz.getName()+".bsh"; + } + + public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { + if(! Util.isEntity(clazz)) return; + if (! Util.hasGuiList(clazz)) return; + Map nameMap = Util.initPackageName(clazz); + String packageName=(String) nameMap.get("packageName"); + String entityName = clazz.getName(); + System.out.println("XXXXXXXX1Debug clazz.getName="+clazz.getName()); + +/*{ +// $Id: GeneratorEditBsh.java,v 1.1 2004/06/02 00:09:26 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 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// @author Olivier.Heintz@nereide.biz +// @version $Revision: 1.1 $ +// @since 3.1 +// +// +// This file has been generated, and will be re-generated, +// so no modification must be done whitout copying it with a other name. +// +import java.util.*; +import org.ofbiz.entity.*; +import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.base.util.*; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilValidate; + +GenericDelegator delegator=request.getAttribute("delegator"); +HashMap formsData= new HashMap(); + +actionForm = request.getParameter("actionForm"); +if (UtilValidate.isEmpty(actionForm)) actionForm = "beforeAction"; +if (actionForm.startsWith("commit") ) actionForm = actionForm.substring(6); +context.put("actionForm",actionForm); + +}*/ + List listAttributeName = new ArrayList(); // list of all attribute which must be declare or read + List listAttCalculated = new ArrayList(); // list of read only attribute + List listAttAssoc = new ArrayList(); // list of the association with MaxMultiplicity() == 1 + + // initialisation of the three lists + for (Iterator iter=clazz.getAttributes().iterator(); iter.hasNext(); ){ + ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); + if (! Util.hasGuiHidden(attribute) && ! Util.isPrimaryKey(attribute)){ + if (Util.hasGuiCalculated(attribute)){ + listAttCalculated.add(attribute.getName()); + } else { + if (attribute.referenceClassifier() ){ + if (attribute.getMaxMultiplicity() == 1){ + Map relationKeyName = Util.getRelationOneFieldName(model, attribute); + listAttAssoc.add(relationKeyName); + List listName = (List) relationKeyName.get("listName"); + for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ + Map fieldNameMap = (Map) iterList.next(); + String attributeKeyName = (String) fieldNameMap.get("fieldName"); + listAttributeName.add(attributeKeyName); + } + } + } else listAttributeName.add(attribute.getName() ); + } + } + } + // initialisation of the primaryList + List listPrimaryKeyName = new ArrayList(), listPrimaryKeyType = new ArrayList(); + Util.getListPrimaryKeyAttr(model, clazz, listPrimaryKeyName, listPrimaryKeyType); + String primaryKeysEmpty = "! UtilValidate.isEmpty("; + String primaryKeysMap = "\""; + for(int j=0; j = request.getParameter("<%=attributeKeyName%>"); +}*/ + primaryKeysEmpty = primaryKeysEmpty + attributeKeyName; + primaryKeysMap = primaryKeysMap + attributeKeyName + "\"," + attributeKeyName; + if (j < listPrimaryKeyName.size()-1){ + primaryKeysEmpty = primaryKeysEmpty + ") && ! UtilValidate.isEmpty("; + primaryKeysMap = primaryKeysMap + ",\""; + } + } + primaryKeysEmpty = primaryKeysEmpty + ")"; +/*{ +if (<%=primaryKeysEmpty%>) { + GenericValue <%=entityName%> = delegator.findByPrimaryKey("<%=entityName%>", UtilMisc.toMap(<%=primaryKeysMap%>)); + + String }*/ + for (int i=0; i}*/ + if (i = request.getParameter("<%=attributeName%>"); +}*/ + } +/*{ + + if (<%=entityName%> != null){ + if (actionForm.equals("add") ) actionForm = "edit"; +}*/ + for(int j=0; j", <%=attributeKeyName%>); + formsData.put("<%=attributeKeyName%>",<%=attributeKeyName%>); + +}*/ + } +/*{ + // FOR attribue with calculated + // formsData.put("%attribue%",<%=entityName%>.get("%attribue%")); + // + +}*/ + for (int i=0; i != null) formsData.put("<%=attributeName%>",<%=attributeName%>); + else formsData.put("<%=attributeName%>",<%=entityName%>.get("<%=attributeName%>" )); + +}*/ + } + for (int i=0; i",<%=entityName%>.get("<%=attributeName%>" )); +}*/ + } + for (int i=0; i = <%=entityName%>.getRelatedOne("<%=relationName%>"); + formsData.put("<%=Util.toLowerCaseFirstLetter(relationName )%><%=Util.toUpperCaseFirstLetter(descriptionFieldName )%>", <%=Util.toLowerCaseFirstLetter(relationName )%>.get("<%=descriptionFieldName%>") ); + +}*/ + } +/*{ + request.setAttribute("formsData",formsData); + } +} +request.setAttribute("actionForm",actionForm); + +}*/ + } +} Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntityObjectJava.java diff -u /dev/null ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntityObjectJava.java:1.1 --- /dev/null Wed Jun 2 00:09:31 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEntityObjectJava.java Wed Jun 2 00:09:26 2004 @@ -0,0 +1,237 @@ +package org.nereide.ofbiz.neogia.generators; + +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModelAttribute; +import org.codelutin.generator.models.object.ObjectModelClass; + +public class GeneratorEntityObjectJava extends ObjectModelGenerator { + + + public String getFilenameForClass(ObjectModelClass clazz){ + Map nameMap = Util.initPackageName(clazz); + String packageName = (String) nameMap.get("packageName"); + return packageName+"/src/org/ofbiz/"+packageName+"/"+((String)nameMap.get("subpackageName"))+"/"+clazz.getName()+".java"; + } + + public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { + if (! Util.isEntity(clazz) ) return; + Map nameMap = Util.initPackageName(clazz); + String packageName = (String) nameMap.get("packageName"); + String subpackageName = (String)nameMap.get("subpackageName"); + String entityName = clazz.getName(); + +/*{ +// +// Copyright (c) 2004 Olivier Heintz - olivier.heintz@nereide.biz +// Copyright (c) 2004 Nereide - www.nereide.biz +// Copyright (c) 2004 Neogia - www.neogia.org +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// @author Olivier.Heintz@nereide.biz +// @version $Revision: 1.1 $ +// @since 3.1 +// +// This file has been generated, and will be re-generated, +// so no modification must be done whitout copying it with a other name. +// + + +package org.ofbiz.<%=packageName%>.<%=subpackageName%>; + +import java.lang.*; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.GenericDelegator; +import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.util.EntityTypeUtil; +import org.ofbiz.entity.util.EntityUtil; + + +public class <%=entityName%> { + + public static final String module = <%=entityName%>.class.getName(); + public static final String resource = "<%=Util.toUpperCaseFirstLetter(packageName)%>UiLabels"; + + protected GenericValue <%=Util.toLowerCaseFirstLetter(entityName)%>; +}*/ + // initialisation of the primaryKeyList + String primaryKeyAsParam="", primaryKeyAsMap="", primaryKeyNotEmpty="! UtilValidate.isEmpty("; + List listPrimaryKeyName = new ArrayList(), listPrimaryKeyType = new ArrayList(); + Util.getListPrimaryKeyAttr(model, clazz, listPrimaryKeyName, listPrimaryKeyType, false); + for(int j=0; j <%=attributeKeyName%>; +}*/ + if (j(GenericDelegator delegator, <%=primaryKeyAsParam%>){ +}*/ + for(int j=0; j = <%=(String) listPrimaryKeyName.get(j)%>; +}*/ + } +/*{ + try { + if (<%=primaryKeyNotEmpty%>)) { + this.<%=Util.toLowerCaseFirstLetter(entityName)%> = delegator.findByPrimaryKey("<%=entityName%>",UtilMisc.toMap(<%=primaryKeyAsMap%>) ); + if (! exist() ){ + this.<%=Util.toLowerCaseFirstLetter(entityName)%> = delegator.makeValue("<%=entityName%>",UtilMisc.toMap(<%=primaryKeyAsMap%>) ); + alreadyPersistant = false; + } else { + alreadyPersistant = true; + } + } + } catch (GenericEntityException e){ + Debug.logError("findByPrimaryKey in <%=entityName%> constructor :" + e.getMessage(), module); + this.<%=Util.toLowerCaseFirstLetter(entityName)%> = null; + } + } + + public boolean exist(){ + if (techDataCalendar != null) return true; + else return false; + } + + public boolean isAlreadyPersistant(){ + return alreadyPersistant; + } + + public GenericValue getGenericValue(){ + return techDataCalendar; + } +}*/ + for(int j=0; j(){ + if (exist() ) return <%=(String) listPrimaryKeyName.get(j)%>; + return null; + } +}*/ + } + for (Iterator iter=clazz.getAttributes().iterator(); iter.hasNext(); ){ + ObjectModelAttribute attribute = (ObjectModelAttribute) iter.next(); + if (! Util.isPrimaryKey(attribute) ){ + if (attribute.referenceClassifier() ){ + if (attribute.getMaxMultiplicity() == 1){ + Map relationKeyName = Util.getRelationOneFieldName(model, attribute); + List listName = (List) relationKeyName.get("listName"); + ObjectModelClass classAssociated = (ObjectModelClass) ((Map) relationKeyName ).get("clazzAssociated"); + primaryKeyAsParam=""; + listPrimaryKeyName.clear(); listPrimaryKeyType.clear(); + Util.getListPrimaryKeyAttr(model, classAssociated, listPrimaryKeyName, listPrimaryKeyType, false); + for(int j=0; j(){ + if (exist() ) return <%=Util.toLowerCaseFirstLetter(entityName)%>.getRelatedOne("<%=classAssociated.getName()%>"); + return null; + } + + public void set<%=classAssociated.getName()%>(<%=primaryKeyAsParam%> ){ + if (exist() ) { +}*/ + for(Iterator iterList=listName.iterator(); iterList.hasNext(); ){ + Map fieldNameMap = (Map) iterList.next(); + String fieldName = (String) fieldNameMap.get("fieldName"); + String relFieldName = (String) fieldNameMap.get("relFieldName"); +/*{ + <%=Util.toLowerCaseFirstLetter(entityName)%>.put("<%=fieldName%>", _<%=relFieldName%>); +}*/ + } +/*{ + } + return; + } +}*/ + }else{ + // TODO : methode get add remove for item of the list + } + } else { // it's a standard attribute + String attOfbizJavaType = Util.getOfbizJavaType(attribute); +/*{ + + public <%=attOfbizJavaType%> get<%=Util.toUpperCaseFirstLetter(attribute.getName() )%>(){ + if (exist() ) return (<%=attOfbizJavaType%>) <%=Util.toLowerCaseFirstLetter(entityName)%>.get("<%=attribute.getName()%>"); + return null; + } + + public void set<%=Util.toUpperCaseFirstLetter(attribute.getName() )%>(<%=attOfbizJavaType%> _<%=attribute.getName()%> ){ + if (exist() ) <%=Util.toLowerCaseFirstLetter(entityName)%>.put("<%=attribute.getName()%>", _<%=attribute.getName()%>); + return; + } +}*/ + } + } + } +/*{ + public boolean store(){ + if (exist() ){ + try { + if (alreadyPersistant) <%=Util.toLowerCaseFirstLetter(entityName)%>.store(); + else <%=Util.toLowerCaseFirstLetter(entityName)%>.create(); + return true; + } catch (GenericEntityException e) { + Debug.logError("create or strore in <%=entityName%> :" + e.getMessage(), module); + } + } + return false; + } +}*/ + } +} Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditFtl.java diff -u /dev/null ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditFtl.java:1.1 --- /dev/null Wed Jun 2 00:09:31 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorEditFtl.java Wed Jun 2 00:09:26 2004 @@ -0,0 +1,98 @@ +package org.nereide.ofbiz.neogia.generators; + +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModelClass; + +public class GeneratorEditFtl extends ObjectModelGenerator { + + + public String getFilenameForClass(ObjectModelClass clazz){ + Map nameMap = Util.initPackageName(clazz); + return ((String)nameMap.get("packageName"))+"/webapp/"+((String)nameMap.get("packageName"))+"/"+((String)nameMap.get("subpackageName"))+"/Edit"+clazz.getName()+".ftl"; + } + + public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { + if(! Util.isEntity(clazz)) return; + boolean guiListAll = Util.hasGuiListAll(clazz); + if (! Util.hasGuiList(clazz) && ! guiListAll ) return; + Map nameMap = Util.initPackageName(clazz); + String packageName= Util.toUpperCaseFirstLetter((String) nameMap.get("packageName") ); + List listPrimaryKeyName = new ArrayList(), listPrimaryKeyType = new ArrayList(); + Util.getListPrimaryKeyAttr(model, clazz, listPrimaryKeyName, listPrimaryKeyType); + String primaryKeys = ""; + for(int j=0; j +<#assign uiLabelMap = requestAttributes.uiLabelMap> +${pages.get(page.getProperty("subMenu"))} + +<#if hasCreatePermission> + + <#-- TODO : Add a select field to choose the instance of the entity the user want to edit --> + + +<#if hasPermission> + <#if actionForm?has_content > + + + +
+ + + <#if actionForm=="add"> + + <#elseif actionForm=="edit"> + + <#else> + + + +
${uiLabelMap.<%=packageName%><%=clazz.getName()%>Creation}
${uiLabelMap.CommonEdit} ${uiLabelMap.<%=packageName%><%=clazz.getName()%>Id} : <%=primaryKeys%>
${uiLabelMap.CommonShow} ${uiLabelMap.<%=packageName%><%=clazz.getName()%>Id} : <%=primaryKeys%>
+
+ ${singleWrapper.renderFormString()} +
+ +<#else> +

${uiLabelMap.CommonPermissionError}

+ + + }*/ + } +} + + Index: ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorPagedefsEditXml.java diff -u /dev/null ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorPagedefsEditXml.java:1.1 --- /dev/null Wed Jun 2 00:09:31 2004 +++ ofbiz-neogia-generators/src/java/org/nereide/ofbiz/neogia/generators/GeneratorPagedefsEditXml.java Wed Jun 2 00:09:26 2004 @@ -0,0 +1,47 @@ +package org.nereide.ofbiz.neogia.generators; + +import java.io.IOException; +import java.io.Writer; +import java.util.Map; + +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModelClass; + +public class GeneratorPagedefsEditXml extends ObjectModelGenerator { + + public String getFilenameForClass(ObjectModelClass clazz){ + Map nameMap = Util.initPackageName(clazz); + return ((String)nameMap.get("packageName"))+"/webapp/"+((String)nameMap.get("packageName"))+"/WEB-INF/pagedefs/"+((String)nameMap.get("subpackageName"))+"/Edit"+clazz.getName()+"G.xml"; + } + + public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException { + if(! Util.isEntity(clazz)) return; + if(! Util.hasGuiEdit(clazz) ) return; + Map nameMap = Util.initPackageName(clazz); + String packageName =Util.toUpperCaseFirstLetter((String) nameMap.get("packageName")); + String subpackageName=(String) nameMap.get("subpackageName"); + + +/*{ + + + + <%=packageName%>Edit<%=clazz.getName()%> + /<%=subpackageName%>/Forms<%=clazz.getName()%>.xml + edit<%=clazz.getName()%> + <%=subpackageName%> + /<%=subpackageName%>/TabBarSubMenu.ftl + edit + <%=clazz.getName()%> + <%=packageName.toUpperCase()%> + _UPDATE + simple + + + + +}*/ + } +} + +