[Jiemamy-notify:2223] commit [3270] リファクタリング

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 4月 14日 (火) 19:06:21 JST


Revision: 3270
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3270
Author:   j5ik2o
Date:     2009-04-14 19:06:21 +0900 (Tue, 14 Apr 2009)

Log Message:
-----------
リファクタリング

Modified Paths:
--------------
    leto/jiemamy-entity-io/trunk/pom.xml
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/ProductInfo.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/AssociationType.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AssociationResolver.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AttributeDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntitySetDescFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/PluralFormDictinary.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/GeneratorImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/ResourceTemplateLoader.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/meta/DbColumnMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/ClassModelSupport.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/EntityModelFactoryImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/ColumnMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterContext.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaCommand.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaReaderFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterContext.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterFactory.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/PropertyMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/TableMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractIdGeneratorMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractPreAllocateIdGeneratorMeta.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaReaderImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java
    leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImplTest.java

Added Paths:
-----------
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/IdentityNotSupportedException.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/GenDialect.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/SqlType.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/StandardGenDialect.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/UnsupportedSqlTypeException.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/ValueType.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ColumnUtil.java
    leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/FileUtil.java
    leto/jiemamy-entity-io/trunk/src/main/resources/org/
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/copyright.ftl
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/entity.ftl
    leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/lib.ftl
    leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/TestDialect.java
    leto/jiemamy-entity-io/trunk/src/test/resources/org/
    leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/
    leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/
    leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/io/
    leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/io/templates/
    leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/io/templates/entity.ftl

Removed Paths:
-------------
    leto/jiemamy-entity-io/trunk/src/test/resources/template/


-------------- next part --------------
Modified: leto/jiemamy-entity-io/trunk/pom.xml
===================================================================
--- leto/jiemamy-entity-io/trunk/pom.xml	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/pom.xml	2009-04-14 10:06:21 UTC (rev 3270)
@@ -175,11 +175,29 @@
 			<artifactId>freemarker</artifactId>
 			<version>2.3.13</version>
 		</dependency>
-<dependency>
-    <groupId>org.apache.geronimo.specs</groupId>
-    <artifactId>geronimo-annotation_1.0_spec</artifactId>
-    <version>1.0</version>
-</dependency>
+		<dependency>
+		    <groupId>org.apache.geronimo.specs</groupId>
+		    <artifactId>geronimo-annotation_1.0_spec</artifactId>
+		    <version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>jiemamy-spec-core</artifactId>
+			<version>0.2-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.jiemamy</groupId>
+			<artifactId>jiemamy-test-helper</artifactId>
+			<version>0.0.1-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>jiemamy-core</artifactId>
+			<version>0.2.0-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
 	<reporting>
 		<plugins>

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/ProductInfo.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/ProductInfo.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/ProductInfo.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -1,6 +1,8 @@
 /*
- * Copyright 2004-2009 the Seasar Foundation and the Others.
+ * Copyright 2007-2009 Jiemamy Project and the Others.
  *
+ * This file is part of Jiemamy.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -9,7 +11,7 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  * either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/AssociationType.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/AssociationType.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/AssociationType.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -63,7 +63,7 @@
 	};
 	
 	/**
-	 * アノテーションを返します。
+	 * アノテーションを取得する。
 	 * 
 	 * @return アノテーション
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AssociationResolver.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AssociationResolver.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AssociationResolver.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -45,7 +45,7 @@
 	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param entitySetDesc エンティティ集合記述
 	 * @param pluralFormDictinary 単語を複数形に変換するための辞書
@@ -62,7 +62,7 @@
 	}
 	
 	/**
-	 * エンティティ記述のすべての属性について必要であれば名前を調整します。
+	 * エンティティ記述のすべての属性について必要であれば名前を調整する。
 	 * 
 	 * @param fkMeta 外部キーメタデータ
 	 * @param entityDesc エンティティ記述
@@ -84,7 +84,7 @@
 	}
 	
 	/**
-	 * 被所有側の関連を処理します。
+	 * 被所有側の関連を処理する。
 	 * 
 	 * @param fkMeta 外部キーメタデータ
 	 * @param ownerEntityDesc 関連の所有者側のエンティティ記述
@@ -109,7 +109,7 @@
 	}
 	
 	/**
-	 * 所有側の関連を処理します。
+	 * 所有側の関連を処理する。
 	 * 
 	 * @param fkMeta 外部キーメタデータ
 	 * @param ownerEntityDesc 関連の所有者側のエンティティ記述
@@ -147,7 +147,7 @@
 	}
 	
 	/**
-	 * 関連名を返します。
+	 * 関連名を取得する。
 	 * 
 	 * @param inverseEntityDesc 参照する側のエンティティ記述
 	 * @param ownerEntityDesc 参照される側のエンティティ記述
@@ -164,7 +164,7 @@
 	}
 	
 	/**
-	 * 関連の所有側の関連名を返します。
+	 * 関連の所有側の関連名を取得する。
 	 * 
 	 * @param fkMeta 外部キーメタデータ
 	 * @param ownerEntityDesc 関連の所有者側のエンティティ記述
@@ -194,7 +194,7 @@
 	}
 	
 	/**
-	 * 名前を複数形に変換します。
+	 * 名前を複数形に変換する。
 	 * 
 	 * @param name 名前
 	 * @return 複数形に変換された名前
@@ -208,7 +208,7 @@
 	}
 	
 	/**
-	 * 関連を解決します。
+	 * 関連を解決する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param fkMeta 外部キーメタデータ
@@ -227,7 +227,7 @@
 	}
 	
 	/**
-	 * 一意の関連名に変換します。
+	 * 一意の関連名に変換する。
 	 * 
 	 * @param entityDesc エンティティ記述
 	 * @param candidateName 候補の関連名
@@ -245,7 +245,7 @@
 	}
 	
 	/**
-	 * 一意な属性名に変換します。
+	 * 一意な属性名に変換する。
 	 * 
 	 * @param entityDesc エンティティ記述
 	 * @param candidateName 候補の属性名

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AttributeDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AttributeDescFactoryImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/AttributeDescFactoryImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -29,6 +29,7 @@
 
 import org.jiemamy.entity.io.gen.desc.AttributeDesc;
 import org.jiemamy.entity.io.gen.desc.AttributeDescFactory;
+import org.jiemamy.entity.io.gen.dialect.GenDialect;
 import org.jiemamy.entity.io.gen.meta.DbColumnMeta;
 import org.jiemamy.entity.io.gen.meta.DbTableMeta;
 import org.jiemamy.entity.io.utils.AnnotationUtil;
@@ -54,22 +55,31 @@
 	/** エンティティの識別子の割り当てサイズ */
 	protected int allocationSize;
 	
+	protected GenDialect dialect;
+	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
+	 * @param dialect 
 	 * @param versionColumnNamePattern バージョンカラム名のパターン
 	 * @param generationType エンティティの識別子の生成方法を示す列挙型 、生成しない場合は{@code null}
 	 * @param initialValue エンティティの識別子の初期値、指定しない場合は{@code null}
 	 * @param allocationSize エンティティの識別子の割り当てサイズ、指定しない場合は{@code null}
+	 * @throws IdentityNotSupportedException 
 	 */
