Fix findbugs violations in aaa-authn-api
[aaa.git] / aaa-authn-api / src / main / java / org / opendaylight / aaa / api / model / Grant.java
1 /*
2  * Copyright (c) 2014, 2017 Hewlett-Packard Development Company, L.P. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.aaa.api.model;
10
11 import java.util.Objects;
12
13 /**
14  *
15  * @author peter.mellquist@hp.com
16  *
17  */
18
19 import javax.xml.bind.annotation.XmlRootElement;
20
21 @XmlRootElement(name = "grant")
22 public class Grant {
23     private String grantid;
24     private String domainid;
25     private String userid;
26     private String roleid;
27
28     public String getGrantid() {
29         return this.grantid;
30     }
31
32     public void setGrantid(String id) {
33         this.grantid = id;
34     }
35
36     public String getDomainid() {
37         return domainid;
38     }
39
40     public void setDomainid(String id) {
41         this.domainid = id;
42     }
43
44     public String getUserid() {
45         return userid;
46     }
47
48     public void setUserid(String id) {
49         this.userid = id;
50     }
51
52     public String getRoleid() {
53         return roleid;
54     }
55
56     public void setRoleid(String id) {
57         this.roleid = id;
58     }
59
60     @Override
61     public int hashCode() {
62         return this.getUserid().hashCode();
63     }
64
65     @Override
66     public boolean equals(Object obj) {
67         if (this == obj) {
68             return true;
69         }
70
71         if (obj == null || getClass() != obj.getClass()) {
72             return false;
73         }
74
75         Grant other = (Grant) obj;
76         if (Objects.equals(getDomainid(), other.getDomainid()) && Objects.equals(getRoleid(), other.getRoleid())
77                 && Objects.equals(getUserid(), other.getUserid())) {
78             return true;
79         }
80         return false;
81     }
82 }