1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.itracker.model;
20
21 import org.apache.commons.lang.builder.ToStringBuilder;
22
23
24
25
26
27
28 public class IssueRelation extends AbstractEntity {
29
30
31
32
33 private static final long serialVersionUID = 1L;
34
35 private Issue issue;
36
37 private Issue relatedIssue;
38
39
40 private int type;
41
42 private Integer matchingRelationId;
43
44
45
46
47
48
49
50
51
52
53 public IssueRelation() {
54 }
55
56 public IssueRelation(Issue issue, Issue relatedIssue, int relationType) {
57 setIssue(issue);
58 setRelatedIssue(relatedIssue);
59 setRelationType(relationType);
60 }
61
62 public Issue getIssue() {
63 return issue;
64 }
65
66 public void setIssue(Issue issue) {
67 if (issue == null) {
68 throw new IllegalArgumentException("null issue");
69 }
70 this.issue = issue;
71 }
72
73 public Issue getRelatedIssue() {
74 return relatedIssue;
75 }
76
77 public void setRelatedIssue(Issue relatedIssue) {
78 if (relatedIssue == null) {
79 throw new IllegalArgumentException("null relatedIssue");
80 }
81 this.relatedIssue = relatedIssue;
82 }
83
84 public int getRelationType() {
85 return type;
86 }
87
88 public void setRelationType(int type) {
89 this.type = type;
90 }
91
92 public Integer getMatchingRelationId() {
93 return matchingRelationId;
94 }
95
96 public void setMatchingRelationId(Integer matchingRelationId) {
97 this.matchingRelationId = matchingRelationId;
98 }
99
100
101 @Override
102 public String toString() {
103 return new ToStringBuilder(this).append("id", getId())
104 .append("issue", getIssue()).append("relatedIssue", getRelatedIssue())
105 .append("type", getRelationType()).toString();
106 }
107
108 public static enum Type {
109
110
111 RELATED_P(1),
112
113
114 RELATED_C(2),
115
116
117 DUPLICATE_P(3),
118
119
120 DUPLICATE_C(4),
121
122
123 CLONED_P(5),
124
125
126 CLONED_C(6),
127
128
129 SPLIT_P(7),
130
131
132 SPLIT_C(8),
133
134
135 DEPENDENT_P(9),
136
137
138 DEPENDENT_C(10);
139
140 @SuppressWarnings("unused")
141 private final int code;
142
143 private Type(int code) {
144 this.code = code;
145 }
146
147 }
148
149 }