Search in sources :

Example 6 with MeasureQuery

use of org.sonar.db.measure.MeasureQuery in project sonarqube by SonarSource.

the class ComponentAction method searchMeasures.

private List<MeasureDto> searchMeasures(DbSession dbSession, ComponentDto component, @Nullable SnapshotDto analysis, List<MetricDto> metrics, @Nullable Long developerId) {
    if (analysis == null) {
        return emptyList();
    }
    List<Integer> metricIds = Lists.transform(metrics, MetricDto::getId);
    MeasureQuery query = MeasureQuery.builder().setPersonId(developerId).setMetricIds(metricIds).setComponentUuid(component.uuid()).build();
    List<MeasureDto> measures = dbClient.measureDao().selectByQuery(dbSession, query);
    addBestValuesToMeasures(measures, component, metrics);
    return measures;
}
Also used : MeasureDto(org.sonar.db.measure.MeasureDto) MetricDto(org.sonar.db.metric.MetricDto) MeasureQuery(org.sonar.db.measure.MeasureQuery)

Aggregations

MeasureDto (org.sonar.db.measure.MeasureDto)6 MeasureQuery (org.sonar.db.measure.MeasureQuery)6 MetricDto (org.sonar.db.metric.MetricDto)3 CheckForNull (javax.annotation.CheckForNull)1 DbSession (org.sonar.db.DbSession)1 ComponentDto (org.sonar.db.component.ComponentDto)1 ComponentLinkDto (org.sonar.db.component.ComponentLinkDto)1 SnapshotDto (org.sonar.db.component.SnapshotDto)1