View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied. See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.ws.security.saml.ext.bean;
21  
22  import org.joda.time.DateTime;
23  
24  /**
25   * Class SubjectConfirmationDataBean represents a SAML (2) SubjectConfirmationData. Please note that
26   * KeyInfo functionality is in SubjectBean for backwards compatibility reasons.
27   */
28  public class SubjectConfirmationDataBean {
29      private String recipient;
30      private String address;
31      private String inResponseTo;
32      private DateTime notBefore;
33      private DateTime notAfter;
34  
35      /**
36       * Constructor SubjectConfirmationDataBean creates a new SubjectConfirmationDataBean instance.
37       */
38      public SubjectConfirmationDataBean() {
39      }
40  
41      /**
42       * Get the recipient of the SubjectConfirmationDataBean
43       * @return the recipient of the SubjectConfirmationDataBean
44       */
45      public String getRecipient() {
46          return recipient;
47      }
48  
49      /**
50       * Set the recipient of the SubjectConfirmationDataBean
51       * @param recipient the recipient of the SubjectConfirmationDataBean
52       */
53      public void setRecipient(String recipient) {
54          this.recipient = recipient;
55      }
56  
57      /**
58       * Get the address of the SubjectConfirmationDataBean
59       * @return the address of the SubjectConfirmationDataBean
60       */
61      public String getAddress() {
62          return address;
63      }
64  
65      /**
66       * Set the address of the SubjectConfirmationDataBean
67       * @param address the address of the SubjectConfirmationDataBean
68       */
69      public void setAddress(String address) {
70          this.address = address;
71      }
72  
73      /**
74       * Get the InResponseTo element of the SubjectConfirmationDataBean
75       * @return the InResponseTo element of the SubjectConfirmationDataBean
76       */
77      public String getInResponseTo() {
78          return inResponseTo;
79      }
80  
81      /**
82       * Set the InResponseTo element of the SubjectConfirmationDataBean
83       * @param inResponseTo the InResponseTo element of the SubjectConfirmationDataBean
84       */
85      public void setInResponseTo(String inResponseTo) {
86          this.inResponseTo = inResponseTo;
87      }
88  
89      /**
90       * Get the NotBefore time of the SubjectConfirmationDataBean
91       * @return the NotBefore time of the SubjectConfirmationDataBean
92       */
93      public DateTime getNotBefore() {
94          return notBefore;
95      }
96  
97      /**
98       * Set the NotBefore time of the SubjectConfirmationDataBean
99       * @param notBefore the NotBefore time of the SubjectConfirmationDataBean
100      */
101     public void setNotBefore(DateTime notBefore) {
102         this.notBefore = notBefore;
103     }
104 
105     /**
106      * Get the NotOnOrAfter time of the SubjectConfirmationDataBean
107      * @return the NotOnOrAfter time of the SubjectConfirmationDataBean
108      */
109     public DateTime getNotAfter() {
110         return notAfter;
111     }
112 
113     /**
114      * Set the NotOnOrAfter time of the SubjectConfirmationDataBean
115      * @param notAfter the NotOnOrAfter time of the SubjectConfirmationDataBean
116      */
117     public void setNotAfter(DateTime notAfter) {
118         this.notAfter = notAfter;
119     }
120     
121     /**
122      * Method equals ...
123      *
124      * @param o of type Object
125      * @return boolean
126      */
127     @Override
128     public boolean equals(Object o) {
129         if (this == o) return true;
130         if (!(o instanceof SubjectConfirmationDataBean)) return false;
131 
132         SubjectConfirmationDataBean that = (SubjectConfirmationDataBean) o;
133 
134         if (recipient == null && that.recipient != null) {
135             return false;
136         } else if (recipient != null && !recipient.equals(that.recipient)) {
137             return false;
138         }
139         
140         if (address == null && that.address != null) {
141             return false;
142         } else if (address != null && !address.equals(that.address)) {
143             return false;
144         }
145         
146         if (inResponseTo == null && that.inResponseTo != null) {
147             return false;
148         } else if (inResponseTo != null && !inResponseTo.equals(that.inResponseTo)) {
149             return false;
150         }
151         
152         if (notBefore == null && that.notBefore != null) {
153             return false;
154         } else if (notBefore != null && !notBefore.equals(that.notBefore)) {
155             return false;
156         }
157         
158         if (notAfter == null && that.notAfter != null) {
159             return false;
160         } else if (notAfter != null && !notAfter.equals(that.notAfter)) {
161             return false;
162         }
163 
164         return true;
165     }
166 
167     /**
168      * @return the hashcode of this object
169      */
170     @Override
171     public int hashCode() {
172         int result = 0;
173         if (recipient != null) {
174             result = recipient.hashCode();
175         }
176         if (address != null) {
177             result = 31 * result + address.hashCode();
178         }
179         if (inResponseTo != null) {
180             result = 31 * result + inResponseTo.hashCode();
181         }
182         if (notBefore != null) {
183             result = 31 * result + notBefore.hashCode();
184         }
185         if (notAfter != null) {
186             result = 31 * result + notAfter.hashCode();
187         }
188         return result;
189     }
190 
191 }