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.BaseObject;
21  import net.ramapuram.thomas.model.User;
22  import net.ramapuram.thomas.model.acquisition.Book;
23  
24  import java.util.Date;
25  
26  /**
27   * User: Thomas Emmanuel Ramapuram
28   * Date: 16/11/11
29   * Time: 6:21 PM
30   */
31  public class Comment extends BaseObject {
32      private Long id;
33      private User user;
34      private String comment;
35      private Date enteredOn;
36      private Book book;
37  
38      public Long getId() {
39          return id;
40      }
41  
42      public void setId(Long id) {
43          this.id = id;
44      }
45  
46      public User getUser() {
47          return user;
48      }
49  
50      public void setUser(User user) {
51          this.user = user;
52      }
53  
54      public String getComment() {
55          return comment;
56      }
57  
58      public void setComment(String comment) {
59          this.comment = comment;
60      }
61  
62      public Date getEnteredOn() {
63          return enteredOn;
64      }
65  
66      public void setEnteredOn(Date enteredOn) {
67          this.enteredOn = enteredOn;
68      }
69  
70      public Book getBook() {
71          return book;
72      }
73  
74      public void setBook(Book book) {
75          this.book = book;
76      }
77  
78      @Override
79      public boolean equals(Object o) {
80          if (this == o) return true;
81          if (o == null || getClass() != o.getClass()) return false;
82  
83          Comment comment1 = (Comment) o;
84  
85          if (book != null ? !book.equals(comment1.book) : comment1.book != null) return false;
86          if (comment != null ? !comment.equals(comment1.comment) : comment1.comment != null) return false;
87          if (enteredOn != null ? !enteredOn.equals(comment1.enteredOn) : comment1.enteredOn != null) return false;
88          if (id != null ? !id.equals(comment1.id) : comment1.id != null) return false;
89          if (user != null ? !user.equals(comment1.user) : comment1.user != null) return false;
90  
91          return true;
92      }
93  
94      @Override
95      public int hashCode() {
96          int result = id != null ? id.hashCode() : 0;
97          result = 31 * result + (user != null ? user.hashCode() : 0);
98          result = 31 * result + (comment != null ? comment.hashCode() : 0);
99          result = 31 * result + (enteredOn != null ? enteredOn.hashCode() : 0);
100         result = 31 * result + (book != null ? book.hashCode() : 0);
101         return result;
102     }
103 
104     @Override
105     public String toString() {
106         return "Comment{" +
107                 "id=" + id +
108                 ", user=" + user +
109                 ", comment='" + comment + '\'' +
110                 ", enteredOn=" + enteredOn +
111                 ", book=" + book +
112                 '}';
113     }
114 }