[Jiemamy-notify:1402] commit [2641] DataType記述子(BuiltinDataType)を、DataTypeCategory (旧TypicalDataType)を用いて表現するように変更。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 9日 (月) 21:39:01 JST


Revision: 2641
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2641
Author:   daisuke_m
Date:     2009-02-09 21:39:00 +0900 (Mon, 09 Feb 2009)

Log Message:
-----------
DataType記述子(BuiltinDataType)を、DataTypeCategory (旧TypicalDataType)を用いて表現するように変更。

Modified Paths:
--------------
    artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java
    artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataTypeImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataTypeUtil.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/builder/TableBuilderTest.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataType.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java
    zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd
    zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml

Added Paths:
-----------
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java

Removed Paths:
-------------
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/TypicalDataType.java


-------------- next part --------------
Modified: artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java
===================================================================
--- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,8 +18,6 @@
  */
 package org.jiemamy.artemis.test;
 
-import java.sql.Types;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -31,6 +29,7 @@
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.entity.ViewModel;
 import org.jiemamy.utils.builder.ColumnBuilder;
@@ -107,8 +106,8 @@
 		rootModel1 = factory1.getRootModel();
 		rootModel2 = factory2.getRootModel();
 		
-		r1t1c1dataType = new DataTypeBuilder(factory1, Types.INTEGER, "INTEGER").build();
-		r1t2c1dataType = new DataTypeBuilder(factory1, Types.VARCHAR, "VARCHAR").build();
+		r1t1c1dataType = new DataTypeBuilder(factory1, DataTypeCategory.INTEGER).build();
+		r1t2c1dataType = new DataTypeBuilder(factory1, DataTypeCategory.VARCHAR).build();
 		r1t1column = new ColumnBuilder(factory1, "column1", r1t1c1dataType).build();
 		r1t2column = new ColumnBuilder(factory1, "column2", r1t2c1dataType).build();
 		r1table1 = new TableBuilder(factory1, "table1").column(r1t1column).primaryKey(0).build();
@@ -122,8 +121,8 @@
 		rootModel1.getEntities().add(r1view2);
 		r1table1.getAttributes().add(r1fk);
 		
-		r2t1c1dataType = new DataTypeBuilder(factory2, Types.INTEGER, "INTEGER").build();
-		r2t2c1dataType = new DataTypeBuilder(factory2, Types.VARCHAR, "VARCHAR").build();
+		r2t1c1dataType = new DataTypeBuilder(factory2, DataTypeCategory.INTEGER).build();
+		r2t2c1dataType = new DataTypeBuilder(factory2, DataTypeCategory.VARCHAR).build();
 		r2t1column = new ColumnBuilder(factory2, "column1", r2t1c1dataType).build();
 		r2t2column = new ColumnBuilder(factory2, "column2", r2t2c1dataType).build();
 		r2table1 = new TableBuilder(factory2, "table1").column(r2t1column).build();

Modified: artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java
===================================================================
--- artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -27,7 +27,6 @@
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.sql.Types;
 import java.util.Collection;
 import java.util.List;
 import java.util.UUID;
@@ -49,6 +48,7 @@
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
 import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.entity.TableModel;
@@ -145,7 +145,7 @@
 		BuiltinDataType builtinDataType1 =
 				DataTypeUtil.toBuiltinDataType(column1.getDataType(), jiemamy.getReferenceResolver());
 		assertThat(column1.getName(), is("poll_id"));
-		assertThat(builtinDataType1.getSqlType(), is(Types.INTEGER));
+		assertThat(builtinDataType1.getCategory(), is(DataTypeCategory.INTEGER));
 		assertThat(builtinDataType1.getTypeName(), is("serial"));
 		// FIXME この仕様はまだ未実装
 //		assertThat(column1.getDataType().getAdapter(SerialDataTypeAdapter.class).isSerial(), is(true));
@@ -156,7 +156,7 @@
 		BuiltinDataType builtinDataType2 =
 				DataTypeUtil.toBuiltinDataType(column2.getDataType(), jiemamy.getReferenceResolver());
 		assertThat(column2.getName(), is("title"));
-		assertThat(builtinDataType2.getSqlType(), is(Types.VARCHAR));
+		assertThat(builtinDataType2.getCategory(), is(DataTypeCategory.VARCHAR));
 		assertThat(builtinDataType2.getTypeName(), is("varchar"));
 		assertThat(builtinDataType2.getAdapter(SizedDataTypeAdapter.class).getSize(), is(128));
 		assertThat(column2.getId(), not(isIn(pkColumnIds)));

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultDataTypeResolver.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -26,6 +26,7 @@
 import org.jiemamy.ReferenceResolver;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.utils.model.DataTypeUtil;
 
 /**
@@ -47,7 +48,7 @@
 	public BuiltinDataType resolveDataType(JiemamyFactory factory, int sqlType, String typeName) {
 		Validate.notNull(factory);
 		BuiltinDataType builtinDataType = factory.newModel(BuiltinDataType.class);
-		builtinDataType.setSqlType(sqlType);
+		builtinDataType.setCategory(DataTypeCategory.fromSqlType(sqlType));
 		builtinDataType.setTypeName(typeName);
 		return builtinDataType;
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataTypeImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataTypeImpl.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataTypeImpl.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,13 +18,10 @@
  */
 package org.jiemamy.model.datatype;
 
