svnno****@sourc*****
svnno****@sourc*****
2008年 10月 23日 (木) 01:11:30 JST
Revision: 2022 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2022 Author: daisuke_m Date: 2008-10-23 01:11:30 +0900 (Thu, 23 Oct 2008) Log Message: ----------- DomainAppender追加。 Modified Paths: -------------- artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeUniqueConstraintModel.java artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon Added Paths: ----------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/DomainAppender.java -------------- next part -------------- Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/DomainAppender.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/DomainAppender.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/DomainAppender.java 2008-10-22 16:11:30 UTC (rev 2022) @@ -0,0 +1,58 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/02 + * + * 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.appender; + +import org.jiemamy.core.model.JiemamyModelAppender; +import org.jiemamy.spec.model.DomainModel; +import org.jiemamy.spec.model.JiemamyModel; +import org.jiemamy.spec.model.RootModel; + +/** + * {@link RootModel} に対して {@link DomainModel}を追加/削除するアペンダ。 + * @author daisuke + */ +public class DomainAppender implements JiemamyModelAppender { + + /** + * {@inheritDoc} + */ + public boolean append(JiemamyModel parent, JiemamyModel child) { + if (parent instanceof RootModel && child instanceof DomainModel) { + RootModel rootModel = (RootModel) parent; + DomainModel domain = (DomainModel) child; + rootModel.getDomains().add(domain); + return true; + } + return false; + } + + /** + * {@inheritDoc} + */ + public boolean remove(JiemamyModel parent, JiemamyModel child) { + if (parent instanceof RootModel && child instanceof DomainModel) { + RootModel rootModel = (RootModel) parent; + DomainModel domain = (DomainModel) child; + rootModel.removeModel(domain); + return true; + } + return false; + } + +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/appender/DomainAppender.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon 2008-10-22 15:58:15 UTC (rev 2021) +++ artemis/trunk/org.jiemamy.core/src/main/resources/jiemamy-core.dicon 2008-10-22 16:11:30 UTC (rev 2022) @@ -14,6 +14,9 @@ <initMethod name="registerAppender"> <arg><component class="org.jiemamy.core.appender.ConnectionAppender" /></arg> </initMethod> + <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.core.appender.DomainAppender" /></arg> + </initMethod> </component> <component class="org.jiemamy.core.model.node.ViewModelImpl" instance="prototype"/> <component class="org.jiemamy.core.model.node.StickyModelImpl" instance="prototype"/> Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java 2008-10-22 15:58:15 UTC (rev 2021) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/ApplicationModelCreator.java 2008-10-22 16:11:30 UTC (rev 2022) @@ -37,6 +37,10 @@ */ public class ApplicationModelCreator { + /** + * TODO for daisuke + * @param args + */ public static void main(String[] args) { RootModel rootModel = new ApplicationModelCreator().createModel(); System.out.println(rootModel); @@ -502,7 +506,7 @@ ForeignKeyModel fk = rootModel.createJiemamyModel(ForeignKeyModel.class).init(rootModel, source, target); for (int i = 0; i < sourceColumnNames.length; i++) { try { - ColumnModel constraintColumn = source.process(new GetColumnProcessor(sourceColumnNames[i])); + ColumnModel constraintColumn = source.getColumn(sourceColumnNames[i]); fk.getMappings().get(i).setConstraintColumn(constraintColumn); } catch (TooManyElementsException e) { throw new JiemamyRuntimeException("test code error", e); Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeUniqueConstraintModel.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeUniqueConstraintModel.java 2008-10-22 15:58:15 UTC (rev 2021) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/model/typedef/constraint/SerializeUniqueConstraintModel.java 2008-10-22 16:11:30 UTC (rev 2022) @@ -20,10 +20,10 @@ import com.thoughtworks.xstream.annotations.XStreamAlias; -import org.jiemamy.core.model.constraint.UniqueConstraintModel; +import org.jiemamy.core.model.constraint.UniqueConstraintModelImpl; /** - * {@link UniqueConstraintModel}に対応するシリアライズ用のモデル。 + * {@link UniqueConstraintModelImpl}に対応するシリアライズ用のモデル。 * * @author j5i2ko */ Modified: artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon =================================================================== --- artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon 2008-10-22 15:58:15 UTC (rev 2021) +++ artemis/trunk/org.jiemamy.view/src/main/resources/jiemamy-view.dicon 2008-10-22 16:11:30 UTC (rev 2022) @@ -16,6 +16,9 @@ <arg><component class="org.jiemamy.core.appender.ConnectionAppender" /></arg> </initMethod> <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.core.appender.DomainAppender" /></arg> + </initMethod> + <initMethod name="registerAppender"> <arg><component class="org.jiemamy.view.DiagramPresentationModelAppender" /></arg> </initMethod> </component>