OSDN Git Service

ディクショナリ機能追加
authortaktos9 <taktos9@136db618-7844-41ca-8ac1-fb3fd040db1d>
Mon, 27 Oct 2008 02:08:27 +0000 (02:08 +0000)
committertaktos9 <taktos9@136db618-7844-41ca-8ac1-fb3fd040db1d>
Mon, 27 Oct 2008 02:08:27 +0000 (02:08 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/ea2ddl/trunk/ea2ddl@67 136db618-7844-41ca-8ac1-fb3fd040db1d

ea2ddl-ddl/src/main/java/jp/sourceforge/ea2ddl/ddl/factory/impl/DatabaseModelFactoryImpl.java
ea2ddl-ddl/src/main/resources/app-config.dicon
ea2ddl-ddl/src/test/resources/dictionary.properties [new file with mode: 0644]
ea2ddl-ddl/src/test/resources/jdbc.dicon

index ae45280..ff3a6c8 100644 (file)
@@ -147,7 +147,7 @@ public class DatabaseModelFactoryImpl implements ModelFactory {
                        final ColumnModel column = new ColumnModel();\r
                        column.setName(attribute.getName());\r
                        column.setAlias(attribute.getStyle());\r
-                       column.setType(attribute.getType());\r
+                       column.setType(getColumnType(attribute));\r
                        column.setLength(attribute.getLength());\r
                        column.setPrecision(attribute.getPrecision());\r
                        column.setScale(attribute.getScale());\r
@@ -157,6 +157,14 @@ public class DatabaseModelFactoryImpl implements ModelFactory {
                }\r
        }\r
 \r
+       protected String getColumnType(TAttribute attribute) {\r
+               final String dictionary = _config.getProperty(attribute.getName());\r
+               if (dictionary != null) {\r
+                       return dictionary;\r
+               }\r
+               return attribute.getType();\r
+       }\r
+\r
        protected void generatePKModel(TableModel table, TObject tobject) {\r
                final ListResultBean<TOperation> pkList = _tOperationBhv.selectOperation(tobject,\r
                                Constants.STEREOTYPE_PRIMARY_KEY);\r
index 99f5bb6..d182ec8 100644 (file)
@@ -7,5 +7,8 @@
                <initMethod name="load">\r
                        <arg>"ea2ddl.properties"</arg>\r
                </initMethod>\r
+               <initMethod name="load">\r
+                       <arg>"dictionary.properties"</arg>\r
+               </initMethod>\r
        </component>\r
 </components>
\ No newline at end of file
diff --git a/ea2ddl-ddl/src/test/resources/dictionary.properties b/ea2ddl-ddl/src/test/resources/dictionary.properties
new file mode 100644 (file)
index 0000000..4d80ce9
--- /dev/null
@@ -0,0 +1,3 @@
+MONEY=NUMBER(12)\r
+FLAG=NUMBER(1)\r
+ID=NUMBER(8)
\ No newline at end of file
index 0d07484..9e25427 100644 (file)
@@ -11,7 +11,7 @@
                        "sun.jdbc.odbc.JdbcOdbcDriver"\r
                </property>\r
                <property name="URL">\r
-                       "jdbc:odbc:exampledb"\r
+                       "jdbc:odbc:exampledb_ea"\r
                </property>\r
                <property name="user">"sa"</property>\r
                <property name="password">""</property>\r