-import java.lang.reflect.Field;
-import java.sql.Types;
-
+import org.apache.commons.lang.Validate;
 import org.apache.commons.lang.builder.ReflectionToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 
-import org.jiemamy.exception.UnexpectedConditionError;
 import org.jiemamy.model.AbstractAdaptable;
 
 /**
@@ -33,7 +30,7 @@
  */
 public class BuiltinDataTypeImpl extends AbstractAdaptable implements BuiltinDataType {
 	
-	private int sqlType;
+	private DataTypeCategory category;
 	
 	private String typeName;
 	
@@ -41,8 +38,8 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public int getSqlType() {
-		return sqlType;
+	public DataTypeCategory getCategory() {
+		return category;
 	}
 	
 	/**
@@ -55,9 +52,9 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public void setSqlType(int sqlType) {
-		validate(sqlType);
-		this.sqlType = sqlType;
+	public void setCategory(DataTypeCategory category) {
+		Validate.notNull(category);
+		this.category = category;
 	}
 	
 	/**
@@ -81,21 +78,4 @@
 		return toStringBuilder.toString();
 	}
 	
-	private void validate(int sqlType) {
-		Field[] fields = Types.class.getDeclaredFields();
-		for (Field field : fields) {
-			try {
-				int value = (Integer) field.get(null);
-				if (sqlType == value) {
-					return;
-				}
-			} catch (IllegalArgumentException e) {
-				throw new UnexpectedConditionError("Illegal Java Implementation (java.sql.Types).");
-			} catch (IllegalAccessException e) {
-				throw new UnexpectedConditionError("Illegal Java Implementation (java.sql.Types).");
-			}
-		}
-		throw new IllegalArgumentException();
-	}
-	
 }

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -51,9 +51,9 @@
 import static org.jiemamy.xml.CoreQName.RECORD;
 import static org.jiemamy.xml.CoreQName.REFERENCE_COLUMNS;
 import static org.jiemamy.xml.CoreQName.SCHEMA_NAME;
-import static org.jiemamy.xml.CoreQName.SQL_TYPE;
 import static org.jiemamy.xml.CoreQName.TABLE;
 import static org.jiemamy.xml.CoreQName.TABLE_REF;
+import static org.jiemamy.xml.CoreQName.TYPE_CATEGORY;
 import static org.jiemamy.xml.CoreQName.TYPE_NAME;
 import static org.jiemamy.xml.CoreQName.VIEW;
 
@@ -127,7 +127,7 @@
 			dataTypeElement.setAttribute(CoreQName.REF.getQNameString(), domainRef.getReferenceId().toString());
 		} else if (dataType instanceof BuiltinDataType) {
 			BuiltinDataType builtinDataType = (BuiltinDataType) dataType;
-			DomUtil.newChild(dataTypeElement, SQL_TYPE, Integer.toString(builtinDataType.getSqlType()));
+			DomUtil.newChild(dataTypeElement, TYPE_CATEGORY, builtinDataType.getCategory());
 			DomUtil.newChild(dataTypeElement, TYPE_NAME, builtinDataType.getTypeName());
 			writeAdapters(dataTypeElement, builtinDataType.getAdapters());
 		} else if (dataType == null) {

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -24,7 +24,6 @@
 import static org.jiemamy.xml.CoreQName.VIEW;
 
 import java.lang.reflect.Field;
-import java.sql.Types;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -62,6 +61,7 @@
 import org.jiemamy.model.dataset.RecordModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.datatype.DomainRefImpl;
 import org.jiemamy.model.entity.EntityModel;
@@ -191,20 +191,15 @@
 			if (element.getChildNodes().getLength() == 0 && StringUtils.isEmpty(element.getAttribute("ref")) == false) {
 				return new DomainRefImpl(jiemamy, DomUtil.getUUID(element, CoreQName.REF));
 			} else {
-				String sqlTypeString =
-						(String) XpathUtil.XPATH.evaluate("core:sqlType/text()", element, XPathConstants.STRING);
+				String typeCategoryString =
+						(String) XpathUtil.XPATH.evaluate("core:typeCategory/text()", element, XPathConstants.STRING);
 				String typeName =
 						(String) XpathUtil.XPATH.evaluate("core:typeName/text()", element, XPathConstants.STRING);
 				
-				int sqlType;
-				try {
-					sqlType = Integer.valueOf(sqlTypeString);
-				} catch (NumberFormatException e) {
-					sqlType = Types.OTHER;
-				}
-				
 				BuiltinDataType dataType = factory.newModel(BuiltinDataType.class);
-				dataType.setSqlType(sqlType);
+				if (StringUtils.isEmpty(typeCategoryString) == false) {
+					dataType.setCategory(DataTypeCategory.valueOf(typeCategoryString));
+				}
 				dataType.setTypeName(typeName);
 				
 				readAdapter(element, dataType);

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,7 +18,6 @@
  */
 package org.jiemamy.test;
 
-import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -40,6 +39,7 @@
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel.ReferentialAction;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.dataset.RecordModel;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
 import org.jiemamy.model.entity.TableModel;
@@ -290,7 +290,7 @@
 		
 		domainId = factory.newModel(DomainModel.class, uuid.get("2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"));
 		domainId.setName("ID");
-		domainId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		domainId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		NotNullConstraintModel notNull =
 				factory.newModel(NotNullConstraintModel.class, uuid.get("af4845dc-7f3a-434d-b5ac-2f25b74d7e76"));
 		domainId.getConstraints().add(notNull);
@@ -304,7 +304,7 @@
 		
 		domainName = factory.newModel(DomainModel.class, uuid.get("62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7"));
 		domainName.setName("NAME");
-		domainName.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32).build());
+		domainName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build());
 		domainName.setDescription("人名用の型です。");
 		rootModel.getDomains().add(domainName);
 	}
