You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(11) |
Oct
(10) |
Nov
(3) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(44) |
Feb
(30) |
Mar
(11) |
Apr
(43) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(9) |
Oct
|
Nov
(1) |
Dec
(1) |
2008 |
Jan
(1) |
Feb
|
Mar
|
Apr
(17) |
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <rfl...@us...> - 2008-09-08 07:58:45
|
Revision: 339 http://salto-db.svn.sourceforge.net/salto-db/?rev=339&view=rev Author: rflament Date: 2008-09-08 07:58:42 +0000 (Mon, 08 Sep 2008) Log Message: ----------- DB2 dialect Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java 2008-05-16 09:24:40 UTC (rev 338) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/HibernateDialectHelper.java 2008-09-08 07:58:42 UTC (rev 339) @@ -18,6 +18,7 @@ dialects.put("Microsoft SQL Server", "org.hibernate.dialect.SQLServerDialect"); dialects.put("PostgreSQL", "org.hibernate.dialect.PostgreSQLDialect"); dialects.put("HypersonicSQL", "org.hibernate.dialect.HSQLDialect"); + dialects.put("DB2", "org.hibernate.dialect.DB2390Dialect"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-16 09:24:45
|
Revision: 338 http://salto-db.svn.sourceforge.net/salto-db/?rev=338&view=rev Author: rflament Date: 2008-05-16 02:24:40 -0700 (Fri, 16 May 2008) Log Message: ----------- use datefield for date attributes Modified Paths: -------------- salto-db-generator/trunk/templates/flex/binding.mxml.vm salto-db-generator/trunk/templates/flex/form.mxml.vm Modified: salto-db-generator/trunk/templates/flex/binding.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/binding.mxml.vm 2008-05-14 11:23:37 UTC (rev 337) +++ salto-db-generator/trunk/templates/flex/binding.mxml.vm 2008-05-16 09:24:40 UTC (rev 338) @@ -5,10 +5,14 @@ #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> #else +#if ($col.getNonPrimitifClass() == "Timestamp" || $col.getNonPrimitifClass() == "Date") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selectedDate" destination="obj.${col.javaAttName}" /> +#else <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> #end #end #end +#end #set ($done= "$fks.clear()" ) #set( $primarykeydone = "false" ) #foreach($col in ${jdoInfo.jdoColInfos}) @@ -38,7 +42,11 @@ #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> #else +#if ($col.getNonPrimitifClass() == "Timestamp" || $col.getNonPrimitifClass() == "Date") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selectedDate" destination="obj.${col.javaAttName}" /> +#else <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> #end #end +#end #end \ No newline at end of file Modified: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-05-14 11:23:37 UTC (rev 337) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-05-16 09:24:40 UTC (rev 338) @@ -9,9 +9,13 @@ #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> #else +#if ($col.getNonPrimitifClass() == "Timestamp" || $col.getNonPrimitifClass() == "Date") + <mx:DateField id="${jdoInfo.javaClassName}_$col.javaAttName" formatString="DD/MM/YYYY" enabled="{obj.stateFlagAsString=='I'}" selectedDate="{obj.${col.javaAttName}}" /> +#else <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> #end #end +#end </mx:FormItem> #end @@ -55,9 +59,13 @@ #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}"/> #else +#if ($col.getNonPrimitifClass() == "Timestamp" || $col.getNonPrimitifClass() == "Date") + <mx:DateField id="${jdoInfo.javaClassName}_$col.javaAttName" selectedDate="{obj.${col.javaAttName}}" formatString="DD/MM/YYYY"/> +#else <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}"/> #end #end +#end </mx:FormItem> #end <mx:Button label="{obj.stateFlagAsString=='I'?'Save':'Update'}" click="handleSaveOrUpdateButtonClick(event)"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-14 11:23:40
|
Revision: 337 http://salto-db.svn.sourceforge.net/salto-db/?rev=337&view=rev Author: rflament Date: 2008-05-14 04:23:37 -0700 (Wed, 14 May 2008) Log Message: ----------- Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/Constants.java salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java salto-db-generator/trunk/src/site/apt/tutorials/customplugin.apt Modified: salto-db-generator/trunk/src/com/salto/db/generator/Constants.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/Constants.java 2008-05-06 15:50:47 UTC (rev 336) +++ salto-db-generator/trunk/src/com/salto/db/generator/Constants.java 2008-05-14 11:23:37 UTC (rev 337) @@ -10,7 +10,7 @@ } - public static final String VERSION = "v1.0.16"; + public static final String VERSION = "v1.1"; public static final String GENERATOR_NAME = "Salto-db Generator " + Constants.VERSION; } Modified: salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java 2008-05-06 15:50:47 UTC (rev 336) +++ salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java 2008-05-14 11:23:37 UTC (rev 337) @@ -284,6 +284,7 @@ TableColInfo[] colInfos = DatabaseInfo.getColumns(tableInfo); if (colInfos != null) { tableInfo.setColInfos(colInfos); + JdoInfo jdoInfo = new JdoInfo(tableInfo); JdoColInfo[] infos = new JdoColInfo[colInfos.length]; for (int i = 0; i < colInfos.length; i++) { Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-05-06 15:50:47 UTC (rev 336) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-05-14 11:23:37 UTC (rev 337) @@ -36,8 +36,6 @@ // TODO : hash global public JdoInfo getJdoInfoByTableName(String tableName) { - System.out.println("------------------------------------------------------"); - System.out.println(tableName); HashMap map = new HashMap(); for (int i = 0; i < context.length; i++) { @@ -214,7 +212,6 @@ ArrayList l = new ArrayList(); for (int i = 0; i < jdoColInfos.length; i++) { - System.out.println("col " + jdoColInfos[i].getColName()); if (!jdoColInfos[i].getColName().endsWith("1")) l.add(jdoColInfos[i]); } Modified: salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java 2008-05-06 15:50:47 UTC (rev 336) +++ salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java 2008-05-14 11:23:37 UTC (rev 337) @@ -922,7 +922,6 @@ ArrayList list = new ArrayList(); TableInfo tableInfo; while (rs.next()) { - if (!rs.getString(3).endsWith("1") && !rs.getString(3).startsWith("s5") && !rs.getString(3).startsWith("a5") && !rs.getString(3).startsWith("dc") && !rs.getString(3).startsWith("g")) { tableInfo = new TableInfo(); tableInfo.setConn(conn); tableInfo.setTableCat(rs.getString(1)); @@ -931,7 +930,6 @@ tableInfo.setTableType(rs.getString(4)); tableInfo.setTableRemarks(rs.getString(5)); list.add(tableInfo); - } } return (TableInfo[]) list.toArray(new TableInfo[list.size()]); } catch (SQLException e) { Modified: salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java 2008-05-06 15:50:47 UTC (rev 336) +++ salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java 2008-05-14 11:23:37 UTC (rev 337) @@ -125,6 +125,7 @@ pk = tableInfo.pk; importedFk = tableInfo.importedFk; exportedFk = tableInfo.exportedFk; + this.conn = tableInfo.conn; } Modified: salto-db-generator/trunk/src/site/apt/tutorials/customplugin.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/tutorials/customplugin.apt 2008-05-06 15:50:47 UTC (rev 336) +++ salto-db-generator/trunk/src/site/apt/tutorials/customplugin.apt 2008-05-14 11:23:37 UTC (rev 337) @@ -1,7 +1,7 @@ --- How to write a custom plugin for Salto-db Generator --- - R\xE9mi Flament + Rémi Flament --- --- @@ -118,6 +118,10 @@ salto-db-generate task : +------------------------------------------------------------------+ + +<taskdef name="salto-db-generate" classname="com.salto.db.ant.DOGeneratorTask" classpathref="lib.path" loaderref="lib.path.loader" /> +<taskdef name="salto-db-register" classname="com.salto.db.ant.RegisterPluginTask" classpathref="lib.path" loaderref="lib.path.loader" /> + <salto-db-register className="com.test.MyPlugin"/> <salto-db-generate nameOffset="0" generateView="${generateView}" plugin="myPlugin" schema="${schema}" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-06 15:51:02
|
Revision: 336 http://salto-db.svn.sourceforge.net/salto-db/?rev=336&view=rev Author: rflament Date: 2008-05-06 08:50:47 -0700 (Tue, 06 May 2008) Log Message: ----------- log that the plugin has been registered Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/RegisterPluginTask.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/RegisterPluginTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/RegisterPluginTask.java 2008-05-05 06:56:45 UTC (rev 335) +++ salto-db-generator/trunk/src/com/salto/db/ant/RegisterPluginTask.java 2008-05-06 15:50:47 UTC (rev 336) @@ -1,7 +1,6 @@ package com.salto.db.ant; import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import com.salto.db.generator.plugin.IGeneratorPlugin; @@ -27,15 +26,15 @@ public void execute() throws BuildException { log("Registering plugin from classname '" + className + "'"); - + try { Class c = Class.forName(className); IGeneratorPlugin plugin = (IGeneratorPlugin) c.newInstance(); Plugins.getInstance().addPlugin(plugin); + log("Plugin '" + plugin.getName() + "' successfully registered !"); } catch (ClassNotFoundException e) { - throw new BuildException("cannot find class '" + className - + "' in classpath", e); + throw new BuildException("cannot find class '" + className + "' in classpath", e); } catch (Exception e) { throw new BuildException(e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-05 06:56:47
|
Revision: 335 http://salto-db.svn.sourceforge.net/salto-db/?rev=335&view=rev Author: rflament Date: 2008-05-04 23:56:45 -0700 (Sun, 04 May 2008) Log Message: ----------- new methods to simplify template development Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-05-05 06:55:45 UTC (rev 334) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-05-05 06:56:45 UTC (rev 335) @@ -103,8 +103,8 @@ Set set = new HashSet(); for (int k = 0; k < tableNames.length; k++) { - TableInfo[] tableInfos = DatabaseInfo.getTables(defaultConn, null, schema, tableNames[k]); - log(tableInfos.length + " database object(s) found for table name '" + tableNames[k] + "'"); + TableInfo[] tableInfos = DatabaseInfo.getTables(defaultConn, null, schema, tableNames[k].trim()); + log(tableInfos.length + " database object(s) found for table name '" + tableNames[k].trim() + "'"); set.addAll(Arrays.asList(tableInfos)); } Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-05-05 06:55:45 UTC (rev 334) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-05-05 06:56:45 UTC (rev 335) @@ -87,7 +87,6 @@ boolean basic = true; if (this.getPk() != null) { - System.out.println(getPk()); for (int j = 0; j < this.getPk().length && basic; j++) { if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { @@ -98,7 +97,6 @@ } if (!basic) { - System.out.println(jdoColInfos[i].getColName() + " is a pk"); list.add(jdoColInfos[i]); } } @@ -174,7 +172,32 @@ return (JdoColInfo[]) list.toArray(new JdoColInfo[list.size()]); } + + public JdoColInfo[] getFKColInfos() { + ArrayList list = new ArrayList(); + for (int i = 0; i < jdoColInfos.length; i++) { + boolean basic = true; + + for (int j = 0; j < this.getImportedFk().length && basic; j++) { + TableFK[] fks = this.getImportedFk()[j]; + + for (int k = 0; k < fks.length; k++) { + if (fks[k].getFkColumnName().equals(jdoColInfos[i].getColName())) { + basic = false; + } + } + + } + + if (!basic) { + list.add(jdoColInfos[i]); + } + } + + return (JdoColInfo[]) list.toArray(new JdoColInfo[list.size()]); + } + /** * @return Returns the jdoColInfos. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-05 06:55:46
|
Revision: 334 http://salto-db.svn.sourceforge.net/salto-db/?rev=334&view=rev Author: rflament Date: 2008-05-04 23:55:45 -0700 (Sun, 04 May 2008) Log Message: ----------- association mapping for insert and update Modified Paths: -------------- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm Modified: salto-db-generator/trunk/templates/ibatis/mapping.xml.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-05-05 06:54:55 UTC (rev 333) +++ salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-05-05 06:55:45 UTC (rev 334) @@ -74,13 +74,43 @@ <insert id="insert${jdoInfo.javaClassName}" parameterClass="${jdoInfo.javaClassName}"> insert into ${jdoInfo.tableName} ( -#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($f = "true") +#foreach($col in ${jdoInfo.getNonFKColInfos()}) +#set ($f = "false") #if ($velocityCount > 0),#end$col.colName +#end +#foreach($col in ${jdoInfo.getFKColInfos()}) + #if ($f == "false"),#end$col.colName #end ) values ( -#foreach($col in ${jdoInfo.jdoColInfos}) +#set ($f = "true") +#foreach($col in ${jdoInfo.getNonFKColInfos()}) +#set ($f = "false") #if ($velocityCount > 0),#end#$col.javaAttName# -#end +#end +#set ($done= "$fks.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + #if ($f == "false"),#end#${col.javaAttName}.$jdoInfo.getJdoInfoByTableName($colfk2.getPkTableName()).getJdoColInfoByName($colfk2.pkColumnName).javaAttName# +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) +#set ($f = "true") ) </insert> @@ -89,8 +119,31 @@ ${jdoInfo.tableName} set #foreach($col in ${jdoInfo.getBasicColInfos()}) +#set ($f = "false") #if ($velocityCount > 0), #end$col.colName = #$col.javaAttName# #end +#set ($done= "$fks.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + #if ($f == "false"),#end$col.colName = #${col.javaAttName}.$jdoInfo.getJdoInfoByTableName($colfk2.getPkTableName()).getJdoColInfoByName($colfk2.pkColumnName).javaAttName# +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) where #foreach($col in ${jdoInfo.jdoColInfos}) #foreach($colpk in ${jdoInfo.getPk()}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-05 06:54:57
|
Revision: 333 http://salto-db.svn.sourceforge.net/salto-db/?rev=333&view=rev Author: rflament Date: 2008-05-04 23:54:55 -0700 (Sun, 04 May 2008) Log Message: ----------- filters Modified Paths: -------------- salto-db-generator/trunk/templates/flex/asscript.mxml.vm salto-db-generator/trunk/templates/flex/binding.mxml.vm salto-db-generator/trunk/templates/flex/form.mxml.vm Modified: salto-db-generator/trunk/templates/flex/asscript.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-05-04 12:11:33 UTC (rev 332) +++ salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-05-05 06:54:55 UTC (rev 333) @@ -69,6 +69,7 @@ private function findAll${jdoInfo.javaClassName}Callback(event:Event):void { ${jdoInfo.javaClassName}s = event.target.lastResult as ArrayCollection; ${jdoInfo.javaClassName}s.filterFunction = processFilter; + ${jdoInfo.javaClassName}s.refresh(); } #set ($done= "$fks.clear()" ) @@ -132,9 +133,8 @@ public function processFilter(item:${jdoInfo.javaClassName}):Boolean { #foreach($col in ${jdoInfo.jdoColInfos}) - if (filter${col.javaAttName}.text.length && item.${col.javaAttName}.toUpperCase().indexOf(filter${col.javaAttName}.text.toUpperCase()) < 0) + if (filter${col.javaAttName}.text.length && item.${col.javaAttName}.toString().toUpperCase().indexOf(filter${col.javaAttName}.text.toUpperCase()) < 0) return false; - #end return true; Modified: salto-db-generator/trunk/templates/flex/binding.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/binding.mxml.vm 2008-05-04 12:11:33 UTC (rev 332) +++ salto-db-generator/trunk/templates/flex/binding.mxml.vm 2008-05-05 06:54:55 UTC (rev 333) @@ -1,11 +1,11 @@ #foreach($col in ${jdoInfo.getPKColInfos()}) #if ($col.getNonPrimitifClass() == "Boolean") - <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> #else #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") - <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> #else - <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> #end #end #end Modified: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-05-04 12:11:33 UTC (rev 332) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-05-05 06:54:55 UTC (rev 333) @@ -67,7 +67,8 @@ #parse("${templatePath}/binding.mxml.vm") <mx:ControlBar width="100%"> -#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($col in ${jdoInfo.jdoColInfos}) + <mx:FormHeading label="$col.javaAttName" /> <mx:TextInput id="filter$col.javaAttName" change="${jdoInfo.javaClassName}s.refresh()" /> #end </mx:ControlBar> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-04 12:11:41
|
Revision: 332 http://salto-db.svn.sourceforge.net/salto-db/?rev=332&view=rev Author: rflament Date: 2008-05-04 05:11:33 -0700 (Sun, 04 May 2008) Log Message: ----------- new methods to simplify template development Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java salto-db-generator/trunk/src/salto/tool/jdo/util/DoJdbcConvert.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-05-04 12:10:55 UTC (rev 331) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-05-04 12:11:33 UTC (rev 332) @@ -70,7 +70,7 @@ public void execute() throws BuildException { - log("Salto-DB ANT Generator - Salto Consulting", Project.MSG_INFO); + log("Salto-DB Generator - Salto Consulting", Project.MSG_INFO); listPlugins(); Connection defaultConn = null; Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java 2008-05-04 12:10:55 UTC (rev 331) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java 2008-05-04 12:11:33 UTC (rev 332) @@ -25,6 +25,7 @@ context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); context.put("date", new Date()); context.put("fks", new HashSet()); + context.put("ros", new HashSet()); info.setJavaPckName(pckName); info.setJavaClassName(className); Modified: salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java 2008-05-04 12:10:55 UTC (rev 331) +++ salto-db-generator/trunk/src/salto/tool/jdo/DataObjectCreate.java 2008-05-04 12:11:33 UTC (rev 332) @@ -22,9 +22,9 @@ import com.salto.db.generator.plugin.Plugins; /** - * Object capable de générer les codes des DataObject et de les réfléchir - * (i.e. extraire et interpréter leurs propriétés) Date de création : - * (7/02/01 17:55:05) + * Object capable de générer les codes des DataObject et de les réfléchir (i.e. + * extraire et interpréter leurs propriétés) Date de création : (7/02/01 + * 17:55:05) * * @author : E.Loiez */ @@ -41,8 +41,8 @@ /** * @exception * @author - * @deprecated Insérez la description de la méthode à cet endroit. Date - * de création : (20/03/01 17:09:16) + * @deprecated Insérez la description de la méthode à cet endroit. Date de + * création : (20/03/01 17:09:16) * @return int * @param sqlTyp * int @@ -151,13 +151,28 @@ return result; } + public static JdoInfo[] followForeignKeys(JdoInfo[] jdoInfos, Integer maxExtendIteration) { + int size = jdoInfos.length; + int previousSize = 0; + int i = 0; + + while (size > previousSize && ((maxExtendIteration != null && i < maxExtendIteration.intValue()) || maxExtendIteration == null)) { + jdoInfos = extend(jdoInfos); + previousSize = size; + size = jdoInfos.length; + i++; + } + + return jdoInfos; + } + /** * TODO : this code is ugly * * @param jdoInfos * @return */ - private JdoInfo[] extend(JdoInfo[] jdoInfos) { + private static JdoInfo[] extend(JdoInfo[] jdoInfos) { Set tablesNames = new HashSet(); Set addedTablesNames = new HashSet(); @@ -221,8 +236,8 @@ } /** - * Méthode permettant de générer les dataobjects Date de création : - * (7/02/01 17:55:57) + * Méthode permettant de générer les dataobjects Date de création : (7/02/01 + * 17:55:57) * * @param compName * java.lang.String le nom du composant @@ -234,17 +249,7 @@ */ public void creerDoSimple(String doPrefix, int defaultNameOffset, String srcPath, String pckName, JdoInfo[] jdoInfos, String pluginName, Integer maxExtendIteration) throws JdoCreateException, IdeException { - int size = jdoInfos.length; - int previousSize = 0; - int i = 0; - - while (size > previousSize && ((maxExtendIteration != null && i < maxExtendIteration.intValue()) || maxExtendIteration == null)) { - jdoInfos = extend(jdoInfos); - previousSize = size; - size = jdoInfos.length; - i++; - } - + jdoInfos = followForeignKeys(jdoInfos, maxExtendIteration); IGeneratorPlugin plugin = null; try { plugin = Plugins.getInstance().getPlugin(pluginName); @@ -253,6 +258,7 @@ for (int j = 0; j < jdoInfos.length; j++) { String doName = CreatorUtil.getDoNameCreator().createDoName(jdoInfos[j].getTableName(), doPrefix, defaultNameOffset); + jdoInfos[j].setContext(jdoInfos); plugin.execute(doName, jdoInfos[j]); } Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-05-04 12:10:55 UTC (rev 331) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-05-04 12:11:33 UTC (rev 332) @@ -1,10 +1,10 @@ package salto.tool.jdo.data; import java.util.ArrayList; +import java.util.HashMap; import salto.tool.jdo.util.DoNameCreator; import salto.tool.jdo.util.IDoNameCreator; -import salto.tool.sql.data.TableColInfo; import salto.tool.sql.data.TableFK; import salto.tool.sql.data.TableInfo; @@ -21,6 +21,8 @@ protected JdoColInfo[] jdoColInfos = null; + protected JdoInfo[] context = null; + // composant cr�ant les noms / ce composant doit �tre param�trable protected static IDoNameCreator nameCreator = new DoNameCreator(); @@ -31,6 +33,20 @@ super(); } + // TODO : hash global + public JdoInfo getJdoInfoByTableName(String tableName) { + + System.out.println("------------------------------------------------------"); + System.out.println(tableName); + HashMap map = new HashMap(); + + for (int i = 0; i < context.length; i++) { + map.put(context[i].getTableName(), context[i]); + } + + return (JdoInfo) map.get(tableName); + } + /** * Commentaire relatif au constructeur JdoInfo. */ @@ -53,6 +69,17 @@ return javaClassName; } + public JdoColInfo getJdoColInfoByName(String colName) { + for (int i = 0; i < jdoColInfos.length; i++) { + + if (colName.equals(jdoColInfos[i].getColName())) { + return jdoColInfos[i]; + } + + } + return null; + } + public JdoColInfo[] getPKColInfos() { ArrayList list = new ArrayList(); @@ -206,4 +233,12 @@ return super.clone(); } + public JdoInfo[] getContext() { + return context; + } + + public void setContext(JdoInfo[] context) { + this.context = context; + } + } Modified: salto-db-generator/trunk/src/salto/tool/jdo/util/DoJdbcConvert.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/util/DoJdbcConvert.java 2008-05-04 12:10:55 UTC (rev 331) +++ salto-db-generator/trunk/src/salto/tool/jdo/util/DoJdbcConvert.java 2008-05-04 12:11:33 UTC (rev 332) @@ -6,121 +6,98 @@ import salto.tool.sql.data.TableColInfo; /** - * Ins�rez la description du type � cet endroit. - * Date de cr�ation : (20/10/01 09:09:16) + * Ins�rez la description du type � cet endroit. Date de cr�ation : (20/10/01 + * 09:09:16) + * * @author : Administrator */ public class DoJdbcConvert implements IJdbcConvert { - -/** - * Commentaire relatif au constructeur DoJdbcConvert. - */ -public DoJdbcConvert() { - super(); -} -/** - * Cette m�thode permet de retourner la fonction du ResultSet qui sera utilis� - pour r�cup�rer les donn�es. - Cette m�thode a un impact sur les performances de la base de donn�e et cela d�pend - de la mani�re dont est cr�� le driver JDBC - Voici quelques informations concernant les diff�rentes fonctions possibles - //non g�r� par les do - Array getArray(int i) throws SQLException; - Ref getRef(int i) throws SQLException; - les fonctions suivantes ne seront � priori jamais g�r� par les do car il est - important de fermer les flux or ceci ne peut pas �tre fait automatiquement. - Ces m�thodes sont donc r�serv�s � du travail d'expertise, l'invers des DO!!!! - java.io.InputStream getAsciiStream(int columnIndex) throws SQLException; - java.io.InputStream getBinaryStream(int columnIndex) - throws SQLException; - java.io.Reader getCharacterStream(int columnIndex) throws SQLException; - java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException; + /** + * Commentaire relatif au constructeur DoJdbcConvert. + */ + public DoJdbcConvert() { + super(); + } - - boolean getBoolean(int columnIndex) throws SQLException; - byte getByte(int columnIndex) throws SQLException; - - //stockage d'objet voir le package - byte[] getBytes(int columnIndex) throws SQLException; - Blob getBlob(int i) throws SQLException; - Clob getClob(int i) throws SQLException; - - //type primitif - Ces m�thodes sont en r�gle g�n�rale les plus performantes - short getShort(int columnIndex) throws SQLException; - int getInt(int columnIndex) throws SQLException; - long getLong(int columnIndex) throws SQLException; - double getDouble(int columnIndex) throws SQLException; - float getFloat(int columnIndex) throws SQLException; - - String getString(int columnIndex) throws SQLException; - - Seul un nombre exceptionnel justifie l'utilisation de ces m�thodes - D'une mani�re g�n�rale, il faut essayer d'�viter ces m�thodes - car - 1 - Ces nombres sont peu pratiques � g�rer pour les d�veloppeurs - 2 - ce n'est pas, en r�gle g�n�ral, les m�thodes les plus performantes pour les drivers - - BigDecimal getBigDecimal(int columnIndex) throws SQLException; - BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException; - - A �viter pour des probl�mes de performance - Cette m�thode est justement cr�� pour �viter l'utilisation de cette M�thode - - Object getObject(int columnIndex) throws SQLException; - - - - Attention aux types Time et Date qui comportent �norm�ment de m�thodes d�pr�ci�s - Il est donc pr�f�rable de g�rer toutes les dates de mani�re uniforme avec le type - Timestamp - - java.sql.Time getTime(int columnIndex) throws SQLException; - java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException; - java.sql.Date getDate(int columnIndex) throws SQLException; - - * Date de cr�ation : (20/10/01 09:10:54) - * @return java.lang.String - * @param attInfo salto.tool.jdo.JdoInfo - */ -public String convert(JdoColInfo attInfo) -{ -/* - BIT = -7; - TINYINT = -6; - SMALLINT = 5; - INTEGER = 4; - BIGINT = -5; - FLOAT = 6; - REAL = 7; - DOUBLE = 8; - NUMERIC = 2; - DECIMAL = 3; - CHAR = 1; - VARCHAR = 12; - LONGVARCHAR = -1; - DATE = 91; - TIME = 92; - TIMESTAMP = 93; - BINARY = -2; - VARBINARY = -3; - LONGVARBINARY = -4; - - NULL = 0; - - OTHER = 1111; - JAVA_OBJECT = 2000; - DISTINCT = 2001; - STRUCT = 2002; - ARRAY = 2003; - BLOB = 2004; - CLOB = 2005; - REF = 2006; - -*/ - String result = null; - switch (attInfo.getColTyp()){ + /** + * Cette m�thode permet de retourner la fonction du ResultSet qui sera + * utilis� pour r�cup�rer les donn�es. Cette m�thode a un impact sur les + * performances de la base de donn�e et cela d�pend de la mani�re dont est + * cr�� le driver JDBC Voici quelques informations concernant les + * diff�rentes fonctions possibles //non g�r� par les do Array getArray(int + * i) throws SQLException; Ref getRef(int i) throws SQLException; + * + * les fonctions suivantes ne seront � priori jamais g�r� par les do car il + * est important de fermer les flux or ceci ne peut pas �tre fait + * automatiquement. Ces m�thodes sont donc r�serv�s � du travail + * d'expertise, l'invers des DO!!!! java.io.InputStream getAsciiStream(int + * columnIndex) throws SQLException; java.io.InputStream getBinaryStream(int + * columnIndex) throws SQLException; java.io.Reader getCharacterStream(int + * columnIndex) throws SQLException; java.io.InputStream + * getUnicodeStream(int columnIndex) throws SQLException; + * + * + * boolean getBoolean(int columnIndex) throws SQLException; byte getByte(int + * columnIndex) throws SQLException; + * + * //stockage d'objet voir le package byte[] getBytes(int columnIndex) + * throws SQLException; Blob getBlob(int i) throws SQLException; Clob + * getClob(int i) throws SQLException; + * + * //type primitif Ces m�thodes sont en r�gle g�n�rale les plus performantes + * short getShort(int columnIndex) throws SQLException; int getInt(int + * columnIndex) throws SQLException; long getLong(int columnIndex) throws + * SQLException; double getDouble(int columnIndex) throws SQLException; + * float getFloat(int columnIndex) throws SQLException; + * + * String getString(int columnIndex) throws SQLException; + * + * Seul un nombre exceptionnel justifie l'utilisation de ces m�thodes D'une + * mani�re g�n�rale, il faut essayer d'�viter ces m�thodes car 1 - Ces + * nombres sont peu pratiques � g�rer pour les d�veloppeurs 2 - ce n'est + * pas, en r�gle g�n�ral, les m�thodes les plus performantes pour les + * drivers + * + * BigDecimal getBigDecimal(int columnIndex) throws SQLException; BigDecimal + * getBigDecimal(int columnIndex, int scale) throws SQLException; + * + * A �viter pour des probl�mes de performance Cette m�thode est justement + * cr�� pour �viter l'utilisation de cette M�thode + * + * Object getObject(int columnIndex) throws SQLException; + * + * + * + * Attention aux types Time et Date qui comportent �norm�ment de m�thodes + * d�pr�ci�s Il est donc pr�f�rable de g�rer toutes les dates de mani�re + * uniforme avec le type Timestamp + * + * java.sql.Time getTime(int columnIndex) throws SQLException; + * java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException; + * java.sql.Date getDate(int columnIndex) throws SQLException; + * + * Date de cr�ation : (20/10/01 09:10:54) + * + * @return java.lang.String + * @param attInfo + * salto.tool.jdo.JdoInfo + */ + public String convert(JdoColInfo attInfo) { + /* + * BIT = -7; TINYINT = -6; SMALLINT = 5; INTEGER = 4; BIGINT = -5; FLOAT = + * 6; REAL = 7; DOUBLE = 8; NUMERIC = 2; DECIMAL = 3; CHAR = 1; VARCHAR = + * 12; LONGVARCHAR = -1; DATE = 91; TIME = 92; TIMESTAMP = 93; BINARY = + * -2; VARBINARY = -3; LONGVARBINARY = -4; + * + * NULL = 0; + * + * OTHER = 1111; JAVA_OBJECT = 2000; DISTINCT = 2001; STRUCT = 2002; + * ARRAY = 2003; BLOB = 2004; CLOB = 2005; REF = 2006; + * + */ + String result = null; + switch (attInfo.getColTyp()) { case Types.TINYINT: result = "Byte"; break; @@ -143,11 +120,16 @@ case Types.DECIMAL: case Types.NUMERIC: if (attInfo.getDecDigit() == 0) { - if (attInfo.getColSize() < 4) result = "Short"; - else if (attInfo.getColSize() < 10) result = "Integer"; - //else if (attInfo.getColSize() < 19) result = "Long"; - else result = "Long"; - + if (attInfo.getColSize() == 1) + result = "Boolean"; + else if (attInfo.getColSize() < 4) + result = "Short"; + else if (attInfo.getColSize() < 10) + result = "Integer"; + // else if (attInfo.getColSize() < 19) result = "Long"; + else + result = "Long"; + } else { result = "Double"; } @@ -171,30 +153,35 @@ case Types.TIMESTAMP: result = "Timestamp"; break; - } - if (result == null) result = "Object"; - if (attInfo.getColNullable() == 0) { - if ("Integer".equals(result)) { - result = "int"; - } else if ("String".equals(result)) { - //ne rien faire - } else { - try { - Class.forName("java.lang."+result); - result = result.toLowerCase(); - } catch (Exception e) {} } + if (result == null) + result = "Object"; + if (attInfo.getColNullable() == 0) { + if ("Integer".equals(result)) { + result = "int"; + } else if ("String".equals(result)) { + // ne rien faire + } else { + try { + Class.forName("java.lang." + result); + result = result.toLowerCase(); + } catch (Exception e) { + } + } + } + return result; } - return result; -} -/* (non-Javadoc) - * @see salto.tool.jdo.util.IJdbcConvert#getJavaPossTyp(salto.tool.sql.data.TableColInfo) - */ -public String[] getJavaPossTyp(TableColInfo attInfo) { - switch (attInfo.getColTyp()) { - case Types.TINYINT : - case Types.SMALLINT : - case Types.INTEGER : + + /* + * (non-Javadoc) + * + * @see salto.tool.jdo.util.IJdbcConvert#getJavaPossTyp(salto.tool.sql.data.TableColInfo) + */ + public String[] getJavaPossTyp(TableColInfo attInfo) { + switch (attInfo.getColTyp()) { + case Types.TINYINT: + case Types.SMALLINT: + case Types.INTEGER: case Types.BIGINT: case Types.REAL: case Types.FLOAT: @@ -203,34 +190,34 @@ case Types.NUMERIC: case Types.BIT: if (booleanValue(attInfo.getColIsNullable())) { - return new String[] {"byte","short","int","long","float","double","BigDecimal","boolean","String"}; + return new String[] { "byte", "short", "int", "long", "float", "double", "BigDecimal", "boolean", "String" }; } else { - return new String[] {"Byte","Short","Integer","Long","Float","Double","BigDecimal","Boolean","String"}; + return new String[] { "Byte", "Short", "Integer", "Long", "Float", "Double", "BigDecimal", "Boolean", "String" }; } case Types.CHAR: - case Types.VARCHAR : - case Types.LONGVARCHAR : + case Types.VARCHAR: + case Types.LONGVARCHAR: if (booleanValue(attInfo.getColIsNullable())) { - return new String[] {"byte","short","int","long","float","double","BigDecimal","boolean","String","Timestamp"}; + return new String[] { "byte", "short", "int", "long", "float", "double", "BigDecimal", "boolean", "String", "Timestamp" }; } else { - return new String[] {"Byte","Short","Integer","Long","Float","Double","BigDecimal","Boolean","String","Timestamp"}; + return new String[] { "Byte", "Short", "Integer", "Long", "Float", "Double", "BigDecimal", "Boolean", "String", "Timestamp" }; } case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: - return new String[] {"String","byte[]"}; + return new String[] { "String", "byte[]" }; case Types.DATE: case Types.TIME: case Types.TIMESTAMP: - return new String[] {"Time","Date","Timestamp"}; + return new String[] { "Time", "Date", "Timestamp" }; + } + return null; } - return null; -} public static boolean booleanValue(String val) { - if (val == null) return false; - if (val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("O") - || val.equalsIgnoreCase("true") || val.equalsIgnoreCase("1")) { + if (val == null) + return false; + if (val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("O") || val.equalsIgnoreCase("true") || val.equalsIgnoreCase("1")) { return true; } return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-04 12:10:56
|
Revision: 331 http://salto-db.svn.sourceforge.net/salto-db/?rev=331&view=rev Author: rflament Date: 2008-05-04 05:10:55 -0700 (Sun, 04 May 2008) Log Message: ----------- filters on datagrids Modified Paths: -------------- salto-db-generator/trunk/templates/flex/asobject.as.vm salto-db-generator/trunk/templates/flex/asscript.mxml.vm salto-db-generator/trunk/templates/flex/form.mxml.vm salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm Added Paths: ----------- salto-db-generator/trunk/templates/flex/binding.mxml.vm Modified: salto-db-generator/trunk/templates/flex/asobject.as.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asobject.as.vm 2008-05-04 12:10:29 UTC (rev 330) +++ salto-db-generator/trunk/templates/flex/asobject.as.vm 2008-05-04 12:10:55 UTC (rev 331) @@ -31,8 +31,13 @@ public var $col.javaAttName:Number; #else +#if ($col.getNonPrimitifClass() == "Timestamp" || $col.getNonPrimitifClass() == "Date") + public var $col.javaAttName:Date; + +#else public var $col.javaAttName:$col.getNonPrimitifClass(); +#end #end #end #end @@ -42,6 +47,18 @@ * Pure actionscript attribute to manage the state */ public var stateFlagAsString:String = "I"; + + public function get asString():String { + var s:String = "${jdoInfo.javaClassName} - "; +#foreach($col in ${jdoInfo.getPKColInfos()}) + s += "$col.javaAttName = " + $col.javaAttName; +#end + return s; + } + + public function toString():String { + return asString; + } } } \ No newline at end of file Modified: salto-db-generator/trunk/templates/flex/asscript.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-05-04 12:10:29 UTC (rev 330) +++ salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-05-04 12:10:55 UTC (rev 331) @@ -68,6 +68,7 @@ private function findAll${jdoInfo.javaClassName}Callback(event:Event):void { ${jdoInfo.javaClassName}s = event.target.lastResult as ArrayCollection; + ${jdoInfo.javaClassName}s.filterFunction = processFilter; } #set ($done= "$fks.clear()" ) @@ -126,6 +127,18 @@ obj = new ${jdoInfo.javaClassName}; } + + + public function processFilter(item:${jdoInfo.javaClassName}):Boolean { + +#foreach($col in ${jdoInfo.jdoColInfos}) + if (filter${col.javaAttName}.text.length && item.${col.javaAttName}.toUpperCase().indexOf(filter${col.javaAttName}.text.toUpperCase()) < 0) + return false; + +#end + + return true; + } ]]> </mx:Script> \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/binding.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/binding.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/binding.mxml.vm 2008-05-04 12:10:55 UTC (rev 331) @@ -0,0 +1,44 @@ +#foreach($col in ${jdoInfo.getPKColInfos()}) +#if ($col.getNonPrimitifClass() == "Boolean") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> +#else +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> +#else + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> +#end +#end +#end +#set ($done= "$fks.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selectedItem as $util.DoNameCreator.createDoName($colfk2.getPkTableName())" destination="obj.${col.javaAttName}" /> +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) +#foreach($col in ${jdoInfo.getBasicColInfos()}) +#if ($col.getNonPrimitifClass() == "Boolean") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> +#else +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> +#else + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> +#end +#end +#end \ No newline at end of file Modified: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-05-04 12:10:29 UTC (rev 330) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-05-04 12:10:55 UTC (rev 331) @@ -14,6 +14,38 @@ #end </mx:FormItem> #end + + +#set ($done= "$fks.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + <mx:FormItem> + <mx:FormHeading label="$col.javaAttName" /> + <mx:ComboBox id="${jdoInfo.javaClassName}_$col.javaAttName" dataProvider="{$util.DoNameCreator.createDoName($colfk2.getPkTableName())s}"/> + </mx:FormItem> +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) + + + + + #foreach($col in ${jdoInfo.getBasicColInfos()}) <mx:FormItem> <mx:FormHeading label="$col.javaAttName" /> @@ -31,15 +63,13 @@ <mx:Button label="{obj.stateFlagAsString=='I'?'Save':'Update'}" click="handleSaveOrUpdateButtonClick(event)"/> </mx:Form> -#foreach($col in ${jdoInfo.jdoColInfos}) -#if ($col.getNonPrimitifClass() == "Boolean") - <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> -#else -#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") - <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> -#else - <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> -#end + +#parse("${templatePath}/binding.mxml.vm") + + <mx:ControlBar width="100%"> +#foreach($col in ${jdoInfo.jdoColInfos}) + <mx:TextInput id="filter$col.javaAttName" change="${jdoInfo.javaClassName}s.refresh()" /> #end -#end + </mx:ControlBar> + \ No newline at end of file Modified: salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm 2008-05-04 12:10:29 UTC (rev 330) +++ salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm 2008-05-04 12:10:55 UTC (rev 331) @@ -16,7 +16,7 @@ #set ($done= "$fks.add($colfk2.fkName)" ) #set ($rodone= "$ros.add($util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName())))" ) #if ($done=="true" && $rodone=="true") - <mx:RemoteObject id="$util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))DAO" destination="$util.DoNameCreator.createDoName($colfk2.getPkTableName())DAO"> + <mx:RemoteObject id="$util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))DAO" destination="$util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))DAO"> <mx:method name="findAll" result="findAll$util.DoNameCreator.createDoName($colfk2.getPkTableName())Callback(event)" /> </mx:RemoteObject> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-05-04 12:10:32
|
Revision: 330 http://salto-db.svn.sourceforge.net/salto-db/?rev=330&view=rev Author: rflament Date: 2008-05-04 05:10:29 -0700 (Sun, 04 May 2008) Log Message: ----------- associations Modified Paths: -------------- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm Modified: salto-db-generator/trunk/templates/ibatis/mapping.xml.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-04-30 15:50:39 UTC (rev 329) +++ salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-05-04 12:10:29 UTC (rev 330) @@ -51,7 +51,7 @@ #if ($bdone=="false") #set ($done= "$fks.add($colfk2.fkName)" ) #if ($done=="true") - <result property="$col.javaAttName" resultMap="Basic$util.DoNameCreator.createDoName($colfk2.getPkTableName())"/> + <result property="${col.javaAttName}.$jdoInfo.getJdoInfoByTableName($colfk2.getPkTableName()).getJdoColInfoByName($colfk2.pkColumnName).javaAttName" column="${jdoInfo.tableName}_$col.colName"/> #end #set( $done = "true" ) #end @@ -62,8 +62,8 @@ #end #set ($done= "$fks.clear()" ) </resultMap> + - <select id="findAll${jdoInfo.javaClassName}" resultMap="${jdoInfo.javaClassName}"> select #foreach($col in ${jdoInfo.jdoColInfos}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-30 15:50:41
|
Revision: 329 http://salto-db.svn.sourceforge.net/salto-db/?rev=329&view=rev Author: rflament Date: 2008-04-30 08:50:39 -0700 (Wed, 30 Apr 2008) Log Message: ----------- add needed remote objects and load needed referentials Modified Paths: -------------- salto-db-generator/trunk/templates/flex/asobject.as.vm salto-db-generator/trunk/templates/flex/asscript.mxml.vm salto-db-generator/trunk/templates/flex/form.mxml.vm salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm Modified: salto-db-generator/trunk/templates/flex/asobject.as.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asobject.as.vm 2008-04-30 14:42:23 UTC (rev 328) +++ salto-db-generator/trunk/templates/flex/asobject.as.vm 2008-04-30 15:50:39 UTC (rev 329) @@ -17,11 +17,8 @@ #if ($bdone=="false") #set ($done= "$fks.add($colfk2.fkName)" ) #if ($done=="true") - /** - * Attribute ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} - */ - public var ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}:$util.DoNameCreator.createDoName($colfk2.getPkTableName()); - + public var $col.javaAttName:$util.DoNameCreator.createDoName($colfk2.getPkTableName()); + #end #set( $done = "true" ) #end @@ -29,19 +26,16 @@ #end #end #end - #if ($done=="false") - /** - * Attribute $col.javaAttName. - */ -#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") public var $col.javaAttName:Number; + #else public var $col.javaAttName:$col.getNonPrimitifClass(); -#end #end #end +#end #set ($done= "$fks.clear()" ) /** Modified: salto-db-generator/trunk/templates/flex/asscript.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-04-30 14:42:23 UTC (rev 328) +++ salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-04-30 15:50:39 UTC (rev 329) @@ -3,7 +3,7 @@ import mx.collections.ArrayCollection; - import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; + import ${jdoInfo.javaPckName}.pojo.*; [Bindable] private var ${jdoInfo.javaClassName}s:ArrayCollection; @@ -11,14 +11,94 @@ [Bindable] private var obj:${jdoInfo.javaClassName} = new ${jdoInfo.javaClassName}; +#set ($done= "$fks.clear()" ) +#set ($rodone= "$ros.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#set ($rodone= "$ros.add($util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName())))" ) +#if ($done=="true" && $rodone=="true") + [Bindable] + private var $util.DoNameCreator.createDoName($colfk2.getPkTableName())s:ArrayCollection; + +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) + private function doInit(event:Event):void { ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.findAll(); +#set ($done= "$fks.clear()" ) +#set ($rodone= "$ros.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#set ($rodone= "$ros.add($util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName())))" ) +#if ($done=="true" && $rodone=="true") + ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}DAO.findAll(); +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) } private function findAll${jdoInfo.javaClassName}Callback(event:Event):void { ${jdoInfo.javaClassName}s = event.target.lastResult as ArrayCollection; } + +#set ($done= "$fks.clear()" ) +#set ($rodone= "$ros.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#set ($rodone= "$ros.add($util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName())))" ) +#if ($done=="true" && $rodone=="true") + private function findAll$util.DoNameCreator.createDoName($colfk2.getPkTableName())Callback(event:Event):void { + $util.DoNameCreator.createDoName($colfk2.getPkTableName())s = event.target.lastResult as ArrayCollection; + } + +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) + private function save${jdoInfo.javaClassName}():void { ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.save(obj); } Modified: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-30 14:42:23 UTC (rev 328) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-30 15:50:39 UTC (rev 329) @@ -6,7 +6,7 @@ #if ($col.getNonPrimitifClass() == "Boolean") <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" enabled="{obj.stateFlagAsString=='I'}"/> #else -#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> #else <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> @@ -20,7 +20,7 @@ #if ($col.getNonPrimitifClass() == "Boolean") <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" /> #else -#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}"/> #else <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}"/> @@ -35,7 +35,7 @@ #if ($col.getNonPrimitifClass() == "Boolean") <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> #else -#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short" || $col.getNonPrimitifClass() == "Long") <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> #else <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> Modified: salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm 2008-04-30 14:42:23 UTC (rev 328) +++ salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm 2008-04-30 15:50:39 UTC (rev 329) @@ -1,3 +1,31 @@ <mx:RemoteObject id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" destination="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO"> <mx:method name="findAll" result="findAll${jdoInfo.javaClassName}Callback(event)" /> </mx:RemoteObject> + +#set ($done= "$fks.clear()" ) +#set ($rodone= "$ros.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#set ($rodone= "$ros.add($util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName())))" ) +#if ($done=="true" && $rodone=="true") + <mx:RemoteObject id="$util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))DAO" destination="$util.DoNameCreator.createDoName($colfk2.getPkTableName())DAO"> + <mx:method name="findAll" result="findAll$util.DoNameCreator.createDoName($colfk2.getPkTableName())Callback(event)" /> + </mx:RemoteObject> + +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-30 14:42:25
|
Revision: 328 http://salto-db.svn.sourceforge.net/salto-db/?rev=328&view=rev Author: rflament Date: 2008-04-30 07:42:23 -0700 (Wed, 30 Apr 2008) Log Message: ----------- relationships Modified Paths: -------------- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm salto-db-generator/trunk/templates/ibatis/setter.vm salto-db-generator/trunk/templates/ibatis/variable.vm Modified: salto-db-generator/trunk/templates/ibatis/mapping.xml.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-04-30 07:32:35 UTC (rev 327) +++ salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-04-30 14:42:23 UTC (rev 328) @@ -13,12 +13,57 @@ #end <typeAlias alias="${jdoInfo.javaClassName}" type="${jdoInfo.javaPckName}.${jdoInfo.javaClassName}" /> - <resultMap id="${jdoInfo.javaClassName}" class="${jdoInfo.javaClassName}"> -#foreach($col in ${jdoInfo.jdoColInfos}) - <result property="$col.javaAttName" column="${jdoInfo.tableName}_$col.colName"/> + <resultMap id="Basic${jdoInfo.javaClassName}" class="${jdoInfo.javaClassName}"> +#set ($done= "$fks.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#set( $done = "true" ) #end +#end +#end +#end +#end +#if ($done=="false") + <result property="$col.javaAttName" column="${jdoInfo.tableName}_$col.colName"/> +#end +#end +#set ($done= "$fks.clear()" ) + </resultMap> + + <resultMap id="${jdoInfo.javaClassName}" class="${jdoInfo.javaClassName}" extends="Basic${jdoInfo.javaClassName}"> +#set ($done= "$fks.clear()" ) +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + <result property="$col.javaAttName" resultMap="Basic$util.DoNameCreator.createDoName($colfk2.getPkTableName())"/> +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end +#end +#set ($done= "$fks.clear()" ) </resultMap> + <select id="findAll${jdoInfo.javaClassName}" resultMap="${jdoInfo.javaClassName}"> select #foreach($col in ${jdoInfo.jdoColInfos}) Modified: salto-db-generator/trunk/templates/ibatis/setter.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/setter.vm 2008-04-30 07:32:35 UTC (rev 327) +++ salto-db-generator/trunk/templates/ibatis/setter.vm 2008-04-30 14:42:23 UTC (rev 328) @@ -17,17 +17,17 @@ #set ($done= "$fks.add($colfk2.fkName)" ) #if ($done == "true") /** - * get ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} + * get $col.javaAttName */ - public ${util.DoNameCreator.createDoName($colfk2.getPkTableName())} get${util.DoNameCreator.createDoName($colfk2.getPkTableName())}() { - return this.${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}; + public ${util.DoNameCreator.createDoName($colfk2.getPkTableName())} ${col.getterMethod()}() { + return this.$col.javaAttName; } /** - * set ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} + * set $col.javaAttName */ - public void set${util.DoNameCreator.createDoName($colfk2.getPkTableName())}(${util.DoNameCreator.createDoName($colfk2.getPkTableName())} ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}) { - this.${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} = ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}; + public void ${col.setterMethod()}(${util.DoNameCreator.createDoName($colfk2.getPkTableName())} $col.javaAttName) { + this.$col.javaAttName = $col.javaAttName; } #end Modified: salto-db-generator/trunk/templates/ibatis/variable.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/variable.vm 2008-04-30 07:32:35 UTC (rev 327) +++ salto-db-generator/trunk/templates/ibatis/variable.vm 2008-04-30 14:42:23 UTC (rev 328) @@ -12,7 +12,7 @@ /** * Attribute ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} */ - private $util.DoNameCreator.createDoName($colfk2.getPkTableName()) ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}; + private $util.DoNameCreator.createDoName($colfk2.getPkTableName()) $col.javaAttName; #end #set( $done = "true" ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-30 07:32:42
|
Revision: 327 http://salto-db.svn.sourceforge.net/salto-db/?rev=327&view=rev Author: rflament Date: 2008-04-30 00:32:35 -0700 (Wed, 30 Apr 2008) Log Message: ----------- patch from terrence miao : sometimes fileoutputstream is null Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/VelocityAbstractPlugin.java Modified: salto-db-generator/trunk/src/com/salto/db/generator/plugin/VelocityAbstractPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/VelocityAbstractPlugin.java 2008-04-29 17:09:06 UTC (rev 326) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/VelocityAbstractPlugin.java 2008-04-30 07:32:35 UTC (rev 327) @@ -74,7 +74,8 @@ } catch (IOException e1) { } try { - fileOutputStream.close(); + if (fileOutputStream != null) + fileOutputStream.close(); } catch (IOException e1) { } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-29 17:09:11
|
Revision: 326 http://salto-db.svn.sourceforge.net/salto-db/?rev=326&view=rev Author: rflament Date: 2008-04-29 10:09:06 -0700 (Tue, 29 Apr 2008) Log Message: ----------- pk list was not initialized Modified Paths: -------------- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java salto-db-generator/trunk/templates/flex/form.mxml.vm Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-04-29 16:45:59 UTC (rev 325) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-04-29 17:09:06 UTC (rev 326) @@ -59,15 +59,19 @@ for (int i = 0; i < jdoColInfos.length; i++) { boolean basic = true; - if (this.pk != null) - for (int j = 0; j < this.pk.length && basic; j++) { + if (this.getPk() != null) { + System.out.println(getPk()); + for (int j = 0; j < this.getPk().length && basic; j++) { + if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { basic = false; } } + } if (!basic) { + System.out.println(jdoColInfos[i].getColName() + " is a pk"); list.add(jdoColInfos[i]); } } @@ -86,8 +90,8 @@ for (int i = 0; i < jdoColInfos.length; i++) { boolean basic = true; - if (this.pk != null) - for (int j = 0; j < this.pk.length && basic; j++) { + if (this.getPk() != null) + for (int j = 0; j < this.getPk().length && basic; j++) { if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { basic = false; } Modified: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-29 16:45:59 UTC (rev 325) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-29 17:09:06 UTC (rev 326) @@ -4,12 +4,12 @@ <mx:FormItem> <mx:FormHeading label="$col.javaAttName" /> #if ($col.getNonPrimitifClass() == "Boolean") - <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" /> + <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" enabled="{obj.stateFlagAsString=='I'}"/> #else #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") - <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}"/> + <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> #else - <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}"/> + <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> #end #end </mx:FormItem> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-29 16:46:03
|
Revision: 325 http://salto-db.svn.sourceforge.net/salto-db/?rev=325&view=rev Author: rflament Date: 2008-04-29 09:45:59 -0700 (Tue, 29 Apr 2008) Log Message: ----------- numeric stepper for number values in the flex application Modified Paths: -------------- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java salto-db-generator/trunk/templates/flex/form.mxml.vm Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-04-29 16:18:07 UTC (rev 324) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-04-29 16:45:59 UTC (rev 325) @@ -53,6 +53,28 @@ return javaClassName; } + public JdoColInfo[] getPKColInfos() { + ArrayList list = new ArrayList(); + + for (int i = 0; i < jdoColInfos.length; i++) { + boolean basic = true; + + if (this.pk != null) + for (int j = 0; j < this.pk.length && basic; j++) { + if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { + basic = false; + } + + } + + if (!basic) { + list.add(jdoColInfos[i]); + } + } + + return (JdoColInfo[]) list.toArray(new JdoColInfo[list.size()]); + } + /** * colinfos that are not pk and not fk * Modified: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-29 16:45:59 UTC (rev 325) @@ -1,13 +1,17 @@ <mx:Form id="${jdoInfo.javaClassName}F" width="100%" label="${jdoInfo.javaClassName}"> <mx:Button label="Create a new ${jdoInfo.javaClassName}" click="obj = new ${jdoInfo.javaClassName};"/> -#foreach($col in ${jdoInfo.getPk()}) +#foreach($col in ${jdoInfo.getPKColInfos()}) <mx:FormItem> <mx:FormHeading label="$col.javaAttName" /> #if ($col.getNonPrimitifClass() == "Boolean") - <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" enabled="{obj.stateFlagAsString=='I'}"/> + <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" /> #else - <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") + <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}"/> +#else + <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}"/> #end +#end </mx:FormItem> #end #foreach($col in ${jdoInfo.getBasicColInfos()}) @@ -16,10 +20,14 @@ #if ($col.getNonPrimitifClass() == "Boolean") <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" /> #else +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") + <mx:NumericStepper id="${jdoInfo.javaClassName}_$col.javaAttName" value="{obj.${col.javaAttName}}"/> +#else <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}"/> #end +#end </mx:FormItem> -#end +#end <mx:Button label="{obj.stateFlagAsString=='I'?'Save':'Update'}" click="handleSaveOrUpdateButtonClick(event)"/> </mx:Form> @@ -28,7 +36,7 @@ <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> #else #if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") - <mx:Binding source="parseInt(${jdoInfo.javaClassName}_${col.javaAttName}.text)" destination="obj.${col.javaAttName}" /> + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.value" destination="obj.${col.javaAttName}" /> #else <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> #end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-29 16:18:25
|
Revision: 324 http://salto-db.svn.sourceforge.net/salto-db/?rev=324&view=rev Author: rflament Date: 2008-04-29 09:18:07 -0700 (Tue, 29 Apr 2008) Log Message: ----------- - dictionnary usable from the ant task - ibatis mapping plugin - spring/ibatis dao plugin - flex application for basic crud operations plugin Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java salto-db-generator/trunk/src/plugins.xml salto-db-generator/trunk/src/salto/tool/jdo/data/JdoColInfo.java salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java salto-db-generator/trunk/src/salto/tool/jdo/util/CreatorUtil.java salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java salto-db-generator/trunk/src/salto/tool/jdo/util/IDoNameCreator.java salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java salto-db-generator/trunk/templates/ejb3/setter.vm Added Paths: ----------- salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/IBatisDAOPlugin.java salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringIBatisDAOPlugin.java salto-db-generator/trunk/src/salto/tool/jdo/util/DicoNameCreator.java salto-db-generator/trunk/templates/flex/ salto-db-generator/trunk/templates/flex/asobject.as.vm salto-db-generator/trunk/templates/flex/asscript.mxml.vm salto-db-generator/trunk/templates/flex/datagrid.mxml.vm salto-db-generator/trunk/templates/flex/form.mxml.vm salto-db-generator/trunk/templates/flex/index.mxml.vm salto-db-generator/trunk/templates/flex/menu.xml.vm salto-db-generator/trunk/templates/flex/pipo.as.vm salto-db-generator/trunk/templates/flex/ref.mxml.vm salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm salto-db-generator/trunk/templates/flex/remoting-config.xml.vm salto-db-generator/trunk/templates/ibatis/ salto-db-generator/trunk/templates/ibatis/dataobject.vm salto-db-generator/trunk/templates/ibatis/ibatis.xml.vm salto-db-generator/trunk/templates/ibatis/mapping.xml.vm salto-db-generator/trunk/templates/ibatis/setter.vm salto-db-generator/trunk/templates/ibatis/variable.vm salto-db-generator/trunk/templates/springibatisdao/ salto-db-generator/trunk/templates/springibatisdao/applicationContext-ibatis.xml.vm salto-db-generator/trunk/templates/springibatisdao/applicationContext-resources.xml.vm salto-db-generator/trunk/templates/springibatisdao/dao.vm salto-db-generator/trunk/templates/springibatisdao/genericdao.vm salto-db-generator/trunk/templates/springibatisdao/ibatisdao.vm salto-db-generator/trunk/templates/springibatisdao/springabstractibatisdao.vm Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-04-29 16:18:07 UTC (rev 324) @@ -1,5 +1,6 @@ package com.salto.db.ant; +import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; @@ -8,6 +9,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import org.apache.tools.ant.BuildException; @@ -16,6 +18,7 @@ import salto.tool.jdo.DataObjectCreate; import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; import salto.tool.sql.ConnectionInfo; import salto.tool.sql.DatabaseInfo; import salto.tool.sql.data.TableInfo; @@ -33,6 +36,8 @@ */ public class DOGeneratorTask extends Task { + private String mappingFilename; + private String outputDir; private String packageName; @@ -67,6 +72,7 @@ log("Salto-DB ANT Generator - Salto Consulting", Project.MSG_INFO); listPlugins(); + Connection defaultConn = null; String tmpl = DEFAULT_PLUGIN; @@ -77,6 +83,13 @@ try { + if (mappingFilename != null) { + log("Loading mapping file : " + mappingFilename, Project.MSG_INFO); + Properties properties = new Properties(); + properties.load(new FileInputStream(mappingFilename)); + CreatorUtil.getDoNameCreator().setProperties(properties); + } + ConnectionInfo connectionInfo = new ConnectionInfo(driverClassName, jdbcUrl, login, password, schema); Class.forName(driverClassName); @@ -126,7 +139,7 @@ if (tableInfos[j].getTableType() == null) continue; - + if (!tableInfos[j].getTableType().equalsIgnoreCase("VIEW") && !tableInfos[j].getTableType().equalsIgnoreCase("TABLE")) { continue; } @@ -300,4 +313,12 @@ this.maxDepth = maxDepth; } + public String getMappingFilename() { + return mappingFilename; + } + + public void setMappingFilename(String mappingFilename) { + this.mappingFilename = mappingFilename; + } + } Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/FlexCrudPlugin.java 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,70 @@ +package com.salto.db.generator.plugin; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import com.salto.db.generator.Constants; + +import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; + +public class FlexCrudPlugin extends VelocityAbstractPlugin { + + private static final String TEMPLATE_PATH = "flex"; + + public void execute(String className, JdoInfo info) throws Exception { + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfo", info); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); + context.put("date", new Date()); + context.put("fks", new HashSet()); + info.setJavaPckName(pckName); + info.setJavaClassName(className); + + runVelocity(TEMPLATE_PATH, "ref.mxml.vm", srcPath + "/" + pckName.replace('.', '/') + "/", className + "Form.mxml", context); + runVelocity(TEMPLATE_PATH, "asobject.as.vm", srcPath + "/" + pckName.replace('.', '/') + "/pojo/", className + ".as", context); + + } + + public void postExecute(JdoInfo[] infos) throws Exception { + + super.postExecute(infos); + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfos", infos); + context.put("connInfo", infos[0].getConnInfo()); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); + context.put("date", new Date()); + context.put("pckName", pckName); + runVelocity(TEMPLATE_PATH, "pipo.as.vm", srcPath, "Pipo.as", context); + runVelocity(TEMPLATE_PATH, "index.mxml.vm", srcPath, "index.mxml", context); + runVelocity(TEMPLATE_PATH, "remoting-config.xml.vm", srcPath, "remoting-config.xml", context); + } + + public String getLongDescription() { + return "This plugin will generate flex ui for basic crud operations"; + } + + public String getName() { + return "FlexCrud"; + } + + public String getShortDescription() { + return "Flex UI"; + } + + public String getDefaultPrefix() { + return ""; + } + +} Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/IBatisDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/IBatisDAOPlugin.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/IBatisDAOPlugin.java 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,72 @@ +package com.salto.db.generator.plugin; + +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import com.salto.db.generator.Constants; + +import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; + +public class IBatisDAOPlugin extends VelocityAbstractPlugin { + + private static final String TEMPLATE_IBATIS = "ibatis"; + + public void execute(String className, JdoInfo info) throws Exception { + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfo", info); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_IBATIS); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); + context.put("date", new Date()); + context.put("fks", new HashSet()); + context.put("annotations", String.valueOf(false)); + info.setJavaPckName(pckName); + info.setJavaClassName(className); + + runVelocity(TEMPLATE_IBATIS, "dataobject.vm", srcPath + "/" + pckName.replace('.', '/') + "/", className + ".java", context); + runVelocity(TEMPLATE_IBATIS, "mapping.xml.vm", srcPath + "/" + "ibatis/", className + ".xml", context); + + + } + + public void postExecute(JdoInfo[] infos) throws Exception { + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfos", infos); + context.put("connInfo", infos[0].getConnInfo()); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_IBATIS); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); + context.put("date", new Date()); + context.put("pckName", pckName); + + + runVelocity(TEMPLATE_IBATIS, "ibatis.xml.vm", srcPath, "ibatis.xml", context); + + } + + public String getLongDescription() { + return "This plugin will generate pojos from database and iBatis mappings"; + } + + public String getName() { + return "iBatis"; + } + + public String getShortDescription() { + return "Pojos and iBatis mappings."; + } + + public String getDefaultPrefix() { + return ""; + } + +} Added: salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringIBatisDAOPlugin.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringIBatisDAOPlugin.java (rev 0) +++ salto-db-generator/trunk/src/com/salto/db/generator/plugin/SpringIBatisDAOPlugin.java 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,89 @@ +package com.salto.db.generator.plugin; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import salto.tool.jdo.data.JdoInfo; +import salto.tool.jdo.util.CreatorUtil; + +import com.salto.db.generator.Constants; + +public class SpringIBatisDAOPlugin extends VelocityAbstractPlugin { + + protected IBatisDAOPlugin ibatisDAOPlugin = null; + + public static final String TEMPLATE_PATH = "springibatisdao"; + + public void execute(String className, JdoInfo info) throws Exception { + + ibatisDAOPlugin.execute(className, info); + + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfo", info); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); + context.put("date", new Date()); + info.setJavaPckName(pckName); + info.setJavaClassName(className); + + runVelocity(TEMPLATE_PATH, "ibatisdao.vm", srcPath + "/" + (pckName + ".dao.ibatis").replace('.', '/') + "/", className + "IBatisDAO.java", context); + + runVelocity(TEMPLATE_PATH, "dao.vm", srcPath + "/" + pckName.replace('.', '/') + "/dao/", className + "DAO.java", context); + +// runVelocity(EJB3AndHibernateDAOPlugin.TEMPLATE_PATH, "dao.vm", srcPath + "/" + pckName.replace('.', '/') + "/", className + "DAO.java", context); + + } + + public String getDefaultPrefix() { + return ""; + } + + public String getLongDescription() { + return "This plugin will generate POJOS, ibatis.xml and Spring DAOs for each class."; + } + + public String getName() { + return "SpringIBatisDao"; + } + + public String getShortDescription() { + return "Pojo + Spring/iBatis DAO"; + } + + public void postExecute(JdoInfo[] infos) throws Exception { + + + ibatisDAOPlugin.postExecute(infos); + CreatorUtil.getDoNameCreator().setPrefix(doPrefix); + CreatorUtil.getDoNameCreator().setDefaultNameOffset(this.defaultNameOffset); + Map context = new HashMap(); + context.put("jdoInfos", infos); + context.put("connInfo", infos[0].getConnInfo()); + context.put("util", CreatorUtil.getInstance()); + context.put("templatePath", TEMPLATE_PATH); + context.put("generatorVersion", Constants.GENERATOR_NAME + " / " + this.getShortDescription()); + context.put("date", new Date()); + context.put("pckName", pckName); + + runVelocity(TEMPLATE_PATH, "springabstractibatisdao.vm", srcPath + "/" + (pckName + ".dao.ibatis").replace('.', '/') + "/", "AbstractIBatisDAO.java", context); + + runVelocity(TEMPLATE_PATH, "genericdao.vm", srcPath + "/" + (pckName + ".dao").replace('.', '/') + "/", "GenericDAO.java", context); + + runVelocity(TEMPLATE_PATH, "applicationContext-resources.xml.vm", srcPath, "applicationContext-resources.xml", context); + runVelocity(TEMPLATE_PATH, "applicationContext-ibatis.xml.vm", srcPath, "applicationContext-ibatis.xml", context); + + } + + public void init(String doPrefix, int defaultNameOffset, String srcPath, String pckName) throws Exception { + super.init(doPrefix, defaultNameOffset, srcPath, pckName); + ibatisDAOPlugin = new IBatisDAOPlugin(); + ibatisDAOPlugin.init(doPrefix, defaultNameOffset, srcPath, pckName + ".pojo"); + } + + + +} Modified: salto-db-generator/trunk/src/plugins.xml =================================================================== --- salto-db-generator/trunk/src/plugins.xml 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/plugins.xml 2008-04-29 16:18:07 UTC (rev 324) @@ -9,5 +9,8 @@ <plugin class="com.salto.db.generator.plugin.PojoHibernateDAOPlugin" /> <plugin class="com.salto.db.generator.plugin.SpringEJB3AndHibernateDAOPlugin" /> <plugin class="com.salto.db.generator.plugin.SpringEJB3AndHibernateDAOAndTestCasesPlugin" /> - <plugin class="com.salto.db.generator.plugin.SpringWebappPlugin" /> + <plugin class="com.salto.db.generator.plugin.SpringWebappPlugin" /> + <plugin class="com.salto.db.generator.plugin.IBatisDAOPlugin" /> + <plugin class="com.salto.db.generator.plugin.FlexCrudPlugin" /> + <plugin class="com.salto.db.generator.plugin.SpringIBatisDAOPlugin" /> </plugins> \ No newline at end of file Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoColInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoColInfo.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoColInfo.java 2008-04-29 16:18:07 UTC (rev 324) @@ -54,7 +54,7 @@ */ public String getJavaAttName() { if (javaAttName == null) - javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(colName); + javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(tableName, colName); return javaAttName; } @@ -65,7 +65,7 @@ */ public String getJavaAttCteName() { if (javaAttCteName == null) - javaAttCteName = CreatorUtil.getDoNameCreator().createJavaCteName(getJavaAttName()); + javaAttCteName = CreatorUtil.getDoNameCreator().createJavaCteName(tableName, getJavaAttName()); return javaAttCteName; } Modified: salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/jdo/data/JdoInfo.java 2008-04-29 16:18:07 UTC (rev 324) @@ -4,6 +4,7 @@ import salto.tool.jdo.util.DoNameCreator; import salto.tool.jdo.util.IDoNameCreator; +import salto.tool.sql.data.TableColInfo; import salto.tool.sql.data.TableFK; import salto.tool.sql.data.TableInfo; @@ -63,24 +64,26 @@ for (int i = 0; i < jdoColInfos.length; i++) { boolean basic = true; - for (int j = 0; j < this.pk.length && basic; j++) { - if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { - basic = false; + if (this.pk != null) + for (int j = 0; j < this.pk.length && basic; j++) { + if (pk[j].getCol().equals(jdoColInfos[i].getColName())) { + basic = false; + } + } - } + if (this.getImportedFk() != null) + for (int j = 0; j < this.getImportedFk().length && basic; j++) { + TableFK[] fks = this.getImportedFk()[j]; - for (int j = 0; j < this.getImportedFk().length && basic; j++) { - TableFK[] fks = this.getImportedFk()[j]; + for (int k = 0; k < fks.length; k++) { + if (fks[k].getFkColumnName().equals(jdoColInfos[i].getColName())) { + basic = false; + } + } - for (int k = 0; k < fks.length; k++) { - if (fks[k].getFkColumnName().equals(jdoColInfos[i].getColName())) { - basic = false; - } } - } - if (basic) { list.add(jdoColInfos[i]); } @@ -132,6 +135,16 @@ */ public void setJdoColInfos(JdoColInfo[] jdoColInfos) { this.jdoColInfos = jdoColInfos; + ArrayList l = new ArrayList(); + + for (int i = 0; i < jdoColInfos.length; i++) { + System.out.println("col " + jdoColInfos[i].getColName()); + if (!jdoColInfos[i].getColName().endsWith("1")) + l.add(jdoColInfos[i]); + } + + jdoColInfos = (JdoColInfo[]) l.toArray(new JdoColInfo[l.size()]); + } /** Modified: salto-db-generator/trunk/src/salto/tool/jdo/util/CreatorUtil.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/util/CreatorUtil.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/jdo/util/CreatorUtil.java 2008-04-29 16:18:07 UTC (rev 324) @@ -14,7 +14,7 @@ * @author e....@sa... */ public class CreatorUtil { - private static IDoNameCreator nameCreator = new DoNameCreator(); + private static IDoNameCreator nameCreator = new DicoNameCreator(); private static IJdbcConvert jdbcConvert = new DoJdbcConvert(); Added: salto-db-generator/trunk/src/salto/tool/jdo/util/DicoNameCreator.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/util/DicoNameCreator.java (rev 0) +++ salto-db-generator/trunk/src/salto/tool/jdo/util/DicoNameCreator.java 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,39 @@ +package salto.tool.jdo.util; + +import java.util.HashSet; +import java.util.Set; + +/** + * + * @author rfl...@la... + * + */ +public class DicoNameCreator extends DoNameCreator { + + private Set<String> notFound = new HashSet<String>(); + + public DicoNameCreator() { + + } + + public String createDoName(String tableName, String prefix, int nameOffset) { + + if (properties == null || properties.getProperty(tableName.toUpperCase()) == null) { + notFound.add(tableName); + return super.createDoName(tableName, prefix, nameOffset); + } else { + return properties.getProperty(tableName.toUpperCase()); + } + } + + public String createJavaAttName(String tableName, String sqlName) { + + if (properties == null || properties.getProperty(tableName.toUpperCase() + "." + sqlName.toUpperCase()) == null) { + notFound.add(tableName.toUpperCase() + "." + sqlName); + return super.createJavaAttName(tableName, sqlName); + } else { + return properties.getProperty(tableName.toUpperCase() + "." + sqlName.toUpperCase()); + } + } + +} Modified: salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/jdo/util/DoNameCreator.java 2008-04-29 16:18:07 UTC (rev 324) @@ -1,9 +1,11 @@ package salto.tool.jdo.util; +import java.util.Properties; + /** - * Interface permettant de cr\xE9er les noms des attributs des composants Plusieurs - * algorithmes sont d\xE9finies \xE0 partir des r\xE8gles de nommage les plus courantes - * des bases de donn\xE9es Date de cr\xE9ation : (20/10/01 05:17:16) + * Interface permettant de cr�er les noms des attributs des composants Plusieurs + * algorithmes sont d�finies � partir des r�gles de nommage les plus courantes + * des bases de donn�es Date de cr�ation : (20/10/01 05:17:16) * * @author : E. Loiez */ @@ -17,6 +19,8 @@ private int defaultNameOffset = DEFAULT_NAME_OFFSET; + protected Properties properties = null; + public int getDefaultNameOffset() { return defaultNameOffset; } @@ -38,15 +42,15 @@ /** * Cr�ation du nom d'une constance � partir du nom d'un attribut - * L'algorithme est bas� sur les r�gles de nommage java: Les constantes - * sont en majuscules Les diff�rents mots sont s�par�s par des '_' - * Date de cr�ation : (7/02/01 17:55:57) + * L'algorithme est bas� sur les r�gles de nommage java: Les constantes sont + * en majuscules Les diff�rents mots sont s�par�s par des '_' Date de + * cr�ation : (7/02/01 17:55:57) * * @param javaName * java.lang.String nom de l'attribut java */ - public String createJavaCteName(String javaName) { + public String createJavaCteName(String tableName, String javaName) { int len = javaName.length(); char[] cteName = new char[len * 2]; int offset = 0; @@ -64,7 +68,7 @@ return new String(cteName, 0, len + offset); } - public String createJavaAttName(String sqlName) { + public String createJavaAttName(String tableName, String sqlName) { if (sqlName.indexOf("_") > 0 || sqlName.toUpperCase().equals(sqlName) || sqlName.toLowerCase().equals(sqlName)) { @@ -126,7 +130,7 @@ * @see salto.tool.jdo.util.IDoNameCreator#dbName2javaCteName(java.lang.String) */ public String dbName2javaCteName(String dbName) { - return createJavaCteName(createJavaAttName(dbName)); + return createJavaCteName("", createJavaAttName("", dbName)); } public String class2attribute(String className) { @@ -144,4 +148,9 @@ return null; return attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1); } + + public void setProperties(Properties prop) { + properties = prop; + + } } \ No newline at end of file Modified: salto-db-generator/trunk/src/salto/tool/jdo/util/IDoNameCreator.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/jdo/util/IDoNameCreator.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/jdo/util/IDoNameCreator.java 2008-04-29 16:18:07 UTC (rev 324) @@ -6,6 +6,8 @@ */ package salto.tool.jdo.util; +import java.util.Properties; + /** * @author Loiez */ @@ -19,10 +21,15 @@ * @param javaName * java.lang.String nom de l'attribut java */ - public abstract String createJavaCteName(String javaName); + // public abstract String createJavaCteName(String javaName); + public void setProperties(Properties prop); - public abstract String createJavaAttName(String sqlName); + public abstract String createJavaCteName(String tableName, String javaName); + // public abstract String createJavaAttName(String sqlName); + + public abstract String createJavaAttName(String tableName, String sqlName); + /** * Retourne le nom d'un do en fonction du nom d'une table * @@ -44,7 +51,7 @@ * @return String */ public abstract String dbName2javaCteName(String dbName); - + public abstract String class2attribute(String className); /** @@ -52,9 +59,9 @@ * @param doPrefix */ public abstract void setPrefix(String doPrefix); - + public int getDefaultNameOffset(); public void setDefaultNameOffset(int defaultNameOffset); - + } \ No newline at end of file Modified: salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/sql/DatabaseInfo.java 2008-04-29 16:18:07 UTC (rev 324) @@ -46,26 +46,21 @@ private static String user = null; - /*static { + /* + * static { + * + * driver = "com.mysql.jdbc.Driver"; url = "jdbc:mysql://localhost/teste"; + * shema = "teste"; try { getConnection(); } catch (Exception e) { + * e.printStackTrace(); } } + */ - driver = "com.mysql.jdbc.Driver"; - url = "jdbc:mysql://localhost/teste"; - shema = "teste"; - try { - getConnection(); - } catch (Exception e) { - e.printStackTrace(); - } - - }*/ - public static void main(String[] args) { try { getConnection(); TableInfo[] infos = getTables(); getColumns(infos[0]); - // infos[0].setConnInfo(connInfo); - getFK(infos[0],IMPORTED_KEY); + // infos[0].setConnInfo(connInfo); + getFK(infos[0], IMPORTED_KEY); } catch (SQLException e) { } catch (DatabaseException e) { } @@ -543,25 +538,27 @@ rs = dbInfo.getExportedKeys(table.getTableCat(), table.getTableShem(), table.getTableName()); String previousTableName = null; while (rs.next()) { - TableFK tbfk = new TableFK(); - tbfk.setPkTableCat(rs.getString(1)); - tbfk.setPkTableShem(rs.getString(2)); - tbfk.setPkTableName(rs.getString(3)); - tbfk.setPkColumnName(rs.getString(4)); - tbfk.setFkTableCat(rs.getString(5)); - tbfk.setFkTableShem(rs.getString(6)); - tbfk.setFkTableName(rs.getString(7)); - tbfk.setFkColumnName(rs.getString(8)); - tbfk.setKeySeq(rs.getShort(9)); - tbfk.setFkName(rs.getString(12)); - if (previousTableName == null) { - previousTableName = tbfk.getFkName(); + if (!(rs.getString(3).endsWith("1") || rs.getString(7).endsWith("1"))) { + TableFK tbfk = new TableFK(); + tbfk.setPkTableCat(rs.getString(1)); + tbfk.setPkTableShem(rs.getString(2)); + tbfk.setPkTableName(rs.getString(3)); + tbfk.setPkColumnName(rs.getString(4)); + tbfk.setFkTableCat(rs.getString(5)); + tbfk.setFkTableShem(rs.getString(6)); + tbfk.setFkTableName(rs.getString(7)); + tbfk.setFkColumnName(rs.getString(8)); + tbfk.setKeySeq(rs.getShort(9)); + tbfk.setFkName(rs.getString(12)); + if (previousTableName == null) { + previousTableName = tbfk.getFkName(); + } + if (previousTableName != null && !previousTableName.equals(tbfk.getFkName())) { + firstDim.add(secondDim.toArray(new TableFK[secondDim.size()])); + secondDim.clear(); + } + secondDim.add(tbfk); } - if (previousTableName != null && !previousTableName.equals(tbfk.getFkName())) { - firstDim.add(secondDim.toArray(new TableFK[secondDim.size()])); - secondDim.clear(); - } - secondDim.add(tbfk); } if (secondDim.size() > 0) firstDim.add(secondDim.toArray(new TableFK[secondDim.size()])); @@ -925,14 +922,16 @@ ArrayList list = new ArrayList(); TableInfo tableInfo; while (rs.next()) { - tableInfo = new TableInfo(); - tableInfo.setConn(conn); - tableInfo.setTableCat(rs.getString(1)); - tableInfo.setTableShem(rs.getString(2)); - tableInfo.setTableName(rs.getString(3)); - tableInfo.setTableType(rs.getString(4)); - tableInfo.setTableRemarks(rs.getString(5)); - list.add(tableInfo); + if (!rs.getString(3).endsWith("1") && !rs.getString(3).startsWith("s5") && !rs.getString(3).startsWith("a5") && !rs.getString(3).startsWith("dc") && !rs.getString(3).startsWith("g")) { + tableInfo = new TableInfo(); + tableInfo.setConn(conn); + tableInfo.setTableCat(rs.getString(1)); + tableInfo.setTableShem(rs.getString(2)); + tableInfo.setTableName(rs.getString(3)); + tableInfo.setTableType(rs.getString(4)); + tableInfo.setTableRemarks(rs.getString(5)); + list.add(tableInfo); + } } return (TableInfo[]) list.toArray(new TableInfo[list.size()]); } catch (SQLException e) { Modified: salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/sql/data/TableFK.java 2008-04-29 16:18:07 UTC (rev 324) @@ -277,7 +277,7 @@ */ public String getPkJavaAttName() { if (javaAttName == null) - javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(pkColumnName); + javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(pkTableName, pkColumnName); return javaAttName; } Modified: salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/sql/data/TableInfo.java 2008-04-29 16:18:07 UTC (rev 324) @@ -328,7 +328,17 @@ * @param infos */ public void setColInfos(TableColInfo[] infos) { - colInfos = infos; + + ArrayList l = new ArrayList(); + + for (int i = 0; i < infos.length; i++) { + System.out.println("col "+infos[i].colName); + if (!infos[i].colName.endsWith("1")) + l.add(infos[i]); + } + + + colInfos = (TableColInfo[]) l.toArray(new TableColInfo[l.size()]); } /** Modified: salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java =================================================================== --- salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/src/salto/tool/sql/data/TablePK.java 2008-04-29 16:18:07 UTC (rev 324) @@ -139,7 +139,7 @@ */ public String getJavaAttName() { if (javaAttName == null) - javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(col); + javaAttName = CreatorUtil.getDoNameCreator().createJavaAttName(table, col); return javaAttName; } } \ No newline at end of file Modified: salto-db-generator/trunk/templates/ejb3/setter.vm =================================================================== --- salto-db-generator/trunk/templates/ejb3/setter.vm 2008-04-27 11:30:51 UTC (rev 323) +++ salto-db-generator/trunk/templates/ejb3/setter.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -61,6 +61,8 @@ #end #end #end +#else + /* liste transiente */ #end #if ($done=="false") #if ($util.getLength($jdoInfo.getPk()) > 1) @@ -172,6 +174,7 @@ * Get the list of $util.DoNameCreator.createDoName($colfk2.getFkTableName()) */ #if ($annotations=="true") + // ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getFkTableName()))}PK @OneToMany(mappedBy="${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($jdoInfo.tableName))}") #end public List<$util.DoNameCreator.createDoName($colfk2.getFkTableName())> get$util.DoNameCreator.createDoName($colfk2.getFkTableName())s() { Added: salto-db-generator/trunk/templates/flex/asobject.as.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asobject.as.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/asobject.as.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,53 @@ +package ${jdoInfo.javaPckName}.pojo +{ + + [Bindable] + [RemoteClass(alias="${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}")] + public class ${jdoInfo.javaClassName} + { + +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + /** + * Attribute ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} + */ + public var ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}:$util.DoNameCreator.createDoName($colfk2.getPkTableName()); + +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end + +#if ($done=="false") + /** + * Attribute $col.javaAttName. + */ +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") + public var $col.javaAttName:Number; +#else + public var $col.javaAttName:$col.getNonPrimitifClass(); +#end + +#end +#end +#set ($done= "$fks.clear()" ) + + /** + * Pure actionscript attribute to manage the state + */ + public var stateFlagAsString:String = "I"; + + } +} \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/asscript.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/asscript.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/asscript.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,51 @@ + <mx:Script> + <![CDATA[ + + import mx.collections.ArrayCollection; + + import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; + + [Bindable] + private var ${jdoInfo.javaClassName}s:ArrayCollection; + + [Bindable] + private var obj:${jdoInfo.javaClassName} = new ${jdoInfo.javaClassName}; + + private function doInit(event:Event):void { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.findAll(); + } + + private function findAll${jdoInfo.javaClassName}Callback(event:Event):void { + ${jdoInfo.javaClassName}s = event.target.lastResult as ArrayCollection; + } + + private function save${jdoInfo.javaClassName}():void { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.save(obj); + } + + private function update${jdoInfo.javaClassName}():void { + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.update(obj); + } + + private function handleDoubleClick(event:Event):void { + var o:${jdoInfo.javaClassName} = (event.target as DataGrid).selectedItem as ${jdoInfo.javaClassName}; + + o.stateFlagAsString = 'U'; + + obj = o; + } + + private function handleSaveOrUpdateButtonClick(event:Event):void { + + if (obj.stateFlagAsString == 'I') + save${jdoInfo.javaClassName}(); + else if (obj.stateFlagAsString == 'U') + update${jdoInfo.javaClassName}(); + + ${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO.findAll(); + + obj = new ${jdoInfo.javaClassName}; + } + + ]]> + </mx:Script> \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/datagrid.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/datagrid.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/datagrid.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,11 @@ + <mx:DataGrid id="${jdoInfo.javaClassName}DG" doubleClickEnabled="true" itemDoubleClick="handleDoubleClick(event)" dragEnabled="false" width="100%" height="100%" dataProvider="{${jdoInfo.javaClassName}s}"> + <mx:columns> +#foreach($col in ${jdoInfo.jdoColInfos}) +#if ($col.getNonPrimitifClass() == "Boolean") + <mx:DataGridColumn headerText="$col.javaAttName" dataField="$col.javaAttName" itemRenderer="mx.controls.CheckBox"/> +#else + <mx:DataGridColumn headerText="$col.javaAttName" dataField="$col.javaAttName" /> +#end +#end + </mx:columns> + </mx:DataGrid> \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/form.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/form.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/form.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,37 @@ + <mx:Form id="${jdoInfo.javaClassName}F" width="100%" label="${jdoInfo.javaClassName}"> + <mx:Button label="Create a new ${jdoInfo.javaClassName}" click="obj = new ${jdoInfo.javaClassName};"/> +#foreach($col in ${jdoInfo.getPk()}) + <mx:FormItem> + <mx:FormHeading label="$col.javaAttName" /> +#if ($col.getNonPrimitifClass() == "Boolean") + <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" enabled="{obj.stateFlagAsString=='I'}"/> +#else + <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}" enabled="{obj.stateFlagAsString=='I'}"/> +#end + </mx:FormItem> +#end +#foreach($col in ${jdoInfo.getBasicColInfos()}) + <mx:FormItem> + <mx:FormHeading label="$col.javaAttName" /> +#if ($col.getNonPrimitifClass() == "Boolean") + <mx:CheckBox id="${jdoInfo.javaClassName}_$col.javaAttName" /> +#else + <mx:TextInput id="${jdoInfo.javaClassName}_$col.javaAttName" text="{obj.${col.javaAttName}}"/> +#end + </mx:FormItem> +#end + <mx:Button label="{obj.stateFlagAsString=='I'?'Save':'Update'}" click="handleSaveOrUpdateButtonClick(event)"/> + </mx:Form> + +#foreach($col in ${jdoInfo.jdoColInfos}) +#if ($col.getNonPrimitifClass() == "Boolean") + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.selected" destination="obj.${col.javaAttName}" /> +#else +#if ($col.getNonPrimitifClass() == "Integer" || $col.getNonPrimitifClass() == "Short") + <mx:Binding source="parseInt(${jdoInfo.javaClassName}_${col.javaAttName}.text)" destination="obj.${col.javaAttName}" /> +#else + <mx:Binding source="${jdoInfo.javaClassName}_${col.javaAttName}.text" destination="obj.${col.javaAttName}" /> +#end +#end +#end + \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/index.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/index.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/index.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" + paddingTop="0" paddingLeft="0" paddingRight="0" + width="100%" height="100%" creationComplete="doInit(event)"> + + <mx:Script> + <![CDATA[ + + import mx.controls.Menu; + import mx.events.MenuEvent; + + private var pipo:Pipo = new Pipo(); + + private function doInit(event:Event):void { + } + + private function itemClickInfo(event:MenuEvent):void { + var comp:String = event.item.@component; + if (event.item.@component != undefined && event.item.@component != null) { + var cls:Class = getDefinitionByName(event.item.@component) as Class; + mainPanel.removeAllChildren(); + mainPanel.addChild(new cls()); + return; + } + } + + ]]> + </mx:Script> + +<mx:MenuBar x="0" color="black" width="100%" labelField="@label" itemClick="itemClickInfo(event)" > + <mx:XMLList> +#parse("${templatePath}/menu.xml.vm") + </mx:XMLList> +</mx:MenuBar> + +<mx:VBox id="mainPanel" width="100%" height="100%"> +</mx:VBox> + +</mx:Application> \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/menu.xml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/menu.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/menu.xml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,7 @@ + <menuitem label="Referentials" > + + #foreach($jdoInfo in ${jdoInfos}) + <menuitem label="${jdoInfo.javaClassName}" component="${pckName}.${jdoInfo.javaClassName}Form"/> + #end + + </menuitem> \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/pipo.as.vm =================================================================== --- salto-db-generator/trunk/templates/flex/pipo.as.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/pipo.as.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,12 @@ +package { + import ${pckName}.*; + + + public class Pipo { + +#foreach($jdoInfo in ${jdoInfos}) + public var ${jdoInfo.javaClassName}F:${jdoInfo.javaClassName}Form = new ${jdoInfo.javaClassName}Form(); +#end + + } +} \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/ref.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/ref.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/ref.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:VBox width="100%" height="100%" xmlns:mx="http://www.adobe.com/2006/mxml" initialize="doInit(event)"> + +<mx:Text width="100%" color="black" fontSize="16"> + <mx:htmlText> + <![CDATA[<B>${jdoInfo.javaClassName} Referential</B>]]> + </mx:htmlText> +</mx:Text> + +#parse("${templatePath}/asscript.mxml.vm") + +#parse("${templatePath}/remoteobject.mxml.vm") + +#parse("${templatePath}/form.mxml.vm") + +#parse("${templatePath}/datagrid.mxml.vm") + + +</mx:VBox> \ No newline at end of file Added: salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/remoteobject.mxml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,3 @@ + <mx:RemoteObject id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" destination="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO"> + <mx:method name="findAll" result="findAll${jdoInfo.javaClassName}Callback(event)" /> + </mx:RemoteObject> Added: salto-db-generator/trunk/templates/flex/remoting-config.xml.vm =================================================================== --- salto-db-generator/trunk/templates/flex/remoting-config.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/flex/remoting-config.xml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<service id="remoting-service" + class="flex.messaging.services.RemotingService" + messageTypes="flex.messaging.messages.RemotingMessage" > + + <adapters> + <adapter-definition id="java-object" + class="flex.messaging.services.remoting.adapters.JavaAdapter" + default="true" /> + </adapters> + + <default-channels> + <channel ref="my-amf" /> + </default-channels> + +#foreach($jdoInfo in ${jdoInfos}) + <destination id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO"> + <properties> + <factory>spring</factory> + <source>${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO</source> + </properties> + </destination> +#end + +</service> \ No newline at end of file Added: salto-db-generator/trunk/templates/ibatis/dataobject.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/dataobject.vm (rev 0) +++ salto-db-generator/trunk/templates/ibatis/dataobject.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,28 @@ +package ${jdoInfo.javaPckName}; + +import java.util.List; +import java.io.Serializable; +import java.sql.Timestamp; + +/** +#if ($jdoInfo.tableShem) + * <p>Pojo mapping ${jdoInfo.tableType} ${jdoInfo.tableShem}.${jdoInfo.tableName}</p> +#else + * <p>Pojo mapping ${jdoInfo.tableType} ${jdoInfo.tableName}</p> +#end +#if ($jdoInfo.getTableRemarks()) + * <p>${jdoInfo.getTableRemarks()}</p> +#end + * + * <p>Generated at $date</p> + * @author ${generatorVersion} + * + */ +@SuppressWarnings("serial") +public class ${jdoInfo.javaClassName} implements Serializable { + +#parse("${templatePath}/variable.vm") + +#parse("${templatePath}/setter.vm") + +} \ No newline at end of file Property changes on: salto-db-generator/trunk/templates/ibatis/dataobject.vm ___________________________________________________________________ Name: svn:executable + * Added: salto-db-generator/trunk/templates/ibatis/ibatis.xml.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/ibatis.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/ibatis/ibatis.xml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<!DOCTYPE sqlMapConfig + PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" + "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> + +<sqlMapConfig> + +#foreach($jdoInfo in ${jdoInfos}) + <sqlMap resource="ibatis/${jdoInfo.javaClassName}.xml" /> +#end + +</sqlMapConfig> \ No newline at end of file Added: salto-db-generator/trunk/templates/ibatis/mapping.xml.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/mapping.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/ibatis/mapping.xml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" + "http://ibatis.apache.org/dtd/sql-map-2.dtd"> + +<!-- This file has been generated by ${generatorVersion} at $date --> +<sqlMap namespace="${jdoInfo.javaPckName}"> + +<!-- Table ${jdoInfo.tableName} --> +#if ($jdoInfo.getTableRemarks()) +<!-- +${jdoInfo.getTableRemarks()} +--> +#end + <typeAlias alias="${jdoInfo.javaClassName}" type="${jdoInfo.javaPckName}.${jdoInfo.javaClassName}" /> + + <resultMap id="${jdoInfo.javaClassName}" class="${jdoInfo.javaClassName}"> +#foreach($col in ${jdoInfo.jdoColInfos}) + <result property="$col.javaAttName" column="${jdoInfo.tableName}_$col.colName"/> +#end + </resultMap> + + <select id="findAll${jdoInfo.javaClassName}" resultMap="${jdoInfo.javaClassName}"> + select +#foreach($col in ${jdoInfo.jdoColInfos}) + #if ($velocityCount > 0),#end$col.colName as ${jdoInfo.tableName}_$col.colName +#end + from ${jdoInfo.tableName} + </select> + + <insert id="insert${jdoInfo.javaClassName}" parameterClass="${jdoInfo.javaClassName}"> + insert into ${jdoInfo.tableName} ( +#foreach($col in ${jdoInfo.jdoColInfos}) + #if ($velocityCount > 0),#end$col.colName +#end + ) values ( +#foreach($col in ${jdoInfo.jdoColInfos}) + #if ($velocityCount > 0),#end#$col.javaAttName# +#end + ) + </insert> + + <update id="update${jdoInfo.javaClassName}" parameterClass="${jdoInfo.javaClassName}"> + update + ${jdoInfo.tableName} + set +#foreach($col in ${jdoInfo.getBasicColInfos()}) + #if ($velocityCount > 0), #end$col.colName = #$col.javaAttName# +#end + where +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) + #if ($velocityCount > 0)and #end$col.colName = #$col.javaAttName# +#end +#end +#end + </update> + + <delete id="delete${jdoInfo.javaClassName}" parameterClass="${jdoInfo.javaClassName}"> + delete from + ${jdoInfo.tableName} + where +#foreach($col in ${jdoInfo.jdoColInfos}) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) + #if ($velocityCount > 0)and #end$col.colName = #$col.javaAttName# +#end +#end +#end + </delete> + +</sqlMap> \ No newline at end of file Added: salto-db-generator/trunk/templates/ibatis/setter.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/setter.vm (rev 0) +++ salto-db-generator/trunk/templates/ibatis/setter.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,61 @@ +#set( $sprimarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($util.getLength($jdoInfo.getPk()) > 1) +#foreach($colpk in ${jdoInfo.getPk()}) +#if ($colpk.col.equals($col.colName)) +#set( $bdone = "true" ) +#end +#end +#end +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done == "true") + /** + * get ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} + */ + public ${util.DoNameCreator.createDoName($colfk2.getPkTableName())} get${util.DoNameCreator.createDoName($colfk2.getPkTableName())}() { + return this.${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}; + } + + /** + * set ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} + */ + public void set${util.DoNameCreator.createDoName($colfk2.getPkTableName())}(${util.DoNameCreator.createDoName($colfk2.getPkTableName())} ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}) { + this.${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} = ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}; + } + +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end + +#if ($done=="false") + /** +#if (${col.colRemarks}) + * <p>${col.colRemarks} + * </p> +#end + * @return ${col.javaAttName} + */ + public $col.getNonPrimitifClass() ${col.getterMethod()}() { + return ${col.javaAttName}; + } + + /** + * @param ${col.javaAttName} new value for ${col.javaAttName} + */ + public void ${col.setterMethod()}(${col.getNonPrimitifClass()} ${col.javaAttName}) { + this.${col.javaAttName} = ${col.javaAttName}; + } + +#end +#end Property changes on: salto-db-generator/trunk/templates/ibatis/setter.vm ___________________________________________________________________ Name: svn:executable + * Added: salto-db-generator/trunk/templates/ibatis/variable.vm =================================================================== --- salto-db-generator/trunk/templates/ibatis/variable.vm (rev 0) +++ salto-db-generator/trunk/templates/ibatis/variable.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,33 @@ +#set( $primarykeydone = "false" ) +#foreach($col in ${jdoInfo.jdoColInfos}) +#set( $done = "false" ) +#if ($util.getLength(${jdoInfo.getImportedFk()}) > 0) +#foreach($colfk in ${jdoInfo.getImportedFk()}) +#foreach($colfk2 in $colfk) +#if($colfk2.getFkColumnName().equals($col.colName)) +#set( $bdone = "false" ) +#if ($bdone=="false") +#set ($done= "$fks.add($colfk2.fkName)" ) +#if ($done=="true") + /** + * Attribute ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))} + */ + private $util.DoNameCreator.createDoName($colfk2.getPkTableName()) ${util.DoNameCreator.class2attribute($util.DoNameCreator.createDoName($colfk2.getPkTableName()))}; + +#end +#set( $done = "true" ) +#end +#end +#end +#end +#end + +#if ($done=="false") + /** + * Attribute $col.javaAttName. + */ + private $col.getNonPrimitifClass() $col.javaAttName; + +#end +#end +#set ($done= "$fks.clear()" ) Property changes on: salto-db-generator/trunk/templates/ibatis/variable.vm ___________________________________________________________________ Name: svn:executable + * Added: salto-db-generator/trunk/templates/springibatisdao/applicationContext-ibatis.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springibatisdao/applicationContext-ibatis.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springibatisdao/applicationContext-ibatis.xml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- This file has been generated by ${generatorVersion} at $date --> + +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> + + + <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> + <property name="configLocation" value="classpath:ibatis.xml"/> + <property name="dataSource" ref="dataSource"/> + </bean> + + +#foreach($jdoInfo in ${jdoInfos}) + + <bean id="${util.DoNameCreator.class2attribute(${jdoInfo.javaClassName})}DAO" class="${pckName}.dao.ibatis.${jdoInfo.javaClassName}IBatisDAO"> + <property name="sqlMapClient" ref="sqlMapClient"/> + </bean> +#end + +</beans> Added: salto-db-generator/trunk/templates/springibatisdao/applicationContext-resources.xml.vm =================================================================== --- salto-db-generator/trunk/templates/springibatisdao/applicationContext-resources.xml.vm (rev 0) +++ salto-db-generator/trunk/templates/springibatisdao/applicationContext-resources.xml.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- This file has been generated by ${generatorVersion} at $date --> + +<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> + + <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> + <property name="driverClassName" value="${connInfo.driver}"/> + <property name="url" value="${connInfo.url}"/> + <property name="username" value="${connInfo.user}"/> + <property name="password" value="${connInfo.pwd}"/> + <property name="maxActive" value="100"/> + <property name="maxIdle" value="30"/> + <property name="maxWait" value="1000"/> + <property name="defaultAutoCommit" value="true"/> + <property name="removeAbandoned" value="true"/> + <property name="removeAbandonedTimeout" value="60"/> + </bean> + + + + <!-- JNDI DataSource for J2EE environments, replace XXXX by your pool name if needed --> + <!-- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> + <property name="jndiName" value="java:comp/env/jdbc/XXXXX" /> + <property name="cache" value="false" /> + <property name="proxyInterface" value="javax.sql.DataSource" /> + </bean>--> + + +</beans> Added: salto-db-generator/trunk/templates/springibatisdao/dao.vm =================================================================== --- salto-db-generator/trunk/templates/springibatisdao/dao.vm (rev 0) +++ salto-db-generator/trunk/templates/springibatisdao/dao.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,16 @@ +package ${jdoInfo.javaPckName}.dao; + +import java.util.List; +import java.sql.Timestamp; + +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; + +/** + * <p>Generic DAO layer for ${jdoInfo.javaClassName}s</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public interface ${jdoInfo.javaClassName}DAO extends GenericDAO<${jdoInfo.javaClassName}> { + +} \ No newline at end of file Added: salto-db-generator/trunk/templates/springibatisdao/genericdao.vm =================================================================== --- salto-db-generator/trunk/templates/springibatisdao/genericdao.vm (rev 0) +++ salto-db-generator/trunk/templates/springibatisdao/genericdao.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,22 @@ +package ${pckName}.dao; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * Generated at $date + * + * @author ${generatorVersion} + */ +public interface GenericDAO<T> { + + List<T> findAll(); + + void save(T entity); + + void update(T entity); + + void delete(T entity); + +} \ No newline at end of file Added: salto-db-generator/trunk/templates/springibatisdao/ibatisdao.vm =================================================================== --- salto-db-generator/trunk/templates/springibatisdao/ibatisdao.vm (rev 0) +++ salto-db-generator/trunk/templates/springibatisdao/ibatisdao.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,24 @@ +package ${jdoInfo.javaPckName}.dao.ibatis; + +import java.util.List; +import java.sql.Timestamp; + +import ${jdoInfo.javaPckName}.pojo.${jdoInfo.javaClassName}; +import ${jdoInfo.javaPckName}.dao.${jdoInfo.javaClassName}DAO; + + +/** + * <p>iBatis DAO layer for ${jdoInfo.javaClassName}s</p> + * <p>Generated at $date</p> + * + * @author ${generatorVersion} + */ +public class ${jdoInfo.javaClassName}IBatisDAO extends + AbstractIBatisDAO<${jdoInfo.javaClassName}> implements + ${jdoInfo.javaClassName}DAO { + + public String getAlias() { + return "${jdoInfo.javaClassName}"; + } + +} Added: salto-db-generator/trunk/templates/springibatisdao/springabstractibatisdao.vm =================================================================== --- salto-db-generator/trunk/templates/springibatisdao/springabstractibatisdao.vm (rev 0) +++ salto-db-generator/trunk/templates/springibatisdao/springabstractibatisdao.vm 2008-04-29 16:18:07 UTC (rev 324) @@ -0,0 +1,46 @@ +package ${pckName}.dao.ibatis; + +import ${pckName}.dao.GenericDAO; +import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.List; +import java.util.Map; + +import org.springframework.dao.DataAccessException; +import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; + +/** + * Generated at $date + * + * @author ${generatorVersion} + */ +public abstract class AbstractIBatisDAO<T> extends SqlMapClientDaoSupport implements GenericDAO<T> { + + private Class<T> persistentClass; + + + + public AbstractIBatisDAO() { + this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + } + + public abstract String getAlias(); + + public void delete(T entity) { + getSqlMapClientTemplate().delete("delete" + getAlias(), entity); + } + + @SuppressWarnings("unchecked") + public List<T> findAll() { + return getSqlMapClientTemplate().queryForList("findAll" + getAlias()); + } + + public void save(T entity) { + getSqlMapClientTemplate().insert("insert"+getAlias(), entity); + } + + public void update(T entity) { + getSqlMapClientTemplate().update("update" + getAlias(), entity); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 11:30:59
|
Revision: 323 http://salto-db.svn.sourceforge.net/salto-db/?rev=323&view=rev Author: rflament Date: 2008-04-27 04:30:51 -0700 (Sun, 27 Apr 2008) Log Message: ----------- update documentation to show that tableName has been replaced by tablesNames Modified Paths: -------------- salto-db-generator/trunk/src/site/apt/antusage.apt salto-db-generator/trunk/src/site/apt/roadmap.apt Modified: salto-db-generator/trunk/src/site/apt/antusage.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/antusage.apt 2008-04-27 11:29:13 UTC (rev 322) +++ salto-db-generator/trunk/src/site/apt/antusage.apt 2008-04-27 11:30:51 UTC (rev 323) @@ -28,12 +28,16 @@ *---------------*--------+------------------------------------------------------------------------------------------------------------------------+ |driverClassName|required|Class name of the jdbc driver to use (i.e. com.mysql.jdbc.Driver for MySQL, oracle.jdbc.OracleDriver for Oracle, etc.) *------------*--------------------------+--------+ +|followForeignKeys|optional (default is false)|If set to true, Salto-db Generator will follow foreign keys on table to retrieve dependants tables to execute plugin on them as well. It is recursive (see maxDepth). +*------------*--------------------------+--------+ |generateView|optional (default is true)|If set to false, views will be ignored by Salto-db Generator. Default is true. *----*-----+--------+ |jdbcUrl|required|JDBC url to access to the database. *----*-----+--------+ |login|required|Login to access to the database. *----*-----+--------+ +|maxDepth|optional (default is 0)|When you set followForeignKeys to true, you need to set a max depth to retrieve dependants table, otherwise you will retrieve the whole database. +*----*-----+--------+ |nameOffset|optional (default is 0)|You can set an offset to ignore first characters of table names. As an example if you run the Hibernate plugin on a table named "TB_PERSON", a pojo mapping this table will be generated. By default its name would be "TbPerson" but if you set nameOffset to 3, the generated name will be "Person" because the first characters "TB_" have been ignored. *----*-----+--------+ |plugin|optional (default is Salto-db)|Name of the plugin you want to use in Salto-db Generator. @@ -48,7 +52,7 @@ *----*-----+--------+ |schema|required|Name of the schema in which target tables can be found *-----*-----+--------+ -|tableName|required|Pattern to search for tables that you want to use. You can use the joker character '%'. +|tablesNames|required|Comma-separated patterns to search for tables that you want to use. You can use the joker character '%' in patterns. *----*-----+--------+ Parameters @@ -63,7 +67,7 @@ <!-- set a pattern to search for tables. You can use the joker character '%'. If you want to generate DataObjects for every tables, just set '%' --> - <property name="tableName" value=""/> + <property name="tablesNames" value=""/> <!-- set your database username--> <property name="login" value=""/> @@ -92,7 +96,7 @@ classpathref="lib.path"/> <target name="generate"> - <salto-db-generate plugin="EJB3" schema="${schema}" tableName="${tableName}" + <salto-db-generate plugin="EJB3" schema="${schema}" tablesNames="${tablesNames}" login="${login}" password="${password}" jdbcUrl="${jdbcUrl}" driverClassName="${driverClassName}" outputDir="${outputDir}" packageName="${packageName}"/> </target> Modified: salto-db-generator/trunk/src/site/apt/roadmap.apt =================================================================== --- salto-db-generator/trunk/src/site/apt/roadmap.apt 2008-04-27 11:29:13 UTC (rev 322) +++ salto-db-generator/trunk/src/site/apt/roadmap.apt 2008-04-27 11:30:51 UTC (rev 323) @@ -6,10 +6,10 @@ Here are plans for v1.1 : - * Core Api rewrite so plugins will be easier to write + * Simple Flex webapp with crud operations - * Spring/Hibernate plugin - * Possibility to use custom plugins within the Eclipse plugin - * Complete webapp generation with crud operations \ No newline at end of file + * Dictionnary integration to choose java objects and fields names + + * Drools integration to select tables, rename fields, etc. \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 11:29:17
|
Revision: 322 http://salto-db.svn.sourceforge.net/salto-db/?rev=322&view=rev Author: rflament Date: 2008-04-27 04:29:13 -0700 (Sun, 27 Apr 2008) Log Message: ----------- typo Modified Paths: -------------- salto-db-generator/trunk/pom.xml Modified: salto-db-generator/trunk/pom.xml =================================================================== --- salto-db-generator/trunk/pom.xml 2008-04-27 11:28:02 UTC (rev 321) +++ salto-db-generator/trunk/pom.xml 2008-04-27 11:29:13 UTC (rev 322) @@ -212,7 +212,7 @@ <distributionManagement> <site> - <id>Sourcefore website</id> + <id>Sourceforge website</id> <url>scp://shell.sf.net/home/groups/s/sa/salto-db/htdocs/salto-db-generator</url> </site> </distributionManagement> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 11:28:06
|
Revision: 321 http://salto-db.svn.sourceforge.net/salto-db/?rev=321&view=rev Author: rflament Date: 2008-04-27 04:28:02 -0700 (Sun, 27 Apr 2008) Log Message: ----------- bug if table type is null Modified Paths: -------------- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java Modified: salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java =================================================================== --- salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-04-27 09:42:17 UTC (rev 320) +++ salto-db-generator/trunk/src/com/salto/db/ant/DOGeneratorTask.java 2008-04-27 11:28:02 UTC (rev 321) @@ -91,7 +91,7 @@ Set set = new HashSet(); for (int k = 0; k < tableNames.length; k++) { TableInfo[] tableInfos = DatabaseInfo.getTables(defaultConn, null, schema, tableNames[k]); - log(tableInfos.length + " table(s) found for table name '" + tableNames[k] + "'"); + log(tableInfos.length + " database object(s) found for table name '" + tableNames[k] + "'"); set.addAll(Arrays.asList(tableInfos)); } @@ -124,6 +124,9 @@ for (int j = 0; j < tableInfos.length; j++) { + if (tableInfos[j].getTableType() == null) + continue; + if (!tableInfos[j].getTableType().equalsIgnoreCase("VIEW") && !tableInfos[j].getTableType().equalsIgnoreCase("TABLE")) { continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 09:42:23
|
Revision: 320 http://salto-db.svn.sourceforge.net/salto-db/?rev=320&view=rev Author: rflament Date: 2008-04-27 02:42:17 -0700 (Sun, 27 Apr 2008) Log Message: ----------- v1.0.16 Modified Paths: -------------- salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF Modified: salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF =================================================================== --- salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF 2008-04-27 09:35:25 UTC (rev 319) +++ salto-db-generator-eclipse/trunk/META-INF/MANIFEST.MF 2008-04-27 09:42:17 UTC (rev 320) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Salto-db Generator Eclipse Plug-in Bundle-SymbolicName: com.salto.db.generator.eclipse;singleton:=true -Bundle-Version: 1.0.15 +Bundle-Version: 1.0.16 Bundle-Activator: com.salto.db.generator.eclipse.Activator Bundle-Vendor: Salto Consulting Bundle-Localization: plugin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 09:35:28
|
Revision: 319 http://salto-db.svn.sourceforge.net/salto-db/?rev=319&view=rev Author: rflament Date: 2008-04-27 02:35:25 -0700 (Sun, 27 Apr 2008) Log Message: ----------- Added Paths: ----------- salto-db-generator-eclipse/tags/v1_0_16/ salto-db-generator-eclipse/tags/v1_0_16/.settings/org.eclipse.core.resources.prefs salto-db-generator-eclipse/tags/v1_0_16/lib/salto-db-generator.jar salto-db-generator-eclipse/tags/v1_0_16/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java salto-db-generator-eclipse/tags/v1_0_16/src/com/salto/db/generator/eclipse/view/GeneratorView.java Removed Paths: ------------- salto-db-generator-eclipse/tags/v1_0_16/lib/salto-db-generator.jar salto-db-generator-eclipse/tags/v1_0_16/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java salto-db-generator-eclipse/tags/v1_0_16/src/com/salto/db/generator/eclipse/view/GeneratorView.java Copied: salto-db-generator-eclipse/tags/v1_0_16 (from rev 314, salto-db-generator-eclipse/trunk) Copied: salto-db-generator-eclipse/tags/v1_0_16/.settings/org.eclipse.core.resources.prefs (from rev 318, salto-db-generator-eclipse/trunk/.settings/org.eclipse.core.resources.prefs) =================================================================== --- salto-db-generator-eclipse/tags/v1_0_16/.settings/org.eclipse.core.resources.prefs (rev 0) +++ salto-db-generator-eclipse/tags/v1_0_16/.settings/org.eclipse.core.resources.prefs 2008-04-27 09:35:25 UTC (rev 319) @@ -0,0 +1,3 @@ +#Sat Apr 26 18:44:44 CEST 2008 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 Deleted: salto-db-generator-eclipse/tags/v1_0_16/lib/salto-db-generator.jar =================================================================== (Binary files differ) Copied: salto-db-generator-eclipse/tags/v1_0_16/lib/salto-db-generator.jar (from rev 315, salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar) =================================================================== --- salto-db-generator-eclipse/tags/v1_0_16/lib/salto-db-generator.jar (rev 0) +++ salto-db-generator-eclipse/tags/v1_0_16/lib/salto-db-generator.jar 2008-04-27 09:35:25 UTC (rev 319) @@ -0,0 +1,1919 @@ +PK + |
From: <rfl...@us...> - 2008-04-27 09:33:53
|
Revision: 318 http://salto-db.svn.sourceforge.net/salto-db/?rev=318&view=rev Author: rflament Date: 2008-04-27 02:33:46 -0700 (Sun, 27 Apr 2008) Log Message: ----------- force utf-8 encoding Added Paths: ----------- salto-db-generator-eclipse/trunk/.settings/org.eclipse.core.resources.prefs Added: salto-db-generator-eclipse/trunk/.settings/org.eclipse.core.resources.prefs =================================================================== --- salto-db-generator-eclipse/trunk/.settings/org.eclipse.core.resources.prefs (rev 0) +++ salto-db-generator-eclipse/trunk/.settings/org.eclipse.core.resources.prefs 2008-04-27 09:33:46 UTC (rev 318) @@ -0,0 +1,3 @@ +#Sat Apr 26 18:44:44 CEST 2008 +eclipse.preferences.version=1 +encoding/<project>=UTF-8 Property changes on: salto-db-generator-eclipse/trunk/.settings/org.eclipse.core.resources.prefs ___________________________________________________________________ Name: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 09:29:17
|
Revision: 317 http://salto-db.svn.sourceforge.net/salto-db/?rev=317&view=rev Author: rflament Date: 2008-04-27 02:29:14 -0700 (Sun, 27 Apr 2008) Log Message: ----------- Modified Paths: -------------- salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java Modified: salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java =================================================================== --- salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java 2008-04-27 09:05:40 UTC (rev 316) +++ salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java 2008-04-27 09:29:14 UTC (rev 317) @@ -2,6 +2,8 @@ import java.io.File; import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -9,14 +11,16 @@ import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.DialogSettings; +import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.dialogs.IconAndMessageDialog; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.LabelProvider; @@ -28,6 +32,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IMemento; @@ -43,7 +48,6 @@ import salto.tool.sql.data.TableInfo; import com.salto.db.generator.eclipse.Activator; -import com.salto.db.generator.eclipse.StackTraceDialog; /** * @author rflament @@ -651,15 +655,28 @@ } catch (Exception e) { e.printStackTrace(); - showException(Msg.getString("error"), Msg.getString("error.db.connection", new String[] { connInfo.getName() }), e); + + + + Status status = new Status(IStatus.ERROR, "Salto DB Generator", 0, + getStackTrace(e), null); + + // Display the dialog + ErrorDialog.openError(Display.getCurrent().getActiveShell(), + Msg.getString("error"), Msg.getString("error.db.connection", new String[] { connInfo.getName() }), status); + } } + + private static String getStackTrace(Throwable t) + { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw, true); + t.printStackTrace(pw); + pw.flush(); + sw.flush(); + return sw.toString(); + } - private void showException(String title, String message, Throwable throwable) { - IconAndMessageDialog dialog = new StackTraceDialog(new Shell(SWT.DIALOG_TRIM), title, throwable, message); - // dialog.s - dialog.open(); - } - } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-27 09:05:41
|
Revision: 316 http://salto-db.svn.sourceforge.net/salto-db/?rev=316&view=rev Author: rflament Date: 2008-04-27 02:05:40 -0700 (Sun, 27 Apr 2008) Log Message: ----------- bug with table types support empty source folder Modified Paths: -------------- salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java Modified: salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java =================================================================== --- salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java 2008-04-26 16:51:41 UTC (rev 315) +++ salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java 2008-04-27 09:05:40 UTC (rev 316) @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; @@ -45,7 +47,6 @@ import salto.tool.sql.data.TableColInfo; import salto.tool.sql.data.TableInfo; -import com.salto.db.generator.Constants; import com.salto.db.generator.eclipse.Activator; import com.salto.db.generator.eclipse.EclipseIdeInterface; import com.salto.db.generator.plugin.IGeneratorPlugin; @@ -77,8 +78,6 @@ private ComboPlugins comboPlugins = new ComboPlugins(); - private static final String GENERATOR = "Salto-db Eclipse " + Constants.VERSION; - public ApplyTemplateControl(Composite parent, int style) { super(parent, style); @@ -116,31 +115,43 @@ label = new Label(this, SWT.NONE); label.setText(Msg.getString("project")); - projects = new Combo(this, SWT.BORDER | SWT.READ_ONLY); + projects = new Combo(this, SWT.BORDER | SWT.READ_ONLY ); projects.setLayoutData(gridData); String[] projets = new EclipseIdeInterface().getProjets(); projects.setItems(projets); projects.addModifyListener(new ModifyListener() { + + /*private boolean contains(String[] array, String string) + { + + for (int i = 0; i < array.length; i++) { + if (array[i].equals(string)) + return true; + } + + return false; + }*/ + + public void modifyText(ModifyEvent e) { try { if (projects.getText() == null || "".equals(projects.getText())) { return; } - - String[] pcks = new EclipseIdeInterface().getPackage(projects.getText()); - pck.setItems(pcks); - - String[] srcs = new EclipseIdeInterface().getSourceFolder(projects.getText()); - src.setItems(srcs); - if (srcs.length <= 1) { - src.setEnabled(false); - } else { - src.setEnabled(true); - } - if (srcs.length > 0) - src.select(0); + //if (contains(projects.getItems(), projects.getText())) { + + String[] pcks = new EclipseIdeInterface().getPackage(projects.getText()); + pck.setItems(pcks); + + String[] srcs = new EclipseIdeInterface().getSourceFolder(projects.getText()); + src.setItems(srcs); + + if (srcs.length > 0) + src.select(0); + // } + } catch (Exception ex) { ex.printStackTrace(); } @@ -214,7 +225,12 @@ try { IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projects.getText()); - String path = project.getLocation().toOSString() + "/" + src.getText() + "/"; + + String path = null; + if (project == null) + path =ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString() + "/"+projects.getText(); + else + path = project.getLocation().toOSString() + "/" + src.getText() + "/"; JdoInfo[] jdoInfos = new JdoInfo[this.tableInfos.length]; @@ -248,7 +264,8 @@ IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject javaProject = myWorkspaceRoot.getProject(projects.getText()); if (javaProject.exists() && !javaProject.isOpen()) - javaProject.open(null); // création des folders si nécessaires + javaProject.open(null); + // création des folders si nécessaires Path filePath = new Path(src.getText() + "/" + pck.getText().replace('.', '/')); IFolder javaFolder = null; String relativePath = ""; Modified: salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java =================================================================== --- salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java 2008-04-26 16:51:41 UTC (rev 315) +++ salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/GeneratorView.java 2008-04-27 09:05:40 UTC (rev 316) @@ -609,6 +609,14 @@ treeParent.setType(CONNECTED_CONNECTION); for (int i = 0; i < tableInfo.length; i++) { + + if (tableInfo[i].getTableType()==null) + continue; + + if (!tableInfo[i].getTableType().equalsIgnoreCase("VIEW") && !tableInfo[i].getTableType().equalsIgnoreCase("TABLE")) { + continue; + } + schema = tableInfo[i].getTableShem(); if (schema == null) { schema = tableInfo[i].getTableCat(); @@ -642,7 +650,7 @@ } } catch (Exception e) { - System.out.println(e); + e.printStackTrace(); showException(Msg.getString("error"), Msg.getString("error.db.connection", new String[] { connInfo.getName() }), e); } } @@ -650,7 +658,7 @@ private void showException(String title, String message, Throwable throwable) { IconAndMessageDialog dialog = new StackTraceDialog(new Shell(SWT.DIALOG_TRIM), title, throwable, message); - + // dialog.s dialog.open(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rfl...@us...> - 2008-04-26 16:51:45
|
Revision: 315 http://salto-db.svn.sourceforge.net/salto-db/?rev=315&view=rev Author: rflament Date: 2008-04-26 09:51:41 -0700 (Sat, 26 Apr 2008) Log Message: ----------- update to work with v1.0.16 Modified Paths: -------------- salto-db-generator-eclipse/trunk/src/com/salto/db/generator/eclipse/view/ApplyTemplateControl.java Added Paths: ----------- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar Removed Paths: ------------- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar Deleted: salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar =================================================================== (Binary files differ) Added: salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar =================================================================== --- salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar (rev 0) +++ salto-db-generator-eclipse/trunk/lib/salto-db-generator.jar 2008-04-26 16:51:41 UTC (rev 315) @@ -0,0 +1,1919 @@ +PK + |