[Jiemamy-notify] commit [2023] ApplicationModelCreatorが動くように色々修正。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 10月 23日 (木) 02:03:17 JST


Revision: 2023
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2023
Author:   daisuke_m
Date:     2008-10-23 02:03:17 +0900 (Thu, 23 Oct 2008)

Log Message:
-----------
ApplicationModelCreatorが動くように色々修正。

Modified Paths:
--------------
    artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java
    artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyMappingImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyModelImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java
    artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/connection/foreignkey/UpdateMappingsProcessor.java
    artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon
    artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java
    artemis/trunk/org.jiemamy.serializer/src/main/java/com/megginson/sax/DataWriter.java
    zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java
    zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/JiemamyProperty.java


-------------- next part --------------
Modified: artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java
===================================================================
--- artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -69,7 +69,7 @@
 			Dialect dialect = ctx.getValue(DIALECT);
 			
 			// FIXME ひとまずStabで。完成し次第 JiemamyInterpreterImpl に置換。
-			JiemamyInterpreter interpreter = new JiemamyInterpreterStab(dialect, ctx); // THINK DI?
+			JiemamyInterpreter interpreter = new JiemamyInterpreterStab(dialect, ctx);
 			String sql = interpreter.interpret(rootModel);
 			writer = new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8");
 			writer.write(sql);

Modified: artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java
===================================================================
--- artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -235,9 +235,10 @@
 						rootModel.appendModel(fkModel);
 					}
 					
-					ForeignKeyMapping mapping = rootModel.createJiemamyModel(ForeignKeyMapping.class).init();
+					ForeignKeyMapping mapping =
+							rootModel.createJiemamyModel(ForeignKeyMapping.class).init(target.getColumn(pkColumnName));
 					mapping.setConstraintColumn(source.getColumn(fkColumnName));
-					mapping.setReferenceColumn(target.getColumn(pkColumnName));
+//					mapping.setReferenceColumn(target.getColumn(pkColumnName));
 					
 					fkModel.setName(fkName);
 					fkModel.getMappings().add(mapping);

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyMappingImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyMappingImpl.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyMappingImpl.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -62,8 +62,9 @@
 	/**
 	 * {@inheritDoc}
 	 */
