blob: 79d9e3a09c614557c6c0fcaaf47dca9b93ae56cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/*******************************************************************************
* Copyright (c) 2012 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.loader.data;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
/**
* @author Andrew M. Finkbeiner
*/
public class RelationDataImpl extends OrcsVersionedObjectImpl implements RelationData {
private int parentId = RelationalConstants.ART_ID_SENTINEL;
private int artIdA = RelationalConstants.ART_ID_SENTINEL;
private int artIdB = RelationalConstants.ART_ID_SENTINEL;
private String rationale = RelationalConstants.DEFAULT_RATIONALE;
public RelationDataImpl(VersionData version) {
super(version);
}
public void setRelationId(int relationId) {
setLocalId(relationId);
}
@Override
public void setArtIdA(int artIdA) {
this.artIdA = artIdA;
}
@Override
public void setArtIdB(int artIdB) {
this.artIdB = artIdB;
}
@Override
public void setRationale(String rationale) {
this.rationale = rationale;
}
public int getRelationId() {
return getLocalId();
}
@Override
public int getArtIdA() {
return artIdA;
}
@Override
public int getArtIdB() {
return artIdB;
}
@Override
public String getRationale() {
return rationale;
}
@Override
public void setParentId(int parentId) {
this.parentId = parentId;
}
@Override
public int getParentId() {
return parentId;
}
@Override
public int getArtIdOn(RelationSide side) {
return RelationSide.SIDE_A == side ? getArtIdA() : getArtIdB();
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + artIdA;
result = prime * result + artIdB;
result = prime * result + parentId;
result = prime * result + ((rationale == null) ? 0 : rationale.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
RelationDataImpl other = (RelationDataImpl) obj;
if (artIdA != other.artIdA) {
return false;
}
if (artIdB != other.artIdB) {
return false;
}
if (parentId != other.parentId) {
return false;
}
if (rationale == null) {
if (other.rationale != null) {
return false;
}
} else if (!rationale.equals(other.rationale)) {
return false;
}
return true;
}
@Override
public String toString() {
return "RelationData [parentId=" + parentId + ", artIdA=" + artIdA + ", artIdB=" + artIdB + ", rationale=" + rationale + " " + super.toString() + "]";
}
}
|