Search in sources :

Example 1 with NewIssuesStatistics

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);
}
Also used : NewIssuesNotification(org.sonar.server.issue.notification.NewIssuesNotification) MyNewIssuesNotification(org.sonar.server.issue.notification.MyNewIssuesNotification) NewIssuesStatistics(org.sonar.server.issue.notification.NewIssuesStatistics) Date(java.util.Date)

Example 2 with NewIssuesStatistics

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);
    }
}
Also used : NewIssuesStatistics(org.sonar.server.issue.notification.NewIssuesStatistics) DefaultIssue(org.sonar.core.issue.DefaultIssue)

Example 3 with NewIssuesStatistics

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);
    }
}
Also used : NewIssuesStatistics(org.sonar.server.issue.notification.NewIssuesStatistics) MyNewIssuesNotification(org.sonar.server.issue.notification.MyNewIssuesNotification) Map(java.util.Map) Date(java.util.Date)

Aggregations

NewIssuesStatistics (org.sonar.server.issue.notification.NewIssuesStatistics)3 Date (java.util.Date)2 MyNewIssuesNotification (org.sonar.server.issue.notification.MyNewIssuesNotification)2 Map (java.util.Map)1 DefaultIssue (org.sonar.core.issue.DefaultIssue)1 NewIssuesNotification (org.sonar.server.issue.notification.NewIssuesNotification)1