-	public ForeignKeyMapping init() {
+	public ForeignKeyMapping init(ColumnModel referenceColumn) {
 		initialize();
+		this.referenceColumn = referenceColumn;
 		return this;
 	}
 	

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyModelImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyModelImpl.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/ForeignKeyModelImpl.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -114,7 +114,7 @@
 		TableModel tableModel = (TableModel) getTarget();
 		List<ColumnModel> referencePkColumns = tableModel.getPrimaryKeyColumns();
 		for (ColumnModel referencePkColumn : referencePkColumns) {
-			ForeignKeyMapping mapping = rootModel.createJiemamyModel(ForeignKeyMapping.class).init();
+			ForeignKeyMapping mapping = rootModel.createJiemamyModel(ForeignKeyMapping.class).init(referencePkColumn);
 			mapping.setDefaultColumns(rootModel, (TableModel) getSource(), referencePkColumn, createColumn);
 			mappings.add(mapping);
 		}

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/constraint/ConstraintSetModelImpl.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -77,7 +77,12 @@
 	 * {@inheritDoc}
 	 */
 	public boolean has(Class<? extends Constraint> constraintClass) {
-		return constraintMap.containsKey(constraintClass);
+		for (Map.Entry<Class<? extends Constraint>, Constraint> e : constraintMap.entrySet()) {
+			if (constraintClass.isAssignableFrom(e.getValue().getClass())) {
+				return true;
+			}
+		}
+		return false;
 	}
 	
 	/**

Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/connection/foreignkey/UpdateMappingsProcessor.java
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/connection/foreignkey/UpdateMappingsProcessor.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/connection/foreignkey/UpdateMappingsProcessor.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -78,7 +78,8 @@
 			try {
 				fkModel.getMapping(referencePkColumn);
 			} catch (ElementNotFoundException e) {
-				ForeignKeyMapping mapping = rootModel.createJiemamyModel(ForeignKeyMapping.class).init();
+				ForeignKeyMapping mapping =
+						rootModel.createJiemamyModel(ForeignKeyMapping.class).init(referencePkColumn);
 				mapping.setDefaultColumns(rootModel, sourceTable, referencePkColumn, createColumnWithFk);
 				additionalMappings.add(mapping);
 			}

Modified: artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon
===================================================================
--- artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon	2008-10-22 17:03:17 UTC (rev 2023)
@@ -21,7 +21,7 @@
 	<component class="org.jiemamy.core.model.node.ViewModelImpl" instance="prototype"/>
 	<component class="org.jiemamy.core.model.node.StickyModelImpl" instance="prototype"/>
 	<component class="org.jiemamy.core.model.connection.ForeignKeyModelImpl" instance="prototype" autoBinding="none"/>
-	<component class="org.jiemamy.core.model.connection.ForeignKeyMappingImpl" instance="prototype"/>
+	<component class="org.jiemamy.core.model.connection.ForeignKeyMappingImpl" instance="prototype" autoBinding="none"/>
 	<component class="org.jiemamy.core.model.DomainModelImpl" instance="prototype" autoBinding="none"/>
 	<component class="org.jiemamy.core.model.dataset.InsertDataSetModelImpl" instance="prototype"/>
 	<component class="org.jiemamy.core.model.node.TableModelImpl" instance="prototype"/>

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -10,6 +10,7 @@
 import org.jiemamy.core.utils.processor.entity.table.GetColumnProcessor;
 import org.jiemamy.core.utils.processor.root.SetRecordProcessor;
 import org.jiemamy.creator.JiemamyModelFactory;
+import org.jiemamy.spec.exception.ElementNotFoundException;
 import org.jiemamy.spec.exception.JiemamyRuntimeException;
 import org.jiemamy.spec.exception.TooManyElementsException;
 import org.jiemamy.spec.model.ColumnModel;
@@ -458,12 +459,12 @@
 				rootModel.createJiemamyModel(ColumnModel.class).init("EMP_NO", new IntegerDataTypeMock());
 		empTable.getColumns().add(noColumn);
 		noColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init());
-		idColumn.setLogicalName("従業員番号");
+		noColumn.setLogicalName("従業員番号");
 		
 		ColumnModel nameColumn = rootModel.createJiemamyModel(ColumnModel.class).init("EMP_NAME", nameDomain);
 		empTable.getColumns().add(nameColumn);
 		nameColumn.addConstraint(rootModel.createJiemamyModel(NotNullConstraintModel.class).init());
-		idColumn.setLogicalName("従業員名");
+		nameColumn.setLogicalName("従業員名");
 		nameColumn.setDefaultValue("no name");
 		nameColumn.setSimpleIndex(true);
 		nameColumn.setRepresentation(true);
@@ -504,12 +505,16 @@
 		};
 		
 		ForeignKeyModel fk = rootModel.createJiemamyModel(ForeignKeyModel.class).init(rootModel, source, target);
+		fk.createMappings(rootModel, false);
 		for (int i = 0; i < sourceColumnNames.length; i++) {
 			try {
 				ColumnModel constraintColumn = source.getColumn(sourceColumnNames[i]);
 				fk.getMappings().get(i).setConstraintColumn(constraintColumn);
+				break;
 			} catch (TooManyElementsException e) {
 				throw new JiemamyRuntimeException("test code error", e);
+			} catch (ElementNotFoundException e) {
+				// ignore
 			}
 		}
 		

Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/com/megginson/sax/DataWriter.java
===================================================================
--- artemis/trunk/org.jiemamy.serializer/src/main/java/com/megginson/sax/DataWriter.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ artemis/trunk/org.jiemamy.serializer/src/main/java/com/megginson/sax/DataWriter.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -52,7 +52,6 @@
  *
  * <pre>
  * &lt;?xml version="1.0" standalone="yes"?>
- *
  * &lt;Person>
  *   &lt;name>Jane Smith&lt;/name>
  *   &lt;date-of-birth>1965-05-23&lt;/date-of-birth>

Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -45,7 +45,7 @@
 	 * モデルの初期化を行う。
 	 * @return 自モデル
 	 */
-	ForeignKeyMapping init();
+	ForeignKeyMapping init(ColumnModel referenceColumn);
 	
 	/**
 	 * 制約を受けるカラムを設定する。

Modified: zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/JiemamyProperty.java
===================================================================
--- zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/JiemamyProperty.java	2008-10-22 16:11:30 UTC (rev 2022)
+++ zeus/trunk/org.jiemamy.spec.event/src/main/java/org/jiemamy/spec/event/JiemamyProperty.java	2008-10-22 17:03:17 UTC (rev 2023)
@@ -32,6 +32,10 @@
 		source, target
 	}
 	
+	public enum DiagramPresentationProperty {
+		name, displayTargetSet, nodeLayouts, nodeColors, connectionLayouts,
+	}
+	
 	public enum EntityProperty implements JiemamyProperty {
 		name, logicalName, beginScript, endScript, description, disabled
 	}


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