Line data Source code
1 : // Copyright (C) 2021 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.common; 16 : 17 : import java.util.List; 18 : import java.util.Objects; 19 : 20 : /** API response containing a {@link com.google.gerrit.entities.SubmitRecord} entity. */ 21 104 : public class SubmitRecordInfo { 22 103 : public enum Status { 23 103 : OK, 24 103 : NOT_READY, 25 103 : CLOSED, 26 103 : FORCED, 27 103 : RULE_ERROR 28 : } 29 : 30 104 : public static class Label { 31 103 : public enum Status { 32 103 : OK, 33 103 : REJECT, 34 103 : NEED, 35 103 : MAY, 36 103 : IMPOSSIBLE 37 : } 38 : 39 : public String label; 40 : public Label.Status status; 41 : public AccountInfo appliedBy; 42 : 43 : @Override 44 : public boolean equals(Object o) { 45 1 : if (this == o) { 46 0 : return true; 47 : } 48 1 : if (!(o instanceof Label)) { 49 0 : return false; 50 : } 51 1 : Label that = (Label) o; 52 1 : return Objects.equals(label, that.label) 53 : && status == that.status 54 1 : && Objects.equals(appliedBy, that.appliedBy); 55 : } 56 : 57 : @Override 58 : public int hashCode() { 59 0 : return Objects.hash(label, status, appliedBy); 60 : } 61 : } 62 : 63 : public String ruleName; 64 : public Status status; 65 : public List<Label> labels; 66 : public List<LegacySubmitRequirementInfo> requirements; 67 : public String errorMessage; 68 : 69 : @Override 70 : public boolean equals(Object o) { 71 1 : if (this == o) { 72 0 : return true; 73 : } 74 1 : if (!(o instanceof SubmitRecordInfo)) { 75 0 : return false; 76 : } 77 1 : SubmitRecordInfo that = (SubmitRecordInfo) o; 78 1 : return Objects.equals(ruleName, that.ruleName) 79 : && status == that.status 80 1 : && Objects.equals(labels, that.labels) 81 1 : && Objects.equals(requirements, that.requirements) 82 1 : && Objects.equals(errorMessage, that.errorMessage); 83 : } 84 : 85 : @Override 86 : public int hashCode() { 87 0 : return Objects.hash(ruleName, status, labels, requirements, errorMessage); 88 : } 89 : }