com.google.gerrit.server.submitrequirement.predicate.SubmitRequirementLabelExtensionPredicate Maven / Gradle / Ivy
The newest version!
// Copyright (C) 2024 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.submitrequirement.predicate;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import com.google.common.base.Enums;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.FluentLogger;
import com.google.common.primitives.Ints;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.gerrit.entities.Account;
import com.google.gerrit.entities.SubmitRecord;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.server.account.ServiceUserClassifier;
import com.google.gerrit.server.notedb.ReviewerStateInternal;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gerrit.server.query.change.ChangeQueryBuilder.Arguments;
import com.google.gerrit.server.query.change.LabelPredicate;
import com.google.gerrit.server.query.change.SubmitRequirementPredicate;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import java.util.Locale;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Extensions of the {@link LabelPredicate} that are only available for submit requirement
* expressions, but not for search.
*
* Supported extensions:
*
*
* - "users=human_reviewers" arg, e.g. "label:Code-Review=MAX,users=human_reviewers" matches
* changes where all human reviewers have approved the change with Code-Review=MAX
*
*/
public class SubmitRequirementLabelExtensionPredicate extends SubmitRequirementPredicate {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
public interface Factory {
SubmitRequirementLabelExtensionPredicate create(String value) throws QueryParseException;
}
private static final Pattern PATTERN = Pattern.compile("(?
© 2015 - 2024 Weber Informatics LLC | Privacy Policy