svnno****@sourc*****
svnno****@sourc*****
2009年 4月 15日 (水) 02:52:18 JST
Revision: 3277 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3277 Author: daisuke_m Date: 2009-04-15 02:52:18 +0900 (Wed, 15 Apr 2009) Log Message: ----------- メソッドのnullチェックを強化。 Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/AbstractDialect.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/BuiltinDataTypeMoldImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/EntityImportVisitor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/ForeignKeyImportVisitor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/SqlEmitter.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/TokenResolver.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultDialectInitializer.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultEntityImportVisitor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultMoldManager.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultSqlEmitter.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ArtemisJiemamyFactory.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/EventBrokerImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ReferenceResolverImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/SavePointImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractAddToCollectionCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractRemoveFromCollectionCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddAttributeCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddColumnToColumnRefListCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDataSetToRootCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDomainToRootCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexColumnCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddRecordsToDataSetCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveColumnFromColumnRefListCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveRecordsFromDataSetCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/SetRecordValueCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/UpdateForeignKeyMappingCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/enhance/FactoryExtension.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomSerializer.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DatabaseCleaner.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LocalizedMessages.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidatorUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EqualsUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/KeyConstraintUtil.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/JiemamyFacadeImplTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/RootModelImplTest.java artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/node/TableModelImplTest.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/JiemamyViewFacadeImpl.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddBendpointCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddConnectionViewCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddNodeViewCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/MoveBendpointCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveBendpointCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveConnectionViewCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveNodeViewCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/ResetBendpointCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RevertBendpointsCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewDomSerializerEnhancer.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewFactoryExtensionEnhancer.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ForEachUtil.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/EventBroker.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyImplementation.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolver.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/MoldManager.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java Added Paths: ----------- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolveException.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/composer/importer/DatabaseImporter.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -95,6 +95,7 @@ public boolean importModel(RootModel rootModel, DatabaseImportConfig config) throws ImportException { Validate.notNull(rootModel); Validate.notNull(config); + Validate.notNull(config.getUri()); Connection connection = null; try { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/AbstractDialect.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/AbstractDialect.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/AbstractDialect.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -74,10 +74,17 @@ * インスタンスを生成する。 * * @param initializer SQL方言の各ストラテジを提供するイニシャライザ - * @throws IllegalArgumentException 引数に{@code null}または空のコレクションを与えた場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws IllegalArgumentException initializerから取得される各ストラテジの何れかが{@code null}の場合 */ public AbstractDialect(DialectInitializer initializer) { Validate.notNull(initializer); + Validate.notNull(initializer.getMoldManager()); + Validate.notNull(initializer.getDataTypeResolver()); + Validate.notNull(initializer.getConnectionAdvisor()); + Validate.notNull(initializer.getSqlEmitter()); + Validate.notNull(initializer.getEntityImportVisitor()); + Validate.notNull(initializer.getForeignKeyImportVisitor()); moldManager = initializer.getMoldManager(); dataTypeResolver = initializer.getDataTypeResolver(); advisor = initializer.getConnectionAdvisor(); @@ -91,22 +98,26 @@ } public BuiltinDataTypeMold findDataTypeMold(BuiltinDataType dataType) { + assert moldManager != null; Validate.notNull(dataType); return moldManager.findDataTypeMold(dataType); } public BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category) { + assert moldManager != null; Validate.notNull(category); return moldManager.findDataTypeMold(category); } public BuiltinDataTypeMold findDataTypeMold(DataTypeCategory category, String typeName) { + assert moldManager != null; Validate.notNull(category); Validate.notNull(typeName); return moldManager.findDataTypeMold(category, typeName); } public List<BuiltinDataTypeMold> getAllDataTypes() { + assert moldManager != null; return moldManager.getTypeList(); } @@ -129,6 +140,11 @@ public void importMetadata(RootModel rootModel, DatabaseMetaData meta, ImportMetadataConfig config, Map<String, EntityModel> importedEntities, Map<String, ForeignKey> importedForeignKeys) throws SQLException { + Validate.notNull(rootModel); + Validate.notNull(meta); + Validate.notNull(config); + Validate.notNull(importedEntities); + Validate.notNull(importedForeignKeys); Connection connection = meta.getConnection(); TypeSafeDatabaseMetaData metaData = new TypeSafeDatabaseMetaData(meta); DatabaseReader reader = new DatabaseReader(this, config, meta); @@ -145,6 +161,7 @@ } public RootModel parseStatements(List<SqlStatement> statements) { + Validate.notNull(statements); throw new UnsupportedOperationException(); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/BuiltinDataTypeMoldImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/BuiltinDataTypeMoldImpl.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/BuiltinDataTypeMoldImpl.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -21,6 +21,8 @@ import java.util.Arrays; import java.util.Collection; +import org.apache.commons.lang.Validate; + import org.jiemamy.dialect.BuiltinDataTypeMold; import org.jiemamy.model.datatype.BuiltinDataType; import org.jiemamy.model.datatype.DataTypeCategory; @@ -46,6 +48,7 @@ * * @param category 型カテゴリ * @param supportedAdapterClasses この型がサポートするアダプタクラス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public BuiltinDataTypeMoldImpl(DataTypeCategory category, Class<?>... supportedAdapterClasses) { this(category, category.name(), supportedAdapterClasses); @@ -57,8 +60,12 @@ * @param category 型カテゴリ * @param name 型名 * @param supportedAdapterClasses この型がサポートするアダプタクラス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public BuiltinDataTypeMoldImpl(DataTypeCategory category, String name, Class<?>... supportedAdapterClasses) { + Validate.notNull(category); + Validate.notNull(name); + Validate.notNull(supportedAdapterClasses); this.category = category; this.name = name; this.supportedAdapterClasses = supportedAdapterClasses; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/EntityImportVisitor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/EntityImportVisitor.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/EntityImportVisitor.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -43,6 +43,7 @@ * @param config インポートに関するコンテキスト情報 * @param importedEntities インポートされたエンティティを格納する{@link Map} * @param dataTypeResolver データ型リゾルバ + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ void intialize(TypeSafeDatabaseMetaData meta, RootModel rootModel, ImportMetadataConfig config, Map<String, EntityModel> importedEntities, DataTypeResolver dataTypeResolver); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/ForeignKeyImportVisitor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/ForeignKeyImportVisitor.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/ForeignKeyImportVisitor.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -37,6 +37,7 @@ * * @param rootModel インポート先の{@link RootModel} * @param importedForeignKeys インポートされた外部キーを格納する{@link Map} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ void initialize(RootModel rootModel, Map<String, ForeignKey> importedForeignKeys); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/SqlEmitter.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/SqlEmitter.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/SqlEmitter.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -37,6 +37,7 @@ * @param rootModel 対象{@link RootModel} * @param instrunction 設定 * @return SQLのリスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ List<SqlStatement> emit(RootModel rootModel, EmitConfig instrunction); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/TokenResolver.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/TokenResolver.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/TokenResolver.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -33,7 +33,7 @@ * オブジェクトをトークン列に変換する。 * * @param value 変換対象 - * @return トークンシーケンス + * @return トークンシーケンス. 引数に{@code null}を与えた場合は空のリスト */ List<Token> resolve(Object value); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultDialectInitializer.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultDialectInitializer.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultDialectInitializer.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.dialect.internal.impl; +import org.apache.commons.lang.Validate; + import org.jiemamy.dialect.ConnectionAdvisor; import org.jiemamy.dialect.DataTypeResolver; import org.jiemamy.dialect.MoldManager; @@ -58,8 +60,10 @@ * インスタンスを生成する。 * * @param moldManager データ型鋳型の管理クラス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public DefaultDialectInitializer(MoldManager moldManager) { + Validate.notNull(moldManager); this.moldManager = moldManager; dataTypeResolver = new DefaultDataTypeResolver(moldManager); connectionAdvisor = new DefaultConnectionAdvisor(); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultEntityImportVisitor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultEntityImportVisitor.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultEntityImportVisitor.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -28,6 +28,7 @@ import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.Validate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,6 +104,12 @@ public void intialize(TypeSafeDatabaseMetaData meta, RootModel rootModel, ImportMetadataConfig config, Map<String, EntityModel> importedEntities, DataTypeResolver dataTypeResolver) { + Validate.notNull(meta); + Validate.notNull(rootModel); + Validate.notNull(config); + Validate.notNull(importedEntities); + Validate.notNull(dataTypeResolver); + this.meta = meta; this.rootModel = rootModel; this.config = config; @@ -122,6 +129,7 @@ } public Void visit(TableMeta tableMeta) throws SQLException { + Validate.notNull(tableMeta); if (entityTypes.contains(tableMeta.tableType) && (selectedEntities == null || selectedEntities.contains(tableMeta.tableName))) { JiemamyFactory factory = rootModel.getJiemamy().getFactory(); @@ -141,8 +149,11 @@ * @param tableMeta 読み込み対象エンティティの情報 * @return 読み込んだ結果生成された{@link ViewModel} * @throws SQLException SQLの実行に失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected EntityModel createEntity(JiemamyFactory factory, TableMeta tableMeta) throws SQLException { + Validate.notNull(factory); + Validate.notNull(tableMeta); EntityModel result = null; logger.debug("type = " + tableMeta.tableType + "(" + tableMeta.tableName + ")"); @@ -164,8 +175,11 @@ * @param tableName 読み込み対象テーブル名 * @return 読み込んだ結果生成された{@link TableModel} * @throws SQLException SQLの実行に失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected TableModel createTable(final JiemamyFactory factory, String tableName) throws SQLException { + Validate.notNull(factory); + Validate.notNull(tableName); final TableModel tableModel = factory.newModel(TableModel.class); final List<ColumnModel> columns = new ArrayList<ColumnModel>(); @@ -197,8 +211,11 @@ * @param viewName 読み込み対象ビュー名 * @return 読み込んだ結果生成された{@link ViewModel} * @throws SQLException SQLの実行に失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected ViewModel createView(JiemamyFactory factory, String viewName) throws SQLException { + Validate.notNull(factory); + Validate.notNull(viewName); // UNDONE ビューの定義SQLを取得する一般的な手段が分からない。 // bacchusでは実は実装できなかった所。 String definition = "VIEW DEFINITION (not implemented)"; @@ -235,14 +252,19 @@ * @param factory 新規モデル作成を行うためのファクトリ * @param dataTypeResolver データ型リゾルバ * @param columns 読み込んだカラムを格納するリスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ private ColumnMetaVisitor(JiemamyFactory factory, DataTypeResolver dataTypeResolver, List<ColumnModel> columns) { + Validate.notNull(factory); + Validate.notNull(dataTypeResolver); + Validate.notNull(columns); this.factory = factory; this.dataTypeResolver = dataTypeResolver; this.columns = columns; } public List<ColumnModel> visit(ColumnMeta element) { + Validate.notNull(element); BuiltinDataType dataType = dataTypeResolver.resolveDataType(factory, element.dataType, element.typeName); ColumnModel columnModel = factory.newModel(ColumnModel.class); @@ -297,15 +319,20 @@ * @param factory 新規モデル作成を行うためのファクトリ * @param primaryKeys 読み込んだPKを格納するテーブル * @param columns カラムのリスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ private PrimaryKeyMetaVisitor(JiemamyFactory factory, List<? super PrimaryKey> primaryKeys, List<ColumnModel> columns) { + Validate.notNull(factory); + Validate.notNull(primaryKeys); + Validate.notNull(columns); this.primaryKeys = primaryKeys; this.factory = factory; this.columns = columns; } public Boolean visit(PrimaryKeyMeta element) { + Validate.notNull(element); PrimaryKey primaryKey = factory.newModel(PrimaryKey.class); for (ColumnModel columnModel : columns) { if (columnModel.getName().equals(element.columnName)) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultForeignKeyImportVisitor.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -20,6 +20,8 @@ import java.util.Map; +import org.apache.commons.lang.Validate; + import org.jiemamy.JiemamyFactory; import org.jiemamy.dialect.internal.ForeignKeyImportVisitor; import org.jiemamy.model.RootModel; @@ -49,18 +51,15 @@ private Map<String, ForeignKey> importedForeignKeys; - /** - * インスタンスを生成する。 - * - * @param rootModel 書き込み先モデル - * @param importedForeignKeys インポートされた外部キー情報を格納する{@link Map} - */ public void initialize(RootModel rootModel, Map<String, ForeignKey> importedForeignKeys) { + Validate.notNull(rootModel); + Validate.notNull(importedForeignKeys); this.rootModel = rootModel; this.importedForeignKeys = importedForeignKeys; } public Void visit(KeyMeta keys) { + Validate.notNull(keys); TableModel constrainedTable = RootModelUtil.getEntity(rootModel, TableModel.class, keys.fkTableName); TableModel referenceTable = RootModelUtil.getEntity(rootModel, TableModel.class, keys.pkTableName); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultMoldManager.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultMoldManager.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultMoldManager.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -41,8 +41,10 @@ * インスタンスを生成する。 * * @param typeList データ型鋳型のリスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public DefaultMoldManager(List<BuiltinDataTypeMold> typeList) { + Validate.notNull(typeList); this.typeList = typeList; } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultSqlEmitter.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultSqlEmitter.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/dialect/internal/impl/DefaultSqlEmitter.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -93,6 +93,8 @@ } public List<SqlStatement> emit(RootModel rootModel, EmitConfig config) { + Validate.notNull(rootModel); + Validate.notNull(config); List<SqlStatement> result = CollectionsUtil.newArrayList(); // THINK RootBeginScript と CreateSchemaStatement、どっちが先? @@ -190,8 +192,11 @@ * @param tableModel インデックスをつけるテーブル * @param indexModel 対象インデックス * @return CREATE INDEX文 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected SqlStatement emitCreateIndexStatement(TableModel tableModel, IndexModel indexModel) { + Validate.notNull(tableModel); + Validate.notNull(indexModel); List<Token> tokens = CollectionsUtil.newArrayList(); tokens.add(Keyword.CREATE); if (indexModel.isUnique()) { @@ -222,8 +227,10 @@ * * @param schemaName スキーマ名 * @return CREATE SCHEMA文 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected SqlStatement emitCreateSchemaStatement(String schemaName) { + Validate.notNull(schemaName); List<Token> tokens = CollectionsUtil.newArrayList(); tokens.add(Keyword.CREATE); tokens.add(Keyword.SCHEMA); @@ -237,8 +244,10 @@ * * @param entityModel 対象エンティティ * @return DDL + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected SqlStatement emitCreateStatement(EntityModel entityModel) { + Validate.notNull(entityModel); return EntityEmitStrategy.fromEntity(entityModel).emit(entityModel, dataTypeResolver, tokenResolver); } @@ -642,8 +651,10 @@ * * @param entityModel 出力対象のエンティティモデル * @return 出力戦略 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static EntityEmitStrategy fromEntity(EntityModel entityModel) { + Validate.notNull(entityModel); for (EntityEmitStrategy s : values()) { if (s.clazz == entityModel.getClass()) { return s; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ArtemisJiemamyFactory.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ArtemisJiemamyFactory.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ArtemisJiemamyFactory.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -130,6 +130,7 @@ @SuppressWarnings("unchecked") public <T extends DataType>T newDataType(DataTypeMold<T> mold) { + Validate.notNull(mold); if (mold instanceof DomainModel) { DomainModel domainModel = (DomainModel) mold; return (T) newReference(domainModel); @@ -142,6 +143,7 @@ @SuppressWarnings("unchecked") public <T extends JiemamyFacade>T newFacade(Class<T> clazz) { + Validate.notNull(clazz); checkInitialized(); return (T) new JiemamyFacadeImpl(jiemamy); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/EventBrokerImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/EventBrokerImpl.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/EventBrokerImpl.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -58,6 +58,7 @@ } public void fireCommandProcessed(Command command) { + Validate.notNull(command); assert listeners != null; logger.info(LogMarker.LIFECYCLE, "EventBroker is kicked enter: " + command.toString()); logger.debug(LogMarker.LIFECYCLE, "target : " + command.getTarget()); @@ -87,6 +88,7 @@ public void removeListener(CommandListener listener) { assert listeners != null; + Validate.notNull(listener); listeners.remove(listener); logger.info(LogMarker.LIFECYCLE, "CommandListener is unregistered: " + listener.toString()); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/JiemamyFacadeImpl.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -32,6 +32,7 @@ import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; import org.jiemamy.JiemamyProperty; +import org.jiemamy.ReferenceResolver; import org.jiemamy.JiemamyProperty.ColumnProperty; import org.jiemamy.dialect.BuiltinDataTypeMold; import org.jiemamy.dialect.Dialect; @@ -99,7 +100,7 @@ protected final Jiemamy jiemamy; /** このファサードが発行したセーブポイントの集合 */ - private Collection<SavePointImpl> publishedSavePoints = CollectionsUtil.newArrayList(); + private Collection<SavePoint> publishedSavePoints = CollectionsUtil.newArrayList(); /** UNDOスタック */ protected EssentialStack<Command> undoStack = new ArrayEssentialStack<Command>(); @@ -122,77 +123,148 @@ } public void addAttribute(TableModel tableModel, AttributeModel attributeModel) { + Validate.notNull(tableModel); + Validate.notNull(attributeModel); + if (tableModel.getAttributes().contains(attributeModel)) { + return; + } + + if (attributeModel instanceof KeyConstraint) { + checkKeyConstraint(tableModel, (KeyConstraint) attributeModel); + } + AddAttributeCommand command = new AddAttributeCommand(eventBroker, tableModel, attributeModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addAttribute(TableModel tableModel, int index, AttributeModel attributeModel) { + Validate.notNull(tableModel); + Validate.notNull(attributeModel); + if (tableModel.getAttributes().contains(attributeModel)) { + return; + } + + if (attributeModel instanceof KeyConstraint) { + checkKeyConstraint(tableModel, (KeyConstraint) attributeModel); + } + AddAttributeCommand command = new AddAttributeCommand(eventBroker, tableModel, index, attributeModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addDataSet(DataSetModel dataSetModel) { - AddDataSetToRootCommand command = - new AddDataSetToRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), dataSetModel); + Validate.notNull(dataSetModel); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + if (rootModel.getDataSets().contains(dataSetModel)) { + return; + } + + AddDataSetToRootCommand command = new AddDataSetToRootCommand(eventBroker, rootModel, dataSetModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addDataSet(DataSetModel dataSetModel, int index) { - AddDataSetToRootCommand command = - new AddDataSetToRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), dataSetModel, index); + Validate.notNull(dataSetModel); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + if (rootModel.getDataSets().contains(dataSetModel)) { + return; + } + + AddDataSetToRootCommand command = new AddDataSetToRootCommand(eventBroker, rootModel, dataSetModel, index); command.execute(); undoStack.push(command.getNegateCommand()); } public void addDomain(DomainModel domainModel) { - AddDomainToRootCommand command = - new AddDomainToRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), domainModel); + Validate.notNull(domainModel); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + if (rootModel.getDomains().contains(domainModel)) { + return; + } + + AddDomainToRootCommand command = new AddDomainToRootCommand(eventBroker, rootModel, domainModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addDomain(DomainModel domainModel, int index) { - AddDomainToRootCommand command = - new AddDomainToRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), domainModel, index); + Validate.notNull(domainModel); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + if (rootModel.getDomains().contains(domainModel)) { + return; + } + + AddDomainToRootCommand command = new AddDomainToRootCommand(eventBroker, rootModel, domainModel, index); command.execute(); undoStack.push(command.getNegateCommand()); } public void addEntity(EntityModel entityModel) { - AddEntityToRootCommand command = - new AddEntityToRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), entityModel); + Validate.notNull(entityModel); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + if (rootModel.getEntities().contains(entityModel)) { + return; + } + + AddEntityToRootCommand command = new AddEntityToRootCommand(eventBroker, rootModel, entityModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addIndex(TableModel tableModel, IndexModel indexModel) { + Validate.notNull(tableModel); + Validate.notNull(indexModel); + if (tableModel.getIndexes().contains(indexModel)) { + return; + } + AddIndexCommand command = new AddIndexCommand(eventBroker, tableModel, indexModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addIndex(TableModel tableModel, int index, IndexModel indexModel) { + Validate.notNull(tableModel); + Validate.notNull(indexModel); + if (tableModel.getIndexes().contains(indexModel)) { + return; + } + AddIndexCommand command = new AddIndexCommand(eventBroker, tableModel, index, indexModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addIndexColumn(IndexModel indexModel, IndexColumnModel indexColumnModel) { + Validate.notNull(indexColumnModel); + Validate.notNull(indexColumnModel); + if (indexModel.getIndexColumns().contains(indexColumnModel)) { + return; + } + AddIndexColumnCommand command = new AddIndexColumnCommand(eventBroker, indexModel, indexColumnModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addIndexColumn(IndexModel indexModel, int index, IndexColumnModel indexColumnModel) { + Validate.notNull(indexColumnModel); + Validate.notNull(indexColumnModel); + if (indexModel.getIndexColumns().contains(indexColumnModel)) { + return; + } + AddIndexColumnCommand command = new AddIndexColumnCommand(eventBroker, indexModel, index, indexColumnModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void addKeyColumn(KeyConstraint keyConstraint, ColumnModel columnModel) { + Validate.notNull(keyConstraint); + Validate.notNull(columnModel); // 既に指定したカラムがキーカラムの要素であった場合は何もしない ColumnRef columnRef = columnModel.getJiemamy().getFactory().newReference(columnModel); if (keyConstraint.getKeyColumns().contains(columnRef)) { @@ -207,6 +279,12 @@ } public void addRecords(DataSetModel dataSetModel, TableModel tableModel) { + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); + if (dataSetModel.getRecords().containsKey(tableModel)) { + return; + } + Command command = new AddRecordsToDataSetCommand(eventBroker, dataSetModel, tableModel); command.execute(); undoStack.push(command.getNegateCommand()); @@ -219,6 +297,8 @@ } public void removeAttribute(TableModel tableModel, AttributeModel attributeModel) { + Validate.notNull(tableModel); + Validate.notNull(attributeModel); // ローカルキーを削除する場合、そのキーを参照する外部キーも同時に削除する if (attributeModel instanceof LocalKeyConstraint) { LocalKeyConstraint localKeyConstraint = (LocalKeyConstraint) attributeModel; @@ -252,17 +332,27 @@ } public void removeDataSet(DataSetModel dataSetModel) { - RemoveDataSetFromRootCommand command = - new RemoveDataSetFromRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), dataSetModel); + Validate.notNull(dataSetModel); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + if (rootModel.getDataSets().contains(dataSetModel) == false) { + return; + } + + RemoveDataSetFromRootCommand command = new RemoveDataSetFromRootCommand(eventBroker, rootModel, dataSetModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void removeDomain(DomainModel domainModel) { + Validate.notNull(domainModel); + JiemamyFactory factory = jiemamy.getFactory(); + RootModel rootModel = factory.getRootModel(); + if (rootModel.getDomains().contains(domainModel) == false) { + return; + } + // 該当ドメインへの参照は、ドメインに設定されていた型情報に書き換える - JiemamyFactory factory = jiemamy.getFactory(); DomainRef domainRef = factory.newReference(domainModel); - RootModel rootModel = factory.getRootModel(); Dialect dialect; try { dialect = RootModelUtil.getDialect(rootModel); @@ -298,13 +388,19 @@ } } - RemoveDomainFromRootCommand command = - new RemoveDomainFromRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), domainModel); + RemoveDomainFromRootCommand command = new RemoveDomainFromRootCommand(eventBroker, rootModel, domainModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void removeEntity(EntityModel entityModel) { + Validate.notNull(entityModel); + JiemamyFactory factory = jiemamy.getFactory(); + RootModel rootModel = factory.getRootModel(); + if (rootModel.getEntities().contains(entityModel) == false) { + return; + } + if (entityModel instanceof TableModel) { // 該当エンティティを参照する外部キーも同時に削除する TableModel tableModel = (TableModel) entityModel; @@ -322,33 +418,44 @@ } // DataSetModelが持つテーブルへの参照も同時に削除する - JiemamyFactory factory = jiemamy.getFactory(); - RootModel rootModel = factory.getRootModel(); List<DataSetModel> dataSets = rootModel.getDataSets(); for (DataSetModel dataSetModel : dataSets) { removeRecords(dataSetModel, tableModel); } } - RemoveEntityFromRootCommand command = - new RemoveEntityFromRootCommand(eventBroker, jiemamy.getFactory().getRootModel(), entityModel); + RemoveEntityFromRootCommand command = new RemoveEntityFromRootCommand(eventBroker, rootModel, entityModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void removeIndex(TableModel tableModel, IndexModel indexModel) { + Validate.notNull(tableModel); + Validate.notNull(indexModel); + if (tableModel.getIndexes().contains(indexModel) == false) { + return; + } + RemoveIndexCommand command = new RemoveIndexCommand(eventBroker, tableModel, indexModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void removeIndexColumn(IndexModel indexModel, IndexColumnModel indexColumnModel) { + Validate.notNull(indexModel); + Validate.notNull(indexColumnModel); + if (indexModel.getIndexColumns().contains(indexColumnModel) == false) { + return; + } + RemoveIndexColumnCommand command = new RemoveIndexColumnCommand(eventBroker, indexModel, indexColumnModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void removeKeyColumn(KeyConstraint keyConstraint, ColumnModel columnModel) { + Validate.notNull(keyConstraint); + Validate.notNull(columnModel); // キーカラム要素が、指定したカラムへの参照を保持していなかった場合は、何もしない JiemamyFactory factory = jiemamy.getFactory(); int index = keyConstraint.getKeyColumns().indexOf(factory.newReference(columnModel)); @@ -384,12 +491,19 @@ } public void removeRecords(DataSetModel dataSetModel, TableModel tableModel) { + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); + if (dataSetModel.getRecords().containsKey(jiemamy.getFactory().newReference(tableModel)) == false) { + return; + } + Command command = new RemoveRecordsFromDataSetCommand(eventBroker, dataSetModel, tableModel); command.execute(); undoStack.push(command.getNegateCommand()); } public void rollback(SavePoint savePoint) { + Validate.notNull(savePoint); if (publishedSavePoints.contains(savePoint) == false) { throw new IllegalArgumentException(); } @@ -425,7 +539,7 @@ public SavePoint save() { EssentialStack<Command> undoCopy = new ArrayEssentialStack<Command>(undoStack); - SavePointImpl sp = new SavePointImpl(undoCopy); + SavePoint sp = new SavePointImpl(undoCopy); publishedSavePoints.add(sp); return sp; } @@ -450,4 +564,15 @@ command.execute(); undoStack.push(command.getNegateCommand()); } + + private void checkKeyConstraint(TableModel tableModel, KeyConstraint keyConstraint) { + ReferenceResolver referenceResolver = jiemamy.getReferenceResolver(); + List<ColumnRef> keyColumns = keyConstraint.getKeyColumns(); + for (ColumnRef columnRef : keyColumns) { + ColumnModel columnModel = referenceResolver.resolve(columnRef); + if (tableModel.getAttributes().contains(columnModel) == false) { + throw new IllegalArgumentException(); + } + } + } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ReferenceResolverImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ReferenceResolverImpl.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/ReferenceResolverImpl.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -31,6 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.jiemamy.ReferenceResolveException; import org.jiemamy.ReferenceResolver; import org.jiemamy.model.ElementReference; import org.jiemamy.model.JiemamyElement; @@ -176,6 +177,11 @@ public <T extends JiemamyElement>T resolve(ElementReference<T> reference) { assert elementMapping != null; Validate.notNull(reference); + + if (elementMapping.containsKey(reference.getReferenceId()) == false) { + throw new ReferenceResolveException(reference); + } + return (T) elementMapping.get(reference.getReferenceId()); } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/SavePointImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/SavePointImpl.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/SavePointImpl.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal; +import org.apache.commons.lang.Validate; + import org.jiemamy.editcommand.Command; import org.jiemamy.facade.SavePoint; import org.jiemamy.utils.ArrayEssentialStack; @@ -31,7 +33,7 @@ * @see JiemamyFacadeImpl#rollback(SavePoint) * @author daisuke */ -public class SavePointImpl implements SavePoint { +class SavePointImpl implements SavePoint { private final EssentialStack<Command> undoStackSnapShot; @@ -40,8 +42,10 @@ * インスタンスを生成する。 * * @param undoStack save時のundo stackの状態 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public SavePointImpl(EssentialStack<Command> undoStack) { + Validate.notNull(undoStack); undoStackSnapShot = new ArrayEssentialStack<Command>(undoStack); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractAddToCollectionCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractAddToCollectionCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractAddToCollectionCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -75,6 +75,7 @@ * @param target 対象親モデル * @param element 追加対象の子モデル要素 * @param index 追加される位置インデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AbstractAddToCollectionCommand(EventBroker eventBroker, P target, C element, int index) { super(eventBroker); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractRemoveFromCollectionCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractRemoveFromCollectionCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AbstractRemoveFromCollectionCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -78,6 +78,7 @@ * @param eventBroker イベント通知用{@link EventBroker} * @param target 対象親モデル * @param index 追加される位置インデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AbstractRemoveFromCollectionCommand(EventBroker eventBroker, P target, int index) { super(eventBroker); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddAttributeCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddAttributeCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddAttributeCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -65,6 +65,7 @@ * @param tableModel 追加されるテーブル * @param index 追加位置をあらわすインデックス値 * @param attributeModel 追加するカラム + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddAttributeCommand(EventBroker eventBroker, TableModel tableModel, int index, AttributeModel attributeModel) { super(eventBroker, tableModel, attributeModel, index); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddColumnToColumnRefListCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddColumnToColumnRefListCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddColumnToColumnRefListCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -56,6 +56,7 @@ * @param target 操作対象の{@link JiemamyElement} * @param columnRefList 追加対象のリスト * @param columnModel 追加されるカラム + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddColumnToColumnRefListCommand(EventBroker eventBroker, JiemamyElement target, List<ColumnRef> columnRefList, ColumnModel columnModel) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDataSetToRootCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDataSetToRootCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDataSetToRootCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -52,6 +52,7 @@ * @param rootModel 追加される{@link RootModel} * @param dataSetModel 追加する{@link DataSetModel} * @param index 追加位置をあらわすインデックス値 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddDataSetToRootCommand(EventBroker eventBroker, RootModel rootModel, DataSetModel dataSetModel, int index) { super(eventBroker, rootModel, dataSetModel, index); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDomainToRootCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDomainToRootCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddDomainToRootCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -52,6 +52,7 @@ * @param rootModel 追加される{@link RootModel} * @param domainModel 追加する{@link DomainModel} * @param index 追加位置をあらわすインデックス値 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddDomainToRootCommand(EventBroker eventBroker, RootModel rootModel, DomainModel domainModel, int index) { super(eventBroker, rootModel, domainModel, index); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexColumnCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexColumnCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexColumnCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -54,6 +54,7 @@ * @param tableModel 追加される{@link TableModel} * @param index 追加位置をあらわすインデックス値 * @param indexModel 追加する{@link DomainModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddIndexColumnCommand(EventBroker eventBroker, IndexModel tableModel, int index, IndexColumnModel indexModel) { super(eventBroker, tableModel, indexModel, index); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddIndexCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -53,6 +53,7 @@ * @param tableModel 追加される{@link TableModel} * @param index 追加位置をあらわすインデックス値 * @param indexModel 追加する{@link DomainModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddIndexCommand(EventBroker eventBroker, TableModel tableModel, int index, IndexModel indexModel) { super(eventBroker, tableModel, indexModel, index); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddRecordsToDataSetCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddRecordsToDataSetCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/AddRecordsToDataSetCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -21,6 +21,8 @@ import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.JiemamyFactory; import org.jiemamy.editcommand.Command; @@ -52,6 +54,7 @@ * @param eventBroker イベント通知用{@link EventBroker} * @param dataSetModel レコード追加対象の{@link DataSetModel} * @param tableModel レコード追加対象の{@link TableModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddRecordsToDataSetCommand(EventBroker eventBroker, DataSetModel dataSetModel, TableModel tableModel) { this(eventBroker, dataSetModel, tableModel, new ArrayList<RecordModel>()); @@ -64,10 +67,14 @@ * @param dataSetModel レコード削除元の{@link DataSetModel} * @param tableModel レコード削除対象の{@link TableModel} * @param records データセット保存用リストとして使用するインスタンス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddRecordsToDataSetCommand(EventBroker eventBroker, DataSetModel dataSetModel, TableModel tableModel, List<RecordModel> records) { super(eventBroker); + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); + Validate.notNull(records); this.dataSetModel = dataSetModel; this.tableModel = tableModel; this.records = records; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveColumnFromColumnRefListCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveColumnFromColumnRefListCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveColumnFromColumnRefListCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -90,10 +90,14 @@ * @param columnRefList 削除対象のリスト * @param columnModel 削除されるカラム * @param index 追加位置をあらわすインデックス値 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RemoveColumnFromColumnRefListCommand(EventBroker eventBroker, JiemamyElement target, List<ColumnRef> columnRefList, ColumnModel columnModel, int index) { super(eventBroker); + Validate.notNull(target); + Validate.notNull(columnRefList); + Validate.notNull(columnModel); this.target = target; this.columnRefList = columnRefList; this.columnModel = columnModel; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveRecordsFromDataSetCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveRecordsFromDataSetCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/RemoveRecordsFromDataSetCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -20,6 +20,8 @@ import java.util.List; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.JiemamyFactory; import org.jiemamy.editcommand.Command; @@ -50,9 +52,12 @@ * @param eventBroker イベント通知用{@link EventBroker} * @param dataSetModel レコード削除元の{@link DataSetModel} * @param tableModel レコード削除対象の{@link TableModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RemoveRecordsFromDataSetCommand(EventBroker eventBroker, DataSetModel dataSetModel, TableModel tableModel) { super(eventBroker); + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); this.dataSetModel = dataSetModel; this.tableModel = tableModel; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/SetRecordValueCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/SetRecordValueCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/SetRecordValueCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal.editcommand; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.JiemamyElement; @@ -55,10 +57,13 @@ * @param recordModel 対象レコード * @param columnModel 対象カラム * @param newValue データ + * @throws IllegalArgumentException 引数newValue<b>以外</b>に{@code null}を与えた場合 */ public SetRecordValueCommand(EventBroker eventBroker, RecordModel recordModel, ColumnModel columnModel, String newValue) { super(eventBroker); + Validate.notNull(recordModel); + Validate.notNull(columnModel); this.recordModel = recordModel; this.columnModel = columnModel; this.newValue = newValue; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/UpdateForeignKeyMappingCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/UpdateForeignKeyMappingCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/editcommand/UpdateForeignKeyMappingCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -20,6 +20,8 @@ import java.util.List; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.JiemamyElement; @@ -57,10 +59,14 @@ * @param foreignKey 更新対象の外部キー * @param newKeyColumns 新しいキーカラム列 * @param newReferenceColumns 新しい参照カラム列 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public UpdateForeignKeyMappingCommand(EventBroker eventBroker, ForeignKey foreignKey, List<ColumnRef> newKeyColumns, List<ColumnRef> newReferenceColumns) { super(eventBroker); + Validate.notNull(foreignKey); + Validate.notNull(newKeyColumns); + Validate.notNull(newReferenceColumns); this.foreignKey = foreignKey; this.newKeyColumns = newKeyColumns; this.newReferenceColumns = newReferenceColumns; Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/enhance/FactoryExtension.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/enhance/FactoryExtension.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/enhance/FactoryExtension.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -28,8 +28,11 @@ import java.util.TreeSet; import java.util.UUID; +import org.apache.commons.lang.Validate; + import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; +import org.jiemamy.ReferenceResolveException; import org.jiemamy.ReferenceResolver; import org.jiemamy.dialect.generic.GenericDialect; import org.jiemamy.exception.UnexpectedConditionError; @@ -97,9 +100,11 @@ * @param clazz 生成したいインスタンスの型 * @return 新しいアダプタインスタンス * @throws IllegalArgumentException 引数に与えたクラスが、生成に対応していない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ @SuppressWarnings("unchecked") public T newAdapter(Class<T> clazz) { + Validate.notNull(clazz); T adapter; if (clazz == Disablable.class) { adapter = (T) new DisablableImpl(); @@ -123,9 +128,12 @@ * @param clazz 生成したいインスタンスの型 * @param factory ファクトリ * @return 新しいビルダインスタンス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ @SuppressWarnings("unchecked") public T newBuilder(Class<T> clazz, JiemamyFactory factory) { + Validate.notNull(clazz); + Validate.notNull(factory); T builder = null; if (TableBuilder.class.isAssignableFrom(clazz)) { builder = (T) new TableBuilderImpl(factory); @@ -141,8 +149,11 @@ * @param clazz 生成したいインスタンスの型 * @param jiemamy インスタンス空間 * @return 生成されたインスタンス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public T newInstance(Class<T> clazz, Jiemamy jiemamy) { + Validate.notNull(clazz); + Validate.notNull(jiemamy); return newInstance(clazz, jiemamy, UUID.randomUUID()); } @@ -157,8 +168,12 @@ * @param jiemamy インスタンス空間 * @param id モデルID * @return 生成されたインスタンス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public T newInstance(Class<T> clazz, Jiemamy jiemamy, UUID id) { + Validate.notNull(clazz); + Validate.notNull(jiemamy); + Validate.notNull(id); ModelStrategy modelStrategy = ModelStrategy.fromClass(clazz); if (modelStrategy == null) { return null; @@ -247,8 +262,15 @@ public int compare(ElementReference<?> o1, ElementReference<?> o2) { ReferenceResolver resolver = jiemamy.getReferenceResolver(); - JiemamyElement e1 = resolver.resolve(o1); - JiemamyElement e2 = resolver.resolve(o2); + JiemamyElement e1; + JiemamyElement e2; + try { + e1 = resolver.resolve(o1); + e2 = resolver.resolve(o2); + } catch (ReferenceResolveException e) { + e1 = null; + e2 = null; + } return JiemamyElementComparator.INSTANCE.compare(e1, e2); } } @@ -265,6 +287,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); RootModelImpl rootModel = new RootModelImpl(jiemamy, id); rootModel.setDomains(new ArrayList<DomainModel>()); rootModel.setEntities(new TreeSet<EntityModel>(JiemamyElementComparator.INSTANCE)); @@ -278,6 +302,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); TableModelImpl tableModel = new TableModelImpl(jiemamy, id); tableModel.setAttributes(new ArrayList<AttributeModel>()); @@ -291,6 +317,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); ViewModelImpl viewModel = new ViewModelImpl(jiemamy, id); viewModel.registerAdapter(factory.newAdapter(Disablable.class)); @@ -302,6 +330,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); ColumnModelImpl columnModel = new ColumnModelImpl(jiemamy, id); columnModel.registerAdapter(factory.newAdapter(RepresentationAdapter.class)); @@ -314,6 +344,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); PrimaryKeyImpl primaryKey = new PrimaryKeyImpl(jiemamy, id); primaryKey.setKeyColumns(new ArrayList<ColumnRef>()); @@ -326,6 +358,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); UniqueKeyImpl uniqueKey = new UniqueKeyImpl(jiemamy, id); uniqueKey.setKeyColumns(new ArrayList<ColumnRef>()); @@ -338,6 +372,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); ForeignKeyImpl foreignKey = new ForeignKeyImpl(jiemamy, id); foreignKey.setKeyColumns(new ArrayList<ColumnRef>()); @@ -351,6 +387,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); DeferrabilityImpl deferrability = new DeferrabilityImpl(jiemamy, id); return (T) deferrability; } @@ -360,6 +398,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); TableCheckConstraintImpl checkConstraint = new TableCheckConstraintImpl(jiemamy, id); checkConstraint.registerAdapter(factory.newAdapter(Disablable.class)); @@ -371,6 +411,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); ColumnCheckConstraintImpl checkConstraint = new ColumnCheckConstraintImpl(jiemamy, id); checkConstraint.registerAdapter(factory.newAdapter(Disablable.class)); @@ -382,6 +424,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); NotNullConstraintImpl nnModel = new NotNullConstraintImpl(jiemamy, id); nnModel.registerAdapter(factory.newAdapter(Disablable.class)); @@ -393,6 +437,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); DomainModelImpl domainModel = new DomainModelImpl(jiemamy, id); return (T) domainModel; } @@ -402,6 +448,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); DataSetModelImpl insertDataSetModel = new DataSetModelImpl(jiemamy, id); insertDataSetModel .setRecords(new TreeMap<TableRef, List<RecordModel>>(new ReferenceComparator(jiemamy))); @@ -413,6 +461,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); RecordModelImpl recordModel = new RecordModelImpl(jiemamy, id); recordModel.setValues(new HashMap<ColumnRef, String>()); return (T) recordModel; @@ -423,6 +473,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); JiemamyFactory factory = jiemamy.getFactory(); IndexModelImpl indexModel = new IndexModelImpl(jiemamy, id); indexModel.setColumns(new ArrayList<IndexColumnModel>()); @@ -435,6 +487,8 @@ @Override public <T>T newInstance(Jiemamy jiemamy, UUID id) { + Validate.notNull(jiemamy); + Validate.notNull(id); IndexColumnModelImpl indexColumnModel = new IndexColumnModelImpl(jiemamy, id); return (T) indexColumnModel; } @@ -444,7 +498,7 @@ * 型からモデルインスタンス生成戦略を取得する。 * * @param clazz 型 - * @return モデルインスタンス生成戦略。戦略が存在しない場合は{@code null} + * @return モデルインスタンス生成戦略. 戦略が存在しない場合は{@code null} */ public static ModelStrategy fromClass(Class<?> clazz) { return ClassToModelStrategy.get(clazz); @@ -467,6 +521,7 @@ * @param jiemamy コンテキスト * @param id モデルID * @return モデルインスタンス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public abstract <T>T newInstance(Jiemamy jiemamy, UUID id); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomParser.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -180,6 +180,7 @@ * インスタンスを生成する。 * @param jiemamy コンテキスト * @param document 読み込むDOMドキュメント + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public JiemamyDomParser(Jiemamy jiemamy, Document document) { Validate.notNull(jiemamy); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomSerializer.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomSerializer.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/internal/serializer/JiemamyDomSerializer.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -140,6 +140,7 @@ * @throws ParserConfigurationException DocumentBuilderFactoryの設定異常 * @throws SAXException XMLのパースに失敗した場合 * @throws IOException 入出力エラーが発生した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected Document toDom(InputStream in) throws ParserConfigurationException, SAXException, IOException { DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); @@ -171,6 +172,7 @@ * @param rootModel 読み込む{@link RootModel} * @return DOMドキュメント * @throws ParserConfigurationException DocumentBuilderFactoryの設定異常 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected Document toDom(RootModel rootModel) throws ParserConfigurationException { return new JiemamyDomBuilder(rootModel).build(); @@ -182,6 +184,7 @@ * @param document 読み込むDOMドキュメント * @return {@link RootModel} * @throws SerializationException シリアライズに失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ protected RootModel toRootModel(Document document) throws SerializationException { return new JiemamyDomParser(jiemamy, document).parse(); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ArrayEssentialStack.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -22,6 +22,7 @@ import java.util.Iterator; import org.apache.commons.collections15.ArrayStack; +import org.apache.commons.lang.Validate; /** * {@link EssentialStack}の{@link ArrayStack}を用いた実装。 @@ -48,8 +49,10 @@ * インスタンスを生成する。 * * @param collection 初期要素を保持したコレクション + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public ArrayEssentialStack(Collection<? extends E> collection) { + Validate.notNull(collection); int size = collection.size(); int capacity = (int) Math.min(size * GROWTH_FACTOR, Integer.MAX_VALUE); @@ -63,8 +66,10 @@ * インスタンスを生成する。 * * @param source 初期要素を保持したスタック + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public ArrayEssentialStack(EssentialStack<? extends E> source) { + Validate.notNull(source); stack = new ArrayStack<E>(source.size()); for (E element : source) { stack.push(element); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/AttributeComparator.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -81,6 +81,14 @@ } public int compare(AttributeModel o1, AttributeModel o2) { + if (o1 == o2) { + return 0; + } + if (o1 == null) { + return -1; + } else if (o2 == null) { + return 1; + } int i1 = getOrder(o1.getClass().getInterfaces()); int i2 = getOrder(o2.getClass().getInterfaces()); if (i1 != i2) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DatabaseCleaner.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DatabaseCleaner.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DatabaseCleaner.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -55,6 +55,7 @@ * * @param config DB接続情報 * @throws ImportException DB情報の読み込みに失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public void clean(DatabaseImportConfig config) throws ImportException { logger.info("clean: " + config.getUri()); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/DomUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -100,7 +100,8 @@ * * @param element 検査対象要素 * @param qName 完全修飾名 - * @return 要素が指定された完全修飾名を持っていれば{@code true} + * @return 要素が指定された完全修飾名を持っている場合は{@code true}、そうでない場合は{@code false}. + * 引数に{@code null}を与えた場合は常に{@code false} */ public static boolean isEqualsQName(Element element, QName qName) { if (element == null || qName == null) { @@ -119,6 +120,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static Element newChild(Element parentElement, JiemamyQName qName) { + Validate.notNull(parentElement); Validate.notNull(qName); return newChild(parentElement, qName.getQName()); } @@ -134,6 +136,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static Element newChild(Element parentElement, JiemamyQName qName, Enum<?> e) { + Validate.notNull(parentElement); Validate.notNull(qName); return newChild(parentElement, qName.getQName(), e); } @@ -146,8 +149,11 @@ * @param qName 完全修飾要素名 * @param text 設定値 * @return 生成された要素 + * @throws IllegalArgumentException 引数parentElement, qNameに{@code null}を与えた場合 */ public static Element newChild(Element parentElement, JiemamyQName qName, String text) { + Validate.notNull(parentElement); + Validate.notNull(qName); return newChild(parentElement, qName.getQName(), text); } @@ -161,6 +167,7 @@ */ public static Element newChild(Element parentElement, QName qName) { Validate.notNull(parentElement); + Validate.notNull(qName); Element childElement = newElement(parentElement.getOwnerDocument(), qName); parentElement.appendChild(childElement); return childElement; @@ -176,8 +183,11 @@ * @param qName 完全修飾要素名 * @param e 設定値 * @return 生成された要素 + * @throws IllegalArgumentException 引数parentElement, qNameに{@code null}を与えた場合 */ public static Element newChild(Element parentElement, QName qName, Enum<?> e) { + Validate.notNull(parentElement); + Validate.notNull(qName); Element childElement = null; if (e != null) { childElement = newChild(parentElement, qName, e.name()); @@ -198,6 +208,8 @@ * @throws IllegalArgumentException 引数parentElement, qNameに{@code null}を与えた場合 */ public static Element newChild(Element parentElement, QName qName, String text) { + Validate.notNull(parentElement); + Validate.notNull(qName); Element childElement = null; if (text != null) { childElement = newChild(parentElement, qName); @@ -215,6 +227,7 @@ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static Element newElement(Document document, JiemamyQName qName) { + Validate.notNull(document); Validate.notNull(qName); return newElement(document, qName.getQName()); } @@ -261,6 +274,7 @@ * @throws IllegalArgumentException 引数elementに{@code null}を与えた場合 */ public static void setText(Element element, String text) { + Validate.notNull(element); if (text != null) { element.appendChild(element.getOwnerDocument().createTextNode(text)); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/EssentialStacks.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -19,6 +19,7 @@ package org.jiemamy.utils; import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.Validate; /** * {@link EssentialStack}のユーティリティクラス。 @@ -36,8 +37,11 @@ * @param left 左辺スタック * @param right 右辺スタック * @return 部分スタック + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static <E>EssentialStack<E> intersection(EssentialStack<? extends E> left, EssentialStack<? extends E> right) { + Validate.notNull(left); + Validate.notNull(right); EssentialStack<E> result = new ArrayEssentialStack<E>(Math.min(left.size(), right.size())); int i = 0; @@ -65,8 +69,11 @@ * @param left 左辺スタック * @param right 右辺スタック * @return 部分スタック + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static <E>EssentialStack<E> minus(EssentialStack<? extends E> left, EssentialStack<? extends E> right) { + Validate.notNull(left); + Validate.notNull(right); EssentialStack<E> result = new ArrayEssentialStack<E>(left); for (E er : right) { for (E el : left) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LocalizedMessages.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LocalizedMessages.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/LocalizedMessages.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -23,6 +23,8 @@ import java.util.Locale; import java.util.Map; +import org.apache.commons.lang.Validate; + /** * 国際化メッセージを管理するクラス。 * @@ -39,8 +41,11 @@ * @param localeIndication ロケール指示 * @param argments メッセージ引数 * @return メッセージ + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public String getMessage(Locale localeIndication, Object[] argments) { + Validate.notNull(localeIndication); + Validate.notNull(argments); String message = null; Locale locale = null; for (Locale loc : Arrays.asList(localeIndication, Locale.getDefault(), Locale.US)) { @@ -67,8 +72,11 @@ * * @param locale ロケール * @param pattern メッセージフォーマット + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public void register(Locale locale, String pattern) { + Validate.notNull(locale); + Validate.notNull(pattern); messages.put(locale, pattern); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidatorUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidatorUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidatorUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -20,6 +20,8 @@ import java.util.Collection; +import org.apache.commons.lang.Validate; + import org.jiemamy.validator.Problem; import org.jiemamy.validator.Validator; import org.jiemamy.validator.Problem.Severity; @@ -37,8 +39,11 @@ * @param problems 問題の集合 * @param severity 問題の重要度 * @return 指定した問題の重要度<b>以上</b>の問題数 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static int sizeOf(Collection<Problem> problems, Severity severity) { + Validate.notNull(problems); + Validate.notNull(severity); int count = 0; for (Problem problem : problems) { if (problem.getSeverity().ordinal() <= severity.ordinal()) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/AttributeUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -44,8 +44,11 @@ * * @param attributeModel 設定対象の属性 * @param rootModel ルートモデル + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void autoDenominate(AttributeModel attributeModel, RootModel rootModel) { + Validate.notNull(attributeModel); + Validate.notNull(rootModel); ReferenceResolver resolver = rootModel.getJiemamy().getReferenceResolver(); TableModel tableModel = AttributeUtil.getDefinedTable(attributeModel); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/DataSetUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -28,6 +28,8 @@ import au.com.bytecode.opencsv.CSVReader; import au.com.bytecode.opencsv.CSVWriter; +import org.apache.commons.lang.Validate; + import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; import org.jiemamy.exception.UnexpectedConditionError; @@ -53,9 +55,13 @@ * @param tableModel 対象テーブル * @param out 出力ストリーム * @throws IOException 入出力エラーが発生した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void exportToCsv(DataSetModel dataSetModel, TableModel tableModel, OutputStream out) throws IOException { + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); + Validate.notNull(out); Jiemamy jiemamy = tableModel.getJiemamy(); JiemamyFactory factory = jiemamy.getFactory(); @@ -99,9 +105,14 @@ * @param tableModel 対象テーブル * @param in 入力ストリーム * @throws IOException 入出力エラーが発生した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void importFromCsv(DataSetModel dataSetModel, TableModel tableModel, InputStream in) throws IOException { + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); + Validate.notNull(in); + JiemamyFactory factory = tableModel.getJiemamy().getFactory(); TableRef tableRef = factory.newReference(tableModel); @@ -140,8 +151,12 @@ * @param dataSetModel 対象{@link DataSetModel} * @param tableModel 設定対象テーブル * @param records レコード + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void setRecord(DataSetModel dataSetModel, TableModel tableModel, List<RecordModel> records) { + Validate.notNull(dataSetModel); + Validate.notNull(tableModel); + Validate.notNull(records); JiemamyFactory factory = tableModel.getJiemamy().getFactory(); TableRef ref = factory.newReference(tableModel); dataSetModel.getRecords().put(ref, records); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EntityUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -112,8 +112,10 @@ * * @param standardEntity 基準エンティティ * @return 直接の依存モデルの集合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ private static Collection<EntityModel> getDependentEntitiesNonRecursive(EntityModel standardEntity) { + Validate.notNull(standardEntity); Set<EntityModel> dependents = CollectionsUtil.newHashSet(); Jiemamy jiemamy = standardEntity.getJiemamy(); RootModel rootModel = jiemamy.getFactory().getRootModel(); @@ -147,8 +149,10 @@ * * @param standardEntity 基準エンティティ * @return 全ての依存モデルの集合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ private static Collection<EntityModel> getDependentEntitiesRecursive(EntityModel standardEntity) { + Validate.notNull(standardEntity); Collection<EntityModel> parentEntities = getDependentEntitiesNonRecursive(standardEntity); Set<EntityModel> entities = CollectionsUtil.newHashSet(); entities.addAll(parentEntities); @@ -167,8 +171,10 @@ * * @param entityModel 対象エンティティ * @return 親モデルのSet + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ private static Collection<EntityModel> getReferenceEntitiesNonRecursive(EntityModel entityModel) { + Validate.notNull(entityModel); Collection<EntityModel> parents = CollectionsUtil.newArrayList(); if (entityModel instanceof TableModel) { @@ -187,8 +193,10 @@ * * @param entityModel 対象エンティティ * @return 祖先モデルのSet + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ private static Collection<EntityModel> getReferenceEntitiesRecursive(EntityModel entityModel) { + Validate.notNull(entityModel); Collection<EntityModel> parentEntities = getReferenceEntitiesNonRecursive(entityModel); Collection<EntityModel> entities = CollectionsUtil.newArrayList(); entities.addAll(parentEntities); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EqualsUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EqualsUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/EqualsUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -25,8 +25,6 @@ import java.util.Arrays; import java.util.List; -import org.apache.commons.lang.Validate; - import org.jiemamy.Jiemamy; import org.jiemamy.exception.UnexpectedConditionError; import org.jiemamy.model.Adapter; @@ -68,8 +66,17 @@ * @return 等しい場合は{@code true}、そうでない場合は{@code false} */ public static boolean equals(Object left, Object right) { - Validate.notNull(left); - Validate.notNull(right); + leftGTree = null; + rightGTree = null; + if (left == right) { + return true; + } + if (left == null || right == null) { + return false; + } + if (left.getClass() != right.getClass()) { + return false; + } // コンバータを作る ObjectConverter converter = Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/KeyConstraintUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/KeyConstraintUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/KeyConstraintUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -43,6 +43,7 @@ * * @param keyModel 対象キー制約モデル * @param columnModel 追加するカラム + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void addKeyColumn(KeyConstraint keyModel, ColumnModel columnModel) { if (containsKeyColumn(keyModel, columnModel)) { Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/RootModelUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -62,8 +62,10 @@ * @param rootModel 対象RootModel * @param refId ID * @return 見つかったモデル。見つからなかった場合は{@code null} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static JiemamyElement findJiemamyElement(RootModel rootModel, UUID refId) { + Validate.notNull(rootModel); Validate.notNull(refId); JiemamyElement result = null; for (DomainModel domainModel : rootModel.getDomains()) { @@ -168,8 +170,10 @@ * * @param rootModel 検索対象の{@link RootModel} * @return 外部キーの集合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static Collection<ForeignKey> getAllForeignKeys(RootModel rootModel) { + Validate.notNull(rootModel); List<ForeignKey> result = CollectionsUtil.newArrayList(); for (TableModel tableModel : getEntities(rootModel, TableModel.class)) { result.addAll(TableUtil.getAttributes(tableModel, ForeignKey.class)); @@ -183,8 +187,10 @@ * @param rootModel 対象RootModel * @return SQL方言 * @throws ClassNotFoundException 設定されたクラスが見つからなかった場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static Dialect getDialect(RootModel rootModel) throws ClassNotFoundException { + Validate.notNull(rootModel); Jiemamy jiemamy = rootModel.getJiemamy(); return jiemamy.getDialect(rootModel); } @@ -252,8 +258,10 @@ * モデルの正規化を行う。 * * @param rootModel 操作対象{@link RootModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void normalize(RootModel rootModel) { + Validate.notNull(rootModel); ReferenceResolver resolver = rootModel.getJiemamy().getReferenceResolver(); for (TableModel tableModel : getEntities(rootModel, TableModel.class)) { // PKの正規化 @@ -291,8 +299,11 @@ * * @param rootModel 操作対象{@link RootModel} * @param dialectClass SQL方言クラス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void setDialect(RootModel rootModel, Class<? extends Dialect> dialectClass) { + Validate.notNull(rootModel); + Validate.notNull(dialectClass); rootModel.setDialectClassName(dialectClass.getName()); } @@ -303,6 +314,8 @@ * @param dialect SQL方言 */ public static void setDialect(RootModel rootModel, Dialect dialect) { + Validate.notNull(rootModel); + Validate.notNull(dialect); setDialect(rootModel, dialect.getClass()); } Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/JiemamyFacadeImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/JiemamyFacadeImplTest.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/JiemamyFacadeImplTest.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -30,7 +30,6 @@ import org.apache.commons.collections15.CollectionUtils; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.jiemamy.Jiemamy; @@ -199,7 +198,6 @@ * {@link JiemamyFacadeImpl#removeKeyColumn(org.jiemamy.model.attribute.constraint.KeyConstraint, ColumnModel)}の例外テスト。 */ @Test(expected = IllegalArgumentException.class) - @Ignore public void test_addPrimaryKey_tableに含まれていないColumnを指定するとException() { TableModel tableModel = factory.newModel(TableModel.class); coreFacade.addEntity(tableModel); Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/RootModelImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/RootModelImplTest.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/RootModelImplTest.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -102,99 +102,4 @@ assertThat(rootModel.getDataSets().size(), is(0)); } - /** - * RootModelからのクローニングが適切に行われること。 - * - * @throws Exception 例外が発生した場合 - */ - @Test - @Ignore("not implemented") - public void test07_RootModelからのクローニングが適切に行われること() throws Exception { - // モデル構築 - DomainModel domainModel1 = factory.newModel(DomainModel.class); - domainModel1.setName("domain1"); - domainModel1.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); - DomainModel domainModel2 = factory.newModel(DomainModel.class); - domainModel2.setName("domain2"); - domainModel2.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); - - rootModel.getDomains().add(domainModel1); - - // オリジナルに2つのモデルがセットされている - assertThat(rootModel.getDomains().get(0), is(sameInstance(domainModel1))); - - // RootModelをクローニングする -// RootModel clone = rootModel.clone(); -// -// // 各RootModelのIDは同一、インスタンスは別 -// assertThat(rootModel.getId(), is(clone.getId())); -// assertThat(clone, is(not(sameInstance(rootModel)))); -// -// // オリジナルとクローンで、domain数は同じ -// assertThat(rootModel.getDomains().size(), is(1)); -// assertThat(clone.getDomains().size(), is(1)); -// -// // 各DomainModelのIDは同一、インスタンスは別 -// assertThat(rootModel.getDomains().get(0).getId(), is(clone.getDomains().get(0).getId())); -// assertThat(rootModel.getDomains().get(1).getId(), is(clone.getDomains().get(1).getId())); -// assertThat(rootModel.getDomains().get(0), is(not(sameInstance(clone.getDomains().get(0))))); -// assertThat(rootModel.getDomains().get(1), is(not(sameInstance(clone.getDomains().get(1))))); -// -// // ここでオリジナルにドメインを追加する -// rootModel.getDomains().add(domain2); -// -// assertThat(rootModel.getDomains().get(1), is(sameInstance(domain2))); -// -// // 追加分はクローンに影響しない -// assertThat(rootModel.getDomains().size(), is(2)); -// assertThat(clone.getDomains().size(), is(1)); - } - - /** - * 外部キーのクローニングが適切に行われること。 - * - * @throws Exception 例外が発生した場合 - */ - @Test - @Ignore("not implemented") - public void test09_外部キーのクローニングが適切に行われること() throws Exception { - // モデル構築 - TableModel tableModel1 = factory.newModel(TableModel.class); - tableModel1.setName("table1"); - TableModel tableModel2 = factory.newModel(TableModel.class); - tableModel2.setName("table2"); - rootModel.getEntities().add(tableModel1); - rootModel.getEntities().add(tableModel2); - - ForeignKey foreignKey = factory.newModel(ForeignKey.class); - AttributeUtil.autoDenominate(foreignKey, rootModel); - tableModel1.getAttributes().add(foreignKey); - - // RootModelをクローニングする -// RootModel cloneRoot = rootModel.clone(); -// TableModel cloneTable1 = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table1"); -// TableModel cloneTable2 = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table2"); -// ForeignKey cloneFk = RootModelUtil.getAllForeignKeys(cloneRoot).iterator().next(); -// -// // RootModelのIDは同一、インスタンスは別 -// assertThat(cloneRoot.getId(), is(rootModel.getId())); -// assertThat(cloneRoot, is(not(sameInstance(rootModel)))); -// -// // オリジナルとクローンで、node, connectionの数は同じ -// assertThat(rootModel.getEntities().size(), is(2)); -// assertThat(cloneRoot.getEntities().size(), is(2)); -// assertThat(RootModelUtil.getAllForeignKeys(rootModel).size(), is(1)); -// assertThat(RootModelUtil.getAllForeignKeys(cloneRoot).size(), is(1)); -// -// // node, connectionのIDは同一 -// assertThat(table1.getId(), is(cloneTable1.getId())); -// assertThat(table2.getId(), is(cloneTable1.getId())); -// assertThat(cloneFk.getId(), is(fk.getId())); -// -// // node, connectionのインスタンスは別 -// assertThat(table1, is(not(sameInstance(cloneTable1)))); -// assertThat(table2, is(not(sameInstance(cloneTable2)))); -// assertThat(cloneFk, is(not(sameInstance(fk)))); - } - } Modified: artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/node/TableModelImplTest.java =================================================================== --- artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/node/TableModelImplTest.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-core/src/test/java/org/jiemamy/internal/model/node/TableModelImplTest.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -21,23 +21,17 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.CoreMatchers.sameInstance; 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.Jiemamy; import org.jiemamy.JiemamyFactory; -import org.jiemamy.internal.builder.DataTypeBuilderImpl; import org.jiemamy.internal.model.entity.TableModelImpl; import org.jiemamy.model.RootModel; -import org.jiemamy.model.attribute.ColumnModel; -import org.jiemamy.model.datatype.DataTypeCategory; import org.jiemamy.model.entity.TableModel; -import org.jiemamy.utils.model.TableUtil; /** * {@link TableModelImpl}のテストクラス。 @@ -106,49 +100,4 @@ assertThat(tableModel.getIndexes().size(), is(0)); } - /** - * RootModelからのクローニングが適切に行われること。 - * - * @throws Exception 例外が発生した場合 - */ - @Test - @Ignore("not implemented") - public void test08_RootModelからのクローニングが適切に行われること() throws Exception { - ColumnModel columnModel1 = factory.newModel(ColumnModel.class); - columnModel1.setName("column1"); - columnModel1.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); - ColumnModel columnModel2 = factory.newModel(ColumnModel.class); - columnModel2.setName("column2"); - columnModel2.setDataType(new DataTypeBuilderImpl(factory, DataTypeCategory.INTEGER).build()); - - tableModel.getAttributes().add(columnModel1); - - // オリジナルにモデルがセットされている - assertThat(TableUtil.getColumns(tableModel).get(0), is(sameInstance(columnModel1))); - - // RootModelをクローニングする -// RootModel cloneRoot = rootModel.clone(); -// TableModel cloneTable = RootModelUtil.getEntity(cloneRoot, TableModel.class, "table"); -// -// // IDは同一、インスタンスは別 -// assertThat(cloneTable.getId(), is(tableModel.getId())); -// assertThat(cloneTable, is(sameInstance(tableModel))); -// -// // オリジナルとクローンで、カラム数は同じ -// assertThat(tableModel.getAttributes().size(), is(1)); -// assertThat(cloneTable.getAttributes().size(), is(1)); -// -// // カラムのIDは同一、インスタンスは別 -// assertThat(cloneTable.getAttributes().get(0).getId(), is(tableModel.getAttributes().get(0).getId())); -// assertThat(cloneTable.getAttributes().get(0), is(sameInstance(tableModel.getAttributes().get(0)))); -// -// tableModel.getAttributes().add(column2); -// -// // オリジナルにモデルがセットされている -// assertThat(TableUtil.getColumns(tableModel).get(1), is(sameInstance(column2))); -// -// // 追加分はクローンに影響しない -// assertThat(tableModel.getAttributes().size(), is(2)); -// assertThat(cloneTable.getAttributes().size(), is(1)); - } } Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/JiemamyViewFacadeImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/JiemamyViewFacadeImpl.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/JiemamyViewFacadeImpl.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -21,6 +21,8 @@ import java.util.List; import java.util.Map; +import org.apache.commons.lang.Validate; + import org.jiemamy.Jiemamy; import org.jiemamy.ReferenceResolver; import org.jiemamy.JiemamyViewProperty.NodeProfileProperty; @@ -73,6 +75,8 @@ } public void addBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex, JmPoint position) { + Validate.notNull(connectionAdapter); + Validate.notNull(position); RootModel rootModel = jiemamy.getFactory().getRootModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); @@ -86,6 +90,8 @@ public void addConnectionProfile(int diagramIndex, ConnectionAdapter connectionAdapter, ConnectionProfile connectionProfile) { + Validate.notNull(connectionAdapter); + Validate.notNull(connectionProfile); RootModel rootModel = jiemamy.getFactory().getRootModel(); Command command = new AddConnectionViewCommand(eventBroker, rootModel, diagramIndex, connectionAdapter, connectionProfile); @@ -94,6 +100,8 @@ } public void addNode(int diagramIndex, NodeAdapter nodeAdapter, JmRectangle rectangle) { + Validate.notNull(nodeAdapter); + Validate.notNull(rectangle); if (nodeAdapter.unwrap() != null) { EntityModel entityModel = nodeAdapter.unwrap(); super.addEntity(entityModel); @@ -104,6 +112,8 @@ } public void addNodeProfile(int diagramIndex, NodeAdapter nodeAdapter, NodeProfile nodeProfile) { + Validate.notNull(nodeAdapter); + Validate.notNull(nodeProfile); RootModel rootModel = jiemamy.getFactory().getRootModel(); Command command = new AddNodeViewCommand(eventBroker, rootModel, diagramIndex, nodeAdapter, nodeProfile); command.execute(); @@ -111,6 +121,8 @@ } public void changeNodeBoundary(int diagramIndex, NodeAdapter nodeAdapter, JmRectangle boundary) { + Validate.notNull(nodeAdapter); + Validate.notNull(boundary); RootModel rootModel = jiemamy.getFactory().getRootModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); @@ -128,6 +140,8 @@ } public void changeNodeColor(int diagramIndex, NodeAdapter nodeAdapter, JmColor color) { + Validate.notNull(nodeAdapter); + Validate.notNull(color); RootModel rootModel = jiemamy.getFactory().getRootModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); @@ -145,6 +159,9 @@ public void createConnection(int diagramIndex, ConnectionAdapter connectionAdapter, TableModel sourceTable, TableModel targetTable) { + Validate.notNull(connectionAdapter); + Validate.notNull(sourceTable); + Validate.notNull(targetTable); if (connectionAdapter.unwrap() != null) { ForeignKey foreignKey = connectionAdapter.unwrap(); Jiemamy jiemamy = foreignKey.getJiemamy(); @@ -179,6 +196,8 @@ public void moveBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex, JmPoint position) { + Validate.notNull(connectionAdapter); + Validate.notNull(position); RootModel rootModel = jiemamy.getFactory().getRootModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); @@ -191,6 +210,7 @@ } public void removeBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex) { + Validate.notNull(connectionAdapter); RootModel rootModel = jiemamy.getFactory().getRootModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); @@ -202,6 +222,8 @@ } public void removeConnection(int diagramIndex, ConnectionAdapter connectionAdapter) { + Validate.notNull(connectionAdapter); + ForeignKey foreignKey = connectionAdapter.unwrap(); removeConnectionProfile(diagramIndex, connectionAdapter); EntityModel sourceTable = connectionAdapter.getSource().unwrap(); @@ -211,6 +233,7 @@ } public void removeConnectionProfile(int diagramIndex, ConnectionAdapter connectionAdapter) { + Validate.notNull(connectionAdapter); RootModel rootModel = jiemamy.getFactory().getRootModel(); Command command = new RemoveConnectionViewCommand(eventBroker, rootModel, diagramIndex, connectionAdapter); command.execute(); @@ -218,6 +241,7 @@ } public void removeNode(int diagramIndex, NodeAdapter nodeAdapter) { + Validate.notNull(nodeAdapter); // 削除対象のモデルをソースとするコネクションのリスト、のコピー List<ConnectionAdapter> sourceConnections = CollectionsUtil.newArrayList(nodeAdapter.getSourceConnections()); // 削除対象のモデルをターゲットとするコネクションのリスト、のコピー @@ -239,6 +263,7 @@ } public void removeNodeProfile(int diagramIndex, NodeAdapter nodeAdapter) { + Validate.notNull(nodeAdapter); RootModel rootModel = jiemamy.getFactory().getRootModel(); Command command = new RemoveNodeViewCommand(eventBroker, rootModel, diagramIndex, nodeAdapter); command.execute(); @@ -246,6 +271,7 @@ } public void resetBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter) { + Validate.notNull(connectionAdapter); RootModel rootModel = jiemamy.getFactory().getRootModel(); Command command = new ResetBendpointCommand(eventBroker, rootModel, diagramIndex, connectionAdapter); command.execute(); @@ -253,6 +279,8 @@ } public void setColor(int diagramIndex, NodeAdapter nodeAdapter, JmColor color) { + Validate.notNull(nodeAdapter); + Validate.notNull(color); RootModel rootModel = jiemamy.getFactory().getRootModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddBendpointCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddBendpointCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddBendpointCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -51,6 +51,7 @@ * @param connectionProfile ベンドポイントが追加されるコネクションのビジュアル情報 * @param bendpointIndex source側からtarget側に向かって数えたベンドポイントのインデックス * @param point 座標 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddBendpointCommand(EventBroker eventBroker, int diagramIndex, ConnectionProfile connectionProfile, int bendpointIndex, JmPoint point) { @@ -67,6 +68,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionProfile ベンドポイントが追加されるコネクションのビジュアル情報 * @param point 座標 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddBendpointCommand(EventBroker eventBroker, int diagramIndex, ConnectionProfile connectionProfile, JmPoint point) { Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddConnectionViewCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddConnectionViewCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddConnectionViewCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal.editcommand; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.ConnectionProfile; @@ -56,10 +58,14 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter コネクション * @param connectionProfile コネクションのビジュアル情報 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddConnectionViewCommand(EventBroker eventBroker, RootModel rootModel, int diagramIndex, ConnectionAdapter connectionAdapter, ConnectionProfile connectionProfile) { super(eventBroker); + Validate.notNull(rootModel); + Validate.notNull(connectionAdapter); + Validate.notNull(connectionProfile); this.rootModel = rootModel; this.diagramIndex = diagramIndex; this.connectionAdapter = connectionAdapter; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddNodeViewCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddNodeViewCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/AddNodeViewCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal.editcommand; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.DiagramPresentationModel; @@ -53,10 +55,14 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter ノードを識別するための{@link NodeAdapter} * @param nodeProfile ノードの見た目の情報を保持する{@link NodeProfile} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public AddNodeViewCommand(EventBroker eventBroker, RootModel rootModel, int diagramIndex, NodeAdapter nodeAdapter, NodeProfile nodeProfile) { super(eventBroker); + Validate.notNull(rootModel); + Validate.notNull(nodeAdapter); + Validate.notNull(nodeProfile); this.rootModel = rootModel; this.diagramIndex = diagramIndex; this.nodeAdapter = nodeAdapter; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/MoveBendpointCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/MoveBendpointCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/MoveBendpointCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal.editcommand; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.ConnectionProfile; @@ -55,10 +57,13 @@ * @param connectionProfile 編集対象コネクションのプロファイル * @param bendpointIndex source側からtarget側に向かって数えたベンドポイントのインデックス * @param newPoint 移動先の座標 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public MoveBendpointCommand(EventBroker eventBroker, int diagramIndex, ConnectionProfile connectionProfile, int bendpointIndex, JmPoint newPoint) { super(eventBroker); + Validate.notNull(connectionProfile); + Validate.notNull(newPoint); this.diagramIndex = diagramIndex; this.connectionProfile = connectionProfile; this.bendpointIndex = bendpointIndex; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveBendpointCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveBendpointCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveBendpointCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -45,6 +45,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionProfile ベンドポイントが削除されるコネクションのビジュアル情報 * @param bendpointIndex source側からtarget側に向かって数えたベンドポイントのインデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RemoveBendpointCommand(EventBroker eventBroker, int diagramIndex, ConnectionProfile connectionProfile, int bendpointIndex) { @@ -63,6 +64,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionProfile ベンドポイントが削除されるコネクションのビジュアル情報 * @param point 削除対象の座標 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RemoveBendpointCommand(EventBroker eventBroker, int diagramIndex, ConnectionProfile connectionProfile, JmPoint point) { Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveConnectionViewCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveConnectionViewCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveConnectionViewCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal.editcommand; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.ConnectionProfile; @@ -53,10 +55,13 @@ * @param rootModel {@link DiagramPresentations}がアダプトされた{@link RootModel} * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter ノードを識別するための{@link NodeAdapter} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RemoveConnectionViewCommand(EventBroker eventBroker, RootModel rootModel, int diagramIndex, ConnectionAdapter connectionAdapter) { super(eventBroker); + Validate.notNull(rootModel); + Validate.notNull(connectionAdapter); this.rootModel = rootModel; this.diagramIndex = diagramIndex; this.connectionAdapter = connectionAdapter; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveNodeViewCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveNodeViewCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RemoveNodeViewCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.internal.editcommand; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.DiagramPresentationModel; @@ -52,9 +54,12 @@ * @param rootModel {@link DiagramPresentations}がアダプトされた{@link RootModel} * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter ノードを識別するための{@link NodeAdapter} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RemoveNodeViewCommand(EventBroker eventBroker, RootModel rootModel, int diagramIndex, NodeAdapter nodeAdapter) { super(eventBroker); + Validate.notNull(rootModel); + Validate.notNull(nodeAdapter); this.rootModel = rootModel; this.diagramIndex = diagramIndex; this.nodeAdapter = nodeAdapter; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/ResetBendpointCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/ResetBendpointCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/ResetBendpointCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -20,6 +20,8 @@ import java.util.List; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.ConnectionProfile; @@ -68,10 +70,13 @@ * @param rootModel ルートモデル * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter ベンドポイントが削除されるコネクション + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public ResetBendpointCommand(EventBroker eventBroker, RootModel rootModel, int diagramIndex, ConnectionAdapter connectionAdapter) { super(eventBroker); + Validate.notNull(rootModel); + Validate.notNull(connectionAdapter); this.rootModel = rootModel; this.diagramIndex = diagramIndex; this.connectionAdapter = connectionAdapter; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RevertBendpointsCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RevertBendpointsCommand.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/editcommand/RevertBendpointsCommand.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -20,6 +20,8 @@ import java.util.List; +import org.apache.commons.lang.Validate; + import org.jiemamy.EventBroker; import org.jiemamy.editcommand.Command; import org.jiemamy.model.ConnectionProfile; @@ -62,10 +64,14 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter ベンドポイントが復元されるコネクション * @param points source側からtarget側に向かう順の座標のリスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public RevertBendpointsCommand(EventBroker eventBroker, RootModel rootModel, int diagramIndex, ConnectionAdapter connectionAdapter, List<JmPoint> points) { super(eventBroker); + Validate.notNull(rootModel); + Validate.notNull(connectionAdapter); + Validate.notNull(points); this.rootModel = rootModel; this.diagramIndex = diagramIndex; this.connectionAdapter = connectionAdapter; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewDomSerializerEnhancer.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewDomSerializerEnhancer.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewDomSerializerEnhancer.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -87,6 +87,7 @@ * インスタンスを生成する。 * * @param jiemamy コンテキスト + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public JiemamyViewDomSerializer(Jiemamy jiemamy) { super(jiemamy); Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewFactoryExtensionEnhancer.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewFactoryExtensionEnhancer.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/enhance/ViewFactoryExtensionEnhancer.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -115,6 +115,14 @@ INSTANCE; public int compare(ConnectionAdapter o1, ConnectionAdapter o2) { + if (o1 == o2) { + return 0; + } else if (o1 == null) { + return -1; + } else if (o2 == null) { + return 1; + } + ForeignKey f1 = o1.unwrap(); ForeignKey f2 = o2.unwrap(); if (f1 != null && f2 != null) { @@ -143,7 +151,7 @@ public int compare(NodeAdapter o1, NodeAdapter o2) { Integer result = null; - if (o1 == null && o2 == null) { + if (o1 == o2) { result = 0; } else if (o1 == null) { result = -1; Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -18,6 +18,8 @@ */ package org.jiemamy.utils.model; +import org.apache.commons.lang.Validate; + import org.jiemamy.JiemamyFactory; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.NodeProfile; @@ -37,8 +39,11 @@ * * @param diagramPresentation 対象ダイアグラム * @param connectionAdapter リセット対象のコネクション + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void resetBenpoinsts(DiagramPresentationModel diagramPresentation, ConnectionAdapter connectionAdapter) { + Validate.notNull(diagramPresentation); + Validate.notNull(connectionAdapter); diagramPresentation.getConnectionProfiles().get(connectionAdapter).getBendpoints().clear(); } @@ -48,8 +53,12 @@ * @param presentation 対象ダイアグラム * @param nodeAdapter ノード * @param boundary 位置サイズ情報 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ public static void setBoundary(DiagramPresentationModel presentation, NodeAdapter nodeAdapter, JmRectangle boundary) { + Validate.notNull(presentation); + Validate.notNull(nodeAdapter); + Validate.notNull(boundary); NodeProfile nodeProfile = presentation.getNodeProfiles().get(nodeAdapter); if (nodeProfile == null) { JiemamyFactory factory = presentation.getJiemamy().getFactory(); Modified: leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ForEachUtil.java =================================================================== --- leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ForEachUtil.java 2009-04-14 14:42:52 UTC (rev 3276) +++ leto/jiemamy-commons/trunk/src/main/java/org/jiemamy/utils/ForEachUtil.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -162,6 +162,7 @@ * @param element 処理対象要素 * @return 引き続きacceptを継続する場合null、ループを終了する場合acceptが返すべき戻り値を返す。 * @throws X ビジタが指定した例外が発生した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ R visit(T element) throws X; } @@ -191,6 +192,7 @@ * @param value 処理対象の値 * @return 引き続きacceptを継続する場合null、ループを終了する場合acceptが返すべき戻り値を返す。 * @throws X ビジタが指定した例外が発生した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ R visit(K key, V value) throws X; } @@ -219,6 +221,7 @@ * @return 引き続きacceptを継続する場合null、ループを終了する場合acceptが返すべき戻り値を返す。 * @throws X ビジタが指定した例外が発生した場合 * @throws SQLException SQLの実行に失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ R visit(T element) throws SQLException, X; } @@ -247,6 +250,7 @@ * @return 引き続きacceptを継続する場合null、ループを終了する場合acceptが返すべき戻り値を返す。 * @throws X ビジタが指定した例外が発生した場合 * @throws SQLException SQLの実行に失敗した場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ R visit(T element) throws SQLException, X; } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/EventBroker.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/EventBroker.java 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/EventBroker.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -33,6 +33,7 @@ * 指定されたリスナを登録する。 * * @param listener 登録するリスナ + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addListener(CommandListener listener); @@ -43,6 +44,7 @@ * <p>引数として与えるEDITコマンドは、既に実行済みであることが通例である。</p> * * @param command 実行されたEDITコマンド + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void fireCommandProcessed(Command command); @@ -51,6 +53,7 @@ * 指定されたリスナを削除する。 * * @param listener 削除するリスナ + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeListener(CommandListener listener); Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyFactory.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -114,6 +114,7 @@ * @param <T> 生成するアダプタの種類を表す型 * @param clazz 生成するアダプタの種類を表す型 * @return 生成されたアダプタ + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ <T>T newAdapter(Class<T> clazz); @@ -148,6 +149,7 @@ * @param <T> 取得するファサードの型 * @param clazz 取得するファサードの型 * @return 新しいファサード + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ <T extends JiemamyFacade>T newFacade(Class<T> clazz); 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-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/JiemamyImplementation.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -107,6 +107,7 @@ * @param jiemamy インスタンス空間 * @param clazz 取得するファサードの型 * @return 新しいファサード + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ <T extends JiemamyFacade>T newFacade(Jiemamy jiemamy, Class<T> clazz); Added: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolveException.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolveException.java (rev 0) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolveException.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -0,0 +1,54 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/04/15 + * + * 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 org.jiemamy.model.ElementReference; + +/** + * 参照オブジェクトからモデルの実体が解決できなかった場合。 + * + * @since 0.2 + * @author daisuke + */ + @ SuppressWarnings("serial") +public class ReferenceResolveException extends RuntimeException { + + /** 解決できなかった参照オブジェクト */ + private final ElementReference<?> ref; + + + /** + * インスタンスを生成する。 + * + * @param ref 解決できなかった参照オブジェクト + */ + public ReferenceResolveException(ElementReference<?> ref) { + this.ref = ref; + } + + /** + * 解決できなかった参照オブジェクトを取得する。 + * + * @return 解決できなかった参照オブジェクト + * @since 0.2 + */ + public ElementReference<?> getId() { + return ref; + } +} Property changes on: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolveException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolver.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolver.java 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/ReferenceResolver.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -44,8 +44,9 @@ * * @param <T> モデルの実態の型 * @param reference モデルの参照オブジェクト - * @return モデルの実体. 解決できない場合は{@code null} + * @return モデルの実体 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws ReferenceResolveException 参照オブジェクトからモデルの実体が解決できなかった場合 * @since 0.2 */ <T extends JiemamyElement>T resolve(ElementReference<T> reference); Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/Dialect.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -51,6 +51,7 @@ * @param config 設定オブジェクト * @return SQL文のリスト * @throws UnsupportedOperationException SQL文の出力をサポートしていない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ List<SqlStatement> emitStatements(RootModel rootModel, EmitConfig config); @@ -60,6 +61,7 @@ * * @param dataType データ型 * @return モールド + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ BuiltinDataTypeMold findDataTypeMold(BuiltinDataType dataType); @@ -177,6 +179,7 @@ * @param statements SQL文のリスト * @return 生成した{@link RootModel} * @throws UnsupportedOperationException 実装がこの機能を提供していない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ RootModel parseStatements(List<SqlStatement> statements); Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/MoldManager.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/MoldManager.java 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/dialect/MoldManager.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -35,6 +35,7 @@ * * @param builtinDataType データ型 * @return モールド + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ BuiltinDataTypeMold findDataTypeMold(BuiltinDataType builtinDataType); Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/facade/JiemamyFacade.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -21,6 +21,7 @@ import java.util.List; import org.jiemamy.JiemamyProperty; +import org.jiemamy.ReferenceResolveException; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.AttributeModel; @@ -54,9 +55,15 @@ /** * {@link TableModel}に{@link AttributeModel}を追加する。 * + * <ul> + * <li>属性が既にこのテーブルに属している場合は、何もしない</li> + * </ul> + * * @param tableModel 追加対象のテーブル * @param attributeModel 追加する属性 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws IllegalArgumentException {@link KeyConstraint}追加時、対象テーブルに属さないカラムがキーカラムに含まれていた場合 + * @throws ReferenceResolveException {@link KeyConstraint}追加時、キーカラムの参照が解決できなかった場合 * @since 0.2 */ void addAttribute(TableModel tableModel, AttributeModel attributeModel); @@ -64,10 +71,16 @@ /** * {@link TableModel}に{@link AttributeModel}を追加する。 * + * <ul> + * <li>属性が既にこのテーブルに属している場合は、何もしない</li> + * </ul> + * * @param tableModel 追加対象のテーブル * @param index 追加位置インデックス * @param attributeModel 追加する属性 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 + * @throws IllegalArgumentException {@link KeyConstraint}追加時、対象テーブルに属さないカラムがキーカラムに含まれていた場合 + * @throws ReferenceResolveException {@link KeyConstraint}追加時、キーカラムの参照が解決できなかった場合 * @since 0.2 */ void addAttribute(TableModel tableModel, int index, AttributeModel attributeModel); @@ -75,6 +88,10 @@ /** * {@link RootModel}に{@link DataSetModel}を追加する。 * + * <ul> + * <li>データセットが既に追加済みの場合は、何もしない</li> + * </ul> + * * @param dataSetModel 追加するデータセット * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 @@ -84,6 +101,10 @@ /** * {@link RootModel}に{@link DataSetModel}を追加する。 * + * <ul> + * <li>データセットが既に追加済みの場合は、何もしない</li> + * </ul> + * * @param dataSetModel 追加するデータセット * @param index 挿入位置インデックス * @throws IllegalArgumentException 引数に{@code null}を与えた場合 @@ -94,6 +115,10 @@ /** * {@link RootModel}に{@link DomainModel}を追加する。 * + * <ul> + * <li>ドメインが既に追加済みの場合は、何もしない</li> + * </ul> + * * @param domainModel 追加するドメイン * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 @@ -103,6 +128,10 @@ /** * {@link RootModel}に{@link DomainModel}を追加する。 * + * <ul> + * <li>ドメインが既に追加済みの場合は、何もしない</li> + * </ul> + * * @param domainModel 追加するドメイン * @param index 挿入位置インデックス * @throws IllegalArgumentException 引数に{@code null}を与えた場合 @@ -113,6 +142,10 @@ /** * {@link RootModel}に{@link EntityModel}を追加する。 * + * <ul> + * <li>エンティティが既に追加済みの場合は、何もしない</li> + * </ul> + * * @param entityModel 追加するエンティティ * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 @@ -122,8 +155,13 @@ /** * {@link TableModel}に{@link IndexModel}を追加する。 * + * <ul> + * <li>インデックスが既にこのテーブルに属している場合は、何もしない</li> + * </ul> + * * @param tableModel 追加対象のテーブル * @param indexModel 追加するインデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addIndex(TableModel tableModel, IndexModel indexModel); @@ -131,9 +169,14 @@ /** * {@link TableModel}に{@link IndexModel}を追加する。 * + * <ul> + * <li>インデックスが既にこのテーブルに属している場合は、何もしない</li> + * </ul> + * * @param tableModel 追加対象のテーブル * @param index 追加位置インデックス * @param indexModel 追加するインデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addIndex(TableModel tableModel, int index, IndexModel indexModel); @@ -141,6 +184,10 @@ /** * {@link IndexModel}に{@link IndexColumnModel}を追加する。 * + * <ul> + * <li>インデックスカラムが既にこのインデックスに属している場合は、何もしない</li> + * </ul> + * * @param indexModel 追加対象のインデックス * @param indexColumnModel 追加するインデックスカラム * @throws IllegalArgumentException 引数に{@code null}を与えた場合 @@ -151,6 +198,10 @@ /** * {@link IndexModel}に{@link IndexColumnModel}を追加する。 * + * <ul> + * <li>インデックスカラムが既にこのインデックスに属している場合は、何もしない</li> + * </ul> + * * @param indexModel 追加対象のインデックス * @param index 挿入位置インデックス * @param indexColumnModel 追加するインデックスカラム @@ -168,6 +219,7 @@ * * @param keyConstraint 対象のキー制約 * @param columnModel 追加するカラム + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addKeyColumn(KeyConstraint keyConstraint, ColumnModel columnModel); @@ -175,8 +227,13 @@ /** * {@link DataSetModel}に、指定したテーブル用のレコード保存領域を確保する。 * + * <ul> + * <li>既に指定したテーブル用のレコード保存領域が確保済みであった場合は何もしない。</li> + * </ul> + * * @param dataSetModel レコード追加対象の{@link DataSetModel} * @param tableModel レコード追加対象の{@link TableModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addRecords(DataSetModel dataSetModel, TableModel tableModel); @@ -212,6 +269,10 @@ /** * {@link RootModel}から{@link DataSetModel}を削除する。 * + * <ul> + * <li>指定したデータセットが{@link RootModel}に属していなかった場合は何もしない。</li> + * </ul> + * * @param dataSetModel 削除するデータセット * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 @@ -222,6 +283,7 @@ * {@link RootModel}から{@link DomainModel}を削除する。 * * <ul> + * <li>指定したドメインが{@link RootModel}に属していなかった場合は何もしない。</li> * <li>該当ドメインへの参照は、ドメインに設定されていた型情報に書き換える。</li> * </ul> * @@ -235,6 +297,7 @@ * {@link RootModel}から{@link EntityModel}を削除する。 * * <ul> + * <li>指定したエンティティが{@link RootModel}に属していなかった場合は何もしない。</li> * <li>該当エンティティを参照する外部キーも同時に削除する。</li> * <li>{@link DataSetModel}が持つテーブルへの参照も同時に削除する。</li> * </ul> @@ -248,8 +311,13 @@ /** * {@link TableModel}から{@link IndexModel}を削除する。 * + * <ul> + * <li>指定したインデックスがテーブルに属していなかった場合は何もしない。</li> + * </ul> + * * @param tableModel 削除元テーブル * @param indexModel 削除するインデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeIndex(TableModel tableModel, IndexModel indexModel); @@ -257,6 +325,10 @@ /** * {@link IndexModel}から{@link IndexColumnModel}を削除する。 * + * <ul> + * <li>指定したインデックスカラムがインデックスに属していなかった場合は何もしない。</li> + * </ul> + * * @param indexModel 削除元インデックス * @param indexColumnModel 削除するインデックスカラム * @throws IllegalArgumentException 引数に{@code null}を与えた場合 @@ -275,6 +347,7 @@ * * @param keyConstraint 対象のキー制約 * @param columnModel 削除するカラム + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeKeyColumn(KeyConstraint keyConstraint, ColumnModel columnModel); @@ -282,8 +355,13 @@ /** * {@link DataSetModel}に確保された、指定したテーブル用のレコード保存領域を削除する。 * + * <ul> + * <li>指定したテーブル用のレコード保存領域が存在しなかった場合は何もしない。</li> + * </ul> + * * @param dataSetModel レコード削除元の{@link DataSetModel} * @param tableModel レコード削除対象の{@link TableModel} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeRecords(DataSetModel dataSetModel, TableModel tableModel); @@ -293,6 +371,7 @@ * * @param savePoint セーブポイント * @throws IllegalArgumentException このファサードが発行したs{@link SavePoint}でない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void rollback(SavePoint savePoint); @@ -311,6 +390,7 @@ * @param recordModel 対象レコード * @param columnModel 対象カラム * @param value データ + * @throws IllegalArgumentException 引数value<b>以外</b>に{@code null}を与えた場合 * @since 0.2 */ void setRecordValue(RecordModel recordModel, ColumnModel columnModel, String value); @@ -322,6 +402,8 @@ * @param list 入れ替え対象のリスト * @param subjectIndex 入れ替え要素1 * @param objectIndex 入れ替え要素2 + * @throws IndexOutOfBoundsException リストに、指定したインデックスの要素が存在しない場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void swapListElement(JiemamyElement targetElement, List<?> list, int subjectIndex, int objectIndex); @@ -333,6 +415,7 @@ * @param keyColumns 新しいキーカラムのリスト * @param referenceColumns 新しい参照カラムのリスト * @throws IllegalArgumentException 引数keyColumnsとreferenceColumnのサイズが異なる場合 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void updateForeignKeyMapping(ForeignKey foreignKey, List<ColumnRef> keyColumns, List<ColumnRef> referenceColumns); Modified: 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 2009-04-14 14:42:52 UTC (rev 3276) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/facade/JiemamyViewFacade.java 2009-04-14 17:52:18 UTC (rev 3277) @@ -46,6 +46,7 @@ * @param connectionAdapter 操作対象のコネクション * @param bendpointIndex source側からtarget側に向かって数えたベンドポイントのインデックス * @param position ベンドポイントの座標 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex, JmPoint position); @@ -56,6 +57,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter コネクション * @param connectionProfile ビジュアル情報 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addConnectionProfile(int diagramIndex, ConnectionAdapter connectionAdapter, ConnectionProfile connectionProfile); @@ -69,6 +71,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter ノードに対応する{@link NodeAdapter} * @param rectangle {@code draw2D}のRectangleから{@link JmRectangle}に変換したもの + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addNode(int diagramIndex, NodeAdapter nodeAdapter, JmRectangle rectangle); @@ -79,6 +82,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter ノードに対応する{@link NodeAdapter} * @param nodeProfile 追加する{@link NodeProfile} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void addNodeProfile(int diagramIndex, NodeAdapter nodeAdapter, NodeProfile nodeProfile); @@ -89,6 +93,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter 操作対象のノード * @param boundary 新しい位置サイズ + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void changeNodeBoundary(int diagramIndex, NodeAdapter nodeAdapter, JmRectangle boundary); @@ -99,6 +104,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter 操作対象のノード * @param color 新しい色 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void changeNodeColor(int diagramIndex, NodeAdapter nodeAdapter, JmColor color); @@ -110,6 +116,7 @@ * @param connectionAdapter コネクションに対応する{@link ConnectionAdapter} * @param sourceTable 接続元のテーブル * @param targetTable 接続先のテーブル + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void createConnection(int diagramIndex, ConnectionAdapter connectionAdapter, TableModel sourceTable, @@ -122,6 +129,7 @@ * @param connectionAdapter 操作対象のコネクション * @param bendpointIndex source側からtarget側に向かって数えたベンドポイントのインデックス * @param position 新しい座標 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void moveBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex, JmPoint position); @@ -132,6 +140,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter 削除対象のコネクション * @param bendpointIndex source側からtarget側に向かって数えたベンドポイントのインデックス + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter, int bendpointIndex); @@ -145,6 +154,7 @@ * * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter ノードに対応する{@link ConnectionAdapter} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeConnection(int diagramIndex, ConnectionAdapter connectionAdapter); @@ -154,6 +164,7 @@ * * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter ノードに対応する{@link ConnectionAdapter} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeConnectionProfile(int diagramIndex, ConnectionAdapter connectionAdapter); @@ -171,6 +182,7 @@ * * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter 削除対象のノード + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeNode(int diagramIndex, NodeAdapter nodeAdapter); @@ -180,6 +192,7 @@ * * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter ノードに対応する{@link NodeAdapter} + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void removeNodeProfile(int diagramIndex, NodeAdapter nodeAdapter); @@ -192,6 +205,7 @@ * * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param connectionAdapter コネクション + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void resetBendpoint(int diagramIndex, ConnectionAdapter connectionAdapter); @@ -202,6 +216,7 @@ * @param diagramIndex ダイアグラムエディタのインデックス(エディタ内のタブインデックス) * @param nodeAdapter ノード * @param color 色 + * @throws IllegalArgumentException 引数に{@code null}を与えた場合 * @since 0.2 */ void setColor(int diagramIndex, NodeAdapter nodeAdapter, JmColor color);