-	public AttributeDescFactoryImpl(Pattern versionColumnNamePattern, GenerationType generationType,
-			Integer initialValue, Integer allocationSize) {
+	public AttributeDescFactoryImpl(GenDialect dialect, Pattern versionColumnNamePattern,
+			GenerationType generationType, Integer initialValue, Integer allocationSize)
+			throws IdentityNotSupportedException {
+		Validate.notNull(dialect);
 		Validate.notNull(versionColumnNamePattern);
+		this.dialect = dialect;
 		this.versionColumnNamePattern = versionColumnNamePattern;
 		this.generationType = generationType == GenerationType.AUTO ? getDefaultGenerationType() : generationType;
 		if (this.generationType == GenerationType.IDENTITY) {
-			
+			if (dialect.supportsIdentity() == false) {
+				throw new IdentityNotSupportedException();
+			}
 		} else if (this.generationType == GenerationType.SEQUENCE) {
 			SequenceGenerator generator = AnnotationUtil.getDefaultSequenceGenerator();
 			this.initialValue = initialValue != null ? initialValue : generator.initialValue();
@@ -82,7 +92,7 @@
 	}
 	
 	/**
-	 * カラムを処理します。
+	 * カラムを処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param columnMeta カラムメタデータ
@@ -97,26 +107,26 @@
 		attributeDesc.setNullable(columnMeta.isNullable());
 		attributeDesc.setUnique(columnMeta.isUnique());
 		attributeDesc.setComment(columnMeta.getComment());
-//		GenDialect.ColumnType columnType = dialect.getColumnType(columnMeta.getTypeName(), columnMeta.getSqlType());
-//		if (columnType != null) {
-//			Class<?> clazz =
-//					columnType.getAttributeClass(columnMeta.getLength(), columnMeta.getLength(), columnMeta.getScale());
-//			attributeDesc.setAttributeClass(clazz);
-//			String defaultValue = attributeDesc.getGenerationType() != null ? null : columnMeta.getDefaultValue();
-//			String definition =
-//					columnType.getColumnDefinition(columnMeta.getLength(), columnMeta.getLength(), columnMeta
-//						.getScale(), defaultValue);
-//			attributeDesc.setColumnDefinition(definition);
-//			attributeDesc.setLob(columnType.isLob());
-//		} else {
-//			attributeDesc.setUnsupportedColumnType(true);
-//			attributeDesc.setAttributeClass(String.class);
-//			attributeDesc.setLob(false);
-//		}
+		GenDialect.ColumnType columnType = dialect.getColumnType(columnMeta.getTypeName(), columnMeta.getSqlType());
+		if (columnType != null) {
+			Class<?> clazz =
+					columnType.getAttributeClass(columnMeta.getLength(), columnMeta.getLength(), columnMeta.getScale());
+			attributeDesc.setAttributeClass(clazz);
+			String defaultValue = attributeDesc.getGenerationType() != null ? null : columnMeta.getDefaultValue();
+			String definition =
+					columnType.getColumnDefinition(columnMeta.getLength(), columnMeta.getLength(), columnMeta
+						.getScale(), defaultValue);
+			attributeDesc.setColumnDefinition(definition);
+			attributeDesc.setLob(columnType.isLob());
+		} else {
+			attributeDesc.setUnsupportedColumnType(true);
+			attributeDesc.setAttributeClass(String.class);
+			attributeDesc.setLob(false);
+		}
 	}
 	
 	/**
-	 * 識別子を処理します。
+	 * 識別子を処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param columnMeta カラムメタデータ
@@ -138,7 +148,7 @@
 	}
 	
 	/**
-	 * 名前を処理します。
+	 * 名前を処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param columnMeta カラムメタデータ
@@ -149,7 +159,7 @@
 	}
 	
 	/**
-	 * 一時的なプロパティを処理します。
+	 * 一時的なプロパティを処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param columnMeta カラムメタデータ
@@ -159,7 +169,7 @@
 	}
 	
 	/**
-	 * バージョンを処理します。
+	 * バージョンを処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param columnMeta カラムメタデータ
@@ -174,7 +184,9 @@
 	}
 	
 	private String fromColumnNameToPropertyName(String name) {
-		return StringUtil.camelize(name);
+		String result = StringUtil.camelize(name);
+		result = StringUtil.decapitalize(result);
+		return result;
 	}
 	
 	public AttributeDesc getAttributeDesc(DbTableMeta tableMeta, DbColumnMeta columnMeta) {
@@ -188,7 +200,7 @@
 	}
 	
 	private GenerationType getDefaultGenerationType() {
-		return GenerationType.AUTO;
+		return dialect.getDefaultGenerationType();
 	}
 	
 	/**

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescFactoryImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntityDescFactoryImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -49,7 +49,7 @@
 	
 
 	/**
-	 * インスタンスを生成します。
+	 * インスタンスを生成する。
 	 * 
 	 * @param compositeUniqueConstraintDescFactory 複合一意制約記述のファクトリ
 	 * @param attributeDescFactory 属性記述のファクトリ
@@ -63,7 +63,7 @@
 	}
 	
 	/**
-	 * 属性記述を処理します。
+	 * 属性記述を処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param entityDesc エンティティ記述
@@ -76,7 +76,7 @@
 	}
 	
 	/**
-	 * 複合一意制約記述を処理します。
+	 * 複合一意制約記述を処理する。
 	 * 
 	 * @param tableMeta テーブルメタデータ
 	 * @param entityDesc エンティティ記述
@@ -92,7 +92,7 @@
 	}
 	
 	/**
-	 * 名前を処理します。
+	 * 名前を処理する。
 	 * 
 	 * @param tableMeta テーブルメタ情報
 	 * @param entityDesc エンティティ記述
@@ -102,7 +102,7 @@
 	}
 	
 	/**
-	 * テーブルを処理します。
+	 * テーブルを処理する。
 	 * 
 	 * @param tableMeta テーブルメタ情報
 	 * @param entityDesc エンティティ記述

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntitySetDescFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntitySetDescFactoryImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/EntitySetDescFactoryImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -37,6 +37,7 @@
 import org.jiemamy.entity.io.gen.desc.EntityDescFactory;
 import org.jiemamy.entity.io.gen.desc.EntitySetDesc;
 import org.jiemamy.entity.io.gen.desc.EntitySetDescFactory;
+import org.jiemamy.entity.io.gen.dialect.GenDialect;
 import org.jiemamy.entity.io.gen.meta.DbForeignKeyMeta;
 import org.jiemamy.entity.io.gen.meta.DbTableMeta;
 import org.jiemamy.entity.io.gen.meta.DbTableMetaReader;
@@ -69,9 +70,12 @@
 	/** エンティティ記述のファクトリ */
 	protected EntityDescFactory entityDescFactory;
 	
+	/** 方言 */
+	protected GenDialect dialect;
+	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param dbTableMetaReader テーブルメタデータのリーダ
 	 * @param versionColumnNamePattern バージョンカラム名のパターン
@@ -79,12 +83,16 @@
 	 * @param generationType エンティティの識別子の生成方法を示す列挙型 、生成しない場合は{@code null}
 	 * @param initialValue エンティティの識別子の初期値、指定しない場合は{@code null}
 	 * @param allocationSize エンティティの識別子の割り当てサイズ、指定しない場合は{@code null}
+	 * @throws IdentityNotSupportedException 
 	 */
-	public EntitySetDescFactoryImpl(DbTableMetaReader dbTableMetaReader, Pattern versionColumnNamePattern,
-			File pluralFormFile, GenerationType generationType, Integer initialValue, Integer allocationSize) {
+	public EntitySetDescFactoryImpl(DbTableMetaReader dbTableMetaReader, GenDialect dialect,
+			Pattern versionColumnNamePattern, File pluralFormFile, GenerationType generationType, Integer initialValue,
+			Integer allocationSize) throws IdentityNotSupportedException {
 		Validate.notNull(dbTableMetaReader);
+		Validate.notNull(dialect);
 		Validate.notNull(versionColumnNamePattern);
 		this.dbTableMetaReader = dbTableMetaReader;
+		this.dialect = dialect;
 		this.versionColumnNamePattern = versionColumnNamePattern;
 		this.pluralFormFile = pluralFormFile;
 		this.generationType = generationType;
@@ -94,7 +102,7 @@
 	}
 	
 	/**
-	 * 関連のリゾルバを作成します。
+	 * 関連のリゾルバを作成する。
 	 * 
 	 * @param entitySetDesc エンティティ集合記述
 	 * @param pluralFormDictinary 単語を複数形に変換するための辞書
@@ -106,20 +114,22 @@
 	}
 	
 	/**
-	 * {@link EntityDescFactory}の実装を作成します。
+	 * {@link EntityDescFactory}の実装を作成する。
 	 * 
 	 * @return {@link EntityDescFactory}の実装
+	 * @throws IdentityNotSupportedException 
 	 */
-	protected EntityDescFactory createEntityDescFactory() {
+	protected EntityDescFactory createEntityDescFactory() throws IdentityNotSupportedException {
 		AttributeDescFactory attributeDescFactory =
-				new AttributeDescFactoryImpl(versionColumnNamePattern, generationType, initialValue, allocationSize);
+				new AttributeDescFactoryImpl(dialect, versionColumnNamePattern, generationType, initialValue,
+						allocationSize);
 		CompositeUniqueConstraintDescFactory compositeUniqueConstraintDescFactory =
 				new CompositeUniqueConstraintDescFactoryImpl();
 		return new EntityDescFactoryImpl(attributeDescFactory, compositeUniqueConstraintDescFactory);
 	}
 	
 	/**
-	 * 単語を複数形に変換するための辞書を作成します。
+	 * 単語を複数形に変換するための辞書を作成する。
 	 * 
 	 * @return 単語を複数形に変換するための辞書
 	 * @throws IOException 入出力が失敗した場合
@@ -151,7 +161,7 @@
 	}
 	
 	/**
-	 * 辞書ファイルをロードし結果を{@link LinkedHashMap}として返します。
+	 * 辞書ファイルをロードし結果を{@link LinkedHashMap}として取得する。
 	 * 
 	 * @return 正規表現をキー、置換文字列を値とするマップ
 	 * @throws IOException 入出力が失敗した場合

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/IdentityNotSupportedException.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/IdentityNotSupportedException.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/IdentityNotSupportedException.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 14, 2009
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.gen.desc.impl;
+
+
+/**
+ * TODO for kato
+ * 
+ * @author kato
+ */
+public class IdentityNotSupportedException extends Exception {
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 */
+	public IdentityNotSupportedException() {
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message
+	 */
+	public IdentityNotSupportedException(String message) {
+		super(message);
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param cause
+	 */
+	public IdentityNotSupportedException(Throwable cause) {
+		super(cause);
+		// TODO Auto-generated constructor stub
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message
+	 * @param cause
+	 */
+	public IdentityNotSupportedException(String message, Throwable cause) {
+		super(message, cause);
+		// TODO Auto-generated constructor stub
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/IdentityNotSupportedException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/PluralFormDictinary.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/PluralFormDictinary.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/desc/impl/PluralFormDictinary.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -35,13 +35,13 @@
 	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 */
 	public PluralFormDictinary() {
 	}
 	
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param dictinary 正規表現の文字列をキー、置換文字列を値とするマップ
 	 */
@@ -53,7 +53,7 @@
 	}
 	
 	/**
-	 * 単語の複数形を検索します。
+	 * 単語の複数形を検索する。
 	 * 
 	 * @param word 単語
 	 * @return 見つかれば単語の複数形、見つからなければ{@code null}

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/GenDialect.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/GenDialect.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/GenDialect.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,448 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.gen.dialect;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+import java.util.Map;
+
+import javax.persistence.GenerationType;
+
+/**
+ * RDBMSごとの方言を扱うインタフェースです。
+ * 
+ * @author j5ik2o
+ */
+public interface GenDialect {
+	
+	/**
+	 * カラム型です。
+	 * <p>
+	 * データベースのメタデータが返すカラムの型名に対応する。
+	 * <p>
+	 * <p>
+	 * データベースのメタデータからJavaコードを生成する場合に使用できます。
+	 * </p>
+	 * 
+	 * @author j5ik2o
+	 */
+	interface ColumnType {
+		
+		/**
+		 * 属性のクラスを取得する。
+		 * 
+		 * @param length
+		 *            長さ
+		 * @param precision
+		 *            精度
+		 * @param scale
+		 *            スケール
+		 * @return 属性のクラス
+		 */
+		Class<?> getAttributeClass(int length, int precision, int scale);
+		
+		/**
+		 * カラム定義を取得する。
+		 * 
+		 * @param length
+		 *            長さ
+		 * @param precision
+		 *            精度
+		 * @param scale
+		 *            スケール
+		 * @param defaultValue
+		 *            デフォルト値、存在しない場合は{@code null}
+		 * @return カラム定義
+		 */
+		String getColumnDefinition(int length, int precision, int scale, String defaultValue);
+		
+		/**
+		 * LOBの場合{@code true}
+		 * 
+		 * @return LOBの場合{@code true}
+		 */
+		boolean isLob();
+		
+	}
+	
+	/**
+	 * SQLブロックのコンテキストです。
+	 * 
+	 * @author j5ik2o
+	 */
+	interface SqlBlockContext {
+		
+		/**
+		 * SQLのキーワードを追加する。
+		 * 
+		 * @param keyword
+		 *            SQLのキーワード
+		 */
+		void addKeyword(String keyword);
+		
+		/**
+		 * SQLブロックの内側と判定できる場合{@code true}
+		 * 
+		 * @return SQLブロックの内側と判定できる場合{@code true}
+		 */
+		boolean isInSqlBlock();
+	}
+	
+
+	/**
+	 * SQLブロックのコンテキストを作成する。
+	 * 
+	 * @return SQLブロックのコンテキスト
+	 */
+	SqlBlockContext createSqlBlockContext();
+	
+	/**
+	 * 終了を表すクォートを取得する。
+	 * 
+	 * @return 終了を表すクォート
+	 */
+	String getCloseQuote();
+	
+	/**
+	 * カラムのコメントをデータベースから直接取得しマップに詰めて取得する。
+	 * <p>
+	 * {@link #isJdbcCommentAvailable()}が{@code true}を返す場合に利用できます。
+	 * </p>
+	 * <p>
+	 * 戻り値のマップのキーは大文字小文字を気にしません。 カラム名に対応するコメントが存在しない、値は{@code null}になります。
+	 * </p>
+	 * 
+	 * @param connection
+	 *            コネクション
+	 * @param catalogName
+	 *            カタログ名
+	 * @param schemaName
+	 *            スキーマ名
+	 * @param tableName
+	 *            テーブル名
+	 * @return 大文字小文字を気にしないカラム名をキー、カラムのコメントを値とするマップ
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	Map<String, String> getColumnCommentMap(Connection connection, String catalogName, String schemaName,
+			String tableName) throws SQLException;
+	
+	/**
+	 * カラム型を取得する。
+	 * 
+	 * @param columnTypeName
+	 *            カラムの型名
+	 * @param sqlType
+	 *            JDBCのSQL型
+	 * @return カラム型、サポートされていないカラムの型名の場合{@code null}
+	 */
+	ColumnType getColumnType(String columnTypeName, int sqlType);
+	
+	/**
+	 * デフォルトの{@link GenerationType}を取得する。
+	 * 
+	 * @return デフォルトの{@link GenerationType}
+	 */
+	GenerationType getDefaultGenerationType();
+	
+	/**
+	 * デフォルトのスキーマ名を取得する。
+	 * 
+	 * @param userName
+	 *            ユーザー名
+	 * @return スキーマ名
+	 */
+	String getDefaultSchemaName(String userName);
+	
+	/**
+	 * 外部キーを削除する構文を取得する。
+	 * 
+	 * @return 外部キーを削除する構文
+	 */
+	String getDropForeignKeySyntax();
+	
+	/**
+	 * 一意キーを削除する構文を取得する。
+	 * 
+	 * @return 外部キーを削除する構文
+	 */
+	String getDropUniqueKeySyntax();
+	
+	/**
+	 * IDENTITYカラムの定義を取得する。
+	 * 
+	 * @return IDENTITYカラムの定義
+	 */
+	String getIdentityColumnDefinition();
+	
+	/**
+	 * IDENTITYカラムに対するinsertを無効化するステートメントを取得する。
+	 * 
+	 * @param tableName
+	 *            テーブル名
+	 * @return IDENTITYカラムに対するinsertを無効化するステートメント
+	 */
+	String getIdentityInsertDisableStatement(String tableName);
+	
+	/**
+	 * IDENTITYカラムに対するinsertを有効化するステートメントを取得する。
+	 * 
+	 * @param tableName テーブル名
+	 * @return IDENTITYカラムに対するinsertを有効化するステートメント
+	 */
+	String getIdentityInsertEnableStatement(String tableName);
+	
+	/**
+	 * 名前を取得する。
+	 * 
+	 * @return 名前
+	 */
+	String getName();
+	
+	/**
+	 * 開始を表すクォートを取得する。
+	 * 
+	 * @return 開始を表すクォート
+	 */
+	String getOpenQuote();
+	
+	/**
+	 * シーケンス定義の断片を取得する。
+	 * <p>
+	 * この断片は create sequence 以降に続きます。
+	 * </p>
+	 * 
+	 * @param dataType
+	 *            データタイプ
+	 * @param initialValue
+	 *            初期値
+	 * @param allocationSize
+	 *            割り当てサイズ
+	 * @return
+	 */
+	String getSequenceDefinitionFragment(String dataType, long initialValue, int allocationSize);
+	
+	/**
+	 * シーケンスの値を取得するSQLを取得する。
+	 * 
+	 * @param sequenceName
+	 *            シーケンス名
+	 * @param allocationSize
+	 *            割り当てサイズ
+	 * @return シーケンスの値を取得するSQL
+	 */
+	String getSequenceNextValString(String sequenceName, int allocationSize);
+	
+	/**
+	 * SQLブロックの区切り文字を取得する。
+	 * 
+	 * @return SQLブロックの区切り文字、SQLブロックの区切り文字蛾存在しない場合{@code null}
+	 */
+	String getSqlBlockDelimiter();
+	
+	/**
+	 * SQL型を取得する。
+	 * 
+	 * @param sqlType
+	 *            JDBCのSQL型
+	 * @return SQL型
+	 * @throws UnsupportedSqlTypeRuntimeException
+	 *             サポートされていないJDBCのSQL型が渡された場合
+	 */
+	SqlType getSqlType(int sqlType) throws UnsupportedSqlTypeException;
+	
+	/**
+	 * SQL型を取得する。
+	 * 
+	 * @param valueTypeProvider
+	 *            {@link ValueType}の提供者
+	 * @param propertyMeta
+	 *            プロパティメタデータ
+	 * @return SQL型
+	 * @throws UnsupportedSqlTypeException 
+	 * @throws UnsupportedSqlTypeRuntimeException
+	 *             サポートされていないJDBCのSQL型が渡された場合
+	 */
+//	SqlType getSqlType(ValueTypeProvider valueTypeProvider, PropertyMeta propertyMeta)
+//			throws UnsupportedSqlTypeException;
+	/**
+	 * テーブルのコメントをデータベースから直接取得する。
+	 * <p>
+	 * {@link #isJdbcCommentAvailable()}が{@code true}を返す場合に利用できます。
+	 * </p>
+	 * 
+	 * @param connection コネクション
+	 * @param catalogName カタログ名
+	 * @param schemaName スキーマ名
+	 * @param tableName テーブル名
+	 * @return テーブルのコメント、存在しない場合{@code null}
+	 * @throws SQLException SQL例外が発生した場合
+	 */
+	String getTableComment(Connection connection, String catalogName, String schemaName, String tableName)
+			throws SQLException;
+	
+	/**
+	 * 列の値が自動的に増分される場合{@code true}を取得する。
+	 * 
+	 * @param connection
+	 *            コネクション
+	 * @param catalogName
+	 *            カタログ名
+	 * @param schemaName
+	 *            スキーマ名
+	 * @param tableName
+	 *            テーブル名
+	 * @param columnName
+	 *            カラム名
+	 * @return 列が自動的に増分される場合{@code true}、そうでない場合{@code false}
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	boolean isAutoIncrement(Connection connection, String catalogName, String schemaName, String tableName,
+			String columnName) throws SQLException;
+	
+	/**
+	 * カラムが存在しない例外を表す場合{@code true}を取得する。
+	 * 
+	 * @param throwable 何らかの例外
+	 * @return カラムが存在しない例外を表す場合{@code true}
+	 */
+	boolean isColumnNotFound(Throwable throwable);
+	
+	/**
+	 * JDBCのコメント取得機能が利用できる場合{@code true}を取得する。
+	 * <p>
+	 * JDBCのコメント取得機能が利用できるとは、次のメソッドでREMARKSカラムの値が取得できることを意味する。
+	 * </p>
+	 * <ul>
+	 * <li>{@link DatabaseMetaData#getTables(String, String, String, String[])}</li>
+	 * <li>{@link DatabaseMetaData#getColumns(String, String, String, String)}</li>
+	 * </ul>
+	 * 
+	 * @return JDBCのコメント取得機能が利用できる場合{@code true}
+	 */
+	boolean isJdbcCommentAvailable();
+	
+	/**
+	 * シーケンスが存在しない例外を表す場合{@code true}を取得する。
+	 * 
+	 * @param throwable 何らかの例外
+	 * @return シーケンスが存在しない例外を表す場合{@code true}
+	 */
+	boolean isSequenceNotFound(Throwable throwable);
+	
+	/**
+	 * テーブルが存在しない例外を表す場合{@code true}を取得する。
+	 * 
+	 * @param throwable 何らかの例外
+	 * @return テーブルが存在しない例外を表す場合{@code true}
+	 */
+	boolean isTableNotFound(Throwable throwable);
+	
+	/**
+	 * クォートで囲みます。
+	 * 
+	 * @param value 値
+	 * @return クォートで囲まれた値
+	 */
+	String quote(String value);
+	
+	/**
+	 * CREATE TABLEでコメントをサポートする場合{@code true}を取得する。
+	 * 
+	 * @return コメントをサポートする場合{@code true}
+	 */
+	boolean supportsCommentInCreateTable();
+	
+	/**
+	 * COMMENT ONをサポートする場合{@code true}を取得する。
+	 * 
+	 * @return COMMENT ONをサポートする場合{@code true}
+	 */
+	boolean supportsCommentOn();
+	
+	/**
+	 * {@link DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean)}
+	 * をサポートする場合{@code true}を取得する。
+	 * 
+	 * @param catalogName カタログ名
+	 * @param schemaName スキーマ名
+	 * @param tableName テーブル名
+	 * @return {@link DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean)}
+	 *         をサポートする場合{@code true}
+	 */
+	boolean supportsGetIndexInfo(String catalogName, String schemaName, String tableName);
+	
+	/**
+	 * IDENTITYカラムをサポートしている場合{@code true}を取得する。
+	 * 
+	 * @return IDENTITYカラムをサポートしている場合{@code true}
+	 */
+	boolean supportsIdentity();
+	
+	/**
+	 * IDENTITYカラムに対するinsertをサポートしている場合{@code true}を取得する。
+	 * 
+	 * @return IDENTITYカラムに対するinsertをサポートしている場合{@code true}
+	 */
+	boolean supportsIdentityInsert();
+	
+	/**
+	 * IDENTITYカラムに対するinsertの有効/無効を制御するステートメントをサポートしている場合{@code true}を取得する。
+	 * 
+	 * @return IDENTITYカラムに対するinsertをサポートしている場合{@code true}
+	 */
+	boolean supportsIdentityInsertControlStatement();
+	
+	/**
+	 * NULLが可能な一意制約をサポートしている場合{@code true}を取得する。
+	 * 
+	 * @return NULLが可能な一意制約をサポートしている場合{@code true}
+	 */
+	boolean supportsNullableUnique();
+	
+	/**
+	 * 参照整合制約の削除規則をサポートする場合{@code true}を取得する。
+	 * 
+	 * @return 参照整合制約の削除規則をサポートする場合{@code true}
+	 */
+	boolean supportsReferentialDeleteRule();
+	
+	/**
+	 * 参照整合制約の更新規則をサポートする場合{@code true}を取得する。
+	 * 
+	 * @return 参照整合制約の更新規則をサポートする場合{@code true}
+	 */
+	boolean supportsReferentialUpdateRule();
+	
+	/**
+	 * シーケンスをサポートする場合{@code true}を取得する。
+	 * 
+	 * @return シーケンスをサポートする場合{@code true}、しない場合{@code false}
+	 */
+	boolean supportsSequence();
+	
+	/**
+	 * クォートを取り除きます。
+	 * 
+	 * @param value 値
+	 * @return クォートが取り除かれた値
+	 */
+	String unquote(String value);
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/GenDialect.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/SqlType.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/SqlType.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/SqlType.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.gen.dialect;
+
+import java.sql.Types;
+
+import org.jiemamy.entity.io.utils.ColumnUtil;
+
+/**
+ * SQL型です。
+ * <p>
+ * JDBCのSQL型、つまり{@link Types}の定数に対応する。
+ * </p>
+ * 
+ * @author j5ik2o
+ */
+public class SqlType {
+	
+	private String dataType;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param dataType データタイプ名
+	 */
+	public SqlType(String dataType) {
+		this.dataType = dataType;
+	}
+	
+	/**
+	 * データ型を取得する。
+	 * 
+	 * @param length 長さ
+	 * @param precision 精度
+	 * @param scale スケール
+	 * @param identity IDENTITYカラムの場合{@code true}
+	 * @return データ型
+	 */
+	public String getDataType(int length, int precision, int scale, boolean identity) {
+		return ColumnUtil.formatDataType(dataType, length, precision, scale);
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/SqlType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/StandardGenDialect.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/StandardGenDialect.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/StandardGenDialect.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,517 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.gen.dialect;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.GenerationType;
+
+import org.jiemamy.entity.io.utils.CaseInsensitiveMap;
+import org.jiemamy.entity.io.utils.ColumnUtil;
+import org.jiemamy.utils.StringUtil;
+
+/**
+ * 標準的な方言をあつかうクラスです。
+ * 
+ * @author j5ik2o
+ */
+public class StandardGenDialect implements GenDialect {
+	
+	/**
+	 * 標準の{@link ColumnType}の実装クラスです。
+	 * 
+	 * @author j5ik2o
+	 */
+	public static class StandardColumnType implements ColumnType {
+		
+		private static final StandardColumnType BIGINT = new StandardColumnType("bigint", Long.class);
+		
+		private static final StandardColumnType BINARY = new StandardColumnType("binary", byte[].class);
+		
+		private static final StandardColumnType BIT = new StandardColumnType("bit", Boolean.class);
+		
+		private static final StandardColumnType BLOB = new StandardColumnType("blob", byte[].class, true);
+		
+		private static final StandardColumnType BOOLEAN = new StandardColumnType("boolean", Boolean.class);
+		
+		private static final StandardColumnType CHAR = new StandardColumnType("char($l)", String.class);
+		
+		private static final StandardColumnType CLOB = new StandardColumnType("clob", String.class, true);
+		
+		private static final StandardColumnType DATE = new StandardColumnType("date", java.sql.Date.class);
+		
+		private static final StandardColumnType DECIMAL = new StandardColumnType("decimal", BigDecimal.class);
+		
+		private static final StandardColumnType DOUBLE = new StandardColumnType("double", Double.class);
+		
+		private static final StandardColumnType FLOAT = new StandardColumnType("float", Float.class);
+		
+		private static final StandardColumnType INTEGER = new StandardColumnType("integer", Integer.class);
+		
+		private static final StandardColumnType LONGVARBINARY = new StandardColumnType("longvarbinary", byte[].class);
+		
+		private static final StandardColumnType LONGVARCHAR = new StandardColumnType("longvarchar", String.class);
+		
+		private static final StandardColumnType NUMERIC = new StandardColumnType("numeric", BigDecimal.class);
+		
+		private static final StandardColumnType REAL = new StandardColumnType("real", Float.class);
+		
+		private static final StandardColumnType SMALLINT = new StandardColumnType("smallint", Short.class);
+		
+		private static final StandardColumnType TIME = new StandardColumnType("time", java.sql.Time.class);
+		
+		private static final StandardColumnType TIMESTAMP = new StandardColumnType("timestamp", Timestamp.class);
+		
+		private static final StandardColumnType TINYINT = new StandardColumnType("tinyint", Short.class);
+		
+		private static final StandardColumnType VARBINARY = new StandardColumnType("varbinary($l)", byte[].class);
+		
+		private static final StandardColumnType VARCHAR = new StandardColumnType("varchar($l)", String.class);
+		
+		/** カラム定義 */
+		protected String dataType;
+		
+		/** 属性のクラス */
+		protected Class<?> attributeClass;
+		
+		/** LOBの場合{@code true} */
+		protected boolean lob;
+		
+
+		/**
+		 * インスタンスを構築する。
+		 * 
+		 * @param dataType データ型
+		 * @param attributeClass 属性のクラス
+		 */
+		protected StandardColumnType(String dataType, Class<?> attributeClass) {
+			this(dataType, attributeClass, false);
+		}
+		
+		/**
+		 * インスタンスを構築する。
+		 * 
+		 * @param dataType カラム定義
+		 * @param attributeClass 属性のクラス
+		 * @param lob LOBの場合{@code true}
+		 */
+		protected StandardColumnType(String dataType, Class<?> attributeClass, boolean lob) {
+			this.dataType = dataType;
+			this.attributeClass = attributeClass;
+			this.lob = lob;
+		}
+		
+		public Class<?> getAttributeClass(int length, int precision, int scale) {
+			return attributeClass;
+		}
+		
+		public String getColumnDefinition(int length, int precision, int scale, String defaultValue) {
+			String completeDataType = ColumnUtil.formatDataType(dataType, length, precision, scale);
+			return getColumnDefinitionInternal(completeDataType, defaultValue);
+		}
+		
+		/**
+		 * カラム定義を取得する。
+		 * 
+		 * @param completeDataType 完全なデータ型
+		 * @param defaultValue デフォルト値、存在しない場合は{@code null}
+		 * @return カラム定義
+		 */
+		protected String getColumnDefinitionInternal(String completeDataType, String defaultValue) {
+			if (defaultValue == null) {
+				return completeDataType;
+			}
+			return completeDataType + " default " + defaultValue;
+		}
+		
+		public boolean isLob() {
+			return lob;
+		}
+		
+	}
+	
+	/**
+	 * 標準の{@link StandardColumnType}の実装クラスです。
+	 * 
+	 * @author j5ik2o
+	 */
+	public static class StandardSqlBlockContext implements SqlBlockContext {
+		
+		/** SQLブロックの開始を表すキーワードの連なりのリスト */
+		protected List<List<String>> sqlBlockStartKeywordsList = new ArrayList<List<String>>();
+		
+		/** 追加されたキーワードの連なり */
+		protected List<String> keywords = new ArrayList<String>();
+		
+		/** SQLブロックの内側の場合{@code true} */
+		protected boolean inSqlBlock;
+		
+
+		public void addKeyword(String keyword) {
+			if (!inSqlBlock) {
+				keywords.add(keyword);
+				check();
+			}
+		}
+		
+		/**
+		 * ブロックの内側かどうかチェックする。
+		 */
+		protected void check() {
+			for (List<String> startKeywords : sqlBlockStartKeywordsList) {
+				if (startKeywords.size() > keywords.size()) {
+					continue;
+				}
+				for (int i = 0; i < startKeywords.size(); i++) {
+					String word1 = startKeywords.get(i);
+					String word2 = keywords.get(i);
+					inSqlBlock = word1.equalsIgnoreCase(word2);
+					if (!inSqlBlock) {
+						break;
+					}
+				}
+				if (inSqlBlock) {
+					break;
+				}
+			}
+		}
+		
+		public boolean isInSqlBlock() {
+			return inSqlBlock;
+		}
+	}
+	
+
+	/** SQL型をキー、{@link SqlType}を値とするマップ */
+	protected Map<Integer, SqlType> sqlTypeMap = new HashMap<Integer, SqlType>();
+	
+	/** カラムの型名をキー、{@link ColumnType}を値とするマップ */
+	@SuppressWarnings("unchecked")
+	protected Map<Object, ColumnType> columnTypeMap = new CaseInsensitiveMap();
+	
+	/** カラムのSQL型をキー、{@link ColumnType}を値とするマップ。 */
+	protected Map<Integer, ColumnType> fallbackColumnTypeMap = new HashMap<Integer, ColumnType>();
+	
+
+	/**
+	 * インスタンスを構築する。
+	 */
+	public StandardGenDialect() {
+		sqlTypeMap.put(Types.BIGINT, new SqlType("bigint"));
+		sqlTypeMap.put(Types.BINARY, new SqlType("binary"));
+		sqlTypeMap.put(Types.BLOB, new SqlType("blob"));
+		sqlTypeMap.put(Types.BOOLEAN, new SqlType("boolean"));
+		sqlTypeMap.put(Types.CHAR, new SqlType("char"));
+		sqlTypeMap.put(Types.CLOB, new SqlType("clob"));
+		sqlTypeMap.put(Types.DATE, new SqlType("clob"));
+		sqlTypeMap.put(Types.DECIMAL, new SqlType("decimal"));
+		sqlTypeMap.put(Types.DOUBLE, new SqlType("double"));
+		sqlTypeMap.put(Types.FLOAT, new SqlType("float"));
+		sqlTypeMap.put(Types.INTEGER, new SqlType("integer"));
+		sqlTypeMap.put(Types.SMALLINT, new SqlType("smallint"));
+		sqlTypeMap.put(Types.TIME, new SqlType("time"));
+		sqlTypeMap.put(Types.TIMESTAMP, new SqlType("timestamp"));
+		sqlTypeMap.put(Types.VARCHAR, new SqlType("varchar"));
+		
+		columnTypeMap.put("bigint", StandardColumnType.BIGINT);
+		columnTypeMap.put("binary", StandardColumnType.BINARY);
+		columnTypeMap.put("bit", StandardColumnType.BIT);
+		columnTypeMap.put("blob", StandardColumnType.BLOB);
+		columnTypeMap.put("boolean", StandardColumnType.BOOLEAN);
+		columnTypeMap.put("char", StandardColumnType.CHAR);
+		columnTypeMap.put("clob", StandardColumnType.CLOB);
+		columnTypeMap.put("date", StandardColumnType.DATE);
+		columnTypeMap.put("decimal", StandardColumnType.DECIMAL);
+		columnTypeMap.put("double", StandardColumnType.DOUBLE);
+		columnTypeMap.put("float", StandardColumnType.FLOAT);
+		columnTypeMap.put("integer", StandardColumnType.INTEGER);
+		columnTypeMap.put("longvarbinary", StandardColumnType.LONGVARBINARY);
+		columnTypeMap.put("longvarchar", StandardColumnType.LONGVARCHAR);
+		columnTypeMap.put("numeric", StandardColumnType.NUMERIC);
+		columnTypeMap.put("real", StandardColumnType.REAL);
+		columnTypeMap.put("smallint", StandardColumnType.SMALLINT);
+		columnTypeMap.put("time", StandardColumnType.TIME);
+		columnTypeMap.put("timestamp", StandardColumnType.TIMESTAMP);
+		columnTypeMap.put("tinyint", StandardColumnType.TINYINT);
+		columnTypeMap.put("varbinary", StandardColumnType.VARBINARY);
+		columnTypeMap.put("varchar", StandardColumnType.VARCHAR);
+		
+		fallbackColumnTypeMap.put(Types.BIGINT, StandardColumnType.BIGINT);
+		fallbackColumnTypeMap.put(Types.BINARY, StandardColumnType.BINARY);
+		fallbackColumnTypeMap.put(Types.BIT, StandardColumnType.BIT);
+		fallbackColumnTypeMap.put(Types.BLOB, StandardColumnType.BLOB);
+		fallbackColumnTypeMap.put(Types.BOOLEAN, StandardColumnType.BOOLEAN);
+		fallbackColumnTypeMap.put(Types.CHAR, StandardColumnType.CHAR);
+		fallbackColumnTypeMap.put(Types.CLOB, StandardColumnType.CLOB);
+		fallbackColumnTypeMap.put(Types.DATE, StandardColumnType.DATE);
+		fallbackColumnTypeMap.put(Types.DECIMAL, StandardColumnType.DECIMAL);
+		fallbackColumnTypeMap.put(Types.DOUBLE, StandardColumnType.DOUBLE);
+		fallbackColumnTypeMap.put(Types.FLOAT, StandardColumnType.FLOAT);
+		fallbackColumnTypeMap.put(Types.INTEGER, StandardColumnType.INTEGER);
+		fallbackColumnTypeMap.put(Types.LONGVARBINARY, StandardColumnType.LONGVARBINARY);
+		fallbackColumnTypeMap.put(Types.LONGVARCHAR, StandardColumnType.LONGVARCHAR);
+		fallbackColumnTypeMap.put(Types.NUMERIC, StandardColumnType.NUMERIC);
+		fallbackColumnTypeMap.put(Types.REAL, StandardColumnType.REAL);
+		fallbackColumnTypeMap.put(Types.SMALLINT, StandardColumnType.SMALLINT);
+		fallbackColumnTypeMap.put(Types.TIME, StandardColumnType.TIME);
+		fallbackColumnTypeMap.put(Types.TIMESTAMP, StandardColumnType.TIMESTAMP);
+		fallbackColumnTypeMap.put(Types.TINYINT, StandardColumnType.TINYINT);
+		fallbackColumnTypeMap.put(Types.VARBINARY, StandardColumnType.VARBINARY);
+		fallbackColumnTypeMap.put(Types.VARCHAR, StandardColumnType.VARCHAR);
+	}
+	
+	public SqlBlockContext createSqlBlockContext() {
+		return new StandardSqlBlockContext();
+	}
+	
+	/**
+	 * 例外チェーンをたどって原因となった{@link SQLException SQL例外}を取得する。
+	 * <p>
+	 * 例外チェーンにSQL例外が存在しない場合は<code>null</code>を取得する。
+	 * </p>
+	 * 
+	 * @param t
+	 *            例外
+	 * @return 原因となった{@link SQLException SQL例外}
+	 */
+	protected SQLException getCauseSQLException(Throwable t) {
+		SQLException cause = null;
+		while (t != null) {
+			if (t instanceof SQLException) {
+				cause = SQLException.class.cast(t);
+				if (cause.getNextException() != null) {
+					cause = cause.getNextException();
+					t = cause;
+					continue;
+				}
+			}
+			t = t.getCause();
+		}
+		return cause;
+	}
+	
+	public String getCloseQuote() {
+		return "\"";
+	}
+	
+	public Map<String, String> getColumnCommentMap(Connection connection, String catalogName, String schemaName,
+			String tableName) throws SQLException {
+		throw new UnsupportedOperationException("getColumnCommentMap");
+	}
+	
+	public ColumnType getColumnType(String typeName, int sqlType) {
+		ColumnType columnType = columnTypeMap.get(typeName);
+		return columnType != null ? columnType : fallbackColumnTypeMap.get(sqlType);
+	}
+	
+	public GenerationType getDefaultGenerationType() {
+		return GenerationType.TABLE;
+	}
+	
+	public String getDefaultSchemaName(String userName) {
+		return userName;
+	}
+	
+	public String getDropForeignKeySyntax() {
+		return "drop constraint";
+	}
+	
+	public String getDropUniqueKeySyntax() {
+		return "drop constraint";
+	}
+	
+	/**
+	 * 例外チェーンをたどって原因となった{@link SQLException#getErrorCode() ベンダー固有の例外コード}を取得する。
+	 * <p>
+	 * 例外チェーンに{@link SQLException SQL例外}が存在しない場合や、例外コードが設定されていない場合は
+	 * <code>null</code>を取得する。
+	 * </p>
+	 * 
+	 * @param t 例外
+	 * @return 原因となった{@link SQLException#getErrorCode() ベンダー固有の例外コード}
+	 */
+	protected Integer getErrorCode(Throwable t) {
+		SQLException cause = getCauseSQLException(t);
+		if (cause != null) {
+			return cause.getErrorCode();
+		}
+		return null;
+	}
+	
+	public String getIdentityColumnDefinition() {
+		throw new UnsupportedOperationException("getIdentityDefinition");
+	}
+	
+	public String getIdentityInsertDisableStatement(String tableName) {
+		throw new UnsupportedOperationException("getIdentityInsertOffStatement");
+	}
+	
+	public String getIdentityInsertEnableStatement(String tableName) {
+		throw new UnsupportedOperationException("getIdentityInsertOnStatement");
+	}
+	
+	public String getName() {
+		return null;
+	}
+	
+	public String getOpenQuote() {
+		return "\"";
+	}
+	
+	public String getSequenceDefinitionFragment(String dataType, long initialValue, int allocationSize) {
+		throw new UnsupportedOperationException("getSequenceDefinitionFragment");
+	}
+	
+	public String getSequenceNextValString(final String sequenceName, final int allocationSize) {
+		throw new UnsupportedOperationException("getSequenceNextValString");
+	}
+	
+	public String getSqlBlockDelimiter() {
+		return null;
+	}
+	
+	/**
+	 * 例外チェーンをたどって原因となった{@link SQLException#getSQLState() SQLステート}を取得する。
+	 * <p>
+	 * 例外チェーンに{@link SQLException SQL例外}が存在しない場合や、SQLステートが設定されていない場合は
+	 * <code>null</code>を取得する。
+	 * </p>
+	 * 
+	 * @param t 例外
+	 * @return 原因となった{@link SQLException#getSQLState() SQLステート}
+	 */
+	protected String getSQLState(Throwable t) {
+		SQLException cause = getCauseSQLException(t);
+		if (cause != null && !StringUtil.isEmpty(cause.getSQLState())) {
+			return cause.getSQLState();
+		}
+		return null;
+	}
+	
+	public SqlType getSqlType(int sqlType) throws UnsupportedSqlTypeException {
+		return getSqlTypeInternal(sqlType);
+	}
+	
+//	public SqlType getSqlType(ValueTypeProvider valueTypeProvider, PropertyMeta propertyMeta)
+//			throws UnsupportedSqlTypeException {
+//		ValueType valueType = valueTypeProvider.provide(propertyMeta);
+//		return getSqlTypeInternal(valueType.getSqlType());
+//	}
+	
+	/**
+	 * 内部的にSQL型を取得する。
+	 * 
+	 * @param sqlType JDBCのSQL型
+	 * @return SQL型
+	 * @throws UnsupportedSqlTypeException 
+	 */
+	protected SqlType getSqlTypeInternal(int sqlType) throws UnsupportedSqlTypeException {
+		SqlType type = sqlTypeMap.get(sqlType);
+		if (type != null) {
+			return type;
+		}
+		throw new UnsupportedSqlTypeException(sqlType);
+	}
+	
+	public String getTableComment(Connection connection, String catalogName, String schemaName, String tableName)
+			throws SQLException {
+		throw new UnsupportedOperationException("getTableComment");
+	}
+	
+	public boolean isAutoIncrement(Connection connection, String catalogName, String schemaName, String tableName,
+			String columnName) throws SQLException {
+		return true;
+	}
+	
+	public boolean isColumnNotFound(Throwable throwable) {
+		return false;
+	}
+	
+	public boolean isJdbcCommentAvailable() {
+		return true;
+	}
+	
+	public boolean isSequenceNotFound(Throwable throwable) {
+		return false;
+	}
+	
+	public boolean isTableNotFound(Throwable throwable) {
+		return false;
+	}
+	
+	public String quote(String value) {
+		if (value == null) {
+			return null;
+		}
+		return getOpenQuote() + value + getCloseQuote();
+	}
+	
+	public boolean supportsCommentInCreateTable() {
+		return false;
+	}
+	
+	public boolean supportsCommentOn() {
+		return false;
+	}
+	
+	public boolean supportsGetIndexInfo(String catalogName, String schemaName, String tableName) {
+		return true;
+	}
+	
+	public boolean supportsIdentity() {
+		return false;
+	}
+	
+	public boolean supportsIdentityInsert() {
+		return false;
+	}
+	
+	public boolean supportsIdentityInsertControlStatement() {
+		return false;
+	}
+	
+	public boolean supportsNullableUnique() {
+		return true;
+	}
+	
+	public boolean supportsReferentialDeleteRule() {
+		return true;
+	}
+	
+	public boolean supportsReferentialUpdateRule() {
+		return true;
+	}
+	
+	public boolean supportsSequence() {
+		return false;
+	}
+	
+	public String unquote(String value) {
+		String s = StringUtil.ltrim(value, getOpenQuote());
+		return StringUtil.rtrim(s, getCloseQuote());
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/StandardGenDialect.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/UnsupportedSqlTypeException.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/UnsupportedSqlTypeException.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/UnsupportedSqlTypeException.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 14, 2009
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.gen.dialect;
+
+/**
+ * TODO for kato
+ * 
+ * @author kato
+ */
+public class UnsupportedSqlTypeException extends Exception {
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 */
+	public UnsupportedSqlTypeException() {
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param sqlType
+	 */
+	public UnsupportedSqlTypeException(int sqlType) {
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message
+	 */
+	public UnsupportedSqlTypeException(String message) {
+		super(message);
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param message
+	 * @param cause
+	 */
+	public UnsupportedSqlTypeException(String message, Throwable cause) {
+		super(message, cause);
+	}
+	
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param cause
+	 */
+	public UnsupportedSqlTypeException(Throwable cause) {
+		super(cause);
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/UnsupportedSqlTypeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/ValueType.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/ValueType.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/ValueType.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.gen.dialect;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * S2JDBC用の値の型をあらわすインターフェースです。
+ * 
+ * @author j5ik2o
+ * 
+ */
+public interface ValueType {
+	
+	/**
+	 * 変数の値をバインドする。
+	 * 
+	 * @param cs
+	 *            ストアドプロシージャを表す文
+	 * @param parameterName
+	 *            パラメータ名
+	 * @param value
+	 *            値
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	void bindValue(CallableStatement cs, String parameterName, Object value) throws SQLException;
+	
+	/**
+	 * 変数の値をバインドする。
+	 * 
+	 * @param ps
+	 *            準備されたSQL文
+	 * @param index
+	 *            位置
+	 * @param value
+	 *            値
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	void bindValue(PreparedStatement ps, int index, Object value) throws SQLException;
+	
+	/**
+	 * JDBCのSQL型を取得する。
+	 * 
+	 * @return JDBCのSQL型
+	 */
+	int getSqlType();
+	
+	/**
+	 * パラメータの値を取得する。
+	 * 
+	 * @param cs
+	 *            ストアドプロシージャを表す文
+	 * @param index
+	 *            位置
+	 * @return パラメータの値
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	Object getValue(CallableStatement cs, int index) throws SQLException;
+	
+	/**
+	 * パラメータの値を取得する。
+	 * 
+	 * @param cs
+	 *            ストアドプロシージャを表す文
+	 * @param parameterName
+	 *            パラメータ名
+	 * @return パラメータの値
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	Object getValue(CallableStatement cs, String parameterName) throws SQLException;
+	
+	/**
+	 * カラムの値を取得する。
+	 * 
+	 * @param resultSet
+	 *            結果セット
+	 * @param index
+	 *            位置
+	 * @return カラムの値
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	Object getValue(ResultSet resultSet, int index) throws SQLException;
+	
+	/**
+	 * カラムの値を取得する。
+	 * 
+	 * @param resultSet
+	 *            結果セット
+	 * @param columnName
+	 *            カラム名
+	 * @return カラムの値
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	Object getValue(ResultSet resultSet, String columnName) throws SQLException;
+	
+	/**
+	 * OUTパラメータを登録する。
+	 * 
+	 * @param cs
+	 *            ストアドプロシージャを表す文
+	 * @param index
+	 *            位置
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	void registerOutParameter(CallableStatement cs, int index) throws SQLException;
+	
+	/**
+	 * OUTパラメータを登録する。
+	 * 
+	 * @param cs
+	 *            ストアドプロシージャを表す文
+	 * @param parameterName
+	 *            パラメータ名
+	 * @throws SQLException
+	 *             SQL例外が発生した場合
+	 */
+	void registerOutParameter(CallableStatement cs, String parameterName) throws SQLException;
+	
+	/**
+	 * 変数の値を文字列表現に変換する。
+	 * 
+	 * @param value
+	 *            値
+	 * @return 値の文字列表現
+	 */
+	String toText(Object value);
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/dialect/ValueType.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/GeneratorImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/GeneratorImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/GeneratorImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -53,7 +53,7 @@
 	private Configuration configuration;
 	
 	/** デフォルトのテンプレートディレクトリの名前 */
-	protected static final String DEFAULT_TEMPLATE_DIR_NAME = "org/jiemamy/entity/io/tempaltes";
+	protected static final String DEFAULT_TEMPLATE_DIR_NAME = "org/jiemamy/entity/io/templates";
 	
 
 	/**
@@ -137,8 +137,10 @@
 			Template template = getTemplate(context.getTemplateName());
 			process(template, context.getModel(), writer);
 		} catch (TemplateException e) {
+			e.printStackTrace();
 			throw new GenerateException(e);
 		} catch (IOException e) {
+			e.printStackTrace();
 			throw new GenerateException(e);
 		} finally {
 			if (writer != null) {
@@ -181,7 +183,7 @@
 	}
 	
 	/**
-	 * ディレクトリを生成します。
+	 * ディレクトリを生成する。
 	 * 
 	 * @param dir ディレクトリ
 	 */
@@ -205,7 +207,7 @@
 	}
 	
 	/**
-	 * テンプレートを処理します。
+	 * テンプレートを処理する。
 	 * 
 	 * @param template テンプレート
 	 * @param dataModel データモデル

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/ResourceTemplateLoader.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/ResourceTemplateLoader.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/generator/impl/ResourceTemplateLoader.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -55,7 +55,8 @@
 	protected URL getURL(String name) {
 		Validate.notNull(name);
 		String path = basePath + "/" + name;
-		return ResourceUtil.getResourceNoException(path);
+		URL result = ResourceUtil.getResourceNoException(path);
+		return result;
 	}
 	
 }

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/meta/DbColumnMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/meta/DbColumnMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/meta/DbColumnMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -123,7 +123,7 @@
 	}
 	
 	/**
-	 * 値が自動的に増分される場合{@code true}を返します。
+	 * 値が自動的に増分される場合{@code true}を取得する。
 	 * 
 	 * @return 値が自動的に増分される場合{@code true}、そうでない場合{@code false}
 	 */
@@ -132,7 +132,7 @@
 	}
 	
 	/**
-	 * NULL可能の場合{@code true}を返します。
+	 * NULL可能の場合{@code true}を取得する。
 	 * 
 	 * @return NULL可能の場合{@code true}、そうでない場合{@code false}
 	 */
@@ -141,7 +141,7 @@
 	}
 	
 	/**
-	 * 主キーの場合{@code true}を返します。
+	 * 主キーの場合{@code true}を取得する。
 	 * 
 	 * @return 主キーの場合{@code true}、そうでない場合{@code false}
 	 */
@@ -150,7 +150,7 @@
 	}
 	
 	/**
-	 * 一意の場合{@code true}、そうでない場合{@code false}を返します。
+	 * 一意の場合{@code true}、そうでない場合{@code false}を取得する。
 	 * 
 	 * @return 一意の場合{@code true}、そうでない場合{@code false}
 	 */
@@ -159,7 +159,7 @@
 	}
 	
 	/**
-	 * 値が自動的に増分される場合{@code true}を設定します。
+	 * 値が自動的に増分される場合{@code true}を設定する。
 	 * 
 	 * @param autoIncrement 値が自動的に増分される場合{@code true}、そうでない場合{@code false}
 	 */
@@ -168,7 +168,7 @@
 	}
 	
 	/**
-	 * コメントを設定します。
+	 * コメントを設定する。
 	 * 
 	 * @param comment コメント
 	 */
@@ -177,7 +177,7 @@
 	}
 	
 	/**
-	 * デフォルト値を設定します
+	 * デフォルト値を設定する
 	 * 
 	 * @param defaultValue デフォルト値
 	 */
@@ -186,7 +186,7 @@
 	}
 	
 	/**
-	 * 長さを設定します。
+	 * 長さを設定する。
 	 * 
 	 * @param length 長さ
 	 */
@@ -195,7 +195,7 @@
 	}
 	
 	/**
-	 * 名前を設定します。
+	 * 名前を設定する。
 	 * 
 	 * @param name 名前
 	 */
@@ -204,7 +204,7 @@
 	}
 	
 	/**
-	 * NULL可能の場合{@code true}を設定します。
+	 * NULL可能の場合{@code true}を設定する。
 	 * 
 	 * @param nullable NULL可能の場合{@code true}
 	 */
@@ -213,7 +213,7 @@
 	}
 	
 	/**
-	 * 主キーの場合 {@code true}を設定します。
+	 * 主キーの場合 {@code true}を設定する。
 	 * 
 	 * @param primaryKey 主キーの場合 {@code true}
 	 * 
@@ -223,7 +223,7 @@
 	}
 	
 	/**
-	 * スケールを設定します。
+	 * スケールを設定する。
 	 * 
 	 * @param scale スケール
 	 */
@@ -232,7 +232,7 @@
 	}
 	
 	/**
-	 * SQL型をセットします。
+	 * SQL型をセットする。
 	 * 
 	 * @param sqlType SQL型
 	 */
@@ -241,7 +241,7 @@
 	}
 	
 	/**
-	 * SQL型の名前を設定します。
+	 * SQL型の名前を設定する。
 	 * 
 	 * @param typeName SQL型の名前
 	 */
@@ -250,7 +250,7 @@
 	}
 	
 	/**
-	 * 一意の場合{@code true}、そうでない場合{@code false}を設定します。
+	 * 一意の場合{@code true}、そうでない場合{@code false}を設定する。
 	 * 
 	 * @param unique 一意の場合{@code true}
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AssociationModel.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -46,7 +46,7 @@
 	
 
 	/**
-	 * 関連タイプを返します。
+	 * 関連タイプを取得する。
 	 * 
 	 * @return 関連タイプ
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/AttributeModel.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -368,7 +368,7 @@
 	}
 	
 	/**
-	 * 名前を設定します。
+	 * 名前を設定する。
 	 * 
 	 * @param name 名前
 	 */
@@ -377,7 +377,7 @@
 	}
 	
 	/**
-	 * NULL可能の場合{@code true}を設定します。
+	 * NULL可能の場合{@code true}を設定する。
 	 * 
 	 * @param nullable NULL可能の場合{@code true}
 	 */
@@ -386,7 +386,7 @@
 	}
 	
 	/**
-	 * 精度を設定します。
+	 * 精度を設定する。
 	 * 
 	 * @param precision 精度
 	 */
@@ -395,7 +395,7 @@
 	}
 	
 	/**
-	 * スケールを設定します。
+	 * スケールを設定する。
 	 * 
 	 * @param scale スケール
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/JoinColumnsModel.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -44,7 +44,7 @@
 	/**
 	 * 結合カラムモデルのリストを取得する。
 	 * 
-	 * @return 結合カラムモデルのリストを設定します。
+	 * @return 結合カラムモデルのリストを設定する。
 	 */
 	public List<JoinColumnModel> getJoinColumnModelList() {
 		return Collections.unmodifiableList(joinColumnModelList);

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AssociationModelFactoryImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -29,7 +29,7 @@
 /**
  * {@link AssociationModelFactory}の実装クラスです。
  * 
- * @author taedium
+ * @author j5ik2o
  */
 public class AssociationModelFactoryImpl implements AssociationModelFactory {
 	
@@ -38,7 +38,7 @@
 	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param showJoinColumn
 	 *            {@link JoinColumn}を表示する場合{@code true}
@@ -48,7 +48,7 @@
 	}
 	
 	/**
-	 * 結合カラムモデルを処理します。
+	 * 結合カラムモデルを処理する。
 	 * 
 	 * @param associationModel
 	 *            関連モデル
@@ -68,7 +68,7 @@
 	}
 	
 	/**
-	 * 複合結合カラムモデルを処理します。
+	 * 複合結合カラムモデルを処理する。
 	 * 
 	 * @param associationModel
 	 *            関連モデル
@@ -109,7 +109,7 @@
 	}
 	
 	/**
-	 * 結合カラムのデフォルトのマッピングルールに合致する場合{@code true}を返します。
+	 * 結合カラムのデフォルトのマッピングルールに合致する場合{@code true}を取得する。
 	 * 
 	 * @param propertyName
 	 *            プロパティ名

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/AttributeModelFactoryImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -47,7 +47,7 @@
 	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param showColumnName
 	 *            カラム名を表示する場合{@code true}
@@ -65,7 +65,7 @@
 	}
 	
 	/**
-	 * 属性のクラスを処理します。
+	 * 属性のクラスを処理する。
 	 * 
 	 * @param attributeModel 属性モデル
 	 * @param attributeDesc 属性記述
@@ -80,7 +80,7 @@
 	}
 	
 	/**
-	 * カラム定義を処理します。
+	 * カラム定義を処理する。
 	 * 
 	 * @param attributeModel
 	 *            属性モデル
@@ -93,7 +93,7 @@
 	}
 	
 	/**
-	 * カラム名を処理します。
+	 * カラム名を処理する。
 	 * 
 	 * @param attributeModel
 	 *            属性モデル
@@ -109,7 +109,7 @@
 	}
 	
 	/**
-	 * 長さを処理します。
+	 * 長さを処理する。
 	 * 
 	 * @param attributeModel
 	 *            属性モデル
@@ -128,7 +128,7 @@
 	}
 	
 	/**
-	 * 精度を処理します。
+	 * 精度を処理する。
 	 * 
 	 * @param attributeModel
 	 *            属性モデル
@@ -146,7 +146,7 @@
 	}
 	
 	/**
-	 * スケールを処理します。
+	 * スケールを処理する。
 	 * 
 	 * @param attributeModel
 	 *            属性モデル

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/ClassModelSupport.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/ClassModelSupport.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/ClassModelSupport.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -100,7 +100,7 @@
 	}
 	
 	/**
-	 * staticインポートが必要なパッケージの場合{@code true}を返します。
+	 * staticインポートが必要なパッケージの場合{@code true}を取得する。
 	 * 
 	 * @param classModel クラスモデル
 	 * @param importPackageName インポートするパッケージ名

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/EntityModelFactoryImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/EntityModelFactoryImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/gen/model/impl/EntityModelFactoryImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -56,7 +56,7 @@
 /**
  * {@link EntityModelFactory}の実装クラスです。
  * 
- * @author taedium
+ * @author j5ik2o
  */
 public class EntityModelFactoryImpl implements EntityModelFactory {
 	
@@ -103,7 +103,7 @@
 	
 
 	/**
-	 * インスタンスを構築しますl
+	 * インスタンスを構築するl
 	 * 
 	 * @param packageName
 	 *            パッケージ名、デフォルトパッケージの場合は{@code null}
@@ -157,7 +157,7 @@
 	}
 	
 	/**
-	 * 関連モデルを処理します。
+	 * 関連モデルを処理する。
 	 * 
 	 * @param entityModel エンティティモデル
 	 * @param entityDesc エンティティ記述
@@ -173,7 +173,7 @@
 	}
 	
 	/**
-	 * 属性モデルを処理します。
+	 * 属性モデルを処理する。
 	 * 
 	 * @param entityModel
 	 *            エンティティモデル
@@ -191,7 +191,7 @@
 	}
 	
 	/**
-	 * 複合一意制約モデルを処理します。
+	 * 複合一意制約モデルを処理する。
 	 * 
 	 * @param entityModel
 	 *            エンティティモデル
@@ -208,7 +208,7 @@
 	}
 	
 	/**
-	 * 生成情報を処理します。
+	 * 生成情報を処理する。
 	 * 
 	 * @param entityModel
 	 *            エンティティモデル
@@ -220,7 +220,7 @@
 	}
 	
 	/**
-	 * インポート名を処理します。
+	 * インポート名を処理する。
 	 * 
 	 * @param model エンティティクラスのモデル
 	 * @param entityDesc エンティティ記述

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/ColumnMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/ColumnMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/ColumnMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -113,7 +113,7 @@
 	}
 	
 	/**
-	 * 更新可能フラグを返します。
+	 * 更新可能フラグを取得する。
 	 * 
 	 * @return trueの場合は更新可能
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterContext.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterContext.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterContext.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -23,6 +23,8 @@
 
 import javax.persistence.GenerationType;
 
+import org.jiemamy.entity.io.gen.dialect.GenDialect;
+
 /**
  * TODO for kato
  * 
@@ -80,11 +82,17 @@
 	
 	private Class<?> entitySuperClass;
 	
+	private GenDialect dialect;
+	
 
 	public Integer getAllocationSize() {
 		return allocationSize;
 	}
 	
+	public GenDialect getDialect() {
+		return dialect;
+	}
+	
 	public String getEntityPackageName() {
 		return entityPackageName;
 	}
@@ -199,6 +207,10 @@
 		this.applyDbCommentToJava = applyDbCommentToJava;
 	}
 	
+	public void setDialect(GenDialect dialect) {
+		this.dialect = dialect;
+	}
+	
 	/**
 	 * TODO for kato
 	 * 

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterFactory.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/DefaultEntityMetaWriterFactory.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -20,6 +20,7 @@
 
 import org.apache.commons.lang.Validate;
 
+import org.jiemamy.entity.io.gen.desc.impl.IdentityNotSupportedException;
 import org.jiemamy.entity.io.meta.impl.EntityMetaWriterImpl;
 
 /**
@@ -29,7 +30,8 @@
  */
 public class DefaultEntityMetaWriterFactory implements EntityMetaWriterFactory {
 	
-	public EntityMetaWriter createEntityMetaWriter(EntityMetaWriterContext entityMetaWriterContext) {
+	public EntityMetaWriter createEntityMetaWriter(EntityMetaWriterContext entityMetaWriterContext)
+			throws IdentityNotSupportedException {
 		Validate.notNull(entityMetaWriterContext);
 		return new EntityMetaWriterImpl(entityMetaWriterContext);
 	}

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -123,7 +123,7 @@
 	}
 	
 	/**
-	 * カラムに結びつく全てのプロパティメタデータの{@link Iterable}を返します。
+	 * カラムに結びつく全てのプロパティメタデータの{@link Iterable}を取得する。
 	 * 
 	 * @return カラムに結びつく全てのプロパティメタデータの{@link Iterable}
 	 */
@@ -183,7 +183,7 @@
 	}
 	
 	/**
-	 * カラムに結びつくプロパティメタデータを返します。
+	 * カラムに結びつくプロパティメタデータを取得する。
 	 * 
 	 * @param index カラムインデックス
 	 * @return プロパティメタデータ
@@ -227,7 +227,7 @@
 	}
 	
 	/**
-	 * MappedByで注釈されているプロパティメタデータを返します。
+	 * MappedByで注釈されているプロパティメタデータを取得する。
 	 * 
 	 * @param mappedBy 関連の所有者側のプロパティ名
 	 * @param relationshipClass 関連クラス
@@ -251,7 +251,7 @@
 	}
 	
 	/**
-	 * プロパティメタデータを返します。
+	 * プロパティメタデータを取得する。
 	 * 
 	 * @param index インデックス
 	 * @return プロパティメタデータ
@@ -276,7 +276,7 @@
 	}
 	
 	/**
-	 * プロパティメタデータの数を返します。
+	 * プロパティメタデータの数を取得する。
 	 * 
 	 * @return プロパティメタデータの数
 	 */
@@ -323,7 +323,7 @@
 	}
 	
 	/**
-	 * バージョンを表すプロパティメタデータがあれば<code>true</code>を返します。
+	 * バージョンを表すプロパティメタデータがあれば<code>true</code>を取得する。
 	 * 
 	 * @return バージョンを表すプロパティメタデータがあれば<code>true</code>
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaCommand.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaCommand.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaCommand.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -28,7 +28,7 @@
 public interface EntityMetaCommand {
 	
 	/**
-	 * {@link EntityMeta}を処理します。
+	 * {@link EntityMeta}を処理する。
 	 * 
 	 * @param entityMetaList {@link EntityMeta}のリスト
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaReaderFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaReaderFactory.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaReaderFactory.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -26,7 +26,7 @@
 public interface EntityMetaReaderFactory {
 	
 	/**
-	 * {@link EntityMetaReader}を生成します。
+	 * {@link EntityMetaReader}を生成する。
 	 * 
 	 * @param entityMetaReaderContext {@link EntityMetaReaderContext}
 	 * @return {@link EntityMetaReader}

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterContext.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterContext.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterContext.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -23,6 +23,8 @@
 
 import javax.persistence.GenerationType;
 
+import org.jiemamy.entity.io.gen.dialect.GenDialect;
+
 /**
  * {@link EntityMetaWriter}のコンテキストインターフェイス。
  * 
@@ -38,6 +40,13 @@
 	Integer getAllocationSize();
 	
 	/**
+	 * TODO for kato
+	 * 
+	 * @return
+	 */
+	GenDialect getDialect();
+	
+	/**
 	 * エンティティクラスのパッケージ名を取得する。
 	 * 
 	 * @return エンティティクラス

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterFactory.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterFactory.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/EntityMetaWriterFactory.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -18,6 +18,8 @@
  */
 package org.jiemamy.entity.io.meta;
 
+import org.jiemamy.entity.io.gen.desc.impl.IdentityNotSupportedException;
+
 /**
  * {@link EntityMetaWriter}用のファクトリインターフェイス。
  * 
@@ -26,10 +28,12 @@
 public interface EntityMetaWriterFactory {
 	
 	/**
-	 * {@link EntityMetaWriter}を生成します。
+	 * {@link EntityMetaWriter}を生成する。
 	 * 
 	 * @param entityMetaWriterContext {@link EntityMetaWriterContext}
 	 * @return {@link EntityMetaWriter}
+	 * @throws IdentityNotSupportedException 
 	 */
-	EntityMetaWriter createEntityMetaWriter(EntityMetaWriterContext entityMetaWriterContext);
+	EntityMetaWriter createEntityMetaWriter(EntityMetaWriterContext entityMetaWriterContext)
+			throws IdentityNotSupportedException;
 }

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/PropertyMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/PropertyMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/PropertyMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -271,7 +271,7 @@
 	}
 	
 	/**
-	 * 識別子を自動生成するIDジェネレータを設定します。
+	 * 識別子を自動生成するIDジェネレータを設定する。
 	 * 
 	 * @return 識別子を自動生成するIDジェネレータ
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/TableMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/TableMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/TableMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -76,7 +76,7 @@
 	}
 	
 	/**
-	 * 名前を返します。
+	 * 名前を取得する。
 	 * 
 	 * @return 名前
 	 */
@@ -85,7 +85,7 @@
 	}
 	
 	/**
-	 * スキーマを返します。
+	 * スキーマを取得する。
 	 * 
 	 * @return スキーマ
 	 */
