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
|
/*
* Sonar, open source software quality management tool.
* Copyright (C) 2008-2012 SonarSource
* mailto:contact AT sonarsource DOT com
*
* Sonar 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.
*
* Sonar 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 Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
package org.sonar.api.issue;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @since 3.6
*/
public class IssueChange {
private String severity = null;
private String comment = null;
private Boolean manualSeverity = null;
private String message = null;
private boolean lineChanged = false;
private Integer line = null;
private boolean costChanged = false;
private Double cost = null;
private String resolution = null;
private boolean assigneeLoginChanged = false;
private String assigneeLogin = null;
private Map<String, String> attributes = null;
private IssueChange() {
}
public static IssueChange create() {
return new IssueChange();
}
public boolean hasChanges() {
return severity != null || comment != null || manualSeverity != null || message != null ||
lineChanged || costChanged || resolution != null || assigneeLoginChanged || attributes != null;
}
public IssueChange setSeverity(String severity) {
this.severity = severity;
return this;
}
public IssueChange setComment(String comment) {
this.comment = comment;
return this;
}
public IssueChange setManualSeverity(boolean b) {
this.manualSeverity = b;
return this;
}
public IssueChange setMessage(String message) {
this.message = message;
return this;
}
public IssueChange setLine(@Nullable Integer line) {
this.lineChanged = true;
this.line = line;
return this;
}
public IssueChange setCost(@Nullable Double cost) {
this.costChanged = true;
this.cost = cost;
return this;
}
public IssueChange setResolution(String resolution) {
this.resolution = resolution;
return this;
}
public IssueChange setAssigneeLogin(@Nullable String assigneeLogin) {
this.assigneeLoginChanged = true;
this.assigneeLogin = assigneeLogin;
return this;
}
public IssueChange setAttribute(String key, @Nullable String value) {
if (attributes == null && value != null) {
attributes = new LinkedHashMap<String, String>();
}
if (value != null) {
attributes.put(key, value);
} else if (attributes != null) {
attributes.remove(key);
}
return this;
}
public String severity() {
return severity;
}
public String comment() {
return comment;
}
public Boolean manualSeverity() {
return manualSeverity;
}
public String message() {
return message;
}
public Integer line() {
return line;
}
public Double cost() {
return cost;
}
public String resolution() {
return resolution;
}
public String assigneeLogin() {
return assigneeLogin;
}
public Map<String, String> attributes() {
return attributes == null ? Collections.<String, String>emptyMap() : new LinkedHashMap<String, String>(attributes);
}
}
|