View Javadoc

1   /**
2    *       Copyright 2010 Newcastle University
3    *
4    *          http://research.ncl.ac.uk/smart/
5    *
6    * Licensed to the Apache Software Foundation (ASF) under one or more
7    * contributor license agreements.  See the NOTICE file distributed with
8    * this work for additional information regarding copyright ownership.
9    * The ASF licenses this file to You under the Apache License, Version 2.0
10   * (the "License"); you may not use this file except in compliance with
11   * the License.  You may obtain a copy of the License at
12   *
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   */
21  package org.apache.amber.oauth2.common.domain.client;
22  
23  /**
24   *
25   *
26   *
27   */
28  public class BasicClientInfo implements ClientInfo {
29  
30      protected String name;
31      protected String clientId;
32      protected String clientSecret;
33      protected String redirectUri;
34      protected String clientUri;
35      protected String description;
36      protected String iconUri;
37      protected Long issuedAt;
38      protected Long expiresIn;
39  
40      public BasicClientInfo() {
41      }
42  
43      @Override
44      public String getClientId() {
45          return clientId;
46      }
47  
48      @Override
49      public String getClientSecret() {
50          return clientSecret;
51      }
52  
53      @Override
54      public String getRedirectUri() {
55          return redirectUri;
56      }
57  
58      @Override
59      public String getName() {
60          return name;
61      }
62  
63      @Override
64      public String getIconUri() {
65          return iconUri;
66      }
67  
68      @Override
69      public String getClientUri() {
70          return clientUri;
71      }
72  
73      @Override
74      public String getDescription() {
75          return description;
76      }
77  
78      public void setClientUri(String clientUri) {
79          this.clientUri = clientUri;
80      }
81  
82      public Long getIssuedAt() {
83          return issuedAt;
84      }
85  
86      public void setIssuedAt(Long issuedAt) {
87          this.issuedAt = issuedAt;
88      }
89  
90      public Long getExpiresIn() {
91          return expiresIn;
92      }
93  
94      public void setExpiresIn(Long expiresIn) {
95          this.expiresIn = expiresIn;
96      }
97  
98      public void setName(String name) {
99          this.name = name;
100     }
101 
102     public void setClientId(String clientId) {
103         this.clientId = clientId;
104     }
105 
106     public void setClientSecret(String clientSecret) {
107         this.clientSecret = clientSecret;
108     }
109 
110     public void setRedirectUri(String redirectUri) {
111         this.redirectUri = redirectUri;
112     }
113 
114     public void setIconUri(String iconUri) {
115         this.iconUri = iconUri;
116     }
117 
118     public void setDescription(String description) {
119         this.description = description;
120     }
121 
122     @Override
123     public boolean equals(Object o) {
124         if (this == o) {
125             return true;
126         }
127         if (o == null || getClass() != o.getClass()) {
128             return false;
129         }
130 
131         BasicClientInfo that = (BasicClientInfo)o;
132 
133         if (clientId != null ? !clientId.equals(that.clientId) : that.clientId != null) {
134             return false;
135         }
136         if (clientSecret != null ? !clientSecret.equals(that.clientSecret) : that.clientSecret != null) {
137             return false;
138         }
139         if (clientUri != null ? !clientUri.equals(that.clientUri) : that.clientUri != null) {
140             return false;
141         }
142         if (description != null ? !description.equals(that.description) : that.description != null) {
143             return false;
144         }
145         if (expiresIn != null ? !expiresIn.equals(that.expiresIn) : that.expiresIn != null) {
146             return false;
147         }
148         if (iconUri != null ? !iconUri.equals(that.iconUri) : that.iconUri != null) {
149             return false;
150         }
151         if (issuedAt != null ? !issuedAt.equals(that.issuedAt) : that.issuedAt != null) {
152             return false;
153         }
154         if (name != null ? !name.equals(that.name) : that.name != null) {
155             return false;
156         }
157         if (redirectUri != null ? !redirectUri.equals(that.redirectUri) : that.redirectUri != null) {
158             return false;
159         }
160 
161         return true;
162     }
163 
164     @Override
165     public int hashCode() {
166         int result = name != null ? name.hashCode() : 0;
167         result = 31 * result + (clientId != null ? clientId.hashCode() : 0);
168         result = 31 * result + (clientSecret != null ? clientSecret.hashCode() : 0);
169         result = 31 * result + (redirectUri != null ? redirectUri.hashCode() : 0);
170         result = 31 * result + (clientUri != null ? clientUri.hashCode() : 0);
171         result = 31 * result + (description != null ? description.hashCode() : 0);
172         result = 31 * result + (iconUri != null ? iconUri.hashCode() : 0);
173         result = 31 * result + (issuedAt != null ? issuedAt.hashCode() : 0);
174         result = 31 * result + (expiresIn != null ? expiresIn.hashCode() : 0);
175         return result;
176     }
177 }