[Jiemamy-notify:940] commit [2339] refactor

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 12月 31日 (水) 19:54:06 JST


Revision: 2339
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2339
Author:   daisuke_m
Date:     2008-12-31 19:54:05 +0900 (Wed, 31 Dec 2008)

Log Message:
-----------
refactor

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java
    artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java
    artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/Artemis.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/command/StaxCommandDestination.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediator.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediatorImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyMappingImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModelImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/index/IndexModelImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/IndexInfoMeta.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/KeyMeta.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/TableMeta.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java
    artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java
    artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java
    artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java
    artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/Jiemamy.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModel.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/node/TableModel.java

Added Paths:
-----------
    artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/
    artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/daisuke/
    artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/daisuke/Daisuke.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java

Removed Paths:
-------------
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/UpdateMappingsProcessor.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/BuiltinDataTypeBuilder.java


-------------- next part --------------
Modified: artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java
===================================================================
--- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/ApplicationModelCreator.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -28,7 +28,7 @@
 import org.jiemamy.model.node.StickyModel;
 import org.jiemamy.model.node.TableModel;
 import org.jiemamy.model.node.ViewModel;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 
 /**
  * アプリケーション用のモデルを生成するクラス。
@@ -75,14 +75,14 @@
 		// ドメインの生成
 		DomainModel idDomain = factory.newModel(DomainModel.class);
 		idDomain.setName("ID");
-		idDomain.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		idDomain.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		idDomain.setNotNull(true);
 		idDomain.getAdapter(SerialDataTypeAdapter.class).setSerial(true);
 		rootModel.appendDomain(idDomain);
 		
 		DomainModel nameDomain = factory.newModel(DomainModel.class);
 		nameDomain.setName("NAME");
-		nameDomain.setDataType(new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32).build());
+		nameDomain.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32).build());
 		nameDomain.setDescription("人名用の型です。");
 		rootModel.appendDomain(nameDomain);
 		
@@ -255,20 +255,20 @@
 		
 		ColumnModel noColumn = factory.newModel(ColumnModel.class);
 		noColumn.setName("DEPT_NO");
-		noColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		noColumn.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		noColumn.setLogicalName("部署番号");
 		deptTable.appendColumn(noColumn);
 		
 		ColumnModel deptNameColumn = factory.newModel(ColumnModel.class);
 		deptNameColumn.setName("DEPT_NAME");
-		deptNameColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
+		deptNameColumn.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
 		deptNameColumn.setLogicalName("部署名");
 		deptNameColumn.setRepresentation(true);
 		deptTable.appendColumn(deptNameColumn);
 		
 		ColumnModel locColumn = factory.newModel(ColumnModel.class);
 		locColumn.setName("LOC");
-		locColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
+		locColumn.setDataType(new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(20).build());
 		locColumn.setLogicalName("ロケーション");
 		locColumn.setDefaultValue("secret");
 		deptTable.appendColumn(locColumn);
@@ -483,7 +483,7 @@
 		
 		ColumnModel noColumn = factory.newModel(ColumnModel.class);
 		noColumn.setName("EMP_NO");
-		noColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		noColumn.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		noColumn.setNotNull(true);
 		noColumn.setLogicalName("従業員番号");
 		empTable.appendColumn(noColumn);
@@ -499,26 +499,26 @@
 		
 		ColumnModel mgrColumn = factory.newModel(ColumnModel.class);
 		mgrColumn.setName("MGR_ID");
-		mgrColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		mgrColumn.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		nameColumn.setLogicalName("上司ID");
 		empTable.appendColumn(mgrColumn);
 		
 		ColumnModel hireColumn = factory.newModel(ColumnModel.class);
 		hireColumn.setName("HIREDATE");
-		hireColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build());
+		hireColumn.setDataType(new DataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build());
 		hireColumn.setNotNull(true);
 		empTable.appendColumn(hireColumn);
 		
 		ColumnModel salColumn = factory.newModel(ColumnModel.class);
 		salColumn.setName("SAL");
-		salColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.NUMERIC, "NUMERIC").setScale(7).setPrecision(2)
+		salColumn.setDataType(new DataTypeBuilder(factory, Types.NUMERIC, "NUMERIC").setScale(7).setPrecision(2)
 			.build());
 		salColumn.setNotNull(true);
 		empTable.appendColumn(salColumn);
 		
 		ColumnModel deptColumn = factory.newModel(ColumnModel.class);
 		deptColumn.setName("DEPT_ID");
-		deptColumn.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		deptColumn.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		deptColumn.setNotNull(true);
 		empTable.appendColumn(deptColumn);
 		

Modified: artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java
===================================================================
--- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/artemis/test/ModelConsistenceTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -35,7 +35,7 @@
 import org.jiemamy.model.datatype.DataType;
 import org.jiemamy.model.node.TableModel;
 import org.jiemamy.model.node.ViewModel;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 import org.jiemamy.utils.builder.ColumnBuilder;
 import org.jiemamy.utils.builder.ForeignKeyBuilder;
 import org.jiemamy.utils.builder.TableBuilder;
@@ -104,8 +104,8 @@
 		factory1 = rootModel1.getFactory();
 		factory2 = rootModel1.getFactory();
 		
-		r1t1c1dataType = new BuiltinDataTypeBuilder(factory1, Types.INTEGER, "INTEGER").build();
-		r1t2c1dataType = new BuiltinDataTypeBuilder(factory1, Types.VARCHAR, "VARCHAR").build();
+		r1t1c1dataType = new DataTypeBuilder(factory1, Types.INTEGER, "INTEGER").build();
+		r1t2c1dataType = new DataTypeBuilder(factory1, Types.VARCHAR, "VARCHAR").build();
 		r1t1column = new ColumnBuilder(factory1, "column1", r1t1c1dataType).build();
 		r1t2column = new ColumnBuilder(factory1, "column2", r1t2c1dataType).build();
 		r1table1 = new TableBuilder(factory1, "table1").column(r1t1column).primaryKey(0).build();
@@ -119,8 +119,8 @@
 		rootModel1.appendNode(r1view2);
 		rootModel1.appendConnection(r1fk);
 		
-		r2t1c1dataType = new BuiltinDataTypeBuilder(factory2, Types.INTEGER, "INTEGER").build();
-		r2t2c1dataType = new BuiltinDataTypeBuilder(factory2, Types.VARCHAR, "VARCHAR").build();
+		r2t1c1dataType = new DataTypeBuilder(factory2, Types.INTEGER, "INTEGER").build();
+		r2t2c1dataType = new DataTypeBuilder(factory2, Types.VARCHAR, "VARCHAR").build();
 		r2t1column = new ColumnBuilder(factory2, "column1", r2t1c1dataType).build();
 		r2t2column = new ColumnBuilder(factory2, "column2", r2t2c1dataType).build();
 		r2table1 = new TableBuilder(factory2, "table1").column(r2t1column).build();

Added: artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/daisuke/Daisuke.java
===================================================================
--- artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/daisuke/Daisuke.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/daisuke/Daisuke.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/12/31
+ *
+ * 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.sandbox.daisuke;
+
+import java.sql.Types;
+import java.util.List;
+
+import org.junit.Test;
+
+import org.jiemamy.Jiemamy;
+import org.jiemamy.JiemamyFactory;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.sql.SqlStatement;
+import org.jiemamy.utils.builder.ColumnBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
+import org.jiemamy.utils.builder.TableBuilder;
+
+/**
+ * TODO for daisuke
+ * @author daisuke
+ */
+public class Daisuke {
+	
+	@Test
+	public void testname() throws Exception {
+		Jiemamy.init();
+		
+		RootModel rootModel = Jiemamy.newRootModel();
+		JiemamyFactory factory = rootModel.getFactory();
+		rootModel.setDialectId("org.jiemamy.dialect.postgresql.PostgresqlDialect");
+		rootModel.appendNode(new TableBuilder(factory, "T_USER").column(
+				new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build())
+					.build()).column(
+				new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(32)
+					.build()).build()).column(
+				new ColumnBuilder(factory, "PASSWORD", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(
+						32).build()).build()).primaryKey(0).build());
+		
+		List<SqlStatement> statements = Jiemamy.toStatements(rootModel);
+		
+		for (SqlStatement statement : statements) {
+			System.out.println(statement);
+		}
+		
+		/*
+		 * CREATE TABLE T_USER (
+		 *   ID INTEGER,
+		 *   NAME VARCHAR(32),
+		 *   PASSWORD VARCHAR(32),
+		 *   PRIMARY KEY (ID)
+		 * );
+		 */
+
+		Jiemamy.dispose();
+	}
+}


