Line data Source code
1 : // Copyright (C) 2016 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.api.changes; 16 : 17 : import com.google.gerrit.common.Nullable; 18 : import com.google.gerrit.extensions.common.AccountInfo; 19 : import java.util.List; 20 : 21 : /** Result object representing the outcome of a request to add/remove a reviewer. */ 22 : public class ReviewerResult { 23 : /** The identifier of an account or group that was to be added/removed as a reviewer. */ 24 : public String input; 25 : 26 : /** If non-null, a string describing why the reviewer could not be added/removed. */ 27 : @Nullable public String error; 28 : 29 : /** 30 : * Non-null and true if the reviewer cannot be added without explicit confirmation. This may be 31 : * the case for groups of a certain size. For removals, it's always false. 32 : */ 33 : @Nullable public Boolean confirm; 34 : 35 : /** 36 : * List of individual reviewers added to the change. The size of this list may be greater than one 37 : * (e.g. when a group is added). Null if no reviewers were added. 38 : */ 39 : @Nullable public List<ReviewerInfo> reviewers; 40 : 41 : /** 42 : * List of new accounts CCed on the change. The size of this list may be greater than one (e.g. 43 : * when a group is CCed). Null if no accounts were CCed. 44 : */ 45 : @Nullable public List<AccountInfo> ccs; 46 : 47 : /** An account removed from the change. Null if no accounts were removed. */ 48 : @Nullable public AccountInfo removed; 49 : 50 : /** 51 : * Constructs a partially initialized result for the given reviewer. 52 : * 53 : * @param input String identifier of an account or group, from user request 54 : */ 55 46 : public ReviewerResult(String input) { 56 46 : this.input = input; 57 46 : } 58 : 59 : /** 60 : * Constructs an error result for the given account. 61 : * 62 : * @param reviewer String identifier of an account or group 63 : * @param error Error message 64 : */ 65 : public ReviewerResult(String reviewer, String error) { 66 0 : this(reviewer); 67 0 : this.error = error; 68 0 : } 69 : 70 : /** 71 : * Constructs a needs-confirmation result for the given account. 72 : * 73 : * @param confirm Whether confirmation is needed. 74 : */ 75 : public ReviewerResult(String reviewer, boolean confirm) { 76 0 : this(reviewer); 77 0 : this.confirm = confirm; 78 0 : } 79 : }