@@ -94,7 +94,7 @@
 	}
 	
 	/**
-	 * カタログを設定します。
+	 * カタログを設定する。
 	 * 
 	 * @param catalog カタログ
 	 */
@@ -112,7 +112,7 @@
 	}
 	
 	/**
-	 * 名前を設定します。
+	 * 名前を設定する。
 	 * 
 	 * @param name 名前
 	 */
@@ -121,7 +121,7 @@
 	}
 	
 	/**
-	 * スキーマを設定します。
+	 * スキーマを設定する。
 	 * 
 	 * @param schema スキーマ
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractIdGeneratorMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractIdGeneratorMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractIdGeneratorMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -36,7 +36,7 @@
 	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param entityMeta エンティティメタデータ
 	 * @param propertyMeta プロパティメタデータ

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractPreAllocateIdGeneratorMeta.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractPreAllocateIdGeneratorMeta.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/generator/AbstractPreAllocateIdGeneratorMeta.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -39,7 +39,7 @@
 	
 
 	/**
-	 * インスタンスを構築します。
+	 * インスタンスを構築する。
 	 * 
 	 * @param entityMeta エンティティメタデータ
 	 * @param propertyMeta プロパティメタデータ

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaReaderImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaReaderImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaReaderImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -79,7 +79,7 @@
 	}
 	
 	/**
-	 * クラスローダを生成します。
+	 * クラスローダを生成する。
 	 * 
 	 * @return {@link ClassLoader}
 	 * @throws IOException 入出力が失敗した場合
@@ -171,7 +171,7 @@
 	}
 	
 	/**
-	 * コメントを読みコメントをメタデータに設定します。
+	 * コメントを読みコメントをメタデータに設定する。
 	 * 
 	 * @param entityMetaList エンティティメタデータのリスト
 	 * @throws IOException 入出力が失敗した場合

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImpl.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -31,6 +31,7 @@
 import org.jiemamy.entity.io.gen.desc.impl.AttributeDescFactoryImpl;
 import org.jiemamy.entity.io.gen.desc.impl.CompositeUniqueConstraintDescFactoryImpl;
 import org.jiemamy.entity.io.gen.desc.impl.EntityDescFactoryImpl;
+import org.jiemamy.entity.io.gen.desc.impl.IdentityNotSupportedException;
 import org.jiemamy.entity.io.gen.generator.GenerateException;
 import org.jiemamy.entity.io.gen.generator.Generator;
 import org.jiemamy.entity.io.gen.generator.impl.GeneratorContextImpl;
@@ -47,6 +48,7 @@
 import org.jiemamy.entity.io.gen.model.impl.EntityModelFactoryImpl;
 import org.jiemamy.entity.io.meta.EntityMetaWriter;
 import org.jiemamy.entity.io.meta.EntityMetaWriterContext;
+import org.jiemamy.entity.io.utils.FileUtil;
 import org.jiemamy.utils.ClassUtil;
 import org.jiemamy.utils.StringUtil;
 
@@ -70,16 +72,17 @@
 	 * インスタンスを生成する。
 	 * 
 	 * @param entityMetaWriterContext {@link EntityMetaWriterContext}
+	 * @throws IdentityNotSupportedException 
 	 */