@@ -599,7 +599,7 @@
 		deptId = factory.newModel(ColumnModel.class, uuid.get("c7ed225d-92a6-4cc2-90de-60531804464e"));
 		deptId.setName("ID");
 		if (instruction.supressUseDomain) {
-			deptId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+			deptId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		} else {
 			ColumnUtil.setDataType(deptId, domainId);
 		}
@@ -608,20 +608,20 @@
 		
 		deptDeptNo = factory.newModel(ColumnModel.class, uuid.get("2d951389-6bc7-49d7-8631-1d26fe17047e"));
 		deptDeptNo.setName("DEPT_NO");
-		deptDeptNo.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		deptDeptNo.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		deptDeptNo.setLogicalName("部署番号");
 		tableDept.getAttributes().add(deptDeptNo);
 		
 		deptDeptName = factory.newModel(ColumnModel.class, uuid.get("1fcd63d3-974e-4d2e-a0d8-3b9c233104d9"));
 		deptDeptName.setName("DEPT_NAME");
-		deptDeptName.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
+		deptDeptName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build());
 		deptDeptName.setLogicalName("部署名");
 		deptDeptName.getAdapter(RepresentationAdapter.class).setRepresentation(true);
 		tableDept.getAttributes().add(deptDeptName);
 		
 		deptLoc = factory.newModel(ColumnModel.class, uuid.get("7bf79e76-07b8-43b6-a993-b8ef374a31f5"));
 		deptLoc.setName("LOC");
-		deptLoc.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
+		deptLoc.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build());
 		deptLoc.setLogicalName("ロケーション");
 		deptLoc.setDefaultValue("secret");
 		tableDept.getAttributes().add(deptLoc);
@@ -653,7 +653,7 @@
 		empId = factory.newModel(ColumnModel.class, uuid.get("44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e"));
 		empId.setName("ID");
 		if (instruction.supressUseDomain) {
-			empId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+			empId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		} else {
 			ColumnUtil.setDataType(empId, domainId);
 		}
@@ -662,14 +662,14 @@
 		
 		empEmpNo = factory.newModel(ColumnModel.class, uuid.get("248a429b-2159-4ebd-a791-eee42a059374"));
 		empEmpNo.setName("EMP_NO");
-		empEmpNo.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		empEmpNo.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		empEmpNo.setLogicalName("従業員番号");
 		tableEmp.getAttributes().add(empEmpNo);
 		
 		empEmpName = factory.newModel(ColumnModel.class, uuid.get("0e51b6df-43ab-408c-90ef-de13c6aab881"));
 		empEmpName.setName("EMP_NAME");
 		if (instruction.supressUseDomain) {
-			empEmpName.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32).build());
+			empEmpName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build());
 		} else {
 			ColumnUtil.setDataType(empEmpName, domainName);
 		}
@@ -680,23 +680,23 @@
 		
 		empMgrId = factory.newModel(ColumnModel.class, uuid.get("3d21a85a-72de-41b3-99dd-f4cb94e58d84"));
 		empMgrId.setName("MGR_ID");
-		empMgrId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		empMgrId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		empMgrId.setLogicalName("上司ID");
 		tableEmp.getAttributes().add(empMgrId);
 		
 		empHiredate = factory.newModel(ColumnModel.class, uuid.get("f0b57eed-98ab-4c21-9855-218c592814dc"));
 		empHiredate.setName("HIREDATE");
-		empHiredate.setDataType(new DataTypeBuilder(factory, Types.DATE, "DATE").build());
+		empHiredate.setDataType(new DataTypeBuilder(factory, DataTypeCategory.DATE).build());
 		tableEmp.getAttributes().add(empHiredate);
 		
 		empSal = factory.newModel(ColumnModel.class, uuid.get("80786549-dc2c-4c1c-bcbd-9f6fdec911d2"));
 		empSal.setName("SAL");
-		empSal.setDataType(new DataTypeBuilder(factory, Types.NUMERIC, "NUMERIC").setPrecision(7).setScale(2).build());
+		empSal.setDataType(new DataTypeBuilder(factory, DataTypeCategory.NUMERIC).setPrecision(7).setScale(2).build());
 		tableEmp.getAttributes().add(empSal);
 		
 		empDeptId = factory.newModel(ColumnModel.class, uuid.get("4ae69b7a-7a0e-422a-89dc-0f0cff77565b"));
 		empDeptId.setName("DEPT_ID");
-		empDeptId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		empDeptId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		tableEmp.getAttributes().add(empDeptId);
 		
 		empPk = factory.newModel(PrimaryKeyModel.class, uuid.get("6145e6a0-9ff7-4033-999d-99d80392a48f"));

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,7 +18,6 @@
  */
 package org.jiemamy.test;
 
-import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -37,6 +36,7 @@
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel.ReferentialAction;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.dataset.RecordModel;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
 import org.jiemamy.model.entity.TableModel;
@@ -305,14 +305,14 @@
 		
 		idDomain = factory.newModel(DomainModel.class, uuid.get("9a3ba23c-b328-4c70-a32d-3e4be3ee3f08"));
 		idDomain.setName("ID");
