Line data Source code
1 : // Copyright (C) 2015 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 2 : public class GpgKeyInfo { 21 : /** 22 : * Status of checking an object like a key or signature. 23 : * 24 : * <p>Order of values in this enum is significant: OK is "better" than BAD, etc. 25 : */ 26 9 : public enum Status { 27 : /** Something is wrong with this key. */ 28 9 : BAD, 29 : 30 : /** 31 : * Inspecting only this key found no problems, but the system does not fully trust the key's 32 : * origin. 33 : */ 34 9 : OK, 35 : 36 : /** This key is valid, and the system knows enough about the key and its origin to trust it. */ 37 9 : TRUSTED; 38 : } 39 : 40 : public String id; 41 : public String fingerprint; 42 : public List<String> userIds; 43 : public String key; 44 : 45 : public Status status; 46 : public List<String> problems; 47 : 48 : @Override 49 : public boolean equals(Object o) { 50 0 : if (o instanceof GpgKeyInfo) { 51 0 : GpgKeyInfo gpgKeyInfo = (GpgKeyInfo) o; 52 0 : return Objects.equals(id, gpgKeyInfo.id) 53 0 : && Objects.equals(fingerprint, gpgKeyInfo.fingerprint) 54 0 : && Objects.equals(userIds, gpgKeyInfo.userIds) 55 0 : && Objects.equals(status, gpgKeyInfo.status) 56 0 : && Objects.equals(problems, gpgKeyInfo.problems); 57 : } 58 0 : return false; 59 : } 60 : 61 : @Override 62 : public int hashCode() { 63 0 : return Objects.hash(id, fingerprint, userIds, status, problems); 64 : } 65 : }