Property changes on: artemis/trunk/org.jiemamy.artemis.test/src/test/java/org/jiemamy/sandbox/daisuke/Daisuke.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF
===================================================================
--- artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF	2008-12-31 10:54:05 UTC (rev 2339)
@@ -174,13 +174,17 @@
  org.easymock.internal,
  org.easymock.internal.matchers,
  org.jiemamy,
+ org.jiemamy.command,
  org.jiemamy.dialect,
  org.jiemamy.dialect.generic,
  org.jiemamy.dialect.helper,
+ org.jiemamy.dialect.openjpa,
  org.jiemamy.dialect.test,
  org.jiemamy.dialect.validator,
  org.jiemamy.internal,
+ org.jiemamy.internal.command,
  org.jiemamy.internal.processor,
+ org.jiemamy.internal.serializer.stax,
  org.jiemamy.model,
  org.jiemamy.model.attribute,
  org.jiemamy.model.connection,
@@ -193,7 +197,9 @@
  org.jiemamy.model.sql,
  org.jiemamy.serializer,
  org.jiemamy.utils,
+ org.jiemamy.utils.builder,
  org.jiemamy.utils.debug,
+ org.jiemamy.utils.metadata,
  org.jiemamy.utils.swap,
  org.jiemamy.utils.visitor,
  org.jiemamy.utils.visitor.impl,

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/Artemis.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/Artemis.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/Artemis.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -55,6 +55,15 @@
 	/**
 	 * コンストラクタ。
 	 * 
+	 * @category instance creation
+	 */
+	public Artemis() {
+		this("jiemamy-core.dicon");
+	}
+	
+	/**
+	 * コンストラクタ。
+	 * 
 	 * <p>現在Artemis(JiemamyProjectによるJiemamy仕様の実装)が提供する仕様の範囲は以下の3つ。
 	 * コンストラクタに{@link ArtemisExtender}を指定することにより、これから扱う仕様の範囲が決定される。
 	 * {@link ArtemisExtender}を複数指定することも可能。</p>

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/command/StaxCommandDestination.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/command/StaxCommandDestination.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/command/StaxCommandDestination.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -40,6 +40,7 @@
 	/** {@link XMLEventFactory} */
 	static final XMLEventFactory EVENT_FACTORY = XMLEventFactory.newInstance();
 	