-		idDomain.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		idDomain.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		idDomain.getConstraints().add(factory.newModel(NotNullConstraintModel.class));
 		idDomain.getAdapter(SerialDataTypeAdapter.class).setSerial(true);
 		rootModel.getDomains().add(idDomain);
 		
 		nameDomain = factory.newModel(DomainModel.class, uuid.get("e2ebf8a7-90d8-48d4-9b5d-8d2e2601b193"));
 		nameDomain.setName("NAME");
-		nameDomain.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32).build());
+		nameDomain.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build());
 		nameDomain.setDescription("人名用の型です。");
 		rootModel.getDomains().add(nameDomain);
 	}
@@ -671,7 +671,7 @@
 		detailId = factory.newModel(ColumnModel.class, uuid.get("d3571020-4e1b-4158-958d-b5460fa6c32c"));
 		detailId.setName("ID");
 		if (instruction.supressUseDomain) {
-			detailId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+			detailId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		} else {
 			ColumnUtil.setDataType(detailId, idDomain);
 		}
@@ -680,17 +680,17 @@
 		
 		detailOrderId = factory.newModel(ColumnModel.class, uuid.get("a28c64c6-b379-41a4-9563-b774f5bce165"));
 		detailOrderId.setName("ORDER_ID");
-		detailOrderId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		detailOrderId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		tableDetail.getAttributes().add(detailOrderId);
 		
 		detailItemId = factory.newModel(ColumnModel.class, uuid.get("b4d50786-3b3e-4557-baa3-b739159f0530"));
 		detailItemId.setName("ITEM_ID");
-		detailItemId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		detailItemId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		tableDetail.getAttributes().add(detailItemId);
 		
 		detailQuantity = factory.newModel(ColumnModel.class, uuid.get("77bb21f4-e793-4198-a695-42363dac2216"));
 		detailQuantity.setName("QUANTITY");
-		detailQuantity.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		detailQuantity.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		tableDetail.getAttributes().add(detailQuantity);
 		
 		detailPk = factory.newModel(PrimaryKeyModel.class, uuid.get("90243681-19af-4bc0-9e6f-f814fbc58f85"));
@@ -713,7 +713,7 @@
 		itemId = factory.newModel(ColumnModel.class, uuid.get("5a9585be-4b0d-4675-99aa-97b0417c816c"));
 		itemId.setName("ID");
 		if (instruction.supressUseDomain) {
-			itemId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+			itemId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		} else {
 			ColumnUtil.setDataType(itemId, idDomain);
 		}
@@ -722,14 +722,14 @@
 		
 		itemName = factory.newModel(ColumnModel.class, uuid.get("5c9b38e1-2cc9-45f9-ad3f-20b02471cc40"));
 		itemName.setName("NAME");
-		itemName.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
+		itemName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build());
 		itemName.setLogicalName("商品名");
 		itemName.getAdapter(RepresentationAdapter.class).setRepresentation(true);
 		tableItem.getAttributes().add(itemName);
 		
 		itemPrice = factory.newModel(ColumnModel.class, uuid.get("7a0cabe3-d382-4e5d-845b-dadd1b637a5f"));
 		itemPrice.setName("PRICE");
-		itemPrice.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
+		itemPrice.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(20).build());
 		itemPrice.setLogicalName("価格");
 		tableItem.getAttributes().add(itemPrice);
 		
@@ -753,7 +753,7 @@
 		orderId = factory.newModel(ColumnModel.class, uuid.get("b647212a-4d8f-4d18-88e4-5397e54ebe67"));
 		orderId.setName("ID");
 		if (instruction.supressUseDomain) {
-			orderId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+			orderId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		} else {
 			ColumnUtil.setDataType(orderId, idDomain);
 		}
@@ -762,13 +762,13 @@
 		
 		orderUserId = factory.newModel(ColumnModel.class, uuid.get("db7a2f62-9658-406a-9dc1-8b90ae2da47c"));
 		orderUserId.setName("USER_ID");
-		orderUserId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		orderUserId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		orderUserId.setLogicalName("オーダーユーザID");
 		tableOrder.getAttributes().add(orderUserId);
 		
 		orderDate = factory.newModel(ColumnModel.class, uuid.get("4ce761b0-137b-4105-ad2a-2efcba5e6bc4"));
 		orderDate.setName("ORDER_DATE");
-		orderDate.setDataType(new DataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build());
+		orderDate.setDataType(new DataTypeBuilder(factory, DataTypeCategory.TIMESTAMP).build());
 		tableOrder.getAttributes().add(orderDate);
 		
 		orderPk = factory.newModel(PrimaryKeyModel.class, uuid.get("b204ff42-537b-4e14-bf61-e9baf1b119dc"));
@@ -791,7 +791,7 @@
 		userId = factory.newModel(ColumnModel.class, uuid.get("6b022a79-45a6-4be4-9d3d-cfb27042a08e"));
 		userId.setName("ID");
 		if (instruction.supressUseDomain) {
-			userId.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+			userId.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		} else {
 			ColumnUtil.setDataType(userId, idDomain);
 		}
@@ -801,7 +801,7 @@
 		userName = factory.newModel(ColumnModel.class, uuid.get("dacc68d2-fe32-4f4b-8082-9d55232ba7da"));
 		userName.setName("NAME");
 		if (instruction.supressUseDomain) {
-			userName.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32).build());
+			userName.setDataType(new DataTypeBuilder(factory, DataTypeCategory.VARCHAR).setSize(32).build());
 		} else {
 			ColumnUtil.setDataType(userName, nameDomain);
 		}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -22,6 +22,7 @@
 
 import org.jiemamy.JiemamyFactory;
 import org.jiemamy.model.datatype.BuiltinDataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter;
 import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
 import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
