org.sonar.api.issue.internal
Class DefaultIssue
java.lang.Object
org.sonar.api.issue.internal.DefaultIssue
- All Implemented Interfaces:
- Serializable, Issue
public class DefaultIssue
- extends Object
- implements Issue
PLUGINS MUST NOT BE USED THIS CLASS, EXCEPT FOR UNIT TESTING.
- Since:
- 3.6
- See Also:
- Serialized Form
Fields inherited from interface org.sonar.api.issue.Issue |
MESSAGE_MAX_SIZE, RESOLUTION_FALSE_POSITIVE, RESOLUTION_FIXED, RESOLUTION_REMOVED, RESOLUTIONS, STATUS_CLOSED, STATUS_CONFIRMED, STATUS_OPEN, STATUS_REOPENED, STATUS_RESOLVED, STATUSES |
Method Summary |
String |
actionPlanKey()
|
DefaultIssue |
addChange(FieldDiffs change)
|
DefaultIssue |
addComment(DefaultIssueComment comment)
|
String |
assignee()
Login of the user who is assigned to this issue. |
String |
attribute(String key)
|
Map<String,String> |
attributes()
|
String |
authorLogin()
Login of the SCM account that introduced this issue. |
List<FieldDiffs> |
changes()
|
String |
checksum()
|
Date |
closeDate()
Date when status was set to Issue.STATUS_CLOSED , else null. |
List<IssueComment> |
comments()
Non-null list of comments, ordered by chronological order. |
Long |
componentId()
The component id not populated on batch side |
String |
componentKey()
Components are modules ("my_project"), directories ("my_project:my/dir") or files ("my_project:my/file.c"). |
Date |
creationDate()
|
FieldDiffs |
currentChange()
|
Duration |
debt()
Elapsed time to fix the issue |
Long |
debtInMinutes()
|
Double |
effortToFix()
Arbitrary distance to threshold for resolving the issue. |
boolean |
equals(Object o)
|
int |
hashCode()
|
boolean |
isChanged()
|
boolean |
isEndOfLife()
True when one of the following conditions is true :
the related component has been deleted or renamed
the rule has been deleted (eg. |
boolean |
isNew()
During a scan return if the current issue is a new one. |
boolean |
isOnDisabledRule()
|
String |
key()
Unique generated key. |
Integer |
line()
Optional line number. |
boolean |
manualSeverity()
|
String |
message()
|
boolean |
mustSendNotifications()
|
String |
projectKey()
The project key is not always populated, that's why it's not present in the Issue API |
String |
reporter()
Login of the user who reported this issue. |
String |
resolution()
The type of resolution, or null if the issue is not resolved. |
RuleKey |
ruleKey()
|
Date |
selectedAt()
|
DefaultIssue |
setActionPlanKey(String actionPlanKey)
|
DefaultIssue |
setAssignee(String s)
|
DefaultIssue |
setAttribute(String key,
String value)
|
DefaultIssue |
setAttributes(Map<String,String> map)
|
DefaultIssue |
setAuthorLogin(String s)
|
DefaultIssue |
setChanged(boolean b)
|
DefaultIssue |
setChanges(List<FieldDiffs> changes)
|
DefaultIssue |
setChecksum(String s)
|
DefaultIssue |
setCloseDate(Date d)
|
DefaultIssue |
setComponentId(Long s)
|
DefaultIssue |
setComponentKey(String s)
|
DefaultIssue |
setCreationDate(Date d)
|
DefaultIssue |
setDebt(Duration t)
|
DefaultIssue |
setEffortToFix(Double d)
|
DefaultIssue |
setEndOfLife(boolean b)
|
DefaultIssue |
setFieldChange(IssueChangeContext context,
String field,
Serializable oldValue,
Serializable newValue)
|
DefaultIssue |
setKey(String key)
|
DefaultIssue |
setLine(Integer l)
|
DefaultIssue |
setManualSeverity(boolean b)
|
DefaultIssue |
setMessage(String s)
|
DefaultIssue |
setNew(boolean b)
|
DefaultIssue |
setOnDisabledRule(boolean b)
|
DefaultIssue |
setProjectKey(String projectKey)
|
DefaultIssue |
setReporter(String s)
|
DefaultIssue |
setResolution(String s)
|
DefaultIssue |
setRuleKey(RuleKey k)
|
DefaultIssue |
setSelectedAt(Date d)
|
DefaultIssue |
setSendNotifications(boolean b)
|
DefaultIssue |
setSeverity(String s)
|
DefaultIssue |
setStatus(String s)
|
DefaultIssue |
setUpdateDate(Date d)
|
String |
severity()
See constants in Severity . |
String |
status()
See constant values in Issue . |
String |
toString()
|
Date |
updateDate()
|
DefaultIssue
public DefaultIssue()
key
public String key()
- Description copied from interface:
Issue
- Unique generated key. It looks like "d2de809c-1512-4ae2-9f34-f5345c9f1a13".
- Specified by:
key
in interface Issue
setKey
public DefaultIssue setKey(String key)
componentKey
public String componentKey()
- Description copied from interface:
Issue
- Components are modules ("my_project"), directories ("my_project:my/dir") or files ("my_project:my/file.c").
Keys of Java packages and classes are currently in a special format: "my_project:com.company" and "my_project:com.company.Foo".
- Specified by:
componentKey
in interface Issue
setComponentKey
public DefaultIssue setComponentKey(String s)
componentId
@CheckForNull
public Long componentId()
- The component id not populated on batch side
setComponentId
public DefaultIssue setComponentId(@Nullable
Long s)
projectKey
@CheckForNull
public String projectKey()
- The project key is not always populated, that's why it's not present in the Issue API
setProjectKey
public DefaultIssue setProjectKey(@Nullable
String projectKey)
ruleKey
public RuleKey ruleKey()
- Specified by:
ruleKey
in interface Issue
setRuleKey
public DefaultIssue setRuleKey(RuleKey k)
severity
public String severity()
- Description copied from interface:
Issue
- See constants in
Severity
.
- Specified by:
severity
in interface Issue
setSeverity
public DefaultIssue setSeverity(@Nullable
String s)
manualSeverity
public boolean manualSeverity()
setManualSeverity
public DefaultIssue setManualSeverity(boolean b)
message
@CheckForNull
public String message()
- Specified by:
message
in interface Issue
setMessage
public DefaultIssue setMessage(@Nullable
String s)
line
@CheckForNull
public Integer line()
- Description copied from interface:
Issue
- Optional line number. If set, then it's greater than or equal 1.
- Specified by:
line
in interface Issue
setLine
public DefaultIssue setLine(@Nullable
Integer l)
effortToFix
@CheckForNull
public Double effortToFix()
- Description copied from interface:
Issue
- Arbitrary distance to threshold for resolving the issue.
For examples:
- for the rule "Avoid too complex methods" : current complexity - max allowed complexity
- for the rule "Avoid Duplications" : number of duplicated blocks
- for the rule "Insufficient Line Coverage" : number of lines to cover to reach the accepted threshold
- Specified by:
effortToFix
in interface Issue
setEffortToFix
public DefaultIssue setEffortToFix(@Nullable
Double d)
debt
@CheckForNull
public Duration debt()
- Elapsed time to fix the issue
debtInMinutes
@CheckForNull
public Long debtInMinutes()
setDebt
public DefaultIssue setDebt(@Nullable
Duration t)
status
public String status()
- Description copied from interface:
Issue
- See constant values in
Issue
.
- Specified by:
status
in interface Issue
setStatus
public DefaultIssue setStatus(String s)
resolution
@CheckForNull
public String resolution()
- Description copied from interface:
Issue
- The type of resolution, or null if the issue is not resolved. See constant values in
Issue
.
- Specified by:
resolution
in interface Issue
setResolution
public DefaultIssue setResolution(@Nullable
String s)
reporter
@CheckForNull
public String reporter()
- Description copied from interface:
Issue
- Login of the user who reported this issue. Null if the issue is reported by a rule engine.
- Specified by:
reporter
in interface Issue
setReporter
public DefaultIssue setReporter(@Nullable
String s)
assignee
@CheckForNull
public String assignee()
- Description copied from interface:
Issue
- Login of the user who is assigned to this issue. Null if the issue is not assigned.
- Specified by:
assignee
in interface Issue
setAssignee
public DefaultIssue setAssignee(@Nullable
String s)
creationDate
public Date creationDate()
- Specified by:
creationDate
in interface Issue
setCreationDate
public DefaultIssue setCreationDate(Date d)
updateDate
@CheckForNull
public Date updateDate()
- Specified by:
updateDate
in interface Issue
setUpdateDate
public DefaultIssue setUpdateDate(@Nullable
Date d)
closeDate
@CheckForNull
public Date closeDate()
- Description copied from interface:
Issue
- Date when status was set to
Issue.STATUS_CLOSED
, else null.
- Specified by:
closeDate
in interface Issue
setCloseDate
public DefaultIssue setCloseDate(@Nullable
Date d)
checksum
@CheckForNull
public String checksum()
setChecksum
public DefaultIssue setChecksum(@Nullable
String s)
isNew
public boolean isNew()
- Description copied from interface:
Issue
- During a scan return if the current issue is a new one.
- Specified by:
isNew
in interface Issue
- Returns:
- always false on server side
setNew
public DefaultIssue setNew(boolean b)
isEndOfLife
public boolean isEndOfLife()
- True when one of the following conditions is true :
- the related component has been deleted or renamed
- the rule has been deleted (eg. on plugin uninstall)
- the rule has been disabled in the Quality profile
setEndOfLife
public DefaultIssue setEndOfLife(boolean b)
isOnDisabledRule
public boolean isOnDisabledRule()
setOnDisabledRule
public DefaultIssue setOnDisabledRule(boolean b)
isChanged
public boolean isChanged()
setChanged
public DefaultIssue setChanged(boolean b)
mustSendNotifications
public boolean mustSendNotifications()
setSendNotifications
public DefaultIssue setSendNotifications(boolean b)
attribute
@CheckForNull
public String attribute(String key)
- Specified by:
attribute
in interface Issue
setAttribute
public DefaultIssue setAttribute(String key,
@Nullable
String value)
attributes
public Map<String,String> attributes()
- Specified by:
attributes
in interface Issue
setAttributes
public DefaultIssue setAttributes(@Nullable
Map<String,String> map)
authorLogin
@CheckForNull
public String authorLogin()
- Description copied from interface:
Issue
- Login of the SCM account that introduced this issue. Requires the
Developer Cockpit Plugin to be installed.
- Specified by:
authorLogin
in interface Issue
setAuthorLogin
public DefaultIssue setAuthorLogin(@Nullable
String s)
actionPlanKey
@CheckForNull
public String actionPlanKey()
- Specified by:
actionPlanKey
in interface Issue
setActionPlanKey
public DefaultIssue setActionPlanKey(@Nullable
String actionPlanKey)
setFieldChange
public DefaultIssue setFieldChange(IssueChangeContext context,
String field,
@Nullable
Serializable oldValue,
@Nullable
Serializable newValue)
currentChange
@CheckForNull
public FieldDiffs currentChange()
addChange
public DefaultIssue addChange(FieldDiffs change)
setChanges
public DefaultIssue setChanges(List<FieldDiffs> changes)
changes
public List<FieldDiffs> changes()
addComment
public DefaultIssue addComment(DefaultIssueComment comment)
comments
public List<IssueComment> comments()
- Description copied from interface:
Issue
- Non-null list of comments, ordered by chronological order.
IMPORTANT: existing comments are not loaded when this method is called when analyzing project
(from
BatchExtension
).
- Specified by:
comments
in interface Issue
selectedAt
@CheckForNull
public Date selectedAt()
setSelectedAt
public DefaultIssue setSelectedAt(@Nullable
Date d)
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2009–2015 SonarSource. All rights reserved.