svnno****@sourc*****
svnno****@sourc*****
2009年 3月 3日 (火) 19:11:19 JST
Revision: 2790 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2790 Author: daisuke_m Date: 2009-03-03 19:11:19 +0900 (Tue, 03 Mar 2009) Log Message: ----------- XMLのルート要素を rootModel から jiemamy に変更。 / コントローラとダイアログのつなぎを整備。 / Versionインターフェイスを追加。 / facade save/rollbackのテストケースだけ書いた。 / refactor / javadoc Modified Paths: -------------- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/JiemamySerializerTest.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReader.java artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/Artemis.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddBendpointCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionViewCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeViewCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteBendpointCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java sandbox/jiemamy-stax/src/main/java/org/jiemamy/command/ObjectCommandDestination.java sandbox/jiemamy-stax/src/main/java/org/jiemamy/internal/command/RootModelCommand.java sandbox/jiemamy-stax/src/main/java/org/jiemamy/utils/ResolvableQueue.java sandbox/jiemamy-stax/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java 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/table/TableEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Jiemamy.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyImplementation.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.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 zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java Added Paths: ----------- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DialogEditCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/Messages.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Version.java zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/VersionTest.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java Removed Paths: ------------- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/Memento.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/JiemamySerializerTest.java =================================================================== --- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/JiemamySerializerTest.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/JiemamySerializerTest.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -60,7 +60,7 @@ */ public abstract class JiemamySerializerTest { - private static final String XPATH_T_DEPT = "/rootModel/entities/table[@id='d7489ed6-0add-443d-95cf-234376eb0455']"; + private static final String XPATH_T_DEPT = "/jiemamy/entities/table[@id='d7489ed6-0add-443d-95cf-234376eb0455']"; private static final String XPATH_T_DEPT_COLUMNS = XPATH_T_DEPT + "/attributes/column"; @@ -105,21 +105,21 @@ Document document = documentBuilder.parse(new ByteArrayInputStream(result.getBytes(CharEncoding.UTF_8))); // RootModel基本プロパティのチェック - assertThat(document, hasXPath("/rootModel/dialect", is("org.jiemamy.dialect.mysql.MySqlDialect"))); - assertThat(document, hasXPath("/rootModel/schemaName", is("FOO"))); - assertThat(document, hasXPath("/rootModel/beginScript", is("BEGIN;"))); - assertThat(document, hasXPath("/rootModel/endScript", is("COMMIT;"))); - assertThat(document, hasXPath("/rootModel/description", is("Jiemamyテストモデル1"))); + assertThat(document, hasXPath("/jiemamy/dialect", is("org.jiemamy.dialect.mysql.MySqlDialect"))); + assertThat(document, hasXPath("/jiemamy/schemaName", is("FOO"))); + assertThat(document, hasXPath("/jiemamy/beginScript", is("BEGIN;"))); + assertThat(document, hasXPath("/jiemamy/endScript", is("COMMIT;"))); + assertThat(document, hasXPath("/jiemamy/description", is("Jiemamyテストモデル1"))); NodeList domainNodes = - (NodeList) XpathUtil.XPATH.evaluate("/rootModel/domains/domain", document, XPathConstants.NODESET); + (NodeList) XpathUtil.XPATH.evaluate("/jiemamy/domains/domain", document, XPathConstants.NODESET); assertThat(domainNodes.getLength(), is(2)); - assertThat(document, hasXPath("/rootModel/domains/domain[1]/@id", is(mb.domainId.getId().toString()))); - assertThat(document, hasXPath("/rootModel/domains/domain[2]/@id", is(mb.domainName.getId().toString()))); + assertThat(document, hasXPath("/jiemamy/domains/domain[1]/@id", is(mb.domainId.getId().toString()))); + assertThat(document, hasXPath("/jiemamy/domains/domain[2]/@id", is(mb.domainName.getId().toString()))); // テーブルのチェック NodeList tableNodes = - (NodeList) XpathUtil.XPATH.evaluate("/rootModel/entities/table", document, XPathConstants.NODESET); + (NodeList) XpathUtil.XPATH.evaluate("/jiemamy/entities/table", document, XPathConstants.NODESET); assertThat(tableNodes.getLength(), is(2)); assertThat(document, hasXPath(XPATH_T_DEPT + "/name", is("T_DEPT"))); @@ -128,10 +128,10 @@ assertThat(columnNodes.getLength(), is(4)); NodeList viewNodes = - (NodeList) XpathUtil.XPATH.evaluate("/rootModel/entities/view", document, XPathConstants.NODESET); + (NodeList) XpathUtil.XPATH.evaluate("/jiemamy/entities/view", document, XPathConstants.NODESET); assertThat(viewNodes.getLength(), is(1)); - assertThat(document, hasXPath("/rootModel/entities/view/@id", is("516f7961-cb7b-48e2-990b-7fb0c750c3a4"))); - assertThat(document, hasXPath("/rootModel/entities/view/name", is("V_HIGH_SAL_EMP"))); + assertThat(document, hasXPath("/jiemamy/entities/view/@id", is("516f7961-cb7b-48e2-990b-7fb0c750c3a4"))); + assertThat(document, hasXPath("/jiemamy/entities/view/name", is("V_HIGH_SAL_EMP"))); // 参考のため、targetディレクトリに出力XMLを記録 FileUtils.writeStringToFile(new File("./target/" + ClassUtils.getShortClassName(this, "null") + "_out.xml"), Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/HtmlExporter.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -31,24 +31,24 @@ */ public class HtmlExporter implements Exporter<HtmlExportConfig> { - /** ContextKey: オーバーライトするかどうか (Boolean) */ + /** ConfigKey: オーバーライトするかどうか (Boolean) */ public static final String OVERWRITE = "overwrite"; - /** ContextKey: 出力先ディレクトリ (File) */ + /** ConfigKey: 出力先ディレクトリ (File) */ public static final String OUTPUT_DIR = "outputDir"; - /** ContextKey: SQL方言 (Dialect) */ + /** ConfigKey: SQL方言 (Dialect) */ public static final String DIALECT = "dialect"; - public boolean exportModel(RootModel rootModel, HtmlExportConfig ctx) throws ExportException { + public boolean exportModel(RootModel rootModel, HtmlExportConfig config) throws ExportException { Validate.notNull(rootModel); - Validate.notNull(ctx); - Validate.notNull(ctx.getOutputFile()); + Validate.notNull(config); + Validate.notNull(config.getOutputFile()); - File outputDir = ctx.getOutputFile(); + File outputDir = config.getOutputFile(); if (outputDir.exists()) { - if (ctx.isOverwrite() == false) { + if (config.isOverwrite() == false) { return false; } Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/exporter/SqlExporter.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -46,10 +46,10 @@ */ public class SqlExporter implements Exporter<SqlExportConfig> { - /** ContextKey: オーバーライトするかどうか (Boolean) */ + /** ConfigKey: オーバーライトするかどうか (Boolean) */ public static final String OVERWRITE = "overwrite"; - /** ContextKey: 出力ファイル名 (String) */ + /** ConfigKey: 出力ファイル名 (String) */ public static final String OUTPUT_FILE = "outputFile"; Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -60,36 +60,36 @@ * * @author daisuke */ -public class DatabaseImporter implements Importer<DefaultDatabaseImportConfig> { +public class DatabaseImporter implements Importer<DatabaseImportConfig> { - /** ContextKey: SQL方言 (Dialect) */ + /** ConfigKey: SQL方言 (Dialect) */ public static final String DIALECT = "dialect"; - /** ContextKey: データベース名 (String) */ + /** ConfigKey: データベース名 (String) */ public static final String DATABASE_NAME = "databaseName"; - /** ContextKey: ドライバJARファイルのURL (URL[]) */ + /** ConfigKey: ドライバJARファイルのURL (URL[]) */ public static final String DRIVER_JAR_PATH = "driverJarPath"; - /** ContextKey: ドライバの完全修飾クラス名 (String) */ + /** ConfigKey: ドライバの完全修飾クラス名 (String) */ public static final String DRIVER_CLASS_NAME = "driverClassName"; - /** ContextKey: DB接続URI (String) */ + /** ConfigKey: DB接続URI (String) */ public static final String URI = "uri"; - /** ContextKey: DB接続スキーマ名 (String) */ + /** ConfigKey: DB接続スキーマ名 (String) */ public static final String SCHEMA = "schema"; - /** ContextKey: DB接続username (String) */ + /** ConfigKey: DB接続username (String) */ public static final String USERNAME = "username"; - /** ContextKey: DB接続password (String) */ + /** ConfigKey: DB接続password (String) */ public static final String PASSWORD = "password"; - /** ContextKey: importするエンティティ名 (String[]) */ + /** ConfigKey: importするエンティティ名 (String[]) */ public static final String SELECTED_ENTITIES = "selectedEntities"; - /** ContextKey: importするエンティティの種類 (String[]) */ + /** ConfigKey: importするエンティティの種類 (String[]) */ public static final String ENTITY_TYPES = "entityTypes"; /** SQL方言 */ @@ -100,33 +100,33 @@ return "Database Importer"; } - public boolean importModel(RootModel rootModel, DefaultDatabaseImportConfig ctx) throws ImportException { + public boolean importModel(RootModel rootModel, DatabaseImportConfig config) throws ImportException { Validate.notNull(rootModel); - Validate.notNull(ctx); + Validate.notNull(config); Connection connection = null; try { - dialect = ctx.getDialect(); + dialect = config.getDialect(); if (dialect instanceof GenericDialect) { throw new GenericModelingModeException(); } Properties props = new Properties(); - props.setProperty("user", ctx.getUsername()); - props.setProperty("password", ctx.getPassword()); + props.setProperty("user", config.getUsername()); + props.setProperty("password", config.getPassword()); - URL[] paths = ctx.getDriverJarPath(); - String className = ctx.getDriverClassName(); + URL[] paths = config.getDriverJarPath(); + String className = config.getDriverClassName(); Driver driver = DriverUtil.getDriverInstance(paths, className); - connection = driver.connect(ctx.getUri(), props); + connection = driver.connect(config.getUri(), props); DatabaseMetaData meta = connection.getMetaData(); // 詰め替え - DatabaseReader reader = new DatabaseReader(dialect, ctx, meta); + DatabaseReader reader = new DatabaseReader(dialect, config, meta); dialect.getAdvisor().setUpRead(connection); - reader.readEnities(new EntityImportVisitor(meta, rootModel, ctx)); - reader.readRelations(new RelationImportVisitor(meta, rootModel, ctx)); + reader.readEnities(new EntityImportVisitor(meta, rootModel, config)); + reader.readRelations(new RelationImportVisitor(meta, rootModel, config)); dialect.getAdvisor().tearDownRead(connection); } catch (GenericModelingModeException e) { throw new ImportException(e); Modified: artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReader.java =================================================================== --- artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReader.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-composer/src/main/java/org/jiemamy/composer/importer/DatabaseReader.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -51,7 +51,7 @@ private final Dialect dialect; - private final DatabaseImportConfig ctx; + private final DatabaseImportConfig config; private final DatabaseMetaData meta; @@ -60,15 +60,15 @@ * インスタンスを生成する。 * * @param dialect SQL方言 - * @param ctx コンテキスト情報 + * @param config コンテキスト情報 * @param meta DBメタデータ */ - public DatabaseReader(Dialect dialect, DatabaseImportConfig ctx, DatabaseMetaData meta) { + public DatabaseReader(Dialect dialect, DatabaseImportConfig config, DatabaseMetaData meta) { Validate.notNull(dialect); - Validate.notNull(ctx); + Validate.notNull(config); Validate.notNull(meta); this.dialect = dialect; - this.ctx = ctx; + this.config = config; this.meta = meta; } @@ -83,11 +83,11 @@ */ public <T>T readEnities(AbstractResultSetVisitor<T, RuntimeException> visitor) throws SQLException { assert dialect != null; - assert ctx != null; + assert config != null; assert meta != null; Validate.notNull(visitor); - String schema = ctx.getSchema(); + String schema = config.getSchema(); ResultSet entities = meta.getTables(null, schema, "%", null); T result = ForEachUtil.accept(entities, visitor); @@ -106,11 +106,11 @@ */ public <T>List<T> readRelations(AbstractResultSetVisitor<T, RuntimeException> visitor) throws SQLException { assert dialect != null; - assert ctx != null; + assert config != null; assert meta != null; Validate.notNull(visitor); - String schema = ctx.getSchema(); + String schema = config.getSchema(); List<String> entityNames = readEnities(new EntityNamesVisitor()); Modified: artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java =================================================================== --- artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/exporter/SqlExporterTest.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -97,10 +97,10 @@ BufferedReader reader = null; try { - DefaultSqlExportConfig ctx = new DefaultSqlExportConfig(); - ctx.setOutputFile(outputFile); - ctx.setOverwrite(true); - exporter.exportModel(model, ctx); + DefaultSqlExportConfig config = new DefaultSqlExportConfig(); + config.setOutputFile(outputFile); + config.setOverwrite(true); + exporter.exportModel(model, config); assertThat(outputFile.exists(), is(true)); Modified: artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java =================================================================== --- artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-composer/src/test/java/org/jiemamy/composer/importer/DatabaseImporterTest.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -77,7 +77,7 @@ private static Logger logger = LoggerFactory.getLogger(DatabaseImporterTest.class); /** {@link DatabaseImporter} */ - public Importer<DefaultDatabaseImportConfig> importer = new DatabaseImporter(); + public Importer<DatabaseImportConfig> importer = new DatabaseImporter(); /** SQL方言 */ private Dialect dialect; @@ -126,9 +126,9 @@ @Test @Ignore("H2Dialectが無いとテストできない") public void test01_DBからのインポートテスト() throws Exception { - DefaultDatabaseImportConfig ctx = createConfig(); + DatabaseImportConfig config = createConfig(); logger.info("START import..."); - importer.importModel(rootModel, ctx); + importer.importModel(rootModel, config); logger.info("FINISH import."); // テスト用DBには、ノードが4つ、コネクションが5つあるはず @@ -202,38 +202,38 @@ * @return インポートコンテキスト情報 * @throws MalformedURLException */ - private DefaultDatabaseImportConfig createConfig() throws MalformedURLException { - DefaultDatabaseImportConfig ctx = new DefaultDatabaseImportConfig(); - ctx.setDialect(dialect); - ctx.setDatabaseName("jpoll"); - ctx.setDriverJarPath(new URL[] { + private DatabaseImportConfig createConfig() throws MalformedURLException { + DefaultDatabaseImportConfig config = new DefaultDatabaseImportConfig(); + config.setDialect(dialect); + config.setDatabaseName("jpoll"); + config.setDriverJarPath(new URL[] { new File("./src/test/resources/h2-1.1.102.jar").toURL() }); - ctx.setDriverClassName("org.h2.Driver"); - ctx.setUri("jdbc:h2:./src/test/resources/database/testdb"); - ctx.setSchema(""); - ctx.setUsername("sa"); - ctx.setPassword(""); - ctx.setSelectedEntities(null); - ctx.setEntityTypes(null); + config.setDriverClassName("org.h2.Driver"); + config.setUri("jdbc:h2:./src/test/resources/database/testdb"); + config.setSchema(""); + config.setUsername("sa"); + config.setPassword(""); + config.setSelectedEntities(null); + config.setEntityTypes(null); - return ctx; + return config; } -// private DefaultDatabaseImportConfig createConfig() throws MalformedURLException { -// ImportConfig ctx = new ImportConfigImpl(); -// ctx.setValue(DatabaseImporter.DIALECT, dialect); -// ctx.setValue(DatabaseImporter.DATABASE_NAME, "jpoll"); -// ctx.setValue(DatabaseImporter.DRIVER_JAR_PATH, new URL[] { +// private DatabaseImportConfig createConfig() throws MalformedURLException { +// ImportConfig config = new ImportConfigImpl(); +// config.setValue(DatabaseImporter.DIALECT, dialect); +// config.setValue(DatabaseImporter.DATABASE_NAME, "jpoll"); +// config.setValue(DatabaseImporter.DRIVER_JAR_PATH, new URL[] { // new File("./src/test/resources/postgresql-8.3-603.jdbc3.jar").toURL() // }); -// ctx.setValue(DatabaseImporter.DRIVER_CLASS_NAME, "org.postgresql.Driver"); -// ctx.setValue(DatabaseImporter.URI, "jdbc:postgresql://localhost/jpoll"); -// ctx.setValue(DatabaseImporter.SCHEMA, ""); -// ctx.setValue(DatabaseImporter.USERNAME, "postgres"); -// ctx.setValue(DatabaseImporter.PASSWORD, "postgres"); -// ctx.setValue(DatabaseImporter.SELECTED_ENTITIES, null); -// ctx.setValue(DatabaseImporter.ENTITY_TYPES, null); -// return ctx; +// config.setValue(DatabaseImporter.DRIVER_CLASS_NAME, "org.postgresql.Driver"); +// config.setValue(DatabaseImporter.URI, "jdbc:postgresql://localhost/jpoll"); +// config.setValue(DatabaseImporter.SCHEMA, ""); +// config.setValue(DatabaseImporter.USERNAME, "postgres"); +// config.setValue(DatabaseImporter.PASSWORD, "postgres"); +// config.setValue(DatabaseImporter.SELECTED_ENTITIES, null); +// config.setValue(DatabaseImporter.ENTITY_TYPES, null); +// return config; // } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/Artemis.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/Artemis.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/Artemis.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -140,4 +140,51 @@ return supportedSpecs; } + public Version getVersion() { + return ArtemisVersion.INSTANCE; + } + + + private static class ArtemisVersion implements Version { + + static final ArtemisVersion INSTANCE = new ArtemisVersion(); + + private final int release = 0; + + private final boolean snapshotImplementation = true; + + + private ArtemisVersion() { + } + + public int getMajor() { + return major; + } + + public int getMinor() { + return minor; + } + + public int getRelease() { + return release; + } + + public boolean isSnapshot() { + return snapshot || snapshotImplementation; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(major); + sb.append("."); + sb.append(minor); + sb.append("."); + sb.append(release); + if (snapshot || snapshotImplementation) { + sb.append("-SNAPSHOT"); + } + return sb.toString(); + } + } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomBuilder.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomBuilder.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -80,6 +80,7 @@ import org.w3c.dom.Element; import org.jiemamy.ReferenceResolver; +import org.jiemamy.Version; import org.jiemamy.exception.UnexpectedConditionError; import org.jiemamy.model.Adapter; import org.jiemamy.model.AdapterType; @@ -258,8 +259,9 @@ DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.newDocument(); - Element rootElement = DomUtil.newElement(document, CoreQName.ROOT_MODEL); + Element rootElement = DomUtil.newElement(document, CoreQName.JIEMAMY); rootElement.setAttribute(CoreQName.ID.getQNameString(), rootModel.getId().toString()); + rootElement.setAttribute(CoreQName.VERSION.getQNameString(), Version.SPEC); // FIXME 正式なバージョンに rootElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); // FIXME locationを正式なURLに rootElement.setAttribute("xsi:schemaLocation", "" Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -40,6 +40,7 @@ import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; +import org.jiemamy.Version; import org.jiemamy.dialect.BuiltinDataTypeMoldImpl; import org.jiemamy.dialect.Dialect; import org.jiemamy.dialect.Dialect.BuiltinDataTypeMold; @@ -179,8 +180,9 @@ /** * DOMを解析し、{@link RootModel}を生成する。 * @return 生成した{@link RootModel} + * @throws SerializationException */ - public RootModel parse() { + public RootModel parse() throws SerializationException { RootModel rootModel = parseRoot(); parseDomainSection(rootModel); parseEntitiesSection(rootModel); @@ -312,7 +314,7 @@ } private void parseDataSetSection(RootModel rootModel) { - NodeList dataSetNodeList = XpathUtil.getNodes(document, "/core:rootModel/core:dataSets/core:dataSet"); + NodeList dataSetNodeList = XpathUtil.getNodes(document, "/core:jiemamy/core:dataSets/core:dataSet"); Iterable<Node> dataSetIterableNodeList = new IterableNodeList(dataSetNodeList); for (Node dataSetNode : dataSetIterableNodeList) { @@ -371,7 +373,7 @@ } private void parseDomainSection(RootModel rootModel) { - NodeList domainsNodeList = XpathUtil.getNodes(document, "/core:rootModel/core:domains/core:domain"); + NodeList domainsNodeList = XpathUtil.getNodes(document, "/core:jiemamy/core:domains/core:domain"); Iterable<Node> domainsIterableNodeList = new IterableNodeList(domainsNodeList); for (Node domainNode : domainsIterableNodeList) { DomainModel domainModel = factory.newModel(DomainModel.class, DomUtil.getUUID(domainNode, CoreQName.ID)); @@ -409,7 +411,7 @@ } private void parseEntitiesSection(RootModel rootModel) { - NodeList entitityNodeList = XpathUtil.getNodes(document, "/core:rootModel/core:entities/*"); + NodeList entitityNodeList = XpathUtil.getNodes(document, "/core:jiemamy/core:entities/*"); Iterable<Node> entitityIterableNodeList = new IterableNodeList(entitityNodeList); for (Node entityNode : entitityIterableNodeList) { if ((entityNode instanceof Element) == false) { @@ -483,15 +485,19 @@ tableModel.getAttributes().add(pkModel); } - private RootModel parseRoot() { + private RootModel parseRoot() throws SerializationException { Element rootElement = document.getDocumentElement(); + String version = XpathUtil.getAttr(document, "/core:jiemamy/@version").getValue(); + if (Version.SPEC.equals(version) == false) { + throw new SerializationException("Version mismatch: serializer=" + Version.SPEC + ", xml=" + version); + } RootModel rootModel = factory.getRootModel(DomUtil.getUUID(rootElement, CoreQName.ID)); - rootModel.setDialectClassName(XpathUtil.getTextContent(document, "/core:rootModel/core:dialect")); - rootModel.setSchemaName(XpathUtil.getTextContent(document, "/core:rootModel/core:schemaName")); - rootModel.setBeginScript(XpathUtil.getTextContent(document, "/core:rootModel/core:beginScript")); - rootModel.setEndScript(XpathUtil.getTextContent(document, "/core:rootModel/core:endScript")); - rootModel.setDescription(XpathUtil.getTextContent(document, "/core:rootModel/core:description")); + rootModel.setDialectClassName(XpathUtil.getTextContent(document, "/core:jiemamy/core:dialect")); + rootModel.setSchemaName(XpathUtil.getTextContent(document, "/core:jiemamy/core:schemaName")); + rootModel.setBeginScript(XpathUtil.getTextContent(document, "/core:jiemamy/core:beginScript")); + rootModel.setEndScript(XpathUtil.getTextContent(document, "/core:jiemamy/core:endScript")); + rootModel.setDescription(XpathUtil.getTextContent(document, "/core:jiemamy/core:description")); return rootModel; } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -187,8 +187,9 @@ * * @param document DOMドキュメント * @return {@link RootModel} + * @throws SerializationException */ - protected RootModel toRootModel(Document document) { + protected RootModel toRootModel(Document document) throws SerializationException { return new JiemamyDomParser(jiemamy, document).parse(); } Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/facade/JiemamyFacadeImplTest.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -21,11 +21,14 @@ import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; +import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; -import org.jiemamy.Artemis; import org.jiemamy.Jiemamy; +import org.jiemamy.JiemamyFactory; +import org.jiemamy.JiemamyProperty.EntityProperty; import org.jiemamy.model.RootModel; import org.jiemamy.model.entity.TableModel; @@ -42,15 +45,28 @@ /** + * テストを初期化する。 * + * @throws Exception 例外が発生した場合 */ @Before - public void setUp() { - jiemamy = Jiemamy.newInstance(new Artemis()); + public void setUp() throws Exception { + jiemamy = Jiemamy.newInstance(); coreFacade = new JiemamyFacadeImpl(jiemamy); } /** + * テストの情報を破棄する。 + * + * @throws Exception 例外が発生した場合 + */ + @After + public void tearDown() throws Exception { + jiemamy = null; + coreFacade = null; + } + + /** * {@link JiemamyFacadeImpl#addEntity(org.jiemamy.model.entity.EntityModel)}のテスト。 */ @Test @@ -70,4 +86,115 @@ assertThat(rootModel.getEntities().contains(tableModel), is(false)); } + + /** + * save/rollbackのテスト。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + @Ignore("まだ実装されていないから動かない~。テストドリヴ~ン") + public void test01_save_rollbackのテスト_縦横無尽() throws Exception { + JiemamyFactory factory = jiemamy.getFactory(); + RootModel rootModel = factory.getRootModel(); + assertThat(rootModel.getEntities().size(), is(0)); + + SavePoint sp1 = coreFacade.save(); + + TableModel table1 = factory.newModel(TableModel.class); + coreFacade.changeModelProperty(table1, EntityProperty.name, "foo"); + coreFacade.addEntity(table1); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("foo")); + + SavePoint sp2 = coreFacade.save(); + + coreFacade.changeModelProperty(table1, EntityProperty.name, "bar"); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("bar")); + + SavePoint sp3 = coreFacade.save(); + + coreFacade.rollback(sp1); + assertThat(rootModel.getEntities().size(), is(0)); + + coreFacade.rollback(sp2); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("foo")); + + coreFacade.rollback(sp3); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("bar")); + + coreFacade.rollback(sp2); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("foo")); + + coreFacade.rollback(sp1); + assertThat(rootModel.getEntities().size(), is(0)); + + coreFacade.rollback(sp3); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("bar")); + + coreFacade.rollback(sp1); + assertThat(rootModel.getEntities().size(), is(0)); + + TableModel tableModel = factory.newModel(TableModel.class); + coreFacade.changeModelProperty(tableModel, EntityProperty.name, "baz"); + coreFacade.addEntity(tableModel); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + SavePoint sp4 = coreFacade.save(); + + coreFacade.rollback(sp1); + assertThat(rootModel.getEntities().size(), is(0)); + + coreFacade.rollback(sp4); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + coreFacade.rollback(sp2); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("foo")); + + coreFacade.rollback(sp4); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + coreFacade.rollback(sp3); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("bar")); + + coreFacade.rollback(sp4); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + coreFacade.rollback(sp2); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("foo")); + + coreFacade.rollback(sp4); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + coreFacade.rollback(sp1); + assertThat(rootModel.getEntities().size(), is(0)); + + coreFacade.rollback(sp4); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + coreFacade.rollback(sp3); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("bar")); + + coreFacade.rollback(sp4); + assertThat(rootModel.getEntities().size(), is(1)); + assertThat(table1.getName(), is("baz")); + + coreFacade.rollback(sp1); + assertThat(rootModel.getEntities().size(), is(0)); + } } Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -44,6 +44,7 @@ import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.model.node.StickyModel; import org.jiemamy.serializer.JiemamyDomSerializer; +import org.jiemamy.serializer.SerializationException; import org.jiemamy.utils.DomUtil; import org.jiemamy.utils.IterableNodeList; import org.jiemamy.utils.LogMarker; @@ -189,10 +190,10 @@ } @Override - protected RootModel toRootModel(Document document) { + protected RootModel toRootModel(Document document) throws SerializationException { RootModel rootModel = super.toRootModel(document); NodeList dpNodeList = - XpathUtil.getNodes(document, "/core:rootModel/view:diagramPresentations/view:diagramPresentation"); + XpathUtil.getNodes(document, "/core:jiemamy/view:diagramPresentations/view:diagramPresentation"); Iterable<Node> dpNodeListIterable = new IterableNodeList(dpNodeList); logger.debug("presentation count = " + dpNodeList.getLength()); Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddBendpointCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddBendpointCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddBendpointCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -27,18 +27,21 @@ import org.jiemamy.model.geometory.JmPoint; /** - * TODO for daisuke + * コネクションにベンドポイントを追加するEDITコマンド。 * * @author daisuke */ public class AddBendpointCommand extends AbstractAddToCollectionCommand<ConnectionProfile, JmPoint> { + /** ベンドポイントのリスト */ private final List<JmPoint> bendpoints; private final RootModel rootModel; + /** ダイアグラムエディタのタブインデックス */ private final int diagramIndex; + /** ベンドポイントが追加されるコネクション */ private final ConnectionProfile connectionProfile; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionViewCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionViewCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionViewCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -24,7 +24,6 @@ import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.connection.ConnectionAdapter; -import org.jiemamy.model.node.NodeAdapter; /** * {@link RootModel}に登録された{@link DiagramPresentations}アダプタに{@link ConnectionAdapter}を追加するEDITコマンド。 @@ -34,12 +33,16 @@ */ public class AddConnectionViewCommand extends AbstractCommand { + /** {@link DiagramPresentations}がアダプトされた{@link RootModel} */ private final RootModel rootModel; + /** コネクション */ private final ConnectionAdapter connectionAdapter; + /** コネクションのビジュアル情報 */ private final ConnectionProfile connectionProfile; + /** ダイアグラムエディタのタブインデックス */ private final int diagramIndex; @@ -48,8 +51,8 @@ * * @param rootModel {@link DiagramPresentations}がアダプトされた{@link RootModel} * @param diagramIndex ダイアグラムエディタのタブインデックス - * @param connectionAdapter ノードを識別するための{@link NodeAdapter} - * @param connectionProfile + * @param connectionAdapter コネクション + * @param connectionProfile コネクションのビジュアル情報 */ public AddConnectionViewCommand(RootModel rootModel, int diagramIndex, ConnectionAdapter connectionAdapter, ConnectionProfile connectionProfile) { @@ -60,23 +63,27 @@ } /** - * @return ノードを識別するための{@link ConnectionAdapter} + * コネクションを取得する。 + * + * @return コネクション */ public ConnectionAdapter getConnectionAdapter() { return connectionAdapter; } /** - * TODO for daisuke + * コネクションのビジュアル情報を取得する。 * - * @return + * @return コネクションのビジュアル情報 */ public ConnectionProfile getConnectionProfile() { return connectionProfile; } /** - * @return the diagramIndex + * ダイアグラムエディタのタブインデックスを取得する。 + * + * @return ダイアグラムエディタのタブインデックス */ public int getDiagramIndex() { return diagramIndex; @@ -87,15 +94,14 @@ } /** + * {@link DiagramPresentations}がアダプトされた{@link RootModel}を取得する。 + * * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} */ public RootModel getRootModel() { return rootModel; } - /** - * {@inheritDoc} - */ public JiemamyElement getTarget() { return getRootModel(); } Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeViewCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeViewCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeViewCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -35,12 +35,13 @@ private final RootModel rootModel; + /** ダイアグラムエディタのタブインデックス */ + private final int diagramIndex; + private final NodeAdapter nodeAdapter; private final NodeProfile nodeProfile; - private final int diagramIndex; - /** * インスタンスを生成する。 Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteBendpointCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteBendpointCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteBendpointCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -34,6 +34,7 @@ private final RootModel rootModel; + /** ダイアグラムエディタのタブインデックス */ private final int diagramIndex; private final ConnectionProfile connectionProfile; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java 2009-03-02 16:30:58 UTC (rev 2789) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -57,7 +57,7 @@ * @author daisuke * @author shin1ogawa */ -public class JiemamyViewFacadeImpl extends JiemamyFacadeImpl { +public class JiemamyViewFacadeImpl extends JiemamyFacadeImpl implements JiemamyViewFacade { private static Logger logger = LoggerFactory.getLogger(JiemamyViewFacadeImpl.class); @@ -236,6 +236,14 @@ redoStack.clear(); } + /** + * TODO for daisuke + * + * @param diagramIndex + * @param connectionAdapter + * @param bendpointIndex + * @param position + */ public void moveBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex, JmPoint position) { RootModel rootModel = jiemamy.getFactory().getRootModel(); @@ -308,6 +316,11 @@ super(eventBroker); } + /** + * TODO for daisuke + * + * @param command + */ public void process(AddBendpointCommand command) { processAddToCollection(command); } @@ -337,6 +350,11 @@ eventBroker.fireCommandProcessed(command); } + /** + * TODO for daisuke + * + * @param command + */ public void process(DeleteBendpointCommand command) { processDeleteFromCollection(command); } @@ -367,6 +385,11 @@ eventBroker.fireCommandProcessed(command); } + /** + * TODO for daisuke + * + * @param command + */ public void process(MoveBendpointCommand command) { ConnectionProfile connectionProfile = command.getConnectionProfile(); connectionProfile.getBendpoints().set(command.getBendpointIndex(), command.getNewPoint()); Modified: sandbox/jiemamy-stax/src/main/java/org/jiemamy/command/ObjectCommandDestination.java =================================================================== --- sandbox/jiemamy-stax/src/main/java/org/jiemamy/command/ObjectCommandDestination.java 2009-03-02 16:30:58 UTC (rev 2789) +++ sandbox/jiemamy-stax/src/main/java/org/jiemamy/command/ObjectCommandDestination.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -66,7 +66,7 @@ } else if (command instanceof StartElementCommand) { StartElementCommand startCommand = (StartElementCommand) command; ctx.begin(startCommand); - if (startCommand.getQName().equals(CoreQName.ROOT_MODEL.getQName())) { + if (startCommand.getQName().equals(CoreQName.JIEMAMY.getQName())) { String id = startCommand.getAttributes().get(CoreQName.ID.getQName()); rootModel = jiemamy.getFactory().getRootModel(UUIDUtil.valueOfOrRandom(id)); } Modified: sandbox/jiemamy-stax/src/main/java/org/jiemamy/internal/command/RootModelCommand.java =================================================================== --- sandbox/jiemamy-stax/src/main/java/org/jiemamy/internal/command/RootModelCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ sandbox/jiemamy-stax/src/main/java/org/jiemamy/internal/command/RootModelCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -60,9 +60,9 @@ attributes.put(CoreQName.ID.getQName(), rootModel.getId().toString()); ResolvableQueue<JiemamyXmlCommand> queue = new ResolvableQueue<JiemamyXmlCommand>(); - queue.enqueue(new StartElementCommandImpl(CoreQName.ROOT_MODEL, attributes)); + queue.enqueue(new StartElementCommandImpl(CoreQName.JIEMAMY, attributes)); queue.enqueue(new DialectCommand(rootModel.getDialectClassName())); - queue.enqueue(new EndElementCommandImpl(CoreQName.ROOT_MODEL)); + queue.enqueue(new EndElementCommandImpl(CoreQName.JIEMAMY)); return queue; } } Modified: sandbox/jiemamy-stax/src/main/java/org/jiemamy/utils/ResolvableQueue.java =================================================================== --- sandbox/jiemamy-stax/src/main/java/org/jiemamy/utils/ResolvableQueue.java 2009-03-02 16:30:58 UTC (rev 2789) +++ sandbox/jiemamy-stax/src/main/java/org/jiemamy/utils/ResolvableQueue.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -34,7 +34,7 @@ */ public class ResolvableQueue<E> implements EssentialQueue<E> { - private List stock = new LinkedList(); + private List<Object> stock = new LinkedList<Object>(); public void clear() { Modified: sandbox/jiemamy-stax/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java =================================================================== --- sandbox/jiemamy-stax/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java 2009-03-02 16:30:58 UTC (rev 2789) +++ sandbox/jiemamy-stax/src/test/java/org/jiemamy/internal/serializer/stax/JiemamyCommandOutputStreamTest.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -139,11 +139,11 @@ attributes.put(new QName("id"), "ffffffff-ffff-ffff-ffff-ffffffffffff"); stream.write(new OpenCommandImpl()); - stream.write(new StartElementCommandImpl(CoreQName.ROOT_MODEL, attributes)); + stream.write(new StartElementCommandImpl(CoreQName.JIEMAMY, attributes)); stream.write(new StartElementCommandImpl(CoreQName.DIALECT)); stream.write(new DataCommandImpl(DIALECT_ID)); stream.write(new EndElementCommandImpl(CoreQName.DIALECT)); - stream.write(new EndElementCommandImpl(CoreQName.ROOT_MODEL)); + stream.write(new EndElementCommandImpl(CoreQName.JIEMAMY)); stream.write(new CloseCommandImpl()); } } Modified: vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF =================================================================== --- vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2009-03-03 10:11:19 UTC (rev 2790) @@ -47,7 +47,6 @@ org.jiemamy.eclipse.action, org.jiemamy.eclipse.editor, org.jiemamy.eclipse.editor.command, - org.jiemamy.eclipse.editor.dialog, org.jiemamy.eclipse.editor.dialog.root, org.jiemamy.eclipse.editor.editpart, org.jiemamy.eclipse.editor.editpart.diagram, Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/JiemamyPlugin.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -216,6 +216,7 @@ @Override protected void initializeImageRegistry(ImageRegistry registry) { + // TODO ImageManagerを使用する。 // Display display = Display.getCurrent(); // if (display == null) { // display = new Display(); @@ -272,6 +273,7 @@ * * @param display */ + @SuppressWarnings("unused") private void setupImageManager(Display display) { ImageManager.init(display); ResourceBundle imageBundle = ResourceBundle.getBundle("org.jiemamy.eclipse.images"); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -55,8 +55,8 @@ */ public class AutoLayoutAction extends AbstractJiemamyAction { - private static EntityNode getNode(NodeList list, NodeAdapter model) { - for (Object obj : list) { + private static Node getNode(List<Node> list, NodeAdapter model) { + for (Node obj : list) { EntityNode node = (EntityNode) obj; if (node.model == model) { return node; @@ -77,13 +77,21 @@ public void run() { RootModel rootModel = (RootModel) getViewer().getContents().getModel(); CompoundCommand commands = new CompoundCommand(); + @SuppressWarnings("unchecked") // TODO キャスト安全性の根拠提示 List<EditPart> editParts = getViewer().getContents().getChildren(); - NodeList graphNodes = new NodeList(); - EdgeList graphEdges = new EdgeList(); + + @SuppressWarnings("unchecked") + // TODO キャスト安全性の根拠提示 + List<Node> graphNodes = new NodeList(); + + @SuppressWarnings("unchecked") + // TODO キャスト安全性の根拠提示 + List<Edge> graphEdges = new EdgeList(); + // assemble nodes - for (Object obj : editParts) { + for (EditPart obj : editParts) { if (obj instanceof AbstractJmNodeEditPart) { AbstractJmNodeEditPart editPart = (AbstractJmNodeEditPart) obj; NodeAdapter model = editPart.getModel(); @@ -110,8 +118,8 @@ continue CONN_LOOP; } } - EntityNode source = getNode(graphNodes, conn.getSource()); - EntityNode target = getNode(graphNodes, conn.getTarget()); + Node source = getNode(graphNodes, conn.getSource()); + Node target = getNode(graphNodes, conn.getTarget()); if (source != null && target != null) { graphEdges.add(new ConnectionEdge(source, target, conn)); } @@ -119,8 +127,8 @@ } DirectedGraph graph = new DirectedGraph(); graph.setDefaultPadding(new Insets(40)); - graph.nodes = graphNodes; - graph.edges = graphEdges; + graph.nodes = (NodeList) graphNodes; + graph.edges = (EdgeList) graphEdges; new DirectedGraphLayout().visit(graph); for (Object obj : graph.nodes) { EntityNode node = (EntityNode) obj; @@ -141,7 +149,7 @@ * @param target * @param model */ - public ConnectionEdge(EntityNode source, EntityNode target, ConnectionAdapter model) { + public ConnectionEdge(Node source, Node target, ConnectionAdapter model) { super(source, target); this.model = model; } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -68,13 +68,14 @@ * @param wizard 実行前にパラメータを設定するためのウィザード * @param viewer ビューア * @param editor エディタ - * @throws NullPointerException 引数importerに{@code null}を与えた場合 + * @throws IllegalArgumentException 引数exporterに{@code null}を与えた場合 * @throws IllegalArgumentException その他引数に{@code null}を与えた場合 */ public ExportAction(Exporter<ExportConfig> exporter, ExporterWizard<Exporter<ExportConfig>, ExportConfig> wizard, GraphicalViewer viewer, JiemamyEditor editor) { - super(exporter.getName(), viewer); + super(exporter == null ? null : exporter.getName(), viewer); + Validate.notNull(exporter); Validate.notNull(wizard); Validate.notNull(viewer); Validate.notNull(editor); @@ -109,10 +110,10 @@ logger.debug(LogMarker.LIFECYCLE, "canceled " + exporter.getName()); return; } - ExportConfig ctx = wizard.getConfig(); + ExportConfig config = wizard.getConfig(); // 実行 - exporter.exportModel(rootModel, ctx); + exporter.exportModel(rootModel, config); // リフレッシュ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ImportAction.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -68,13 +68,14 @@ * @param wizard 実行前にパラメータを設定するためのウィザード * @param viewer ビューア * @param editor エディタ - * @throws NullPointerException 引数importerに{@code null}を与えた場合 + * @throws IllegalArgumentException 引数importerに{@code null}を与えた場合 * @throws IllegalArgumentException その他引数に{@code null}を与えた場合 */ public ImportAction(Importer<ImportConfig> importer, ImporterWizard<Importer<ImportConfig>, ImportConfig> wizard, GraphicalViewer viewer, JiemamyEditor editor) { - super(importer.getName(), viewer); + super(importer == null ? null : importer.getName(), viewer); + Validate.notNull(importer); Validate.notNull(wizard); Validate.notNull(viewer); Validate.notNull(editor); @@ -109,10 +110,10 @@ logger.debug(LogMarker.LIFECYCLE, "canceled " + importer.getName()); return; } - ImportConfig ctx = wizard.getConfig(); + ImportConfig config = wizard.getConfig(); // 実行 - importer.importModel(rootModel, ctx); + importer.importModel(rootModel, config); // リフレッシュ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -52,8 +52,6 @@ */ public class CreateConnectionCommand extends Command { - private RootModel rootModel; - private NodeAdapter source; private NodeAdapter target; @@ -74,7 +72,6 @@ * @param connection 作成するコネクションモデル */ public CreateConnectionCommand(RootModel rootModel, ConnectionAdapter connection) { - this.rootModel = rootModel; this.connection = connection; source = connection.getSource(); target = connection.getTarget(); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -19,8 +19,6 @@ package org.jiemamy.eclipse.editor.command; import org.eclipse.gef.commands.Command; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.jiemamy.facade.JiemamyViewFacadeImpl; import org.jiemamy.model.RootModel; @@ -33,11 +31,6 @@ */ public class DeleteNodeCommand extends Command { - private static Logger logger = LoggerFactory.getLogger(DeleteNodeCommand.class); - - /** 削除されるエンティティが所属するRootModel */ - private RootModel rootModel; - /** 削除されるノード */ private NodeAdapter nodeAdapter; @@ -53,7 +46,6 @@ * @param nodeAdapter */ public DeleteNodeCommand(RootModel rootModel, NodeAdapter nodeAdapter) { - this.rootModel = rootModel; this.nodeAdapter = nodeAdapter; jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); } Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DialogEditCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DialogEditCommand.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DialogEditCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -0,0 +1,67 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/03 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.eclipse.editor.command; + +import org.eclipse.gef.commands.Command; + +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.SavePoint; + +/** + * モデル編集GEFコマンド。 + * + * @author daisuke + */ +public class DialogEditCommand extends Command { + + private final JiemamyFacade jiemamyFacade; + + private final SavePoint beforeEditSavePoint; + + private final SavePoint afterEditSavePoint; + + + /** + * インスタンスを生成する。 + * + * @param jiemamyFacade + * @param beforeEditSavePoint + * @param afterEditSavePoint + */ + public DialogEditCommand(JiemamyFacade jiemamyFacade, SavePoint beforeEditSavePoint, SavePoint afterEditSavePoint) { + this.jiemamyFacade = jiemamyFacade; + this.beforeEditSavePoint = beforeEditSavePoint; + this.afterEditSavePoint = afterEditSavePoint; + } + + @Override + public void execute() { + // TODO Auto-generated method stub + } + + @Override + public void redo() { + jiemamyFacade.rollback(afterEditSavePoint); + } + + @Override + public void undo() { + jiemamyFacade.rollback(beforeEditSavePoint); + } +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DialogEditCommand.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -50,8 +50,6 @@ private DisplayStatus displayStatus; - private RootModel rootModel; - private JiemamyViewFacadeImpl jiemamyFacade; @@ -61,7 +59,6 @@ * @param rootModel */ public DirectEditNodeCommand(RootModel rootModel) { - this.rootModel = rootModel; jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); } Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -1,80 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.eclipse.editor.command; - -import org.eclipse.gef.commands.Command; - -import org.jiemamy.eclipse.editor.dialog.Memento; -import org.jiemamy.facade.JiemamyViewFacadeImpl; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.attribute.constraint.ForeignKeyModel; - -/** - * モデル編集GEFコマンド。 - * - * @author daisuke - */ -public class EditForeignKeyModelCommand extends Command { - - /** 編集対象モデル */ - private ForeignKeyModel foreignKeyModel; - - /** 編集前のmemento */ - private Memento beforeEditMemento; - - /** 編集後のmemento */ - private Memento afterEditMemento; - - private final JiemamyViewFacadeImpl jiemamyFacade; - - - /** - * インスタンスを生成する。 - * - * @param rootModel - * @param foreignKeyModel 編集対象モデル - * @param beforeEditMemento 編集前のmemento - * @param afterEditMemento 編集後のmemento - */ - public EditForeignKeyModelCommand(RootModel rootModel, ForeignKeyModel foreignKeyModel, Memento beforeEditMemento, - Memento afterEditMemento) { - this.foreignKeyModel = foreignKeyModel; - this.beforeEditMemento = beforeEditMemento; - this.afterEditMemento = afterEditMemento; - - jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); - } - - @Override - public void execute() { - // TODO Auto-generated method stub - } - - @Override - public void redo() { - // 編集後のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, afterEditMemento, new ForeignKeyEditDialogMemento.FkModelFilter()); - } - - @Override - public void undo() { - // 編集前のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, beforeEditMemento, new ForeignKeyEditDialogMemento.FkModelFilter()); - } -} Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -1,71 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.eclipse.editor.command; - -import org.eclipse.gef.commands.Command; - -import org.jiemamy.eclipse.editor.dialog.Memento; -import org.jiemamy.facade.JiemamyViewFacadeImpl; -import org.jiemamy.model.RootModel; - -/** - * モデル編集GEFコマンド。 - * - * @author daisuke - */ -public class EditRootModelCommand extends Command { - - /** 編集対象モデル */ - private RootModel rootModel; - - /** 編集前のmemento */ - private Memento beforeEditMemento; - - /** 編集後のmemento */ - private Memento afterEditMemento; - - private JiemamyViewFacadeImpl jiemamyFacade; - - /** - * インスタンスを生成する。 - * - * @param rootModel 編集対象モデル - * @param beforeEditMemento 編集前のmemento - * @param afterEditMemento 編集後のmemento - */ - public EditRootModelCommand(RootModel rootModel, Memento beforeEditMemento, Memento afterEditMemento) { - this.rootModel = rootModel; - this.beforeEditMemento = beforeEditMemento; - this.afterEditMemento = afterEditMemento; - - jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); - } - - @Override - public void redo() { - // 編集後のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, afterEditMemento, new DatabaseEditDialogMemento.DatabaseModelFilter()); - } - - @Override - public void undo() { - // 編集前のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, beforeEditMemento, new DatabaseEditDialogMemento.DatabaseModelFilter()); - } -} Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -1,71 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.eclipse.editor.command; - -import org.eclipse.gef.commands.Command; - -import org.jiemamy.eclipse.editor.dialog.Memento; -import org.jiemamy.facade.JiemamyViewFacadeImpl; -import org.jiemamy.model.entity.TableModel; - -/** - * モデル編集GEFコマンド。 - * - * @author daisuke - */ -public class EditTableModelCommand extends Command { - - /** 編集対象モデル */ - private TableModel tableModel; - - /** 編集前のmemento */ - private Memento beforeEditMemento; - - /** 編集後のmemento */ - private Memento afterEditMemento; - - private JiemamyViewFacadeImpl jiemamyFacade; - - - /** - * インスタンスを生成する。 - * - * @param tableModel 編集対象モデル - * @param beforeEditMemento 編集前のmemento - * @param afterEditMemento 編集後のmemento - */ - public EditTableModelCommand(TableModel tableModel, Memento beforeEditMemento, Memento afterEditMemento) { - this.tableModel = tableModel; - this.beforeEditMemento = beforeEditMemento; - this.afterEditMemento = afterEditMemento; - jiemamyFacade = new JiemamyViewFacadeImpl(tableModel.getJiemamy()); - } - - @Override - public void redo() { - // 編集後のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, afterEditMemento, new TableEditDialogMemento.TableModelFilter()); - } - - @Override - public void undo() { - // 編集前のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, beforeEditMemento, new TableEditDialogMemento.TableModelFilter()); - } -} Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -1,71 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.eclipse.editor.command; - -import org.eclipse.gef.commands.Command; - -import org.jiemamy.eclipse.editor.dialog.Memento; -import org.jiemamy.facade.JiemamyViewFacadeImpl; -import org.jiemamy.model.entity.ViewModel; - -/** - * モデル編集GEFコマンド。 - * - * @author daisuke - */ -public class EditViewModelCommand extends Command { - - /** 編集対象モデル */ - private ViewModel viewModel; - - /** 編集前のmemento */ - private Memento beforeEditMemento; - - /** 編集後のmemento */ - private Memento afterEditMemento; - - private JiemamyViewFacadeImpl jiemamyFacade; - - - /** - * インスタンスを生成する。 - * - * @param viewModel 編集対象モデル - * @param beforeEditMemento 編集前のmemento - * @param afterEditMemento 編集後のmemento - */ - public EditViewModelCommand(ViewModel viewModel, Memento beforeEditMemento, Memento afterEditMemento) { - this.viewModel = viewModel; - this.beforeEditMemento = beforeEditMemento; - this.afterEditMemento = afterEditMemento; - jiemamyFacade = new JiemamyViewFacadeImpl(viewModel.getJiemamy()); - } - - @Override - public void redo() { - // 編集後のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, afterEditMemento, new ViewEditDialogMemento.ViewModelFilter()); - } - - @Override - public void undo() { - // 編集前のスナップショットをオリジナルに反映 -// BeanUtil.copyBean(targetModel, beforeEditMemento, new ViewEditDialogMemento.ViewModelFilter()); - } -} Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -37,8 +37,6 @@ */ public class MoveBendpointCommand extends AbstractMovePositionCommand { - private RootModel rootModel; - private ConnectionAdapter connectionAdapter; private Point oldLocation; @@ -64,7 +62,6 @@ DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX); ConnectionProfile connectionProfile = presentation.getConnectionProfiles().get(connectionAdapter); - this.rootModel = rootModel; this.connectionAdapter = connectionAdapter; this.bendpointIndex = bendpointIndex; oldLocation = ConvertUtil.convert(connectionProfile.getBendpoints().get(bendpointIndex)); Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/Memento.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/Memento.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/Memento.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -1,27 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.eclipse.editor.dialog; - -/** - * Memento型。メソッドは一切実行しないモデル。 - * - * @author daisuke - */ -public interface Memento { -} Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -42,7 +42,7 @@ import org.jiemamy.model.RootModel; /** - * {@link RootModel}設定ダイアログ。 + * {@link RootModel}設定ダイアログクラス。 * * @author daisuke */ 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-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -75,6 +75,7 @@ import org.jiemamy.utils.CollectionsUtil; import org.jiemamy.utils.ListUtil; import org.jiemamy.utils.LogMarker; +import org.jiemamy.utils.model.DataTypeUtil; import org.jiemamy.utils.model.RootModelUtil; /** @@ -537,10 +538,10 @@ @Override protected void enableEditorControls(int index) { DomainModel domain = domains.get(index); - DataType columnType = domain.getDataType(); + DataType dataType = domain.getDataType(); txtDomainName.setText(domain.getName()); -// cmbColumnType.setText(rootModel.getDialect().convertToPrimitiveType(columnType).getIdentifier()); + cmbColumnType.setText(DataTypeUtil.getTypeName(dataType, jiemamy.getReferenceResolver())); txtColumnSize.setText(ObjectUtils.toString(domain.getDataType().getAdapter(SizedDataTypeAdapter.class) .getSize(), "")); txtDescription.setText(StringUtils.defaultIfEmpty(domain.getDescription(), "")); Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/Messages.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/Messages.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/Messages.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -0,0 +1,68 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/16 + * + * 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.eclipse.editor.dialog.sticky; + +import org.eclipse.osgi.util.NLS; + +/** + * {@link StickyEditDialog}用メッセージリソースクラス。 + * + * @author daisuke + */ +class Messages extends NLS { + + /** Dialogのタイトル */ + public static String Dialog_Title; + + /** ビュー編集コントロールグループタイトル */ + public static String Message; + + /** ビュー名ラベル */ + public static String Label_View_Name; + + /** ビュー名ラベル */ + public static String Label_View_LogicalName; + + /** 定義タブ */ + public static String Tab_Sticky_Contents; + + /** 開始スクリプトタブ */ + public static String Tab_View_BeginScript; + + /** 終了スクリプトタブ */ + public static String Tab_View_EndScript; + + /** 説明タブ */ + public static String Tab_View_Description; + + private static final String BUNDLE_NAME = Messages.class.getName().toLowerCase(); + + static { + reloadMessages(); + } + + + /** + * load message values from bundle file + */ + public static void reloadMessages() { + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/Messages.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -0,0 +1,131 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/17 + * + * 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.eclipse.editor.dialog.sticky; + +import org.apache.commons.lang.StringUtils; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.ColorDialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.TabFolder; + +import org.jiemamy.eclipse.Images; +import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.ui.JiemamyEditDialog; +import org.jiemamy.eclipse.ui.tab.TextEditTab; +import org.jiemamy.model.node.StickyModel; + +/** + * Sticky設定ダイアログクラス。 + * + * @author daisuke + */ +public class StickyEditDialog extends JiemamyEditDialog<StickyModel> { + + private TextEditTab tabContents; + + + /** + * コンストラクタ。 + * + * @param shell + * @param viewModel + */ + public StickyEditDialog(Shell shell, StickyModel viewModel) { + super(shell, viewModel, StickyModel.class); + setShellStyle(getShellStyle() | SWT.RESIZE); + } + + @Override + protected void constrainShellSize() { + Shell shell = getShell(); + shell.pack(); + int height = 370; + shell.setSize((int) (height * 1.618), height); + } + + @Override + protected Control createDialogArea(Composite parent) { + StickyModel stickyModel = getTargetModel(); + getShell().setText(Messages.Dialog_Title); + + Composite composite = (Composite) super.createDialogArea(parent); + composite.setLayout(new GridLayout(6, false)); + + // ---- A-1. 色 + ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); + + Button btnColor = new Button(composite, SWT.PUSH); + btnColor.setImage(ir.get(Images.ICON_COLOR_PALETTE)); + btnColor.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent evt) { + ColorDialog colorDialog = new ColorDialog(getShell(), SWT.NULL); + RGB rgb = colorDialog.open(); + if (rgb != null) { + // TODO +// viewModel.setBgColor(new JmColor(rgb.red, rgb.green, rgb.blue)); + } + } + }); + + Button btnDefaultColor = new Button(composite, SWT.PUSH); + btnDefaultColor.setText("default color"); // RESOURCE + btnDefaultColor.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent evt) { + // TODO +// viewModel.setBgColor(null); + } + }); + + // ---- B. タブ + TabFolder tabFolder = new TabFolder(composite, SWT.NONE); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.horizontalSpan = 6; + tabFolder.setLayoutData(gd); + + // ---- B-1. Contents + tabContents = + new TextEditTab(tabFolder, Messages.Tab_Sticky_Contents, StringUtils.defaultIfEmpty(stickyModel + .getContents(), "")); + addTab(tabContents); + + createAdditionalTabs(tabFolder); + + return composite; + } + + @Override + protected boolean performOk() { + StickyModel stickyModel = getTargetModel(); + stickyModel.setContents(tabContents.getTextWidget().getText()); + return true; + } +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/sticky/StickyEditDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -52,7 +52,7 @@ import org.jiemamy.utils.model.TableUtil; /** - * テーブルの詳細編集ダイアログ。 + * テーブルの詳細編集ダイアログクラス。 * * @author daisuke */ Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -40,10 +40,11 @@ import org.jiemamy.eclipse.ui.JiemamyEditDialog; import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter; import org.jiemamy.eclipse.ui.tab.TextEditTab; +import org.jiemamy.facade.JiemamyFacade; import org.jiemamy.model.entity.ViewModel; /** - * View設定ダイアログ + * View設定ダイアログクラス。 * * @author daisuke */ @@ -61,16 +62,20 @@ private TextEditTab tabDescription; + private final JiemamyFacade facade; + /** * コンストラクタ。 * * @param shell * @param viewModel + * @param facade */ - public ViewEditDialog(Shell shell, ViewModel viewModel) { + public ViewEditDialog(Shell shell, ViewModel viewModel, JiemamyFacade facade) { super(shell, viewModel, ViewModel.class); setShellStyle(getShellStyle() | SWT.RESIZE); + this.facade = facade; } @Override Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -24,8 +24,10 @@ import org.eclipse.draw2d.PolylineConnection; import org.eclipse.draw2d.PolylineDecoration; import org.eclipse.draw2d.PositionConstants; +import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.Request; import org.eclipse.gef.RequestConstants; +import org.eclipse.gef.commands.Command; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; @@ -33,9 +35,13 @@ import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.editor.DisplayPlace; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.foreignkey.ForeignKeyEditDialog; import org.jiemamy.eclipse.editor.editpart.EditDialogSupport; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.constraint.ForeignKeyModel; @@ -72,24 +78,25 @@ public void openEditDialog() { logger.debug(LogMarker.LIFECYCLE, "openEditDialog"); + RootModel rootModel = (RootModel) getParent().getModel(); ConnectionAdapter connection = getModel(); - ForeignKeyModel fkModel = connection.unwrap(); + ForeignKeyModel foreignKeyModel = connection.unwrap(); - ForeignKeyEditDialog dialog = new ForeignKeyEditDialog(getViewer().getControl().getShell(), fkModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); -// + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + + ForeignKeyEditDialog dialog = new ForeignKeyEditDialog(getViewer().getControl().getShell(), foreignKeyModel); + if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// viewer.getEditDomain().getCommandStack().execute( -// new EditForeignKeyModelCommand(fkModel, beforeEditMemento, afterEditMemento)); + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + Command command = new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); } else { -// // 編集前にロールバック -// dialog.setMemento(beforeEditMemento); + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -26,6 +26,7 @@ import org.eclipse.draw2d.Layer; import org.eclipse.draw2d.XYLayout; import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalViewer; import org.eclipse.gef.LayerConstants; import org.eclipse.gef.editparts.AbstractGraphicalEditPart; import org.eclipse.jface.dialogs.Dialog; @@ -36,12 +37,16 @@ import org.jiemamy.Migration; import org.jiemamy.eclipse.JiemamyPlugin; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.root.RootEditDialog; import org.jiemamy.eclipse.editor.editpart.EditDialogSupport; import org.jiemamy.eclipse.editor.editpolicy.JmLayoutEditPolicy; import org.jiemamy.eclipse.preference.JiemamyPreference; import org.jiemamy.editcommand.Command; import org.jiemamy.editcommand.CommandListener; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.JiemamyElement; @@ -114,21 +119,23 @@ logger.debug(LogMarker.LIFECYCLE, "openEditDialog"); RootModel rootModel = getModel(); + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + RootEditDialog dialog = new RootEditDialog(getViewer().getControl().getShell(), rootModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); -// + if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// viewer.getEditDomain().getCommandStack().execute( -// new EditDatabaseModelCommand(rootModel, beforeEditMemento, afterEditMemento)); + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + + org.eclipse.gef.commands.Command command = + new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); } else { -// // 編集前にロールバック -// dialog.setMemento(beforeEditMemento); + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -24,16 +24,24 @@ import org.eclipse.draw2d.Panel; import org.eclipse.draw2d.StackLayout; import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.gef.commands.Command; import org.eclipse.gef.tools.CellEditorLocator; import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.jface.dialogs.Dialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.jiemamy.Migration; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; +import org.jiemamy.eclipse.editor.dialog.sticky.StickyEditDialog; import org.jiemamy.eclipse.editor.figure.StickyFigure; import org.jiemamy.eclipse.editor.tools.MultiLineTextCellEditor; import org.jiemamy.eclipse.editor.tools.NodeCellEditorLocator; import org.jiemamy.eclipse.utils.ConvertUtil; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.JiemamyElement; @@ -72,24 +80,26 @@ logger.debug(LogMarker.LIFECYCLE, "openEditDialog"); // TODO Dialog open! -// StickyModel stickyModel = (StickyModel) getModel(); -// -// StickyEditDialog dialog = new StickyEditDialog(getViewer().getControl().getShell(), stickyModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); // 編集前のスナップショットを保存 -// -// if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// viewer.getEditDomain().getCommandStack().execute( -// new EditStickyModelCommand(stickyModel, beforeEditMemento, afterEditMemento)); -// } else { -// // 編集前にロールバック -// dialog.setMemento(beforeEditMemento); -// } + RootModel rootModel = (RootModel) getParent().getModel(); + StickyModel stickyModel = (StickyModel) getModel(); + + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + + StickyEditDialog dialog = new StickyEditDialog(getViewer().getControl().getShell(), stickyModel); + + if (dialog.open() == Dialog.OK) { + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + + Command command = new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); + } else { + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); + } } @Override Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -25,17 +25,23 @@ import org.eclipse.draw2d.Panel; import org.eclipse.draw2d.StackLayout; import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.gef.commands.Command; import org.eclipse.jface.dialogs.Dialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.DisplayPlace; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.table.TableEditDialog; import org.jiemamy.eclipse.editor.figure.ColumnFigure; import org.jiemamy.eclipse.editor.figure.TableFigure; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; import org.jiemamy.eclipse.utils.ConvertUtil; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.Level; @@ -71,24 +77,26 @@ public void openEditDialog() { logger.debug(LogMarker.LIFECYCLE, "openEditDialog"); + RootModel rootModel = (RootModel) getParent().getModel(); NodeAdapter node = getModel(); TableModel tableModel = (TableModel) node.unwrap(); + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + TableEditDialog dialog = new TableEditDialog(getViewer().getControl().getShell(), tableModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); -// + if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// viewer.getEditDomain().getCommandStack().execute( -// new EditTableModelCommand(tableModel, beforeEditMemento, afterEditMemento)); + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + + Command command = new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); } else { -// // 編集前にロールバック -// dialog.setMemento(beforeEditMemento); + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -25,16 +25,22 @@ import org.eclipse.draw2d.Panel; import org.eclipse.draw2d.StackLayout; import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.gef.commands.Command; import org.eclipse.jface.dialogs.Dialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.DisplayPlace; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.view.ViewEditDialog; import org.jiemamy.eclipse.editor.figure.ViewFigure; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; import org.jiemamy.eclipse.utils.ConvertUtil; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.NodeProfile; @@ -71,21 +77,22 @@ NodeAdapter node = getModel(); ViewModel viewModel = (ViewModel) node.unwrap(); - ViewEditDialog dialog = new ViewEditDialog(getViewer().getControl().getShell(), viewModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); // 編集前のスナップショットを保存 -// - if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// viewer.getEditDomain().getCommandStack().execute( -// new EditViewModelCommand(viewModel, beforeEditMemento, afterEditMemento)); + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + + ViewEditDialog dialog = new ViewEditDialog(getViewer().getControl().getShell(), viewModel, facade); + + if (dialog.open() != Dialog.OK) { + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + + Command command = new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); } else { -// // 編集前にロールバック -// dialog.setMemento(beforeEditMemento); + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -95,9 +95,9 @@ RootModel rootModel = getModel(); Jiemamy jiemamy = rootModel.getJiemamy(); - domainContainer = new ModelContainer("outline.domains", jiemamy); // RESOURCE - tableContainer = new ModelContainer("outline.tables", jiemamy); // RESOURCE - viewContainer = new ModelContainer("outline.views", jiemamy); // RESOURCE + domainContainer = new ModelContainer("ドメイン", jiemamy); // RESOURCE + tableContainer = new ModelContainer("テーブル", jiemamy); // RESOURCE + viewContainer = new ModelContainer("ビュー", jiemamy); // RESOURCE children.add(tableContainer); children.add(viewContainer); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/TableTreeEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -21,19 +21,28 @@ import java.util.List; import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.gef.commands.Command; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.resource.ImageRegistry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.Images; import org.jiemamy.eclipse.JiemamyPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.table.TableEditDialog; import org.jiemamy.eclipse.editor.editpolicy.JmTreeComponentEditPolicy; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.AttributeModel; import org.jiemamy.model.entity.TableModel; +import org.jiemamy.utils.LogMarker; /** * {@link TableModel}に対するTree用EditPart(コントローラ)。 @@ -41,6 +50,9 @@ */ public class TableTreeEditPart extends AbstractEntityTreeEditPart { + private static Logger logger = LoggerFactory.getLogger(TableTreeEditPart.class); + + /** * インスタンスを生成する。 * @@ -61,21 +73,27 @@ } public void openEditDialog() { + logger.debug(LogMarker.LIFECYCLE, "openEditDialog"); + + RootModel rootModel = (RootModel) getParent().getModel(); TableModel tableModel = getModel(); + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + TableEditDialog dialog = new TableEditDialog(getViewer().getControl().getShell(), tableModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); -// + if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// -// viewer.getEditDomain().getCommandStack().execute( -// new EditTableModelCommand(tableModel, beforeEditMemento, afterEditMemento)); + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + + Command command = new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); + } else { + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/ViewTreeEditPart.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -19,18 +19,27 @@ package org.jiemamy.eclipse.editor.editpart.outlinetree; import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.gef.commands.Command; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.resource.ImageRegistry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.Images; import org.jiemamy.eclipse.JiemamyPlugin; import org.jiemamy.eclipse.editor.DisplayPlace; +import org.jiemamy.eclipse.editor.command.DialogEditCommand; import org.jiemamy.eclipse.editor.dialog.view.ViewEditDialog; import org.jiemamy.eclipse.editor.editpolicy.JmTreeComponentEditPolicy; import org.jiemamy.eclipse.editor.utils.LabelStringUtil; +import org.jiemamy.facade.JiemamyFacade; +import org.jiemamy.facade.JiemamyViewFacadeImpl; +import org.jiemamy.facade.SavePoint; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.entity.ViewModel; +import org.jiemamy.utils.LogMarker; /** * ViewModelに対するTree用EditPart @@ -39,6 +48,9 @@ */ public class ViewTreeEditPart extends AbstractEntityTreeEditPart { + private static Logger logger = LoggerFactory.getLogger(ViewTreeEditPart.class); + + /** * インスタンスを生成する。 * @@ -59,23 +71,27 @@ } public void openEditDialog() { + logger.debug(LogMarker.LIFECYCLE, "openEditDialog"); + + RootModel rootModel = (RootModel) getParent().getModel(); ViewModel viewModel = getModel(); - ViewEditDialog dialog = new ViewEditDialog(getViewer().getControl().getShell(), viewModel); -// -// // 編集前のスナップショットを保存 -// Memento beforeEditMemento = dialog.createMemento(); -// - if (dialog.open() == Dialog.OK) { -// // 編集後のスナップショットを保存 -// Memento afterEditMemento = dialog.createMemento(); -// -// GraphicalViewer viewer = (GraphicalViewer) getViewer(); -// viewer.getEditDomain().getCommandStack().execute( -// new EditViewModelCommand(viewModel, beforeEditMemento, afterEditMemento)); + // 編集前のスナップショットを保存 + JiemamyFacade facade = new JiemamyViewFacadeImpl(rootModel.getJiemamy()); + SavePoint beforeEditSavePoint = facade.save(); + + ViewEditDialog dialog = new ViewEditDialog(getViewer().getControl().getShell(), viewModel, facade); + + if (dialog.open() != Dialog.OK) { + // 編集後のスナップショットを保存 + SavePoint afterEditSavePoint = facade.save(); + + Command command = new DialogEditCommand(facade, beforeEditSavePoint, afterEditSavePoint); + GraphicalViewer viewer = (GraphicalViewer) getViewer(); + viewer.getEditDomain().getCommandStack().execute(command); } else { -// // 編集前にロールバック -// dialog.setMemento(beforeEditMemento); + // 編集前にロールバック + facade.rollback(beforeEditSavePoint); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java 2009-03-02 16:30:58 UTC (rev 2789) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/JiemamyEditDialog.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -161,8 +161,10 @@ /** * OKボタン押下処理を行う。 + * Notifies that the OK button of this dialog has been pressed. * - * @return + * @return {@code false} to abort the container's OK + * processing and {@code true} to allow the OK to happen */ protected abstract boolean performOk(); } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Jiemamy.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Jiemamy.java 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Jiemamy.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -65,7 +65,7 @@ * @throws JiemamyRuntimeException Artemis実装が見つからない、もしくは不正である場合 */ public static Jiemamy newInstance() { - return newInstance(getDefaultImplementation(), new DefaultInstanceProvider<Dialect>()); + return newInstance(findDefaultImplementation(), new DefaultInstanceProvider<Dialect>()); } /** @@ -123,7 +123,7 @@ * * @return デフォルトのJiemamy実装 */ - private static JiemamyImplementation getDefaultImplementation() { + private static JiemamyImplementation findDefaultImplementation() { try { Class<?> artemisClass = Class.forName("org.jiemamy.Artemis"); return (JiemamyImplementation) artemisClass.newInstance(); @@ -172,6 +172,15 @@ } /** + * デフォルトで使用するJiemamy実装を取得する。 + * + * @return デフォルトで使用するJiemamy実装 + */ + public JiemamyImplementation getDefaultImplementation() { + return defaultImplementation; + } + + /** * SQL方言を取得する。 * * @param rootModel 適用対象{@link RootModel} Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyImplementation.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyImplementation.java 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyImplementation.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -84,4 +84,11 @@ * @return サポートされている追加仕様の{@link Set} */ Set<OptionalSpec> getSupportedSpecs(); + + /** + * Jiemamyのバージョンを取得する。 + * + * @return Jiemamyのバージョン + */ + Version getVersion(); } Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Version.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Version.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Version.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -0,0 +1,70 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/03 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy; + +/** + * Jiemamyのバージョンを表すインターフェイス。 + * + * @author daisuke + */ +public interface Version { + + /** 仕様のメジャーバージョン番号 */ + static final int major = 0; + + /** 仕様のマイナーバージョン番号 */ + static final int minor = 2; + + /** 仕様がスナップショット版であるかどうか */ + static final boolean snapshot = true; + + /** 仕様バージョンの文字列表記 */ + static final String SPEC = major + "." + minor + (snapshot ? "-SNAPSHOT" : ""); + + + /** + * 仕様及び実装のメジャーバージョン番号を取得する。 + * + * @return 仕様及び実装のメジャーバージョン番号 + */ + int getMajor(); + + /** + * 仕様及び実装のマイナーバージョン番号を取得する。 + * + * @return 仕様及び実装のマイナーバージョン番号 + */ + int getMinor(); + + /** + * 実装のリリース番号を取得する。 + * + * @return 実装のリリース番号 + */ + int getRelease(); + + /** + * スナップショット版であるかどうかを取得する。 + * + * <p>仕様または実装のいずれかがスナップショット版であれば、{@code true}を返す。両者とも正式版の時のみ、{@code false}を返す。</p> + * + * @return スナップショット版であれば{@code true} + */ + boolean isSnapshot(); +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/Version.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Exporter.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -35,7 +35,7 @@ * * @param rootModel エクスポート対象モデル * @param config エクスポートの設定情報 - * @return エクスポートが正常に完了した場合は{@code true}、contextの設定等により出力が行われなかった場合は{@code false} + * @return エクスポートが正常に完了した場合は{@code true}、configの設定等により出力が行われなかった場合は{@code false} * @throws ExportException エクスポートに失敗した時 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws IllegalArgumentException 必須コンテキスト情報が{@code null}または、型が異なる場合 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/composer/Importer.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -41,11 +41,11 @@ * 外部リソースからモデルにデータをインポートする。 * * @param rootModel インポート対象モデル - * @param ctx インポートのコンテキスト情報 - * @return インポートが正常に行われた場合は{@code true}、contextの設定により、入力が行われなかった場合は{@code false} + * @param config インポートのコンテキスト情報 + * @return インポートが正常に行われた場合は{@code true}、configの設定により、入力が行われなかった場合は{@code false} * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @throws ImportException インポートに失敗した時 */ - boolean importModel(RootModel rootModel, T ctx) throws ImportException; + boolean importModel(RootModel rootModel, T config) throws ImportException; } 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-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/xml/CoreQName.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -27,11 +27,8 @@ */ public enum CoreQName implements JiemamyQName { /***/ - ROOT_MODEL(CoreNamespace.NS_CORE, "rootModel"), + JIEMAMY(CoreNamespace.NS_CORE, "jiemamy"), - /***/ - NULL_VALUE(CoreNamespace.NS_CORE, "nullValue"), - // -------- /***/ @@ -92,9 +89,6 @@ TABLE_CHECK_CONSTRAINT(CoreNamespace.NS_CORE, "tableCheck"), /***/ - COLUMN_CHECK_CONSTRAINT(CoreNamespace.NS_CORE, "columnCheck"), - - /***/ COLUMN(CoreNamespace.NS_CORE, "column"), /***/ @@ -130,6 +124,9 @@ COLUMN_PRIMARY_KEY(CoreNamespace.NS_CORE, "columnPrimaryKey"), /***/ + COLUMN_CHECK_CONSTRAINT(CoreNamespace.NS_CORE, "columnCheck"), + + /***/ EXPRESSION(CoreNamespace.NS_CORE, "expression"), /***/ @@ -179,7 +176,11 @@ ENTITY_REF(CoreNamespace.NS_CORE, "entityRef"), // -------- Attributes + /***/ + VERSION(CoreNamespace.NONE, "version"), + + /***/ ID(CoreNamespace.NONE, "id"), /***/ Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd 2009-03-03 10:11:19 UTC (rev 2790) @@ -12,7 +12,7 @@ <xsd:documentation source="description" xml:lang="ja-JP">Jiemamyモデルスキーマ</xsd:documentation> </xsd:annotation> - <xsd:element name="rootModel"> + <xsd:element name="jiemamy"> <xsd:complexType> <xsd:sequence maxOccurs="1" minOccurs="1"> <xsd:element name="dialect" type="fqcnType" /> @@ -40,6 +40,7 @@ <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax" namespace="##other"/> </xsd:sequence> <xsd:attribute name="id" type="uuidType" use="required" /> + <xsd:attribute name="version" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml 2009-03-03 10:11:19 UTC (rev 2790) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<rootModel xmlns="http://jiemamy.org/xml/ns/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="d5a96af3-b1e9-4285-a8ef-c491ce5ae308" xsi:schemaLocation="http://jiemamy.org/xml/ns/core ../../main/resources/jiemamy-core.xsd http://jiemamy.org/xml/ns/view ../../main/resources/jiemamy-view.xsd"> +<jiemamy xmlns="http://jiemamy.org/xml/ns/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="d5a96af3-b1e9-4285-a8ef-c491ce5ae308" xsi:schemaLocation="http://jiemamy.org/xml/ns/core ../../main/resources/jiemamy-core.xsd http://jiemamy.org/xml/ns/view ../../main/resources/jiemamy-view.xsd" version="0.2-SNAPSHOT"> <dialect>org.jiemamy.dialect.mysql.MySqlDialect</dialect> <schemaName>FOO</schemaName> <description>Jiemamyテストモデル1</description> @@ -456,4 +456,4 @@ </view:connectionProfiles> </view:diagramPresentation> </view:diagramPresentations> -</rootModel> +</jiemamy> Added: zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/VersionTest.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/VersionTest.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/VersionTest.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -0,0 +1,58 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/03 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.io.File; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathFactory; + +import org.junit.Test; +import org.w3c.dom.Document; + +/** + * {@link Version}のテストクラス。 + * + * @author daisuke + */ +public class VersionTest { + + /** + * pomのバージョンとSPECが一致していること。 + * + * @throws Exception 例外が発生した場合 + */ + @Test + public void test01_pomのバージョンとSPECが一致していること() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(new File("pom.xml")); + + XPathFactory xpathFactory = XPathFactory.newInstance(); + XPath xpath = xpathFactory.newXPath(); + String version = xpath.evaluate("/project/version", document); + + assertThat(Version.SPEC, is(version)); + } +} Property changes on: zeus/trunk/jiemamy-spec-core/src/test/java/org/jiemamy/VersionTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java (rev 0) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -0,0 +1,28 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/03/03 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.facade; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public interface JiemamyViewFacade extends JiemamyFacade { + +} Property changes on: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java 2009-03-02 16:30:58 UTC (rev 2789) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java 2009-03-03 10:11:19 UTC (rev 2790) @@ -24,7 +24,7 @@ import org.jiemamy.model.geometory.JmPoint; /** - * コネクションの見た目情報。 + * コネクションのビジュアル情報インターフェイス。 * * @author daisuke */