View Javadoc

1   /*
2    * This file is part of Library Management Software (LMS).
3    *
4    * LMS is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * LMS is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with LMS.  If not, see <http://www.gnu.org/licenses/>.
16   */
17  
18  package net.ramapuram.thomas.model.opac;
19  
20  import net.ramapuram.thomas.model.User;
21  import net.ramapuram.thomas.model.acquisition.Book;
22  
23  import java.util.Date;
24  
25  /**
26   * User: Thomas Emmanuel Ramapuram
27   * Date: 17/11/11
28   * Time: 9:17 AM
29   */
30  public class Reservation {
31      private Long id;
32      private Book book;
33      private User user;
34      private Date reservationReleaseDate;
35  
36      public Long getId() {
37          return id;
38      }
39  
40      public void setId(Long id) {
41          this.id = id;
42      }
43  
44      public Book getBook() {
45          return book;
46      }
47  
48      public void setBook(Book book) {
49          this.book = book;
50      }
51  
52      public User getUser() {
53          return user;
54      }
55  
56      public void setUser(User user) {
57          this.user = user;
58      }
59  
60      public Date getReservationReleaseDate() {
61          return reservationReleaseDate;
62      }
63  
64      public void setReservationReleaseDate(Date reservationReleaseDate) {
65          this.reservationReleaseDate = reservationReleaseDate;
66      }
67  
68      @Override
69      public boolean equals(Object o) {
70          if (this == o) return true;
71          if (o == null || getClass() != o.getClass()) return false;
72  
73          Reservation that = (Reservation) o;
74  
75          if (book != null ? !book.equals(that.book) : that.book != null) return false;
76          if (id != null ? !id.equals(that.id) : that.id != null) return false;
77          if (reservationReleaseDate != null ? !reservationReleaseDate.equals(that.reservationReleaseDate) : that.reservationReleaseDate != null)
78              return false;
79          if (user != null ? !user.equals(that.user) : that.user != null) return false;
80  
81          return true;
82      }
83  
84      @Override
85      public int hashCode() {
86          int result = id != null ? id.hashCode() : 0;
87          result = 31 * result + (book != null ? book.hashCode() : 0);
88          result = 31 * result + (user != null ? user.hashCode() : 0);
89          result = 31 * result + (reservationReleaseDate != null ? reservationReleaseDate.hashCode() : 0);
90          return result;
91      }
92  
93      @Override
94      public String toString() {
95          return "Reservation{" +
96                  "id=" + id +
97                  ", book=" + book +
98                  ", user=" + user +
99                  ", reservationReleaseDate=" + reservationReleaseDate +
100                 '}';
101     }
102 }