@@ -32,16 +33,20 @@
  */
 public class DataTypeBuilder extends ModelBuilder<BuiltinDataType> {
 	
+	public DataTypeBuilder(JiemamyFactory factory, DataTypeCategory typeCategory) {
+		this(factory, typeCategory, typeCategory.name());
+	}
+	
 	/**
 	 * インスタンスを生成する。
 	 * @param factory
-	 * @param sqlType 
+	 * @param typeCategory 
 	 * @param typeName 
 	 */
-	public DataTypeBuilder(JiemamyFactory factory, int sqlType, String typeName) {
+	public DataTypeBuilder(JiemamyFactory factory, DataTypeCategory typeCategory, String typeName) {
 		super(factory, BuiltinDataType.class);
 		Validate.notNull(typeName);
-		model.setSqlType(sqlType);
+		model.setCategory(typeCategory);
 		model.setTypeName(typeName);
 	}
 	

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataTypeUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataTypeUtil.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataTypeUtil.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,8 +18,6 @@
  */
 package org.jiemamy.utils.model;
 
-import java.sql.Types;
-
 import org.apache.commons.lang.Validate;
 
 import org.jiemamy.ReferenceResolver;
@@ -37,16 +35,6 @@
 public final class DataTypeUtil {
 	
 	/**
-	 *  {@link Types}で表される型を取得する。
-	 * @param dataType 対象
-	 * @param resolver 参照リゾルバ
-	 * @return {@link Types}で表される型
-	 */
-	public static int getSqlType(DataType dataType, ReferenceResolver resolver) {
-		return toBuiltinDataType(dataType, resolver).getSqlType();
-	}
-	
-	/**
 	 * データ型名を取得する。
 	 * @param dataType 対象
 	 * @param resolver 参照リゾルバ

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/builder/TableBuilderTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/builder/TableBuilderTest.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/builder/TableBuilderTest.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,8 +18,6 @@
  */
 package org.jiemamy.builder;
 
-import java.sql.Types;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -31,6 +29,7 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.datatype.DataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.utils.builder.ColumnBuilder;
 import org.jiemamy.utils.builder.DataTypeBuilder;
 import org.jiemamy.utils.builder.TableBuilder;
@@ -65,9 +64,9 @@
 		jiemamy = Jiemamy.newInstance();
 		factory = jiemamy.getFactory();
 		rootModel = factory.getRootModel();
-		DataType dataType1 = new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build();
-		DataType dataType2 = new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build();
-		DataType dataType3 = new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build();
+		DataType dataType1 = new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build();
+		DataType dataType2 = new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build();
+		DataType dataType3 = new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build();
 		col1 = new ColumnBuilder(factory, "column1", dataType1).build();
 		col2 = new ColumnBuilder(factory, "column2", dataType2).build();
 		col3 = new ColumnBuilder(factory, "column3", dataType3).build();

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/RootModelImplTest.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -25,8 +25,6 @@
 import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertThat;
 
-import java.sql.Types;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -35,6 +33,7 @@
 import org.jiemamy.Jiemamy;
 import org.jiemamy.JiemamyFactory;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.builder.DataTypeBuilder;
@@ -110,10 +109,10 @@
 		// モデル構築
 		DomainModel domain1 = factory.newModel(DomainModel.class);
 		domain1.setName("domain1");
-		domain1.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		domain1.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		DomainModel domain2 = factory.newModel(DomainModel.class);
 		domain2.setName("domain2");
-		domain2.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		domain2.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		
 		rootModel.getDomains().add(domain1);
 		

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -24,8 +24,6 @@
 import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.junit.Assert.assertThat;
 
-import java.sql.Types;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -35,6 +33,7 @@
 import org.jiemamy.JiemamyFactory;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.entity.TableModelImpl;
 import org.jiemamy.utils.builder.DataTypeBuilder;
@@ -113,10 +112,10 @@
 	public void test08_RootModelからのクローニングが適切に行われること() throws Exception {
 		ColumnModel column1 = factory.newModel(ColumnModel.class);
 		column1.setName("column1");
-		column1.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column1.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		ColumnModel column2 = factory.newModel(ColumnModel.class);
 		column2.setName("column2");
-		column2.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column2.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		
 		tableModel.getAttributes().add(column1);
 		

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,8 +18,6 @@
  */
 package org.jiemamy.utils.builder;
 
-import java.sql.Types;
-
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -34,6 +32,7 @@
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
 import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
 import org.jiemamy.model.entity.TableModel;
@@ -93,27 +92,27 @@
 		ColumnModel empId = factory.newModel(ColumnModel.class);
 		empId.setName("ID");
 		BuiltinDataType empIdDataType = factory.newModel(BuiltinDataType.class);
-		empIdDataType.setSqlType(Types.INTEGER);
+		empIdDataType.setCategory(DataTypeCategory.INTEGER);
 		empIdDataType.setTypeName("INTEGER");
 		empIdDataType.getAdapter(SerialDataTypeAdapter.class).setSerial(true);
 		empId.setDataType(empIdDataType);
 		ColumnModel empName = factory.newModel(ColumnModel.class);
 		empName.setName("NAME");
 		BuiltinDataType empNameDataType = factory.newModel(BuiltinDataType.class);
-		empNameDataType.setSqlType(Types.VARCHAR);
+		empNameDataType.setCategory(DataTypeCategory.VARCHAR);
 		empNameDataType.setTypeName("VARCHAR");
 		empNameDataType.getAdapter(SizedDataTypeAdapter.class).setSize(32);
 		empName.setDataType(empNameDataType);
 		ColumnModel empDeptId = factory.newModel(ColumnModel.class);
 		empDeptId.setName("DEPT_ID");
 		BuiltinDataType empDeptIdDataType = factory.newModel(BuiltinDataType.class);
-		empDeptIdDataType.setSqlType(Types.INTEGER);
+		empDeptIdDataType.setCategory(DataTypeCategory.INTEGER);
 		empDeptIdDataType.setTypeName("INTEGER");
 		empDeptId.setDataType(empDeptIdDataType);
 		ColumnModel empHiredate = factory.newModel(ColumnModel.class);
 		empHiredate.setName("HIREDATE");
 		BuiltinDataType empHireDateDataType = factory.newModel(BuiltinDataType.class);
-		empHireDateDataType.setSqlType(Types.TIMESTAMP);
+		empHireDateDataType.setCategory(DataTypeCategory.TIMESTAMP);
 		empHireDateDataType.setTypeName("TIMESTAMP");
 		empHiredate.setDataType(empHireDateDataType);
 		
@@ -134,21 +133,21 @@
 		ColumnModel deptId = factory.newModel(ColumnModel.class);
 		deptId.setName("ID");
 		BuiltinDataType deptIdDataType = factory.newModel(BuiltinDataType.class);
-		deptIdDataType.setSqlType(Types.INTEGER);
+		deptIdDataType.setCategory(DataTypeCategory.INTEGER);
 		deptIdDataType.setTypeName("INTEGER");
 		deptIdDataType.getAdapter(SerialDataTypeAdapter.class).setSerial(true);
 		deptId.setDataType(deptIdDataType);
 		ColumnModel deptName = factory.newModel(ColumnModel.class);
 		deptName.setName("NAME");
 		BuiltinDataType deptNameDataType = factory.newModel(BuiltinDataType.class);
-		deptNameDataType.setSqlType(Types.VARCHAR);
+		deptNameDataType.setCategory(DataTypeCategory.VARCHAR);
 		deptNameDataType.setTypeName("VARCHAR");
 		deptNameDataType.getAdapter(SizedDataTypeAdapter.class).setSize(32);
 		deptName.setDataType(deptNameDataType);
 		ColumnModel deptLocation = factory.newModel(ColumnModel.class);
 		deptLocation.setName("LOCATION");
 		BuiltinDataType deptLocationDataType = factory.newModel(BuiltinDataType.class);
-		deptLocationDataType.setSqlType(Types.VARCHAR);
+		deptLocationDataType.setCategory(DataTypeCategory.VARCHAR);
 		deptLocationDataType.setTypeName("VARCHAR");
 		deptLocationDataType.getAdapter(SizedDataTypeAdapter.class).setSize(16);
 		deptLocation.setDataType(deptLocationDataType);
@@ -188,23 +187,23 @@
 		// EMPテーブルのビルド
 		rootModel.getEntities().add(
 				new TableBuilder(factory, "T_EMP").column(
-						new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER")
+						new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, DataTypeCategory.INTEGER)
 							.setSerial(true).build()).build()).column(
-						new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
+						new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, DataTypeCategory.VARCHAR)
 							.setSize(32).build()).build()).column(
-						new ColumnBuilder(factory, "DEPT_ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER")
+						new ColumnBuilder(factory, "DEPT_ID", new DataTypeBuilder(factory, DataTypeCategory.INTEGER)
 							.build()).build()).column(
-						new ColumnBuilder(factory, "HIREDATE", new DataTypeBuilder(factory, Types.TIMESTAMP,
-								"TIMESTAMP").build()).build()).primaryKey(0).build());
+						new ColumnBuilder(factory, "HIREDATE", new DataTypeBuilder(factory, DataTypeCategory.TIMESTAMP)
+							.build()).build()).primaryKey(0).build());
 		
 		// DEPTテーブルのビルド
 		rootModel.getEntities().add(
 				new TableBuilder(factory, "T_DEPT").column(
-						new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER")
+						new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, DataTypeCategory.INTEGER)
 							.setSerial(true).build()).build()).column(
-						new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
+						new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, DataTypeCategory.VARCHAR)
 							.setSize(32).build()).build()).column(
-						new ColumnBuilder(factory, "LOCATION", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
+						new ColumnBuilder(factory, "LOCATION", new DataTypeBuilder(factory, DataTypeCategory.VARCHAR)
 							.setSize(16).build()).build()).primaryKey(0).build());
 		
 		// 外部キーの設定

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataType.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataType.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/BuiltinDataType.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -18,8 +18,6 @@
  */
 package org.jiemamy.model.datatype;
 
