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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
/*
* SonarQube
* Copyright (C) 2009-2025 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.db.issue;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.annotation.CheckForNull;
import org.sonar.api.issue.IssueStatus;
import org.sonar.api.issue.impact.Severity;
import org.sonar.api.issue.impact.SoftwareQuality;
public final class IndexedIssueDto {
private String issueKey = null;
private String assignee = null;
private Integer line = null;
private String resolution = null;
private String cleanCodeAttribute = null;
private String ruleCleanCodeAttribute = null;
private String severity = null;
private String status = null;
private Long effort = null;
private String authorLogin = null;
private Long issueCloseDate = null;
private Long issueCreationDate = null;
private Long issueUpdateDate = null;
private String ruleUuid = null;
private String language = null;
private String componentUuid = null;
private String path = null;
private String scope = null;
private String branchUuid = null;
private boolean isMain = false;
private String projectUuid = null;
private String tags = null;
private Integer issueType = null;
private String securityStandards = null;
private String qualifier = null;
private boolean isNewCodeReferenceIssue = false;
private String codeVariants = null;
private boolean prioritizedRule = false;
private Set<ImpactDto> impacts = new HashSet<>();
private Set<ImpactDto> ruleDefaultImpacts = new HashSet<>();
public IndexedIssueDto() {
// empty constructor
}
public String getIssueKey() {
return issueKey;
}
public IndexedIssueDto setIssueKey(String issueKey) {
this.issueKey = issueKey;
return this;
}
public String getAssignee() {
return assignee;
}
public IndexedIssueDto setAssignee(String assignee) {
this.assignee = assignee;
return this;
}
public Integer getLine() {
return line;
}
public IndexedIssueDto setLine(Integer line) {
this.line = line;
return this;
}
public String getResolution() {
return resolution;
}
public IndexedIssueDto setResolution(String resolution) {
this.resolution = resolution;
return this;
}
public String getSeverity() {
return severity;
}
public IndexedIssueDto setSeverity(String severity) {
this.severity = severity;
return this;
}
public String getStatus() {
return status;
}
public IndexedIssueDto setStatus(String status) {
this.status = status;
return this;
}
@CheckForNull
public String getIssueStatus() {
return Optional.ofNullable(IssueStatus.of(status, resolution)).map(IssueStatus::name).orElse(null);
}
public Long getEffort() {
return effort;
}
public IndexedIssueDto setEffort(Long effort) {
this.effort = effort;
return this;
}
public String getAuthorLogin() {
return authorLogin;
}
public IndexedIssueDto setAuthorLogin(String authorLogin) {
this.authorLogin = authorLogin;
return this;
}
public Long getIssueCloseDate() {
return issueCloseDate;
}
public IndexedIssueDto setIssueCloseDate(Long issueCloseDate) {
this.issueCloseDate = issueCloseDate;
return this;
}
public Long getIssueCreationDate() {
return issueCreationDate;
}
public IndexedIssueDto setIssueCreationDate(Long issueCreationDate) {
this.issueCreationDate = issueCreationDate;
return this;
}
public Long getIssueUpdateDate() {
return issueUpdateDate;
}
public IndexedIssueDto setIssueUpdateDate(Long issueUpdateDate) {
this.issueUpdateDate = issueUpdateDate;
return this;
}
public String getRuleUuid() {
return ruleUuid;
}
public IndexedIssueDto setRuleUuid(String ruleUuid) {
this.ruleUuid = ruleUuid;
return this;
}
public String getLanguage() {
return language;
}
public IndexedIssueDto setLanguage(String language) {
this.language = language;
return this;
}
public String getComponentUuid() {
return componentUuid;
}
public IndexedIssueDto setComponentUuid(String componentUuid) {
this.componentUuid = componentUuid;
return this;
}
public String getPath() {
return path;
}
public IndexedIssueDto setPath(String path) {
this.path = path;
return this;
}
public String getScope() {
return scope;
}
public IndexedIssueDto setScope(String scope) {
this.scope = scope;
return this;
}
public String getBranchUuid() {
return branchUuid;
}
public IndexedIssueDto setBranchUuid(String branchUuid) {
this.branchUuid = branchUuid;
return this;
}
public boolean isMain() {
return isMain;
}
public IndexedIssueDto setIsMain(boolean isMain) {
this.isMain = isMain;
return this;
}
public String getProjectUuid() {
return projectUuid;
}
public IndexedIssueDto setProjectUuid(String projectUuid) {
this.projectUuid = projectUuid;
return this;
}
public String getTags() {
return tags;
}
public IndexedIssueDto setTags(String tags) {
this.tags = tags;
return this;
}
public Integer getIssueType() {
return issueType;
}
public IndexedIssueDto setIssueType(Integer issueType) {
this.issueType = issueType;
return this;
}
public String getSecurityStandards() {
return securityStandards;
}
public IndexedIssueDto setSecurityStandards(String securityStandards) {
this.securityStandards = securityStandards;
return this;
}
public String getQualifier() {
return qualifier;
}
public IndexedIssueDto setQualifier(String qualifier) {
this.qualifier = qualifier;
return this;
}
public boolean isNewCodeReferenceIssue() {
return isNewCodeReferenceIssue;
}
public IndexedIssueDto setNewCodeReferenceIssue(boolean newCodeReferenceIssue) {
isNewCodeReferenceIssue = newCodeReferenceIssue;
return this;
}
public String getCodeVariants() {
return codeVariants;
}
public IndexedIssueDto setCodeVariants(String codeVariants) {
this.codeVariants = codeVariants;
return this;
}
public Set<ImpactDto> getImpacts() {
return impacts;
}
public Set<ImpactDto> getRuleDefaultImpacts() {
return ruleDefaultImpacts;
}
public Map<SoftwareQuality, Severity> getEffectiveImpacts() {
EnumMap<SoftwareQuality, Severity> effectiveImpacts = new EnumMap<>(SoftwareQuality.class);
ruleDefaultImpacts.forEach(impact -> effectiveImpacts.put(impact.getSoftwareQuality(), impact.getSeverity()));
impacts.forEach(impact -> effectiveImpacts.put(impact.getSoftwareQuality(), impact.getSeverity()));
return Collections.unmodifiableMap(effectiveImpacts);
}
public String getCleanCodeAttribute() {
if (cleanCodeAttribute != null) {
return cleanCodeAttribute;
}
return ruleCleanCodeAttribute;
}
public IndexedIssueDto setCleanCodeAttribute(String cleanCodeAttribute) {
this.cleanCodeAttribute = cleanCodeAttribute;
return this;
}
public String getRuleCleanCodeAttribute() {
return ruleCleanCodeAttribute;
}
public IndexedIssueDto setRuleCleanCodeAttribute(String ruleCleanCodeAttribute) {
this.ruleCleanCodeAttribute = ruleCleanCodeAttribute;
return this;
}
public boolean isPrioritizedRule() {
return prioritizedRule;
}
public IndexedIssueDto setPrioritizedRule(boolean prioritizedRule) {
this.prioritizedRule = prioritizedRule;
return this;
}
}
|