+	/** 出力用StAX {@link XMLEventWriter} */
 	private XMLEventWriter xmlWriter;
 	
 
@@ -99,6 +100,10 @@
 		}
 	}
 	
+	/**
+	 * 出力用StAX {@link XMLEventWriter}を取得する。
+	 * @return 出力用StAX {@link XMLEventWriter}
+	 */
 	public XMLEventWriter getXmlWriter() {
 		return xmlWriter;
 	}

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/dialect/openjpa/OpenJpaTableAdapter.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -91,7 +91,7 @@
 		for (ColumnModel c : jiemamyTable.getColumns()) {
 			result.add(c.getName());
 		}
-		return result.toArray(new String[0]);
+		return result.toArray(new String[result.size()]);
 	}
 	
 	@Override
@@ -100,7 +100,7 @@
 		for (ColumnModel c : jiemamyTable.getColumns()) {
 			result.add(new ColumnAdapter(c));
 		}
-		return result.toArray(new Column[0]);
+		return result.toArray(new Column[result.size()]);
 	}
 	
 	@Override

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediator.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediator.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediator.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -48,9 +48,11 @@
 	
 	/**
 	 * 子モデルを親モデルに所属させる。
+	 * 
 	 * @param <T> 親モデルの型
 	 * @param child 子モデル
 	 * @param parent 親モデル
+	 * @throws ModelConsistenceException 子モデルが既に親モデルを持っている場合
 	 */
 	<T>void append(AppropriativeChildOf<T> child, T parent);
 	

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediatorImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediatorImpl.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/ModelConsistenceMediatorImpl.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -34,7 +34,9 @@
 		if (child.getParent() != null) {
 			throw new ModelConsistenceException();
 		}