-import java.sql.Types;
-
 import org.jiemamy.utils.Adaptable;
 
 /**
@@ -29,10 +27,10 @@
 public interface BuiltinDataType extends DataType, Adaptable {
 	
 	/**
-	 *  {@link Types}で表される型を取得する。
-	 * @return {@link Types}で表される型
+	 *  型カテゴリを取得する。
+	 * @return 型カテゴリ
 	 */
-	int getSqlType();
+	DataTypeCategory getCategory();
 	
 	/**
 	 * データ型名を取得する。
@@ -41,10 +39,10 @@
 	String getTypeName();
 	
 	/**
-	 * {@link Types}で表される型を設定する。
-	 * @param sqlType {@link Types}で表される型
+	 * 型カテゴリを設定する。
+	 * @param category 型カテゴリ
 	 */
-	void setSqlType(int sqlType);
+	void setCategory(DataTypeCategory category);
 	
 	/**
 	 * データ型名を設定する。

Copied: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java (from rev 2638, zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/TypicalDataType.java)
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java	                        (rev 0)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/08
+ *
+ * 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.model.datatype;
+
+import java.sql.Types;
+
+/**
+ * 代表的なデータ型を表す列挙型
+ * 
+ * @author daisuke
+ */
+public enum DataTypeCategory {
+	
+	/** CHARACTER型 */
+	CHARACTER(Types.CHAR),
+
+	/** VARCHAR型 */
+	VARCHAR(Types.VARCHAR),
+
+	/** CLOB型 */
+	CLOB(Types.CLOB),
+
+	/** BLOB型 */
+	BLOB(Types.BLOB),
+
+	/** BIT型 */
+	BIT(Types.BIT),
+
+	/** VARBIT型 */
+	VARBIT(Types.OTHER),
+
+	/** NUMERIC型 */
+	NUMERIC(Types.NUMERIC),
+
+	/** DECIMAL型 */
+	DECIMAL(Types.DECIMAL),
+
+	/** INTEGER型 */
+	INTEGER(Types.INTEGER),
+
+	/** SMALLINT型 */
+	SMALLINT(Types.SMALLINT),
+
+	/** FLOAT型 */
+	FLOAT(Types.FLOAT),
+
+	/** REAL型 */
+	REAL(Types.REAL),
+
+	/** DOUBLE型 */
+	DOUBLE(Types.DOUBLE),
+
+	/** BOOLEAN型 */
+	BOOLEAN(Types.BOOLEAN),
+
+	/** DATE型 */
+	DATE(Types.DATE),
+
+	/** TIME型 */
+	TIME(Types.TIME),
+
+	/** TIMESTAMP型 */
+	TIMESTAMP(Types.TIMESTAMP),
+
+	/** INTERVAL型 */
+	INTERVAL(Types.OTHER),
+
+	/** その他型 */
+	OTHER(Types.OTHER);
+	
+	/**
+	 * TODO for daisuke
+	 * 
+	 * @param sqlType
+	 * @return
+	 */
+	public static DataTypeCategory fromSqlType(int sqlType) {
+		for (DataTypeCategory category : values()) {
+			if (category.sqlType == sqlType) {
+				return category;
+			}
+		}
+		return null;
+	}
+	
+
+	private final int sqlType;
+	
+
+	DataTypeCategory(int sqlType) {
+		this.sqlType = sqlType;
+		
+	}
+	
+	public int getSqlType() {
+		return sqlType;
+	}
+	
+}


Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DataTypeCategory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/TypicalDataType.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/TypicalDataType.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/TypicalDataType.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -1,96 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2009/02/08
- *
- * 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.model.datatype;
-
-import java.sql.Types;
-
-/**
- * 代表的なデータ型を表す列挙型
- * 
- * @author daisuke
- */
-public enum TypicalDataType implements DataType {
-	
-	/** CHARACTER型 */
-	CHARACTER(Types.CHAR),
-
-	/** VARCHAR型 */
-	VARCHAR(Types.VARCHAR),
-
-	/** CLOB型 */
-	CLOB(Types.CLOB),
-
-	/** BLOB型 */
-	BLOB(Types.BLOB),
-
-	/** BIT型 */
-	BIT(Types.BIT),
-
-	/** VARBIT型 */
-	VARBIT(Types.OTHER),
-
-	/** NUMERIC型 */
-	NUMERIC(Types.NUMERIC),
-
-	/** DECIMAL型 */
-	DECIMAL(Types.DECIMAL),
-
-	/** INTEGER型 */
-	INTEGER(Types.INTEGER),
-
-	/** SMALLINT型 */
-	SMALLINT(Types.SMALLINT),
-
-	/** FLOAT型 */
-	FLOAT(Types.FLOAT),
-
-	/** REAL型 */
-	REAL(Types.REAL),
-
-	/** DOUBLE型 */
-	DOUBLE(Types.DOUBLE),
-
-	/** BOOLEAN型 */
-	BOOLEAN(Types.BOOLEAN),
-
-	/** DATE型 */
-	DATE(Types.DATE),
-
-	/** TIME型 */
-	TIME(Types.TIME),
-
-	/** TIMESTAMP型 */
-	TIMESTAMP(Types.TIMESTAMP),
-
-	/** INTERVAL型 */
-	INTERVAL(Types.OTHER);
-	
-	private final int sqlType;
-	
-
-	TypicalDataType(int sqlType) {
-		this.sqlType = sqlType;
-		
-	}
-	
-	public int getSqlType() {
-		return sqlType;
-	}
-	
-}

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java	2009-02-09 12:36:49 UTC (rev 2640)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java	2009-02-09 12:39:00 UTC (rev 2641)
@@ -108,7 +108,7 @@
 	DATA_TYPE(CoreNamespace.NS_CORE, "dataType"),
 
 	/***/
