[Jiemamy-notify:2332] commit [3342] depったメソッドの使用を回避。

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 4月 30日 (木) 23:43:06 JST


Revision: 3342
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3342
Author:   daisuke_m
Date:     2009-04-30 23:43:06 +0900 (Thu, 30 Apr 2009)

Log Message:
-----------
depったメソッドの使用を回避。

Modified Paths:
--------------
    artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/internal/serializer/SerializationTest.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/DataTypeBuilderImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/ForeignKeyBuilderImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/TableBuilderImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/BuiltinDataTypeImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/DomainRefImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomBuilder.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EntityDependencyCalculator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataTypeUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/CheckConstraintValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ColumnValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ForeignKeyValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/IndexValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/KeyConstraintValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/PrimaryKeyValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/TableValidator.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/EntityUtilTest.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java
    artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlEmitter.java
    artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlEmitterTest.java
    artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlEntityImportVisitor.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/foreignkey/ForeignKeyEditDialog.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialog.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialogTableTab.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java
    metis/documents/trunk/src/test/java/org/jiemamy/documents/JiemamyTest.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java

Added Paths:
-----------
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/attribute/
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/attribute/AbstractAttributeModelTest.java

Removed Paths:
-------------
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java


-------------- next part --------------
Modified: artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/internal/serializer/SerializationTest.java
===================================================================
--- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/internal/serializer/SerializationTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/internal/serializer/SerializationTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -157,7 +157,7 @@
 		assertThat(jxpath.getValue("domains[2]/logicalName"), is(nullValue()));
 		
 		logger.info("***Entities");
-		Collection<TableModel> tables = rootModel.getEntities(TableModel.class);
+		Collection<TableModel> tables = rootModel.findEntities(TableModel.class);
 		for (TableModel tableModel : tables) {
 			logger.info("  Table:" + tableModel.getId() + "," + tableModel.getName() + ","
 					+ tableModel.getLogicalName() + "," + tableModel.getDescription());
@@ -168,7 +168,7 @@
 		}
 		assertThat(tables.size(), is(2));
 		
-		Collection<ViewModel> views = rootModel.getEntities(ViewModel.class);
+		Collection<ViewModel> views = rootModel.findEntities(ViewModel.class);
 		for (ViewModel view : views) {
 			logger.info("  View:" + view);
 		}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -70,8 +70,8 @@
 				constrainedTable.getAttributes().add(foreignKey);
 				importedForeignKeys.put(keys.fkName, foreignKey);
 			}
-			ColumnModel fkColumn = constrainedTable.getColumn(keys.fkColumnName);
-			ColumnModel pkColumn = referenceTable.getColumn(keys.pkColumnName);
+			ColumnModel fkColumn = constrainedTable.findColumn(keys.fkColumnName);
+			ColumnModel pkColumn = referenceTable.findColumn(keys.pkColumnName);
 			ForeignKeyUtil.addMapping(foreignKey, fkColumn, pkColumn);
 			
 			if (keys.updateRule != null) {

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -81,8 +81,6 @@
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.EssentialStack;
 import org.jiemamy.utils.EssentialStacks;
-import org.jiemamy.utils.model.AttributeUtil;
-import org.jiemamy.utils.model.EntityUtil;
 import org.jiemamy.utils.model.TableUtil;
 
 /**
@@ -305,7 +303,7 @@
 			for (EntityModel entityModel : dependentEntities) {
 				if (entityModel instanceof TableModel) {
 					TableModel dependentTable = (TableModel) entityModel;
-					List<ForeignKey> foreignKeys = dependentTable.getAttributes(ForeignKey.class);
+					List<ForeignKey> foreignKeys = dependentTable.findAttributes(ForeignKey.class);
 					for (ForeignKey foreignKey : foreignKeys) {
 						if (foreignKey.findReferencedKeyConstraint() == null) {
 							removeAttribute(dependentTable, foreignKey);
@@ -318,7 +316,7 @@
 		// カラムを削除する場合、全てのキーに含まれる該当カラムへの参照も同時に削除する
 		if (attributeModel instanceof ColumnModel) {
 			ColumnModel columnModel = (ColumnModel) attributeModel;
-			List<KeyConstraint> keys = tableModel.getAttributes(KeyConstraint.class, true);
+			List<KeyConstraint> keys = tableModel.findAttributes(KeyConstraint.class, true);
 			for (KeyConstraint keyConstraint : keys) {
 				removeKeyColumn(keyConstraint, columnModel);
 			}
@@ -358,7 +356,7 @@
 			logger.warn("Dialectのロスト", e);
 			dialect = new GenericDialect();
 		}
-		Collection<TableModel> tableModels = rootModel.getEntities(TableModel.class);
+		Collection<TableModel> tableModels = rootModel.findEntities(TableModel.class);
 		for (TableModel tableModel : tableModels) {
 			List<ColumnModel> columns = tableModel.findColumns();
 			for (ColumnModel columnModel : columns) {
@@ -402,7 +400,7 @@
 		if (entityModel instanceof TableModel) {
 			// 該当エンティティを参照する外部キーも同時に削除する
 			TableModel tableModel = (TableModel) entityModel;
-			Collection<EntityModel> sourceEntities = EntityUtil.getDependentEntities(tableModel, false);
+			Collection<EntityModel> sourceEntities = tableModel.findSubEntities(false);
 			for (EntityModel sourceEntity : sourceEntities) {
 				if (sourceEntity instanceof TableModel) {
 					TableModel sourceTable = (TableModel) sourceEntity;
@@ -469,7 +467,7 @@
 		
 		// 削除の結果、キーカラムの数が0になった場合、キー制約自体を所属テーブルから削除する
 		if (keyConstraint.getKeyColumns().size() == 0) {
-			TableModel definedTable = AttributeUtil.getDefinedTable(keyConstraint);
+			TableModel definedTable = keyConstraint.findDeclaringTable();
 			if (definedTable != null) {
 				removeAttribute(definedTable, keyConstraint);
 			}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/DataTypeBuilderImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/DataTypeBuilderImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/DataTypeBuilderImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -32,7 +32,6 @@
 import org.jiemamy.model.datatype.DataTypeCategory;
 import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter;
 import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * {@link BuiltinDataType}を構築するためのビルダー実装クラス。
@@ -59,7 +58,7 @@
 		RootModel rootModel = factory.getRootModel();
 		Dialect dialect;
 		try {
-			dialect = RootModelUtil.getDialect(rootModel);
+			dialect = rootModel.findDialect();
 		} catch (ClassNotFoundException e) {
 			logger.warn("Dialectのロスト", e);
 			dialect = new GenericDialect();

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/ForeignKeyBuilderImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/ForeignKeyBuilderImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/ForeignKeyBuilderImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -32,9 +32,7 @@
 import org.jiemamy.model.attribute.constraint.LocalKeyConstraint;
 import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.AttributeUtil;
 import org.jiemamy.utils.model.ForeignKeyUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * {@link ForeignKey}を構築するためのビルダー実装クラス。
@@ -68,7 +66,7 @@
 		this.constrainedTable = constrainedTable;
 		this.referenceTable = referenceTable;
 		
-		localKeys = TableUtil.getAttributes(referenceTable, LocalKeyConstraint.class);
+		localKeys = referenceTable.findAttributes(LocalKeyConstraint.class);
 	}
 	
 	public ForeignKeyBuilder mapping(ColumnModel keyColumn, ColumnModel referenceColumn) {
@@ -88,10 +86,10 @@
 			throw new ModelConsistenceException();
 		}
 		
-		EntityModel referenceEntity = ForeignKeyUtil.getReferenceEntity(model);
+		EntityModel referenceEntity = model.findReferencedEntity();
 		if (referenceEntity != null) {
 			ColumnModel columnModel = resolver.resolve(referenceColumn);
-			TableModel definedTable = AttributeUtil.getDefinedTable(columnModel);
+			TableModel definedTable = columnModel.findDeclaringTable();
 			if (referenceEntity != definedTable) {
 				throw new ModelConsistenceException();
 			}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/TableBuilderImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/TableBuilderImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/builder/TableBuilderImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -25,7 +25,6 @@
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKey;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * {@link TableModel}を構築するためのビルダー実装クラス。
@@ -72,11 +71,11 @@
 	 */
 	public TableBuilder primaryKey(int index, int... otherIndexes) {
 		PrimaryKey primaryKey = factory.newModel(PrimaryKey.class);
-		ColumnModel pkColumn = TableUtil.getColumns(model).get(index);
+		ColumnModel pkColumn = model.findColumns().get(index);
 		primaryKey.getKeyColumns().add(factory.newReference(pkColumn));
 		
 		for (int otherIndex : otherIndexes) {
-			pkColumn = TableUtil.getAttributes(model, ColumnModel.class).get(otherIndex);
+			pkColumn = model.findAttributes(ColumnModel.class).get(otherIndex);
 			if (primaryKey.getKeyColumns().contains(pkColumn) == false) {
 				primaryKey.getKeyColumns().add(factory.newReference(pkColumn));
 			}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/RootModelImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -26,13 +26,21 @@
 import org.apache.commons.lang.Validate;
 
 import org.jiemamy.Jiemamy;
+import org.jiemamy.ReferenceResolver;
 import org.jiemamy.dialect.Dialect;
+import org.jiemamy.exception.ElementNotFoundException;
+import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.attribute.ColumnRef;
+import org.jiemamy.model.attribute.constraint.PrimaryKey;
+import org.jiemamy.model.attribute.constraint.UniqueKey;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.entity.EntityModel;
+import org.jiemamy.model.entity.TableModel;
+import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.ValidateUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * 1つのDBスキーマ・データ全体を表す。
@@ -92,6 +100,25 @@
 //		}
 //	}
 	
+	public Dialect findDialect() throws ClassNotFoundException {
+		return getJiemamy().getDialect(this);
+	}
+	
+	public <T extends EntityModel>Collection<T> findEntities(Class<T> clazz) {
+		Validate.notNull(clazz);
+		
+		List<T> nodes = CollectionsUtil.newArrayList();
+		for (EntityModel entityModel : getEntities()) {
+			if (clazz.isAssignableFrom(entityModel.getClass())) {
+				// 直前でロジックによる型チェックを行っているため、キャスト安全である。
+				@SuppressWarnings("unchecked")
+				T castedNode = (T) entityModel;
+				nodes.add(castedNode);
+			}
+		}
+		return nodes;
+	}
+	
 	public String getBeginScript() {
 		return beginScript;
 	}
@@ -105,11 +132,6 @@
 		return description;
 	}
 	
-	public Dialect findDialect() throws ClassNotFoundException {
-		// TODO インライン展開
-		return RootModelUtil.getDialect(this);
-	}
-	
 	public String getDialectClassName() {
 		return dialectClassName;
 	}
@@ -128,14 +150,22 @@
 		return entities;
 	}
 	
-	public <T extends EntityModel>Collection<T> getEntities(Class<T> clazz) {
-		// TODO インライン展開
-		return RootModelUtil.getEntities(this, clazz);
-	}
-	
 	public <T extends EntityModel>T getEntity(Class<T> clazz, String entityName) {
-		// TODO インライン展開
-		return RootModelUtil.getEntity(this, clazz, entityName);
+		Validate.notNull(entityName);
+		
+		List<T> entities = CollectionsUtil.newArrayList();
+		for (EntityModel entityModel : getEntities()) {
+			if (entityName.equalsIgnoreCase(entityModel.getName())
+					&& (clazz == null || clazz.isAssignableFrom(entityModel.getClass()))) {
+				entities.add((T) entityModel);
+			}
+		}
+		if (entities.size() == 0) {
+			throw new ElementNotFoundException(this, entityName);
+		} else if (entities.size() > 1) {
+			throw new TooManyElementsException(this, entityName, entities);
+		}
+		return entities.get(0);
 	}
 	
 	public String getSchemaName() {
@@ -143,8 +173,36 @@
 	}
 	
 	public void normalize() {
-		// TODO インライン展開
-		RootModelUtil.normalize(this);
+		ReferenceResolver resolver = getJiemamy().getReferenceResolver();
+		for (TableModel tableModel : findEntities(TableModel.class)) {
+			// PKの正規化
+			try {
+				tableModel.findAttribute(PrimaryKey.class, false);
+			} catch (ElementNotFoundException e) {
+				try {
+					PrimaryKey primaryKey = tableModel.findPrimaryKey();
+					ColumnRef columnRef = primaryKey.getKeyColumns().get(0);
+					resolver.resolve(columnRef).setPrimaryKey(null);
+					tableModel.getAttributes().add(primaryKey);
+				} catch (ElementNotFoundException e2) {
+					// nothing to do
+				}
+			}
+			
+			// UKの正規化
+			for (ColumnModel columnModel : tableModel.findColumns()) {
+				UniqueKey uniqueKey = columnModel.getUniqueKey();
+				if (uniqueKey != null) {
+					columnModel.setUniqueKey(null);
+					tableModel.getAttributes().add(uniqueKey);
+				}
+			}
+			
+			// 属性順序の正規化
+			// THINK 順序の正規化をするかしないか
+			//			Comparator<AttributeModel> comparator = new AttributeComparator(tableModel);
+			//			Collections.sort(tableModel.getAttributes(), comparator);
+		}
 	}
 	
 	public void setBeginScript(String beginScript) {

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/AbstractAttributeModel.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -22,9 +22,9 @@
 
 import org.jiemamy.Jiemamy;
 import org.jiemamy.internal.model.AbstractJiemamyElement;
+import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.AttributeUtil;
 
 /**
  * {@link AttributeModel}の骨格実装。
@@ -55,8 +55,13 @@
 	}
 	
 	public TableModel findDeclaringTable() {
-		// TODO インライン展開
-		return AttributeUtil.getDefinedTable(this);
+		RootModel rootModel = getJiemamy().getFactory().getRootModel();
+		for (TableModel tableModel : rootModel.findEntities(TableModel.class)) {
+			if (tableModel.getAttributes().contains(this)) {
+				return tableModel;
+			}
+		}
+		return null;
 	}
 	
 	public String getDescription() {

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/ColumnModelImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -18,16 +18,19 @@
  */
 package org.jiemamy.internal.model.attribute;
 
+import java.util.List;
 import java.util.UUID;
 
 import org.jiemamy.Jiemamy;
+import org.jiemamy.exception.ElementNotFoundException;
 import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.ColumnCheckConstraint;
 import org.jiemamy.model.attribute.constraint.NotNullConstraint;
 import org.jiemamy.model.attribute.constraint.PrimaryKey;
 import org.jiemamy.model.attribute.constraint.UniqueKey;
 import org.jiemamy.model.datatype.DataType;
-import org.jiemamy.utils.model.ColumnUtil;
+import org.jiemamy.model.entity.TableModel;
 
 /**
  * カラム定義モデル。Artemisにおける{@link ColumnModel}の実装クラス。
@@ -63,6 +66,23 @@
 		setName("");
 	}
 	
+	public boolean checkPrimaryKeyColumn() {
+		TableModel tableModel = findDeclaringTable();
+		PrimaryKey primaryKey;
+		try {
+			primaryKey = tableModel.findAttribute(PrimaryKey.class, true);
+		} catch (ElementNotFoundException e) {
+			return false;
+		}
+		List<ColumnRef> keyColumns = primaryKey.getKeyColumns();
+		for (ColumnRef columnRef : keyColumns) {
+			if (columnRef.getReferenceId().equals(getId())) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
 	public ColumnCheckConstraint getCheckConstraint() {
 		return checkConstraint;
 	}
@@ -87,11 +107,6 @@
 		return uniqueKey;
 	}
 	
-	public boolean checkPrimaryKeyColumn() {
-		// TODO インライン展開
-		return ColumnUtil.isPartOfPrimaryKeyColumns(this);
-	}
-	
 	public void setCheckConstraint(ColumnCheckConstraint checkConstraint) {
 		this.checkConstraint = checkConstraint;
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/attribute/constraint/ForeignKeyImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -18,15 +18,20 @@
  */
 package org.jiemamy.internal.model.attribute.constraint;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.UUID;
 
 import org.jiemamy.Jiemamy;
+import org.jiemamy.exception.ModelConsistenceException;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.attribute.constraint.KeyConstraint;
 import org.jiemamy.model.entity.EntityModel;
-import org.jiemamy.utils.model.ForeignKeyUtil;
+import org.jiemamy.model.entity.TableModel;
+import org.jiemamy.utils.CollectionsUtil;
 
 /**
  * 外部キーモデル。
@@ -59,6 +64,52 @@
 		super(jiemamy, id);
 	}
 	
+	public EntityModel findReferencedEntity() {
+		if (getReferenceColumns().size() == 0) {
+			throw new ModelConsistenceException();
+		}
+		Jiemamy jiemamy = getJiemamy();
+		ColumnRef columnRef = getReferenceColumns().get(0);
+		
+		RootModel rootModel = jiemamy.getFactory().getRootModel();
+		for (TableModel tableModel : rootModel.findEntities(TableModel.class)) {
+			for (ColumnModel columnModel : tableModel.findColumns()) {
+				if (columnRef.getReferenceId().equals(columnModel.getId())) {
+					return tableModel;
+				}
+			}
+		}
+		return null;
+	}
+	
+	public KeyConstraint findReferencedKeyConstraint() {
+		TableModel referenceTable = (TableModel) findReferencedEntity();
+		for (KeyConstraint keyConstraint : referenceTable.findAttributes(KeyConstraint.class, true)) {
+			
+			// サイズ不一致であれば、そもそもこのキーを参照したものではない
+			if (keyConstraint.getKeyColumns().size() != getReferenceColumns().size()) {
+				continue;
+			}
+			
+			Collection<UUID> referenceSetIds = CollectionsUtil.newArrayList();
+			for (ColumnRef referenceKeyColumn : keyConstraint.getKeyColumns()) {
+				referenceSetIds.add(referenceKeyColumn.getReferenceId());
+			}
+			
+			boolean found = true;
+			for (ColumnRef target : getReferenceColumns()) {
+				if (referenceSetIds.contains(target.getReferenceId()) == false) {
+					found = false;
+				}
+			}
+			
+			if (found) {
+				return keyConstraint;
+			}
+		}
+		return null;
+	}
+	
 	public MatchType getMatchType() {
 		return matchType;
 	}
@@ -75,16 +126,6 @@
 		return referenceColumns;
 	}
 	
-	public EntityModel findReferencedEntity() {
-		// TODO インライン展開
-		return ForeignKeyUtil.getReferenceEntity(this);
-	}
-	
-	public KeyConstraint findReferencedKeyConstraint() {
-		// TODO インライン展開
-		return ForeignKeyUtil.getReferenceKeyConstraint(this);
-	}
-	
 	public void setMatchType(MatchType matchType) {
 		this.matchType = matchType;
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/BuiltinDataTypeImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/BuiltinDataTypeImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/BuiltinDataTypeImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -26,7 +26,6 @@
 import org.jiemamy.internal.model.AbstractAdaptable;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DataTypeCategory;
-import org.jiemamy.utils.model.DataTypeUtil;
 
 /**
  * {@link BuiltinDataType}の実装クラス。
@@ -72,8 +71,9 @@
 	}
 	
 	public BuiltinDataType toBuiltinDataType(ReferenceResolver resolver) {
-		// TODO インライン展開
-		return DataTypeUtil.toBuiltinDataType(this, resolver);
+		Validate.notNull(resolver);
+		
+		return this;
 	}
 	
 	@Override

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/DomainRefImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/DomainRefImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/datatype/DomainRefImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -20,13 +20,14 @@
 
 import java.util.UUID;
 
+import org.apache.commons.lang.Validate;
+
 import org.jiemamy.Jiemamy;
 import org.jiemamy.ReferenceResolver;
 import org.jiemamy.internal.model.AbstractElementReference;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.datatype.DomainRef;
-import org.jiemamy.utils.model.DataTypeUtil;
 
 /**
  * {@link DomainModel}に対する参照オブジェクトの実装。Artemisにおける{@link DomainRef}の実装クラス。
@@ -57,8 +58,10 @@
 	}
 	
 	public BuiltinDataType toBuiltinDataType(ReferenceResolver resolver) {
-		// TODO インライン展開
-		return DataTypeUtil.toBuiltinDataType(this, resolver);
+		Validate.notNull(resolver);
+		
+		DomainModel domainModel = resolver.resolve(this);
+		return domainModel.getDataType();
 	}
 	
 }

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/AbstractEntityModel.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -19,12 +19,21 @@
 package org.jiemamy.internal.model.entity;
 
 import java.util.Collection;
+import java.util.Set;
 import java.util.UUID;
 
+import org.apache.commons.lang.Validate;
+
 import org.jiemamy.Jiemamy;
+import org.jiemamy.ReferenceResolver;
 import org.jiemamy.internal.model.AbstractJiemamyElement;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.attribute.ColumnRef;
+import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.entity.EntityModel;
-import org.jiemamy.utils.model.EntityUtil;
+import org.jiemamy.model.entity.TableModel;
+import org.jiemamy.utils.CollectionsUtil;
 
 /**
  * エンティティ(TableやView)の抽象モデルクラス。
@@ -33,6 +42,110 @@
  */
 public abstract class AbstractEntityModel extends AbstractJiemamyElement implements EntityModel {
 	
+	/**
+	 * 直接の依存モデルの集合を返す。
+	 * 
+	 * @param standardEntity 基準エンティティ
+	 * @return 直接の依存モデルの集合
+	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
+	 */
+	private static Collection<EntityModel> getSubEntitiesNonRecursive(EntityModel standardEntity) {
+		Validate.notNull(standardEntity);
+		Set<EntityModel> dependents = CollectionsUtil.newHashSet();
+		Jiemamy jiemamy = standardEntity.getJiemamy();
+		RootModel rootModel = jiemamy.getFactory().getRootModel();
+		ReferenceResolver resolver = jiemamy.getReferenceResolver();
+		
+		for (EntityModel entityModel : rootModel.getEntities()) {
+			if (entityModel instanceof TableModel) {
+				TableModel dependentTableModel = (TableModel) entityModel;
+				for (ForeignKey foreignKey : dependentTableModel.findAttributes(ForeignKey.class)) {
+					if (foreignKey.getReferenceColumns().size() == 0) {
+						continue;
+					}
+					ColumnRef columnRef = foreignKey.getReferenceColumns().get(0);
+					ColumnModel columnModel = resolver.resolve(columnRef);
+					TableModel referenceTableModel = columnModel.findDeclaringTable();
+					if (referenceTableModel == null) {
+						continue;
+					}
+					if (referenceTableModel.getId().equals(standardEntity.getId())) {
+						dependents.add(dependentTableModel);
+					}
+				}
+			}
+		}
+		
+		return dependents;
+	}
+	
+	/**
+	 * 全ての依存モデルの集合を返す。
+	 * 
+	 * @param standardEntity 基準エンティティ
+	 * @return 全ての依存モデルの集合
+	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
+	 */
+	private static Collection<EntityModel> getSubEntitiesRecursive(EntityModel standardEntity) {
+		Validate.notNull(standardEntity);
+		Collection<EntityModel> parentEntities = getSubEntitiesNonRecursive(standardEntity);
+		Set<EntityModel> entities = CollectionsUtil.newHashSet();
+		entities.addAll(parentEntities);
+		
+		for (EntityModel parentEntity : parentEntities) {
+			if (standardEntity.equals(parentEntity) == false) {
+				entities.addAll(getSubEntitiesRecursive(parentEntity));
+			}
+		}
+		
+		return entities;
+	}
+	
+	/**
+	 * 参照先親モデルを返す。
+	 * 
+	 * @param entityModel 対象エンティティ
+	 * @return 親モデルのSet
+	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
+	 */
+	private static Collection<EntityModel> getSuperEntitiesNonRecursive(EntityModel entityModel) {
+		Validate.notNull(entityModel);
+		Collection<EntityModel> parents = CollectionsUtil.newArrayList();
+		
+		if (entityModel instanceof TableModel) {
+			TableModel tableModel = (TableModel) entityModel;
+			for (ForeignKey foreignKey : tableModel.findAttributes(ForeignKey.class)) {
+				EntityModel keyEntity = foreignKey.findReferencedEntity();
+				parents.add(keyEntity);
+			}
+		}
+		
+		return parents;
+	}
+	
+	/**
+	 * 全ての参照先 祖先モデルを返す。
+	 * 
+	 * @param entityModel 対象エンティティ
+	 * @return 祖先モデルのSet
+	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
+	 */
+	private static Collection<EntityModel> getSuperEntitiesRecursive(EntityModel entityModel) {
+		Validate.notNull(entityModel);
+		Collection<EntityModel> parentEntities = getSuperEntitiesNonRecursive(entityModel);
+		Collection<EntityModel> entities = CollectionsUtil.newArrayList();
+		entities.addAll(parentEntities);
+		
+		for (EntityModel parentEntity : parentEntities) {
+			if (entityModel.equals(parentEntity) == false) {
+				entities.addAll(getSuperEntitiesRecursive(parentEntity));
+			}
+		}
+		
+		return entities;
+	}
+	
+
 	/** 名前 */
 	private String name;
 	
@@ -60,6 +173,14 @@
 		super(jiemamy, id);
 	}
 	
+	public Collection<EntityModel> findSubEntities(boolean recursive) {
+		return recursive ? getSubEntitiesRecursive(this) : getSubEntitiesNonRecursive(this);
+	}
+	
+	public Collection<EntityModel> findSuperEntities(boolean recursive) {
+		return recursive ? getSuperEntitiesRecursive(this) : getSuperEntitiesNonRecursive(this);
+	}
+	
 	public String getBeginScript() {
 		return beginScript;
 	}
@@ -80,16 +201,6 @@
 		return name;
 	}
 	
-	public Collection<EntityModel> findSubEntities(boolean recursive) {
-		// TODO インライン展開
-		return EntityUtil.getDependentEntities(this, recursive);
-	}
-	
-	public Collection<EntityModel> findSuperEntities(boolean recursive) {
-		// TODO インライン展開
-		return EntityUtil.getReferenceEntities(this, recursive);
-	}
-	
 	public void setBeginScript(String beginScript) {
 		this.beginScript = beginScript;
 	}
@@ -114,4 +225,5 @@
 	public String toString() {
 		return "Entity " + getName();
 	}
+	
 }

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/model/entity/TableModelImpl.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -24,13 +24,16 @@
 import org.apache.commons.lang.Validate;
 
 import org.jiemamy.Jiemamy;
