Search in sources :

Example 1 with IssueComment

use of org.sonar.api.issue.IssueComment in project sonarqube by SonarSource.

the class PersistIssuesStep method insertChanges.

private static void insertChanges(IssueChangeMapper mapper, DefaultIssue issue) {
    for (IssueComment comment : issue.comments()) {
        DefaultIssueComment c = (DefaultIssueComment) comment;
        if (c.isNew()) {
            IssueChangeDto changeDto = IssueChangeDto.of(c);
            mapper.insert(changeDto);
        }
    }
    FieldDiffs diffs = issue.currentChange();
    if (!issue.isNew() && diffs != null) {
        IssueChangeDto changeDto = IssueChangeDto.of(issue.key(), diffs);
        mapper.insert(changeDto);
    }
}
Also used : IssueChangeDto(org.sonar.db.issue.IssueChangeDto) FieldDiffs(org.sonar.core.issue.FieldDiffs) DefaultIssueComment(org.sonar.core.issue.DefaultIssueComment) IssueComment(org.sonar.api.issue.IssueComment) DefaultIssueComment(org.sonar.core.issue.DefaultIssueComment)

Example 2 with IssueComment

use of org.sonar.api.issue.IssueComment in project sonarqube by SonarSource.

the class IssueStorage method insertChanges.

private void insertChanges(IssueChangeMapper mapper, DefaultIssue issue) {
    for (IssueComment comment : issue.comments()) {
        DefaultIssueComment c = (DefaultIssueComment) comment;
        if (c.isNew()) {
            IssueChangeDto changeDto = IssueChangeDto.of(c);
            mapper.insert(changeDto);
        }
    }
    FieldDiffs diffs = issue.currentChange();
    if (!issue.isNew() && diffs != null) {
        IssueChangeDto changeDto = IssueChangeDto.of(issue.key(), diffs);
        mapper.insert(changeDto);
    }
}
Also used : IssueChangeDto(org.sonar.db.issue.IssueChangeDto) FieldDiffs(org.sonar.core.issue.FieldDiffs) DefaultIssueComment(org.sonar.core.issue.DefaultIssueComment) IssueComment(org.sonar.api.issue.IssueComment) DefaultIssueComment(org.sonar.core.issue.DefaultIssueComment)

Aggregations

IssueComment (org.sonar.api.issue.IssueComment)2 DefaultIssueComment (org.sonar.core.issue.DefaultIssueComment)2 FieldDiffs (org.sonar.core.issue.FieldDiffs)2 IssueChangeDto (org.sonar.db.issue.IssueChangeDto)2