svnno****@sourc*****
svnno****@sourc*****
2008年 10月 23日 (木) 00:58:15 JST
Revision: 2021 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2021 Author: daisuke_m Date: 2008-10-23 00:58:15 +0900 (Thu, 23 Oct 2008) Log Message: ----------- 制約モデルの生成方法が間違っていたので修正。 Modified Paths: -------------- artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java 2008-10-22 15:54:05 UTC (rev 2020) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java 2008-10-22 15:58:15 UTC (rev 2021) @@ -2,9 +2,6 @@ import java.util.List; import org.jiemamy.core.S2FactoryStrategy; -import org.jiemamy.core.model.constraint.NotNullConstraintModelImpl; -import org.jiemamy.core.model.constraint.PrimaryKeyConstraintModelImpl; -import org.jiemamy.core.model.constraint.UniqueConstraintModel; import org.jiemamy.core.model.dataset.RecordModelImpl; import org.jiemamy.core.model.typedef.datatype.impl.IntegerDataTypeMock; import org.jiemamy.core.model.typedef.datatype.impl.NumericDataTypeMock; @@ -21,6 +18,9 @@ import org.jiemamy.spec.model.connection.ForeignKeyModel; import org.jiemamy.spec.model.connection.ForeignKeyModel.InitiallyCheckTime; import org.jiemamy.spec.model.connection.ForeignKeyModel.ReferentialAction; +import org.jiemamy.spec.model.constraint.NotNullConstraintModel; +import org.jiemamy.spec.model.constraint.PrimaryKeyConstraintModel; +import org.jiemamy.spec.model.constraint.UniqueConstraintModel; import org.jiemamy.spec.model.dataset.RecordModel; import org.jiemamy.spec.model.node.StickyModel; import org.jiemamy.spec.model.node.TableModel; @@ -59,8 +59,8 @@ DomainModel idDomain = rootModel.createJiemamyModel(DomainModel.class).init("ID", new IntegerDataTypeMock()); rootModel.appendModel(idDomain); - idDomain.addConstraint(new NotNullConstraintModelImpl()); - idDomain.addConstraint(new UniqueConstraintModel("UNIQUE_CONSTTRAINT_ID")); + idDomain.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init()); + idDomain.addConstraint(rootModel.createJiemamyModel(UniqueConstraintModel.class).init()); // TODO AUTO_INCREMENTの追加 [CORE-21] DomainModel nameDomain = @@ -226,7 +226,7 @@ ColumnModel idColumn = rootModel.createJiemamyModel(ColumnModel.class).init("ID", idDomain); deptTable.getColumns().add(idColumn); - idColumn.addConstraint(new PrimaryKeyConstraintModelImpl()); + idColumn.addConstraint(rootModel.createJiemamyModel(PrimaryKeyConstraintModel.class).init()); idColumn.setLogicalName("部署ID"); ColumnModel noColumn = @@ -447,18 +447,18 @@ ColumnModel idColumn = rootModel.createJiemamyModel(ColumnModel.class).init("ID", idDomain); empTable.getColumns().add(idColumn); - idColumn.addConstraint(new PrimaryKeyConstraintModelImpl()); + idColumn.addConstraint(rootModel.createJiemamyModel(PrimaryKeyConstraintModel.class).init()); idColumn.setLogicalName("従業員ID"); ColumnModel noColumn = rootModel.createJiemamyModel(ColumnModel.class).init("EMP_NO", new IntegerDataTypeMock()); empTable.getColumns().add(noColumn); - noColumn.addConstraint(new NotNullConstraintModelImpl()); + noColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init()); idColumn.setLogicalName("従業員番号"); ColumnModel nameColumn = rootModel.createJiemamyModel(ColumnModel.class).init("EMP_NAME", nameDomain); empTable.getColumns().add(nameColumn); - nameColumn.addConstraint(new NotNullConstraintModelImpl()); + nameColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init()); idColumn.setLogicalName("従業員名"); nameColumn.setDefaultValue("no name"); nameColumn.setSimpleIndex(true); @@ -469,17 +469,17 @@ ColumnModel hireColumn = rootModel.createJiemamyModel(ColumnModel.class).init("HIREDATE", new TimestampDataTypeMock()); empTable.getColumns().add(hireColumn); - hireColumn.addConstraint(new NotNullConstraintModelImpl()); + hireColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init()); ColumnModel salColumn = rootModel.createJiemamyModel(ColumnModel.class).init("SAL", new NumericDataTypeMock(7, 2)); empTable.getColumns().add(salColumn); - salColumn.addConstraint(new NotNullConstraintModelImpl()); + salColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init()); ColumnModel deptColumn = rootModel.createJiemamyModel(ColumnModel.class).init("DEPT_ID", new IntegerDataTypeMock()); empTable.getColumns().add(deptColumn); - deptColumn.addConstraint(new NotNullConstraintModelImpl()); + deptColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init()); return empTable; }