use of org.sonar.server.issue.notification.NewIssuesStatistics in project sonarqube by SonarSource.
the class SendIssueNotificationsStep method sendNewIssuesNotification.
private void sendNewIssuesNotification(NewIssuesStatistics statistics, Component project, long analysisDate) {
NewIssuesStatistics.Stats globalStatistics = statistics.globalStatistics();
NewIssuesNotification notification = newIssuesNotificationFactory.newNewIssuesNotication().setProject(project.getKey(), project.getUuid(), project.getName()).setAnalysisDate(new Date(analysisDate)).setStatistics(project.getName(), globalStatistics).setDebt(globalStatistics.debt());
service.deliver(notification);
}
use of org.sonar.server.issue.notification.NewIssuesStatistics 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.server.issue.notification.NewIssuesStatistics in project sonarqube by SonarSource.
the class SendIssueNotificationsStep method sendNewIssuesNotificationToAssignees.
private void sendNewIssuesNotificationToAssignees(NewIssuesStatistics statistics, Component project, long analysisDate) {
// send email to each user having issues
for (Map.Entry<String, NewIssuesStatistics.Stats> assigneeAndStatisticsTuple : statistics.assigneesStatistics().entrySet()) {
String assignee = assigneeAndStatisticsTuple.getKey();
NewIssuesStatistics.Stats assigneeStatistics = assigneeAndStatisticsTuple.getValue();
MyNewIssuesNotification myNewIssuesNotification = newIssuesNotificationFactory.newMyNewIssuesNotification().setAssignee(assignee);
myNewIssuesNotification.setProject(project.getKey(), project.getUuid(), project.getName()).setAnalysisDate(new Date(analysisDate)).setStatistics(project.getName(), assigneeStatistics).setDebt(assigneeStatistics.debt());
service.deliver(myNewIssuesNotification);
}
}
Aggregations