Search in sources :

Example 1 with Component

use of org.sonarqube.ws.WsMeasures.Component in project sonarqube by SonarSource.

the class ComponentDtoToWsComponent method componentDtoToWsComponent.

static Component.Builder componentDtoToWsComponent(ComponentDto component, Map<MetricDto, MeasureDto> measuresByMetric, Map<String, ComponentDto> referenceComponentsByUuid) {
    Component.Builder wsComponent = componentDtoToWsComponent(component);
    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
    if (referenceComponent != null) {
        wsComponent.setRefId(referenceComponent.uuid());
        wsComponent.setRefKey(referenceComponent.key());
    }
    for (Map.Entry<MetricDto, MeasureDto> entry : measuresByMetric.entrySet()) {
        wsComponent.addMeasures(measureDtoToWsMeasure(entry.getKey(), entry.getValue()));
    }
    return wsComponent;
}
Also used : MeasureDto(org.sonar.db.measure.MeasureDto) MetricDto(org.sonar.db.metric.MetricDto) ComponentDto(org.sonar.db.component.ComponentDto) Component(org.sonarqube.ws.WsMeasures.Component) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 ComponentDto (org.sonar.db.component.ComponentDto)1 MeasureDto (org.sonar.db.measure.MeasureDto)1 MetricDto (org.sonar.db.metric.MetricDto)1 Component (org.sonarqube.ws.WsMeasures.Component)1