• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

TMD-Maker(T字形ER図作成ツール)のEclipse Plugin,RCP,Webサイト用


Commit MetaInfo

Revisiondcf9f622bfca08617a6d2514f2073a5c178632a3 (tree)
Zeit2009-12-19 13:45:56
Autornakag <nakag@user...>
Commiternakag

Log Message

アトリビュートリストの出力順をアトリビュート名、エンティティ名の順になるように修正。
同じアトリビュート名が1つにまとめられる不具合を合わせて修正。

Ändern Zusammenfassung

Diff

--- a/tmdmaker/src/jp/sourceforge/tmdmaker/generate/attributelist/AttributeListHtmlGenerator.java
+++ b/tmdmaker/src/jp/sourceforge/tmdmaker/generate/attributelist/AttributeListHtmlGenerator.java
@@ -35,6 +35,7 @@ import jp.sourceforge.tmdmaker.model.CombinationTable;
3535 import jp.sourceforge.tmdmaker.model.Detail;
3636 import jp.sourceforge.tmdmaker.model.Diagram;
3737 import jp.sourceforge.tmdmaker.model.Entity;
38+import jp.sourceforge.tmdmaker.model.Identifier;
3839 import jp.sourceforge.tmdmaker.model.MappingList;
3940 import jp.sourceforge.tmdmaker.model.ModelElement;
4041 import jp.sourceforge.tmdmaker.model.MultivalueAndSuperset;
@@ -95,22 +96,22 @@ public class AttributeListHtmlGenerator {
9596 new File(rootDir, "index.html")));
9697 // context.put("entities", findAvailableModel(model));
9798 context.put("esc", new EscapeTool());
98- Map<Attribute, AbstractEntityModel> attributes = findAllAttributes(model);
99+ Map<String, EntityAttributePair> attributes = findAllAttributes(model);
99100
100101 context.put("entities", findAvailableModel(model));
101102 applyTemplate("summary.html", new File(rootDir, "summary.html"),
102103 context);
103104
104- context.put("attributes", attributes.keySet());
105+ context.put("attributes", attributes.entrySet());
105106
106107 applyTemplate("attribute_list.html", new File(rootDir,
107108 "attribute_list.html"), context);
108109 File attributesDir = new File(rootDir, "attributes");
109110 attributesDir.mkdir();
110- for (Map.Entry<Attribute, AbstractEntityModel> entry : attributes
111+ for (Map.Entry<String, EntityAttributePair> entry : attributes
111112 .entrySet()) {
112- Attribute attribute = entry.getKey();
113- AbstractEntityModel entity = entry.getValue();
113+ Attribute attribute = entry.getValue().getAttribute();
114+ AbstractEntityModel entity = entry.getValue().getModel();
114115 context.put("attribute", attribute);
115116 context.put("entity", entity);
116117 if (entity instanceof Entity) {
@@ -119,9 +120,8 @@ public class AttributeListHtmlGenerator {
119120 } else {
120121 context.remove("entityType");
121122 }
122- applyTemplate("attribute.html", new File(attributesDir, attribute
123- .getName()
124- + ".html"), context);
123+ applyTemplate("attribute.html", new File(attributesDir,
124+ entry.getValue().createAttributeFileKey() + ".html"), context);
125125 }
126126 }
127127
@@ -154,10 +154,11 @@ public class AttributeListHtmlGenerator {
154154 return entities;
155155 }
156156
157- private Map<Attribute, AbstractEntityModel> findAllAttributes(
157+ private Map<String, EntityAttributePair> findAllAttributes(
158158 Diagram diagram) {
159- Map<Attribute, AbstractEntityModel> attributes = new TreeMap<Attribute, AbstractEntityModel>(
160- new Comparator<Attribute>() {
159+
160+ Map<String, EntityAttributePair> attributes = new TreeMap<String, EntityAttributePair>(
161+ new Comparator<String>() {
161162
162163 /**
163164 * {@inheritDoc}
@@ -166,23 +167,29 @@ public class AttributeListHtmlGenerator {
166167 * java.lang.Object)
167168 */
168169 @Override
169- public int compare(Attribute o1, Attribute o2) {
170- return o1.getName().compareTo(o2.getName());
170+ public int compare(String o1, String o2) {
171+ return o1.compareTo(o2);
171172
172173 }
174+
173175 });
174176
175177 for (AbstractEntityModel m : findAvailableModel(diagram)) {
176178 if (m instanceof Entity) {
177179 Entity e = (Entity) m;
178- attributes.put(e.getIdentifier(), e);
180+ Identifier i = e.getIdentifier();
181+ EntityAttributePair pair = new EntityAttributePair(e, i);
182+ attributes.put(pair.createAttributeFileKey(), pair);
179183 }
180184 if (m instanceof Detail) {
181185 Detail d = (Detail) m;
182- attributes.put(d.getDetailIdentifier(), d);
186+ Identifier i = d.getDetailIdentifier();
187+ EntityAttributePair pair = new EntityAttributePair(d, i);
188+ attributes.put(pair.createAttributeFileKey(), pair);
183189 }
184190 for (Attribute a : m.getAttributes()) {
185- attributes.put(a, m);
191+ EntityAttributePair pair = new EntityAttributePair(m, a);
192+ attributes.put(pair.createAttributeFileKey(), pair);
186193 }
187194 }
188195 return attributes;
@@ -209,4 +216,5 @@ public class AttributeListHtmlGenerator {
209216 }
210217 }
211218 }
219+
212220 }
--- /dev/null
+++ b/tmdmaker/src/jp/sourceforge/tmdmaker/generate/attributelist/EntityAttributePair.java
@@ -0,0 +1,69 @@
1+/*
2+ * Copyright 2009 TMD-Maker Project <http://tmdmaker.sourceforge.jp/>
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package jp.sourceforge.tmdmaker.generate.attributelist;
17+
18+import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
19+import jp.sourceforge.tmdmaker.model.Attribute;
20+
21+/**
22+ * エンティティ系モデルとアトリビュートの1:1のペアモデル
23+ *
24+ * @author nakaG
25+ *
26+ */
27+public class EntityAttributePair {
28+ private Attribute attribute;
29+ private AbstractEntityModel model;
30+
31+ /**
32+ * コンストラクタ
33+ *
34+ * @param model
35+ * @param attribute
36+ */
37+ public EntityAttributePair(AbstractEntityModel model, Attribute attribute) {
38+ this.model = model;
39+ this.attribute = attribute;
40+ }
41+ public String createAttributeFileKey() {
42+ return attribute.getName() + "_" + model.getName();
43+ }
44+ /**
45+ * @return the attribute
46+ */
47+ public Attribute getAttribute() {
48+ return attribute;
49+ }
50+ /**
51+ * @param attribute the attribute to set
52+ */
53+ public void setAttribute(Attribute attribute) {
54+ this.attribute = attribute;
55+ }
56+ /**
57+ * @return the model
58+ */
59+ public AbstractEntityModel getModel() {
60+ return model;
61+ }
62+ /**
63+ * @param model the model to set
64+ */
65+ public void setModel(AbstractEntityModel model) {
66+ this.model = model;
67+ }
68+
69+}
--- a/tmdmaker/src/jp/sourceforge/tmdmaker/generate/attributelist/attribute_list.html
+++ b/tmdmaker/src/jp/sourceforge/tmdmaker/generate/attributelist/attribute_list.html
@@ -23,7 +23,7 @@
2323 <strong><a href="summary.html" target="attribute_frame">対象エンティティ一覧</a></strong><br>
2424 #foreach($attr in $attributes)
2525 &nbsp;
26- <a href="attributes/${attr.name}.html" target="attribute_frame">$esc.html($attr.name)</a><br>
26+ <a href="attributes/${attr.value.createAttributeFileKey()}.html" target="attribute_frame">$esc.html($attr.value.attribute.name)</a><br>
2727 #end
2828 </body>
2929 </html>
\ No newline at end of file