+import org.jiemamy.exception.ElementNotFoundException;
+import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.attribute.constraint.PrimaryKey;
+import org.jiemamy.model.attribute.constraint.UniqueKey;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.index.IndexModel;
-import org.jiemamy.utils.model.TableUtil;
+import org.jiemamy.utils.CollectionsUtil;
 
 /**
  * テーブルモデル。
@@ -57,48 +60,80 @@
 		super(jiemamy, id);
 	}
 	
-	public List<ColumnModel> findColumns() {
-		// TODO インライン展開
-		return TableUtil.getColumns(this);
+	public <T extends AttributeModel>T findAttribute(Class<T> clazz) {
+		return findAttribute(clazz, false);
 	}
 	
-	public List<ForeignKey> findForeignKeys() {
-		return getAttributes(ForeignKey.class);
+	public <T extends AttributeModel>T findAttribute(Class<T> clazz, boolean columnAttr) {
+		List<T> attributes = findAttributes(clazz, columnAttr);
+		if (attributes.size() == 0) {
+			throw new ElementNotFoundException(this, clazz);
+		} else if (attributes.size() > 1) {
+			throw new TooManyElementsException(this, clazz, attributes);
+		}
+		return attributes.get(0);
 	}
 	
-	public PrimaryKey findPrimaryKey() {
-		// TODO インライン展開
-		return TableUtil.getPrimaryKey(this);
+	public <T extends AttributeModel>List<T> findAttributes(Class<T> clazz) {
+		return findAttributes(clazz, false);
 	}
 	
-	public <T extends AttributeModel>T getAttribute(Class<T> clazz) {
-		// TODO インライン展開
-		return TableUtil.getAttribute(this, clazz);
+	public <T extends AttributeModel>List<T> findAttributes(Class<T> clazz, boolean columnAttr) {
+		Validate.notNull(clazz);
+		
+		List<T> result = CollectionsUtil.newArrayList();
+		for (AttributeModel attribute : getAttributes()) {
+			if (clazz.isAssignableFrom(attribute.getClass())) {
+				result.add(clazz.cast(attribute));
+			}
+			if (columnAttr && attribute instanceof ColumnModel) {
+				ColumnModel columnModel = (ColumnModel) attribute;
+				UniqueKey uniqueKey = columnModel.getUniqueKey();
+				if (uniqueKey != null && clazz.isAssignableFrom(uniqueKey.getClass())) {
+					result.add(clazz.cast(uniqueKey));
+				}
+				PrimaryKey primaryKey = columnModel.getPrimaryKey();
+				if (primaryKey != null && clazz.isAssignableFrom(primaryKey.getClass())) {
+					result.add(clazz.cast(primaryKey));
+				}
+				// column chek と not null は attributeじゃないので処理しない
+			}
+		}
+		return result;
 	}
 	
-	public <T extends AttributeModel>T getAttribute(Class<T> clazz, boolean columnAttr) {
-		// TODO インライン展開
-		return TableUtil.getAttribute(this, clazz, columnAttr);
+	public ColumnModel findColumn(String columnName) {
+		Validate.notNull(columnName);
+		
+		List<ColumnModel> columns = CollectionsUtil.newArrayList();
+		for (ColumnModel columnModel : findAttributes(ColumnModel.class)) {
+			if (columnName.equals(columnModel.getName())) {
+				columns.add(columnModel);
+			}
+		}
+		if (columns.size() == 0) {
+			throw new ElementNotFoundException(this, columnName);
+		} else if (columns.size() > 1) {
+			throw new TooManyElementsException(this, columnName, columns);
+		}
+		return columns.get(0);
 	}
 	
-	public List<AttributeModel> getAttributes() {
-		assert attributes != null;
-		return attributes;
+	public List<ColumnModel> findColumns() {
+		return findAttributes(ColumnModel.class);
 	}
 	
-	public <T extends AttributeModel>List<T> getAttributes(Class<T> clazz) {
-		// TODO インライン展開
-		return TableUtil.getAttributes(this, clazz);
+	public List<ForeignKey> findForeignKeys() {
+		return findAttributes(ForeignKey.class);
 	}
 	
-	public <T extends AttributeModel>List<T> getAttributes(Class<T> clazz, boolean columnAttr) {
-		// TODO インライン展開
-		return TableUtil.getAttributes(this, clazz, columnAttr);
+	public PrimaryKey findPrimaryKey() {
+		return findAttribute(PrimaryKey.class, true);
 	}
 	
-	public ColumnModel getColumn(String columnName) {
-		// TODO インライン展開
-		return TableUtil.getColumn(this, columnName);
+	public List<AttributeModel> getAttributes() {
+		assert attributes != null;
+		return attributes;
 	}
 	
 	public List<IndexModel> getIndexes() {

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomBuilder.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomBuilder.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomBuilder.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -117,7 +117,6 @@
 import org.jiemamy.utils.AnnotationUtil;
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.DomUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.xml.CoreNamespace;
 import org.jiemamy.xml.CoreQName;
 import org.jiemamy.xml.JiemamyQName;
@@ -182,8 +181,8 @@
 	
 	private static SortedSet<Entry<ColumnRef, String>> sortDataEntry(EntityModel entityModel, RecordModel recordModel) {
 		SortedSet<Entry<ColumnRef, String>> treeSet =
-				new TreeSet<Map.Entry<ColumnRef, String>>(new RecordSetComparator(TableUtil
-					.getColumns((TableModel) entityModel)));
+				new TreeSet<Map.Entry<ColumnRef, String>>(new RecordSetComparator(((TableModel) entityModel)
+					.findColumns()));
 		for (Map.Entry<ColumnRef, String> entry2 : recordModel.getValues().entrySet()) {
 			treeSet.add(entry2);
 		}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -83,7 +83,6 @@
 import org.jiemamy.utils.IterableNodeList;
 import org.jiemamy.utils.SmartXpath;
 import org.jiemamy.utils.UUIDUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 import org.jiemamy.xml.CoreQName;
 import org.jiemamy.xml.JiemamyQName;
 
@@ -152,7 +151,7 @@
 				RootModel rootModel = factory.getRootModel();
 				Dialect dialect;
 				try {
-					dialect = RootModelUtil.getDialect(rootModel);
+					dialect = rootModel.findDialect();
 				} catch (ClassNotFoundException e) {
 					logger.warn("Dialectのロスト", e);
 					dialect = null;

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EntityDependencyCalculator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EntityDependencyCalculator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EntityDependencyCalculator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -26,7 +26,6 @@
 import org.jiemamy.exception.UnexpectedConditionError;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.entity.EntityModel;
-import org.jiemamy.utils.model.EntityUtil;
 
 /**
  * エンティティの依存度を計算するクラス。
@@ -68,7 +67,7 @@
 	private static void addDependsdentsToResult(EntityModel entityModel) {
 		Validate.notNull(entityModel);
 		
-		for (EntityModel dependent : EntityUtil.getReferenceEntities(entityModel, false)) {
+		for (EntityModel dependent : entityModel.findSuperEntities(false)) {
 			if (dependent.equals(entityModel) == false) {
 				addDependsdentsToResult(dependent);
 				addToResult(dependent);

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -20,7 +20,6 @@
 
 import org.apache.commons.lang.Validate;
 
-import org.jiemamy.Jiemamy;
 import org.jiemamy.ReferenceResolver;
 import org.jiemamy.exception.UnexpectedConditionError;
 import org.jiemamy.model.RootModel;
@@ -51,7 +50,7 @@
 		Validate.notNull(rootModel);
 		ReferenceResolver resolver = rootModel.getJiemamy().getReferenceResolver();
 		
-		TableModel tableModel = AttributeUtil.getDefinedTable(attributeModel);
+		TableModel tableModel = attributeModel.findDeclaringTable();
 		
 		StringBuilder sb = new StringBuilder();
 		if (attributeModel instanceof ColumnModel) {
@@ -84,28 +83,6 @@
 		attributeModel.setName(sb.toString());
 	}
 	
-	/**
-	 * この属性が所属するテーブルを取得する。
-	 * 
-	 * @param attribute 対象属性モデル
-	 * @return この属性が所属するテーブル. どのテーブルにも所属していない場合は{@code null}
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link AttributeModel#findDeclaringTable()}
-	 */
-	@Deprecated
-	public static TableModel getDefinedTable(AttributeModel attribute) {
-		Validate.notNull(attribute);
-		
-		Jiemamy jiemamy = attribute.getJiemamy();
-		RootModel rootModel = jiemamy.getFactory().getRootModel();
-		for (TableModel tableModel : RootModelUtil.getEntities(rootModel, TableModel.class)) {
-			if (tableModel.getAttributes().contains(attribute)) {
-				return tableModel;
-			}
-		}
-		return null;
-	}
-	
 	private AttributeUtil() {
 		throw new UnexpectedConditionError("不到達ポイント");
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -18,19 +18,13 @@
  */
 package org.jiemamy.utils.model;
 
-import java.util.List;
-
 import org.apache.commons.lang.Validate;
 
 import org.jiemamy.JiemamyFactory;
-import org.jiemamy.exception.ElementNotFoundException;
 import org.jiemamy.exception.UnexpectedConditionError;
 import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.attribute.ColumnRef;
-import org.jiemamy.model.attribute.constraint.PrimaryKey;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.datatype.DomainRef;
-import org.jiemamy.model.entity.TableModel;
 
 /**
  * {@link ColumnModel}のユーティリティクラス。
@@ -40,33 +34,6 @@
 public final class ColumnUtil {
 	
 	/**
-	 * カラムが主キー制約を構成するカラムであるかどうか調べる。
-	 * 
-	 * @param columnModel 対象カラム
-	 * @return 主キー制約構成カラムである場合は{@code true}、そうでない場合は{@code false}
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link ColumnModel#checkPrimaryKeyColumn()}
-	 */
-	@Deprecated
-	public static boolean isPartOfPrimaryKeyColumns(ColumnModel columnModel) {
-		Validate.notNull(columnModel);
-		TableModel tableModel = AttributeUtil.getDefinedTable(columnModel);
-		PrimaryKey primaryKey;
-		try {
-			primaryKey = TableUtil.getAttribute(tableModel, PrimaryKey.class, true);
-		} catch (ElementNotFoundException e) {
-			return false;
-		}
-		List<ColumnRef> keyColumns = primaryKey.getKeyColumns();
-		for (ColumnRef columnRef : keyColumns) {
-			if (columnRef.getReferenceId().equals(columnModel.getId())) {
-				return true;
-			}
-		}
-		return false;
-	}
-	
-	/**
 	 * カラムにドメイン型をデータ型として設定する。
 	 * 
 	 * @param columnModel 対象カラム

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -72,7 +72,7 @@
 		try {
 			writer = new CSVWriter(new OutputStreamWriter(out));
 			
-			List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+			List<ColumnModel> columns = tableModel.findColumns();
 			String[] line = new String[columns.size()];
 			int i = 0;
 			for (ColumnModel columnModel : columns) {
@@ -126,7 +126,7 @@
 			
 			List<ColumnModel> columnModels = CollectionsUtil.newArrayList();
 			for (String columnName : line) {
-				ColumnModel columnModel = TableUtil.getColumn(tableModel, columnName);
+				ColumnModel columnModel = tableModel.findColumn(columnName);
 				columnModels.add(columnModel);
 			}
 			

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-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataTypeUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -18,14 +18,9 @@
  */
 package org.jiemamy.utils.model;
 
-import org.apache.commons.lang.Validate;
-
 import org.jiemamy.ReferenceResolver;
 import org.jiemamy.exception.UnexpectedConditionError;
-import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DataType;
-import org.jiemamy.model.datatype.DomainModel;
-import org.jiemamy.model.datatype.DomainRef;
 
 /**
  * {@link DataType}のユーティリティクラス。
@@ -43,36 +38,9 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 */
 	public static String getTypeName(DataType dataType, ReferenceResolver resolver) {
-		return toBuiltinDataType(dataType, resolver).getTypeName();
+		return dataType.toBuiltinDataType(resolver).getTypeName();
 	}
 	
-	/**
-	 * {@link DataType}を{@link BuiltinDataType}に変換する。
-	 * 
-	 * @param dataType 変換対象
-	 * @param resolver リゾルバ
-	 * @return 変換結果
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link DataType#toBuiltinDataType(ReferenceResolver)}
-	 */
-	@Deprecated
-	public static BuiltinDataType toBuiltinDataType(DataType dataType, ReferenceResolver resolver) {
-		Validate.notNull(dataType);
-		Validate.notNull(resolver);
-		
-		BuiltinDataType builtin;
-		if (dataType instanceof DomainRef) {
-			DomainRef domainRef = (DomainRef) dataType;
-			DomainModel domainModel = resolver.resolve(domainRef);
-			builtin = domainModel.getDataType();
-		} else if (dataType instanceof BuiltinDataType) {
-			builtin = (BuiltinDataType) dataType;
-		} else {
-			throw new UnexpectedConditionError("unknwon dataType: " + dataType.getClass().getName());
-		}
-		return builtin;
-	}
-	
 	private DataTypeUtil() {
 		throw new UnexpectedConditionError("不到達ポイント");
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -18,24 +18,13 @@
  */
 package org.jiemamy.utils.model;
 
-import java.util.Collection;
-import java.util.Set;
-
-import org.apache.commons.lang.Validate;
-
-import org.jiemamy.Jiemamy;
-import org.jiemamy.ReferenceResolver;
 import org.jiemamy.exception.ElementNotFoundException;
 import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.exception.UnexpectedConditionError;
 import org.jiemamy.model.RootModel;
-import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.attribute.ColumnRef;
-import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.entity.ViewModel;
-import org.jiemamy.utils.CollectionsUtil;
 
 /**
  * {@link EntityModel}のユーティリティクラス。
@@ -69,7 +58,7 @@
 			}
 			sb.append(++counter);
 			try {
-				RootModelUtil.getEntity(rootModel, target, sb.toString());
+				rootModel.getEntity(target, sb.toString());
 				duplicated = true;
 			} catch (TooManyElementsException e) {
 				duplicated = true;
@@ -81,139 +70,6 @@
 		entityModel.setName(sb.toString());
 	}
 	
-	/**
-	 * 指定したエンティティを外部キー制約によって参照している(指定したエンティティに依存している:A→BにおけるA)エンティティの集合を取得する。
-	 * 
-	 * @param entityModel 基準エンティティ
-	 * @param recursive 再帰的に検索する場合は{@code true}、そうでない場合は{@code false}
-	 * @return エンティティの集合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link EntityModel#findSubEntities(boolean)}
-	 */
-	@Deprecated
-	public static Collection<EntityModel> getDependentEntities(EntityModel entityModel, boolean recursive) {
-		Validate.notNull(entityModel);
-		return recursive ? getDependentEntitiesRecursive(entityModel) : getDependentEntitiesNonRecursive(entityModel);
-	}
-	
-	/**
-	 * 指定したエンティティが外部キー制約によって参照している(指定したエンティティが依存している:A→BにおけるB)エンティティの集合を取得する。
-	 * 
-	 * @param entityModel 対象エンティティ
-	 * @param recursive 再帰的に検索する場合は{@code true}、そうでない場合は{@code false}
-	 * @return エンティティの集合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link EntityModel#findSuperEntities(boolean)}
-	 */
-	@Deprecated
-	public static Collection<EntityModel> getReferenceEntities(EntityModel entityModel, boolean recursive) {
-		Validate.notNull(entityModel);
-		return recursive ? getReferenceEntitiesRecursive(entityModel) : getReferenceEntitiesNonRecursive(entityModel);
-	}
-	
-	/**
-	 * 直接の依存モデルの集合を返す。
-	 * 
-	 * @param standardEntity 基準エンティティ
-	 * @return 直接の依存モデルの集合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 */
-	private static Collection<EntityModel> getDependentEntitiesNonRecursive(EntityModel standardEntity) {
-		Validate.notNull(standardEntity);
-		Set<EntityModel> dependents = CollectionsUtil.newHashSet();
-		Jiemamy jiemamy = standardEntity.getJiemamy();
-		RootModel rootModel = jiemamy.getFactory().getRootModel();
-		ReferenceResolver resolver = jiemamy.getReferenceResolver();
-		
-		for (EntityModel entityModel : rootModel.getEntities()) {
-			if (entityModel instanceof TableModel) {
-				TableModel dependentTableModel = (TableModel) entityModel;
-				for (ForeignKey foreignKey : TableUtil.getAttributes(dependentTableModel, ForeignKey.class)) {
-					if (foreignKey.getReferenceColumns().size() == 0) {
-						continue;
-					}
-					ColumnRef columnRef = foreignKey.getReferenceColumns().get(0);
-					ColumnModel columnModel = resolver.resolve(columnRef);
-					TableModel referenceTableModel = AttributeUtil.getDefinedTable(columnModel);
-					if (referenceTableModel == null) {
-						continue;
-					}
-					if (referenceTableModel.getId().equals(standardEntity.getId())) {
-						dependents.add(dependentTableModel);
-					}
-				}
-			}
-		}
-		
-		return dependents;
-	}
-	
-	/**
-	 * 全ての依存モデルの集合を返す。
-	 * 
-	 * @param standardEntity 基準エンティティ
-	 * @return 全ての依存モデルの集合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 */
-	private static Collection<EntityModel> getDependentEntitiesRecursive(EntityModel standardEntity) {
-		Validate.notNull(standardEntity);
-		Collection<EntityModel> parentEntities = getDependentEntitiesNonRecursive(standardEntity);
-		Set<EntityModel> entities = CollectionsUtil.newHashSet();
-		entities.addAll(parentEntities);
-		
-		for (EntityModel parentEntity : parentEntities) {
-			if (standardEntity.equals(parentEntity) == false) {
-				entities.addAll(getDependentEntitiesRecursive(parentEntity));
-			}
-		}
-		
-		return entities;
-	}
-	
-	/**
-	 * 参照先親モデルを返す。
-	 * 
-	 * @param entityModel 対象エンティティ
-	 * @return 親モデルのSet
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 */
-	private static Collection<EntityModel> getReferenceEntitiesNonRecursive(EntityModel entityModel) {
-		Validate.notNull(entityModel);
-		Collection<EntityModel> parents = CollectionsUtil.newArrayList();
-		
-		if (entityModel instanceof TableModel) {
-			TableModel tableModel = (TableModel) entityModel;
-			for (ForeignKey foreignKey : TableUtil.getAttributes(tableModel, ForeignKey.class)) {
-				EntityModel keyEntity = ForeignKeyUtil.getReferenceEntity(foreignKey);
-				parents.add(keyEntity);
-			}
-		}
-		
-		return parents;
-	}
-	
-	/**
-	 * 全ての参照先 祖先モデルを返す。
-	 * 
-	 * @param entityModel 対象エンティティ
-	 * @return 祖先モデルのSet
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 */
-	private static Collection<EntityModel> getReferenceEntitiesRecursive(EntityModel entityModel) {
-		Validate.notNull(entityModel);
-		Collection<EntityModel> parentEntities = getReferenceEntitiesNonRecursive(entityModel);
-		Collection<EntityModel> entities = CollectionsUtil.newArrayList();
-		entities.addAll(parentEntities);
-		
-		for (EntityModel parentEntity : parentEntities) {
-			if (entityModel.equals(parentEntity) == false) {
-				entities.addAll(getReferenceEntitiesRecursive(parentEntity));
-			}
-		}
-		
-		return entities;
-	}
-	
 	private EntityUtil() {
 		throw new UnexpectedConditionError("不到達ポイント");
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ForeignKeyUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -18,24 +18,13 @@
  */
 package org.jiemamy.utils.model;
 
-import java.util.Collection;
-import java.util.UUID;
-
 import org.apache.commons.lang.Validate;
 
-import org.jiemamy.Jiemamy;
 import org.jiemamy.JiemamyFactory;
-import org.jiemamy.exception.ModelConsistenceException;
 import org.jiemamy.exception.UnexpectedConditionError;
-import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.ForeignKey;
-import org.jiemamy.model.attribute.constraint.KeyConstraint;
-import org.jiemamy.model.entity.EntityModel;
-import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.CollectionsUtil;
-import org.jiemamy.validator.impl.ForeignKeyValidator;
 
 /**
  * {@link ForeignKey}のユーティリティクラス。
@@ -89,79 +78,6 @@
 		foreignKey.getReferenceColumns().add(ref);
 	}
 	
-	/**
-	 * この外部キーが参照するエンティティを取得する。
-	 * 
-	 * @param foreignKey 対象外部キー
-	 * @return この外部キーが参照するエンティティ. 参照エンティティが見つからない場合は{@code null}
-	 * @throws ModelConsistenceException 参照カラムが1つもない場合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link ForeignKey#findReferencedEntity()}
-	 */
-	@Deprecated
-	public static EntityModel getReferenceEntity(ForeignKey foreignKey) {
-		Validate.notNull(foreignKey);
-		
-		if (foreignKey.getReferenceColumns().size() == 0) {
-			throw new ModelConsistenceException();
-		}
-		Jiemamy jiemamy = foreignKey.getJiemamy();
-		ColumnRef columnRef = foreignKey.getReferenceColumns().get(0);
-		
-		RootModel rootModel = jiemamy.getFactory().getRootModel();
-		for (TableModel tableModel : RootModelUtil.getEntities(rootModel, TableModel.class)) {
-			for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
-				if (columnRef.getReferenceId().equals(columnModel.getId())) {
-					return tableModel;
-				}
-			}
-		}
-		return null;
-	}
-	
-	/**
-	 * この外部キーが参照するキー制約を取得する。該当するキーが存在しなかった場合、{@code null}を返す。
-	 * 
-	 * <p>該当するキー制約が存在しない、という状況はモデル不整合を表す。
-	 * {@link ForeignKeyValidator}がエラーを出すはずである。</p>
-	 * 
-	 * @param foreignKey 対象外部キー
-	 * @return この外部キーが参照するキー
-	 * @see ForeignKeyValidator
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link ForeignKey#findReferencedKeyConstraint()}
-	 */
-	@Deprecated
-	public static KeyConstraint getReferenceKeyConstraint(ForeignKey foreignKey) {
-		Validate.notNull(foreignKey);
-		
-		TableModel referenceTable = (TableModel) ForeignKeyUtil.getReferenceEntity(foreignKey);
-		for (KeyConstraint keyConstraint : TableUtil.getAttributes(referenceTable, KeyConstraint.class, true)) {
-			
-			// サイズ不一致であれば、そもそもこのキーを参照したものではない
-			if (keyConstraint.getKeyColumns().size() != foreignKey.getReferenceColumns().size()) {
-				continue;
-			}
-			
-			Collection<UUID> referenceSetIds = CollectionsUtil.newArrayList();
-			for (ColumnRef referenceKeyColumn : keyConstraint.getKeyColumns()) {
-				referenceSetIds.add(referenceKeyColumn.getReferenceId());
-			}
-			
-			boolean found = true;
-			for (ColumnRef target : foreignKey.getReferenceColumns()) {
-				if (referenceSetIds.contains(target.getReferenceId()) == false) {
-					found = false;
-				}
-			}
-			
-			if (found) {
-				return keyConstraint;
-			}
-		}
-		return null;
-	}
-	
 	private ForeignKeyUtil() {
 		throw new UnexpectedConditionError("不到達ポイント");
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -24,17 +24,12 @@
 
 import org.apache.commons.lang.Validate;
 
-import org.jiemamy.Jiemamy;
-import org.jiemamy.ReferenceResolver;
 import org.jiemamy.dialect.Dialect;
-import org.jiemamy.exception.ElementNotFoundException;
-import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.exception.UnexpectedConditionError;
 import org.jiemamy.model.JiemamyElement;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.ColumnCheckConstraint;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKey;
@@ -175,134 +170,13 @@
 	public static Collection<ForeignKey> getAllForeignKeys(RootModel rootModel) {
 		Validate.notNull(rootModel);
 		List<ForeignKey> result = CollectionsUtil.newArrayList();
-		for (TableModel tableModel : getEntities(rootModel, TableModel.class)) {
-			result.addAll(TableUtil.getAttributes(tableModel, ForeignKey.class));
+		for (TableModel tableModel : rootModel.findEntities(TableModel.class)) {
+			result.addAll(tableModel.findAttributes(ForeignKey.class));
 		}
 		return result;
 	}
 	
 	/**
-	 * SQL方言を取得する。
-	 * 
-	 * @param rootModel 対象RootModel
-	 * @return SQL方言
-	 * @throws ClassNotFoundException 設定されたクラスが見つからなかった場合 
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link RootModel#findDialect()}
-	 */
-	@Deprecated
-	public static Dialect getDialect(RootModel rootModel) throws ClassNotFoundException {
-		Validate.notNull(rootModel);
-		Jiemamy jiemamy = rootModel.getJiemamy();
-		return jiemamy.getDialect(rootModel);
-	}
-	
-	/**
-	 * 特定の種類のノードのリストを取得する。
-	 * 
-	 * @param <T> 取得したいノードのクラス
-	 * @param rootModel 操作対象{@link RootModel}
-	 * @param clazz 取得したいノードのクラス
-	 * @return ノードのリスト
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link RootModel#getEntities(Class)}
-	 */
-	@Deprecated
-	public static <T extends EntityModel>Collection<T> getEntities(RootModel rootModel, Class<T> clazz) {
-		Validate.notNull(rootModel);
-		Validate.notNull(clazz);
-		
-		List<T> nodes = CollectionsUtil.newArrayList();
-		for (EntityModel entityModel : rootModel.getEntities()) {
-			if (clazz.isAssignableFrom(entityModel.getClass())) {
-				// 直前でロジックによる型チェックを行っているため、キャスト安全である。
-				@SuppressWarnings("unchecked")
-				T castedNode = (T) entityModel;
-				nodes.add(castedNode);
-			}
-		}
-		return nodes;
-	}
-	
-	/**
-	 * 指定した名前を持つエンティティを取得する。
-	 * 
-	 * <p>エンティティ名の大文字・小文字は区別されない。</p>
-	 * 
-	 * @param <T> エンティティの種類を表すクラス
-	 * @param rootModel 操作対象{@link RootModel}
-	 * @param clazz エンティティの種類を表すクラス. {@code null}の場合、エンティティの種類を限定しないことを表す
-	 * @param entityName エンティティ名
-	 * @return 見つかったエンティティ
-	 * @throws TooManyElementsException 同名のエンティティが複数見つかった場合
-	 * @throws ElementNotFoundException エンティティが見つからなかった場合
-	 * @throws IllegalArgumentException 引数rootModel, entityNameに{@code null}を与えた場合
-	 * @deprecated use {@link RootModel#getEntity(Class, String)}
-	 */
-	@Deprecated
-	@SuppressWarnings("unchecked")
-	public static <T extends EntityModel>T getEntity(RootModel rootModel, Class<T> clazz, String entityName) {
-		Validate.notNull(rootModel);
-		Validate.notNull(entityName);
-		
-		List<T> entities = CollectionsUtil.newArrayList();
-		for (EntityModel entityModel : rootModel.getEntities()) {
-			if (entityName.equalsIgnoreCase(entityModel.getName())
-					&& (clazz == null || clazz.isAssignableFrom(entityModel.getClass()))) {
-				entities.add((T) entityModel);
-			}
-		}
-		if (entities.size() == 0) {
-			throw new ElementNotFoundException(rootModel, entityName);
-		} else if (entities.size() > 1) {
-			throw new TooManyElementsException(rootModel, entityName, entities);
-		}
-		return entities.get(0);
-	}
-	
-	/**
-	 * モデルの正規化を行う。
-	 * 
-	 * @param rootModel 操作対象{@link RootModel}
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link RootModel#normalize()}
-	 */
-	@Deprecated
-	public static void normalize(RootModel rootModel) {
-		Validate.notNull(rootModel);
-		ReferenceResolver resolver = rootModel.getJiemamy().getReferenceResolver();
-		for (TableModel tableModel : getEntities(rootModel, TableModel.class)) {
-			// PKの正規化
-			try {
-				TableUtil.getAttribute(tableModel, PrimaryKey.class, false);
-			} catch (ElementNotFoundException e) {
-				try {
-					PrimaryKey primaryKey = TableUtil.getPrimaryKey(tableModel);
-					ColumnRef columnRef = primaryKey.getKeyColumns().get(0);
-					resolver.resolve(columnRef).setPrimaryKey(null);
-					tableModel.getAttributes().add(primaryKey);
-				} catch (ElementNotFoundException e2) {
-					// nothing to do
-				}
-			}
-			
-			// UKの正規化
-			for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
-				UniqueKey uniqueKey = columnModel.getUniqueKey();
-				if (uniqueKey != null) {
-					columnModel.setUniqueKey(null);
-					tableModel.getAttributes().add(uniqueKey);
-				}
-			}
-			
-			// 属性順序の正規化
-			// THINK 順序の正規化をするかしないか
-//			Comparator<AttributeModel> comparator = new AttributeComparator(tableModel);
-//			Collections.sort(tableModel.getAttributes(), comparator);
-		}
-	}
-	
-	/**
 	 * SQL方言を設定する。
 	 * 
 	 * @param rootModel 操作対象{@link RootModel}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -21,18 +21,14 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.lang.Validate;
-
 import org.jiemamy.exception.ElementNotFoundException;
 import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.exception.UnexpectedConditionError;
-import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.attribute.constraint.LocalKeyConstraint;
 import org.jiemamy.model.attribute.constraint.PrimaryKey;
 import org.jiemamy.model.attribute.constraint.TableConstraint;
-import org.jiemamy.model.attribute.constraint.UniqueKey;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.CollectionsUtil;
 
@@ -44,130 +40,6 @@
 public final class TableUtil {
 	
 	/**
-	 * 指定した型を持つ属性を取得する。
-	 * 
-	 * @param <T> 属性の型
-	 * @param tableModel 対象のテーブル
-	 * @param clazz 属性の型
-	 * @return 属性
-	 * @throws TooManyElementsException 複数の属性が見つかった場合
-	 * @throws ElementNotFoundException 属性が見つからなかった場合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#getAttribute(Class)}
-	 */
-	@Deprecated
-	public static <T extends AttributeModel>T getAttribute(TableModel tableModel, Class<T> clazz) {
-		return getAttribute(tableModel, clazz, false);
-	}
-	
-	/**
-	 * 指定した型を持つ属性を取得する。
-	 * 
-	 * @param <T> 属性の型
-	 * @param tableModel 対象のテーブル
-	 * @param clazz 属性の型
-	 * @param columnAttr カラム属性も検索対象とする場合は{@code true}、そうでない場合は{@code false}
-	 * @return 属性
-	 * @throws TooManyElementsException 複数の属性が見つかった場合
-	 * @throws ElementNotFoundException 属性が見つからなかった場合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#getAttribute(Class, boolean)}
-	 */
-	@Deprecated
-	public static <T extends AttributeModel>T getAttribute(TableModel tableModel, Class<T> clazz, boolean columnAttr) {
-		List<T> attributes = getAttributes(tableModel, clazz, columnAttr);
-		if (attributes.size() == 0) {
-			throw new ElementNotFoundException(tableModel, clazz);
-		} else if (attributes.size() > 1) {
-			throw new TooManyElementsException(tableModel, clazz, attributes);
-		}
-		return attributes.get(0);
-	}
-	
-	/**
-	 * 指定した型を持つ属性のリストを取得する。
-	 * 
-	 * @param <T> 属性の型
-	 * @param tableModel 対象のテーブル
-	 * @param clazz 検索する型
-	 * @return 属性のリスト
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#getAttributes(Class)}
-	 */
-	@Deprecated
-	public static <T extends AttributeModel>List<T> getAttributes(TableModel tableModel, Class<T> clazz) {
-		return getAttributes(tableModel, clazz, false);
-	}
-	
-	/**
-	 * 属性のうち、指定した型を持つもののリストを取得する。
-	 * 
-	 * @param <T> 対象属性の型
-	 * @param tableModel 対象のテーブル
-	 * @param clazz 対象属性の型
-	 * @param columnAttr カラムに付随するモデルも対象とする場合は{@code true}、そうでない場合は{@code false}
-	 * @return 属性のリスト
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#getAttributes(Class, boolean)}
-	 */
-	@Deprecated
-	public static <T extends AttributeModel>List<T> getAttributes(TableModel tableModel, Class<T> clazz,
-			boolean columnAttr) {
-		Validate.notNull(tableModel);
-		Validate.notNull(clazz);
-		
-		List<T> result = CollectionsUtil.newArrayList();
-		for (AttributeModel attribute : tableModel.getAttributes()) {
-			if (clazz.isAssignableFrom(attribute.getClass())) {
-				result.add(clazz.cast(attribute));
-			}
-			if (columnAttr && attribute instanceof ColumnModel) {
-				ColumnModel columnModel = (ColumnModel) attribute;
-				UniqueKey uniqueKey = columnModel.getUniqueKey();
-				if (uniqueKey != null && clazz.isAssignableFrom(uniqueKey.getClass())) {
-					result.add(clazz.cast(uniqueKey));
-				}
-				PrimaryKey primaryKey = columnModel.getPrimaryKey();
-				if (primaryKey != null && clazz.isAssignableFrom(primaryKey.getClass())) {
-					result.add(clazz.cast(primaryKey));
-				}
-				// column chek と not null は attributeじゃないので処理しない
-			}
-		}
-		return result;
-	}
-	
-	/**
-	 * テーブルから、指定した名前を持つカラムを取得する。
-	 * 
-	 * @param tableModel 検索対象のテーブル
-	 * @param columnName カラム名
-	 * @return 見つかったカラム
-	 * @throws TooManyElementsException 同名のカラムが複数見つかった場合
-	 * @throws ElementNotFoundException カラムが見つからなかった場合 
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#getColumn(String)}
-	 */
-	@Deprecated
-	public static ColumnModel getColumn(TableModel tableModel, String columnName) {
-		Validate.notNull(tableModel);
-		Validate.notNull(columnName);
-		
-		List<ColumnModel> columns = CollectionsUtil.newArrayList();
-		for (ColumnModel columnModel : TableUtil.getAttributes(tableModel, ColumnModel.class)) {
-			if (columnName.equals(columnModel.getName())) {
-				columns.add(columnModel);
-			}
-		}
-		if (columns.size() == 0) {
-			throw new ElementNotFoundException(tableModel, columnName);
-		} else if (columns.size() > 1) {
-			throw new TooManyElementsException(tableModel, columnName, columns);
-		}
-		return columns.get(0);
-	}
-	
-	/**
 	 * カラムに設定された主キー制約を取得する。
 	 * 
 	 * @param tableModel 対象のテーブル
@@ -177,7 +49,7 @@
 	 */
 	public static PrimaryKey getColumnPrimaryKey(TableModel tableModel) {
 		Collection<PrimaryKey> pks = CollectionsUtil.newArrayList();
-		for (ColumnModel columnModel : getColumns(tableModel)) {
+		for (ColumnModel columnModel : tableModel.findColumns()) {
 			PrimaryKey primaryKey = columnModel.getPrimaryKey();
 			if (primaryKey != null) {
 				pks.add(primaryKey);
@@ -193,19 +65,6 @@
 	}
 	
 	/**
-	 * カラムのリストを取得する。
-	 * 
-	 * @param tableModel 対象のテーブル
-	 * @return カラムのリスト
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#findColumns()}
-	 */
-	@Deprecated
-	public static List<ColumnModel> getColumns(TableModel tableModel) {
-		return getAttributes(tableModel, ColumnModel.class);
-	}
-	
-	/**
 	 * 制約のリストを取得する。
 	 * 
 	 * @param tableModel 対象のテーブル
@@ -213,7 +72,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 */
 	public static List<TableConstraint> getConstraints(TableModel tableModel) {
-		return getAttributes(tableModel, TableConstraint.class);
+		return tableModel.findAttributes(TableConstraint.class);
 	}
 	
 	/**
@@ -224,7 +83,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 */
 	public static List<ForeignKey> getForeignKeys(TableModel tableModel) {
-		return getAttributes(tableModel, ForeignKey.class);
+		return tableModel.findAttributes(ForeignKey.class);
 	}
 	
 	/**
@@ -238,9 +97,9 @@
 	public static LocalKeyConstraint getKey(TableModel tableModel) {
 		LocalKeyConstraint key = null;
 		try {
-			key = TableUtil.getPrimaryKey(tableModel);
+			key = tableModel.findPrimaryKey();
 		} catch (ElementNotFoundException e) {
-			List<LocalKeyConstraint> attributes = TableUtil.getAttributes(tableModel, LocalKeyConstraint.class);
+			List<LocalKeyConstraint> attributes = tableModel.findAttributes(LocalKeyConstraint.class);
 			if (attributes.size() > 0) {
 				key = attributes.get(0);
 			}
@@ -248,21 +107,6 @@
 		return key;
 	}
 	
-	/**
-	 * 主キーを取得する。
-	 * 
-	 * @param tableModel 対象のテーブル
-	 * @return 主キー
-	 * @throws TooManyElementsException 複数の主キーが見つかった場合
-	 * @throws ElementNotFoundException 主キーが存在しない場合
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @deprecated use {@link TableModel#findPrimaryKey()}
-	 */
-	@Deprecated
-	public static PrimaryKey getPrimaryKey(TableModel tableModel) {
-		return getAttribute(tableModel, PrimaryKey.class, true);
-	}
-	
 	private TableUtil() {
 		throw new UnexpectedConditionError("不到達ポイント");
 	}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/CheckConstraintValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/CheckConstraintValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/CheckConstraintValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -28,8 +28,6 @@
 import org.jiemamy.model.attribute.constraint.CheckConstraint;
 import org.jiemamy.model.attribute.constraint.TableCheckConstraint;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
 import org.jiemamy.validator.Problem;
@@ -48,16 +46,16 @@
 	@Override
 	public Collection<Problem> validate(RootModel rootModel) {
 		Collection<Problem> result = super.validate(rootModel);
-		Collection<TableModel> tableModels = RootModelUtil.getEntities(rootModel, TableModel.class);
+		Collection<TableModel> tableModels = rootModel.findEntities(TableModel.class);
 		for (TableModel tableModel : tableModels) {
-			for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
+			for (ColumnModel columnModel : tableModel.findColumns()) {
 				CheckConstraint checkConstraint = columnModel.getCheckConstraint();
 				if (checkConstraint != null && verify(checkConstraint) == false) {
 					result.add(new EmptyExpressionProblem(tableModel, columnModel));
 				}
 			}
 			int index = 0;
-			for (CheckConstraint checkConstraint : TableUtil.getAttributes(tableModel, TableCheckConstraint.class)) {
+			for (CheckConstraint checkConstraint : tableModel.findAttributes(TableCheckConstraint.class)) {
 				if (verify(checkConstraint) == false) {
 					result.add(new EmptyExpressionProblem(tableModel, index));
 				}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ColumnValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ColumnValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ColumnValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -29,8 +29,6 @@
 import org.jiemamy.model.attribute.constraint.PrimaryKey;
 import org.jiemamy.model.attribute.constraint.UniqueKey;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
 import org.jiemamy.validator.Problem;
@@ -51,10 +49,10 @@
 	@Override
 	public Collection<Problem> validate(RootModel rootModel) {
 		Collection<Problem> result = super.validate(rootModel);
-		Collection<TableModel> tableModels = RootModelUtil.getEntities(rootModel, TableModel.class);
+		Collection<TableModel> tableModels = rootModel.findEntities(TableModel.class);
 		for (TableModel tableModel : tableModels) {
 			int index = 0;
-			for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
+			for (ColumnModel columnModel : tableModel.findColumns()) {
 				if (StringUtils.isEmpty(columnModel.getName())) {
 					result.add(new EmptyColumnNameProblem(tableModel, index));
 				}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ForeignKeyValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ForeignKeyValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ForeignKeyValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -28,7 +28,6 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.attribute.constraint.KeyConstraint;
-import org.jiemamy.utils.model.ForeignKeyUtil;
 import org.jiemamy.utils.model.RootModelUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
@@ -58,7 +57,7 @@
 				result.add(new ReferenceMappingProblem(foreignKey));
 			}
 			
-			if (ForeignKeyUtil.getReferenceKeyConstraint(foreignKey) == null) {
+			if (foreignKey.findReferencedKeyConstraint() == null) {
 				logger.error("fk(" + foreignKey.getId() + ") reference error");
 				result.add(new ReferenceKeyProblem(foreignKey));
 			}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/IndexValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/IndexValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/IndexValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -34,8 +34,6 @@
 import org.jiemamy.model.index.IndexColumnModel;
 import org.jiemamy.model.index.IndexModel;
 import org.jiemamy.utils.CollectionsUtil;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
 import org.jiemamy.validator.Problem;
@@ -54,9 +52,9 @@
 	public Collection<Problem> validate(RootModel rootModel) {
 		Collection<Problem> result = super.validate(rootModel);
 		ReferenceResolver referenceResolver = rootModel.getJiemamy().getReferenceResolver();
-		for (TableModel tableModel : RootModelUtil.getEntities(rootModel, TableModel.class)) {
+		for (TableModel tableModel : rootModel.findEntities(TableModel.class)) {
 			Collection<UUID> columnIds = CollectionsUtil.newArrayList();
-			for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
+			for (ColumnModel columnModel : tableModel.findColumns()) {
 				columnIds.add(columnModel.getId());
 			}
 			

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/KeyConstraintValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/KeyConstraintValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/KeyConstraintValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -32,8 +32,6 @@
 import org.jiemamy.model.attribute.constraint.KeyConstraint;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.CollectionsUtil;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
 import org.jiemamy.validator.Problem;
@@ -55,12 +53,12 @@
 	@Override
 	public Collection<Problem> validate(RootModel rootModel) {
 		Collection<Problem> result = super.validate(rootModel);
-		for (TableModel tableModel : RootModelUtil.getEntities(rootModel, TableModel.class)) {
+		for (TableModel tableModel : rootModel.findEntities(TableModel.class)) {
 			Collection<UUID> columnIds = CollectionsUtil.newArrayList();
-			for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
+			for (ColumnModel columnModel : tableModel.findColumns()) {
 				columnIds.add(columnModel.getId());
 			}
-			for (KeyConstraint keyConstraint : TableUtil.getAttributes(tableModel, KeyConstraint.class)) {
+			for (KeyConstraint keyConstraint : tableModel.findAttributes(KeyConstraint.class)) {
 				if (keyConstraint.getKeyColumns().size() < 1) {
 					result.add(new NoKeyColumnProblem(tableModel, keyConstraint));
 				}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/PrimaryKeyValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/PrimaryKeyValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/PrimaryKeyValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -24,8 +24,6 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKey;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
 import org.jiemamy.validator.Problem;
@@ -45,9 +43,9 @@
 	@Override
 	public Collection<Problem> validate(RootModel rootModel) {
 		Collection<Problem> result = super.validate(rootModel);
-		Collection<TableModel> tableModels = RootModelUtil.getEntities(rootModel, TableModel.class);
+		Collection<TableModel> tableModels = rootModel.findEntities(TableModel.class);
 		for (TableModel tableModel : tableModels) {
-			int size = TableUtil.getAttributes(tableModel, PrimaryKey.class, true).size();
+			int size = tableModel.findAttributes(PrimaryKey.class, true).size();
 			if (size == 0) {
 				result.add(new NoPrimaryKeyProblem(tableModel));
 			} else if (size > 1) {

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/TableValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/TableValidator.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/TableValidator.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -27,8 +27,6 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 import org.jiemamy.validator.AbstractProblem;
 import org.jiemamy.validator.AbstractValidator;
 import org.jiemamy.validator.Problem;
@@ -48,9 +46,9 @@
 	@Override
 	public Collection<Problem> validate(RootModel rootModel) {
 		Collection<Problem> result = super.validate(rootModel);
-		Collection<TableModel> tableModels = RootModelUtil.getEntities(rootModel, TableModel.class);
+		Collection<TableModel> tableModels = rootModel.findEntities(TableModel.class);
 		for (TableModel tableModel : tableModels) {
-			List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+			List<ColumnModel> columns = tableModel.findColumns();
 			if (columns.size() == 0) {
 				result.add(new NoColumnProblem(tableModel));
 			}

Added: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/attribute/AbstractAttributeModelTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/attribute/AbstractAttributeModelTest.java	                        (rev 0)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/attribute/AbstractAttributeModelTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/04/30
+ *
+ * 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.internal.model.attribute;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+import java.util.SortedSet;
+
+import org.jiemamy.Jiemamy;
+import org.jiemamy.internal.test.TestModelBuilders;
+import org.jiemamy.internal.test.TestModelsTestBase;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.AttributeModel;
+import org.jiemamy.model.entity.EntityModel;
+import org.jiemamy.model.entity.TableModel;
+
+/**
+ * TODO for daisuke
+ * 
+ * @author daisuke
+ */
+public class AbstractAttributeModelTest extends TestModelsTestBase {
+	
+	/**
+	 * {@link AttributeModel#findDeclaringTable()}のテスト。
+	 * 
+	 * @throws Exception 例外が発生した場合
+	 */
+	@Override
+	public void doTest(TestModelBuilders entry) throws Exception {
+		Jiemamy jiemamy = entry.getBuiltModel();
+		RootModel rootModel = jiemamy.getFactory().getRootModel();
+		SortedSet<EntityModel> entities = rootModel.getEntities();
+		for (EntityModel entityModel : entities) {
+			if (entityModel instanceof TableModel) {
+				TableModel tableModel = (TableModel) entityModel;
+				
+				List<AttributeModel> attributes = tableModel.getAttributes();
+				for (AttributeModel attributeModel : attributes) {
+					assertThat(attributeModel.findDeclaringTable(), is(tableModel));
+				}
+				
+			}
+		}
+	}
+	
+}


Property changes on: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/attribute/AbstractAttributeModelTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Deleted: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/AttributeUtilTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -1,64 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2009/02/23
- *
- * 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.utils.model;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-import java.util.SortedSet;
-
-import org.jiemamy.Jiemamy;
-import org.jiemamy.internal.test.TestModelBuilders;
-import org.jiemamy.internal.test.TestModelsTestBase;
-import org.jiemamy.model.RootModel;
-import org.jiemamy.model.attribute.AttributeModel;
-import org.jiemamy.model.entity.EntityModel;
-import org.jiemamy.model.entity.TableModel;
-
-/**
- * {@link AttributeUtil}のテストクラス。
- * 
- * @author daisuke
- */
-public class AttributeUtilTest extends TestModelsTestBase {
-	
-	/**
-	 * {@link AttributeUtil#getDefinedTable(AttributeModel)}のテスト。
-	 * 
-	 * @throws Exception 例外が発生した場合
-	 */
-	@Override
-	public void doTest(TestModelBuilders entry) throws Exception {
-		Jiemamy jiemamy = entry.getBuiltModel();
-		RootModel rootModel = jiemamy.getFactory().getRootModel();
-		SortedSet<EntityModel> entities = rootModel.getEntities();
-		for (EntityModel entityModel : entities) {
-			if (entityModel instanceof TableModel) {
-				TableModel tableModel = (TableModel) entityModel;
-				
-				List<AttributeModel> attributes = tableModel.getAttributes();
-				for (AttributeModel attributeModel : attributes) {
-					assertThat(AttributeUtil.getDefinedTable(attributeModel), is(tableModel));
-				}
-				
-			}
-		}
-	}
-}

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/ColumnUtilTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -30,6 +30,7 @@
 import org.jiemamy.Jiemamy;
 import org.jiemamy.internal.test.CoreTestModelBuilder;
 import org.jiemamy.internal.test.ReflectionDialectProvider;
+import org.jiemamy.model.attribute.ColumnModel;
 
 /**
  * {@link ColumnUtil}のテストクラス。
@@ -64,24 +65,24 @@
 	}
 	
 	/**
-	 * {@link ColumnUtil#isPartOfPrimaryKeyColumns(org.jiemamy.model.attribute.ColumnModel)}のテスト。
+	 * {@link ColumnModel#checkPrimaryKeyColumn()}のテスト。
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
 	public void test01_isPartOfPrimaryKeyColumns() throws Exception {
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.deptId), is(true));
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.deptDeptName), is(false));
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.deptDeptNo), is(false));
+		assertThat(mb.deptId.checkPrimaryKeyColumn(), is(true));
+		assertThat(mb.deptDeptName.checkPrimaryKeyColumn(), is(false));
+		assertThat(mb.deptDeptNo.checkPrimaryKeyColumn(), is(false));
 		
 		// empIdはPKである
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(true));
 		
 		// PKを外すと
 		assertThat(mb.tableEmp.getAttributes().remove(mb.empPk), is(true));
 		
 		// empIdはPKではなくなる
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(false));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(false));
 		
 		// カラムに対してPKは設定されていない
 		assertThat(mb.empId.getPrimaryKey(), is(nullValue()));
@@ -90,7 +91,7 @@
 		mb.empId.setPrimaryKey(mb.empPk);
 		
 		// そするとPK扱いとなる
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(true));
 		
 		// しかし、テーブルのattributesには含まれていない
 		assertThat(mb.tableEmp.getAttributes().contains(mb.empPk), is(false));

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/EntityUtilTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/EntityUtilTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/EntityUtilTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -40,12 +40,12 @@
 public class EntityUtilTest {
 	
 	/**
-	 * {@link EntityUtil#getReferenceEntities(EntityModel, boolean)}
+	 * {@link EntityModel#findSuperEntities(boolean)}
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
-	public void test01_getReferenceEntities_empDept() throws Exception {
+	public void test01_findSuperEntities_empDept() throws Exception {
 		Jiemamy jiemamy = Jiemamy.newInstance(new Artemis(), new ReflectionDialectProvider());
 		CoreTestModelBuilder mb = new CoreTestModelBuilder(jiemamy);
 		mb.build();
@@ -53,24 +53,22 @@
 		// `___^
 		// 矢印を正順に辿る
 		
-		assertThat(EntityUtil.getReferenceEntities(mb.tableEmp, true),
-				hasItems((EntityModel) mb.tableDept, mb.tableEmp));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableEmp, false), hasItems((EntityModel) mb.tableDept,
-				mb.tableEmp));
+		assertThat(mb.tableEmp.findSuperEntities(true), hasItems((EntityModel) mb.tableDept, mb.tableEmp));
+		assertThat(mb.tableEmp.findSuperEntities(false), hasItems((EntityModel) mb.tableDept, mb.tableEmp));
 		
-		assertThat(EntityUtil.getReferenceEntities(mb.tableDept, true).size(), is(0));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableDept, false).size(), is(0));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableEmp, true).size(), is(2));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableEmp, false).size(), is(2));
+		assertThat(mb.tableDept.findSuperEntities(true).size(), is(0));
+		assertThat(mb.tableDept.findSuperEntities(false).size(), is(0));
+		assertThat(mb.tableEmp.findSuperEntities(true).size(), is(2));
+		assertThat(mb.tableEmp.findSuperEntities(false).size(), is(2));
 	}
 	
 	/**
-	 * {@link EntityUtil#getDependentEntities(EntityModel, boolean)}
+	 * {@link EntityModel#findSubEntities(boolean)}
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
-	public void test02_getDependentEntities_empDept() throws Exception {
+	public void test02_findSubEntities_empDept() throws Exception {
 		Jiemamy jiemamy = Jiemamy.newInstance(new Artemis(), new ReflectionDialectProvider());
 		CoreTestModelBuilder mb = new CoreTestModelBuilder(jiemamy);
 		mb.build();
@@ -78,24 +76,24 @@
 		// `___^
 		// 矢印を逆順に辿る
 		
-		assertThat(EntityUtil.getDependentEntities(mb.tableDept, true), hasItem((EntityModel) mb.tableEmp));
-		assertThat(EntityUtil.getDependentEntities(mb.tableDept, false), hasItem((EntityModel) mb.tableEmp));
-		assertThat(EntityUtil.getDependentEntities(mb.tableEmp, true), hasItem((EntityModel) mb.tableEmp));
-		assertThat(EntityUtil.getDependentEntities(mb.tableEmp, false), hasItem((EntityModel) mb.tableEmp));
+		assertThat(mb.tableDept.findSubEntities(true), hasItem((EntityModel) mb.tableEmp));
+		assertThat(mb.tableDept.findSubEntities(false), hasItem((EntityModel) mb.tableEmp));
+		assertThat(mb.tableEmp.findSubEntities(true), hasItem((EntityModel) mb.tableEmp));
+		assertThat(mb.tableEmp.findSubEntities(false), hasItem((EntityModel) mb.tableEmp));
 		
-		assertThat(EntityUtil.getDependentEntities(mb.tableDept, true).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableDept, false).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableEmp, true).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableEmp, false).size(), is(1));
+		assertThat(mb.tableDept.findSubEntities(true).size(), is(1));
+		assertThat(mb.tableDept.findSubEntities(false).size(), is(1));
+		assertThat(mb.tableEmp.findSubEntities(true).size(), is(1));
+		assertThat(mb.tableEmp.findSubEntities(false).size(), is(1));
 	}
 	
 	/**
-	 * {@link EntityUtil#getReferenceEntities(EntityModel, boolean)}
+	 * {@link EntityModel#findSuperEntities( boolean)}
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
-	public void test03_getReferenceEntities_order() throws Exception {
+	public void test03_findSuperEntities_order() throws Exception {
 		Jiemamy jiemamy = Jiemamy.newInstance(new Artemis(), new ReflectionDialectProvider());
 		CoreTestModelBuilder2 mb = new CoreTestModelBuilder2(jiemamy);
 		mb.build();
@@ -103,30 +101,29 @@
 		//        +-> ITEM
 		// 矢印を正順に辿る
 		
-		assertThat(EntityUtil.getReferenceEntities(mb.tableDetail, true), hasItems((EntityModel) mb.tableOrder,
-				mb.tableUser, mb.tableItem));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableDetail, false), hasItems((EntityModel) mb.tableOrder,
+		assertThat(mb.tableDetail.findSuperEntities(true), hasItems((EntityModel) mb.tableOrder, mb.tableUser,
 				mb.tableItem));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableOrder, true), hasItem((EntityModel) mb.tableUser));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableOrder, false), hasItem((EntityModel) mb.tableUser));
+		assertThat(mb.tableDetail.findSuperEntities(false), hasItems((EntityModel) mb.tableOrder, mb.tableItem));
+		assertThat(mb.tableOrder.findSuperEntities(true), hasItem((EntityModel) mb.tableUser));
+		assertThat(mb.tableOrder.findSuperEntities(false), hasItem((EntityModel) mb.tableUser));
 		
-		assertThat(EntityUtil.getReferenceEntities(mb.tableDetail, true).size(), is(3));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableDetail, false).size(), is(2));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableItem, true).size(), is(0));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableItem, false).size(), is(0));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableOrder, true).size(), is(1));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableOrder, false).size(), is(1));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableUser, true).size(), is(0));
-		assertThat(EntityUtil.getReferenceEntities(mb.tableUser, false).size(), is(0));
+		assertThat(mb.tableDetail.findSuperEntities(true).size(), is(3));
+		assertThat(mb.tableDetail.findSuperEntities(false).size(), is(2));
+		assertThat(mb.tableItem.findSuperEntities(true).size(), is(0));
+		assertThat(mb.tableItem.findSuperEntities(false).size(), is(0));
+		assertThat(mb.tableOrder.findSuperEntities(true).size(), is(1));
+		assertThat(mb.tableOrder.findSuperEntities(false).size(), is(1));
+		assertThat(mb.tableUser.findSuperEntities(true).size(), is(0));
+		assertThat(mb.tableUser.findSuperEntities(false).size(), is(0));
 	}
 	
 	/**
-	 * {@link EntityUtil#getDependentEntities(EntityModel, boolean)}
+	 * {@link EntityModel#findSubEntities(boolean)}
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
-	public void test04_getDependentEntities_order() throws Exception {
+	public void test04_findSubEntities_order() throws Exception {
 		Jiemamy jiemamy = Jiemamy.newInstance(new Artemis(), new ReflectionDialectProvider());
 		CoreTestModelBuilder2 mb = new CoreTestModelBuilder2(jiemamy);
 		mb.build();
@@ -134,21 +131,20 @@
 		//        +-> ITEM
 		// 矢印を逆順に辿る
 		
-		assertThat(EntityUtil.getDependentEntities(mb.tableDetail, true).size(), is(0));
-		assertThat(EntityUtil.getDependentEntities(mb.tableDetail, false).size(), is(0));
-		assertThat(EntityUtil.getDependentEntities(mb.tableItem, true).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableItem, false).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableOrder, true).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableOrder, false).size(), is(1));
-		assertThat(EntityUtil.getDependentEntities(mb.tableUser, true).size(), is(2));
-		assertThat(EntityUtil.getDependentEntities(mb.tableUser, false).size(), is(1));
+		assertThat(mb.tableDetail.findSubEntities(true).size(), is(0));
+		assertThat(mb.tableDetail.findSubEntities(false).size(), is(0));
+		assertThat(mb.tableItem.findSubEntities(true).size(), is(1));
+		assertThat(mb.tableItem.findSubEntities(false).size(), is(1));
+		assertThat(mb.tableOrder.findSubEntities(true).size(), is(1));
+		assertThat(mb.tableOrder.findSubEntities(false).size(), is(1));
+		assertThat(mb.tableUser.findSubEntities(true).size(), is(2));
+		assertThat(mb.tableUser.findSubEntities(false).size(), is(1));
 		
-		assertThat(EntityUtil.getDependentEntities(mb.tableItem, true), hasItem((EntityModel) mb.tableDetail));
-		assertThat(EntityUtil.getDependentEntities(mb.tableItem, false), hasItem((EntityModel) mb.tableDetail));
-		assertThat(EntityUtil.getDependentEntities(mb.tableOrder, true), hasItem((EntityModel) mb.tableDetail));
-		assertThat(EntityUtil.getDependentEntities(mb.tableOrder, false), hasItem((EntityModel) mb.tableDetail));
-		assertThat(EntityUtil.getDependentEntities(mb.tableUser, true), hasItems((EntityModel) mb.tableOrder,
-				mb.tableDetail));
-		assertThat(EntityUtil.getDependentEntities(mb.tableUser, false), hasItem((EntityModel) mb.tableOrder));
+		assertThat(mb.tableItem.findSubEntities(true), hasItem((EntityModel) mb.tableDetail));
+		assertThat(mb.tableItem.findSubEntities(false), hasItem((EntityModel) mb.tableDetail));
+		assertThat(mb.tableOrder.findSubEntities(true), hasItem((EntityModel) mb.tableDetail));
+		assertThat(mb.tableOrder.findSubEntities(false), hasItem((EntityModel) mb.tableDetail));
+		assertThat(mb.tableUser.findSubEntities(true), hasItems((EntityModel) mb.tableOrder, mb.tableDetail));
+		assertThat(mb.tableUser.findSubEntities(false), hasItem((EntityModel) mb.tableOrder));
 	}
 }

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/utils/model/RootModelUtilTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -71,13 +71,13 @@
 	}
 	
 	/**
-	 * {@link RootModelUtil#getDialect(org.jiemamy.model.RootModel)}のテスト。
+	 * {@link RootModel#findDialect()}のテスト。
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
 	public void test01_getDialect() throws Exception {
-		Dialect dialect = RootModelUtil.getDialect(mb.rootModel);
+		Dialect dialect = mb.rootModel.findDialect();
 		assertThat(dialect, is(notNullValue()));
 		assertThat(dialect.toString(), is(mb.rootModel.getDialectClassName()));
 	}
@@ -99,8 +99,8 @@
 		rootModel.getEntities().add(new ViewBuilderImpl(factory, "view1").build());
 		rootModel.getEntities().add(new ViewBuilderImpl(factory, "view2").build());
 		
-		assertThat(rootModel.getEntities(TableModel.class).size(), is(3));
-		assertThat(rootModel.getEntities(ViewModel.class).size(), is(2));
+		assertThat(rootModel.findEntities(TableModel.class).size(), is(3));
+		assertThat(rootModel.findEntities(ViewModel.class).size(), is(2));
 	}
 	
 	/**
@@ -124,14 +124,14 @@
 	}
 	
 	/**
-	 * {@link RootModelUtil#normalize(org.jiemamy.model.RootModel)}のテスト。
+	 * {@link RootModel#normalize()}のテスト。
 	 * 
 	 * @throws Exception 例外が発生した場合
 	 */
 	@Test
 	public void test03_normalize() throws Exception {
 		// empIdはPKである
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(true));
 		
 		// PKはカラムに対して設定されたものではなく
 		assertThat(mb.empId.getPrimaryKey(), is(nullValue()));
@@ -143,7 +143,7 @@
 		assertThat(mb.tableEmp.getAttributes().remove(mb.empPk), is(true));
 		
 		// empIdはPKではなくなる
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(false));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(false));
 		
 		// 今度はPKカラムに対して設定し
 		mb.empId.setPrimaryKey(mb.empPk);
@@ -155,14 +155,14 @@
 		assertThat(mb.tableEmp.getAttributes().contains(mb.empPk), is(false));
 		
 		// empIdがPK扱いとなる
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(true));
 		
 		// ここでノーマライズすると
-		RootModelUtil.normalize(mb.rootModel);
+		mb.rootModel.normalize();
 		
 		// カラムに設定されたPKは、テーブルに対するPKに戻る。
 		assertThat(mb.empId.getPrimaryKey(), is(nullValue()));
 		assertThat(mb.tableEmp.getAttributes().contains(mb.empPk), is(true));
-		assertThat(ColumnUtil.isPartOfPrimaryKeyColumns(mb.empId), is(true));
+		assertThat(mb.empId.checkPrimaryKeyColumn(), is(true));
 	}
 }

Modified: artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlEmitter.java
===================================================================
--- artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlEmitter.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-dialect-mysql/src/main/java/org/jiemamy/dialect/mysql/MySqlEmitter.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -58,8 +58,6 @@
 import org.jiemamy.model.sql.Token;
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.Disablable;
-import org.jiemamy.utils.model.DataTypeUtil;
-import org.jiemamy.utils.model.ForeignKeyUtil;
 
 /**
  * MySQL用の{@link SqlEmitter}実装クラス。
@@ -116,8 +114,7 @@
 				tokens.addAll(dataTypeResolver.resolveDataType(columnModel.getDataType(), referenceResolver));
 				
 				if (StringUtils.isEmpty(columnModel.getDefaultValue()) == false) {
-					BuiltinDataType builtinDataType =
-							DataTypeUtil.toBuiltinDataType(columnModel.getDataType(), referenceResolver);
+					BuiltinDataType builtinDataType = columnModel.getDataType().toBuiltinDataType(referenceResolver);
 					tokens.add(Keyword.DEFAULT);
 					tokens.add(Literal
 						.of(columnModel.getDefaultValue(), builtinDataType.getCategory().getLiteralType()));
@@ -209,7 +206,7 @@
 				tokens.add(Keyword.KEY);
 				addColumnList(tokens, foreignKey.getKeyColumns(), referenceResolver);
 				tokens.add(Keyword.REFERENCES);
-				EntityModel referenceEntity = ForeignKeyUtil.getReferenceEntity(foreignKey);
+				EntityModel referenceEntity = foreignKey.findReferencedEntity();
 				tokens.add(Identifier.of(referenceEntity.getName()));
 				addColumnList(tokens, foreignKey.getReferenceColumns(), referenceResolver);
 				

Modified: artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlEmitterTest.java
===================================================================
--- artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlEmitterTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-dialect-mysql/src/test/java/org/jiemamy/dialect/mysql/MySqlEmitterTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -49,7 +49,6 @@
 import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.sql.SqlStatement;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * {@link MySqlEmitter}のテストクラス。
@@ -78,7 +77,7 @@
 		mb.tableDept.registerAdapter(new StorageEngineImpl());
 		mb.tableDept.getAdapter(StorageEngine.class).setType(StandardEngine.InnoDB);
 		
-		Dialect dialect = RootModelUtil.getDialect(mb.rootModel);
+		Dialect dialect = mb.rootModel.findDialect();
 		
 		jiemamy = mb.getJiemamy();
 		DataTypeResolver dataTypeResolver = new DefaultDataTypeResolver(dialect.getMoldManager());
@@ -121,7 +120,7 @@
 		JiemamyFactory factory = jiemamy.getFactory();
 		RootModel rootModel = factory.getRootModel();
 		rootModel.setDialectClassName(MySqlDialect.class.getName());
-		Dialect dialect = RootModelUtil.getDialect(rootModel);
+		Dialect dialect = rootModel.findDialect();
 		
 		TableModel tableModel = factory.newModel(TableModel.class);
 		rootModel.getEntities().add(tableModel);

Modified: artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlEntityImportVisitor.java
===================================================================
--- artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlEntityImportVisitor.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ artemis/trunk/jiemamy-dialect-postgresql/src/main/java/org/jiemamy/dialect/postgresql/PostgresqlEntityImportVisitor.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -30,7 +30,6 @@
 import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.StringUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * {@link EntityImportVisitor}のPostgreSQL用実装クラス。
@@ -47,7 +46,7 @@
 	protected TableModel createTable(final JiemamyFactory factory, String tableName) throws SQLException {
 		TableModel tableModel = super.createTable(factory, tableName);
 		
-		List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+		List<ColumnModel> columns = tableModel.findColumns();
 		for (ColumnModel columnModel : columns) {
 			if (columnModel.getDataType() instanceof BuiltinDataType) {
 				BuiltinDataType builtinDataType = (BuiltinDataType) columnModel.getDataType();

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/DiagramEditor.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -114,7 +114,6 @@
 import org.jiemamy.serializer.SerializationException;
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.LogMarker;
-import org.jiemamy.utils.model.RootModelUtil;
 import org.jiemamy.validator.Problem;
 import org.jiemamy.validator.Validator;
 import org.jiemamy.validator.Problem.Severity;
@@ -547,7 +546,7 @@
 		IFile file = ((IFileEditorInput) getEditorInput()).getFile();
 		try {
 			rootModel = jiemamy.getSerializer().deserialize(file.getContents());
-			RootModelUtil.normalize(rootModel);
+			rootModel.normalize();
 		} catch (SerializationException e) {
 			ExceptionHandler.handleException(e, "Data file is broken.");
 		} catch (CoreException e) {

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/MultiDiagramEditor.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -54,7 +54,6 @@
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.utils.CollectionsUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * マルチページ構成のダイアグラムエディタクラス。
@@ -177,7 +176,7 @@
 		IFile file = ((IFileEditorInput) input).getFile();
 		try {
 			rootModel = jiemamy.getSerializer().deserialize(file.getContents());
-			RootModelUtil.normalize(rootModel);
+			rootModel.normalize();
 //			rootModel.setDisplayMode(DatabaseModel.MODE_PHYSICAL_ATTRTYPE);
 		} catch (SerializationException e) {
 			ExceptionHandler.handleException(e, "Data file is broken.");

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -38,7 +38,6 @@
 import org.jiemamy.model.node.NodeAdapter;
 import org.jiemamy.model.node.StickyModel;
 import org.jiemamy.utils.LogMarker;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * コネクション作成GEFコマンド。
@@ -107,7 +106,7 @@
 		}
 		
 		// カラムが1つもないテーブルからは外部キーが貼れない
-		if (TableUtil.getColumns((TableModel) source.unwrap()).size() < 1) {
+		if (((TableModel) source.unwrap()).findColumns().size() < 1) {
 			LogUtil.log(JiemamyUIPlugin.getDefault(), Messages.CreateConnectionCommand_log_canExecute_03);
 			return false;
 		}
@@ -199,9 +198,9 @@
 	private LocalKeyConstraint getKey(TableModel tableModel) {
 		LocalKeyConstraint key = null;
 		try {
-			key = TableUtil.getPrimaryKey(tableModel);
+			key = tableModel.findPrimaryKey();
 		} catch (ElementNotFoundException e) {
-			List<LocalKeyConstraint> attributes = TableUtil.getAttributes(tableModel, LocalKeyConstraint.class);
+			List<LocalKeyConstraint> attributes = tableModel.findAttributes(LocalKeyConstraint.class);
 			if (attributes.size() > 0) {
 				key = attributes.get(0);
 			}

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -26,8 +26,6 @@
 import org.jiemamy.model.attribute.constraint.ForeignKey;
 import org.jiemamy.model.connection.ConnectionAdapter;
 import org.jiemamy.model.entity.TableModel;
-import org.jiemamy.utils.model.AttributeUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * コネクション削除GEFコマンド。
@@ -61,7 +59,7 @@
 	@Override
 	public void execute() {
 		ForeignKey foreignKey = connection.unwrap();
-		TableModel definedTable = AttributeUtil.getDefinedTable(foreignKey);
+		TableModel definedTable = foreignKey.findDeclaringTable();
 		
 		save = jiemamyFacade.save();
 		jiemamyFacade.removeAttribute(definedTable, foreignKey);
@@ -70,6 +68,6 @@
 	@Override
 	public void undo() {
 		jiemamyFacade.rollback(save);
-		RootModelUtil.normalize(rootModel);
+		rootModel.normalize();
 	}
 }

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/foreignkey/ForeignKeyEditDialog.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/foreignkey/ForeignKeyEditDialog.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/foreignkey/ForeignKeyEditDialog.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -61,11 +61,8 @@
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.LogMarker;
-import org.jiemamy.utils.model.AttributeUtil;
-import org.jiemamy.utils.model.ForeignKeyUtil;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
 import org.jiemamy.utils.model.KeyConstraintUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * 外部キー設定ダイアログクラス。
@@ -143,10 +140,10 @@
 		this.jiemamyFacade = jiemamyFacade;
 		setShellStyle(getShellStyle() | SWT.RESIZE);
 		jiemamy = foreignKey.getJiemamy();
-		TableModel sourceTableModel = AttributeUtil.getDefinedTable(foreignKey);
-		TableModel targetTableModel = (TableModel) ForeignKeyUtil.getReferenceEntity(foreignKey);
-		sourceColumns = TableUtil.getColumns(sourceTableModel);
-		referenceKeys = TableUtil.getAttributes(targetTableModel, LocalKeyConstraint.class, true);
+		TableModel sourceTableModel = foreignKey.findDeclaringTable();
+		TableModel targetTableModel = (TableModel) foreignKey.findReferencedEntity();
+		sourceColumns = sourceTableModel.findColumns();
+		referenceKeys = targetTableModel.findAttributes(LocalKeyConstraint.class, true);
 		
 		keyColumnCombos = CollectionsUtil.newArrayList(referenceKeys.size());
 		referenceColumnLabels = CollectionsUtil.newArrayList(referenceKeys.size());
@@ -194,7 +191,7 @@
 			radDeferred.setEnabled(false);
 		}
 		
-		KeyConstraint referenceKeyConstraint = ForeignKeyUtil.getReferenceKeyConstraint(foreignKey);
+		KeyConstraint referenceKeyConstraint = foreignKey.findReferencedKeyConstraint();
 		if (referenceKeyConstraint == null) {
 			cmbReferenceKey.setText(cmbReferenceKey.getItem(0));
 		} else {

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialog.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialog.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialog.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -68,7 +68,6 @@
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.entity.TableRef;
 import org.jiemamy.utils.model.DataSetUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * {@link RootModel}設定ダイアログクラス。
@@ -330,7 +329,7 @@
 				public void widgetSelected(SelectionEvent evt) {
 					JiemamyFactory factory = dataSetModel.getJiemamy().getFactory();
 					RootModel rootModel = factory.getRootModel();
-					Collection<TableModel> tables = RootModelUtil.getEntities(rootModel, TableModel.class);
+					Collection<TableModel> tables = rootModel.findEntities(TableModel.class);
 					List<TableModel> list = IteratorUtils.toList(tables.iterator());
 					TableSelectDialog dialog = new TableSelectDialog(getShell(), list);
 					dialog.open();

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialogTableTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialogTableTab.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DataSetEditDialogTableTab.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -47,7 +47,6 @@
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.LogMarker;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * データセット編集ダイアログの各テーブルのタブ。
@@ -95,7 +94,7 @@
 		table.setLinesVisible(true);
 		table.setData(tableModel);
 		
-		List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+		List<ColumnModel> columns = tableModel.findColumns();
 		for (ColumnModel columnModel : columns) {
 			TableColumn column = new TableColumn(table, SWT.NONE);
 			column.setWidth(COL_WIDTH);

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -134,7 +134,7 @@
 			
 		}
 		try {
-			cmbDialect.setText(rootModel.getDialect().getName());
+			cmbDialect.setText(rootModel.findDialect().getName());
 		} catch (ClassNotFoundException e) {
 			cmbDialect.setText(dialects.get(0).getName());
 		}

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -94,7 +94,6 @@
 import org.jiemamy.utils.LogMarker;
 import org.jiemamy.utils.model.DataTypeUtil;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * データベース編集ダイアログの「ドメイン」タブ。
@@ -131,7 +130,7 @@
 		
 		Dialect dialect;
 		try {
-			dialect = RootModelUtil.getDialect(rootModel);
+			dialect = rootModel.findDialect();
 		} catch (ClassNotFoundException e) {
 			dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0);
 			logger.warn("Dialectのロスト", e);
@@ -287,7 +286,7 @@
 			domains = rootModel.getDomains();
 			
 			try {
-				dialect = RootModelUtil.getDialect(rootModel.getJiemamy().getFactory().getRootModel());
+				dialect = rootModel.findDialect();
 			} catch (ClassNotFoundException e) {
 				// TODO GenericDialectをセットするように
 				dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0);
@@ -536,7 +535,7 @@
 			txtCheckName.setEnabled(true);
 			txtCheckExpression.setEnabled(true);
 			
-			BuiltinDataType dataType = (BuiltinDataType) domainModel.getDataType();
+			BuiltinDataType dataType = domainModel.getDataType();
 			List<Object> adapters = dataType.getAdapters();
 			List<Class<?>> adapterClasses = CollectionsUtil.newArrayList();
 			for (Object adapter : adapters) {

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -59,7 +59,6 @@
 import org.jiemamy.model.node.NodeAdapter;
 import org.jiemamy.utils.Disablable;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * テーブルの詳細編集ダイアログクラス。
@@ -217,7 +216,7 @@
 			}
 		}
 		
-		List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+		List<ColumnModel> columns = tableModel.findColumns();
 		Set<String> columnNames = new HashSet<String>(columns.size());
 		for (ColumnModel columnModel : columns) {
 			columnNames.add(columnModel.getName());

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -64,7 +64,6 @@
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.LogMarker;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * テーブル編集ダイアログの「チェック制約」タブ。
@@ -351,7 +350,7 @@
 			
 			jiemamyFacade.addAttribute(tableModel, checkConstraint);
 			
-			int addedIndex = TableUtil.getAttributes(tableModel, TableCheckConstraint.class).indexOf(checkConstraint);
+			int addedIndex = tableModel.findAttributes(TableCheckConstraint.class).indexOf(checkConstraint);
 			table.setSelection(addedIndex);
 			enableEditControls(addedIndex);
 			txtCheckName.setFocus();
@@ -375,7 +374,7 @@
 				jiemamyFacade.addAttribute(tableModel, subjectIndex, checkConstraint);
 			}
 			
-			int addedIndex = TableUtil.getAttributes(tableModel, TableCheckConstraint.class).indexOf(checkConstraint);
+			int addedIndex = tableModel.findAttributes(TableCheckConstraint.class).indexOf(checkConstraint);
 			table.setSelection(addedIndex);
 			enableEditControls(addedIndex);
 			txtCheckName.setFocus();
@@ -454,8 +453,7 @@
 			if (editIndex == -1) {
 				return;
 			}
-			CheckConstraint checkConstraint =
-					TableUtil.getAttributes(tableModel, TableCheckConstraint.class).get(editIndex);
+			CheckConstraint checkConstraint = tableModel.findAttributes(TableCheckConstraint.class).get(editIndex);
 			
 			String checkName = JiemamyPropertyUtil.careNull(txtCheckName.getText(), true);
 			jiemamyFacade.changeModelProperty(checkConstraint, ConstraintProperty.name, checkName);

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -102,10 +102,7 @@
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.Disablable;
 import org.jiemamy.utils.LogMarker;
-import org.jiemamy.utils.model.ColumnUtil;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
-import org.jiemamy.utils.model.RootModelUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * テーブル編集ダイアログの「カラム」タブ。
@@ -145,7 +142,7 @@
 		
 		Dialect dialect;
 		try {
-			dialect = RootModelUtil.getDialect(rootModel);
+			dialect = rootModel.findDialect();
 		} catch (ClassNotFoundException e) {
 			dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0);
 			logger.warn("Dialectのロスト", e);
@@ -229,7 +226,7 @@
 			
 			switch (columnIndex) {
 				case 0:
-					return ColumnUtil.isPartOfPrimaryKeyColumns(columnModel) ? ir.get(Images.ICON_PK) : null;
+					return columnModel.checkPrimaryKeyColumn() ? ir.get(Images.ICON_PK) : null;
 					
 				case 4:
 					return ir.get(columnModel.getNotNullConstraint() != null ? Images.CHECK_ON : Images.CHECK_OFF);
@@ -328,7 +325,7 @@
 			attributes = tableModel.getAttributes();
 			
 			try {
-				dialect = RootModelUtil.getDialect(rootModel.getJiemamy().getFactory().getRootModel());
+				dialect = rootModel.findDialect();
 			} catch (ClassNotFoundException e) {
 				// TODO GeneriDialectをセットするように
 				dialect = JiemamyCorePlugin.getDialectResolver().getAllInstance().get(0);
@@ -672,7 +669,7 @@
 			txtDefaultValue.setText(JiemamyPropertyUtil.careNull(columnModel.getDefaultValue()));
 			txtDescription.setText(JiemamyPropertyUtil.careNull(columnModel.getDescription()));
 			
-			chkIsPK.setSelection(ColumnUtil.isPartOfPrimaryKeyColumns(columnModel));
+			chkIsPK.setSelection(columnModel.checkPrimaryKeyColumn());
 			
 			if (columnModel.hasAdapter(Disablable.class)
 					&& Boolean.TRUE.equals(columnModel.getAdapter(Disablable.class).isDisabled())) {
@@ -690,7 +687,7 @@
 			JiemamyFactory factory = jiemamy.getFactory();
 			ColumnModel columnModel = factory.newModel(ColumnModel.class);
 			
-			String newName = "COLUMN_" + (TableUtil.getColumns(tableModel).size() + 1);
+			String newName = "COLUMN_" + (tableModel.findColumns().size() + 1);
 			jiemamyFacade.changeModelProperty(columnModel, AttributeProperty.name, newName);
 			
 			DataType builtinDataType = factory.newDataType(allTypes.get(0));
@@ -702,7 +699,7 @@
 					new TypeOptionManager(columnModel, cmpTypeOption, editListener, typeOptionHandler);
 			typeOptionManagers.put(columnModel, typeOptionManager);
 			
-			int addedIndex = TableUtil.getColumns(tableModel).indexOf(columnModel);
+			int addedIndex = tableModel.findColumns().indexOf(columnModel);
 			table.setSelection(addedIndex);
 			enableEditControls(addedIndex);
 			txtColumnName.setFocus();
@@ -717,7 +714,7 @@
 			
 			JiemamyFactory factory = jiemamy.getFactory();
 			ColumnModel columnModel = factory.newModel(ColumnModel.class);
-			String newName = "COLUMN_" + (TableUtil.getColumns(tableModel).size() + 1);
+			String newName = "COLUMN_" + (tableModel.findColumns().size() + 1);
 			jiemamyFacade.changeModelProperty(columnModel, AttributeProperty.name, newName);
 			
 			DataType builtinDataType = factory.newDataType(allTypes.get(0));
@@ -735,7 +732,7 @@
 					new TypeOptionManager(columnModel, cmpTypeOption, editListener, typeOptionHandler);
 			typeOptionManagers.put(columnModel, typeOptionManager);
 			
-			int addedIndex = TableUtil.getColumns(tableModel).indexOf(columnModel);
+			int addedIndex = tableModel.findColumns().indexOf(columnModel);
 			table.setSelection(addedIndex);
 			enableEditControls(addedIndex);
 			txtColumnName.setFocus();
@@ -873,7 +870,7 @@
 				return;
 			}
 			
-			ColumnModel columnModel = TableUtil.getColumns(tableModel).get(columnEditIndex);
+			ColumnModel columnModel = tableModel.findColumns().get(columnEditIndex);
 			
 			JiemamyFactory factory = columnModel.getJiemamy().getFactory();
 			
@@ -901,7 +898,7 @@
 			
 			PrimaryKey primaryKey = null;
 			try {
-				primaryKey = TableUtil.getPrimaryKey(tableModel);
+				primaryKey = tableModel.findPrimaryKey();
 			} catch (ElementNotFoundException e) {
 				// ignore
 			}
@@ -913,7 +910,7 @@
 				if (primaryKey == null) {
 					primaryKey = factory.newModel(PrimaryKey.class);
 					jiemamyFacade.addAttribute(tableModel, primaryKey);
-					RootModelUtil.normalize(rootModel);
+					rootModel.normalize();
 				}
 				jiemamyFacade.addKeyColumn(primaryKey, columnModel);
 			}

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -71,7 +71,6 @@
 import org.jiemamy.model.index.IndexColumnModel.SortOrder;
 import org.jiemamy.utils.LogMarker;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * テーブル編集ダイアログの「インデックス」タブ
@@ -367,7 +366,7 @@
 			Table table = getTableViewer().getTable();
 			int indexIndex = indexesTableEditor.getTableViewer().getTable().getSelectionIndex();
 			
-			List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+			List<ColumnModel> columns = tableModel.findColumns();
 			ColumnSelectDialog dialog = new ColumnSelectDialog(table.getShell(), columns);
 			
 			if (dialog.open() == Dialog.OK && dialog.getResult() != null && indexIndex != -1) {
@@ -395,7 +394,7 @@
 			Table table = getTableViewer().getTable();
 			int index = table.getSelectionIndex();
 			int indexIndex = indexesTableEditor.getTableViewer().getTable().getSelectionIndex();
-			List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+			List<ColumnModel> columns = tableModel.findColumns();
 			ColumnSelectDialog dialog = new ColumnSelectDialog(table.getShell(), columns);
 			
 			if (dialog.open() == Dialog.OK && dialog.getResult() != null && indexIndex != -1) {

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogLocalKeyTab.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -71,7 +71,6 @@
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.LogMarker;
 import org.jiemamy.utils.model.JiemamyPropertyUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * テーブル編集ダイアログの「キー制約」タブ。
@@ -365,7 +364,7 @@
 		
 		@Override
 		protected void enableEditorControls(int index) {
-			LocalKeyConstraint localKey = TableUtil.getAttributes(tableModel, LocalKeyConstraint.class).get(index);
+			LocalKeyConstraint localKey = tableModel.findAttributes(LocalKeyConstraint.class).get(index);
 			
 			txtKeyConstraintName.setEnabled(true);
 			lstKeyColumns.setEnabled(true);
@@ -374,7 +373,7 @@
 			// 現在値の設定
 			txtKeyConstraintName.setText(JiemamyPropertyUtil.careNull(localKey.getName()));
 			List<ColumnRef> keyColumns = localKey.getKeyColumns();
-			List<ColumnModel> columns = TableUtil.getColumns(tableModel);
+			List<ColumnModel> columns = tableModel.findColumns();
 			for (ColumnModel columnModel : columns) {
 				lstKeyColumns.add(columnModel.getName());
 				boolean found = false;
@@ -400,7 +399,7 @@
 			
 			jiemamyFacade.addAttribute(tableModel, uniqueKey);
 			
-			int addedIndex = TableUtil.getAttributes(tableModel, LocalKeyConstraint.class).indexOf(uniqueKey);
+			int addedIndex = tableModel.findAttributes(LocalKeyConstraint.class).indexOf(uniqueKey);
 			table.setSelection(addedIndex);
 			enableEditControls(addedIndex);
 			txtKeyConstraintName.setFocus();
@@ -424,7 +423,7 @@
 				jiemamyFacade.addAttribute(tableModel, subjectIndex, uniqueKey);
 			}
 			
-			int addedIndex = TableUtil.getAttributes(tableModel, LocalKeyConstraint.class).indexOf(uniqueKey);
+			int addedIndex = tableModel.findAttributes(LocalKeyConstraint.class).indexOf(uniqueKey);
 			table.setSelection(addedIndex);
 			enableEditControls(addedIndex);
 			txtKeyConstraintName.setFocus();
@@ -505,12 +504,12 @@
 			}
 			
 			JiemamyFactory factory = jiemamy.getFactory();
-			LocalKeyConstraint localKey = TableUtil.getAttributes(tableModel, LocalKeyConstraint.class).get(editIndex);
+			LocalKeyConstraint localKey = tableModel.findAttributes(LocalKeyConstraint.class).get(editIndex);
 			localKey.setName(JiemamyPropertyUtil.careNull(txtKeyConstraintName.getText(), true));
 			List<ColumnRef> keyColumns = localKey.getKeyColumns();
 			keyColumns.clear();
 			for (int selectionIndex : lstKeyColumns.getSelectionIndices()) {
-				ColumnModel columnModel = TableUtil.getColumns(tableModel).get(selectionIndex);
+				ColumnModel columnModel = tableModel.findColumns().get(selectionIndex);
 				keyColumns.add(factory.newReference(columnModel));
 			}
 		}

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -52,8 +52,6 @@
 import org.jiemamy.model.geometory.JmColor;
 import org.jiemamy.model.node.NodeAdapter;
 import org.jiemamy.utils.LogMarker;
-import org.jiemamy.utils.model.ColumnUtil;
-import org.jiemamy.utils.model.TableUtil;
 
 /**
  * テーブルモデルに対するDiagram用EditPart(コントローラ)。
@@ -152,7 +150,7 @@
 		
 		tableFigure.removeAllColumns();
 		
-		for (ColumnModel columnModel : TableUtil.getColumns(tableModel)) {
+		for (ColumnModel columnModel : tableModel.findColumns()) {
 			ColumnFigure[] columnFigure = createColumnFigure(columnModel);
 			tableFigure.add(columnFigure[0], columnFigure[1]);
 		}
@@ -174,7 +172,7 @@
 		nameLabel.setText(LabelStringUtil.getString(rootModel, columnModel, DisplayPlace.FIGURE));
 		typeLabel.setText(LabelStringUtil.getString(rootModel, columnModel.getDataType(), DisplayPlace.FIGURE));
 		
-		if (ColumnUtil.isPartOfPrimaryKeyColumns(columnModel)) {
+		if (columnModel.checkPrimaryKeyColumn()) {
 			nameLabel.setUnderline(true);
 			typeLabel.setUnderline(true);
 		}

Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -38,9 +38,7 @@
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.sql.Token;
-import org.jiemamy.utils.model.DataTypeUtil;
 import org.jiemamy.utils.model.KeyConstraintUtil;
-import org.jiemamy.utils.model.RootModelUtil;
 
 /**
  * UI表示用文字列を生成するユーティリティクラス。
@@ -63,7 +61,7 @@
 	public static String getString(RootModel rootModel, DataType dataType, DisplayPlace place) {
 		ReferenceResolver resolver = rootModel.getJiemamy().getReferenceResolver();
 		try {
-			Dialect dialect = RootModelUtil.getDialect(rootModel);
+			Dialect dialect = rootModel.findDialect();
 			List<Token> tokens = dialect.getDataTypeResolver().resolveDataType(dataType, resolver);
 			StringBuilder sb = new StringBuilder();
 			Token lastToken = null;
@@ -78,7 +76,7 @@
 			return sb.toString();
 		} catch (ClassNotFoundException e) {
 			logger.warn("Dialectのロスト", e);
-			return DataTypeUtil.toBuiltinDataType(dataType, resolver).getTypeName();
+			return dataType.toBuiltinDataType(resolver).getTypeName();
 		}
 	}
 	

Modified: metis/documents/trunk/src/test/java/org/jiemamy/documents/JiemamyTest.java
===================================================================
--- metis/documents/trunk/src/test/java/org/jiemamy/documents/JiemamyTest.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ metis/documents/trunk/src/test/java/org/jiemamy/documents/JiemamyTest.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -61,7 +61,7 @@
 		
 		RootModel rootModel = factory.getRootModel();
 		RootModelUtil.setDialect(rootModel, MySqlDialect.class);
-		Dialect dialect = RootModelUtil.getDialect(rootModel);
+		Dialect dialect = rootModel.findDialect();
 		
 		//@extract-start newDataType
 		BuiltinDataTypeMold mold = dialect.findDataTypeMold(DataTypeCategory.VARCHAR);
@@ -99,7 +99,7 @@
 		
 		// set Dialect to ues and get instance
 		RootModelUtil.setDialect(rootModel, MySqlDialect.class);
-		Dialect dialect = RootModelUtil.getDialect(rootModel);
+		Dialect dialect = rootModel.findDialect();
 		
 		// create TABLE and set name
 		TableModel tableModel = factory.newModel(TableModel.class);

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/RootModel.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -128,7 +128,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合
 	 */
-	<T extends EntityModel>Collection<T> getEntities(Class<T> clazz);
+	<T extends EntityModel>Collection<T> findEntities(Class<T> clazz);
 	
 	/**
 	 * 指定した名前を持つエンティティを取得する。

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java	2009-04-30 12:03:35 UTC (rev 3341)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/entity/TableModel.java	2009-04-30 14:43:06 UTC (rev 3342)
@@ -81,7 +81,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合
 	 */
-	<T extends AttributeModel>T getAttribute(Class<T> clazz);
+	<T extends AttributeModel>T findAttribute(Class<T> clazz);
 	
 	/**
 	 * 指定した型を持つ属性を取得する。
@@ -95,7 +95,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合
 	 */
-	<T extends AttributeModel>T getAttribute(Class<T> clazz, boolean columnAttr);
+	<T extends AttributeModel>T findAttribute(Class<T> clazz, boolean columnAttr);
 	
 	/**
 	 * 属性のリストを取得する。
@@ -119,7 +119,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合
 	 */
-	<T extends AttributeModel>List<T> getAttributes(Class<T> clazz);
+	<T extends AttributeModel>List<T> findAttributes(Class<T> clazz);
 	
 	/**
 	 * 指定した型を持つ属性のリストを取得する。
@@ -133,7 +133,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合
 	 */
-	<T extends AttributeModel>List<T> getAttributes(Class<T> clazz, boolean columnAttr);
+	<T extends AttributeModel>List<T> findAttributes(Class<T> clazz, boolean columnAttr);
 	
 	/**
 	 * 指定した名前を持つカラムを取得する。
@@ -145,7 +145,7 @@
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 * @throws UnsupportedOperationException 実装がこのメソッドをサポートしない場合
 	 */
-	ColumnModel getColumn(String columnName);
+	ColumnModel findColumn(String columnName);
 	
 	/**
 	 * インデックスのリストを取得する。



Jiemamy-notify メーリングリストの案内
アーカイブの一覧に戻る