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.circulation;
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: 16/11/11
28   * Time: 6:18 PM
29   */
30  public class Issue {
31      private Long id;
32      private Book book;
33      private User issuedTo;
34      private Date issueDate;
35      private Date dueDate;
36      private Date returnDate;
37  
38      public Long getId() {
39          return id;
40      }
41  
42      public void setId(Long id) {
43          this.id = id;
44      }
45  
46      public Book getBook() {
47          return book;
48      }
49  
50      public void setBook(Book book) {
51          this.book = book;
52      }
53  
54      public User getIssuedTo() {
55          return issuedTo;
56      }
57  
58      public void setIssuedTo(User issuedTo) {
59          this.issuedTo = issuedTo;
60      }
61  
62      public Date getIssueDate() {
63          return issueDate;
64      }
65  
66      public void setIssueDate(Date issueDate) {
67          this.issueDate = issueDate;
68      }
69  
70      public Date getDueDate() {
71          return dueDate;
72      }
73  
74      public void setDueDate(Date dueDate) {
75          this.dueDate = dueDate;
76      }
77  
78      public Date getReturnDate() {
79          return returnDate;
80      }
81  
82      public void setReturnDate(Date returnDate) {
83          this.returnDate = returnDate;
84      }
85  
86      @Override
87      public boolean equals(Object o) {
88          if (this == o) return true;
89          if (o == null || getClass() != o.getClass()) return false;
90  
91          Issue issue = (Issue) o;
92  
93          if (book != null ? !book.equals(issue.book) : issue.book != null) return false;
94          if (dueDate != null ? !dueDate.equals(issue.dueDate) : issue.dueDate != null) return false;
95          if (id != null ? !id.equals(issue.id) : issue.id != null) return false;
96          if (issueDate != null ? !issueDate.equals(issue.issueDate) : issue.issueDate != null) return false;
97          if (issuedTo != null ? !issuedTo.equals(issue.issuedTo) : issue.issuedTo != null) return false;
98          if (returnDate != null ? !returnDate.equals(issue.returnDate) : issue.returnDate != null) return false;
99  
100         return true;
101     }
102 
103     @Override
104     public int hashCode() {
105         int result = id != null ? id.hashCode() : 0;
106         result = 31 * result + (book != null ? book.hashCode() : 0);
107         result = 31 * result + (issuedTo != null ? issuedTo.hashCode() : 0);
108         result = 31 * result + (issueDate != null ? issueDate.hashCode() : 0);
109         result = 31 * result + (dueDate != null ? dueDate.hashCode() : 0);
110         result = 31 * result + (returnDate != null ? returnDate.hashCode() : 0);
111         return result;
112     }
113 
114     @Override
115     public String toString() {
116         return "Issue{" +
117                 "id=" + id +
118                 ", book=" + book +
119                 ", issuedTo=" + issuedTo +
120                 ", issueDate=" + issueDate +
121                 ", dueDate=" + dueDate +
122                 ", returnDate=" + returnDate +
123                 '}';
124     }
125 }