Search in sources :

Example 1 with Locations

use of org.sonar.db.protobuf.DbIssues.Locations in project sonarqube by SonarSource.

the class ShowAction method formatFlows.

private void formatFlows(DbSession dbSession, ShowWsResponse.Builder hotspotBuilder, IssueDto hotspot) {
    DbIssues.Locations locations = hotspot.parseLocations();
    if (locations == null) {
        return;
    }
    Set<String> componentUuids = readComponentUuidsFromLocations(hotspot, locations);
    Map<String, ComponentDto> componentsByUuids = loadComponents(dbSession, componentUuids);
    for (DbIssues.Flow flow : locations.getFlowList()) {
        Common.Flow.Builder targetFlow = Common.Flow.newBuilder();
        for (DbIssues.Location flowLocation : flow.getLocationList()) {
            targetFlow.addLocations(textRangeFormatter.formatLocation(flowLocation, hotspotBuilder.getComponent().getKey(), componentsByUuids));
        }
        hotspotBuilder.addFlows(targetFlow.build());
    }
}
Also used : Locations(org.sonar.db.protobuf.DbIssues.Locations) DbIssues(org.sonar.db.protobuf.DbIssues) ComponentDto(org.sonar.db.component.ComponentDto)

Aggregations

ComponentDto (org.sonar.db.component.ComponentDto)1 DbIssues (org.sonar.db.protobuf.DbIssues)1 Locations (org.sonar.db.protobuf.DbIssues.Locations)1