-	SQL_TYPE(CoreNamespace.NS_CORE, "sqlType"),
+	TYPE_CATEGORY(CoreNamespace.NS_CORE, "typeCategory"),
 
 	/***/
 	TYPE_NAME(CoreNamespace.NS_CORE, "typeName"),

Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd	2009-02-09 12:36:49 UTC (rev 2640)
+++ zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd	2009-02-09 12:39:00 UTC (rev 2641)
@@ -293,7 +293,7 @@
 		</xsd:annotation>
 		<xsd:complexType>
 			<xsd:sequence>
-				<xsd:element name="sqlType" minOccurs="0" type="xsd:integer"/>
+				<xsd:element name="typeCategory" minOccurs="0" type="typeCategoryType"/>
 				<xsd:element name="typeName" minOccurs="0" type="xsd:string"/>
 				<xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/>
 			</xsd:sequence>
@@ -423,6 +423,30 @@
 		</xsd:restriction>
 	</xsd:simpleType>
 
+	<xsd:simpleType name="typeCategoryType">
+		<xsd:restriction base="xsd:token">
+			<xsd:enumeration value="CHARACTER" />
+			<xsd:enumeration value="VARCHAR" />
+			<xsd:enumeration value="CLOB" />
+			<xsd:enumeration value="BLOB" />
+			<xsd:enumeration value="BIT" />
+			<xsd:enumeration value="VARBIT" />
+			<xsd:enumeration value="NUMERIC" />
+			<xsd:enumeration value="DECIMAL" />
+			<xsd:enumeration value="INTEGER" />
+			<xsd:enumeration value="SMALLINT" />
+			<xsd:enumeration value="FLOAT" />
+			<xsd:enumeration value="REAL" />
+			<xsd:enumeration value="DOUBLE" />
+			<xsd:enumeration value="BOOLEAN" />
+			<xsd:enumeration value="DATE" />
+			<xsd:enumeration value="TIME" />
+			<xsd:enumeration value="TIMESTAMP" />
+			<xsd:enumeration value="INTERVAL" />
+			<xsd:enumeration value="OTHER" />
+		</xsd:restriction>
+	</xsd:simpleType>
+
 	<xsd:simpleType name="referentialActionType">
 		<xsd:annotation>
 			<xsd:documentation source="description" xml:lang="ja-JP">onDelete/onUpdateに設定できる値</xsd:documentation>

Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml	2009-02-09 12:36:49 UTC (rev 2640)
+++ zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml	2009-02-09 12:39:00 UTC (rev 2641)
@@ -9,7 +9,7 @@
     <domain id="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9">
       <name>ID</name>
       <dataType>
