Search in sources :

Example 1 with FixSuggestion

use of com.google.gerrit.reviewdb.client.FixSuggestion in project gerrit by GerritCodeReview.

the class Fixes method parse.

@Override
public FixResource parse(RevisionResource revisionResource, IdString id) throws ResourceNotFoundException, OrmException {
    String fixId = id.get();
    ChangeNotes changeNotes = revisionResource.getNotes();
    List<RobotComment> robotComments = commentsUtil.robotCommentsByPatchSet(changeNotes, revisionResource.getPatchSet().getId());
    for (RobotComment robotComment : robotComments) {
        for (FixSuggestion fixSuggestion : robotComment.fixSuggestions) {
            if (Objects.equals(fixId, fixSuggestion.fixId)) {
                return new FixResource(revisionResource, fixSuggestion.replacements);
            }
        }
    }
    throw new ResourceNotFoundException(id);
}
Also used : FixSuggestion(com.google.gerrit.reviewdb.client.FixSuggestion) RobotComment(com.google.gerrit.reviewdb.client.RobotComment) IdString(com.google.gerrit.extensions.restapi.IdString) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException)

Aggregations

IdString (com.google.gerrit.extensions.restapi.IdString)1 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 FixSuggestion (com.google.gerrit.reviewdb.client.FixSuggestion)1 RobotComment (com.google.gerrit.reviewdb.client.RobotComment)1 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)1