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.constants.XrefDatabaseConstant;
14 import uk.ac.ebi.intenz.domain.enzyme.EnzymeLink;
15 import uk.ac.ebi.intenz.domain.exceptions.DomainException;
16
17
18
19
20
21
22
23
24 public class EnzymeLinkMapper {
25
26 private static final String COLUMNS =
27 "enzyme_id, url, display_name, status, source, web_view, data_comment";
28 private static final String TABLES = "links";
29
30 private static final String XREF_COLUMNS =
31 "enzyme_id, database_code, database_ac, name, status, source, web_view, data_comment";
32 private static final String XREF_TABLES = "xrefs";
33
34
35
36 public EnzymeLinkMapper() {
37 }
38
39 private String findStatement() {
40 return "SELECT " + COLUMNS +
41 " FROM " + TABLES +
42 " WHERE links.enzyme_id = ?" +
43 " ORDER BY links.display_name";
44 }
45
46 private String exportSibLinksStatement() {
47 return "SELECT " + COLUMNS +
48 " FROM " + TABLES +
49 " WHERE links.enzyme_id = ? AND (links.web_view = ? OR links.web_view = ? OR links.web_view = ? OR links.web_view = ?)" +
50 " ORDER BY links.display_name";
51 }
52
53 private String findXrefsStatement() {
54 return "SELECT " + XREF_COLUMNS +
55 " FROM " + XREF_TABLES +
56 " WHERE xrefs.enzyme_id = ?" +
57 " ORDER BY xrefs.name";
58 }
59
60 private String findSibXrefsStatement() {
61 return "SELECT " + XREF_COLUMNS +
62 " FROM " + XREF_TABLES +
63 " WHERE xrefs.enzyme_id = ? AND (xrefs.web_view = ? OR xrefs.web_view = ? OR xrefs.web_view = ? OR xrefs.web_view = ?)" +
64 " ORDER BY name";
65 }
66
67 private String insertStatement() {
68 return "INSERT INTO links (enzyme_id, url, display_name, status, source, web_view, data_comment) VALUES (?, ?, ?, ?, ?, ?, ?)";
69 }
70
71 private String insertXrefStatement() {
72 return "INSERT INTO xrefs (enzyme_id, database_code, database_ac, name, status, source, web_view, data_comment) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
73 }
74
75 private String updateLinkUrlStatement() {
76 return "UPDATE links SET url = ?, status = ? WHERE enzyme_id = ? AND display_name = ?";
77 }
78
79 private String deleteStatement() {
80 return "DELETE links WHERE enzyme_id = ? AND display_name = ? AND url = ?";
81 }
82
83 private String deleteAllStatement() {
84 return "DELETE links WHERE enzyme_id = ?";
85 }
86
87 private String deleteXrefStatement() {
88 return "DELETE xrefs WHERE enzyme_id = ? AND database_code = ? AND database_ac = ? AND name = ?";
89 }
90
91 private String deleteAllXrefStatement() {
92 return "DELETE xrefs WHERE enzyme_id = ?";
93 }
94
95 private String deleteByCodeXrefStatement() {
96 return "DELETE xrefs WHERE enzyme_id = ? AND database_code = ?";
97 }
98
99 private String deleteByNameStatement() {
100 return "DELETE links WHERE enzyme_id = ? AND display_name = ?";
101 }
102
103
104
105
106
107
108
109
110
111 public List<EnzymeLink> find(Long enzymeId, Connection con) throws SQLException, DomainException {
112 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
113 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
114
115 PreparedStatement findStatement = null;
116 ResultSet rs = null;
117 List<EnzymeLink> result = new ArrayList<EnzymeLink>();
118
119 try {
120 findStatement = con.prepareStatement(findStatement());
121 findStatement.setLong(1, enzymeId.longValue());
122 rs = findStatement.executeQuery();
123 while (rs.next()) {
124 EnzymeLink link = doLoad(rs);
125 if (link == null) continue;
126 result.add(link);
127 }
128 List<EnzymeLink> xrefs = findXrefs(enzymeId, con);
129 if (xrefs != null) result.addAll(xrefs);
130 } finally {
131 if (rs != null) rs.close();
132 if (findStatement != null) findStatement.close();
133 }
134
135 if (result.size() == 0) return null;
136 return result;
137 }
138
139
140
141
142
143
144
145
146
147
148
149
150 public List<EnzymeLink> exportSibLinks(Long enzymeId, Connection con) throws SQLException, DomainException {
151 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
152 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
153
154 PreparedStatement findStatement = null;
155 ResultSet rs = null;
156 List<EnzymeLink> result = new ArrayList<EnzymeLink>();
157
158 try {
159 findStatement = con.prepareStatement(exportSibLinksStatement());
160 findStatement.setLong(1, enzymeId.longValue());
161 findStatement.setString(2, EnzymeViewConstant.INTENZ.toString());
162 findStatement.setString(3, EnzymeViewConstant.IUBMB_SIB.toString());
163 findStatement.setString(4, EnzymeViewConstant.SIB.toString());
164 findStatement.setString(5, EnzymeViewConstant.SIB_INTENZ.toString());
165 rs = findStatement.executeQuery();
166 while (rs.next()) {
167 EnzymeLink link = doLoad(rs);
168 if (link == null) continue;
169 result.add(link);
170 }
171 List<EnzymeLink> xrefs = findSibXrefs(enzymeId, con);
172 if (xrefs != null) result.addAll(xrefs);
173 } finally {
174 if (rs != null) rs.close();
175 if (findStatement != null) findStatement.close();
176 }
177
178 if (result.size() == 0) return null;
179 return result;
180 }
181
182
183
184
185
186
187
188
189
190 public List<EnzymeLink> findXrefs(Long enzymeId, Connection con) throws SQLException, DomainException {
191 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
192 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
193
194 PreparedStatement findStatement = null;
195 ResultSet rs = null;
196 List<EnzymeLink> result = new ArrayList<EnzymeLink>();
197 boolean noResult = true;
198
199 try {
200
201 findStatement = con.prepareStatement(findXrefsStatement());
202 findStatement.setLong(1, enzymeId.longValue());
203 rs = findStatement.executeQuery();
204 while (rs.next()) {
205 noResult = false;
206 EnzymeLink link = doLoadXref(rs);
207 if (link == null) continue;
208 result.add(link);
209 }
210 } finally {
211 if (rs != null) rs.close();
212 if (findStatement != null) findStatement.close();
213 }
214
215 if (noResult) return null;
216 return result;
217 }
218
219
220
221
222
223
224
225
226
227
228 public List<EnzymeLink> findSibXrefs(Long enzymeId, Connection con) throws SQLException, DomainException {
229 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
230 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
231
232 PreparedStatement findStatement = null;
233 ResultSet rs = null;
234 List<EnzymeLink> result = new ArrayList<EnzymeLink>();
235 boolean noResult = true;
236
237 try {
238
239 findStatement = con.prepareStatement(findSibXrefsStatement());
240 findStatement.setLong(1, enzymeId.longValue());
241 findStatement.setString(2, EnzymeViewConstant.INTENZ.toString());
242 findStatement.setString(3, EnzymeViewConstant.IUBMB_SIB.toString());
243 findStatement.setString(4, EnzymeViewConstant.SIB.toString());
244 findStatement.setString(5, EnzymeViewConstant.SIB_INTENZ.toString());
245 rs = findStatement.executeQuery();
246 while (rs.next()) {
247 noResult = false;
248 EnzymeLink link = doLoadXref(rs);
249 if (link == null) continue;
250 result.add(link);
251 }
252 } finally {
253 if (rs != null) rs.close();
254 if (findStatement != null) findStatement.close();
255 }
256
257 if (noResult) return null;
258 return result;
259 }
260
261
262
263
264
265
266
267
268
269
270 public void insert(List<EnzymeLink> links, Long enzymeId, Status status, Connection con)
271 throws SQLException {
272 if (links == null) throw new NullPointerException("Parameter 'links' must not be null.");
273 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
274 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
275 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
276
277 PreparedStatement insertStatement = null, insertXrefStatement = null;
278
279 try {
280 insertStatement = con.prepareStatement(insertStatement());
281 insertXrefStatement = con.prepareStatement(insertXrefStatement());
282 for (int iii = 0; iii < links.size(); iii++) {
283 EnzymeLink link = links.get(iii);
284 if (link.getXrefDatabaseConstant().isXref()) {
285 doInsertXref(link, enzymeId, status, insertXrefStatement);
286 insertXrefStatement.execute();
287 } else {
288 doInsert(link, enzymeId, status, insertStatement);
289 insertStatement.execute();
290 }
291 }
292 } finally {
293 if (insertStatement != null) insertStatement.close();
294 if (insertXrefStatement != null) insertXrefStatement.close();
295 }
296 }
297
298 public void insertLink(EnzymeLink link, Long enzymeId, Status status, Connection con) throws SQLException {
299 if (link == null) throw new NullPointerException("Parameter 'link' must not be null.");
300 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
301 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
302 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
303
304 PreparedStatement insertStatement = null;
305 try {
306 insertStatement = con.prepareStatement(insertStatement());
307 doInsert(link, enzymeId, status, insertStatement);
308 insertStatement.execute();
309 } finally {
310 if (insertStatement != null) insertStatement.close();
311 }
312 }
313
314 public void updateLinkUrl(EnzymeLink link, Long enzymeId, Status status, Connection con) throws SQLException {
315 if (link == null) throw new NullPointerException("Parameter 'link' must not be null.");
316 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
317 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
318 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
319
320 PreparedStatement updateStatement = null;
321 try {
322 updateStatement = con.prepareStatement(updateLinkUrlStatement());
323 updateStatement.setString(1, link.getSpecificUrl());
324 updateStatement.setString(2, status.getCode());
325 updateStatement.setLong(3, enzymeId.longValue());
326 if (link.getXrefDatabaseConstant().equals("NIST74"))
327 updateStatement.setString(4, "GTD");
328 else
329 updateStatement.setString(4, link.getXrefDatabaseConstant().toString());
330 updateStatement.execute();
331 } finally {
332 if (updateStatement != null) updateStatement.close();
333 }
334 }
335
336 public void reloadLinks(List<EnzymeLink> links, Long enzymeId, Status status, Connection con) throws SQLException {
337 if (links == null) throw new NullPointerException("Parameter 'links' must not be null.");
338 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
339 if (status == null) throw new NullPointerException("Parameter 'status' must not be null.");
340 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
341
342 deleteOtherLinks(links, enzymeId, con);
343 insert(links, enzymeId, status, con);
344 }
345
346 public void delete(Long enzymeId, EnzymeLink link, Connection con) throws SQLException {
347 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
348 if (link == null) throw new NullPointerException("Parameter 'link' must not be null.");
349 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
350
351 PreparedStatement deleteStatement = null;
352 try {
353 deleteStatement = con.prepareStatement(deleteStatement());
354 deleteStatement.setLong(1, enzymeId.longValue());
355 if (link.getXrefDatabaseConstant().equals("NIST74"))
356 deleteStatement.setString(2, "GTD");
357 else
358 deleteStatement.setString(2, link.getXrefDatabaseConstant().toString());
359 deleteStatement.setString(3, link.getSpecificUrl());
360 deleteStatement.execute();
361
362
363
364
365 } finally {
366 if (deleteStatement != null) deleteStatement.close();
367 }
368 }
369
370 public void deleteAll(Long enzymeId, Connection con) throws SQLException {
371 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
372 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
373
374 PreparedStatement deleteStatement = null;
375 try {
376 deleteStatement = con.prepareStatement(deleteAllStatement());
377 deleteStatement.setLong(1, enzymeId.longValue());
378 deleteStatement.execute();
379
380
381
382
383 } finally {
384 if (deleteStatement != null) deleteStatement.close();
385 }
386 }
387
388 public void deleteXref(Long enzymeId, EnzymeLink xref, Connection con) throws SQLException {
389 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
390 if (xref == null) throw new NullPointerException("Parameter 'xref' must not be null.");
391 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
392
393 PreparedStatement deleteXrefStatement = null;
394 String dbCode = xref.getXrefDatabaseConstant().toString();
395
396 if (dbCode.equals("Swiss-Prot")) dbCode = "S";
397 if (dbCode.equals("PROSITE")) dbCode = "P";
398
399 try {
400 deleteXrefStatement = con.prepareStatement(deleteXrefStatement());
401 deleteXrefStatement.setLong(1, enzymeId.longValue());
402 deleteXrefStatement.setString(2, dbCode);
403 deleteXrefStatement.setString(3, xref.getAccession());
404 deleteXrefStatement.setString(4, xref.getName());
405 deleteXrefStatement.execute();
406
407
408
409
410 } finally {
411 if (deleteXrefStatement != null) deleteXrefStatement.close();
412 }
413 }
414
415 public void deleteAllXref(Long enzymeId, Connection con) throws SQLException {
416 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
417 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
418
419 PreparedStatement deleteXrefStatement = null;
420 try {
421 deleteXrefStatement = con.prepareStatement(deleteAllXrefStatement());
422 deleteXrefStatement.setLong(1, enzymeId.longValue());
423 deleteXrefStatement.execute();
424
425
426
427
428 } finally {
429 if (deleteXrefStatement != null) deleteXrefStatement.close();
430 }
431 }
432
433 public void deleteByName(Long enzymeId, String displayName, Connection con) throws SQLException {
434 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
435 if (displayName == null) throw new NullPointerException("Parameter 'displayName' must not be null.");
436 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
437
438 PreparedStatement deleteByNameStatement = null;
439 try {
440 deleteByNameStatement = con.prepareStatement(deleteByNameStatement());
441 deleteByNameStatement.setLong(1, enzymeId.longValue());
442 deleteByNameStatement.setString(2, displayName);
443 deleteByNameStatement.execute();
444
445
446
447
448 } finally {
449 if (deleteByNameStatement != null) deleteByNameStatement.close();
450 }
451 }
452
453 public void deleteByCodeXref(Long enzymeId, String xrefCode, Connection con) throws SQLException {
454 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
455 if (xrefCode == null) throw new NullPointerException("Parameter 'xrefCode' must not be null.");
456 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
457
458 PreparedStatement deleteByNameStatement = null;
459 if (xrefCode.equals(XrefDatabaseConstant.SWISSPROT.getDatabaseCode())) xrefCode = "S";
460 if (xrefCode.equals(XrefDatabaseConstant.PROSITE.getDatabaseCode())) xrefCode = "P";
461
462 try {
463 deleteByNameStatement = con.prepareStatement(deleteByCodeXrefStatement());
464 deleteByNameStatement.setLong(1, enzymeId.longValue());
465 deleteByNameStatement.setString(2, xrefCode);
466 deleteByNameStatement.execute();
467
468
469
470
471 } finally {
472 if (deleteByNameStatement != null) deleteByNameStatement.close();
473 }
474 }
475
476
477 public void deleteOtherLinks(List<EnzymeLink> links, Long enzymeId, Connection con) throws SQLException {
478 if (links == null) throw new NullPointerException("Parameter 'links' must not be null.");
479 if (enzymeId == null) throw new NullPointerException("Parameter 'enzymeId' must not be null.");
480 if (con == null) throw new NullPointerException("Parameter 'con' must not be null.");
481
482 deleteAll(enzymeId, con);
483 deleteAllXref(enzymeId, con);
484
485 }
486
487
488
489
490
491
492
493
494
495
496
497
498 private EnzymeLink doLoad(ResultSet rs) throws SQLException, DomainException {
499 assert rs != null : "Parameter 'rs' must not be null.";
500
501 EnzymeLink result = null;
502
503 String displayName = "";
504 String url = "";
505 String source = "";
506 String webView = "";
507 String dataComment = null;
508
509 if (rs.getString("display_name") != null) displayName = rs.getString("display_name");
510 if (rs.getString("url") != null) url = rs.getString("url");
511 if (rs.getString("source") != null) source = rs.getString("source");
512 if (rs.getString("web_view") != null) webView = rs.getString("web_view");
513 if (rs.getString("data_comment") != null) dataComment = rs.getString("data_comment");
514
515 if (displayName.equals("UM-BBD")) displayName = "UMBBD";
516 if (displayName.equals("NIST 74")) displayName = "NIST74";
517
518
519 if (displayName.equals(EnzymeLink.BRENDA.getXrefDatabaseConstant().getDatabaseCode())){
520 result = EnzymeLink.BRENDA;
521 } else if (displayName.equals(EnzymeLink.KEGG.getXrefDatabaseConstant().getDatabaseCode())){
522 result = EnzymeLink.KEGG;
523 } else if (displayName.equals(EnzymeLink.EXPASY.getXrefDatabaseConstant().getDatabaseCode())){
524 return null;
525 } else if (displayName.equals(EnzymeLink.GO.getXrefDatabaseConstant().getDatabaseCode())){
526 result = EnzymeLink.GO;
527 } else if (displayName.equals(EnzymeLink.NIST74.getXrefDatabaseConstant().getDisplayName()) ||
528 displayName.equals("GTD")){
529 result = EnzymeLink.NIST74;
530 } else if (displayName.equals(EnzymeLink.ERGO.getXrefDatabaseConstant().getDatabaseCode()) ||
531 displayName.equals(EnzymeLink.WIT.getXrefDatabaseConstant().getDatabaseCode())) {
532 result = EnzymeLink.ERGO;
533 } else if (displayName.equals(XrefDatabaseConstant.CAS.getDatabaseCode())) {
534 if(url.trim().equals("")) return null;
535 result = EnzymeLink.valueOf(XrefDatabaseConstant.CAS, "", url, "",
536 EnzymeSourceConstant.valueOf(source), EnzymeViewConstant.valueOf(webView), dataComment);
537 }
538
539 if (result == null){
540 result = EnzymeLink.valueOf(XrefDatabaseConstant.valueOf(displayName), url, "", "",
541 EnzymeSourceConstant.valueOf(source), EnzymeViewConstant.valueOf(webView), dataComment);
542 } else if (dataComment != null){
543 result = EnzymeLink.valueOf(XrefDatabaseConstant.valueOf(displayName), result.getSpecificUrl(),
544 result.getAccession(), result.getName(), result.getSource(), result.getView(), dataComment);
545 }
546
547 return result;
548 }
549
550
551
552
553
554
555
556
557
558 private EnzymeLink doLoadXref(ResultSet rs) throws SQLException, DomainException {
559 assert rs != null : "Parameter 'rs' must not be null.";
560
561 String databaseCode = "";
562 String accession = "";
563 String name = "";
564 String source = "";
565 String webView = "";
566 String dataComment = null;
567
568 if (rs.getString("database_code") != null) databaseCode = rs.getString("database_code");
569 if (rs.getString("database_ac") != null) accession = rs.getString("database_ac");
570 if (rs.getString("name") != null) name = rs.getString("name");
571 if (rs.getString("source") != null) source = rs.getString("source");
572 if (rs.getString("web_view") != null) webView = rs.getString("web_view");
573 if (rs.getString("data_comment") != null) dataComment = rs.getString("data_comment");
574
575 if (databaseCode.equals("S")) databaseCode = "SWISSPROT";
576 if (databaseCode.equals("P")) databaseCode = "PROSITE";
577 if (databaseCode.equals("DIAGR")) {
578 databaseCode = "DIAGRAM";
579 return EnzymeLink.valueOf(XrefDatabaseConstant.DIAGRAM, accession, "", name,
580 EnzymeSourceConstant.valueOf(source), EnzymeViewConstant.valueOf(webView), dataComment);
581 }
582
583 return EnzymeLink.valueOf(XrefDatabaseConstant.valueOf(databaseCode), "", accession, name,
584 EnzymeSourceConstant.valueOf(source), EnzymeViewConstant.valueOf(webView), dataComment);
585 }
586
587
588
589
590
591
592
593
594
595
596 private void doInsert(EnzymeLink link, Long enzymeId, Status status,
597 PreparedStatement insertStatement) throws SQLException {
598 assert link != null : "Parameter 'link' must not be null.";
599 assert enzymeId != null : "Parameter 'enzymeId' must not be null.";
600 assert status != null : "Parameter 'status' must not be null.";
601 assert insertStatement != null : "Parameter 'insertStatement' must not be null.";
602
603 insertStatement.setLong(1, enzymeId.longValue());
604 if (link.getXrefDatabaseConstant() == XrefDatabaseConstant.CAS) {
605 insertStatement.setString(2, link.getAccession());
606 } else {
607 insertStatement.setString(2, link.getSpecificUrl());
608 }
609 if (link.getXrefDatabaseConstant().equals("NIST74"))
610 insertStatement.setString(3, "GTD");
611 else
612 insertStatement.setString(3, link.getXrefDatabaseConstant().toString());
613 insertStatement.setString(4, status.getCode());
614 insertStatement.setString(5, link.getSource().toString());
615 insertStatement.setString(6, link.getView().toString());
616 if (link.getDataComment() == null || link.getDataComment().equals("")){
617 insertStatement.setNull(7, java.sql.Types.VARCHAR);
618 } else {
619 insertStatement.setString(7, link.getDataComment());
620 }
621 }
622
623 private void doInsertXref(EnzymeLink xref, Long enzymeId, Status status,
624 PreparedStatement insertXrefStatement) throws SQLException {
625 assert xref != null : "Parameter 'xref' must not be null.";
626 assert enzymeId != null : "Parameter 'enzymeId' must not be null.";
627 assert status != null : "Parameter 'status' must not be null.";
628 assert insertXrefStatement != null : "Parameter 'insertXrefStatement' must not be null.";
629
630 String dbCode = xref.getXrefDatabaseConstant().getDatabaseCode();
631 if (dbCode.equals("SWISSPROT")) dbCode = "S";
632 if (dbCode.equals("PROSITE")) dbCode = "P";
633
634 insertXrefStatement.setLong(1, enzymeId.longValue());
635 insertXrefStatement.setString(2, dbCode);
636 if (dbCode.equals("DIAGR"))
637 insertXrefStatement.setString(3, xref.getSpecificUrl());
638 else
639 insertXrefStatement.setString(3, xref.getAccession());
640 insertXrefStatement.setString(4, xref.getName());
641 insertXrefStatement.setString(5, status.getCode());
642 insertXrefStatement.setString(6, xref.getSource().toString());
643 insertXrefStatement.setString(7, xref.getView().toString());
644 if (xref.getDataComment() == null || xref.getDataComment().equals("")){
645 insertXrefStatement.setNull(8, java.sql.Types.VARCHAR);
646 } else {
647 insertXrefStatement.setString(8, xref.getDataComment());
648 }
649 }
650 }