1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package net.ramapuram.thomas.model.acquisition;
19
20 import net.ramapuram.thomas.model.BaseObject;
21 import net.ramapuram.thomas.model.circulation.Issue;
22
23 import javax.persistence.Entity;
24 import java.util.Date;
25
26
27
28
29
30
31 @Entity
32 public class Book extends BaseObject {
33 private Long id;
34 private String title;
35 private String author;
36 private String subject;
37 private String isbn;
38 private String publishedPlace;
39 private Date publishedYear;
40 private Issue currentIssue;
41
42 public Long getId() {
43 return id;
44 }
45
46 public void setId(Long id) {
47 this.id = id;
48 }
49
50 public String getTitle() {
51 return title;
52 }
53
54 public void setTitle(String title) {
55 this.title = title;
56 }
57
58 public String getAuthor() {
59 return author;
60 }
61
62 public void setAuthor(String author) {
63 this.author = author;
64 }
65
66 public String getSubject() {
67 return subject;
68 }
69
70 public void setSubject(String subject) {
71 this.subject = subject;
72 }
73
74 public String getIsbn() {
75 return isbn;
76 }
77
78 public void setIsbn(String isbn) {
79 this.isbn = isbn;
80 }
81
82 public String getPublishedPlace() {
83 return publishedPlace;
84 }
85
86 public void setPublishedPlace(String publishedPlace) {
87 this.publishedPlace = publishedPlace;
88 }
89
90 public Date getPublishedYear() {
91 return publishedYear;
92 }
93
94 public void setPublishedYear(Date publishedYear) {
95 this.publishedYear = publishedYear;
96 }
97
98 public Issue getCurrentIssue() {
99 return currentIssue;
100 }
101
102 public void setCurrentIssue(Issue currentIssue) {
103 this.currentIssue = currentIssue;
104 }
105
106 @Override
107 public boolean equals(Object o) {
108 if (this == o) return true;
109 if (o == null || getClass() != o.getClass()) return false;
110
111 Book book = (Book) o;
112
113 if (author != null ? !author.equals(book.author) : book.author != null) return false;
114 if (currentIssue != null ? !currentIssue.equals(book.currentIssue) : book.currentIssue != null) return false;
115 if (id != null ? !id.equals(book.id) : book.id != null) return false;
116 if (isbn != null ? !isbn.equals(book.isbn) : book.isbn != null) return false;
117 if (publishedPlace != null ? !publishedPlace.equals(book.publishedPlace) : book.publishedPlace != null)
118 return false;
119 if (publishedYear != null ? !publishedYear.equals(book.publishedYear) : book.publishedYear != null)
120 return false;
121 if (subject != null ? !subject.equals(book.subject) : book.subject != null) return false;
122 if (title != null ? !title.equals(book.title) : book.title != null) return false;
123
124 return true;
125 }
126
127 @Override
128 public int hashCode() {
129 int result = id != null ? id.hashCode() : 0;
130 result = 31 * result + (title != null ? title.hashCode() : 0);
131 result = 31 * result + (author != null ? author.hashCode() : 0);
132 result = 31 * result + (subject != null ? subject.hashCode() : 0);
133 result = 31 * result + (isbn != null ? isbn.hashCode() : 0);
134 result = 31 * result + (publishedPlace != null ? publishedPlace.hashCode() : 0);
135 result = 31 * result + (publishedYear != null ? publishedYear.hashCode() : 0);
136 result = 31 * result + (currentIssue != null ? currentIssue.hashCode() : 0);
137 return result;
138 }
139
140 @Override
141 public String toString() {
142 return "Book{" +
143 "id=" + id +
144 ", title='" + title + '\'' +
145 ", author='" + author + '\'' +
146 ", subject='" + subject + '\'' +
147 ", isbn='" + isbn + '\'' +
148 ", publishedPlace='" + publishedPlace + '\'' +
149 ", publishedYear=" + publishedYear +
150 ", currentIssue=" + currentIssue +
151 '}';
152 }
153 }