use of org.sonar.db.webhook.WebhookDao in project sonarqube by SonarSource.
the class WebHooksImpl method readWebHooksFrom.
private Stream<WebhookDto> readWebHooksFrom(String projectUuid, @CheckForNull PostProjectAnalysisTask.LogStatistics taskLogStatistics) {
try (DbSession dbSession = dbClient.openSession(false)) {
Optional<ProjectDto> optionalProjectDto = dbClient.projectDao().selectByUuid(dbSession, projectUuid);
ProjectDto projectDto = checkStateWithOptional(optionalProjectDto, "the requested project '%s' was not found", projectUuid);
WebhookDao dao = dbClient.webhookDao();
List<WebhookDto> projectWebhooks = dao.selectByProject(dbSession, projectDto);
List<WebhookDto> globalWebhooks = dao.selectGlobalWebhooks(dbSession);
if (taskLogStatistics != null) {
taskLogStatistics.add("globalWebhooks", globalWebhooks.size());
taskLogStatistics.add("projectWebhooks", projectWebhooks.size());
}
return Stream.concat(projectWebhooks.stream(), globalWebhooks.stream());
}
}
Aggregations