Search in sources :

Example 6 with LabelVote

use of com.google.gerrit.server.util.LabelVote in project gerrit by GerritCodeReview.

the class CommentSender method getLabelVoteSoyData.

private List<Map<String, Object>> getLabelVoteSoyData(List<LabelVote> votes) {
    List<Map<String, Object>> result = new ArrayList<>();
    for (LabelVote vote : votes) {
        Map<String, Object> data = new HashMap<>();
        data.put("label", vote.label());
        // Soy needs the short to be cast as an int for it to get converted to the
        // correct tamplate type.
        data.put("value", (int) vote.value());
        result.add(data);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) LabelVote(com.google.gerrit.server.util.LabelVote) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

LabelVote (com.google.gerrit.server.util.LabelVote)6 ConfigInvalidException (org.eclipse.jgit.errors.ConfigInvalidException)3 Account (com.google.gerrit.entities.Account)2 PatchSetApproval (com.google.gerrit.entities.PatchSetApproval)2 ParsedPatchSetApproval (com.google.gerrit.server.notedb.ChangeNoteUtil.ParsedPatchSetApproval)2 PersonIdent (org.eclipse.jgit.lib.PersonIdent)2 OrPredicate (com.google.gerrit.index.query.OrPredicate)1 Predicate (com.google.gerrit.index.query.Predicate)1 Range (com.google.gerrit.index.query.RangeUtil.Range)1 Account (com.google.gerrit.reviewdb.client.Account)1 LabelId (com.google.gerrit.reviewdb.client.LabelId)1 PatchSetApproval (com.google.gerrit.reviewdb.client.PatchSetApproval)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Option (org.kohsuke.args4j.Option)1