use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class BaseIssuesLoader method loadForComponentUuid.
public List<DefaultIssue> loadForComponentUuid(String componentUuid) {
try (DbSession dbSession = dbClient.openSession(false)) {
List<DefaultIssue> result = new ArrayList<>();
dbSession.getMapper(IssueMapper.class).selectNonClosedByComponentUuid(componentUuid, resultContext -> {
DefaultIssue issue = ((IssueDto) resultContext.getResultObject()).toDefaultIssue();
if (!isActive(issue.ruleKey()) || ruleRepository.getByKey(issue.ruleKey()).getStatus() == RuleStatus.REMOVED) {
issue.setOnDisabledRule(true);
issue.setBeingClosed(true);
}
issue.setSelectedAt(System.currentTimeMillis());
result.add(issue);
});
return result;
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class IntegrateIssuesVisitor method fillNewOpenIssues.
private void fillNewOpenIssues(Component component, Tracking<DefaultIssue, DefaultIssue> tracking, DiskCache<DefaultIssue>.DiskAppender<DefaultIssue> cacheAppender) {
for (DefaultIssue issue : tracking.getUnmatchedRaws()) {
issueLifecycle.initNewOpenIssue(issue);
process(component, issue, cacheAppender);
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class PersistIssuesStep method execute.
@Override
public void execute() {
try (DbSession dbSession = dbClient.openSession(true);
CloseableIterator<DefaultIssue> issues = issueCache.traverse()) {
IssueMapper mapper = dbSession.getMapper(IssueMapper.class);
IssueChangeMapper changeMapper = dbSession.getMapper(IssueChangeMapper.class);
while (issues.hasNext()) {
DefaultIssue issue = issues.next();
boolean saved = persistIssueIfRequired(mapper, issue);
if (saved) {
insertChanges(changeMapper, issue);
}
}
dbSession.flushStatements();
dbSession.commit();
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class SendIssueNotificationsStep method doExecute.
private void doExecute(Component project) {
NewIssuesStatistics newIssuesStats = new NewIssuesStatistics();
CloseableIterator<DefaultIssue> issues = issueCache.traverse();
try {
processIssues(newIssuesStats, issues, project);
} finally {
issues.close();
}
if (newIssuesStats.hasIssues()) {
long analysisDate = analysisMetadataHolder.getAnalysisDate();
sendNewIssuesNotification(newIssuesStats, project, analysisDate);
sendNewIssuesNotificationToAssignees(newIssuesStats, project, analysisDate);
}
}
use of org.sonar.core.issue.DefaultIssue in project sonarqube by SonarSource.
the class AddCommentAction method handle.
@Override
public void handle(Request request, Response response) {
userSession.checkLoggedIn();
AddCommentRequest wsRequest = toWsRequest(request);
try (DbSession dbSession = dbClient.openSession(false)) {
IssueDto issueDto = issueFinder.getByKey(dbSession, wsRequest.getIssue());
IssueChangeContext context = IssueChangeContext.createUser(new Date(system2.now()), userSession.getLogin());
DefaultIssue defaultIssue = issueDto.toDefaultIssue();
issueFieldsSetter.addComment(defaultIssue, wsRequest.getText(), context);
issueUpdater.saveIssue(dbSession, defaultIssue, context, wsRequest.getText());
responseWriter.write(defaultIssue.key(), request, response);
}
}
Aggregations