• R/O
  • HTTP
  • SSH
  • HTTPS

tmdmaker: Commit

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


Commit MetaInfo

Revision5b59a5fcded6693108c402d6f7f76fd75607d4b3 (tree)
Time2018-09-22 20:33:20
Authornakag <nakag@user...>
Commiternakag

Log Message

Change default Identifier datatype

Change Summary

Incremental Difference

--- a/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Attribute.java
+++ b/bundles/tmdmaker.core/src/jp/sourceforge/tmdmaker/model/Attribute.java
@@ -261,4 +261,67 @@ public class Attribute extends ModelElement implements IAttribute {
261261 public void accept(IVisitor visitor) {
262262 visitor.visit(this);
263263 }
264+
265+ @Override
266+ public int hashCode() {
267+ final int prime = 31;
268+ int result = 1;
269+ result = prime * result
270+ + ((dataTypeDeclaration == null) ? 0 : dataTypeDeclaration.hashCode());
271+ result = prime * result + (derivation ? 1231 : 1237);
272+ result = prime * result + ((derivationRule == null) ? 0 : derivationRule.hashCode());
273+ result = prime * result + ((description == null) ? 0 : description.hashCode());
274+ result = prime * result + ((implementName == null) ? 0 : implementName.hashCode());
275+ result = prime * result + ((lock == null) ? 0 : lock.hashCode());
276+ result = prime * result + (nullable ? 1231 : 1237);
277+ result = prime * result + ((validationRule == null) ? 0 : validationRule.hashCode());
278+ return result;
279+ }
280+
281+ @Override
282+ public boolean equals(Object obj) {
283+ if (this == obj)
284+ return true;
285+ if (obj == null)
286+ return false;
287+ if (getClass() != obj.getClass())
288+ return false;
289+ Attribute other = (Attribute) obj;
290+ if (dataTypeDeclaration == null) {
291+ if (other.dataTypeDeclaration != null)
292+ return false;
293+ } else if (!dataTypeDeclaration.equals(other.dataTypeDeclaration))
294+ return false;
295+ if (derivation != other.derivation)
296+ return false;
297+ if (derivationRule == null) {
298+ if (other.derivationRule != null)
299+ return false;
300+ } else if (!derivationRule.equals(other.derivationRule))
301+ return false;
302+ if (description == null) {
303+ if (other.description != null)
304+ return false;
305+ } else if (!description.equals(other.description))
306+ return false;
307+ if (implementName == null) {
308+ if (other.implementName != null)
309+ return false;
310+ } else if (!implementName.equals(other.implementName))
311+ return false;
312+ if (lock == null) {
313+ if (other.lock != null)
314+ return false;
315+ } else if (!lock.equals(other.lock))
316+ return false;
317+ if (nullable != other.nullable)
318+ return false;
319+ if (validationRule == null) {
320+ if (other.validationRule != null)
321+ return false;
322+ } else if (!validationRule.equals(other.validationRule))
323+ return false;
324+ return true;
325+ }
326+
264327 }
--- a/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/dialogs/models/EntityCreationModel.java
+++ b/bundles/tmdmaker/src/jp/sourceforge/tmdmaker/ui/dialogs/models/EntityCreationModel.java
@@ -16,10 +16,12 @@
1616 package jp.sourceforge.tmdmaker.ui.dialogs.models;
1717
1818 import jp.sourceforge.tmdmaker.model.AbstractEntityModel;
19+import jp.sourceforge.tmdmaker.model.DataTypeDeclaration;
1920 import jp.sourceforge.tmdmaker.model.Entity;
2021 import jp.sourceforge.tmdmaker.model.EntityType;
2122 import jp.sourceforge.tmdmaker.model.Identifier;
2223 import jp.sourceforge.tmdmaker.model.Laputa;
24+import jp.sourceforge.tmdmaker.model.StandardSQLDataType;
2325 import jp.sourceforge.tmdmaker.model.parts.ModelName;
2426
2527 /**
@@ -106,6 +108,8 @@ public class EntityCreationModel {
106108
107109 public AbstractEntityModel getCreateModel() {
108110 Identifier identifier = this.identifier.toIdentifier();
111+ identifier.setDataTypeDeclaration(
112+ new DataTypeDeclaration(StandardSQLDataType.CHARACTER_VARYING, 10, null));
109113 if (isLaputa()) {
110114 return Laputa.of(entityName, identifier);
111115 } else {
--- /dev/null
+++ b/tests/tmdmaker.core.test/src/jp/sourceforge/tmdmaker/model/IdentifierTest.java
@@ -0,0 +1,46 @@
1+/*
2+ * Copyright 2009-2018 TMD-Maker Project <https://tmdmaker.osdn.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.model;
17+
18+import static org.junit.Assert.*;
19+
20+import org.junit.After;
21+import org.junit.Before;
22+import org.junit.Test;
23+
24+public class IdentifierTest {
25+
26+ @Before
27+ public void setUp() throws Exception {
28+ }
29+
30+ @After
31+ public void tearDown() throws Exception {
32+ }
33+
34+ @Test
35+ public void testCreateEntityName() {
36+ Identifier identifier = new Identifier("請求書番号");
37+ assertEquals("請求", identifier.createEntityName().getValue());
38+ }
39+
40+ @Test
41+ public void testGetCopy() {
42+ Identifier identifier1 = new Identifier("請求書番号");
43+ Identifier identifier2 = (Identifier) identifier1.getCopy();
44+ assertEquals(identifier1, identifier2);
45+ }
46+}
Show on old repository browser