[Jiemamy-notify:1460] commit [2687] 制約モデルをカラム制約とテーブル制約に分離。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 19日 (木) 00:39:26 JST


Revision: 2687
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2687
Author:   daisuke_m
Date:     2009-02-19 00:39:26 +0900 (Thu, 19 Feb 2009)

Log Message:
-----------
制約モデルをカラム制約とテーブル制約に分離。
カラムが制約を持てるようになった。
そして、NotNullはカラムにしか持てないようになった。

Modified Paths:
--------------
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DisablableImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DomainUtil.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/AbstractTraversalValidator.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ColumnValidator.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java
    artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java
    artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/ArtemisViewTest.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyProperty.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ConstraintModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/KeyConstraintModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/LocalKeyModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Disablable.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java
    zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd
    zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml

Added Paths:
-----------
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModelImpl.java
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModelImpl.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnConstraint.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModel.java
    zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableConstraint.java

Removed Paths:
-------------
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/CheckConstraintModelImpl.java


-------------- next part --------------
Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/FactoryExtension.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -38,8 +38,9 @@
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.ColumnRefImpl;
 import org.jiemamy.model.attribute.RepresentationAdapter;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModelImpl;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModelImpl;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.DeferrabilityImpl;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
@@ -48,9 +49,10 @@
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModelImpl;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModelImpl;
+import org.jiemamy.model.attribute.constraint.TableCheckModelImpl;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModelImpl;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.dataset.DataSetModelImpl;
 import org.jiemamy.model.dataset.RecordModel;
@@ -244,6 +246,7 @@
 			@Override
 			public <T>T newInstance(Jiemamy jiemamy, UUID id) {
 				ColumnModelImpl columnModel = new ColumnModelImpl(jiemamy, id);
+				columnModel.setColumnConstraints(new ArrayList<ColumnConstraint>());
 				columnModel.registerAdapter(new RepresentationAdapter());
 				columnModel.registerAdapter(new DisablableImpl());
 				return (T) columnModel;
@@ -293,16 +296,26 @@
 			}
 		},
 		/***/
-		CHECK(CheckConstraintModel.class) {
+		TABLE_CHECK(TableCheckModel.class) {
 			
 			@Override
 			public <T>T newInstance(Jiemamy jiemamy, UUID id) {
-				CheckConstraintModelImpl checkModel = new CheckConstraintModelImpl(jiemamy, id);
+				TableCheckModelImpl checkModel = new TableCheckModelImpl(jiemamy, id);
 				checkModel.registerAdapter(new DisablableImpl());
 				return (T) checkModel;
 			}
 		},
 		/***/
+		COLUMN_CHECK(ColumnCheckModel.class) {
+			
+			@Override
+			public <T>T newInstance(Jiemamy jiemamy, UUID id) {
+				ColumnCheckModelImpl checkModel = new ColumnCheckModelImpl(jiemamy, id);
+				checkModel.registerAdapter(new DisablableImpl());
+				return (T) checkModel;
+			}
+		},
+		/***/
 		NOT_NULL(NotNullConstraintModel.class) {
 			
 			@Override
@@ -318,7 +331,7 @@
 			@Override
 			public <T>T newInstance(Jiemamy jiemamy, UUID id) {
 				DomainModelImpl domainModel = new DomainModelImpl(jiemamy, id);
-				domainModel.setConstraints(new ArrayList<ValueConstraintModel>());
+				domainModel.setConstraints(new ArrayList<ColumnConstraint>());
 				return (T) domainModel;
 			}
 		},

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/AbstractDialect.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -199,8 +199,7 @@
 					
 					if ("NO".equals(isNullable) == false) {
 						NotNullConstraintModel notNullConstraintModel = factory.newModel(NotNullConstraintModel.class);
-						notNullConstraintModel.setColumn(factory.newReference(column));
-						tableModel.getAttributes().add(notNullConstraintModel);
+						column.getConstraints().add(notNullConstraintModel);
 					}
 					
 					finalResult.add(column);

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/DefaultSqlEmitter.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -28,11 +28,13 @@
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.ConstraintModel;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.LiteralType;
@@ -42,7 +44,6 @@
 import org.jiemamy.model.sql.Identifier;
 import org.jiemamy.model.sql.Keyword;
 import org.jiemamy.model.sql.Literal;
-import org.jiemamy.model.sql.Operator;
 import org.jiemamy.model.sql.Separator;
 import org.jiemamy.model.sql.SqlStatement;
 import org.jiemamy.model.sql.SqlStatementImpl;
@@ -154,6 +155,18 @@
 				List<Token> tokens = CollectionsUtil.newArrayList();
 				tokens.add(new Identifier(columnModel.getName()));
 				tokens.addAll(dataTypeResolver.resolveDataType(columnModel.getDataType(), referenceResolver));
+				
+				for (ColumnConstraint columnConstraint : columnModel.getConstraints()) {
+					if (columnConstraint instanceof NotNullConstraintModel) {
+						if (StringUtils.isEmpty(columnConstraint.getName()) == false) {
+							tokens.add(Keyword.CONSTRAINT);
+							tokens.add(new Identifier(columnConstraint.getName()));
+							tokens.add(Keyword.NOT);
+							tokens.add(Keyword.NULL);
+						}
+					}
+				}
+				
 				if (StringUtils.isEmpty(columnModel.getDefaultValue()) == false) {
 					BuiltinDataType builtinDataType =
 							DataTypeUtil.toBuiltinDataType(columnModel.getDataType(), referenceResolver);
@@ -244,31 +257,31 @@
 			}
 		},
 		
-		/** NOT NULL制約の出力戦略 */
-		NN(NotNullConstraintModel.class) {
-			
-			@Override
-			public List<Token> emit(AttributeModel attributeModel, DataTypeResolver dataTypeResolver,
-					ReferenceResolver referenceResolver, TokenResolver tokenResolver) {
-				NotNullConstraintModel nnModel = (NotNullConstraintModel) attributeModel;
-				List<Token> tokens = CollectionsUtil.newArrayList();
-				addConstraintNameDefinition(nnModel, tokens);
-				tokens.add(Keyword.CHECK);
-				tokens.add(Separator.LEFT_PAREN);
-				
-				ColumnModel columnModel = referenceResolver.resolve(nnModel.getColumn());
-				tokens.add(new Identifier(columnModel.getName()));
-				
-				tokens.add(Operator.IS);
-				tokens.add(Operator.NOT);
-				tokens.add(Literal.NULL);
-				tokens.add(Separator.RIGHT_PAREN);
-				return tokens;
-			}
-		},
+//		/** NOT NULL制約の出力戦略 */
+//		NN(NotNullConstraintModel.class) {
+//			
+//			@Override
+//			public List<Token> emit(AttributeModel attributeModel, DataTypeResolver dataTypeResolver,
+//					ReferenceResolver referenceResolver, TokenResolver tokenResolver) {
+//				NotNullConstraintModel nnModel = (NotNullConstraintModel) attributeModel;
+//				List<Token> tokens = CollectionsUtil.newArrayList();
+//				addConstraintNameDefinition(nnModel, tokens);
+//				tokens.add(Keyword.CHECK);
+//				tokens.add(Separator.LEFT_PAREN);
+//				
+//				ColumnModel columnModel = referenceResolver.resolve(nnModel.getColumn());
+//				tokens.add(new Identifier(columnModel.getName()));
+//				
+//				tokens.add(Operator.IS);
+//				tokens.add(Operator.NOT);
+//				tokens.add(Literal.NULL);
+//				tokens.add(Separator.RIGHT_PAREN);
+//				return tokens;
+//			}
+//		},
 		
 		/** CHECK制約の出力戦略 */
