svnno****@sourc*****
svnno****@sourc*****
2008年 11月 1日 (土) 01:43:17 JST
Revision: 2067 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2067 Author: daisuke_m Date: 2008-11-01 01:43:17 +0900 (Sat, 01 Nov 2008) Log Message: ----------- refactor Modified Paths: -------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java Added Paths: ----------- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CheckConstraintXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CollectionXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ColumnXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ConstraintXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DataTypeXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DomainXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyMappingXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/RootXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/TableXmlElement.java artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/XmlElement.java Removed Paths: ------------- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java 2008-10-30 16:30:12 UTC (rev 2066) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/ColumnModelImpl.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -103,7 +103,7 @@ public ConstraintsModel getConstraints() { if (dataType instanceof DomainModel) { DomainModel domainModel = (DomainModel) dataType; - return ConstraintUtil.marge(constraints, domainModel.getConstraint()); + return ConstraintUtil.marge(constraints, domainModel.getConstraints()); } return constraints; } @@ -164,7 +164,7 @@ public boolean hasConstraint(Class<? extends Constraint> clazz) { if (dataType instanceof DomainModel) { DomainModel domainModel = (DomainModel) dataType; - return ConstraintUtil.marge(constraints, domainModel.getConstraint()).has(clazz); + return ConstraintUtil.marge(constraints, domainModel.getConstraints()).has(clazz); } return constraints.has(clazz); } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java 2008-10-30 16:30:12 UTC (rev 2066) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/DomainModelImpl.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -95,14 +95,6 @@ /** * {@inheritDoc} */ - public ConstraintsModel getConstraint() { - return constraints; - } - - /** - * 制約を取得する。 - * @return 制約 - */ public ConstraintsModel getConstraints() { return constraints; } Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java 2008-10-30 16:30:12 UTC (rev 2066) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/JiemamySerializerFactory.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -26,7 +26,7 @@ */ public class JiemamySerializerFactory { - private volatile static JiemamySerializer singleton; + private static volatile JiemamySerializer singleton; /** Modified: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java 2008-10-30 16:30:12 UTC (rev 2066) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/ModelWriter.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -26,7 +26,9 @@ import org.xml.sax.SAXException; -import org.jiemamy.serializer.XmlElement.ElementState; +import org.jiemamy.serializer.element.RootXmlElement; +import org.jiemamy.serializer.element.XmlElement; +import org.jiemamy.serializer.element.XmlElement.ElementState; import org.jiemamy.spec.model.RootModel; /** @@ -93,7 +95,7 @@ addToQueue(sw.toString().getBytes()); - xmlStack.push(new XmlElement(null, rootModel)); + xmlStack.push(new RootXmlElement(null, rootModel)); } /** @@ -155,11 +157,11 @@ element.setState(ElementState.PROGRESS); xmlStack.push(element.next()); } else { - if (element.getContent() == null || element.isEmptyCollection()) { + if (element.isEmptyElement()) { dataWriter.emptyElement(CORE_NAMESPACE, element.getName(), element.getName(), element .getAttributes()); } else { - dataWriter.dataElement(CORE_NAMESPACE, element.getName(), element.getContent().toString()); + dataWriter.dataElement(CORE_NAMESPACE, element.getName(), element.toString()); } element.setState(ElementState.FINISHED); xmlStack.pop(); Deleted: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java 2008-10-30 16:30:12 UTC (rev 2066) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/XmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -1,290 +0,0 @@ -/* - * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. - * Created on 2008/10/26 - * - * 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.serializer; - -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Queue; - -import org.apache.commons.lang.ClassUtils; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.AttributesImpl; - -import org.jiemamy.core.model.datatype.adapter.PrecisionedDataTypeAdapter; -import org.jiemamy.core.model.datatype.adapter.SizedDataTypeAdapter; -import org.jiemamy.core.model.datatype.adapter.TimezonedDataTypeAdapter; -import org.jiemamy.spec.model.ColumnModel; -import org.jiemamy.spec.model.JiemamyModel; -import org.jiemamy.spec.model.RootModel; -import org.jiemamy.spec.model.connection.ForeignKeyMapping; -import org.jiemamy.spec.model.connection.ForeignKeyModel; -import org.jiemamy.spec.model.constraint.CheckConstraintModel; -import org.jiemamy.spec.model.constraint.Constraint; -import org.jiemamy.spec.model.constraint.NotNullConstraintModel; -import org.jiemamy.spec.model.constraint.PrimaryKeyConstraintModel; -import org.jiemamy.spec.model.constraint.UniqueConstraintModel; -import org.jiemamy.spec.model.datatype.DataType; -import org.jiemamy.spec.model.node.TableModel; - -class XmlElement implements Iterator<XmlElement> { - - private static final String NAMESPACE = "http://jiemamy.org/ns/model/v1"; - - private String name; - - private AttributesImpl attributes = new AttributesImpl(); - - private Object content; - - private ElementState state = ElementState.INIT; - - /** - * 未出力エレメントのキュー - * - * <pre> - * <foo> - * <bar/> - * <baz/> - * </foo> - * </pre> - * - * 上記のようなXML構造の場合、foo要素のXmlElementでは、コンストラクト時に bar, baz がenqueueされる。 - */ - private Queue<XmlElement> queue = new LinkedList<XmlElement>(); - - - /** - * コンストラクタ。 - * @param name - * @param content - * @category instance creation - */ - XmlElement(String name, Object content) { - this(name, content, false); - } - - /** - * コンストラクタ。 - * @param name - * @param content - * @param byReference - * @category instance creation - */ - XmlElement(String name, Object content, boolean byReference) { - if (name == null) { - if (content instanceof RootModel) { - this.name = "rootModel"; - } else if (content instanceof TableModel) { - this.name = "table"; - } else if (content instanceof ColumnModel) { - this.name = "column"; - } else if (content instanceof DataType) { - this.name = "dataType"; - } else if (content instanceof ForeignKeyModel) { - this.name = "foreignKey"; - } else if (content instanceof ForeignKeyMapping) { - this.name = "mapping"; - } else if (content instanceof PrimaryKeyConstraintModel) { - this.name = "primaryKey"; - } else if (content instanceof NotNullConstraintModel) { - this.name = "notNull"; - } else if (content instanceof UniqueConstraintModel) { - this.name = "unique"; - } else { - this.name = ClassUtils.getShortClassName(content, "null"); - } - } else { - this.name = name; - } - - this.content = content; - - if (content instanceof JiemamyModel && byReference == false) { - JiemamyModel jiemamyModel = (JiemamyModel) content; - addAttribute("id", jiemamyModel.getId().toString()); - } - - if (content instanceof Collection) { - Collection<?> collection = (Collection<?>) content; - Iterator<?> ite = collection.iterator(); - while (ite.hasNext()) { - queue.add(new XmlElement(null, ite.next(), byReference)); - } - } else if (content instanceof Map) { - // TODO - } else if (content instanceof JiemamyModel && byReference) { - JiemamyModel jiemamyModel = (JiemamyModel) content; - addAttribute("ref", jiemamyModel.getId().toString()); - this.content = null; - } else if (content instanceof RootModel) { - RootModel rootModel = (RootModel) content; - queue.add(new XmlElement("rdbmsName", rootModel.getDialectClassName())); - queue.add(new XmlElement("beginScript", rootModel.getBeginScript())); - queue.add(new XmlElement("endScript", rootModel.getEndScript())); - queue.add(new XmlElement("description", rootModel.getDescription())); - queue.add(new XmlElement("schemaName", rootModel.getSchemaName())); - queue.add(new XmlElement("domains", rootModel.getDomains())); - queue.add(new XmlElement("nodes", rootModel.getNodes())); - queue.add(new XmlElement("connections", rootModel.getConnections())); - queue.add(new XmlElement("insertDataSetModels", null)); // FIXME - queue.add(new XmlElement("diagramPresentations", null)); // FIXME - } else if (content instanceof TableModel) { - TableModel tableModel = (TableModel) content; - queue.add(new XmlElement("name", tableModel.getName())); - queue.add(new XmlElement("logicalName", tableModel.getLogicalName())); - queue.add(new XmlElement("sourceConnections", tableModel.getSourceConnections(), true)); - queue.add(new XmlElement("targetConnections", tableModel.getTargetConnections(), true)); - queue.add(new XmlElement("beginScript", tableModel.getBeginScript())); - queue.add(new XmlElement("endScript", tableModel.getEndScript())); - queue.add(new XmlElement("description", tableModel.getDescription())); - queue.add(new XmlElement("columns", tableModel.getColumns())); - } else if (content instanceof ColumnModel) { - ColumnModel columnModel = (ColumnModel) content; - queue.add(new XmlElement("name", columnModel.getName())); - queue.add(new XmlElement("logicalName", columnModel.getLogicalName())); - queue.add(new XmlElement("dataType", columnModel.getDataType())); - queue.add(new XmlElement("defaultValue", columnModel.getDefaultValue())); - queue.add(new XmlElement("constraints", columnModel.getConstraints())); - queue.add(new XmlElement("simpleIndex", columnModel.isSimpleIndex())); - queue.add(new XmlElement("freeString", columnModel.getFreeString())); - queue.add(new XmlElement("description", columnModel.getDescription())); - queue.add(new XmlElement("options", null)); // FIXME - queue.add(new XmlElement("representation", columnModel.isRepresentation())); - } else if (content instanceof DataType) { - DataType dataType = (DataType) content; - if (dataType.hasAdapter(SizedDataTypeAdapter.class)) { - queue.add(new XmlElement("size", dataType.getAdapter(SizedDataTypeAdapter.class).getSize())); - } - if (dataType.hasAdapter(TimezonedDataTypeAdapter.class)) { - queue.add(new XmlElement("timezone", dataType.getAdapter(TimezonedDataTypeAdapter.class) - .isWithTimezone())); - } - if (dataType.hasAdapter(PrecisionedDataTypeAdapter.class)) { - queue.add(new XmlElement("precision", dataType.getAdapter(PrecisionedDataTypeAdapter.class) - .getPrecision())); - queue.add(new XmlElement("scale", dataType.getAdapter(PrecisionedDataTypeAdapter.class).getScale())); - } - } else if (content instanceof ForeignKeyModel) { - ForeignKeyModel fk = (ForeignKeyModel) content; - queue.add(new XmlElement("name", fk.getName())); - queue.add(new XmlElement("logicalName", fk.getLogicalName())); - queue.add(new XmlElement("source", fk.getSource(), true)); - queue.add(new XmlElement("target", fk.getTarget(), true)); - queue.add(new XmlElement("mappings", fk.getMappings())); - queue.add(new XmlElement("matchType", fk.getMatchType())); - queue.add(new XmlElement("onDelete", fk.getOnDelete())); - queue.add(new XmlElement("onUpdate", fk.getOnUpdate())); - queue.add(new XmlElement("deferrable", fk.isDeferrable())); - queue.add(new XmlElement("initiallyCheckTime", fk.getInitiallyCheckTime())); - queue.add(new XmlElement("description", fk.getDescription())); - } else if (content instanceof ForeignKeyMapping) { - ForeignKeyMapping mapping = (ForeignKeyMapping) content; - queue.add(new XmlElement("constraintColumn", mapping.getConstraintColumn(), true)); - queue.add(new XmlElement("referenceColumn", mapping.getReferenceColumn(), true)); - } else if (content instanceof CheckConstraintModel) { - CheckConstraintModel check = (CheckConstraintModel) content; - queue.add(new XmlElement("name", check.getName())); - queue.add(new XmlElement("expression", check.getExpression())); - } else if (content instanceof Constraint) { - Constraint constraint = (Constraint) content; - queue.add(new XmlElement("name", constraint.getName())); - } - } - - public void addAttribute(String key, String value) { - // DOCME 引数、よく分からずに使ってます>< - attributes.addAttribute("", key, key, "", value); - } - - public Attributes getAttributes() { - return attributes; - } - - public Object getContent() { - return content; - } - - public String getName() { - return name; - } - - public ElementState getState() { - return state; - } - - /** - * {@inheritDoc} - */ - public boolean hasNext() { - return queue.isEmpty() == false; - } - - /** - * TODO for daisuke - * @return - */ - public boolean isEmptyCollection() { - return content instanceof Collection && ((Collection<?>) getContent()).isEmpty(); - } - - /** - * {@inheritDoc} - */ - public XmlElement next() { - if (hasNext() == false) { - throw new NoSuchElementException(); - } - return queue.poll(); - } - - /** - * {@inheritDoc} - */ - public void remove() { - throw new UnsupportedOperationException(); - } - - public void setContent(Object content) { - this.content = content; - } - - public void setName(String name) { - this.name = name; - } - - public void setState(ElementState state) { - this.state = state; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return name + ":" + content; - } - - - enum ElementState { - INIT, PROGRESS, FINISHED - } -} Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CheckConstraintXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CheckConstraintXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CheckConstraintXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,57 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.constraint.CheckConstraintModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class CheckConstraintXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param checkConstraint + * @category instance creation + */ + public CheckConstraintXmlElement(String name, CheckConstraintModel checkConstraint) { + this(name, checkConstraint, false); + } + + /** + * コンストラクタ。 + * @param name + * @param checkConstraint + * @param byReference + * @category instance creation + */ + public CheckConstraintXmlElement(String name, CheckConstraintModel checkConstraint, boolean byReference) { + super(name == null ? "column" : name, checkConstraint, byReference); + + if (byReference) { + addAttribute("ref", checkConstraint.getId().toString()); + } else { + addAttribute("id", checkConstraint.getId().toString()); + queue.add(new XmlElement("name", checkConstraint.getName())); + queue.add(new XmlElement("expression", checkConstraint.getExpression())); + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CheckConstraintXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CollectionXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CollectionXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CollectionXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,104 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +import org.jiemamy.spec.model.ColumnModel; +import org.jiemamy.spec.model.DomainModel; +import org.jiemamy.spec.model.RootModel; +import org.jiemamy.spec.model.connection.ForeignKeyMapping; +import org.jiemamy.spec.model.connection.ForeignKeyModel; +import org.jiemamy.spec.model.constraint.CheckConstraintModel; +import org.jiemamy.spec.model.constraint.Constraint; +import org.jiemamy.spec.model.datatype.DataType; +import org.jiemamy.spec.model.node.TableModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class CollectionXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param content + * @category instance creation + */ + public CollectionXmlElement(String name, Collection<?> content) { + this(name, content, false); + } + + /** + * コンストラクタ。 + * @param name + * @param collection + * @param byReference + * @category instance creation + */ + public CollectionXmlElement(String name, Collection<?> collection, boolean byReference) { + super(name, collection, byReference); + + Iterator<?> ite = collection.iterator(); + while (ite.hasNext()) { + queue.add(newElement(ite.next(), byReference)); + } + } + + /** + * TODO for daisuke + * @param content + * @param byReference + * @return + */ + private XmlElement newElement(Object content, boolean byReference) { + XmlElement result; + + if (content instanceof Collection) { + result = new CollectionXmlElement(null, (Collection<?>) content, byReference); + } else if (content instanceof Map) { + result = null; // TODO + } else if (content instanceof RootModel) { + result = new RootXmlElement(null, (RootModel) content, byReference); + } else if (content instanceof TableModel) { + result = new TableXmlElement(null, (TableModel) content, byReference); + } else if (content instanceof ColumnModel) { + result = new ColumnXmlElement(null, (ColumnModel) content, byReference); + } else if (content instanceof DomainModel) { + result = new DomainXmlElement(null, (DomainModel) content, byReference); + } else if (content instanceof DataType) { + result = new DataTypeXmlElement(null, (DataType) content, byReference); + } else if (content instanceof ForeignKeyModel) { + result = new ForeignKeyXmlElement(null, (ForeignKeyModel) content, byReference); + } else if (content instanceof ForeignKeyMapping) { + result = new ForeignKeyMappingXmlElement(null, (ForeignKeyMapping) content, byReference); + } else if (content instanceof CheckConstraintModel) { + result = new CheckConstraintXmlElement(null, (CheckConstraintModel) content, byReference); + } else if (content instanceof Constraint) { + result = new ConstraintXmlElement(null, (Constraint) content, byReference); + } else { + result = new XmlElement(null, content, byReference); + } + + return result; + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/CollectionXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ColumnXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ColumnXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ColumnXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,65 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.ColumnModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class ColumnXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param columnModel + * @category instance creation + */ + public ColumnXmlElement(String name, ColumnModel columnModel) { + this(name, columnModel, false); + } + + /** + * コンストラクタ。 + * @param name + * @param columnModel + * @param byReference + * @category instance creation + */ + public ColumnXmlElement(String name, ColumnModel columnModel, boolean byReference) { + super(name == null ? "column" : name, columnModel, byReference); + + if (byReference) { + addAttribute("ref", columnModel.getId().toString()); + } else { + addAttribute("id", columnModel.getId().toString()); + queue.add(new XmlElement("name", columnModel.getName())); + queue.add(new XmlElement("logicalName", columnModel.getLogicalName())); + queue.add(new DataTypeXmlElement("dataType", columnModel.getDataType())); + queue.add(new XmlElement("defaultValue", columnModel.getDefaultValue())); + queue.add(new CollectionXmlElement("constraints", columnModel.getConstraints())); + queue.add(new XmlElement("simpleIndex", columnModel.isSimpleIndex())); + queue.add(new XmlElement("freeString", columnModel.getFreeString())); + queue.add(new XmlElement("description", columnModel.getDescription())); + queue.add(new XmlElement("options", null)); // FIXME + queue.add(new XmlElement("representation", columnModel.isRepresentation())); + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ColumnXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ConstraintXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ConstraintXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ConstraintXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,56 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.constraint.Constraint; + +/** + * TODO for daisuke + * @author daisuke + */ +public class ConstraintXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param constraint + * @category instance creation + */ + public ConstraintXmlElement(String name, Constraint constraint) { + this(name, constraint, false); + } + + /** + * コンストラクタ。 + * @param name + * @param constraint + * @param byReference + * @category instance creation + */ + public ConstraintXmlElement(String name, Constraint constraint, boolean byReference) { + super(name == null ? "column" : name, constraint, byReference); + + if (byReference) { + addAttribute("ref", constraint.getId().toString()); + } else { + addAttribute("id", constraint.getId().toString()); + queue.add(new XmlElement("name", constraint.getName())); + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ConstraintXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DataTypeXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DataTypeXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DataTypeXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,70 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.core.model.datatype.adapter.PrecisionedDataTypeAdapter; +import org.jiemamy.core.model.datatype.adapter.SizedDataTypeAdapter; +import org.jiemamy.core.model.datatype.adapter.TimezonedDataTypeAdapter; +import org.jiemamy.spec.model.datatype.DataType; + +/** + * TODO for daisuke + * @author daisuke + */ +public class DataTypeXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param dataType + * @category instance creation + */ + public DataTypeXmlElement(String name, DataType dataType) { + this(name, dataType, false); + } + + /** + * コンストラクタ。 + * @param name + * @param dataType + * @param byReference + * @category instance creation + */ + public DataTypeXmlElement(String name, DataType dataType, boolean byReference) { + super(name == null ? "dataType" : name, dataType, byReference); + + if (byReference) { + addAttribute("ref", dataType.getId().toString()); + } else { + addAttribute("id", dataType.getId().toString()); + if (dataType.hasAdapter(SizedDataTypeAdapter.class)) { + queue.add(new XmlElement("size", dataType.getAdapter(SizedDataTypeAdapter.class).getSize())); + } + if (dataType.hasAdapter(TimezonedDataTypeAdapter.class)) { + queue.add(new XmlElement("timezone", dataType.getAdapter(TimezonedDataTypeAdapter.class) + .isWithTimezone())); + } + if (dataType.hasAdapter(PrecisionedDataTypeAdapter.class)) { + queue.add(new XmlElement("precision", dataType.getAdapter(PrecisionedDataTypeAdapter.class) + .getPrecision())); + queue.add(new XmlElement("scale", dataType.getAdapter(PrecisionedDataTypeAdapter.class).getScale())); + } + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DataTypeXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DomainXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DomainXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DomainXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,64 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.DomainModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class DomainXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param domainModel + * @category instance creation + */ + public DomainXmlElement(String name, DomainModel domainModel) { + this(name, domainModel, false); + } + + /** + * コンストラクタ。 + * @param name + * @param domainModel + * @param byReference + * @category instance creation + */ + public DomainXmlElement(String name, DomainModel domainModel, boolean byReference) { + super(name == null ? "domain" : name, domainModel, byReference); + + if (byReference) { + addAttribute("ref", domainModel.getId().toString()); + } else { + addAttribute("id", domainModel.getId().toString()); + queue.add(new XmlElement("name", domainModel.getName())); + queue.add(new XmlElement("logicalName", domainModel.getLogicalName())); + queue.add(new DataTypeXmlElement("dataType", domainModel.getDataType())); + queue.add(new XmlElement("defaultValue", domainModel.getDefaultValue())); + queue.add(new CollectionXmlElement("constraints", domainModel.getConstraints())); + queue.add(new XmlElement("simpleIndex", domainModel.isSimpleIndex())); + queue.add(new XmlElement("freeString", domainModel.getFreeString())); + queue.add(new XmlElement("description", domainModel.getDescription())); + queue.add(new XmlElement("options", null)); // FIXME + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/DomainXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyMappingXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyMappingXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyMappingXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,57 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.connection.ForeignKeyMapping; + +/** + * TODO for daisuke + * @author daisuke + */ +public class ForeignKeyMappingXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param mapping + * @category instance creation + */ + public ForeignKeyMappingXmlElement(String name, ForeignKeyMapping mapping) { + this(name, mapping, false); + } + + /** + * コンストラクタ。 + * @param name + * @param mapping + * @param byReference + * @category instance creation + */ + public ForeignKeyMappingXmlElement(String name, ForeignKeyMapping mapping, boolean byReference) { + super(name == null ? "mapping" : name, mapping, byReference); + + if (byReference) { + addAttribute("ref", mapping.getId().toString()); + } else { + addAttribute("id", mapping.getId().toString()); + queue.add(new ColumnXmlElement("constraintColumn", mapping.getConstraintColumn(), true)); + queue.add(new ColumnXmlElement("referenceColumn", mapping.getReferenceColumn(), true)); + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyMappingXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,67 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.connection.ForeignKeyModel; +import org.jiemamy.spec.model.node.TableModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class ForeignKeyXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param fk + * @category instance creation + */ + public ForeignKeyXmlElement(String name, ForeignKeyModel fk) { + this(name, fk, false); + } + + /** + * コンストラクタ。 + * @param name + * @param fk + * @param byReference + * @category instance creation + */ + public ForeignKeyXmlElement(String name, ForeignKeyModel fk, boolean byReference) { + super(name == null ? "foreignKey" : name, fk, byReference); + + if (byReference) { + addAttribute("ref", fk.getId().toString()); + } else { + addAttribute("id", fk.getId().toString()); + queue.add(new XmlElement("name", fk.getName())); + queue.add(new XmlElement("logicalName", fk.getLogicalName())); + queue.add(new TableXmlElement("source", (TableModel) fk.getSource(), true)); + queue.add(new TableXmlElement("target", (TableModel) fk.getTarget(), true)); + queue.add(new CollectionXmlElement("mappings", fk.getMappings())); + queue.add(new XmlElement("matchType", fk.getMatchType())); + queue.add(new XmlElement("onDelete", fk.getOnDelete())); + queue.add(new XmlElement("onUpdate", fk.getOnUpdate())); + queue.add(new XmlElement("deferrable", fk.isDeferrable())); + queue.add(new XmlElement("initiallyCheckTime", fk.getInitiallyCheckTime())); + queue.add(new XmlElement("description", fk.getDescription())); + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/ForeignKeyXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/RootXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/RootXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/RootXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,65 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.RootModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class RootXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param content + * @category instance creation + */ + public RootXmlElement(String name, RootModel content) { + this(name, content, false); + } + + /** + * コンストラクタ。 + * @param name + * @param rootModel + * @param byReference + * @category instance creation + */ + public RootXmlElement(String name, RootModel rootModel, boolean byReference) { + super(name == null ? "rootModel" : name, rootModel, byReference); + + if (byReference) { + addAttribute("ref", rootModel.getId().toString()); + } else { + addAttribute("id", rootModel.getId().toString()); + queue.add(new XmlElement("rdbmsName", rootModel.getDialectClassName())); + queue.add(new XmlElement("beginScript", rootModel.getBeginScript())); + queue.add(new XmlElement("endScript", rootModel.getEndScript())); + queue.add(new XmlElement("description", rootModel.getDescription())); + queue.add(new XmlElement("schemaName", rootModel.getSchemaName())); + queue.add(new CollectionXmlElement("domains", rootModel.getDomains())); + queue.add(new CollectionXmlElement("nodes", rootModel.getNodes())); + queue.add(new CollectionXmlElement("connections", rootModel.getConnections())); + queue.add(new XmlElement("insertDataSetModels", null)); // FIXME + queue.add(new XmlElement("diagramPresentations", null)); // FIXME + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/RootXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/TableXmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/TableXmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/TableXmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,63 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/26 + * + * 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.serializer.element; + +import org.jiemamy.spec.model.node.TableModel; + +/** + * TODO for daisuke + * @author daisuke + */ +public class TableXmlElement extends XmlElement { + + /** + * コンストラクタ。 + * @param name + * @param tableModel + * @category instance creation + */ + public TableXmlElement(String name, TableModel tableModel) { + this(name, tableModel, false); + } + + /** + * コンストラクタ。 + * @param name + * @param tableModel + * @param byReference + * @category instance creation + */ + public TableXmlElement(String name, TableModel tableModel, boolean byReference) { + super(name == null ? "table" : name, tableModel, byReference); + + if (byReference) { + addAttribute("ref", tableModel.getId().toString()); + } else { + addAttribute("id", tableModel.getId().toString()); + queue.add(new XmlElement("name", tableModel.getName())); + queue.add(new XmlElement("logicalName", tableModel.getLogicalName())); + queue.add(new CollectionXmlElement("sourceConnections", tableModel.getSourceConnections(), true)); + queue.add(new CollectionXmlElement("targetConnections", tableModel.getTargetConnections(), true)); + queue.add(new XmlElement("beginScript", tableModel.getBeginScript())); + queue.add(new XmlElement("endScript", tableModel.getEndScript())); + queue.add(new XmlElement("description", tableModel.getDescription())); + queue.add(new CollectionXmlElement("columns", tableModel.getColumns())); + } + } +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/TableXmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Added: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/XmlElement.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/XmlElement.java (rev 0) +++ artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/XmlElement.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -0,0 +1,164 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/11/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.serializer.element; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.NoSuchElementException; +import java.util.Queue; + +import org.apache.commons.lang.ClassUtils; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.AttributesImpl; + +/** + * TODO for daisuke + * @author daisuke + */ +public class XmlElement implements Iterator<XmlElement> { + + private static final String NAMESPACE = "http://jiemamy.org/ns/model/v1"; + + /** + * 未出力エレメントのキュー + * + * <pre> + * <foo> + * <bar/> + * <baz/> + * </foo> + * </pre> + * + * 上記のようなXML構造の場合、foo要素のXmlElementでは、コンストラクト時に bar, baz がenqueueされる。 + */ + protected Queue<XmlElement> queue = new LinkedList<XmlElement>(); + + private Object content; + + private String name; + + private AttributesImpl attributes = new AttributesImpl(); + + private ElementState state = ElementState.INIT; + + + /** + * コンストラクタ。 + * + * @category instance creation + */ + public XmlElement() { + } + + /** + * コンストラクタ。 + * @param name + * @param content + * @category instance creation + */ + public XmlElement(String name, Object content) { + this(name, content, false); + } + + /** + * コンストラクタ。 + * @param name + * @param content + * @param byReference + * @category instance creation + */ + public XmlElement(String name, Object content, boolean byReference) { + this.name = name == null ? ClassUtils.getShortClassName(content, "null") : name; + if (byReference == false) { + this.content = content; + } + } + + public void addAttribute(String key, String value) { + // DOCME 引数、よく分からずに使ってます>< + attributes.addAttribute("", key, key, "", value); + } + + public Attributes getAttributes() { + return attributes; + } + + public String getName() { + return name; + } + + public ElementState getState() { + return state; + } + + /** + * {@inheritDoc} + */ + public boolean hasNext() { + return queue.isEmpty() == false; + } + + /** + * TODO for daisuke + * @return + */ + public boolean isEmptyElement() { + return content == null || content instanceof Collection && ((Collection<?>) content).isEmpty(); + } + + /** + * {@inheritDoc} + */ + public XmlElement next() { + if (hasNext() == false) { + throw new NoSuchElementException(); + } + return queue.poll(); + } + + /** + * {@inheritDoc} + */ + public void remove() { + throw new UnsupportedOperationException(); + } + + public void setName(String name) { + this.name = name; + } + + public void setState(ElementState state) { + this.state = state; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return content.toString(); + } + + + public enum ElementState { + INIT, PROGRESS, FINISHED + } + +} Property changes on: artemis/trunk/org.jiemamy.serializer/src/main/java/org/jiemamy/serializer/element/XmlElement.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java 2008-10-30 16:30:12 UTC (rev 2066) +++ artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/ModelInputStreamTest.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -28,6 +28,7 @@ import org.junit.Test; import org.jiemamy.core.S2FactoryStrategy; +import org.jiemamy.core.model.ApplicationModelCreator; import org.jiemamy.core.model.typedef.datatype.impl.IntegerDataTypeMock; import org.jiemamy.core.model.typedef.datatype.impl.TimestampDataTypeMock; import org.jiemamy.core.model.typedef.datatype.impl.VarcharDataTypeMock; @@ -65,7 +66,7 @@ rootModel.appendModel(t); // もっと複雑なモデルを出したい時、コメント外す。 -// rootModel = new ApplicationModelCreator().createModel(); + rootModel = new ApplicationModelCreator().createModel(); StrBuilder sbActual = new StrBuilder(); BufferedReader reader = null; Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java 2008-10-30 16:30:12 UTC (rev 2066) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/spec/model/DomainModel.java 2008-10-31 16:43:17 UTC (rev 2067) @@ -38,7 +38,7 @@ * 制約を取得する。 * @return 制約 */ - ConstraintsModel getConstraint(); + ConstraintsModel getConstraints(); /** * ドメインとして定義された型を取得する。