Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Copyright (C) 2011 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.entities;
import static com.google.common.collect.ImmutableList.toImmutableList;
import com.google.common.collect.ImmutableList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
/** Describes the state and edits required to submit a change. */
public class SubmitRecord {
public static boolean allRecordsOK(Collection in) {
if (in == null || in.isEmpty()) {
// If the list is null or empty, it means that this Gerrit installation does not
// have any form of validation rules.
// Hence, the permission system should be used to determine if the change can be merged
// or not.
return true;
}
// The change can be submitted, unless at least one plugin prevents it.
return in.stream().map(SubmitRecord::status).allMatch(SubmitRecord.Status::allowsSubmission);
}
public enum Status {
// NOTE: These values are persisted in the index, so deleting or changing
// the name of any values requires a schema upgrade.
/** The change is ready for submission. */
OK,
/** Something is preventing this change from being submitted. */
NOT_READY,
/** The change has been closed. */
CLOSED,
/** The change was submitted bypassing submit rules. */
FORCED,
/**
* A rule error caused by user misconfiguration.
*
*
This status should only be used to signal that the user has misconfigured the submit rule.
* In case plugins encounter server exceptions while evaluating the rule, they should throw a
* {@link RuntimeException} such as {@link IllegalStateException}.
*
*
Additional detail may be available in {@link SubmitRecord#errorMessage}.
*/
RULE_ERROR;
private boolean allowsSubmission() {
return this == OK || this == FORCED;
}
}
// Name of the rule that created this submit record, formatted as '$pluginName~$ruleName'
public String ruleName;
public SubmitRecord.Status status;
public List