1 package uk.ac.ebi.intenz.mapper;
2
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import java.util.ArrayList;
8 import java.util.List;
9
10 import uk.ac.ebi.intenz.domain.constants.EnzymeSourceConstant;
11 import uk.ac.ebi.intenz.domain.constants.EnzymeViewConstant;
12 import uk.ac.ebi.intenz.domain.constants.Status;
13 import uk.ac.ebi.intenz.domain.reference.Book;
14 import uk.ac.ebi.intenz.domain.reference.Journal;
15 import uk.ac.ebi.intenz.domain.reference.Patent;
16 import uk.ac.ebi.intenz.domain.reference.Reference;
17
18
19
20
21
22
23
24 public class EnzymeReferenceMapper {
25
26 private static final String COLUMNS = "p.pub_id, p.medline_id, p.pubmed_id, p.pub_type, p.author, " +
27 "p.pub_year, p.title, p.journal_book, p.volume, p.first_page, p.last_page, " +
28 "p.edition, p.editor, p.pub_company, p.pub_place, p.web_view, p.source";
29
30
31
32 public EnzymeReferenceMapper() {
33 }
34
35 private String findStatement() {
36 return "SELECT " + COLUMNS +
37 " FROM citations c, publications p" +
38 " WHERE c.enzyme_id = ? AND c.pub_id = p.pub_id ORDER BY c.order_in";
39 }
40
41 private String findPubIdsStatement() {
42 return "SELECT pub_id FROM citations WHERE enzyme_id = ?";
43 }
44
45 private String findNextPubIdStatement() {
46 return "SELECT s_pub_id.nextval FROM DUAL";
47 }
48
49 private String findNextOrderInStatement() {
50 return "SELECT MAX(order_in) FROM citations WHERE enzyme_id = ?";
51 }
52
53 private String insertJournalStatement() {
54 return "INSERT INTO publications " +
55 "(pub_id, medline_id, pubmed_id, pub_type, author, pub_year, title, journal_book, volume, first_page, last_page, web_view, source) " +
56 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
57 }
58
59 private String updateJournalStatement() {
60 return "UPDATE publications " +
61 "SET medline_id = ?, pubmed_id = ?, pub_type = ?, author = ?, pub_year = ?, title = ?, journal_book = ?, " +
62 "volume = ?, first_page = ?, last_page = ?, web_view = ?, source = ? " +
63 "WHERE pub_id = ?";
64 }
65
66 private String insertBookStatement() {
67 return "INSERT INTO publications " +
68 "(pub_id, pub_type, author, pub_year, title, journal_book, volume, first_page, last_page, edition, editor, pub_company, pub_place, web_view, source) " +
69 "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
70 }
71
72 private String updateBookStatement() {
73 return "UPDATE publications " +
74 "SET pub_type = ?, author = ?, pub_year = ?, title = ?, journal_book = ?, volume = ?, first_page = ?, " +
75 "last_page = ?, edition = ?, editor = ?, pub_company = ?, pub_place = ?, web_view = ?, source = ? " +
76 "WHERE pub_id = ?";
77 }
78
79 private String insertPatentStatement() {
80 return "INSERT INTO publications " +
81 "(pub_id, pub_type, author, pub_year, title, journal_book, web_view, source) " +
82 "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
83 }
84
85 private String updatePatentStatement() {
86 return "UPDATE publications " +
87 "SET pub_type = ?, author = ?, pub_year = ?, title = ?, journal_book = ?, web_view = ?, source = ? " +
88 "WHERE pub_id = ?";
89 }
90
91 private String insertCitationStatement() {
92 return "INSERT INTO citations (enzyme_id, pub_id, order_in, status, source) VALUES (?, ?, ?, ?, ?)";
93 }
94
95 private String deleteCitationStatement() {
96 return "DELETE citations WHERE enzyme_id = ? AND order_in = ?";
97 }
98
99 private String deletePublicationStatement() {
100 return "DELETE publications WHERE pub_id = ?";
101 }
102
103 private String deleteCitationsStatement() {
104 return "DELETE citations WHERE enzyme_id = ?";
105 }
106
107 private String deleteCitationByPubIdStatement() {
108 return "DELETE citations WHERE enzyme_id = ? AND pub_id = ?";
109 }
110
111
112
113
114
115
116
117
118
119 public List<Reference> find(Long enzymeId, Connection con) throws SQLException {
120 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
121 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
122
123 PreparedStatement findStatement = null;
124 ResultSet rs = null;
125 List<Reference> result = new ArrayList<Reference>();
126 boolean noResult = true;
127 try {
128
129 findStatement = con.prepareStatement(findStatement());
130 findStatement.setLong(1, enzymeId.longValue());
131 rs = findStatement.executeQuery();
132 while (rs.next()) {
133 noResult = false;
134 Reference reference = doLoad(rs);
135 if (reference == null) continue;
136 result.add(reference);
137 }
138 } finally {
139 if (rs != null) rs.close();
140 if (findStatement != null) findStatement.close();
141 }
142
143 if (noResult) return null;
144 return result;
145 }
146
147 public List<Long> findPubIds(Long enzymeId, Connection con) throws SQLException {
148 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
149 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
150
151 PreparedStatement findPubIdsStatement = null;
152 ResultSet rs = null;
153 List<Long> result = new ArrayList<Long>();
154 try {
155
156 findPubIdsStatement = con.prepareStatement(findPubIdsStatement());
157 findPubIdsStatement.setLong(1, enzymeId.longValue());
158 rs = findPubIdsStatement.executeQuery();
159 while (rs.next()) {
160 result.add(new Long(rs.getLong(1)));
161 }
162 } finally {
163 if (rs != null) rs.close();
164 if (findPubIdsStatement != null) findPubIdsStatement.close();
165 }
166
167 return result;
168 }
169
170 public void insert(Reference reference, Long enzymeId, Status status, Connection con) throws SQLException {
171 if (reference == null) throw new NullPointerException("Parameter 'reference' must not be null.");
172 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
173 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
174 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
175
176 PreparedStatement insertJournalStatement = null, insertBookStatement = null,
177 insertPatentStatement = null, insertCitationStatement = null,
178 deleteCitationStatement = null;
179
180 try {
181 insertCitationStatement = con.prepareStatement(insertCitationStatement());
182 deleteCitationStatement = con.prepareStatement(deleteCitationStatement());
183 insertJournalStatement = con.prepareStatement(insertJournalStatement());
184 insertBookStatement = con.prepareStatement(insertBookStatement());
185 insertPatentStatement = con.prepareStatement(insertPatentStatement());
186 int orderIn = findNextOrderIn(enzymeId, con);
187
188 Long oldPubId = reference.getPubId();
189
190 Long newPubId = (oldPubId == null)? findNextPubId(con) : oldPubId;
191
192 doInsertCitation(enzymeId, newPubId, orderIn, status, reference.getSource(), insertCitationStatement);
193 insertCitationStatement.execute();
194
195 orderIn++;
196
197 if (reference instanceof Journal) {
198 Journal journal = (Journal) reference;
199 doInsertJournal(newPubId, journal, insertJournalStatement);
200 insertJournalStatement.execute();
201
202 }
203 if (reference instanceof Book) {
204 Book book = (Book) reference;
205 doInsertBook(newPubId, book, insertBookStatement);
206 insertBookStatement.execute();
207
208 }
209 if (reference instanceof Patent) {
210 Patent patent = (Patent) reference;
211 doInsertPatent(newPubId, patent, insertPatentStatement);
212 insertPatentStatement.execute();
213
214 }
215
216
217
218 } finally {
219 if (insertJournalStatement != null) insertJournalStatement.close();
220 if (insertBookStatement != null) insertBookStatement.close();
221 if (insertPatentStatement != null) insertPatentStatement.close();
222 if (insertCitationStatement != null) insertCitationStatement.close();
223 if (deleteCitationStatement != null) deleteCitationStatement.close();
224 }
225 }
226
227
228
229
230
231
232
233
234
235
236 public void insert(List<Reference> references, Long enzymeId, Status status, Connection con)
237 throws SQLException {
238 if (references == null) throw new NullPointerException("Parameter 'references' must not be null.");
239 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
240 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
241 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
242
243 for (int iii = 0; iii < references.size(); iii++) {
244 Reference reference = references.get(iii);
245 insert(reference, enzymeId, status, con);
246 }
247 }
248
249 public void reload(List<Reference> references, Long enzymeId, Status status, Connection con)
250 throws SQLException {
251 deleteAll(enzymeId, con);
252 insert(references, enzymeId, status, con);
253 }
254
255 public void update(Reference reference, Long enzymeId, Status status, Connection con) throws SQLException {
256 if (reference == null) throw new NullPointerException("Parameter 'reference' must not be null.");
257 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
258 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
259 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
260
261 PreparedStatement updateJournalStatement = null, updateBookStatement = null,
262 updatePatentStatement = null;
263 try {
264 updateJournalStatement = con.prepareStatement(updateJournalStatement());
265 updateBookStatement = con.prepareStatement(updateBookStatement());
266 updatePatentStatement = con.prepareStatement(updatePatentStatement());
267
268 if (reference instanceof Journal) {
269 Journal journal = (Journal) reference;
270 doUpdateJournal(journal, updateJournalStatement);
271 updateJournalStatement.execute();
272
273 }
274 if (reference instanceof Book) {
275 Book book = (Book) reference;
276 doUpdateBook(book, updateBookStatement);
277 updateBookStatement.execute();
278
279 }
280 if (reference instanceof Patent) {
281 Patent patent = (Patent) reference;
282 doUpdatePatent(patent, updatePatentStatement);
283 updatePatentStatement.execute();
284
285 }
286
287
288
289 } finally {
290 if (updateJournalStatement != null) updateJournalStatement.close();
291 if (updateBookStatement != null) updateBookStatement.close();
292 if (updatePatentStatement != null) updatePatentStatement.close();
293 }
294 }
295
296 public void update(List<Reference> references, Long enzymeId, Status status, Connection con)
297 throws SQLException {
298 if (references == null) throw new NullPointerException("Parameter 'references' must not be null.");
299 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
300 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
301 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
302
303 for (int iii = 0; iii < references.size(); iii++) {
304 Reference reference = references.get(iii);
305 update(reference, enzymeId, status, con);
306 }
307 }
308
309 public void deleteAll(Long enzymeId, Connection con) throws SQLException {
310 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
311 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
312
313
314
315 List<Long> pubIds = findPubIds(enzymeId, con);
316 for (int iii = 0; iii < pubIds.size(); iii++) {
317 deletePublication(pubIds.get(iii), con);
318 }
319 deleteCitations(enzymeId, con);
320 }
321
322 public void deleteCitations(Long enzymeId, Connection con) throws SQLException {
323 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
324 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
325
326 PreparedStatement deleteCitationsStatement = null;
327 try {
328 deleteCitationsStatement = con.prepareStatement(deleteCitationsStatement());
329 deleteCitationsStatement.setLong(1, enzymeId.longValue());
330 deleteCitationsStatement.execute();
331
332
333
334
335 } finally {
336 if (deleteCitationsStatement != null) deleteCitationsStatement.close();
337 }
338 }
339
340
341
342
343
344
345
346
347
348
349
350 public void deleteCitations(List<Long> pubIds, Long enzymeId, Connection con) throws SQLException {
351 if (pubIds == null) throw new NullPointerException("Parameter 'pubIds' must not be null.");
352 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
353 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
354
355 PreparedStatement deleteCitationStatement = null;
356 try {
357 for (int iii = 0; iii < pubIds.size(); iii++) {
358 Long pubId = pubIds.get(iii);
359 deleteCitationStatement = con.prepareStatement(deleteCitationByPubIdStatement());
360 deleteCitationStatement.setLong(1, enzymeId.longValue());
361 deleteCitationStatement.setLong(2, pubId.longValue());
362 deleteCitationStatement.execute();
363 }
364
365
366
367
368 } finally {
369 if (deleteCitationStatement != null) deleteCitationStatement.close();
370 }
371 }
372
373 public void deletePublication(Long pubId, Connection con) throws SQLException {
374 if (pubId == null) throw new NullPointerException("Parameter 'pubId' must not be null.");
375 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
376
377 PreparedStatement deletePublicationStatement = null;
378 try {
379 deletePublicationStatement = con.prepareStatement(deletePublicationStatement());
380 deletePublicationStatement.setLong(1, pubId.longValue());
381 deletePublicationStatement.execute();
382
383
384
385
386 } finally {
387 if (deletePublicationStatement != null) deletePublicationStatement.close();
388 }
389 }
390
391
392
393
394
395
396
397
398
399
400
401 private Reference doLoad(ResultSet rs) throws SQLException {
402 assert rs != null : "Parameter 'rs' must not be null.";
403
404 Long pubId = null;
405 String medlineId = "";
406 String pubMedId = "";
407 String pubType = "";
408 String authors = "";
409 String pubYear = "";
410 String title = "";
411 String pubName = "";
412 String volume = "";
413 String firstPage = "";
414 String lastPage = "";
415 String edition = "";
416 String editor = "";
417 String publisher = "";
418 String pubPlace = "";
419 String webView = "";
420 String source = "";
421
422 if (rs.getLong("pub_id") > 0) pubId = new Long(rs.getLong("pub_id"));
423 if (rs.getString("medline_id") != null) medlineId = rs.getString("medline_id");
424 if (rs.getString("pubmed_id") != null) pubMedId = rs.getString("pubmed_id");
425 if (rs.getString("pub_type") != null) pubType = rs.getString("pub_type");
426 if (rs.getString("author") != null) authors = rs.getString("author");
427 if (rs.getString("pub_year") != null) pubYear = rs.getString("pub_year");
428 if (rs.getString("title") != null) title = rs.getString("title");
429 if (rs.getString("journal_book") != null) pubName = rs.getString("journal_book");
430 if (rs.getString("volume") != null) volume = rs.getString("volume");
431 if (rs.getString("first_page") != null) firstPage = rs.getString("first_page");
432 if (rs.getString("last_page") != null) lastPage = rs.getString("last_page");
433 if (rs.getString("edition") != null) edition = rs.getString("edition");
434 if (rs.getString("editor") != null) editor = rs.getString("editor");
435 if (rs.getString("pub_company") != null) publisher = rs.getString("pub_company");
436 if (rs.getString("pub_place") != null) pubPlace = rs.getString("pub_place");
437 if (rs.getString("web_view") != null) webView = rs.getString("web_view");
438 if (rs.getString("source") != null) source = rs.getString("source");
439
440 if (pubType.equals("B"))
441 return new Book(pubId, authors, title, pubYear, firstPage, lastPage, pubName,
442 edition, editor, volume, publisher, pubPlace, EnzymeViewConstant.valueOf(webView),
443 EnzymeSourceConstant.valueOf(source));
444
445 if (pubType.equals("J"))
446 return new Journal(pubId, authors, title, pubYear, pubName, firstPage, lastPage, volume, pubMedId, medlineId,
447 EnzymeViewConstant.valueOf(webView), EnzymeSourceConstant.valueOf(source));
448
449 if (pubType.equals("P"))
450 return new Patent(pubId, authors, title, pubYear, pubName, EnzymeViewConstant.valueOf(webView),
451 EnzymeSourceConstant.valueOf(source));
452
453 return null;
454 }
455
456
457
458
459
460
461
462
463 private Long findNextPubId(Connection con) throws SQLException {
464 assert con != null : "Parameter 'con' must not be null.";
465
466 Long pubId = null;
467 PreparedStatement findNextPubId = null;
468 ResultSet rs = null;
469 try {
470 findNextPubId = con.prepareStatement(findNextPubIdStatement());
471 rs = findNextPubId.executeQuery();
472 if (rs.next()) {
473 pubId = new Long(rs.getLong(1));
474 }
475 } finally {
476 if (rs != null) rs.close();
477 if (findNextPubId != null) findNextPubId.close();
478 }
479
480 return pubId;
481 }
482
483 private int findNextOrderIn(Long enzymeId, Connection con) throws SQLException {
484 assert enzymeId != null : "Parameter 'enzymeId' must not be null.";
485 assert con != null : "Parameter 'con' must not be null.";
486
487 int orderIn = 0;
488 PreparedStatement findNextOrderIn = null;
489 ResultSet rs = null;
490 try {
491 findNextOrderIn = con.prepareStatement(findNextOrderInStatement());
492 findNextOrderIn.setLong(1, enzymeId.longValue());
493 rs = findNextOrderIn.executeQuery();
494 if (rs.next()) {
495 orderIn = rs.getInt(1);
496 }
497 } finally {
498 if (rs != null) rs.close();
499 if (findNextOrderIn != null) findNextOrderIn.close();
500 }
501
502 return ++orderIn;
503 }
504
505
506
507
508
509
510
511
512
513
514
515
516 private void doInsertCitation(Long enzymeId, Long pubId, int orderIn, Status status, EnzymeSourceConstant source,
517 PreparedStatement insertCitationStatement) throws SQLException {
518 insertCitationStatement.setLong(1, enzymeId.longValue());
519 insertCitationStatement.setLong(2, pubId.longValue());
520 insertCitationStatement.setInt(3, orderIn);
521 insertCitationStatement.setString(4, status.getCode());
522 insertCitationStatement.setString(5, source.toString());
523 }
524
525 private void doInsertJournal(Long newPubId, Journal journal, PreparedStatement insertJournalStatement) throws SQLException {
526 assert newPubId != null : "Parameter 'newPubId' must not be null.";
527 assert journal != null : "Parameter 'journal' must not be null.";
528 assert insertJournalStatement != null : "Parameter 'insertJournalStatement' must not be null.";
529
530 insertJournalStatement.setLong(1, newPubId.longValue());
531 insertJournalStatement.setString(2, journal.getMedlineId());
532 insertJournalStatement.setString(3, journal.getPubMedId());
533 insertJournalStatement.setString(4, "J");
534 insertJournalStatement.setString(5, journal.getAuthors());
535 insertJournalStatement.setString(6, journal.getYear());
536 insertJournalStatement.setString(7, journal.getTitle());
537 insertJournalStatement.setString(8, journal.getPubName());
538 insertJournalStatement.setString(9, journal.getVolume());
539 insertJournalStatement.setString(10, journal.getFirstPage());
540 insertJournalStatement.setString(11, journal.getLastPage());
541 insertJournalStatement.setString(12, journal.getView().toString());
542 insertJournalStatement.setString(13, journal.getSource().toString());
543 }
544
545 private void doUpdateJournal(Journal journal, PreparedStatement updateJournalStatement) throws SQLException {
546 assert journal != null : "Parameter 'journal' must not be null.";
547 assert updateJournalStatement != null : "Parameter 'updateJournalStatement' must not be null.";
548
549 updateJournalStatement.setString(1, journal.getMedlineId());
550 updateJournalStatement.setString(2, journal.getPubMedId());
551 updateJournalStatement.setString(3, "J");
552 updateJournalStatement.setString(4, journal.getAuthors());
553 updateJournalStatement.setString(5, journal.getYear());
554 updateJournalStatement.setString(6, journal.getTitle());
555 updateJournalStatement.setString(7, journal.getPubName());
556 updateJournalStatement.setString(8, journal.getVolume());
557 updateJournalStatement.setString(9, journal.getFirstPage());
558 updateJournalStatement.setString(10, journal.getLastPage());
559 updateJournalStatement.setLong(11, journal.getPubId().longValue());
560 updateJournalStatement.setString(12, journal.getView().toString());
561 updateJournalStatement.setString(13, journal.getSource().toString());
562 }
563
564 private void doInsertBook(Long newPubId, Book book, PreparedStatement insertBookStatement) throws SQLException {
565 assert newPubId != null : "Parameter 'newPubId' must not be null.";
566 assert book != null : "Parameter 'book' must not be null.";
567 assert insertBookStatement != null : "Parameter 'insertBookStatement' must not be null.";
568
569 insertBookStatement.setLong(1, newPubId.longValue());
570 insertBookStatement.setString(2, "B");
571 insertBookStatement.setString(3, book.getAuthors());
572 insertBookStatement.setString(4, book.getYear());
573 insertBookStatement.setString(5, book.getTitle());
574 insertBookStatement.setString(6, book.getPubName());
575 insertBookStatement.setString(7, book.getVolume());
576 insertBookStatement.setString(8, book.getFirstPage());
577 insertBookStatement.setString(9, book.getLastPage());
578 insertBookStatement.setString(10, book.getEdition(false));
579 insertBookStatement.setString(11, book.getEditor(false));
580 insertBookStatement.setString(12, book.getPublisher());
581 insertBookStatement.setString(13, book.getPublisherPlace());
582 insertBookStatement.setString(14, book.getView().toString());
583 insertBookStatement.setString(15, book.getSource().toString());
584 }
585
586 private void doUpdateBook(Book book, PreparedStatement updateBookStatement) throws SQLException {
587 assert book != null : "Parameter 'book' must not be null.";
588 assert updateBookStatement != null : "Parameter 'updateBookStatement' must not be null.";
589
590 updateBookStatement.setString(1, "B");
591 updateBookStatement.setString(2, book.getAuthors());
592 updateBookStatement.setString(3, book.getYear());
593 updateBookStatement.setString(4, book.getTitle());
594 updateBookStatement.setString(5, book.getPubName());
595 updateBookStatement.setString(6, book.getVolume());
596 updateBookStatement.setString(7, book.getFirstPage());
597 updateBookStatement.setString(8, book.getLastPage());
598 updateBookStatement.setString(9, book.getEdition(false));
599 updateBookStatement.setString(10, book.getEditor(false));
600 updateBookStatement.setString(11, book.getPublisher());
601 updateBookStatement.setString(12, book.getPublisherPlace());
602 updateBookStatement.setLong(13, book.getPubId().longValue());
603 updateBookStatement.setString(14, book.getView().toString());
604 updateBookStatement.setString(15, book.getSource().toString());
605 }
606
607 private void doInsertPatent(Long newPubId, Patent patent, PreparedStatement insertPatentStatement) throws SQLException {
608 assert newPubId != null : "Parameter 'newPubId' must not be null.";
609 assert patent != null : "Parameter 'patent' must not be null.";
610 assert insertPatentStatement != null : "Parameter 'insertPatentStatement' must not be null.";
611
612 insertPatentStatement.setLong(1, newPubId.longValue());
613 insertPatentStatement.setString(2, "P");
614 insertPatentStatement.setString(3, patent.getAuthors());
615 insertPatentStatement.setString(4, patent.getYear());
616 insertPatentStatement.setString(5, patent.getTitle());
617 insertPatentStatement.setString(6, patent.getPatentNumber());
618 insertPatentStatement.setString(7, patent.getView().toString());
619 insertPatentStatement.setString(8, patent.getSource().toString());
620 }
621
622 private void doUpdatePatent(Patent patent, PreparedStatement updatePatentStatement) throws SQLException {
623 assert patent != null : "Parameter 'patent' must not be null.";
624 assert updatePatentStatement != null : "Parameter 'updatePatentStatement' must not be null.";
625
626 updatePatentStatement.setString(1, "P");
627 updatePatentStatement.setString(2, patent.getAuthors());
628 updatePatentStatement.setString(3, patent.getYear());
629 updatePatentStatement.setString(4, patent.getTitle());
630 updatePatentStatement.setString(5, patent.getPatentNumber());
631 updatePatentStatement.setLong(6, patent.getPubId().longValue());
632 updatePatentStatement.setString(7, patent.getView().toString());
633 updatePatentStatement.setString(8, patent.getSource().toString());
634 }
635
636 }