-        <sqlType>4</sqlType>
+        <typeCategory>INTEGER</typeCategory>
         <typeName>INTEGER</typeName>
         <adapter class="org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter">
           <serial>true</serial>
@@ -27,7 +27,7 @@
       <name>NAME</name>
       <description>人名用の型です。</description>
       <dataType>
-        <sqlType>12</sqlType>
+        <typeCategory>VARCHAR</typeCategory>
         <typeName>VARCHAR</typeName>
         <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter">
           <size>32</size>
@@ -54,7 +54,7 @@
           <name>EMP_NO</name>
           <logicalName>従業員番号</logicalName>
           <dataType>
-            <sqlType>4</sqlType>
+            <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
           <adapter class="org.jiemamy.utils.DisablableImpl">
@@ -77,7 +77,7 @@
           <name>MGR_ID</name>
           <logicalName>上司ID</logicalName>
           <dataType>
-            <sqlType>4</sqlType>
+            <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
           <adapter class="org.jiemamy.utils.DisablableImpl">
@@ -87,7 +87,7 @@
         <column id="f0b57eed-98ab-4c21-9855-218c592814dc">
           <name>HIREDATE</name>
           <dataType>
-            <sqlType>91</sqlType>
+            <typeCategory>DATE</typeCategory>
             <typeName>DATE</typeName>
           </dataType>
           <adapter class="org.jiemamy.utils.DisablableImpl">
@@ -97,7 +97,7 @@
         <column id="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">
           <name>SAL</name>
           <dataType>
-            <sqlType>2</sqlType>
+            <typeCategory>NUMERIC</typeCategory>
             <typeName>NUMERIC</typeName>
             <adapter class="org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter">
               <precision>7</precision>
@@ -111,7 +111,7 @@
         <column id="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">
           <name>DEPT_ID</name>
           <dataType>
-            <sqlType>4</sqlType>
+            <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
           <adapter class="org.jiemamy.utils.DisablableImpl">
@@ -208,7 +208,7 @@
           <name>DEPT_NO</name>
           <logicalName>部署番号</logicalName>
           <dataType>
-            <sqlType>4</sqlType>
+            <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
           <adapter class="org.jiemamy.utils.DisablableImpl">
@@ -219,7 +219,7 @@
           <name>DEPT_NAME</name>
           <logicalName>部署名</logicalName>
           <dataType>
-            <sqlType>12</sqlType>
+            <typeCategory>VARCHAR</typeCategory>
             <typeName>VARCHAR</typeName>
             <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter">
               <size>20</size>
@@ -236,7 +236,7 @@
           <name>LOC</name>
           <logicalName>ロケーション</logicalName>
           <dataType>
-            <sqlType>12</sqlType>
+            <typeCategory>VARCHAR</typeCategory>
             <typeName>VARCHAR</typeName>
             <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter">
               <size>20</size>



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