-		CHECK(CheckConstraintModel.class) {
+		TABLE_CHECK(TableCheckModel.class) {
 			
 			@Override
 			public List<Token> emit(AttributeModel attributeModel, DataTypeResolver dataTypeResolver,

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -18,13 +18,16 @@
  */
 package org.jiemamy.model.attribute;
 
+import java.util.Collection;
 import java.util.UUID;
 
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.ToStringStyle;
 
 import org.jiemamy.Jiemamy;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.datatype.DataType;
+import org.jiemamy.utils.ValidateUtil;
 
 /**
  * カラム定義モデル。Artemisにおける{@link ColumnModel}の実装クラス。
@@ -39,6 +42,9 @@
 	/** デフォルト値 */
 	private String defaultValue;
 	
+	/** カラム制約の集合 */
+	private Collection<ColumnConstraint> constraints;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -53,6 +59,13 @@
 	/**
 	 * {@inheritDoc}
 	 */
+	public Collection<ColumnConstraint> getConstraints() {
+		return constraints;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
 	public synchronized DataType getDataType() {
 		return dataType;
 	}
@@ -65,9 +78,18 @@
 	}
 	
 	/**
+	 * TODO for daisuke
+	 * @param columnConstraints the columnConstraints to set
+	 */
+	public void setColumnConstraints(Collection<ColumnConstraint> columnConstraints) {
+		ValidateUtil.injectionSetter(this.constraints);
+		this.constraints = columnConstraints;
+	}
+	
+	/**
 	 * {@inheritDoc}
 	 */
-	public void setDataType(DataType dataType) {
+	public synchronized void setDataType(DataType dataType) {
 		this.dataType = dataType;
 	}
 	

Deleted: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/CheckConstraintModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/CheckConstraintModelImpl.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/CheckConstraintModelImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -1,68 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/06/09
- *
- * This file is part of Jiemamy-core.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-package org.jiemamy.model.attribute.constraint;
-
-import java.util.UUID;
-
-import org.jiemamy.Jiemamy;
-
-/**
- * チェック制約モデル。
- * 
- * @author daisuke
- */
- @ SuppressWarnings("serial")
-public class CheckConstraintModelImpl extends AbstractConstraintModel implements CheckConstraintModel {
-	
-	/** CHEKC制約定義式 */
-	private String expression;
-	
-
-	/**
-	 * インスタンスを生成する。
-	 * @param jiemamy
-	 * @param id 
-	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
-	 */
-	public CheckConstraintModelImpl(Jiemamy jiemamy, UUID id) {
-		super(jiemamy, id);
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public String getExpression() {
-		return expression;
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void setExpression(String expression) {
-		this.expression = expression;
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public String toString() {
-		return super.toString() + "[" + expression + "]";
-	}
-}

Added: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModelImpl.java	                        (rev 0)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModelImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2008/06/09
+ *
+ * This file is part of Jiemamy-core.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.model.attribute.constraint;
+
+import java.util.UUID;
+
+import org.jiemamy.Jiemamy;
+
+/**
+ * チェック制約モデル。
+ * 
+ * @author daisuke
+ */
+public class ColumnCheckModelImpl extends AbstractConstraintModel implements ColumnCheckModel {
+	
+	/** CHEKC制約定義式 */
+	private String expression;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * @param jiemamy
+	 * @param id 
+	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
+	 */
+	public ColumnCheckModelImpl(Jiemamy jiemamy, UUID id) {
+		super(jiemamy, id);
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public String getExpression() {
+		return expression;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void setExpression(String expression) {
+		this.expression = expression;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public String toString() {
+		return super.toString() + "[" + expression + "]";
+	}
+}


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

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModelImpl.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModelImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -21,7 +21,6 @@
 import java.util.UUID;
 
 import org.jiemamy.Jiemamy;
-import org.jiemamy.model.attribute.ColumnRef;
 
 /**
  * NOT NULL制約モデル。
@@ -30,9 +29,6 @@
  */
 public class NotNullConstraintModelImpl extends AbstractConstraintModel implements NotNullConstraintModel {
 	
-	private ColumnRef column;
-	
-
 	/**
 	 * インスタンスを生成する。
 	 * 
@@ -42,19 +38,4 @@
 	public NotNullConstraintModelImpl(Jiemamy jiemamy, UUID id) {
 		super(jiemamy, id);
 	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public ColumnRef getColumn() {
-		return column;
-	}
-	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void setColumn(ColumnRef column) {
-		this.column = column;
-		
-	}
 }

Copied: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModelImpl.java (from rev 2684, artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/CheckConstraintModelImpl.java)
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModelImpl.java	                        (rev 0)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModelImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2008/06/09
+ *
+ * This file is part of Jiemamy-core.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.model.attribute.constraint;
+
+import java.util.UUID;
+
+import org.jiemamy.Jiemamy;
+
+/**
+ * チェック制約モデル。
+ * 
+ * @author daisuke
+ */
+ @ SuppressWarnings("serial")
+public class TableCheckModelImpl extends AbstractConstraintModel implements TableCheckModel {
+	
+	/** CHEKC制約定義式 */
+	private String expression;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * @param jiemamy
+	 * @param id 
+	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
+	 */
+	public TableCheckModelImpl(Jiemamy jiemamy, UUID id) {
+		super(jiemamy, id);
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public String getExpression() {
+		return expression;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	public void setExpression(String expression) {
+		this.expression = expression;
+	}
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public String toString() {
+		return super.toString() + "[" + expression + "]";
+	}
+}


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

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -25,14 +25,13 @@
 
 import org.jiemamy.Jiemamy;
 import org.jiemamy.model.AbstractJiemamyElement;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 
 /**
  * ドメイン定義モデル。
  * 
  * @author daisuke
  */
- @ SuppressWarnings("serial")
 public class DomainModelImpl extends AbstractJiemamyElement implements DomainModel {
 	
 	/** ドメイン名 */
@@ -45,7 +44,7 @@
 	private BuiltinDataType dataType;
 	
 	/** 制約のリスト */
-	private List<ValueConstraintModel> constraints;
+	private List<ColumnConstraint> constraints;
 	
 	/** 説明文 */
 	private String description;
@@ -87,7 +86,7 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public List<ValueConstraintModel> getConstraints() {
+	public List<ColumnConstraint> getConstraints() {
 		return constraints;
 	}
 	
@@ -146,7 +145,7 @@
 	 * 
 	 * @param constraints 制約のリスト
 	 */
-	public void setConstraints(List<ValueConstraintModel> constraints) {
+	public void setConstraints(List<ColumnConstraint> constraints) {
 		this.constraints = constraints;
 	}
 	

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -21,7 +21,7 @@
 import static org.jiemamy.xml.CoreQName.ADAPTER;
 import static org.jiemamy.xml.CoreQName.ATTRIBUTES;
 import static org.jiemamy.xml.CoreQName.BEGIN_SCRIPT;
-import static org.jiemamy.xml.CoreQName.CHECK_CONSTRAINT;
+import static org.jiemamy.xml.CoreQName.COLUMN_CHECK_CONSTRAINT;
 import static org.jiemamy.xml.CoreQName.COLUMN_REF;
 import static org.jiemamy.xml.CoreQName.COLUMN_REFS;
 import static org.jiemamy.xml.CoreQName.CONSTRAINTS;
@@ -50,12 +50,14 @@
 import static org.jiemamy.xml.CoreQName.REFERENCE_COLUMNS;
 import static org.jiemamy.xml.CoreQName.SCHEMA_NAME;
 import static org.jiemamy.xml.CoreQName.TABLE;
+import static org.jiemamy.xml.CoreQName.TABLE_CHECK_CONSTRAINT;
 import static org.jiemamy.xml.CoreQName.TABLE_REF;
 import static org.jiemamy.xml.CoreQName.TYPE_CATEGORY;
 import static org.jiemamy.xml.CoreQName.TYPE_NAME;
 import static org.jiemamy.xml.CoreQName.VIEW;
 
 import java.lang.reflect.Field;
+import java.util.Collection;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
@@ -85,14 +87,15 @@
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.KeyConstraintModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.dataset.RecordModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
@@ -121,6 +124,28 @@
 	private static Logger logger = LoggerFactory.getLogger(DomBuilder.class);
 	
 
+	private static Element newColumnConstraintsElement(Element parentElement, Collection<ColumnConstraint> constraints) {
+		if (constraints.size() == 0) {
+			return null;
+		}
+		Element constraintsElement = DomUtil.newChild(parentElement, CONSTRAINTS);
+		for (ColumnConstraint columnConstraint : constraints) {
+			if (columnConstraint instanceof NotNullConstraintModel) {
+				NotNullConstraintModel notNullConstraintModel = (NotNullConstraintModel) columnConstraint;
+				Element nnElement = DomUtil.newChild(constraintsElement, NOT_NULL);
+				nnElement.setAttribute(CoreQName.ID.getQNameString(), notNullConstraintModel.getId().toString());
+				writeAdapters(nnElement, notNullConstraintModel.getAdapters());
+			} else if (columnConstraint instanceof ColumnCheckModel) {
+				ColumnCheckModel columnCheckModel = (ColumnCheckModel) columnConstraint;
+				writeColumnCheckConstrait(constraintsElement, columnCheckModel);
+			} else {
+				// 処理しない。
+				logger.info("column keyConstraint convert to table keyConstraint");
+			}
+		}
+		return constraintsElement;
+	}
+	
 	private static Element newDataTypeElement(Element parentElement, DataType dataType) {
 		Element dataTypeElement = DomUtil.newChild(parentElement, DATA_TYPE);
 		if (dataType instanceof DomainRef) {
@@ -182,21 +207,24 @@
 		}
 	}
 	
-	private static void writeCheckConstrait(Element parentElement, CheckConstraintModel checkConstraintModel) {
-		Element checkElement = DomUtil.newChild(parentElement, CHECK_CONSTRAINT);
+	private static void writeColumnCheckConstrait(Element parentElement, ColumnCheckModel checkConstraintModel) {
+		Element checkElement = DomUtil.newChild(parentElement, COLUMN_CHECK_CONSTRAINT);
 		checkElement.setAttribute(CoreQName.ID.getQNameString(), checkConstraintModel.getId().toString());
 		DomUtil.newChild(checkElement, NAME, checkConstraintModel.getName());
+		DomUtil.newChild(checkElement, EXPRESSION, checkConstraintModel.getExpression());
+		writeAdapters(checkElement, checkConstraintModel.getAdapters());
+	}
+	
+	private static void writeTableCheckConstrait(Element parentElement, TableCheckModel checkConstraintModel) {
+		Element checkElement = DomUtil.newChild(parentElement, TABLE_CHECK_CONSTRAINT);
+		checkElement.setAttribute(CoreQName.ID.getQNameString(), checkConstraintModel.getId().toString());
+		DomUtil.newChild(checkElement, NAME, checkConstraintModel.getName());
 		DomUtil.newChild(checkElement, LOGICAL_NAME, checkConstraintModel.getLogicalName());
 		DomUtil.newChild(checkElement, DESCRIPTION, checkConstraintModel.getDescription());
 		DomUtil.newChild(checkElement, EXPRESSION, checkConstraintModel.getExpression());
+		writeAdapters(checkElement, checkConstraintModel.getAdapters());
 	}
 	
-	private static void writeNotNullConstrait(Element parentElement, NotNullConstraintModel notNullConstraintModel) {
-		Element columnRefElement = DomUtil.newChild(parentElement, COLUMN_REF);
-		columnRefElement.setAttribute(CoreQName.REF.getQNameString(), notNullConstraintModel.getColumn()
-			.getReferenceId().toString());
-	}
-	
 
 	private RootModel rootModel;
 	
@@ -280,18 +308,16 @@
 			
 			if (domainModel.getConstraints().size() > 0) {
 				Element constraintsElement = DomUtil.newChild(domainElement, CONSTRAINTS);
-				for (ValueConstraintModel constraint : domainModel.getConstraints()) {
+				for (ColumnConstraint constraint : domainModel.getConstraints()) {
 					if (constraint instanceof NotNullConstraintModel) {
 						NotNullConstraintModel notNullConstraintModel = (NotNullConstraintModel) constraint;
 						Element notNullElement = DomUtil.newChild(constraintsElement, NOT_NULL);
 						notNullElement.setAttribute(CoreQName.ID.getQNameString(), notNullConstraintModel.getId()
 							.toString());
 						DomUtil.newChild(notNullElement, NAME, notNullConstraintModel.getName());
-						DomUtil.newChild(notNullElement, LOGICAL_NAME, notNullConstraintModel.getLogicalName());
-						DomUtil.newChild(notNullElement, DESCRIPTION, notNullConstraintModel.getDescription());
-//					writeNotNullConstrait(constraintsElement, notNullConstraintModel);
-					} else if (constraint instanceof CheckConstraintModel) {
-						writeCheckConstrait(constraintsElement, (CheckConstraintModel) constraint);
+						writeAdapters(notNullElement, notNullConstraintModel.getAdapters());
+					} else if (constraint instanceof ColumnCheckModel) {
+						writeColumnCheckConstrait(constraintsElement, (ColumnCheckModel) constraint);
 					} else {
 						logger.warn("unknown domain constraint: " + constraint.getClass().getName());
 					}
@@ -334,6 +360,7 @@
 						ColumnModel columnModel = (ColumnModel) attributeModel;
 						newDataTypeElement(attributeElement, columnModel.getDataType());
 						DomUtil.newChild(attributeElement, DEFAULT_VALUE, columnModel.getDefaultValue());
+						newColumnConstraintsElement(attributeElement, columnModel.getConstraints());
 					} else if (attributeModel instanceof KeyConstraintModel) {
 						KeyConstraintModel keyeyModel = (KeyConstraintModel) attributeModel;
 						Element columnRefsElement = DomUtil.newChild(attributeElement, COLUMN_REFS);
@@ -368,16 +395,9 @@
 							DomUtil.newChild(attributeElement, ON_DELETE, foreignKeyModel.getOnDelete());
 							DomUtil.newChild(attributeElement, ON_UPDATE, foreignKeyModel.getOnUpdate());
 						}
-					} else if (attributeModel instanceof ValueConstraintModel) {
-						ValueConstraintModel valueConstraintModel = (ValueConstraintModel) attributeModel;
-						if (attributeModel instanceof NotNullConstraintModel) {
-							NotNullConstraintModel notNullConstraintModel =
-									(NotNullConstraintModel) valueConstraintModel;
-							writeNotNullConstrait(attributeElement, notNullConstraintModel);
-						} else if (attributeModel instanceof CheckConstraintModel) {
-							CheckConstraintModel checkConstraintModel = (CheckConstraintModel) valueConstraintModel;
-							writeCheckConstrait(attributeElement, checkConstraintModel);
-						}
+					} else if (attributeModel instanceof TableCheckModel) {
+						TableCheckModel tableCheckModel = (TableCheckModel) attributeModel;
+						writeTableCheckConstrait(attributeElement, tableCheckModel);
 					}
 					writeAdapters(attributeElement, attributeModel.getAdapters());
 				}
@@ -390,10 +410,6 @@
 				DomUtil.newChild(entityElement, BEGIN_SCRIPT, viewModel.getBeginScript());
 				DomUtil.newChild(entityElement, END_SCRIPT, viewModel.getEndScript());
 				DomUtil.newChild(entityElement, DEFINITION, viewModel.getDefinition());
-//			} else if (nodeModel instanceof StickyModel) {
-//				StickyModel stickyModel = (StickyModel) nodeModel;
-//				nodeElement = XmlUtil.newChild(nodesElement, STICKY);
-//				XmlUtil.newChild(nodeElement, CONTENTS, stickyModel.getContents());
 			} else {
 				throw new UnexpectedConditionError("unknown entity:" + entityModel.getClass().getName());
 			}
@@ -412,10 +428,8 @@
 			return CoreQName.UNIQUE_KEY;
 		} else if (attributeModel instanceof ForeignKeyModel) {
 			return CoreQName.FOREIGN_KEY;
-		} else if (attributeModel instanceof NotNullConstraintModel) {
-			return CoreQName.NOT_NULL;
-		} else if (attributeModel instanceof CheckConstraintModel) {
-			return CoreQName.CHECK_CONSTRAINT;
+		} else if (attributeModel instanceof TableCheckModel) {
+			return CoreQName.TABLE_CHECK_CONSTRAINT;
 		} else {
 			return null;
 		}

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -18,7 +18,7 @@
  */
 package org.jiemamy.serializer;
 
-import static org.jiemamy.xml.CoreQName.CHECK_CONSTRAINT;
+import static org.jiemamy.xml.CoreQName.COLUMN_CHECK_CONSTRAINT;
 import static org.jiemamy.xml.CoreQName.NOT_NULL;
 import static org.jiemamy.xml.CoreQName.TABLE;
 import static org.jiemamy.xml.CoreQName.VIEW;
@@ -47,14 +47,15 @@
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.ColumnRefImpl;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.KeyConstraintModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.attribute.constraint.Deferrability.InitiallyCheckTime;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel.ReferentialAction;
 import org.jiemamy.model.dataset.DataSetModel;
@@ -99,6 +100,7 @@
 				} else {
 					try {
 						adapter = clazz.newInstance();
+						jiemamyElement.registerAdapter(adapter);
 					} catch (InstantiationException e) {
 						logger.warn("ModelAdapter must have default constructor.", e);
 						continue;
@@ -233,32 +235,49 @@
 				parseUniqueKey(attributeElement, tableModel);
 			} else if (DomUtil.equalsElement(attributeElement, CoreQName.FOREIGN_KEY)) {
 				parseForeignKey(attributeElement, tableModel);
-			} else if (DomUtil.equalsElement(attributeElement, CoreQName.NOT_NULL)) {
-				parseNotNullConstraint(attributeElement, tableModel);
-			} else if (DomUtil.equalsElement(attributeElement, CoreQName.CHECK_CONSTRAINT)) {
-				parseCheckConstraint(attributeElement, tableModel);
+			} else if (DomUtil.equalsElement(attributeElement, CoreQName.TABLE_CHECK_CONSTRAINT)) {
+				parseTableCheckConstraint(attributeElement, tableModel);
 			} else {
 				logger.warn("unknown attribute");
 			}
 		}
 	}
 	
-	private void parseCheckConstraint(Element checkElement, TableModel tableModel) {
-		CheckConstraintModel checkModel =
-				factory.newModel(CheckConstraintModel.class, DomUtil.getUUID(checkElement, CoreQName.ID));
-		checkModel.setName(XpathUtil.getTextContent(checkElement, "core:name"));
-		checkModel.setLogicalName(XpathUtil.getTextContent(checkElement, "core:logicalName"));
-		checkModel.setExpression(XpathUtil.getText(checkElement, "core:expression/text()"));
-		readAdapter(checkElement, checkModel);
-		tableModel.getAttributes().add(checkModel);
-	}
-	
 	private void parseColumn(Element columnElement, TableModel tableModel) {
 		ColumnModel columnModel = factory.newModel(ColumnModel.class, DomUtil.getUUID(columnElement, CoreQName.ID));
 		columnModel.setName(XpathUtil.getText(columnElement, "core:name/text()"));
 		columnModel.setLogicalName(XpathUtil.getTextContent(columnElement, "core:logicalName"));
 		columnModel.setDataType(getDataType((Element) XpathUtil.getNode(columnElement, "core:dataType")));
 		columnModel.setDefaultValue(XpathUtil.getTextContent(columnElement, "core:defaultValue"));
+		
+		if (XpathUtil.getNode(columnElement, "core:constraints") != null) {
+			NodeList constraintNodeList = XpathUtil.getNodes(columnElement, "core:constraints/*");
+			Iterable<Node> constraintIterableNodeList = new IterableNodeList(constraintNodeList);
+			for (Node constraintNode : constraintIterableNodeList) {
+				if ((constraintNode instanceof Element) == false) {
+					continue;
+				}
+				Element constraintElement = (Element) constraintNode;
+				if (DomUtil.equalsElement(constraintElement, CoreQName.NOT_NULL)) {
+					NotNullConstraintModel nnModel =
+							factory.newModel(NotNullConstraintModel.class, DomUtil.getUUID(constraintElement,
+									CoreQName.ID));
+					nnModel.setName(XpathUtil.getText(constraintElement, "core:name/text()"));
+					readAdapter(constraintElement, nnModel);
+					columnModel.getConstraints().add(nnModel);
+				} else if (DomUtil.equalsElement(constraintElement, CoreQName.COLUMN_CHECK_CONSTRAINT)) {
+					ColumnCheckModel checkModel =
+							factory.newModel(ColumnCheckModel.class, DomUtil.getUUID(constraintElement, CoreQName.ID));
+					checkModel.setName(XpathUtil.getText(constraintElement, "core:name/text()"));
+					checkModel.setExpression(XpathUtil.getText(constraintElement, "core:expression/text()"));
+					readAdapter(constraintElement, checkModel);
+					columnModel.getConstraints().add(checkModel);
+				} else {
+					logger.warn("unknown attribute");
+				}
+			}
+		}
+		
 		columnModel.setDescription(XpathUtil.getTextContent(columnElement, "core:description"));
 		readAdapter(columnElement, columnModel);
 		tableModel.getAttributes().add(columnModel);
@@ -340,18 +359,20 @@
 					logger.warn("unexpected constraint: " + constraintNode.getNodeType());
 					continue;
 				}
-				ValueConstraintModel constraint;
+				ColumnConstraint constraint;
 				Element constraintElement = (Element) constraintNode;
 				
 				if (constraintElement.getNodeName().equals(NOT_NULL.getQName().getLocalPart())) {
 					NotNullConstraintModel notNullConstraintModel =
 							factory.newModel(NotNullConstraintModel.class, DomUtil
 								.getUUID(constraintNode, CoreQName.ID));
+					readAdapter(constraintElement, notNullConstraintModel);
 					constraint = notNullConstraintModel;
-				} else if (constraintElement.getNodeName().equals(CHECK_CONSTRAINT.getQName().getLocalPart())) {
-					CheckConstraintModel checkConstraintModel =
-							factory.newModel(CheckConstraintModel.class, DomUtil.getUUID(constraintNode, CoreQName.ID));
+				} else if (constraintElement.getNodeName().equals(COLUMN_CHECK_CONSTRAINT.getQName().getLocalPart())) {
+					ColumnCheckModel checkConstraintModel =
+							factory.newModel(ColumnCheckModel.class, DomUtil.getUUID(constraintNode, CoreQName.ID));
 					checkConstraintModel.setExpression(XpathUtil.getText(constraintElement, "core:expression/text()"));
+					readAdapter(constraintElement, checkConstraintModel);
 					constraint = checkConstraintModel;
 				} else {
 					logger.warn("unknown constraint: " + constraintElement.getNodeName());
@@ -359,7 +380,6 @@
 				}
 				
 				constraint.setName(XpathUtil.getTextContent(constraintElement, "core:name"));
-				constraint.setLogicalName(XpathUtil.getTextContent(constraintElement, "core:logicalName"));
 				
 				domainModel.getConstraints().add(constraint);
 			}
@@ -429,17 +449,13 @@
 		tableModel.getAttributes().add(fkModel);
 	}
 	
-	private void parseNotNullConstraint(Element nnElement, TableModel tableModel) {
+	private void parseNotNullConstraint(Element nnElement, ColumnModel columnModel) {
 		NotNullConstraintModel nnModel =
 				factory.newModel(NotNullConstraintModel.class, DomUtil.getUUID(nnElement, CoreQName.ID));
 		nnModel.setName(XpathUtil.getTextContent(nnElement, "core:name"));
-		nnModel.setLogicalName(XpathUtil.getTextContent(nnElement, "core:logicalName"));
-		Node columnRefNode = XpathUtil.getNode(nnElement, "core:columnRef");
-		ColumnRef columnRef = new ColumnRefImpl(jiemamy, DomUtil.getUUID(columnRefNode, CoreQName.REF));
-		nnModel.setColumn(columnRef);
 		
 		readAdapter(nnElement, nnModel);
-		tableModel.getAttributes().add(nnModel);
+		columnModel.getConstraints().add(nnModel);
 	}
 	
 	private void parsePrimaryKey(Element pkElement, TableModel tableModel) {
@@ -493,6 +509,17 @@
 		return tableModel;
 	}
 	
+	private void parseTableCheckConstraint(Element checkElement, TableModel tableModel) {
+		;
+		TableCheckModel checkModel =
+				factory.newModel(TableCheckModel.class, DomUtil.getUUID(checkElement, CoreQName.ID));
+		checkModel.setName(XpathUtil.getTextContent(checkElement, "core:name"));
+		checkModel.setLogicalName(XpathUtil.getTextContent(checkElement, "core:logicalName"));
+		checkModel.setExpression(XpathUtil.getText(checkElement, "core:expression/text()"));
+		readAdapter(checkElement, checkModel);
+		tableModel.getAttributes().add(checkModel);
+	}
+	
 	private void parseUniqueKey(Element ukElement, TableModel tableModel) {
 		UniqueKeyModel ukModel = factory.newModel(UniqueKeyModel.class, DomUtil.getUUID(ukElement, CoreQName.ID));
 		ukModel.setName(XpathUtil.getTextContent(ukElement, "core:name"));

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -30,7 +30,7 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.RepresentationAdapter;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
@@ -45,6 +45,7 @@
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.entity.ViewModel;
 import org.jiemamy.utils.CollectionsUtil;
+import org.jiemamy.utils.Disablable;
 import org.jiemamy.utils.builder.DataTypeBuilder;
 import org.jiemamy.utils.model.ColumnUtil;
 import org.jiemamy.utils.model.DataSetUtil;
@@ -294,8 +295,8 @@
 		NotNullConstraintModel notNull =
 				factory.newModel(NotNullConstraintModel.class, uuid.get("af4845dc-7f3a-434d-b5ac-2f25b74d7e76"));
 		domainId.getConstraints().add(notNull);
-		CheckConstraintModel check =
-				factory.newModel(CheckConstraintModel.class, uuid.get("48b76d76-b288-480a-afa4-111247379f8d"));
+		ColumnCheckModel check =
+				factory.newModel(ColumnCheckModel.class, uuid.get("48b76d76-b288-480a-afa4-111247379f8d"));
 		check.setName("hoge");
 		check.setExpression("VALUE > 0");
 		domainId.getConstraints().add(check);
@@ -638,8 +639,7 @@
 		for (ColumnModel column : Arrays.asList(deptDeptNo, deptDeptName)) {
 			NotNullConstraintModel notNull =
 					factory.newModel(NotNullConstraintModel.class, columnNotNullMap.get(column.getId()));
-			notNull.setColumn(factory.newReference(column));
-			tableDept.getAttributes().add(notNull);
+			column.getConstraints().add(notNull);
 		}
 	}
 	
@@ -664,6 +664,10 @@
 		empEmpNo.setName("EMP_NO");
 		empEmpNo.setDataType(new DataTypeBuilder(factory, DataTypeCategory.INTEGER).build());
 		empEmpNo.setLogicalName("従業員番号");
+		NotNullConstraintModel notNullEmpEmpNo =
+				factory.newModel(NotNullConstraintModel.class, uuid.get("05ee4c06-d8b5-4599-a7e9-1cda036ea2c7"));
+		notNullEmpEmpNo.getAdapter(Disablable.class).setDisabled(true);
+		empEmpNo.getConstraints().add(notNullEmpEmpNo);
 		tableEmp.getAttributes().add(empEmpNo);
 		
 		empEmpName = factory.newModel(ColumnModel.class, uuid.get("0e51b6df-43ab-408c-90ef-de13c6aab881"));
@@ -705,17 +709,15 @@
 		tableEmp.getAttributes().add(empPk);
 		
 		Map<UUID, UUID> columnNotNullMap = CollectionsUtil.newHashMap();
-		columnNotNullMap.put(empEmpNo.getId(), uuid.get("05ee4c06-d8b5-4599-a7e9-1cda036ea2c7"));
 		columnNotNullMap.put(empEmpName.getId(), uuid.get("41f178b9-2cb5-4dad-a6c0-48df2d5b1300"));
 		columnNotNullMap.put(empHiredate.getId(), uuid.get("2d66fd73-8d6b-41d8-b6b8-daec7d6c0c53"));
 		columnNotNullMap.put(empSal.getId(), uuid.get("a446779a-4fb6-4a0f-8262-22daae856e85"));
 		columnNotNullMap.put(empDeptId.getId(), uuid.get("b9a0fdce-a965-4118-ae71-5dc7150f6d4e"));
 		
-		for (ColumnModel column : Arrays.asList(empEmpNo, empEmpName, empHiredate, empSal, empDeptId)) {
+		for (ColumnModel column : Arrays.asList(empEmpName, empHiredate, empSal, empDeptId)) {
 			NotNullConstraintModel notNull =
 					factory.newModel(NotNullConstraintModel.class, columnNotNullMap.get(column.getId()));
-			notNull.setColumn(factory.newReference(column));
-			tableEmp.getAttributes().add(notNull);
+			column.getConstraints().add(notNull);
 		}
 	}
 	

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder2.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -699,8 +699,7 @@
 		
 		for (ColumnModel column : Arrays.asList(detailOrderId, detailItemId, detailQuantity)) {
 			NotNullConstraintModel notNull = factory.newModel(NotNullConstraintModel.class);
-			notNull.setColumn(factory.newReference(column));
-			tableDetail.getAttributes().add(notNull);
+			column.getConstraints().add(notNull);
 		}
 	}
 	
@@ -740,8 +739,7 @@
 		
 		for (ColumnModel column : Arrays.asList(itemName, itemPrice)) {
 			NotNullConstraintModel notNull = factory.newModel(NotNullConstraintModel.class);
-			notNull.setColumn(factory.newReference(column));
-			tableItem.getAttributes().add(notNull);
+			column.getConstraints().add(notNull);
 		}
 	}
 	
@@ -778,8 +776,7 @@
 		
 		for (ColumnModel column : Arrays.asList(orderUserId, orderDate)) {
 			NotNullConstraintModel notNull = factory.newModel(NotNullConstraintModel.class);
-			notNull.setColumn(factory.newReference(column));
-			tableOrder.getAttributes().add(notNull);
+			column.getConstraints().add(notNull);
 		}
 	}
 	
@@ -816,7 +813,6 @@
 		tableUser.getAttributes().add(userPk);
 		
 		NotNullConstraintModel notNull = factory.newModel(NotNullConstraintModel.class);
-		notNull.setColumn(factory.newReference(userName));
-		tableUser.getAttributes().add(notNull);
+		userName.getConstraints().add(notNull);
 	}
 }

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -26,10 +26,9 @@
 
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
-import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.entity.TableModel;
 
@@ -48,8 +47,7 @@
 		order.add(PrimaryKeyModel.class);
 		order.add(UniqueKeyModel.class);
 		order.add(ForeignKeyModel.class);
-		order.add(NotNullConstraintModel.class);
-		order.add(CheckConstraintModel.class);
+		order.add(TableCheckModel.class);
 		ORDER = UnmodifiableList.decorate(order);
 	}
 	

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DisablableImpl.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DisablableImpl.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DisablableImpl.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -18,6 +18,8 @@
  */
 package org.jiemamy.utils;
 
+import org.apache.commons.lang.BooleanUtils;
+
 import org.jiemamy.composer.Exporter;
 
 /**
@@ -26,28 +28,19 @@
  */
 public class DisablableImpl implements Disablable {
 	
-	private boolean disabled;
+	private Boolean disabled;
 	
 
-	/**
-	 * {@inheritDoc}
-	 */
-	public boolean isDisabled() {
+	public Boolean isDisabled() {
 		return disabled;
 	}
 	
-	/**
-	 * {@inheritDoc}
-	 */
-	public void setDisabled(boolean disabled) {
+	public void setDisabled(Boolean disabled) {
 		this.disabled = disabled;
 	}
 	
-	/**
-	 * {@inheritDoc}
-	 */
 	@Override
 	public String toString() {
-		return disabled ? "disabled" : "enabled";
+		return BooleanUtils.toString(disabled, "disabled", "enabled", "");
 	}
 }

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DomainUtil.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DomainUtil.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DomainUtil.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -20,8 +20,8 @@
 
 import java.util.List;
 
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.ConstraintModel;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.datatype.DomainModel;
 
 /**
@@ -39,8 +39,8 @@
 	 * @return 
 	 */
 	public static boolean hasConstraint(DomainModel domainModel, Class<? extends ConstraintModel> clazz) {
-		List<ValueConstraintModel> constraints = domainModel.getConstraints();
-		for (ValueConstraintModel constraint : constraints) {
+		List<ColumnConstraint> constraints = domainModel.getConstraints();
+		for (ColumnConstraint constraint : constraints) {
 			if (clazz.isAssignableFrom(constraint.getClass())) {
 				return true;
 			}

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-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -33,9 +33,9 @@
 import org.jiemamy.model.JiemamyElement;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.AttributeModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.dataset.RecordModel;
 import org.jiemamy.model.datatype.DomainModel;
@@ -64,7 +64,7 @@
 			if (domainModel.getId().equals(refId)) {
 				return domainModel;
 			}
-			for (ValueConstraintModel valueConstraintModel : domainModel.getConstraints()) {
+			for (ColumnConstraint valueConstraintModel : domainModel.getConstraints()) {
 				if (valueConstraintModel.getId().equals(refId)) {
 					return valueConstraintModel;
 				}

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-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/TableUtil.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -25,9 +25,9 @@
 import org.jiemamy.internal.processor.GetColumnProcessor;
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.attribute.constraint.ConstraintModel;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableConstraint;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.CollectionsUtil;
 import org.jiemamy.utils.ProcessorUtil;
@@ -106,8 +106,8 @@
 	 * @param tableModel 対象のテーブル
 	 * @return 制約のリスト
 	 */
-	public static List<ConstraintModel> getConstraints(TableModel tableModel) {
-		return getAttributes(tableModel, ConstraintModel.class);
+	public static List<TableConstraint> getConstraints(TableModel tableModel) {
+		return getAttributes(tableModel, TableConstraint.class);
 	}
 	
 	/**

Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/AbstractTraversalValidator.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/AbstractTraversalValidator.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/AbstractTraversalValidator.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -27,10 +27,10 @@
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.ConstraintModel;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.KeyConstraintModel;
-import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.dataset.DataSetModel;
@@ -91,6 +91,20 @@
 					if (attributeModel instanceof ColumnModel) {
 						ColumnModel columnModel = (ColumnModel) attributeModel;
 						check(columnModel.getDataType(), TABLE + index(i) + "/column" + index(j) + "/dataType");
+						int k = 0;
+						for (ColumnConstraint columnConstraint : columnModel.getConstraints()) {
+							check(columnConstraint, TABLE + index(i) + "/column" + index(j) + "/constraint" + index(k));
+							if (columnConstraint instanceof KeyConstraintModel) {
+								KeyConstraintModel keyConstraintModel = (KeyConstraintModel) columnConstraint;
+								int l = 0;
+								for (ColumnRef columnRef : keyConstraintModel.getKeyColumns()) {
+									check(columnRef, TABLE + index(i) + "/column" + index(j) + "/constraint" + index(k)
+											+ "/columnRef" + index(l));
+									l++;
+								}
+							}
+							k++;
+						}
 					} else if (attributeModel instanceof ConstraintModel) {
 						checkConstraintModel(i, j, (ConstraintModel) attributeModel);
 					}
@@ -160,9 +174,6 @@
 					k++;
 				}
 			}
-		} else if (constraintModel instanceof NotNullConstraintModel) {
-			NotNullConstraintModel notNullConstraintModel = (NotNullConstraintModel) constraintModel;
-			check(notNullConstraintModel.getColumn(), TABLE + index(i) + "/notNull" + index(j) + "/column");
 		} else if (constraintModel instanceof CheckConstraintModel) {
 			CheckConstraintModel checkConstraintModel = (CheckConstraintModel) constraintModel;
 			check(checkConstraintModel.getExpression(), TABLE + index(i) + "/check" + index(j) + "/expression");

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-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/validator/impl/ColumnValidator.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -25,6 +25,9 @@
 
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.attribute.ColumnRef;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
+import org.jiemamy.model.attribute.constraint.LocalKeyModel;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.utils.model.RootModelUtil;
 import org.jiemamy.utils.model.TableUtil;
@@ -57,6 +60,18 @@
 				if (column.getDataType() == null) {
 					result.add(new EmptyDataTypeProblem(tableModel, column));
 				}
+				for (ColumnConstraint columnConstraint : column.getConstraints()) {
+					if (columnConstraint instanceof LocalKeyModel) {
+						LocalKeyModel localKeyModel = (LocalKeyModel) columnConstraint;
+						if (localKeyModel.getKeyColumns().size() != 1) {
+							// UNDONE
+						}
+						ColumnRef columnRef = localKeyModel.getKeyColumns().get(0);
+						if (columnRef.getReferenceId() != column.getId()) {
+							// UNDONE
+						}
+					}
+				}
 				index++;
 			}
 		}

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/ArtemisJiemamyFactoryTest.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -38,10 +38,11 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.dataset.DataSetModel;
 import org.jiemamy.model.dataset.RecordModel;
@@ -126,7 +127,8 @@
 		assertThat(factory.newModel(PrimaryKeyModel.class), is(notNullValue()));
 		assertThat(factory.newModel(UniqueKeyModel.class), is(notNullValue()));
 		assertThat(factory.newModel(ForeignKeyModel.class), is(notNullValue()));
-		assertThat(factory.newModel(CheckConstraintModel.class), is(notNullValue()));
+		assertThat(factory.newModel(TableCheckModel.class), is(notNullValue()));
+		assertThat(factory.newModel(ColumnCheckModel.class), is(notNullValue()));
 		assertThat(factory.newModel(NotNullConstraintModel.class), is(notNullValue()));
 		assertThat(factory.newModel(DomainModel.class), is(notNullValue()));
 		assertThat(factory.newModel(DataSetModel.class), is(notNullValue()));

Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java
===================================================================
--- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/JiemamyPropertyTest.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -31,6 +31,7 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import org.jiemamy.model.attribute.constraint.AbstractConstraintModel;
 import org.jiemamy.utils.ReflectionUtil;
 
 /**
@@ -130,7 +131,11 @@
 				try {
 					targetModelClass.getDeclaredField(enumField.getName());
 				} catch (NoSuchFieldException e) {
-					fail(targetModelClass.getName() + " is not have " + enumField.getName());
+					if (targetModelClass == AbstractConstraintModel.class && enumField.getName() == "name") {
+						// 例外 success
+					} else {
+						fail(targetModelClass.getName() + " is not have " + enumField.getName());
+					}
 				}
 			}
 		}

Modified: artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/ArtemisViewTest.java
===================================================================
--- artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/ArtemisViewTest.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/ArtemisViewTest.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -35,10 +35,11 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.ColumnModel;
 import org.jiemamy.model.attribute.ColumnRef;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.connection.ConnectionAdapter;
 import org.jiemamy.model.dataset.DataSetModel;
@@ -105,7 +106,8 @@
 		assertThat(factory.newModel(PrimaryKeyModel.class), is(notNullValue()));
 		assertThat(factory.newModel(UniqueKeyModel.class), is(notNullValue()));
 		assertThat(factory.newModel(ForeignKeyModel.class), is(notNullValue()));
-		assertThat(factory.newModel(CheckConstraintModel.class), is(notNullValue()));
+		assertThat(factory.newModel(TableCheckModel.class), is(notNullValue()));
+		assertThat(factory.newModel(ColumnCheckModel.class), is(notNullValue()));
 		assertThat(factory.newModel(NotNullConstraintModel.class), is(notNullValue()));
 		assertThat(factory.newModel(DomainModel.class), is(notNullValue()));
 		assertThat(factory.newModel(DataSetModel.class), is(notNullValue()));
@@ -149,7 +151,8 @@
 		assertThat(factoryWithView.newModel(PrimaryKeyModel.class), is(notNullValue()));
 		assertThat(factoryWithView.newModel(UniqueKeyModel.class), is(notNullValue()));
 		assertThat(factoryWithView.newModel(ForeignKeyModel.class), is(notNullValue()));
-		assertThat(factoryWithView.newModel(CheckConstraintModel.class), is(notNullValue()));
+		assertThat(factoryWithView.newModel(TableCheckModel.class), is(notNullValue()));
+		assertThat(factoryWithView.newModel(ColumnCheckModel.class), is(notNullValue()));
 		assertThat(factoryWithView.newModel(NotNullConstraintModel.class), is(notNullValue()));
 		assertThat(factoryWithView.newModel(DomainModel.class), is(notNullValue()));
 		assertThat(factoryWithView.newModel(DataSetModel.class), is(notNullValue()));

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -69,9 +69,9 @@
 import org.jiemamy.editcommand.CommandListener;
 import org.jiemamy.model.JiemamyElement;
 import org.jiemamy.model.RootModel;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.datatype.BuiltinDataType;
 import org.jiemamy.model.datatype.DataType;
 import org.jiemamy.model.datatype.DataTypeCategory;
@@ -555,10 +555,10 @@
 				.getSize(), ""));
 			txtDescription.setText(StringUtils.defaultIfEmpty(domain.getDescription(), ""));
 			chkIsNotNull.setSelection(DomainUtil.hasConstraint(domain, NotNullConstraintModel.class));
-			List<ValueConstraintModel> constraints = domain.getConstraints();
-			for (ValueConstraintModel valueConstraintModel : constraints) {
-				if (valueConstraintModel instanceof CheckConstraintModel) {
-					CheckConstraintModel checkConstraintModel = (CheckConstraintModel) valueConstraintModel;
+			List<ColumnConstraint> constraints = domain.getConstraints();
+			for (ColumnConstraint valueConstraintModel : constraints) {
+				if (valueConstraintModel instanceof ColumnCheckModel) {
+					ColumnCheckModel checkConstraintModel = (ColumnCheckModel) valueConstraintModel;
 					txtCheck.setText(checkConstraintModel.getExpression());
 					break;
 				}
@@ -660,9 +660,9 @@
 				domain.setDescription(txtDescription.getText());
 				
 				if (chkIsNotNull.getSelection()) {
-					Collection<ValueConstraintModel> toRemove = CollectionsUtil.newArrayList();
-					List<ValueConstraintModel> constraints = domain.getConstraints();
-					for (ValueConstraintModel valueConstraintModel : constraints) {
+					Collection<ColumnConstraint> toRemove = CollectionsUtil.newArrayList();
+					List<ColumnConstraint> constraints = domain.getConstraints();
+					for (ColumnConstraint valueConstraintModel : constraints) {
 						if (valueConstraintModel instanceof NotNullConstraintModel) {
 							toRemove.add(valueConstraintModel);
 						}

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyProperty.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyProperty.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyProperty.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -21,13 +21,14 @@
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.AttributeModel;
 import org.jiemamy.model.attribute.ColumnModel;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnCheckModel;
 import org.jiemamy.model.attribute.constraint.ConstraintModel;
 import org.jiemamy.model.attribute.constraint.Deferrability;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.attribute.constraint.KeyConstraintModel;
 import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
 import org.jiemamy.model.attribute.constraint.PrimaryKeyModel;
+import org.jiemamy.model.attribute.constraint.TableCheckModel;
 import org.jiemamy.model.attribute.constraint.UniqueKeyModel;
 import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
 import org.jiemamy.model.dataset.DataSetModel;
@@ -62,16 +63,26 @@
 		description
 	}
 	
+//	/**
+//	 * {@link CheckConstraintModel}のプロパティを表す列挙型。
+//	 * 
+//	 * @author daisuke
+//	 */
+//	@TargetModel(CheckConstraintModel.class)
+//	public enum CheckConstraintModelProperty implements JiemamyProperty {
+//		
+//		/** {@link CheckConstraintModel#getExpression()}で取得できるプロパティ */
+//		expression
+//	}
+	
 	/**
-	 * {@link CheckConstraintModel}のプロパティを表す列挙型。
+	 * {@link ColumnCheckModel}のプロパティを表す列挙型。
 	 * 
 	 * @author daisuke
 	 */
-	@TargetModel(CheckConstraintModel.class)
-	public enum CheckConstraintProperty implements JiemamyProperty {
+	@TargetModel(ColumnCheckModel.class)
+	public enum ColumnCheckModelProperty implements JiemamyProperty {
 		
-		/** {@link CheckConstraintModel#getExpression()}で取得できるプロパティ */
-		expression
 	}
 	
 	/**
@@ -86,7 +97,10 @@
 		dataType,
 
 		/** {@link ColumnModel#getDefaultValue()}で取得できるプロパティ */
-		defaultValue
+		defaultValue,
+
+		/** {@link ColumnModel#getConstraints()}で取得できるプロパティ */
+		constraints
 	}
 	
 	/**
@@ -97,6 +111,8 @@
 	@TargetModel(ConstraintModel.class)
 	public enum ConstraintProperty implements JiemamyProperty {
 		
+		/** {@link ConstraintModel#getName()}で取得できるプロパティ */
+		name
 	}
 	
 	/**
@@ -229,8 +245,6 @@
 	@TargetModel(NotNullConstraintModel.class)
 	public enum NotNullConstraintProperty implements JiemamyProperty {
 		
-		/** {@link NotNullConstraintModel#getColumn()}で取得できるプロパティ */
-		column
 	}
 	
 	/**
@@ -289,6 +303,16 @@
 	}
 	
 	/**
+	 * {@link ColumnCheckModel}のプロパティを表す列挙型。
+	 * 
+	 * @author daisuke
+	 */
+	@TargetModel(TableCheckModel.class)
+	public enum TableCheckModelProperty implements JiemamyProperty {
+		
+	}
+	
+	/**
 	 * {@link TableModel}のプロパティを表す列挙型。
 	 * 
 	 * @author daisuke

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -18,6 +18,9 @@
  */
 package org.jiemamy.model.attribute;
 
+import java.util.Collection;
+
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 import org.jiemamy.model.datatype.DataType;
 
 /**
@@ -27,6 +30,13 @@
 public interface ColumnModel extends AttributeModel {
 	
 	/**
+	 * カラム制約の集合を取得する。
+	 * 
+	 * @return カラム制約の集合
+	 */
+	Collection<ColumnConstraint> getConstraints();
+	
+	/**
 	 * 型記述子を取得する。
 	 * @return 型記述子
 	 */

Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModel.java	                        (rev 0)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnCheckModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/18
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.model.attribute.constraint;
+
+/**
+ * TODO for daisuke
+ * 
+ * @author daisuke
+ */
+public interface ColumnCheckModel extends CheckConstraintModel, ColumnConstraint {
+	
+}


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

Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnConstraint.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnConstraint.java	                        (rev 0)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ColumnConstraint.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/18
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.model.attribute.constraint;
+
+/**
+ * カラム制約を表すマーカインターフェイス。
+ * 
+ * @author daisuke
+ */
+public interface ColumnConstraint extends ConstraintModel {
+	
+}


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

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ConstraintModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ConstraintModel.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/ConstraintModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -18,12 +18,24 @@
  */
 package org.jiemamy.model.attribute.constraint;
 
-import org.jiemamy.model.attribute.AttributeModel;
+import org.jiemamy.model.JiemamyElement;
 
 /**
  * 制約を表すモデルインターフェイス。
  * @author daisuke
  */
-public interface ConstraintModel extends AttributeModel {
+public interface ConstraintModel extends JiemamyElement {
 	
+	/**
+	 * 物理名を取得する。
+	 * @return 物理名
+	 */
+	String getName();
+	
+	/**
+	 * 物理名を設定する。
+	 * @param name 物理名
+	 */
+	void setName(String name);
+	
 }

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/KeyConstraintModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/KeyConstraintModel.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/KeyConstraintModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -27,7 +27,7 @@
  * 
  * @author daisuke
  */
-public interface KeyConstraintModel extends ConstraintModel {
+public interface KeyConstraintModel extends ConstraintModel, TableConstraint {
 	
 	/**
 	 * 遅延評価可能性モデルを取得する。

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/LocalKeyModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/LocalKeyModel.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/LocalKeyModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -25,6 +25,6 @@
  * 
  * @author daisuke
  */
-public interface LocalKeyModel extends KeyConstraintModel {
+public interface LocalKeyModel extends KeyConstraintModel, ColumnConstraint {
 	
 }

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModel.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/NotNullConstraintModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -18,29 +18,12 @@
  */
 package org.jiemamy.model.attribute.constraint;
 
-import org.jiemamy.model.attribute.ColumnRef;
 
 /**
  * NOT NULL制約を表すモデルインターフェイス。
  * 
- * <p>NOT NULLは、CHECK (<i>value</i> IS NOT NULL)と等価であるため、{@link CheckConstraintModel}の
- * サブインターフェイスである。</p>
- * 
  * @author daisuke
  */
-public interface NotNullConstraintModel extends ValueConstraintModel {
+public interface NotNullConstraintModel extends ValueConstraintModel, ColumnConstraint {
 	
-	/**
-	 * NOT NULL制約対象カラムを取得する。
-	 * 
-	 * @return NOT NULL制約対象カラム
-	 */
-	ColumnRef getColumn();
-	
-	/**
-	 * NOT NULL制約対象カラムを設定する。
-	 * 
-	 * @param column NOT NULL制約対象カラム
-	 */
-	void setColumn(ColumnRef column);
 }

Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModel.java	                        (rev 0)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableCheckModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/18
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.model.attribute.constraint;
+
+/**
+ * TODO for daisuke
+ * 
+ * @author daisuke
+ */
+public interface TableCheckModel extends CheckConstraintModel, TableConstraint {
+	
+}


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

Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableConstraint.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableConstraint.java	                        (rev 0)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/constraint/TableConstraint.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/18
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.model.attribute.constraint;
+
+import org.jiemamy.model.attribute.AttributeModel;
+
+/**
+ * テーブル制約を表すマーカインターフェイス。
+ * 
+ * @author daisuke
+ */
+public interface TableConstraint extends AttributeModel, ConstraintModel {
+	
+}


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

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -21,7 +21,7 @@
 import java.util.List;
 
 import org.jiemamy.model.JiemamyElement;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
+import org.jiemamy.model.attribute.constraint.ColumnConstraint;
 
 /**
  * ドメインを表すモデルインターフェイス。
@@ -46,7 +46,7 @@
 	 * 
 	 * @return 制約のリスト
 	 */
-	List<ValueConstraintModel> getConstraints();
+	List<ColumnConstraint> getConstraints();
 	
 	/**
 	 * ドメインとして定義された型記述子を取得する。

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Disablable.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Disablable.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/utils/Disablable.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -33,12 +33,12 @@
 	 * エクスポート対象として無効かどうかを取得する。
 	 * @return エクスポート対象として無効かどうか
 	 */
-	boolean isDisabled();
+	Boolean isDisabled();
 	
 	/**
 	 * エクスポート対象として無効かどうかを設定する。
 	 * @param disabled エクスポート対象として無効かどうか
 	 */
-	void setDisabled(boolean disabled);
+	void setDisabled(Boolean disabled);
 	
 }

Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java	2009-02-18 15:39:26 UTC (rev 2687)
@@ -91,9 +91,12 @@
 	FOREIGN_KEY(CoreNamespace.NS_CORE, "foreignKey"),
 
 	/***/
-	CHECK_CONSTRAINT(CoreNamespace.NS_CORE, "check"),
+	TABLE_CHECK_CONSTRAINT(CoreNamespace.NS_CORE, "tableCheck"),
 
 	/***/
+	COLUMN_CHECK_CONSTRAINT(CoreNamespace.NS_CORE, "columnCheck"),
+
+	/***/
 	COLUMN(CoreNamespace.NS_CORE, "column"),
 
 	/***/

Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd	2009-02-18 15:39:26 UTC (rev 2687)
@@ -85,8 +85,7 @@
 							<xsd:element ref="primaryKey" minOccurs="1" />
 							<xsd:element ref="uniqueKey" minOccurs="0" maxOccurs="unbounded" />
 							<xsd:element ref="foreignKey" minOccurs="0" maxOccurs="unbounded" />
-							<xsd:element ref="notNull" minOccurs="0" maxOccurs="unbounded" />
-							<xsd:element ref="check" minOccurs="0" maxOccurs="unbounded" />
+							<xsd:element ref="tableCheck" minOccurs="0" maxOccurs="unbounded" />
 						</xsd:sequence>
 					</xsd:complexType>
 				</xsd:element>
@@ -128,6 +127,7 @@
 				<xsd:element ref="description" minOccurs="0" />
 				<xsd:element ref="dataType" />
 				<xsd:element ref="defaultValue" minOccurs="0" />
+				<xsd:element ref="constraints" minOccurs="0" maxOccurs="unbounded" />
 				<xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/>
 			</xsd:sequence>
 			<xsd:attribute name="id" type="uuidType" use="required" />
@@ -231,27 +231,9 @@
 		</xsd:complexType>
 	</xsd:element>
 
-	<xsd:element name="notNull">
+	<xsd:element name="tableCheck">
 		<xsd:complexType>
 			<xsd:sequence>
-				<xsd:element ref="name" minOccurs="0">
-					<xsd:annotation>
-						<xsd:documentation source="description" xml:lang="en">primary key physical name.</xsd:documentation> 
-						<xsd:documentation source="description" xml:lang="ja-JP">NOT NULL制約名を表す。</xsd:documentation>
-					</xsd:annotation>
-				</xsd:element>
-				<xsd:element ref="logicalName" minOccurs="0" />
-				<xsd:element ref="description" minOccurs="0" />
-				<xsd:element ref="columnRef" minOccurs="0"/>
-				<xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/>
-			</xsd:sequence>
-			<xsd:attribute name="id" type="uuidType" use="required" />
-		</xsd:complexType>
-	</xsd:element>
-
-	<xsd:element name="check">
-		<xsd:complexType>
-			<xsd:sequence>
 				<xsd:element ref="name" minOccurs="0" />
 				<xsd:element ref="logicalName" minOccurs="0" />
 				<xsd:element ref="description" minOccurs="0" />
@@ -261,7 +243,6 @@
 						<xsd:documentation source="description" xml:lang="ja-JP">NOT NULL制約名を表す。</xsd:documentation>
 					</xsd:annotation>
 				</xsd:element>
-				<xsd:element ref="columnRefs" minOccurs="0"/>
 				<xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/>
 			</xsd:sequence>
 			<xsd:attribute name="id" type="uuidType" use="required" />
@@ -299,15 +280,6 @@
 		</xsd:complexType>
 	</xsd:element>
 
-	<xsd:element name="adapter">
-		<xsd:complexType>
-			<xsd:sequence>
-				<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
-			</xsd:sequence>
-			<xsd:attribute name="class" type="fqcnType" use="required" />
-		</xsd:complexType>
-	</xsd:element>
-	
 	<xsd:element name="constraints">
 		<xsd:annotation>
 			<xsd:documentation source="description" xml:lang="en">column constraint</xsd:documentation> 
@@ -316,11 +288,53 @@
 		<xsd:complexType>
 			<xsd:sequence>
 				<xsd:element ref="notNull" minOccurs="0"/>
-				<xsd:element ref="check" minOccurs="0"/>
+				<xsd:element ref="columnCheck" minOccurs="0"/>
 			</xsd:sequence>
 		</xsd:complexType>
 	</xsd:element>
 
+	<xsd:element name="notNull">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element ref="name" minOccurs="0">
+					<xsd:annotation>
+						<xsd:documentation source="description" xml:lang="en">primary key physical name.</xsd:documentation> 
+						<xsd:documentation source="description" xml:lang="ja-JP">NOT NULL制約名を表す。</xsd:documentation>
+					</xsd:annotation>
+				</xsd:element>
+				<xsd:element ref="logicalName" minOccurs="0" />
+				<xsd:element ref="description" minOccurs="0" />
+				<xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/>
+			</xsd:sequence>
+			<xsd:attribute name="id" type="uuidType" use="required" />
+		</xsd:complexType>
+	</xsd:element>
+
+	<xsd:element name="columnCheck">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element ref="name" minOccurs="0" />
+				<xsd:element name="expression" type="xsd:string">
+					<xsd:annotation>
+						<xsd:documentation source="description" xml:lang="en">primary key physical name.</xsd:documentation> 
+						<xsd:documentation source="description" xml:lang="ja-JP">NOT NULL制約名を表す。</xsd:documentation>
+					</xsd:annotation>
+				</xsd:element>
+				<xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/>
+			</xsd:sequence>
+			<xsd:attribute name="id" type="uuidType" use="required" />
+		</xsd:complexType>
+	</xsd:element>
+
+	<xsd:element name="adapter">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+			</xsd:sequence>
+			<xsd:attribute name="class" type="fqcnType" use="required" />
+		</xsd:complexType>
+	</xsd:element>
+	
 	<xsd:element name="dataSets">
 		<xsd:complexType>
  			<xsd:sequence>

Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml
===================================================================
--- zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml	2009-02-18 11:53:59 UTC (rev 2686)
+++ zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml	2009-02-18 15:39:26 UTC (rev 2687)
@@ -17,10 +17,10 @@
       </dataType>
       <constraints>
         <notNull id="af4845dc-7f3a-434d-b5ac-2f25b74d7e76"/>
-        <check id="48b76d76-b288-480a-afa4-111247379f8d">
+        <columnCheck id="48b76d76-b288-480a-afa4-111247379f8d">
           <name>hoge</name>
           <expression>VALUE &gt; 0</expression>
-        </check>
+        </columnCheck>
       </constraints>
     </domain>
     <domain id="62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7">
@@ -46,9 +46,6 @@
           <name>ID</name>
           <logicalName>従業員ID</logicalName>
           <dataType ref="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </column>
         <column id="248a429b-2159-4ebd-a791-eee42a059374">
           <name>EMP_NO</name>
@@ -57,21 +54,25 @@
             <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
+          <constraints>
+            <notNull id="05ee4c06-d8b5-4599-a7e9-1cda036ea2c7">
+              <adapter class="org.jiemamy.utils.DisablableImpl">
+                <disabled>true</disabled>
+              </adapter>
+            </notNull>
+          </constraints>
         </column>
         <column id="0e51b6df-43ab-408c-90ef-de13c6aab881">
           <name>EMP_NAME</name>
           <logicalName>従業員名</logicalName>
           <dataType ref="62f1e6ec-e6aa-4d52-a6c3-27dac086f2d7"/>
           <defaultValue>no name</defaultValue>
+          <constraints>
+            <notNull id="41f178b9-2cb5-4dad-a6c0-48df2d5b1300"/>
+          </constraints>
           <adapter class="org.jiemamy.model.attribute.RepresentationAdapter">
             <representation>true</representation>
           </adapter>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </column>
         <column id="3d21a85a-72de-41b3-99dd-f4cb94e58d84">
           <name>MGR_ID</name>
@@ -80,9 +81,6 @@
             <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </column>
         <column id="f0b57eed-98ab-4c21-9855-218c592814dc">
           <name>HIREDATE</name>
@@ -90,9 +88,9 @@
             <typeCategory>DATE</typeCategory>
             <typeName>DATE</typeName>
           </dataType>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
+          <constraints>
+            <notNull id="2d66fd73-8d6b-41d8-b6b8-daec7d6c0c53"/>
+          </constraints>
         </column>
         <column id="80786549-dc2c-4c1c-bcbd-9f6fdec911d2">
           <name>SAL</name>
@@ -104,9 +102,9 @@
               <scale>2</scale>
             </adapter>
           </dataType>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
+          <constraints>
+            <notNull id="a446779a-4fb6-4a0f-8262-22daae856e85"/>
+          </constraints>
         </column>
         <column id="4ae69b7a-7a0e-422a-89dc-0f0cff77565b">
           <name>DEPT_ID</name>
@@ -114,18 +112,15 @@
             <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
+          <constraints>
+            <notNull id="b9a0fdce-a965-4118-ae71-5dc7150f6d4e"/>
+          </constraints>
         </column>
         <primaryKey id="6145e6a0-9ff7-4033-999d-99d80392a48f">
           <name>emp_pkey</name>
           <columnRefs>
             <columnRef ref="44c8e93d-b7ad-46cc-9b29-88c3a7d6c33e"/>
           </columnRefs>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </primaryKey>
         <foreignKey id="e43d3c43-33c8-4b02-aa42-83f2d868cfe6">
           <name>emp_mgr_id_fkey</name>
@@ -140,9 +135,6 @@
             <initiallyCheckTime>DEFERRED</initiallyCheckTime>
           </deferrability>
           <onDelete>SET_NULL</onDelete>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </foreignKey>
         <foreignKey id="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed">
           <name>emp_dept_id_fkey</name>
@@ -152,44 +144,8 @@
           <referenceColumns>
             <columnRef ref="c7ed225d-92a6-4cc2-90de-60531804464e"/>
           </referenceColumns>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </foreignKey>
-        <notNull id="05ee4c06-d8b5-4599-a7e9-1cda036ea2c7">
-          <columnRef ref="248a429b-2159-4ebd-a791-eee42a059374"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
-        <notNull id="41f178b9-2cb5-4dad-a6c0-48df2d5b1300">
-          <columnRef ref="0e51b6df-43ab-408c-90ef-de13c6aab881"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
-        <notNull id="2d66fd73-8d6b-41d8-b6b8-daec7d6c0c53">
-          <columnRef ref="f0b57eed-98ab-4c21-9855-218c592814dc"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
-        <notNull id="a446779a-4fb6-4a0f-8262-22daae856e85">
-          <columnRef ref="80786549-dc2c-4c1c-bcbd-9f6fdec911d2"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
-        <notNull id="b9a0fdce-a965-4118-ae71-5dc7150f6d4e">
-          <columnRef ref="4ae69b7a-7a0e-422a-89dc-0f0cff77565b"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
       </attributes>
-      <adapter class="org.jiemamy.utils.DisablableImpl">
-        <disabled>false</disabled>
-      </adapter>
     </table>
     <table id="d7489ed6-0add-443d-95cf-234376eb0455">
       <name>T_DEPT</name>
@@ -200,9 +156,6 @@
           <name>ID</name>
           <logicalName>部署ID</logicalName>
           <dataType ref="2eec0aa0-5122-4eb7-833d-9f5a43e7abe9"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </column>
         <column id="2d951389-6bc7-49d7-8631-1d26fe17047e">
           <name>DEPT_NO</name>
@@ -211,9 +164,9 @@
             <typeCategory>INTEGER</typeCategory>
             <typeName>INTEGER</typeName>
           </dataType>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
+          <constraints>
+            <notNull id="cc709f63-a886-4207-a316-58ad7f279e10"/>
+          </constraints>
         </column>
         <column id="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9">
           <name>DEPT_NAME</name>
@@ -225,12 +178,12 @@
               <size>20</size>
             </adapter>
           </dataType>
+          <constraints>
+            <notNull id="fab2f883-0489-4661-bd57-f04286188eef"/>
+          </constraints>
           <adapter class="org.jiemamy.model.attribute.RepresentationAdapter">
             <representation>true</representation>
           </adapter>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </column>
         <column id="7bf79e76-07b8-43b6-a993-b8ef374a31f5">
           <name>LOC</name>
@@ -243,43 +196,19 @@
             </adapter>
           </dataType>
           <defaultValue>secret</defaultValue>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </column>
         <primaryKey id="8de55e65-ec48-467a-bac5-8eee2d71d41c">
           <name>dept_pkey</name>
           <columnRefs>
             <columnRef ref="c7ed225d-92a6-4cc2-90de-60531804464e"/>
           </columnRefs>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
         </primaryKey>
-        <notNull id="cc709f63-a886-4207-a316-58ad7f279e10">
-          <columnRef ref="2d951389-6bc7-49d7-8631-1d26fe17047e"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
-        <notNull id="fab2f883-0489-4661-bd57-f04286188eef">
-          <columnRef ref="1fcd63d3-974e-4d2e-a0d8-3b9c233104d9"/>
-          <adapter class="org.jiemamy.utils.DisablableImpl">
-            <disabled>false</disabled>
-          </adapter>
-        </notNull>
       </attributes>
-      <adapter class="org.jiemamy.utils.DisablableImpl">
-        <disabled>false</disabled>
-      </adapter>
     </table>
     <view id="516f7961-cb7b-48e2-990b-7fb0c750c3a4">
       <name>V_HIGH_SAL_EMP</name>
       <logicalName>高給取り</logicalName>
       <definition>SELECT * FROM T_EMP WHERE SAL &gt; 2000;</definition>
-      <adapter class="org.jiemamy.utils.DisablableImpl">
-        <disabled>false</disabled>
-      </adapter>
     </view>
   </entities>
   <dataSets>



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