-		child.setParent(parent);
+		if (child.getParent() != parent) {
+			child.setParent(parent);
+		}
 	}
 	
 	/**

Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/UpdateMappingsProcessor.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/UpdateMappingsProcessor.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/internal/processor/UpdateMappingsProcessor.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -1,124 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/08/03
- *
- * 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.processor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.lang.Validate;
-
-import org.jiemamy.JiemamyFactory;
-import org.jiemamy.exception.ElementNotFoundException;
-import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.connection.ForeignKeyMapping;
-import org.jiemamy.model.connection.ForeignKeyMappingImpl;
-import org.jiemamy.model.connection.ForeignKeyModel;
-import org.jiemamy.model.node.TableModel;
-
-/**
- * 外部キーに指定されたマッピングを更新するプロセッサ。
- * @author daisuke
- */
-public class UpdateMappingsProcessor extends AbstractProcessor<ForeignKeyModel, Void, RuntimeException> {
-	
-	private JiemamyFactory factory;
-	
-	/** カラムを自動で新規に追加することを許すかどうか */
-	private boolean createColumnWithFk;
-	
-
-	/**
-	 * コンストラクタ。
-	 * @param factory 
-	 * @param createColumnWithFk 
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 * @category instance creation
-	 */
-	public UpdateMappingsProcessor(JiemamyFactory factory, boolean createColumnWithFk) {
-		Validate.notNull(factory);
-		this.factory = factory;
-		this.createColumnWithFk = createColumnWithFk;
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public Void process(ForeignKeyModel fkModel) {
-		Validate.notNull(fkModel);
-		Validate.notNull(fkModel.getSource());
-		Validate.notNull(fkModel.getTarget());
-		TableModel targetTable = (TableModel) fkModel.getTarget();
-		TableModel sourceTable = (TableModel) fkModel.getSource();
-		List<ColumnModel> targetPkColumns = targetTable.getPrimaryKey().getColumns();
-		
-		// 編集によって参照先テーブル(targetTable)のPKが削除されていた場合、
-		// そのmappingを削除する。
-		List<ForeignKeyMapping> removalMappings = new ArrayList<ForeignKeyMapping>(fkModel.getMappings().size());
-		for (ForeignKeyMapping mapping : fkModel.getMappings()) {
-			if (!targetPkColumns.contains(mapping.getReferenceColumn())) {
-				removalMappings.add(mapping);
-			}
-		}
-		fkModel.getMappings().removeAll(removalMappings);
-		
-		// 編集によって参照先テーブル(targetTable)のPKが追加されていた場合、
-		// そのmappingを新規作成する。
-		List<ForeignKeyMapping> additionalMappings = new ArrayList<ForeignKeyMapping>(targetPkColumns.size());
-		for (ColumnModel referencePkColumn : targetPkColumns) {
-			try {
-				fkModel.getMapping(referencePkColumn);
-			} catch (ElementNotFoundException e) {
-				ForeignKeyMapping mapping = factory.newModel(ForeignKeyMapping.class);
-				mapping.setReferenceColumn(referencePkColumn);
-				((ForeignKeyMappingImpl) mapping).setDefaultColumns(factory, sourceTable, referencePkColumn,
-						createColumnWithFk);
-				additionalMappings.add(mapping);
-			}
-		}
-		fkModel.getMappings().addAll(additionalMappings);
-		
-		// この時点で、targetのPK数とmapping数は同一であるはず。
-		assert targetPkColumns.size() == fkModel.getMappings().size();
-		
-		// mappinngの順序を、参照先テーブル(targetTable)のPKに合わせる。
-		for (int pkColumnIndex = 0; pkColumnIndex < targetPkColumns.size(); pkColumnIndex++) {
-			ColumnModel referencePkColumn = targetPkColumns.get(pkColumnIndex);
-			ForeignKeyMapping baseMapping = fkModel.getMapping(referencePkColumn);
-			if (fkModel.getMappings().indexOf(baseMapping) != pkColumnIndex) {
-				Collections.swap(fkModel.getMappings(), pkColumnIndex, pkColumnIndex + 1);
-			}
-		}
-		
-		// 編集によって、制約カラムが削除されていた場合、
-		// デフォルトのマッピングをする。
-		for (ForeignKeyMapping mapping : fkModel.getMappings()) {
-			if (sourceTable.getColumns().contains(mapping.getConstraintColumn())) {
-				// targetColumn @ sourceTableの名称変更に追従
-				if (mapping.getConstraintColumn().getName().equals(mapping.getConstraintColumn().getName()) == false) {
-					mapping.getConstraintColumn().setName(mapping.getConstraintColumn().getName());
-				}
-				continue;
-			}
-			((ForeignKeyMappingImpl) mapping).setDefaultColumns(factory, sourceTable, mapping.getReferenceColumn(),
-					createColumnWithFk);
-		}
-		return null;
-	}
-}

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyMappingImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyMappingImpl.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyMappingImpl.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -104,7 +104,11 @@
 	}
 	
 	/**
-	 * {@inheritDoc}
+	 * TODO for daisuke
+	 * @param factory 
+	 * @param sourceTable 
+	 * @param referencePkColumn 
+	 * @param createColumnWithFk 
 	 */
 	public void setDefaultColumns(JiemamyFactory factory, TableModel sourceTable, ColumnModel referencePkColumn,
 			boolean createColumnWithFk) {

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModelImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModelImpl.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModelImpl.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -31,7 +31,6 @@
 import org.jiemamy.JiemamyFactory;
 import org.jiemamy.internal.processor.GetMappingProcessor;
 import org.jiemamy.internal.processor.ProvideForeignKeyNameProcessor;
-import org.jiemamy.internal.processor.UpdateMappingsProcessor;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.node.TableModel;
@@ -278,13 +277,6 @@
 		this.onUpdate = onUpdate;
 	}
 	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void updateMappings(JiemamyFactory factory, boolean createColumnWithFk) {
-		ProcessorUtil.process(this, new UpdateMappingsProcessor(factory, createColumnWithFk));
-	}
-	
 	synchronized void careMappings(boolean createColumn) {
 		// TODO extract to processor
 		List<ForeignKeyMapping> oldMappings = new ArrayList<ForeignKeyMapping>(mappings);

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/index/IndexModelImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/index/IndexModelImpl.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/model/index/IndexModelImpl.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -26,8 +26,8 @@
 import org.apache.commons.lang.builder.ToStringStyle;
 import org.seasar.framework.container.annotation.tiger.Binding;
 
+import org.jiemamy.internal.ModelConsistenceMediator;
 import org.jiemamy.internal.AdapterManager;
-import org.jiemamy.internal.ModelConsistenceMediator;
 import org.jiemamy.model.AppropriativeChildOf;
 import org.jiemamy.model.node.TableModel;
 

Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/BuiltinDataTypeBuilder.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/BuiltinDataTypeBuilder.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/BuiltinDataTypeBuilder.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -1,89 +0,0 @@
-/*
- * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
- * Created on 2008/12/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.utils.builder;
-
-import org.apache.commons.lang.Validate;
-
-import org.jiemamy.JiemamyFactory;
-import org.jiemamy.model.datatype.BuiltinDataType;
-import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter;
-import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
-import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
-
-/**
- * {@link BuiltinDataType}を生成するビルダ。
- * @author daisuke
- */
-public class BuiltinDataTypeBuilder extends ModelBuilder<BuiltinDataType> {
-	
-	/**
-	 * コンストラクタ。
-	 * @param factory
-	 * @param sqlType 
-	 * @param typeName 
-	 * @category instance creation
-	 */
-	public BuiltinDataTypeBuilder(JiemamyFactory factory, int sqlType, String typeName) {
-		super(factory, BuiltinDataType.class);
-		Validate.notNull(typeName);
-		model.setSqlType(sqlType);
-		model.setTypeName(typeName);
-	}
-	
-	/**
-	 * 精度を設定する。
-	 * @param precision 精度
-	 * @return this
-	 */
-	public BuiltinDataTypeBuilder setPrecision(int precision) {
-		model.getAdapter(PrecisionedDataTypeAdapter.class).setPrecision(precision);
-		return this;
-	}
-	
-	/**
-	 * スケールを設定する。
-	 * @param scale スケール
-	 * @return this
-	 */
-	public BuiltinDataTypeBuilder setScale(int scale) {
-		model.getAdapter(PrecisionedDataTypeAdapter.class).setScale(scale);
-		return this;
-	}
-	
-	/**
-	 * 自動採番型かどうかを設定する。
-	 * @param serial 自動採番であれば{@code true}
-	 * @return this
-	 */
-	public BuiltinDataTypeBuilder setSerial(boolean serial) {
-		model.getAdapter(SerialDataTypeAdapter.class).setSerial(serial);
-		return this;
-	}
-	
-	/**
-	 * サイズを設定する。
-	 * @param size サイズ
-	 * @return this
-	 */
-	public BuiltinDataTypeBuilder setSize(int size) {
-		model.getAdapter(SizedDataTypeAdapter.class).setSize(size);
-		return this;
-	}
-	
-}

Copied: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java (from rev 2338, artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/BuiltinDataTypeBuilder.java)
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java	                        (rev 0)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others.
+ * Created on 2008/12/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.utils.builder;
+
+import org.apache.commons.lang.Validate;
+
+import org.jiemamy.JiemamyFactory;
+import org.jiemamy.model.datatype.BuiltinDataType;
+import org.jiemamy.model.datatype.adapter.PrecisionedDataTypeAdapter;
+import org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter;
+import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
+
+/**
+ * {@link BuiltinDataType}を生成するビルダ。
+ * @author daisuke
+ */
+public class DataTypeBuilder extends ModelBuilder<BuiltinDataType> {
+	
+	/**
+	 * コンストラクタ。
+	 * @param factory
+	 * @param sqlType 
+	 * @param typeName 
+	 * @category instance creation
+	 */
+	public DataTypeBuilder(JiemamyFactory factory, int sqlType, String typeName) {
+		super(factory, BuiltinDataType.class);
+		Validate.notNull(typeName);
+		model.setSqlType(sqlType);
+		model.setTypeName(typeName);
+	}
+	
+	/**
+	 * 精度を設定する。
+	 * @param precision 精度
+	 * @return this
+	 */
+	public DataTypeBuilder setPrecision(int precision) {
+		model.getAdapter(PrecisionedDataTypeAdapter.class).setPrecision(precision);
+		return this;
+	}
+	
+	/**
+	 * スケールを設定する。
+	 * @param scale スケール
+	 * @return this
+	 */
+	public DataTypeBuilder setScale(int scale) {
+		model.getAdapter(PrecisionedDataTypeAdapter.class).setScale(scale);
+		return this;
+	}
+	
+	/**
+	 * 自動採番型かどうかを設定する。
+	 * @param serial 自動採番であれば{@code true}
+	 * @return this
+	 */
+	public DataTypeBuilder setSerial(boolean serial) {
+		model.getAdapter(SerialDataTypeAdapter.class).setSerial(serial);
+		return this;
+	}
+	
+	/**
+	 * サイズを設定する。
+	 * @param size サイズ
+	 * @return this
+	 */
+	public DataTypeBuilder setSize(int size) {
+		model.getAdapter(SizedDataTypeAdapter.class).setSize(size);
+		return this;
+	}
+	
+}


Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/builder/DataTypeBuilder.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/IndexInfoMeta.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/IndexInfoMeta.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/IndexInfoMeta.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -63,7 +63,7 @@
 	 * column sort sequence, "A" => ascending, "D" => descending,
 	 * may be null if sort sequence is not supported; null when TYPE is tableIndexStatistic
 	 */
-	public final String ascOrDesc;
+	public final SortSequence ascOrDesc;
 	
 	/**
 	 * When TYPE is tableIndexStatistic, then this is the number of rows in the table; otherwise,
@@ -99,7 +99,7 @@
 		type = IndexType.getIndexType(indexInfo.getShort("TYPE"));
 		ordinalPosition = indexInfo.getShort("ORDINAL_POSITION");
 		columnName = indexInfo.getString("COLUMN_NAME");
-		ascOrDesc = indexInfo.getString("ASC_OR_DESC");
+		ascOrDesc = SortSequence.getSortSequence(indexInfo.getString("ASC_OR_DESC"));
 		cardinality = indexInfo.getInt("CARDINALITY");
 		pages = indexInfo.getInt("PAGES");
 		filterCondition = indexInfo.getString("FILTER_CONDITION");

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/KeyMeta.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/KeyMeta.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/KeyMeta.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -27,8 +27,8 @@
 import org.apache.commons.lang.builder.ToStringStyle;
 
 /**
- * {@link DatabaseMetaData#getExportedKeys(String, String, String)}, {@link DatabaseMetaData#getImportedKeys(String, String, String)}
- * の結果の一つを表す値クラス。
+ * {@link DatabaseMetaData#getExportedKeys(String, String, String)},
+ * {@link DatabaseMetaData#getImportedKeys(String, String, String)}の結果の一つを表す値クラス。
  * @author daisuke
  */
 public class KeyMeta {

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/TableMeta.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/TableMeta.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/utils/metadata/TableMeta.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -106,7 +106,14 @@
 	 * @author daisuke
 	 */
 	public enum RefGeneration {
-		SYSTEM, USER, DERIVED
+		/** TODO for daisuke */
+		SYSTEM,
+
+		/** TODO for daisuke */
+		USER,
+
+		/** TODO for daisuke */
+		DERIVED
 	}
 	
 }

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/RootModelImplTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -40,7 +40,7 @@
 import org.jiemamy.model.dataset.InsertDataSetModel;
 import org.jiemamy.model.datatype.DomainModel;
 import org.jiemamy.model.node.TableModel;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 
 /**
  * {@link RootModelImpl}のテストクラス。
@@ -153,7 +153,7 @@
 		
 		DomainModel domain = factory.newModel(DomainModel.class);
 		domain.setName("a");
-		domain.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		domain.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		rootModel.appendDomain(domain);
 		rootModel.appendNode(source);
 		rootModel.appendNode(target);
@@ -201,10 +201,10 @@
 		// モデル構築
 		DomainModel domain1 = factory.newModel(DomainModel.class);
 		domain1.setName("domain1");
-		domain1.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		domain1.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		DomainModel domain2 = factory.newModel(DomainModel.class);
 		domain2.setName("domain2");
-		domain2.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		domain2.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		
 		rootModel.appendDomain(domain1);
 		

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/model/node/TableModelImplTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -41,7 +41,7 @@
 import org.jiemamy.model.connection.ForeignKeyModel;
 import org.jiemamy.model.constraint.CheckConstraintModel;
 import org.jiemamy.model.index.IndexModel;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 
 /**
  * {@link TableModelImpl}のテストクラス。
@@ -157,10 +157,10 @@
 	public void test03_appendModelとremoveModel経由で各種モデルが追加削除できること() throws Exception {
 		ColumnModel column1 = factory.newModel(ColumnModel.class);
 		column1.setName("col1");
-		column1.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column1.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		ColumnModel column2 = factory.newModel(ColumnModel.class);
 		column2.setName("col2");
-		column2.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column2.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		tableModel.appendColumn(column1);
 		tableModel.appendColumn(column2);
 		
@@ -207,11 +207,11 @@
 	public void test04_モデルIDの一致により他フィールドの内容に関わらずequalsがtrueとなる() throws Exception {
 		ColumnModel column1 = factory.newModel(ColumnModel.class);
 		column1.setName("column1");
-		column1.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column1.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		
 		ColumnModel column2 = factory.newModel(ColumnModel.class);
 		column2.setName("column2");
-		column2.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column2.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		
 		ColumnModel column3 = factory.newModel(ColumnModel.class, column1.getId());
 		
@@ -229,10 +229,10 @@
 	public void test08_RootModelからのクローニングが適切に行われること() throws Exception {
 		ColumnModel column1 = factory.newModel(ColumnModel.class);
 		column1.setName("column1");
-		column1.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column1.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		ColumnModel column2 = factory.newModel(ColumnModel.class);
 		column2.setName("column2");
-		column2.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		column2.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		
 		tableModel.appendColumn(column1);
 		

Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/utils/builder/ModelBuilderTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -176,23 +176,23 @@
 		
 		// EMPテーブルのビルド
 		rootModel.appendNode(new TableBuilder(factory, "T_EMP").column(
-				new ColumnBuilder(factory, "ID", new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER")
+				new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER")
 					.setSerial(true).build()).build()).column(
-				new ColumnBuilder(factory, "NAME", new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
+				new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
 					.setSize(32).build()).build()).column(
-				new ColumnBuilder(factory, "DEPT_ID", new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER")
+				new ColumnBuilder(factory, "DEPT_ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER")
 					.build()).build()).column(
 				new ColumnBuilder(factory, "HIREDATE",
-						new BuiltinDataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build()).build()).primaryKey(
+						new DataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build()).build()).primaryKey(
 				0).build());
 		
 		// DEPTテーブルのビルド
 		rootModel.appendNode(new TableBuilder(factory, "T_DEPT").column(
-				new ColumnBuilder(factory, "ID", new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER")
+				new ColumnBuilder(factory, "ID", new DataTypeBuilder(factory, Types.INTEGER, "INTEGER")
 					.setSerial(true).build()).build()).column(
-				new ColumnBuilder(factory, "NAME", new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
+				new ColumnBuilder(factory, "NAME", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
 					.setSize(32).build()).build()).column(
-				new ColumnBuilder(factory, "LOCATION", new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
+				new ColumnBuilder(factory, "LOCATION", new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR")
 					.setSize(16).build()).build()).primaryKey(0).build());
 		
 		// 外部キーの設定

Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java
===================================================================
--- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/model/RootModelEventTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -43,7 +43,7 @@
 import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.node.TableModel;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 
 /**
  * RootModel用のイベント系テスト
@@ -98,7 +98,7 @@
 		TableModel tableModel = rootModel.getEntity(TableModel.class, "T_USER01");
 		ColumnModel columnModel = factory.newModel(ColumnModel.class);
 		columnModel.setName("COL1");
-		columnModel.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		columnModel.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		
 		assertThat(tableModel, is(notNullValue()));
 		assertThat(columnModel, is(notNullValue()));
@@ -159,7 +159,7 @@
 		rootModel.appendNode(table2);
 		ColumnModel columnModel = factory.newModel(ColumnModel.class);
 		columnModel.setName("COL1");
-		columnModel.setDataType(new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
+		columnModel.setDataType(new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build());
 		table1.appendColumn(columnModel);
 		
 		// rootModelの監視を開始する。

Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java
===================================================================
--- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableListTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -46,7 +46,7 @@
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.datatype.DataType;
 import org.jiemamy.utils.ObservableList;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 
 /**
  * {@link ObservableList}のテストクラス。
@@ -67,15 +67,15 @@
 		Object[][] columnDatas = {
 			{
 				"ID",
-				new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build()
+				new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build()
 			},
 			{
 				"NAME",
-				new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(100).build()
+				new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(100).build()
 			},
 			{
 				"TIMESTAMP",
-				new BuiltinDataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build()
+				new DataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build()
 			}
 		};
 		ColumnModel[] columnModels = new ColumnModel[columnDatas.length];

Modified: artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java
===================================================================
--- artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ artemis/trunk/org.jiemamy.event/src/test/java/org/jiemamy/util/ObservableMapTest.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -43,7 +43,7 @@
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.datatype.DataType;
 import org.jiemamy.utils.ObservableMap;
-import org.jiemamy.utils.builder.BuiltinDataTypeBuilder;
+import org.jiemamy.utils.builder.DataTypeBuilder;
 
 /**
  * {@link ObservableMap}のテストクラス。
@@ -61,15 +61,15 @@
 		Object[][] columnDatas = {
 			{
 				"ID",
-				new BuiltinDataTypeBuilder(factory, Types.INTEGER, "INTEGER").build()
+				new DataTypeBuilder(factory, Types.INTEGER, "INTEGER").build()
 			},
 			{
 				"NAME",
-				new BuiltinDataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(100).build()
+				new DataTypeBuilder(factory, Types.VARCHAR, "VARCHAR").setSize(100).build()
 			},
 			{
 				"TIMESTAMP",
-				new BuiltinDataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build()
+				new DataTypeBuilder(factory, Types.TIMESTAMP, "TIMESTAMP").build()
 			}
 		};
 		ColumnModel[] columnModels = new ColumnModel[columnDatas.length];

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -29,11 +29,9 @@
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Display;
 
-import org.jiemamy.eclipse.JiemamyPlugin;
 import org.jiemamy.eclipse.editor.editpart.DoubleClickSupport;
 import org.jiemamy.eclipse.editor.editpart.EditDialogSupport;
 import org.jiemamy.eclipse.editor.extraprocessor.LabelStringProcessor;
-import org.jiemamy.eclipse.preference.JiemamyPreference;
 import org.jiemamy.event.ModelChangeEvent;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.connection.ForeignKeyMapping;
@@ -63,21 +61,20 @@
 	public void modelChanged(ModelChangeEvent evt) {
 		super.modelChanged(evt);
 		
-		if (evt.getSource().equals(getModel())) {
+//		if (evt.getSource().equals(getModel())) {
 //			if (evt.getField().equals(ForeignKeyModel.P_CREATE)) {
 //				openEditDialog();
 //				updateLabel();
 //			} else if (evt.getField().equals(ForeignKeyModel.P_RELATION_FK_MAPPING)) {
-			updateLabel();
+//			updateLabel();
 //			}
-		} else {
+//		} else {
 //			if (evt.getField().equals(TableModel.P_ENTITY_TABLE_COLUMNS)) {
-			updateMapping();
-			updateLabel();
+//			updateLabel();
 //			} else if (evt.getField().equals(DatabaseModel.P_DB_DISPLAY_MODE)) {
-//				updateLabel();
+		updateLabel();
 //			}
-		}
+//		}
 	}
 	
 	/**
@@ -142,13 +139,4 @@
 		String labelString = ProcessorUtil.process(rootModel, new LabelStringProcessor(mappings));
 		label.setText(labelString);
 	}
-	
-	private void updateMapping() {
-		RootModel rootModel = (RootModel) getRoot().getContents().getModel();
-		JiemamyPreference pref = JiemamyPlugin.getPreference();
-		
-		ForeignKeyModel fkModel = (ForeignKeyModel) getModel();
-		fkModel.updateMappings(rootModel.getFactory(), pref.isCreateColumnWithFk());
-	}
-	
 }

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/Jiemamy.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/Jiemamy.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/Jiemamy.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -25,6 +25,7 @@
 
 import org.jiemamy.dialect.Dialect;
 import org.jiemamy.exception.IllegalImplementationException;
+import org.jiemamy.exception.JiemamyRuntimeException;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.sql.SqlStatement;
 import org.jiemamy.utils.Identifiable;
@@ -73,6 +74,24 @@
 	}
 	
 	/**
+	 * JiemamyをArtemis実装によって初期化する。
+	 * @throws JiemamyRuntimeException Artemis実装が見つからない、もしくは不正である場合
+	 */
+	public static void init() {
+		try {
+			Class<?> artemisClass = Class.forName("org.jiemamy.Artemis");
+			JiemamyImplementation implementation = (JiemamyImplementation) artemisClass.newInstance();
+			init(implementation);
+		} catch (ClassNotFoundException e) {
+			throw new JiemamyRuntimeException("Jiemamy Artemis implementation not found.", e);
+		} catch (InstantiationException e) {
+			throw new JiemamyRuntimeException("Illegal Jiemamy Artemis implementation.", e);
+		} catch (IllegalAccessException e) {
+			throw new JiemamyRuntimeException("Illegal Jiemamy Artemis implementation.", e);
+		}
+	}
+	
+	/**
 	 * Jiemamyを初期化する。
 	 * 
 	 * <p>与える{@link JiemamyImplementation}によって、これから使用する実装の種類及び、

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModel.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModel.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/connection/ForeignKeyModel.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -20,7 +20,6 @@
 
 import java.util.List;
 
-import org.jiemamy.JiemamyFactory;
 import org.jiemamy.exception.ElementNotFoundException;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
@@ -154,15 +153,6 @@
 	 */
 	void setOnUpdate(ReferentialAction onUpdate);
 	
-	/**
-	 * 外部キーのアップデート。
-	 * 
-	 * FIXME 本来、ColumnModelの変更に伴い自動で行われるべき。要修正。
-	 * @param factory 
-	 * @param createColumnWithFk
-	 */
-	void updateMappings(JiemamyFactory factory, boolean createColumnWithFk);
-	
 
 	/**
 	 * 制約検査を行うデフォルトの時期。

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/node/TableModel.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/node/TableModel.java	2008-12-31 08:44:44 UTC (rev 2338)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/model/node/TableModel.java	2008-12-31 10:54:05 UTC (rev 2339)
@@ -55,6 +55,10 @@
 	 */
 	void appendIndex(IndexModel index);
 	
+	/**
+	 * UNIQUE制約を追加する。
+	 * @param unique UNIQUE制約
+	 */
 	void appendUnique(UniqueConstraintModel unique);
 	
 	/**
@@ -111,6 +115,10 @@
 	 */
 	void removeIndex(IndexModel index);
 	
+	/**
+	 * UNIQUE制約を削除する。
+	 * @param unique UNIQUE制約
+	 */
 	void removeUnique(UniqueConstraintModel unique);
 	
 	/**


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