3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.io
.globis
.validation
;
13 import java
.sql
.ResultSet
;
14 import java
.sql
.SQLException
;
16 import org
.apache
.log4j
.Logger
;
19 import eu
.etaxonomy
.cdm
.io
.common
.IOValidator
;
20 import eu
.etaxonomy
.cdm
.io
.common
.Source
;
21 import eu
.etaxonomy
.cdm
.io
.erms
.ErmsImportConfigurator
;
22 import eu
.etaxonomy
.cdm
.io
.erms
.ErmsImportState
;
23 import eu
.etaxonomy
.cdm
.io
.globis
.GlobisImportConfigurator
;
24 import eu
.etaxonomy
.cdm
.io
.globis
.GlobisImportState
;
31 public class GlobisReferenceImportValidator
implements IOValidator
<GlobisImportState
>{
32 private static final Logger logger
= Logger
.getLogger(GlobisReferenceImportValidator
.class);
34 public boolean validate(GlobisImportState state
){
35 boolean result
= true;
36 GlobisImportConfigurator config
= state
.getConfig();
37 logger
.warn("Checking for references not yet fully implemented");
38 // result &= checkTaxonStatus(config);
39 // result &= checkInactivated(config);
43 // private boolean checkTaxonStatus(GlobisImportConfigurator bmiConfig){
45 // boolean result = true;
46 // Source source = bmiConfig.getSource();
47 // String strSQL = " SELECT RelPTaxon.RelQualifierFk, RelPTaxon.relPTaxonId, PTaxon.PTNameFk, PTaxon.PTRefFk, PTaxon_1.PTNameFk AS Expr1, PTaxon.RIdentifier, PTaxon_1.RIdentifier AS Expr3, Name.FullNameCache " +
48 // " FROM RelPTaxon " +
49 // " INNER JOIN PTaxon ON RelPTaxon.PTNameFk1 = PTaxon.PTNameFk AND RelPTaxon.PTRefFk1 = PTaxon.PTRefFk " +
50 // " INNER JOIN PTaxon AS PTaxon_1 ON RelPTaxon.PTNameFk2 = PTaxon_1.PTNameFk AND RelPTaxon.PTRefFk2 = PTaxon_1.PTRefFk " +
51 // " INNER JOIN Name ON PTaxon.PTNameFk = Name.NameId " +
52 // " WHERE (dbo.PTaxon.StatusFk = 1) AND ((RelPTaxon.RelQualifierFk = 7) OR (RelPTaxon.RelQualifierFk = 6) OR (RelPTaxon.RelQualifierFk = 2)) ";
53 // ResultSet rs = source.getResultSet(strSQL);
54 // boolean firstRow = true;
59 // System.out.println("========================================================");
60 // logger.warn("There are taxa that have a 'is synonym of' - relationship but having taxon status 'accepted'!");
61 // System.out.println("========================================================");
63 // int rIdentifier = rs.getInt("RIdentifier");
64 // int nameFk = rs.getInt("PTNameFk");
65 // int refFk = rs.getInt("PTRefFk");
66 // int relPTaxonId = rs.getInt("relPTaxonId");
67 // String taxonName = rs.getString("FullNameCache");
69 // System.out.println("RIdentifier:" + rIdentifier + "\n name: " + nameFk +
70 // "\n taxonName: " + taxonName + "\n refId: " + refFk + "\n RelPTaxonId: " + relPTaxonId );
71 // result = firstRow = false;
74 // System.out.println(" ");
78 // } catch (SQLException e) {
79 // e.printStackTrace();