-	public EntityMetaWriterImpl(EntityMetaWriterContext entityMetaWriterContext) {
+	public EntityMetaWriterImpl(EntityMetaWriterContext entityMetaWriterContext) throws IdentityNotSupportedException {
 		Validate.notNull(entityMetaWriterContext);
 		Validate.notNull(entityMetaWriterContext.getJavaSrcFileEncoding());
 		Validate.notNull(entityMetaWriterContext.getTemplateName());
 		this.entityMetaWriterContext = entityMetaWriterContext;
 		AttributeDescFactory attributeDescFactory =
-				new AttributeDescFactoryImpl(entityMetaWriterContext.getVersionColumnNamePattern(),
-						entityMetaWriterContext.getIdGenerationType(), entityMetaWriterContext.getInitialValue(),
-						entityMetaWriterContext.getAllocationSize());
+				new AttributeDescFactoryImpl(entityMetaWriterContext.getDialect(), entityMetaWriterContext
+					.getVersionColumnNamePattern(), entityMetaWriterContext.getIdGenerationType(),
+						entityMetaWriterContext.getInitialValue(), entityMetaWriterContext.getAllocationSize());
 		CompositeUniqueConstraintDescFactory compositeUniqueConstraintDescFactory =
 				new CompositeUniqueConstraintDescFactoryImpl();
 		entityDescFactory = new EntityDescFactoryImpl(attributeDescFactory, compositeUniqueConstraintDescFactory);
@@ -114,14 +117,22 @@
 		context.setEncoding(entityMetaWriterContext.getJavaSrcFileEncoding());
 		context.setOverwrite(entityMetaWriterContext.isOverwrite());
 		context.setTemplateName(entityMetaWriterContext.getTemplateName());
+		
+		String packageName =
+				ClassUtil.concatName(entityMetaWriterContext.getRootPackageName(), entityMetaWriterContext
+					.getEntityPackageName());
+		
 		for (DbTableMeta tableMeta : tableMetaList) {
-			String fileName = String.format("%s.java", StringUtil.camelize(tableMeta.getName()));
-			context.setFile(new File(fileName));
+			File file =
+					FileUtil.createJavaFile(entityMetaWriterContext.getJavaSrcFileDestDir(), packageName, StringUtil
+						.camelize(tableMeta.getName()));
+			context.setFile(file);
 			Object model = convertModel(tableMeta);
 			context.setModel(model);
 			try {
 				generator.generate(context);
 			} catch (GenerateException e) {
+				e.printStackTrace();
 				throw new IOException();
 			}
 		}

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/AnnotationUtil.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -67,7 +67,7 @@
 	
 
 	/**
-	 * デフォルトの{@link Column}を返します。
+	 * デフォルトの{@link Column}を取得する。
 	 * 
 	 * @return デフォルトの{@link Column}
 	 */
@@ -76,7 +76,7 @@
 	}
 	
 	/**
-	 * デフォルトの{@link ReferentialConstraint}を返します。
+	 * デフォルトの{@link ReferentialConstraint}を取得する。
 	 * 
 	 * @return デフォルトの{@link ReferentialConstraint}
 	 */
@@ -85,7 +85,7 @@
 	}
 	
 	/**
-	 * デフォルトの{@link SequenceGenerator}を返します。
+	 * デフォルトの{@link SequenceGenerator}を取得する。
 	 * 
 	 * @return デフォルトの{@link SequenceGenerator}
 	 */
