Search in sources :

Example 1 with FixSuggestion

use of com.google.gerrit.entities.FixSuggestion in project gerrit by GerritCodeReview.

the class Fixes method parse.

@Override
public FixResource parse(RevisionResource revisionResource, IdString id) throws ResourceNotFoundException {
    String fixId = id.get();
    ChangeNotes changeNotes = revisionResource.getNotes();
    List<RobotComment> robotComments = commentsUtil.robotCommentsByPatchSet(changeNotes, revisionResource.getPatchSet().id());
    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 : FixResource(com.google.gerrit.server.change.FixResource) FixSuggestion(com.google.gerrit.entities.FixSuggestion) RobotComment(com.google.gerrit.entities.RobotComment) IdString(com.google.gerrit.extensions.restapi.IdString) ChangeNotes(com.google.gerrit.server.notedb.ChangeNotes) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException)

Aggregations

FixSuggestion (com.google.gerrit.entities.FixSuggestion)1 RobotComment (com.google.gerrit.entities.RobotComment)1 IdString (com.google.gerrit.extensions.restapi.IdString)1 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 FixResource (com.google.gerrit.server.change.FixResource)1 ChangeNotes (com.google.gerrit.server.notedb.ChangeNotes)1