public class LabelNormalizer
extends java.lang.Object
Votes are recorded in the database for a user based on the state of the project at that time: what labels are defined for the project, and what the user is allowed to vote on. Both of those can change between the time a vote is originally made and a later point, for example when a change is submitted. This class normalizes old votes against current project configuration.
Modifier and Type | Class and Description |
---|---|
static class |
LabelNormalizer.Result |
Modifier and Type | Method and Description |
---|---|
boolean |
canVote(ChangeControl ctl,
com.google.gerrit.common.data.LabelType lt,
com.google.gerrit.reviewdb.client.Account.Id id) |
LabelNormalizer.Result |
normalize(com.google.gerrit.reviewdb.client.Change change,
java.util.Collection<com.google.gerrit.reviewdb.client.PatchSetApproval> approvals) |
LabelNormalizer.Result |
normalize(ChangeControl ctl,
java.util.Collection<com.google.gerrit.reviewdb.client.PatchSetApproval> approvals) |
public LabelNormalizer.Result normalize(com.google.gerrit.reviewdb.client.Change change, java.util.Collection<com.google.gerrit.reviewdb.client.PatchSetApproval> approvals) throws NoSuchChangeException, com.google.gwtorm.server.OrmException
change
- change containing the given approvals.approvals
- list of approvals.NoSuchChangeException
com.google.gwtorm.server.OrmException
public LabelNormalizer.Result normalize(ChangeControl ctl, java.util.Collection<com.google.gerrit.reviewdb.client.PatchSetApproval> approvals)
ctl
- change control containing the given approvals.approvals
- list of approvals.public boolean canVote(ChangeControl ctl, com.google.gerrit.common.data.LabelType lt, com.google.gerrit.reviewdb.client.Account.Id id)
ctl
- change control (for any user).lt
- label type.id
- account ID.