1 package uk.ac.ebi.intenz.domain.reference;
2
3 import uk.ac.ebi.intenz.domain.constants.EnzymeSourceConstant;
4 import uk.ac.ebi.intenz.domain.constants.EnzymeViewConstant;
5
6
7
8
9
10
11
12
13
14 public class Journal extends Reference {
15
16 private String pubName;
17
18 private String firstPage;
19
20 private String lastPage;
21
22 private String volume;
23
24 private String pubMedId;
25
26 private String medlineId;
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 public Journal(Long id, String authors, String title, String year, String pubName, String firstPage,
44 String lastPage, String volume, String pubMedId, String medlineId, EnzymeViewConstant view,
45 EnzymeSourceConstant source) {
46 super(id, authors, title, year, view, source);
47 if (pubName == null || firstPage == null || lastPage == null || volume == null || pubMedId == null ||
48 medlineId == null)
49 throw new NullPointerException("No parameter must be 'null'");
50 this.pubName = pubName;
51 this.firstPage = firstPage;
52 this.lastPage = lastPage;
53 this.volume = volume;
54 this.pubMedId = pubMedId;
55 this.medlineId = medlineId;
56 }
57
58
59
60
61
62
63 public String toString() {
64 StringBuffer referenceString = new StringBuffer();
65
66 referenceString.append(authors);
67 referenceString.append(" ");
68 referenceString.append(title);
69 referenceString.append(" ");
70 if (!pubName.equals("")) {
71 referenceString.append("<i>");
72 referenceString.append(pubName);
73 referenceString.append("</i> ");
74 }
75 if (!volume.equals("")) {
76 referenceString.append(volume);
77 referenceString.append(" ");
78 }
79 if (!year.equals("")) {
80 referenceString.append("(");
81 referenceString.append(year);
82 referenceString.append(") ");
83 }
84 if (!firstPage.equals("")) {
85 referenceString.append(firstPage);
86 if (!lastPage.equals("")) {
87 referenceString.append("-");
88 referenceString.append(lastPage);
89 referenceString.append(". ");
90 } else {
91 referenceString.append(" only. ");
92 }
93 }
94
95
96
97
98
99
100
101
102 if (!pubMedId.equals("")) {
103 referenceString.append("[PMID: <a target=\"_blank\" href=\"http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-id+IntEnz+[medline-PMID:");
104 referenceString.append(pubMedId);
105 referenceString.append("]+-e\">");
106 referenceString.append(pubMedId);
107 referenceString.append("</a>]");
108 }
109
110 return referenceString.toString();
111 }
112
113
114
115
116
117
118
119 public boolean equals(Object o) {
120 if (this == o) return true;
121 if (!(o instanceof Journal)) return false;
122 if (!super.equals(o)) return false;
123
124 final Journal journal = (Journal) o;
125
126 if (firstPage != null ? !firstPage.equals(journal.firstPage) : journal.firstPage != null) return false;
127 if (pubName != null ? !pubName.equals(journal.pubName) : journal.pubName != null) return false;
128 if (lastPage != null ? !lastPage.equals(journal.lastPage) : journal.lastPage != null) return false;
129 if (medlineId != null ? !medlineId.equals(journal.medlineId) : journal.medlineId != null) return false;
130 if (pubMedId != null ? !pubMedId.equals(journal.pubMedId) : journal.pubMedId != null) return false;
131 if (volume != null ? !volume.equals(journal.volume) : journal.volume != null) return false;
132
133 return true;
134 }
135
136
137
138
139
140
141 public int hashCode() {
142 int result = super.hashCode();
143 result = 29 * result + (pubName != null ? pubName.hashCode() : 0);
144 result = 29 * result + (firstPage != null ? firstPage.hashCode() : 0);
145 result = 29 * result + (lastPage != null ? lastPage.hashCode() : 0);
146 result = 29 * result + (volume != null ? volume.hashCode() : 0);
147 result = 29 * result + (pubMedId != null ? pubMedId.hashCode() : 0);
148 result = 29 * result + (medlineId != null ? medlineId.hashCode() : 0);
149 return result;
150 }
151
152
153
154
155 public String getPubName() {
156 return pubName;
157 }
158
159 public String getFirstPage() {
160 return firstPage;
161 }
162
163 public String getLastPage() {
164 return lastPage;
165 }
166
167 public String getVolume() {
168 return volume;
169 }
170
171 public String getPubMedId() {
172 return pubMedId;
173 }
174
175 public String getMedlineId() {
176 return medlineId;
177 }
178
179
180 public String toXML(int number, boolean intenzTextXML) {
181 StringBuffer xmlStringBuffer = new StringBuffer();
182
183 xmlStringBuffer.append(super.toXML(number, intenzTextXML));
184 if (intenzTextXML) {
185 xmlStringBuffer.append("<pubName>");
186 xmlStringBuffer.append(pubName);
187 xmlStringBuffer.append("</pubName>");
188 xmlStringBuffer.append("<patent_no>");
189 xmlStringBuffer.append("</patent_no>");
190 xmlStringBuffer.append("<first_page>");
191 xmlStringBuffer.append(firstPage);
192 xmlStringBuffer.append("</first_page>");
193 xmlStringBuffer.append("<last_page>");
194 xmlStringBuffer.append(lastPage);
195 xmlStringBuffer.append("</last_page>");
196 xmlStringBuffer.append("<edition>");
197 xmlStringBuffer.append("</edition>");
198 xmlStringBuffer.append("<editor>");
199 xmlStringBuffer.append("</editor>");
200 xmlStringBuffer.append("<volume>");
201 xmlStringBuffer.append("</volume>");
202 xmlStringBuffer.append("<pub_place>");
203 xmlStringBuffer.append("</pub_place>");
204 xmlStringBuffer.append("<pub_company>");
205 xmlStringBuffer.append("</pub_company>");
206 xmlStringBuffer.append("<pub_med>");
207 xmlStringBuffer.append(pubMedId);
208 xmlStringBuffer.append("</pub_med>");
209 xmlStringBuffer.append("<medline>");
210 xmlStringBuffer.append(medlineId);
211 xmlStringBuffer.append("</medline>");
212 } else {
213 xmlStringBuffer.append(" <pubName>");
214 xmlStringBuffer.append(pubName);
215 xmlStringBuffer.append("</pubName>\n");
216 xmlStringBuffer.append(" <patent_no>");
217 xmlStringBuffer.append("</patent_no>\n");
218 xmlStringBuffer.append(" <first_page>");
219 xmlStringBuffer.append(firstPage);
220 xmlStringBuffer.append("</first_page>\n");
221 xmlStringBuffer.append(" <last_page>");
222 xmlStringBuffer.append(lastPage);
223 xmlStringBuffer.append("</last_page>\n");
224 xmlStringBuffer.append(" <edition>");
225 xmlStringBuffer.append("</edition>\n");
226 xmlStringBuffer.append(" <editor>");
227 xmlStringBuffer.append("</editor>\n");
228 xmlStringBuffer.append(" <volume>");
229 xmlStringBuffer.append("</volume>\n");
230 xmlStringBuffer.append(" <pub_place>");
231 xmlStringBuffer.append("</pub_place>\n");
232 xmlStringBuffer.append(" <pub_company>");
233 xmlStringBuffer.append("</pub_company>\n");
234 xmlStringBuffer.append(" <pub_med>");
235 xmlStringBuffer.append(pubMedId);
236 xmlStringBuffer.append("</pub_med>\n");
237 xmlStringBuffer.append(" <medline>");
238 xmlStringBuffer.append(medlineId);
239 xmlStringBuffer.append("</medline>\n");
240 }
241 return xmlStringBuffer.toString();
242 }
243
244 }