svnno****@sourc*****
svnno****@sourc*****
2008年 9月 23日 (火) 20:30:38 JST
Revision: 1939 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=1939 Author: daisuke_m Date: 2008-09-23 20:30:38 +0900 (Tue, 23 Sep 2008) Log Message: ----------- refactor / ロジック仕様をspecのi/f内にコメントで記述。 Modified Paths: -------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ModelIdManager.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/GetColumnProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/RemoveInheritedColumnsProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetEntityProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetNodesProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessor.java artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParentsTest.java artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractEntityTreeEditPart.java artemis/trunk/org.jiemamy.spec/.project artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/ColumnModel.java artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/JiemamyModel.java artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/RootModel.java artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/AbstractConnectionModel.java artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/AbstractEntityModel.java artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/TableModel.java Added Paths: ----------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetReferenceEntitiesProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSubEntitiesProcessor.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSuperEntitiesProcessor.java Removed Paths: ------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParents.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceChildren.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceParents.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ModelIdManager.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ModelIdManager.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ModelIdManager.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -89,7 +89,7 @@ */ synchronized void register(JiemamyModel model) { UUID id = UUID.randomUUID(); - model.setId(id); + ((AbstractModel) model).setId(id); modelMap.put(id, model); } @@ -100,7 +100,7 @@ */ synchronized void unregister(JiemamyModel model) { modelMap.remove(model.getId()); - model.setId(null); + ((AbstractModel) model).setId(null); } } Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -1,48 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/06/09 - * - * This file is part of Jiemamy-core. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.core.model.connection; - -import org.jiemamy.spec.model.node.AbstractEntityModel; - -/** - * 継承モデル。 - * - * @author daisuke - */ - @ SuppressWarnings("serial") -public class InheritanceModel extends AbstractRelationModelImpl { - - /** - * コンストラクタ。 - * @category instance creation - */ - public InheritanceModel() { - super(null, null); - } - - /** - * コンストラクタ。 - * @param source 接続元モデル - * @param target 接続先モデル - * @category instance creation - */ - public InheritanceModel(AbstractEntityModel source, AbstractEntityModel target) { - super(source, target); - } -} Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/connection/InheritanceModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -0,0 +1,48 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/06/09 + * + * This file is part of Jiemamy-core. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.core.model.connection; + +import org.jiemamy.spec.model.node.AbstractEntityModel; + +/** + * 継承モデル。 + * + * @author daisuke + */ + @ SuppressWarnings("serial") +public class InheritanceModel extends AbstractRelationModelImpl { + + /** + * コンストラクタ。 + * @category instance creation + */ + public InheritanceModel() { + super(null, null); + } + + /** + * コンストラクタ。 + * @param source 接続元モデル + * @param target 接続先モデル + * @category instance creation + */ + public InheritanceModel(AbstractEntityModel source, AbstractEntityModel target) { + super(source, target); + } +} Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParents.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParents.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParents.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -1,91 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/08/01 - * - * 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.core.utils.processor.entity; - -import java.util.HashSet; -import java.util.Set; - -import org.jiemamy.spec.model.connection.AbstractConnectionModel; -import org.jiemamy.spec.model.connection.ForeignKeyModel; -import org.jiemamy.spec.model.node.AbstractEntityModel; -import org.jiemamy.spec.util.Processor; - -/** - * 指定したエンティティの参照先親にあたるモデルのリストを取得する。 - * @author daisuke - */ -public class GetForeignKeyParents implements Processor<AbstractEntityModel, Set<AbstractEntityModel>, RuntimeException> { - - private boolean recursive; - - - /** - * コンストラクタ。 - * @param recursive 再帰的に辿るかどうか - * @category instance creation - */ - public GetForeignKeyParents(boolean recursive) { - this.recursive = recursive; - } - - /** - * {@inheritDoc} - */ - public Set<AbstractEntityModel> process(AbstractEntityModel entity) { - return recursive ? processRecursive(entity) : processNonRecursive(entity); - } - - /** - * 参照先親モデルを返す。 - * @param entity 対象エンティティ - * @return 親モデルのSet - */ - private Set<AbstractEntityModel> processNonRecursive(AbstractEntityModel entity) { - Set<AbstractEntityModel> parents = new HashSet<AbstractEntityModel>(); - - for (AbstractConnectionModel connection : entity.getSourceConnections()) { - if (connection instanceof ForeignKeyModel) { - ForeignKeyModel fkModel = (ForeignKeyModel) connection; - parents.add((AbstractEntityModel) fkModel.getTarget()); - } - } - - return parents; - } - - /** - * 全ての参照先 祖先モデルを返す。 - * @param entity 対象エンティティ - * @return 祖先モデルのSet - */ - private Set<AbstractEntityModel> processRecursive(AbstractEntityModel entity) { - Set<AbstractEntityModel> parentEntities = entity.process(new GetForeignKeyParents(false)); - Set<AbstractEntityModel> entities = new HashSet<AbstractEntityModel>(); - - entities.addAll(parentEntities); - for (AbstractEntityModel parentEntity : parentEntities) { - if (entity.equals(parentEntity) == false) { - entities.addAll(parentEntity.process(new GetForeignKeyParents(true))); - } - } - - return entities; - } - -} Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceChildren.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceChildren.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceChildren.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -1,90 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/08/01 - * - * 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.core.utils.processor.entity; - -import java.util.HashSet; -import java.util.Set; - -import org.jiemamy.core.model.connection.InheritanceModel; -import org.jiemamy.spec.model.connection.AbstractConnectionModel; -import org.jiemamy.spec.model.node.AbstractEntityModel; -import org.jiemamy.spec.util.Processor; - -/** - * 指定したエンティティの継承先子にあたるモデルのリストを取得する。 - * @author daisuke - */ -public class GetInheritanceChildren implements - Processor<AbstractEntityModel, Set<AbstractEntityModel>, RuntimeException> { - - private boolean recursive; - - - /** - * コンストラクタ。 - * @param recursive 再帰的に辿るかどうか - * @category instance creation - */ - public GetInheritanceChildren(boolean recursive) { - this.recursive = recursive; - } - - /** - * {@inheritDoc} - */ - public Set<AbstractEntityModel> process(AbstractEntityModel entity) { - return recursive ? processRecursive(entity) : processNonRecursive(entity); - } - - /** - * 継承先子モデルを返す。 - * @param entity 対象エンティティ - * @return 継承先子モデルのSet - */ - private Set<AbstractEntityModel> processNonRecursive(AbstractEntityModel entity) { - Set<AbstractEntityModel> children = new HashSet<AbstractEntityModel>(); - - for (AbstractConnectionModel relation : entity.getTargetConnections()) { - if (relation instanceof InheritanceModel) { - InheritanceModel inheritanceModel = (InheritanceModel) relation; - children.add((AbstractEntityModel) inheritanceModel.getSource()); - } - } - - return children; - } - - /** - * 全ての継承先 子孫モデルを返す。 - * @param entity 対象エンティティ - * @return 継承先子モデルのSet - */ - private Set<AbstractEntityModel> processRecursive(AbstractEntityModel entity) { - Set<AbstractEntityModel> childrenEntities = entity.process(new GetInheritanceChildren(false)); - Set<AbstractEntityModel> entities = new HashSet<AbstractEntityModel>(); - - entities.addAll(childrenEntities); - for (AbstractEntityModel childEntity : childrenEntities) { - entities.addAll(childEntity.process(new GetInheritanceChildren(false))); - } - - return entities; - } - -} Deleted: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceParents.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceParents.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceParents.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -1,92 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/08/01 - * - * 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.core.utils.processor.entity; - -import java.util.HashSet; -import java.util.Set; - -import org.jiemamy.core.model.connection.InheritanceModel; -import org.jiemamy.spec.model.connection.AbstractConnectionModel; -import org.jiemamy.spec.model.node.AbstractEntityModel; -import org.jiemamy.spec.util.Processor; - -/** - * 指定したエンティティの継承親にあたるモデルのリストを取得する。 - * @author daisuke - */ -public class GetInheritanceParents implements - Processor<AbstractEntityModel, Set<AbstractEntityModel>, RuntimeException> { - - private boolean recursive; - - - /** - * コンストラクタ。 - * @param recursive 再帰的に辿るかどうか - * @category instance creation - */ - public GetInheritanceParents(boolean recursive) { - this.recursive = recursive; - } - - /** - * {@inheritDoc} - */ - public Set<AbstractEntityModel> process(AbstractEntityModel entity) { - return recursive ? processRecursive(entity) : processNonRecursive(entity); - } - - /** - * 継承先親モデルを返す。 - * @param entity 対象エンティティ - * @return 継承先親モデルのSet - */ - private Set<AbstractEntityModel> processNonRecursive(AbstractEntityModel entity) { - Set<AbstractEntityModel> parents = new HashSet<AbstractEntityModel>(); - - for (AbstractConnectionModel relation : entity.getSourceConnections()) { - if (relation instanceof InheritanceModel) { - InheritanceModel inheritanceModel = (InheritanceModel) relation; - parents.add((AbstractEntityModel) inheritanceModel.getTarget()); - } - } - - return parents; - } - - /** - * 全ての継承先 祖先モデルを返す。 - * @param entity 対象エンティティ - * @return 継承先親モデルのSet - */ - private Set<AbstractEntityModel> processRecursive(AbstractEntityModel entity) { - Set<AbstractEntityModel> parentEntities = entity.process(new GetInheritanceParents(false)); - Set<AbstractEntityModel> entities = new HashSet<AbstractEntityModel>(); - - entities.addAll(parentEntities); - for (AbstractEntityModel parentEntity : parentEntities) { - if (entity.equals(parentEntity) == false) { - entities.addAll(parentEntity.process(new GetInheritanceParents(true))); - } - } - - return entities; - } - -} Copied: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetReferenceEntitiesProcessor.java (from rev 1938, artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParents.java) =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetReferenceEntitiesProcessor.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetReferenceEntitiesProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -0,0 +1,91 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/08/01 + * + * 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.core.utils.processor.entity; + +import java.util.HashSet; +import java.util.Set; + +import org.jiemamy.spec.model.connection.AbstractConnectionModel; +import org.jiemamy.spec.model.connection.ForeignKeyModel; +import org.jiemamy.spec.model.node.AbstractEntityModel; +import org.jiemamy.spec.util.Processor; + +/** + * 指定したエンティティの参照先親にあたるモデルのリストを取得する。 + * @author daisuke + */ +public class GetReferenceEntitiesProcessor implements Processor<AbstractEntityModel, Set<AbstractEntityModel>, RuntimeException> { + + private boolean recursive; + + + /** + * コンストラクタ。 + * @param recursive 再帰的に辿るかどうか + * @category instance creation + */ + public GetReferenceEntitiesProcessor(boolean recursive) { + this.recursive = recursive; + } + + /** + * {@inheritDoc} + */ + public Set<AbstractEntityModel> process(AbstractEntityModel entity) { + return recursive ? processRecursive(entity) : processNonRecursive(entity); + } + + /** + * 参照先親モデルを返す。 + * @param entity 対象エンティティ + * @return 親モデルのSet + */ + private Set<AbstractEntityModel> processNonRecursive(AbstractEntityModel entity) { + Set<AbstractEntityModel> parents = new HashSet<AbstractEntityModel>(); + + for (AbstractConnectionModel connection : entity.getSourceConnections()) { + if (connection instanceof ForeignKeyModel) { + ForeignKeyModel fkModel = (ForeignKeyModel) connection; + parents.add((AbstractEntityModel) fkModel.getTarget()); + } + } + + return parents; + } + + /** + * 全ての参照先 祖先モデルを返す。 + * @param entity 対象エンティティ + * @return 祖先モデルのSet + */ + private Set<AbstractEntityModel> processRecursive(AbstractEntityModel entity) { + Set<AbstractEntityModel> parentEntities = entity.process(new GetReferenceEntitiesProcessor(false)); + Set<AbstractEntityModel> entities = new HashSet<AbstractEntityModel>(); + + entities.addAll(parentEntities); + for (AbstractEntityModel parentEntity : parentEntities) { + if (entity.equals(parentEntity) == false) { + entities.addAll(parentEntity.process(new GetReferenceEntitiesProcessor(true))); + } + } + + return entities; + } + +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetReferenceEntitiesProcessor.java ___________________________________________________________________ Name: svn:mime-type + text/plain Copied: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSubEntitiesProcessor.java (from rev 1938, artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceChildren.java) =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSubEntitiesProcessor.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSubEntitiesProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -0,0 +1,90 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/08/01 + * + * 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.core.utils.processor.entity; + +import java.util.HashSet; +import java.util.Set; + +import org.jiemamy.core.model.connection.InheritanceModel; +import org.jiemamy.spec.model.connection.AbstractConnectionModel; +import org.jiemamy.spec.model.node.AbstractEntityModel; +import org.jiemamy.spec.util.Processor; + +/** + * 指定したエンティティの継承先子にあたるモデルのリストを取得する。 + * @author daisuke + */ +public class GetSubEntitiesProcessor implements + Processor<AbstractEntityModel, Set<AbstractEntityModel>, RuntimeException> { + + private boolean recursive; + + + /** + * コンストラクタ。 + * @param recursive 再帰的に辿るかどうか + * @category instance creation + */ + public GetSubEntitiesProcessor(boolean recursive) { + this.recursive = recursive; + } + + /** + * {@inheritDoc} + */ + public Set<AbstractEntityModel> process(AbstractEntityModel entity) { + return recursive ? processRecursive(entity) : processNonRecursive(entity); + } + + /** + * 継承先子モデルを返す。 + * @param entity 対象エンティティ + * @return 継承先子モデルのSet + */ + private Set<AbstractEntityModel> processNonRecursive(AbstractEntityModel entity) { + Set<AbstractEntityModel> children = new HashSet<AbstractEntityModel>(); + + for (AbstractConnectionModel relation : entity.getTargetConnections()) { + if (relation instanceof InheritanceModel) { + InheritanceModel inheritanceModel = (InheritanceModel) relation; + children.add((AbstractEntityModel) inheritanceModel.getSource()); + } + } + + return children; + } + + /** + * 全ての継承先 子孫モデルを返す。 + * @param entity 対象エンティティ + * @return 継承先子モデルのSet + */ + private Set<AbstractEntityModel> processRecursive(AbstractEntityModel entity) { + Set<AbstractEntityModel> childrenEntities = entity.process(new GetSubEntitiesProcessor(false)); + Set<AbstractEntityModel> entities = new HashSet<AbstractEntityModel>(); + + entities.addAll(childrenEntities); + for (AbstractEntityModel childEntity : childrenEntities) { + entities.addAll(childEntity.process(new GetSubEntitiesProcessor(false))); + } + + return entities; + } + +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSubEntitiesProcessor.java ___________________________________________________________________ Name: svn:mime-type + text/plain Copied: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSuperEntitiesProcessor.java (from rev 1938, artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetInheritanceParents.java) =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSuperEntitiesProcessor.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSuperEntitiesProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -0,0 +1,92 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/08/01 + * + * 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.core.utils.processor.entity; + +import java.util.HashSet; +import java.util.Set; + +import org.jiemamy.core.model.connection.InheritanceModel; +import org.jiemamy.spec.model.connection.AbstractConnectionModel; +import org.jiemamy.spec.model.node.AbstractEntityModel; +import org.jiemamy.spec.util.Processor; + +/** + * 指定したエンティティの継承親にあたるモデルのリストを取得する。 + * @author daisuke + */ +public class GetSuperEntitiesProcessor implements + Processor<AbstractEntityModel, Set<AbstractEntityModel>, RuntimeException> { + + private boolean recursive; + + + /** + * コンストラクタ。 + * @param recursive 再帰的に辿るかどうか + * @category instance creation + */ + public GetSuperEntitiesProcessor(boolean recursive) { + this.recursive = recursive; + } + + /** + * {@inheritDoc} + */ + public Set<AbstractEntityModel> process(AbstractEntityModel entity) { + return recursive ? processRecursive(entity) : processNonRecursive(entity); + } + + /** + * 継承先親モデルを返す。 + * @param entity 対象エンティティ + * @return 継承先親モデルのSet + */ + private Set<AbstractEntityModel> processNonRecursive(AbstractEntityModel entity) { + Set<AbstractEntityModel> parents = new HashSet<AbstractEntityModel>(); + + for (AbstractConnectionModel relation : entity.getSourceConnections()) { + if (relation instanceof InheritanceModel) { + InheritanceModel inheritanceModel = (InheritanceModel) relation; + parents.add((AbstractEntityModel) inheritanceModel.getTarget()); + } + } + + return parents; + } + + /** + * 全ての継承先 祖先モデルを返す。 + * @param entity 対象エンティティ + * @return 継承先親モデルのSet + */ + private Set<AbstractEntityModel> processRecursive(AbstractEntityModel entity) { + Set<AbstractEntityModel> parentEntities = entity.process(new GetSuperEntitiesProcessor(false)); + Set<AbstractEntityModel> entities = new HashSet<AbstractEntityModel>(); + + entities.addAll(parentEntities); + for (AbstractEntityModel parentEntity : parentEntities) { + if (entity.equals(parentEntity) == false) { + entities.addAll(parentEntity.process(new GetSuperEntitiesProcessor(true))); + } + } + + return entities; + } + +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/GetSuperEntitiesProcessor.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/GetColumnProcessor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/GetColumnProcessor.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/GetColumnProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -51,18 +51,18 @@ * @throws TooManyElementsException 複数のカラムが見つかった時 */ public ColumnModel process(TableModel tableModel) throws TooManyElementsException { - List<ColumnModel> result = CollectionsUtil.newArrayList(); + List<ColumnModel> columns = CollectionsUtil.newArrayList(); for (ColumnModel column : tableModel.getColumns()) { if (columnName.equals(column.getName())) { - result.add(column); + columns.add(column); } } - if (result.size() == 0) { + if (columns.size() == 0) { throw new ElementNotFoundException(tableModel, columnName); - } else if (result.size() > 1) { - throw new TooManyElementsException(tableModel, columnName, result); + } else if (columns.size() > 1) { + throw new TooManyElementsException(tableModel, columnName, columns); } - return result.get(0); + return columns.get(0); } } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/RemoveInheritedColumnsProcessor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/RemoveInheritedColumnsProcessor.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/entity/table/RemoveInheritedColumnsProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -61,5 +61,4 @@ return null; } - } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetEntityProcessor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetEntityProcessor.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetEntityProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -52,22 +52,21 @@ * @throws TooManyElementsException */ public AbstractEntityModel process(RootModel rootModel) throws TooManyElementsException { - - List<AbstractEntityModel> result = CollectionsUtil.newArrayList(); + List<AbstractEntityModel> entities = CollectionsUtil.newArrayList(); for (AbstractNodeModel node : rootModel.getNodes()) { if (node instanceof AbstractEntityModel) { AbstractEntityModel entiy = (AbstractEntityModel) node; if (entityName.equals(entiy.getName())) { - result.add(entiy); + entities.add(entiy); } } } - if (result.size() == 0) { + if (entities.size() == 0) { throw new ElementNotFoundException(rootModel, entityName); - } else if (result.size() > 1) { - throw new TooManyElementsException(rootModel, entityName, result); + } else if (entities.size() > 1) { + throw new TooManyElementsException(rootModel, entityName, entities); } - return result.get(0); + return entities.get(0); } } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetNodesProcessor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetNodesProcessor.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/GetNodesProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -45,7 +45,7 @@ * {@inheritDoc} */ @SuppressWarnings("unchecked") - public List<T> process(RootModel rootModel) throws RuntimeException { + public List<T> process(RootModel rootModel) { List<T> nodes = CollectionsUtil.newArrayList(); for (AbstractNodeModel node : rootModel.getNodes()) { Class<? extends AbstractNodeModel> nodeClass = node.getClass(); Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessor.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessor.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/processor/root/presentation/SetConstraintProcessor.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -24,7 +24,7 @@ import org.jiemamy.spec.util.Processor; /** - * 位置サイズ情報を取得する。 + * 位置サイズ情報を設定する。 * @author daisuke */ public class SetConstraintProcessor implements Processor<RootModel, JmRectangle, RuntimeException> { Modified: artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParentsTest.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParentsTest.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.core/src/test/java/org/jiemamy/core/utils/processor/entity/GetForeignKeyParentsTest.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -28,7 +28,7 @@ import org.jiemamy.core.utils.processor.base.ForeignKeyTestBase; /** - * {@link GetForeignKeyParents}のテストクラス。 + * {@link GetReferenceEntitiesProcessor}のテストクラス。 * @author daisuke */ @RunWith(Seasar2.class) @@ -40,9 +40,9 @@ */ @Test public void test01_name() throws Exception { - assertThat(deptTableModel.process(new GetForeignKeyParents(true)).size(), is(0)); - assertThat(deptTableModel.process(new GetForeignKeyParents(false)).size(), is(0)); - assertThat(empTableModel.process(new GetForeignKeyParents(true)).size(), is(2)); - assertThat(empTableModel.process(new GetForeignKeyParents(false)).size(), is(2)); + assertThat(deptTableModel.process(new GetReferenceEntitiesProcessor(true)).size(), is(0)); + assertThat(deptTableModel.process(new GetReferenceEntitiesProcessor(false)).size(), is(0)); + assertThat(empTableModel.process(new GetReferenceEntitiesProcessor(true)).size(), is(2)); + assertThat(empTableModel.process(new GetReferenceEntitiesProcessor(false)).size(), is(2)); } } Modified: artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java =================================================================== --- artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -29,9 +29,9 @@ import org.jiemamy.core.utils.processor.connection.DetachConnectionProcessor; import org.jiemamy.core.utils.processor.connection.IsCyclicProcessor; import org.jiemamy.core.utils.processor.connection.foreignkey.GenerateForeignKeyNameProcessor; -import org.jiemamy.core.utils.processor.entity.GetForeignKeyParents; -import org.jiemamy.core.utils.processor.entity.GetInheritanceChildren; -import org.jiemamy.core.utils.processor.entity.GetInheritanceParents; +import org.jiemamy.core.utils.processor.entity.GetReferenceEntitiesProcessor; +import org.jiemamy.core.utils.processor.entity.GetSubEntitiesProcessor; +import org.jiemamy.core.utils.processor.entity.GetSuperEntitiesProcessor; import org.jiemamy.core.utils.processor.entity.table.AddInheritedColumnsProcessor; import org.jiemamy.core.utils.processor.entity.table.RemoveInheritedColumnsProcessor; import org.jiemamy.core.utils.processor.root.presentation.ResetBendpointProcessor; @@ -95,7 +95,7 @@ if (connection instanceof ForeignKeyModel) { // 循環参照の禁止(ターゲットの親に自分がいたら、参照不可) - if (((AbstractEntityModel) target).process(new GetForeignKeyParents(true)).contains(source)) { + if (((AbstractEntityModel) target).process(new GetReferenceEntitiesProcessor(true)).contains(source)) { LogUtil.log(JiemamyPlugin.getDefault(), "attempt to create cyclic connection"); // RESOURCE return false; } @@ -116,13 +116,13 @@ } // 循環継承の禁止(ターゲットの親に自分がいたら、継承不可) - if (((AbstractEntityModel) target).process(new GetInheritanceParents(true)).contains(source)) { + if (((AbstractEntityModel) target).process(new GetSuperEntitiesProcessor(true)).contains(source)) { LogUtil.log(JiemamyPlugin.getDefault(), "attempt to create cyclic inheritance"); // RESOURCE return false; } // 同エンティティの間接多重継承の禁止(ターゲットの子に自分がいたら、継承不可) - if (((AbstractEntityModel) target).process(new GetInheritanceChildren(true)).contains(source)) { + if (((AbstractEntityModel) target).process(new GetSubEntitiesProcessor(true)).contains(source)) { LogUtil.log(JiemamyPlugin.getDefault(), "attempt xxx"); // TODO return false; } Modified: artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java =================================================================== --- artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -20,7 +20,7 @@ import org.eclipse.gef.tools.DirectEditManager; -import org.jiemamy.core.utils.processor.entity.GetInheritanceParents; +import org.jiemamy.core.utils.processor.entity.GetSuperEntitiesProcessor; import org.jiemamy.spec.model.node.AbstractEntityModel; import org.jiemamy.spec.util.ModelChangeEvent; @@ -39,7 +39,7 @@ AbstractEntityModel entityModel = (AbstractEntityModel) getModel(); // 継承親モデルを監視開始 - for (AbstractEntityModel parent : entityModel.process(new GetInheritanceParents(false))) { + for (AbstractEntityModel parent : entityModel.process(new GetSuperEntitiesProcessor(false))) { parent.addModelChangeListener(this); } } @@ -52,7 +52,7 @@ AbstractEntityModel entityModel = (AbstractEntityModel) getModel(); // 継承親モデルを監視終了 - for (AbstractEntityModel parent : entityModel.process(new GetInheritanceParents(false))) { + for (AbstractEntityModel parent : entityModel.process(new GetSuperEntitiesProcessor(false))) { parent.removeModelChangeListener(this); } Modified: artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java =================================================================== --- artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -32,7 +32,7 @@ import org.jiemamy.core.MustBeMulti; import org.jiemamy.core.model.InheritanceColumnModel; -import org.jiemamy.core.utils.processor.entity.GetInheritanceParents; +import org.jiemamy.core.utils.processor.entity.GetSuperEntitiesProcessor; import org.jiemamy.core.utils.processor.entity.table.RefreshInheritedColumnsProcessor; import org.jiemamy.core.utils.processor.root.presentation.GetColorProcessor; import org.jiemamy.core.utils.processor.root.presentation.GetConstraintProcessor; @@ -94,7 +94,7 @@ refreshTargetConnections(); updateFigure(getFigure()); // } - } else if (((TableModel) getModel()).process(new GetInheritanceParents(false)).contains(evt.getSource())) { // 継承親の発火 + } else if (((TableModel) getModel()).process(new GetSuperEntitiesProcessor(false)).contains(evt.getSource())) { // 継承親の発火 // if (evt.getField().equals(TableModel.P_ENTITY_TABLE_COLUMNS)) { // 継承親モデルのカラムが編集された時 refreshInheritColumns((TableModel) evt.getSource()); // } Modified: artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractEntityTreeEditPart.java =================================================================== --- artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractEntityTreeEditPart.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractEntityTreeEditPart.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -18,7 +18,7 @@ */ package org.jiemamy.eclipse.editor.editpart.outlinetree; -import org.jiemamy.core.utils.processor.entity.GetInheritanceParents; +import org.jiemamy.core.utils.processor.entity.GetSuperEntitiesProcessor; import org.jiemamy.spec.model.connection.AbstractConnectionModel; import org.jiemamy.spec.model.node.AbstractEntityModel; import org.jiemamy.spec.util.ModelChangeEvent; @@ -51,7 +51,7 @@ } // 継承親モデルの監視 - for (AbstractEntityModel parent : entity.process(new GetInheritanceParents(false))) { + for (AbstractEntityModel parent : entity.process(new GetSuperEntitiesProcessor(false))) { parent.addModelChangeListener(this); } } @@ -62,7 +62,7 @@ @Override public void deactivate() { AbstractEntityModel entity = (AbstractEntityModel) getModel(); - for (AbstractEntityModel parent : entity.process(new GetInheritanceParents(false))) { + for (AbstractEntityModel parent : entity.process(new GetSuperEntitiesProcessor(false))) { parent.removeModelChangeListener(this); } for (AbstractConnectionModel connection : entity.getTargetConnections()) { Modified: artemis/trunk/org.jiemamy.spec/.project =================================================================== --- artemis/trunk/org.jiemamy.spec/.project 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/.project 2008-09-23 11:30:38 UTC (rev 1939) @@ -47,17 +47,17 @@ <link> <name>.fbprefs</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.fbprefs</locationURI> + <location>D:/develop/eclipse/workspaces/main/org.jiemamy.project/.fbprefs</location> </link> <link> <name>findbugs.xml</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/findbugs.xml</locationURI> + <location>D:/develop/eclipse/workspaces/main/org.jiemamy.project/findbugs.xml</location> </link> <link> <name>.checkstyle</name> <type>1</type> - <locationURI>DOCUMENTS/org.jiemamy.project/.checkstyle</locationURI> + <location>D:/develop/eclipse/workspaces/main/org.jiemamy.project/.checkstyle</location> </link> </linkedResources> </projectDescription> Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/ColumnModel.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/ColumnModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/ColumnModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -95,6 +95,13 @@ */ boolean isSimpleIndex(); +// /** +// * カラムが、指定したテーブルから継承されたものであるかどうかを取得する。 +// * @param parentTable 親テーブル +// * @return 指定したテーブルから継承されたものであれば <code>true</code> +// */ +// boolean isSubColumnOf(TableModel parentTable); + /** * 制約を削除する。 * @param constraintClass 制約クラス @@ -148,5 +155,4 @@ * @param simpleIndex 単純インデックスの有無 */ void setSimpleIndex(boolean simpleIndex); - } Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/JiemamyModel.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/JiemamyModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/JiemamyModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -34,6 +34,9 @@ /** * モデルIDを取得する。 * + * <p>モデルIDは、このモデルのライフサイクル(生成から削除まで)を通して一貫しており、 + * 全モデル間で一意でなければならない(MUST)。</p> + * * @return id モデルID */ public UUID getId(); @@ -71,12 +74,6 @@ public <R, T extends JiemamyModel, E extends Exception>R process(Processor<T, R, E> processor) throws E; /** - * TODO for daisuke - * @param id - */ - public void setId(UUID id); - - /** * このオブジェクトが保持しているリソースを破棄します。 */ void dispose(); Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/RootModel.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/RootModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/RootModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -32,6 +32,31 @@ */ public interface RootModel extends JiemamyModel { +// /** +// * 新規にモデルインスタンスを生成する。 +// * @param <T> 生成するモデルの種類を表す型 +// * @param clazz 生成するモデルの種類を表す型 +// * @return 生成されたモデル +// * additional logic +// */ +// <T extends JiemamyModel>T createJiemamyModel(Class<T> clazz); +// +// /** +// * 既存エンティティと衝突しない適切な初期エンティティ名で初期化を行う。 +// * @param entityModel 初期化対象のエンティティ +// * @param validator 識別子名の適切性を判断するバリデータ +// * additional logic +// */ +// void generateValidName(AbstractEntityModel entityModel, IdentifierValidator validator); +// +// /** +// * 既存リレーションと衝突しない適切な初期リレーション名で初期化を行う。 +// * @param relationModel 初期化対象のリレーション +// * @param validator 識別子名の適切性を判断するバリデータ +// * additional logic +// */ +// void generateValidName(ForeignKeyModel relationModel, IdentifierValidator validator); + /** * 開始スクリプトを取得する。 * @return 開始スクリプト @@ -44,6 +69,15 @@ */ Set<AbstractConnectionModel> getConnections(); +// /** +// * 特定の種類のコネクション{@link Set}を取得する。 +// * @param <T> 取得したいコネクションのクラス +// * @param clazz 取得したいコネクションのクラス +// * @return コネクションの{@link List} +// * additional logic +// */ +// <T extends AbstractConnectionModel>Set<T> getConnections(Class<T> clazz); + /** * 説明文を取得する。 * @return 説明文 @@ -74,6 +108,18 @@ */ String getEndScript(); +// /** +// * 指定した名前を持つエンティティを取得する。 +// * @param <T> エンティティの種類 +// * @param clazz エンティティの種類 +// * @param entityName エンティティ名 +// * @return 見つかったエンティティ +// * @throws TooManyElementsException 同名のエンティティが複数見つかった場合 +// * @throws ElementNotFoundException エンティティが見つからなかった場合 +// * additional logic +// */ +// <T extends AbstractEntityModel>T getEntity(Class<T> clazz, String entityName) throws TooManyElementsException; + /** * INSERTデータセットを取得する。 * @return INSERTデータセット @@ -86,18 +132,69 @@ */ Set<AbstractNodeModel> getNodes(); +// /** +// * 特定の種類のノード{@link Set}を取得する。 +// * @param <T> 取得したいノードのクラス +// * @param clazz 取得したいノードのクラス +// * @return ノードの{@link List} +// */ +// <T extends AbstractNodeModel>Set<T> getNodes(Class<T> clazz); + /** * スキーマ名を取得する。 * @return スキーマ名 */ String getSchemaName(); +// /** +// * ベンドポイントを初期化する。 +// * +// * <p>異なるノード間のコネクションである場合、ベンドポイントは無くなるべきである(SHOULD)。 +// * また、同一ノード間のコネクション(自己参照)である場合、コネクションが見やすい位置に複数のベンドポイントを +// * 配置してもよい(MAY)。</p> +// * +// * @param index ダイアグラム番号 +// * @param connection 設定対象コネクション +// * additional logic +// */ +// void resetBendpoints(int index, AbstractConnectionModel connection); + /** * 開始スクリプトを設定する。 * @param beginScript 開始スクリプト */ void setBeginScript(String beginScript); +// /** +// * コネクションのベンドポイント情報を設定する。 +// * +// * <p>ベンドポイント情報のリストは、source側を起点とした順番で格納されたリストである。</p> +// * +// * @param index ダイアグラム番号 +// * @param connection 設定対象コネクション +// * @param bendpoints ベンドポイント情報のリスト +// * additional logic +// */ +// void setBendpoints(int index, AbstractConnectionModel connection, List<JmPoint> bendpoints); +// +// /** +// * ノードの背景色情報を設定する。 +// * @param index ダイアグラム番号 +// * @param node 設定対象ノード +// * @param color 背景色情報 +// * additional logic +// */ +// void setColor(int index, AbstractNodeModel node, JmColor color); +// +// /** +// * ノードの位置サイズ情報を設定する。 +// * @param index ダイアグラム番号 +// * @param node 設定対象ノード +// * @param constraint 位置サイズ情報 +// * additional logic +// */ +// void setConstraint(int index, AbstractNodeModel node, JmRectangle constraint); + /** * 説明文を設定する。 * @param description 説明文 Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/AbstractConnectionModel.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/AbstractConnectionModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/AbstractConnectionModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -39,6 +39,12 @@ */ AbstractNodeModel getTarget(); +// /** +// * 自分同士を繋ぐコネクションであるかどうかを調べる。 +// * @return 自己コネクションである場合 <code>true</code> +// */ +// boolean isSelfConnection(); + /** * 接続元ノードを設定する。 * @param source 接続元ノード @@ -50,5 +56,4 @@ * @param target 接続先ノード */ void setTarget(AbstractNodeModel target); - } Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/connection/ForeignKeyMapping.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -39,6 +39,14 @@ */ ColumnModel getReferenceColumn(); +// /** +// * デフォルトの「制約を受けるカラム」と「参照先カラム」を設定する。 +// * @param sourceTable +// * @param referencePkColumn +// * @param createColumn +// */ +// void initWithDefaultColumns(TableModel sourceTable, ColumnModel referencePkColumn, boolean createColumn); + /** * 制約を受けるカラムを設定する。 * @param constraintColumn 制約を受けるカラム @@ -50,5 +58,4 @@ * @param referenceColumn 参照先カラム */ void setReferenceColumn(ColumnModel referenceColumn); - } Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/AbstractEntityModel.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/AbstractEntityModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/AbstractEntityModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -18,6 +18,7 @@ */ package org.jiemamy.spec.model.node; + /** * TODO for daisuke * @author daisuke @@ -30,6 +31,13 @@ */ String getBeginScript(); +// /** +// * 指定したエンティティが外部キー制約によって参照しているエンティティの {@link Set} を取得する。 +// * @param recursive 再帰的に検索する場合は <code>true</code> +// * @return 外部キー制約によって参照しているエンティティの {@link Set} +// */ +// Set<AbstractEntityModel> getConstrainEntities(boolean recursive); + /** * 説明文を取得する。 * @return 説明文 @@ -54,6 +62,27 @@ */ String getName(); +// /** +// * 指定したエンティティが外部キー制約によって参照しているエンティティの {@link Set} を取得する。 +// * @param recursive 再帰的に検索する場合は <code>true</code> +// * @return 外部キー制約によって参照しているエンティティの {@link Set} +// */ +// Set<AbstractEntityModel> getReferenceEntities(boolean recursive); +// +// /** +// * 指定したエンティティの継承派生エンティティの {@link Set} を取得する。 +// * @param recursive 再帰的に検索する場合は <code>true</code> +// * @return 継承派生エンティティの {@link Set} +// */ +// Set<AbstractEntityModel> getSubEntities(boolean recursive); +// +// /** +// * 指定したエンティティの継承基底エンティティの {@link Set} を取得する。 +// * @param recursive 再帰的に検索する場合は <code>true</code> +// * @return 継承基底エンティティの {@link Set} +// */ +// Set<AbstractEntityModel> getSuperEntities(boolean recursive); + /** * 開始スクリプトを設定する。 * @param beginScript 開始スクリプト @@ -83,5 +112,4 @@ * @param name 名前 */ void setName(String name); - } Modified: artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/TableModel.java =================================================================== --- artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/TableModel.java 2008-09-18 14:46:25 UTC (rev 1938) +++ artemis/trunk/org.jiemamy.spec/src/main/java/org/jiemamy/spec/model/node/TableModel.java 2008-09-23 11:30:38 UTC (rev 1939) @@ -36,6 +36,15 @@ */ List<CheckConstraintModel> getChecks(); +// /** +// * 指定した名前を持つカラムを取得する。 +// * @param columnName カラム名 +// * @return 見つかったカラム +// * @throws TooManyElementsException 同名のカラムが複数見つかった場合 +// * @throws ElementNotFoundException カラムが見つからなかった場合 +// */ +// ColumnModel getColumn(String columnName) throws TooManyElementsException; + /** * カラムのリストを取得する。 * @return カラムのリスト @@ -48,4 +57,16 @@ */ List<IndexModel> getIndexes(); +// /** +// * 主キーカラムの {@link Set} を取得する。 +// * @return 主キーカラムの {@link Set} +// */ +// Set<ColumnModel> getPrimaryKeyColumns(); + +// /** +// * 複合キーテーブルかどうかを取得する。 +// * @return 複合キーテーブルであれば <code>true</code> +// */ +// boolean isCompositeKeyTable(); + }