@@ -94,7 +94,7 @@
 	}
 	
 	/**
-	 * デフォルトの{@link Table}を返します。
+	 * デフォルトの{@link Table}を取得する。
 	 * 
 	 * @return デフォルトの{@link Table}
 	 */
@@ -103,7 +103,7 @@
 	}
 	
 	/**
-	 * デフォルトの{@link TableGenerator}を返します。
+	 * デフォルトの{@link TableGenerator}を取得する。
 	 * 
 	 * @return デフォルトの{@link TableGenerator}
 	 */

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveMap.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -38,14 +38,14 @@
 	}
 	
 	/**
-	 * {@link CaseInsensitiveMap}を作成します。
+	 * {@link CaseInsensitiveMap}を作成する。
 	 */
 	public CaseInsensitiveMap() {
 		super();
 	}
 	
 	/**
-	 * {@link CaseInsensitiveMap}を作成します。
+	 * {@link CaseInsensitiveMap}を作成する。
 	 * 
 	 * @param capacity
 	 */
@@ -59,7 +59,7 @@
 	}
 	
 	/**
-	 * キーが含まれているかどうかを返します。
+	 * キーが含まれているかどうかを取得する。
 	 * 
 	 * @param key
 	 * @return キーが含まれているかどうか

Modified: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/CaseInsensitiveSet.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -28,7 +28,7 @@
 /**
  * 大文字小文字を気にしない {@link Set}です。
  * 
- * @author higa
+ * @author j5ik2o
  * 
  */
 @SuppressWarnings("unchecked")
