public static IntStream allLinesFor(DefaultIssue issue, String componentId) {
    DbIssues.Locations locations = issue.getLocations();
    if (locations == null) {
      return IntStream.empty();
    }

    Stream<DbCommons.TextRange> textRanges = Stream.concat(
      locations.hasTextRange() ? Stream.of(locations.getTextRange()) : Stream.empty(),
      locations.getFlowList().stream()
        .flatMap(f -> f.getLocationList().stream())
        .filter(l -> Objects.equals(componentIdOf(issue, l), componentId))
        .map(DbIssues.Location::getTextRange));
    return textRanges.flatMapToInt(range -> IntStream.rangeClosed(range.getStartLine(), range.getEndLine()));
  }
public static IntStream allLinesFor ( DefaultIssue issue , String componentId ) { DbIssues . Locations locations = issue . getLocations ( ) ; if ( locations == null ) { return IntStream . empty ( ) ; } Stream < DbCommons . TextRange > textRanges = Stream . concat ( locations . hasTextRange ( ) ? Stream . of ( locations . getTextRange ( ) ) : Stream . empty ( ) , locations . getFlowList ( ) . stream ( ) . flatMap ( f -> f . getLocationList ( ) . stream ( ) ) . filter ( l -> Objects . equals ( componentIdOf ( issue , l ) , componentId ) ) . map ( DbIssues . Location :: getTextRange ) ) ; return textRanges . flatMapToInt ( range -> IntStream . rangeClosed ( range . getStartLine ( ) , range . getEndLine ( ) ) ) ; }
Extract the lines of all the locations in the specified component. All the flows and secondary locations
are taken into account. The lines present in multiple flows and locations are kept
duplicated. Ordering of results is not guaranteed.
<p>
TODO should be a method of DefaultIssue, as soon as it's no
longer in sonar-core and can access sonar-db-dao.