use of com.google.gerrit.server.query.change.ChangeData.StorageConstraint in project gerrit by GerritCodeReview.
the class EqualsLabelPredicate method match.
@Override
public boolean match(ChangeData object) {
Change c = object.change();
if (c == null) {
//
return false;
}
if (Integer.valueOf(0).equals(count)) {
// is computationally expensive.
return false;
}
Optional<ProjectState> project = projectCache.get(c.getDest().project());
if (!project.isPresent()) {
//
return false;
}
LabelType labelType = type(project.get().getLabelTypes(), label);
if (labelType == null) {
// Label is not defined by this project.
return false;
}
boolean hasVote = false;
int matchingVotes = 0;
StorageConstraint currentStorageConstraint = object.getStorageConstraint();
object.setStorageConstraint(ChangeData.StorageConstraint.INDEX_PRIMARY_NOTEDB_SECONDARY);
for (PatchSetApproval p : object.currentApprovals()) {
if (labelType.matches(p)) {
hasVote = true;
if (match(object, p.value(), p.accountId())) {
matchingVotes += 1;
}
}
}
object.setStorageConstraint(currentStorageConstraint);
if (!hasVote && expVal == 0) {
return true;
}
return count == null ? matchingVotes >= 1 : matchingVotes == count;
}
Aggregations