@@ -42,14 +42,14 @@
 	
 
 	/**
-	 * {@link CaseInsensitiveSet}を作成します。
+	 * {@link CaseInsensitiveSet}を作成する。
 	 */
 	public CaseInsensitiveSet() {
 		map = new CaseInsensitiveMap();
 	}
 	
 	/**
-	 * {@link CaseInsensitiveSet}を作成します。
+	 * {@link CaseInsensitiveSet}を作成する。
 	 * 
 	 * @param c
 	 */
@@ -59,7 +59,7 @@
 	}
 	
 	/**
-	 * {@link CaseInsensitiveSet}を作成します。
+	 * {@link CaseInsensitiveSet}を作成する。
 	 * 
 	 * @param initialCapacity
 	 */

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ColumnUtil.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ColumnUtil.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ColumnUtil.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.utils;
+
+/**
+ * カラムに関するユーティリティクラスです。
+ * 
+ * @author j5ik2o
+ */
+public class ColumnUtil {
+	
+	/**
+	 * カラムのデータ型をフォーマットする。
+	 * <p>
+	 * カラムのデータ型に含まれる置換文字を置き換えます。
+	 * <ul>
+	 * <li>$l を長さで置き換えます。</li>
+	 * <li>$p を精度で置き換えます。</li>
+	 * <li>$s をスケールで置き換えます。</li>
+	 * </ul>
+	 * </p>
+	 * 
+	 * @param dataType カラムのデータ型
+	 * @param length 長さ
+	 * @param precision 精度
+	 * @param scale スケール
+	 * @return フォーマットされたカラムのデータ型
+	 */
+	public static String formatDataType(String dataType, int length, int precision, int scale) {
+		StringBuilder buf = new StringBuilder();
+		for (int i = 0; i < dataType.length(); i++) {
+			char c = dataType.charAt(i);
+			if (c == '$') {
+				i++;
+				if (i < dataType.length()) {
+					c = dataType.charAt(i);
+					switch (c) {
+						case 'l':
+							buf.append(length);
+							break;
+						case 'p':
+							buf.append(precision);
+							break;
+						case 's':
+							buf.append(scale);
+							break;
+						default:
+							buf.append('$');
+							buf.append(c);
+							break;
+					}
+				} else {
+					buf.append(c);
+				}
+			} else {
+				buf.append(c);
+			}
+		}
+		return buf.toString();
+	}
+	
+	/**
+	 * 
+	 */
+	protected ColumnUtil() {
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/ColumnUtil.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/FileUtil.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/FileUtil.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/FileUtil.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.util.Arrays;
+import java.util.Comparator;
+
+/**
+ * {@link File}に関するユーティリティクラスです。
+ * 
+ * @author j5ik2o
+ */
+public class FileUtil {
+	
+	/**
+	 * ファイルを扱うインタフェースです・
+	 * 
+	 * @author j5ik2o
+	 */
+	public interface FileHandler {
+		
+		/**
+		 * 処理する。
+		 * 
+		 * @param file {@link File}
+		 */
+		void handle(File file);
+	}
+	
+
+	/**
+	 * ファイルをコピーし追加する。
+	 * 
+	 * @param src コピー元ファイル
+	 * @param dest コピー先ファイル
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public static void append(File src, File dest) throws IOException {
+		FileInputStream in = null;
+		FileOutputStream out = null;
+		try {
+			in = new FileInputStream(src);
+			out = new FileOutputStream(dest, true);
+			copyInternal(in, out);
+		} finally {
+			if (in != null) {
+				in.close();
+			}
+			if (out != null) {
+				out.close();
+			}
+		}
+	}
+	
+	/**
+	 * ファイルをコピーする。
+	 * 
+	 * @param src コピー元ファイル
+	 * @param dest コピー先ファイル
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public static void copy(File src, File dest) throws IOException {
+		FileInputStream in = null;
+		FileOutputStream out = null;
+		try {
+			in = new FileInputStream(src);
+			out = new FileOutputStream(dest);
+			copyInternal(in, out);
+		} finally {
+			if (in != null) {
+				in.close();
+			}
+			if (out != null) {
+				out.close();
+			}
+		}
+	}
+	
+	/**
+	 * 内部的にコピーする。
+	 * 
+	 * @param in コピー元
+	 * @param out コピー先
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	protected static void copyInternal(FileInputStream in, FileOutputStream out) throws IOException {
+		FileChannel src = in.getChannel();
+		FileChannel dest = out.getChannel();
+		src.transferTo(0, src.size(), dest);
+	}
+	
+	/**
+	 * Javaファイルを作成する。
+	 * 
+	 * @param baseDir ベースディレクトリ
+	 * @param packageName パッケージ名
+	 * @param shortClassName クラスの単純名
+	 * @return Javaファイル
+	 */
+	public static File createJavaFile(File baseDir, String packageName, String shortClassName) {
+		File packageDir;
+		if (packageName == null) {
+			packageDir = baseDir;
+		} else {
+			packageDir = new File(baseDir, packageName.replace('.', File.separatorChar));
+		}
+		return new File(packageDir, shortClassName + ".java");
+	}
+	
+	/**
+	 * 新しいファイルを不可分 (atomic) に生成する。
+	 * 
+	 * @param file ファイル
+	 * @return 指定されたファイルが存在せず、ファイルの生成に成功した場合は{@code true}、示されたファイルがすでに存在する場合は
+	 *         {@code false}
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public static boolean createNewFile(File file) throws IOException {
+		return file.createNewFile();
+	}
+	
+	/**
+	 * 一時ファイルを作成する。
+	 * 
+	 * @param prefix 接頭辞文字列。3 文字以上の長さが必要である
+	 * @param suffix 接尾辞文字列。null も指定でき、その場合は、接尾辞 ".tmp" が使用される
+	 * @return {@link File}
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public static File createTempFile(String prefix, String suffix) throws IOException {
+		return File.createTempFile(prefix, suffix);
+	}
+	
+	/**
+	 * ファイルの正規の形式を取得する。
+	 * 
+	 * @param file ファイル
+	 * @return 正規の形式
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public static File getCanonicalFile(File file) throws IOException {
+		return file.getCanonicalFile();
+	}
+	
+	/**
+	 * ファイルの正規のパス名文字列を取得する。
+	 * 
+	 * @param file ファイル
+	 * @return ファイルの正規パス名文字列
+	 * @throws IOException 入出力が失敗した場合
+	 */
+	public static String getCanonicalPath(File file) throws IOException {
+		return file.getCanonicalPath();
+	}
+	
+	/**
+	 * ディレクトリを横断する。
+	 * 
+	 * @param dir ディレクトリ
+	 * @param filter フィルタ
+	 * @param comparator コンパレータ
+	 * @param handler ハンドラ
+	 */
+	public static void traverseDirectory(File dir, FilenameFilter filter, Comparator<File> comparator,
+			FileHandler handler) {
+		if (!dir.exists()) {
+			return;
+		}
+		File[] files = dir.listFiles(filter);
+		if (files == null) {
+			return;
+		}
+		Arrays.sort(files, comparator);
+		for (File file : files) {
+			if (file.isDirectory()) {
+				traverseDirectory(file, filter, comparator, handler);
+			}
+			handler.handle(file);
+		}
+	}
+	
+	/**
+	 * 
+	 */
+	protected FileUtil() {
+	}
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/main/java/org/jiemamy/entity/io/utils/FileUtil.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/entity.ftl
===================================================================
--- leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/entity.ftl	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/main/resources/org/jiemamy/entity/io/templates/entity.ftl	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,138 @@
+<#import "/lib.ftl" as lib>
+<#if lib.copyright??>
+${lib.copyright}
+</#if>
+<#if !lib.copyright??>
+<#include "/copyright.ftl">
+</#if>
+<#if packageName??>
+package ${packageName};
+</#if>
+
+<#list importNameSet as importName>
+import ${importName};
+</#list>
+<#if staticImportNameSet?size gt 0>
+
+  <#list staticImportNameSet as importName>
+import static ${importName};
+  </#list>
+</#if>
+
+/**
+<#if useComment && comment??>
+ * ${comment}
+<#else>
+ * ${shortClassName}エンティティクラス
+</#if>
+ * 
+<#if lib.author??>
+ * @author ${lib.author}
+</#if>
+ */
+ @ Entity
+<#if catalogName?? || schemaName?? || tableName?? || compositeUniqueConstraintModelList?size gt 0>
+ @ Table(<#if catalogName??>catalog = "${catalogName}"</#if><#if schemaName??><#if catalogName??>, </#if>schema = "${schemaName}"</#if><#if tableName??><#if catalogName?? || schemaName??>, </#if>name = "${tableName}"</#if><#if compositeUniqueConstraintModelList?size gt 0><#if catalogName?? || schemaName?? || tableName??>, </#if>uniqueConstraints = { <#list compositeUniqueConstraintModelList as uniqueConstraint>@UniqueConstraint(columnNames = { <#list uniqueConstraint.columnNameList as columnName>"${columnName}"<#if columnName_has_next>, </#if></#list> })<#if uniqueConstraint_has_next>, </#if></#list> }</#if>)
+</#if>
+ @ Generated(value = {<#list generatedInfoList as info>"${info}"<#if info_has_next>, </#if></#list>}, date = "${currentDate?datetime}")
+public class ${shortClassName}<#if shortSuperclassName??> extends ${shortSuperclassName}</#if> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+<#list attributeModelList as attr>
+
+  <#if attr.unsupportedColumnType>
+    /**
+     * FIXME このプロパティに対応するカラムの型(${attr.columnTypeName})はサポート対象外です。
+     */
+  <#else>
+    <#if useComment && attr.comment??>
+    /** ${attr.comment} */
+    <#else>
+    /** ${attr.name}プロパティ */
+    </#if>
+  </#if>
+  <#if attr.id>
+    @Id
+    <#if attr.generationType??>
+    @GeneratedValue(strategy = GenerationType.${attr.generationType}<#if attr.generationType?matches("SEQUENCE|TABLE")>, generator = "generator"</#if>)
+      <#if attr.generationType == "SEQUENCE">
+    @SequenceGenerator(name = "generator", initialValue = ${attr.initialValue}, allocationSize = ${attr.allocationSize})
+      <#elseif attr.generationType == "TABLE">
+    @TableGenerator(name = "generator", initialValue = ${attr.initialValue}, allocationSize = ${attr.allocationSize})
+      </#if>
+    </#if>
+  </#if>
+  <#if attr.lob>
+    @Lob
+  </#if>
+  <#if attr.temporalType??>
+    @Temporal(TemporalType.${attr.temporalType})
+  </#if>
+  <#if attr.transient>
+    @Transient
+  </#if>
+  <#if attr.version>
+    @Version
+  </#if>
+  <#if !attr.transient>
+    @Column(<#if attr.columnName??>name = "${attr.columnName}", </#if><#if attr.columnDefinition??>columnDefinition = "${attr.columnDefinition}", <#else><#if attr.length??>length = ${attr.length}, </#if><#if attr.precision??>precision = ${attr.precision}, </#if><#if attr.scale??>scale = ${attr.scale}, </#if></#if>nullable = ${attr.nullable?string}, unique = ${attr.unique?string})
+  </#if>
+    <#if useAccessor>private<#else>public</#if> ${attr.attributeClass.simpleName} ${attr.name};
+</#list>
+<#list associationModelList as asso>
+
+    /** ${asso.name}関連プロパティ */
+    @${asso.associationType.annotation.simpleName}<#if asso.mappedBy??>(mappedBy = "${asso.mappedBy}")</#if>
+  <#if asso.joinColumnModel??>
+    @JoinColumn(name = "${asso.joinColumnModel.name}", referencedColumnName = "${asso.joinColumnModel.referencedColumnName}")
+  <#elseif asso.joinColumnsModel??>
+    @JoinColumns( {
+    <#list asso.joinColumnsModel.joinColumnModelList as joinColumnModel>
+        @JoinColumn(name = "${joinColumnModel.name}", referencedColumnName = "${joinColumnModel.referencedColumnName}")<#if joinColumnModel_has_next>,<#else> })</#if>
+    </#list>
+  </#if>
+    <#if useAccessor>private<#else>public</#if> ${asso.shortClassName} ${asso.name};
+</#list>
+<#if useAccessor>
+  <#list attributeModelList as attr>
+
+    /**
+     * ${attr.name}を返します。
+     * 
+     * @param ${attr.name}
+     */
+    public ${attr.attributeClass.simpleName} <#if attr.attributeClass.getSimpleName()?matches("[bB]oolean")>is<#else>get</#if>${attr.name?cap_first}() {
+        return ${attr.name};
+    }
+
+    /**
+     * ${attr.name}を設定します。
+     * 
+     * @param ${attr.name}
+     */
+    public void set${attr.name?cap_first}(${attr.attributeClass.simpleName} ${attr.name}) {
+        this.${attr.name} = ${attr.name};
+    }
+  </#list>
+  <#list associationModelList as asso>
+
+    /**
+     * ${asso.name}を返します。
+     * 
+     * @param ${asso.name}
+     */
+    public ${asso.shortClassName} get${asso.name?cap_first}() {
+        return ${asso.name};
+    }
+
+    /**
+     * ${asso.name}を設定します。
+     * 
+     * @param ${asso.name}
+     */
+    public void set${asso.name?cap_first}(${asso.shortClassName} ${asso.name}) {
+        this.${asso.name} = ${asso.name};
+    }
+  </#list>
+</#if>
+}
\ No newline at end of file

Modified: leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImplTest.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImplTest.java	2009-04-14 07:25:02 UTC (rev 3269)
+++ leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/EntityMetaWriterImplTest.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -20,20 +20,30 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.sql.Types;
 import java.util.List;
 import java.util.regex.Pattern;
 
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.jiemamy.Jiemamy;
+import org.jiemamy.dialect.generic.GenericDialect;
+import org.jiemamy.entity.io.gen.desc.impl.IdentityNotSupportedException;
+import org.jiemamy.entity.io.gen.dialect.StandardGenDialect;
 import org.jiemamy.entity.io.gen.meta.DbColumnMeta;
 import org.jiemamy.entity.io.gen.meta.DbTableMeta;
 import org.jiemamy.entity.io.meta.DefaultEntityMetaWriterContext;
 import org.jiemamy.entity.io.meta.DefaultEntityMetaWriterFactory;
 import org.jiemamy.entity.io.meta.EntityMetaWriter;
+import org.jiemamy.internal.test.ReflectionDialectProvider;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.utils.ClassUtil;
 import org.jiemamy.utils.CollectionsUtil;
+import org.jiemamy.utils.ResourceNotFoundException;
 import org.jiemamy.utils.ResourceUtil;
 
 /**
@@ -47,26 +57,50 @@
 	
 	private static final Logger LOG = LoggerFactory.getLogger(EntityMetaWriterImplTest.class);
 	
+	private Jiemamy jiemamy;
+	
+	private RootModel rootModel;
+	
 
 	/**
+	 * テストを初期化する。
+	 * 
+	 * @throws Exception 例外が発生した場合
+	 */
+	@Before
+	public void setUp() throws Exception {
+		jiemamy = Jiemamy.newInstance(new ReflectionDialectProvider());
+		rootModel = jiemamy.getFactory().getRootModel();
+		rootModel.setDialectClassName(GenericDialect.class.getName());
+	}
+	
+	/**
 	 * Test method for {@link org.jiemamy.entity.io.meta.impl.EntityMetaWriterImpl#write(java.util.List)}.
 	 * @throws IOException 
+	 * @throws IdentityNotSupportedException 
+	 * @throws ClassNotFoundException 
+	 * @throws ResourceNotFoundException 
 	 */
 	@Test
 	@Ignore
-	public void testWrite() throws IOException {
+	public void testWrite() throws IOException, IdentityNotSupportedException, ClassNotFoundException,
+			ResourceNotFoundException {
 		DefaultEntityMetaWriterContext context = new DefaultEntityMetaWriterContext();
+		
+		//context.setDialect(new TestDialect(jiemamy.getFactory(), jiemamy.getDialect(rootModel)));
+		
+		context.setDialect(new StandardGenDialect());
+		context.setOverwrite(true);
 		context.setJavaSrcFileEncoding("UTF-8");
 		context.setRootPackageName("test");
 		context.setEntityPackageName("entity");
 		context.setTemplateName("entity.ftl");
 		context.setTemplateFileEncoding("UTF-8");
 		context.setVersionColumnNamePattern(Pattern.compile("VERSION([_]?NO)?"));
+		String packageName = ClassUtil.getPackageName(getClass());
+		File dir = ResourceUtil.getResourceAsFile(packageName.replace('.', '/'));
 		
-		File buildDir = ResourceUtil.getBuildDirNoException(example.entity.Employee.class);
-		String srcPath = String.format("%s/%s", buildDir.getCanonicalPath(), "src/test/java");
-		
-		context.setJavaSrcFileDestDir(new File(srcPath));
+		context.setJavaSrcFileDestDir(dir);
 		entityMetaWriter = new DefaultEntityMetaWriterFactory().createEntityMetaWriter(context);
 		List<DbTableMeta> dbTableMetaList = CollectionsUtil.newArrayList();
 		DbTableMeta dbTableMeta = new DbTableMeta();
@@ -76,16 +110,22 @@
 		columnMeta.setName("EMPLOYEE_ID");
 		columnMeta.setNullable(false);
 		columnMeta.setPrimaryKey(true);
+		columnMeta.setSqlType(Types.BIGINT);
+		columnMeta.setTypeName("BIGINT");
 		dbTableMeta.addColumnMeta(columnMeta);
 		
 		columnMeta = new DbColumnMeta();
 		columnMeta.setName("EMPLOYEE_NAME");
 		columnMeta.setNullable(false);
+		columnMeta.setSqlType(Types.VARCHAR);
+		columnMeta.setTypeName("VARCHAR");
 		dbTableMeta.addColumnMeta(columnMeta);
 		
 		columnMeta = new DbColumnMeta();
 		columnMeta.setName("VERSION_NO");
 		columnMeta.setNullable(false);
+		columnMeta.setSqlType(Types.BIGINT);
+		columnMeta.setTypeName("BIGINT");
 		dbTableMeta.addColumnMeta(columnMeta);
 		
 		dbTableMetaList.add(dbTableMeta);

Added: leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/TestDialect.java
===================================================================
--- leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/TestDialect.java	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/TestDialect.java	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on Apr 14, 2009
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.entity.io.meta.impl;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Map;
+
+import javax.persistence.GenerationType;
+
+import org.jiemamy.JiemamyFactory;
+import org.jiemamy.dialect.BuiltinDataTypeMold;
+import org.jiemamy.dialect.Dialect;
+import org.jiemamy.entity.io.gen.dialect.GenDialect;
+import org.jiemamy.entity.io.gen.dialect.SqlType;
+import org.jiemamy.model.datatype.BuiltinDataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
+
+/**
+ * TODO for kato
+ * 
+ * @author kato
+ */
+public class TestDialect implements GenDialect {
+	
+	private Dialect dialect;
+	
+	private JiemamyFactory factory;
+	
+
+	public TestDialect(JiemamyFactory factory, Dialect dialect) {
+		this.factory = factory;
+		this.dialect = dialect;
+	}
+	
+	public SqlBlockContext createSqlBlockContext() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getCloseQuote() {
+		return "\"";
+	}
+	
+	public Map<String, String> getColumnCommentMap(Connection connection, String catalogName, String schemaName,
+			String tableName) throws SQLException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public ColumnType getColumnType(String columnTypeName, int sqlType) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public GenerationType getDefaultGenerationType() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getDefaultSchemaName(String userName) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getDropForeignKeySyntax() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getDropUniqueKeySyntax() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getIdentityColumnDefinition() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getIdentityInsertDisableStatement(String tableName) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getIdentityInsertEnableStatement(String tableName) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getOpenQuote() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getSequenceDefinitionFragment(String dataType, long initialValue, int allocationSize) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public String getSequenceNextValString(String sequenceName, int allocationSize) {
+		return null;
+	}
+	
+	public String getSqlBlockDelimiter() {
+		return null;
+	}
+	
+	public SqlType getSqlType(int sqlType) {
+		return getSqlTypeInternal(sqlType);
+	}
+	
+	/**
+	 * 内部的にSQL型を取得する。
+	 * 
+	 * @param sqlType JDBCのSQL型
+	 * @return SQL型 
+	 */
+	protected SqlType getSqlTypeInternal(int sqlType) {
+		DataTypeCategory dtc = DataTypeCategory.fromSqlType(sqlType);
+		BuiltinDataTypeMold dtm = dialect.findDataTypeMold(dtc);
+		BuiltinDataType dt = factory.newDataType(dtm);
+		String typeName = dt.getTypeName();
+		SqlType result = new SqlType(typeName);
+		return result;
+	}
+	
+	public String getTableComment(Connection connection, String catalogName, String schemaName, String tableName)
+			throws SQLException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	public boolean isAutoIncrement(Connection connection, String catalogName, String schemaName, String tableName,
+			String columnName) throws SQLException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean isColumnNotFound(Throwable throwable) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean isJdbcCommentAvailable() {
+		return false;
+	}
+	
+	public boolean isSequenceNotFound(Throwable throwable) {
+		return false;
+	}
+	
+	public boolean isTableNotFound(Throwable throwable) {
+		return false;
+	}
+	
+	public String quote(String value) {
+		if (value == null) {
+			return null;
+		}
+		return getOpenQuote() + value + getCloseQuote();
+	}
+	
+	public boolean supportsCommentInCreateTable() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsCommentOn() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsGetIndexInfo(String catalogName, String schemaName, String tableName) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsIdentity() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsIdentityInsert() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsIdentityInsertControlStatement() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsNullableUnique() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsReferentialDeleteRule() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsReferentialUpdateRule() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public boolean supportsSequence() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	public String unquote(String value) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+}


Property changes on: leto/jiemamy-entity-io/trunk/src/test/java/org/jiemamy/entity/io/meta/impl/TestDialect.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/io/templates/entity.ftl
===================================================================
--- leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/io/templates/entity.ftl	                        (rev 0)
+++ leto/jiemamy-entity-io/trunk/src/test/resources/org/jiemamy/entity/io/templates/entity.ftl	2009-04-14 10:06:21 UTC (rev 3270)
@@ -0,0 +1,138 @@
+<#import "/lib.ftl" as lib>
+<#if lib.copyright??>
+${lib.copyright}
+</#if>
+<#if !lib.copyright??>
+<#include "/copyright.ftl">
+</#if>
+<#if packageName??>
+package ${packageName};
+</#if>
+
+<#list importNameSet as importName>
+import ${importName};
+</#list>
+<#if staticImportNameSet?size gt 0>
+
+  <#list staticImportNameSet as importName>
+import static ${importName};
+  </#list>
+</#if>
+
+/**
+<#if useComment && comment??>
+ * ${comment}
+<#else>
+ * ${shortClassName}エンティティクラス
+</#if>
+ * 
+<#if lib.author??>
+ * @author ${lib.author}
+</#if>
+ */
+ @ Entity
+<#if catalogName?? || schemaName?? || tableName?? || compositeUniqueConstraintModelList?size gt 0>
+ @ Table(<#if catalogName??>catalog = "${catalogName}"</#if><#if schemaName??><#if catalogName??>, </#if>schema = "${schemaName}"</#if><#if tableName??><#if catalogName?? || schemaName??>, </#if>name = "${tableName}"</#if><#if compositeUniqueConstraintModelList?size gt 0><#if catalogName?? || schemaName?? || tableName??>, </#if>uniqueConstraints = { <#list compositeUniqueConstraintModelList as uniqueConstraint>@UniqueConstraint(columnNames = { <#list uniqueConstraint.columnNameList as columnName>"${columnName}"<#if columnName_has_next>, </#if></#list> })<#if uniqueConstraint_has_next>, </#if></#list> }</#if>)
+</#if>
+ @ Generated(value = {<#list generatedInfoList as info>"${info}"<#if info_has_next>, </#if></#list>}, date = "${currentDate?datetime}")
+public class ${shortClassName}<#if shortSuperclassName??> extends ${shortSuperclassName}</#if> implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+<#list attributeModelList as attr>
+
+  <#if attr.unsupportedColumnType>
+    /**
+     * FIXME このプロパティに対応するカラムの型(${attr.columnTypeName})はサポート対象外です。
+     */
+  <#else>
+    <#if useComment && attr.comment??>
+    /** ${attr.comment} */
+    <#else>
+    /** ${attr.name}プロパティ */
+    </#if>
+  </#if>
+  <#if attr.id>
+    @Id
+    <#if attr.generationType??>
+    @GeneratedValue(strategy = GenerationType.${attr.generationType}<#if attr.generationType?matches("SEQUENCE|TABLE")>, generator = "generator"</#if>)
+      <#if attr.generationType == "SEQUENCE">
+    @SequenceGenerator(name = "generator", initialValue = ${attr.initialValue}, allocationSize = ${attr.allocationSize})
+      <#elseif attr.generationType == "TABLE">
+    @TableGenerator(name = "generator", initialValue = ${attr.initialValue}, allocationSize = ${attr.allocationSize})
+      </#if>
+    </#if>
+  </#if>
+  <#if attr.lob>
+    @Lob
+  </#if>
+  <#if attr.temporalType??>
+    @Temporal(TemporalType.${attr.temporalType})
+  </#if>
+  <#if attr.transient>
+    @Transient
+  </#if>
+  <#if attr.version>
+    @Version
+  </#if>
+  <#if !attr.transient>
+    @Column(<#if attr.columnName??>name = "${attr.columnName}", </#if><#if attr.columnDefinition??>columnDefinition = "${attr.columnDefinition}", <#else><#if attr.length??>length = ${attr.length}, </#if><#if attr.precision??>precision = ${attr.precision}, </#if><#if attr.scale??>scale = ${attr.scale}, </#if></#if>nullable = ${attr.nullable?string}, unique = ${attr.unique?string})
+  </#if>
+    <#if useAccessor>private<#else>public</#if> ${attr.attributeClass.simpleName} ${attr.name};
+</#list>
+<#list associationModelList as asso>
+
+    /** ${asso.name}関連プロパティ */
+    @${asso.associationType.annotation.simpleName}<#if asso.mappedBy??>(mappedBy = "${asso.mappedBy}")</#if>
+  <#if asso.joinColumnModel??>
+    @JoinColumn(name = "${asso.joinColumnModel.name}", referencedColumnName = "${asso.joinColumnModel.referencedColumnName}")
+  <#elseif asso.joinColumnsModel??>
+    @JoinColumns( {
+    <#list asso.joinColumnsModel.joinColumnModelList as joinColumnModel>
+        @JoinColumn(name = "${joinColumnModel.name}", referencedColumnName = "${joinColumnModel.referencedColumnName}")<#if joinColumnModel_has_next>,<#else> })</#if>
+    </#list>
+  </#if>
+    <#if useAccessor>private<#else>public</#if> ${asso.shortClassName} ${asso.name};
+</#list>
+<#if useAccessor>
+  <#list attributeModelList as attr>
+
+    /**
+     * ${attr.name}を返します。
+     * 
+     * @param ${attr.name}
+     */
+    public ${attr.attributeClass.simpleName} <#if attr.attributeClass.getSimpleName()?matches("[bB]oolean")>is<#else>get</#if>${attr.name?cap_first}() {
+        return ${attr.name};
+    }
+
+    /**
+     * ${attr.name}を設定します。
+     * 
+     * @param ${attr.name}
+     */
+    public void set${attr.name?cap_first}(${attr.attributeClass.simpleName} ${attr.name}) {
+        this.${attr.name} = ${attr.name};
+    }
+  </#list>
+  <#list associationModelList as asso>
+
+    /**
+     * ${asso.name}を返します。
+     * 
+     * @param ${asso.name}
+     */
+    public ${asso.shortClassName} get${asso.name?cap_first}() {
+        return ${asso.name};
+    }
+
+    /**
+     * ${asso.name}を設定します。
+     * 
+     * @param ${asso.name}
+     */
+    public void set${asso.name?cap_first}(${asso.shortClassName} ${asso.name}) {
+        this.${asso.name} = ${asso.name};
+    }
+  </#list>
+</#if>
+}
\ No newline at end of file



Jiemamy-notify メーリングリストの案内
Back to archive index