blob: ebbcec139ef577af67b91e961bf422f05c8d418e (
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
|
/*********************************************************************
* Copyright (c) 2012 Boeing
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Boeing - initial API and implementation
**********************************************************************/
package org.eclipse.osee.orcs.db.internal.loader.data;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.RelationTypeToken;
import org.eclipse.osee.framework.core.data.RelationalConstants;
import org.eclipse.osee.framework.core.enums.RelationSide;
import org.eclipse.osee.orcs.core.ds.OrcsVersionedObjectImpl;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
/**
* @author Andrew M. Finkbeiner
*/
public class RelationDataImpl extends OrcsVersionedObjectImpl<RelationTypeToken> implements RelationData {
private ArtifactId artIdA = ArtifactId.SENTINEL;
private ArtifactId artIdB = ArtifactId.SENTINEL;
private String rationale = RelationalConstants.DEFAULT_RATIONALE;
private boolean useBackingData = false;
public RelationDataImpl(VersionData version) {
super(version);
}
public void setRelationId(int relationId) {
setLocalId(relationId);
}
@Override
public void setArtIdA(ArtifactId artIdA) {
this.artIdA = artIdA;
}
@Override
public void setArtIdB(ArtifactId artIdB) {
this.artIdB = artIdB;
}
@Override
public void setRationale(String rationale) {
this.rationale = rationale;
}
public long getRelationId() {
return getLocalId();
}
@Override
public Long getArtIdA() {
return artIdA.getId().intValue();
}
@Override
public Long getArtIdB() {
return artIdB.getId().intValue();
}
@Override
public String getRationale() {
return rationale;
}
@Override
public ArtifactId getArtIdOn(RelationSide side) {
return RelationSide.SIDE_A == side ? getArtifactIdA() : getArtifactIdB();
}
@Override
public String toString() {
return "RelationData [artIdA=" + artIdA + ", artIdB=" + artIdB + ", rationale=" + rationale + " " + super.toString() + "]";
}
@Override
public boolean isExistingVersionUsed() {
return useBackingData;
}
@Override
public void setUseBackingData(boolean useBackingData) {
this.useBackingData = useBackingData;
}
@Override
public ArtifactId getArtifactIdA() {
return artIdA;
}
@Override
public ArtifactId getArtifactIdB() {
return artIdB;
}
@Override
public Long getId() {
return getLocalId().longValue();
}
}
|