1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
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.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.io.globis.validation;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.io.common.IOValidator;
|
16
|
import eu.etaxonomy.cdm.io.globis.GlobisImportConfigurator;
|
17
|
import eu.etaxonomy.cdm.io.globis.GlobisImportState;
|
18
|
|
19
|
/**
|
20
|
* @author a.mueller
|
21
|
* @created 17.02.2010
|
22
|
* @version 1.0
|
23
|
*/
|
24
|
public class GlobisReferenceImportValidator implements IOValidator<GlobisImportState>{
|
25
|
private static final Logger logger = Logger.getLogger(GlobisReferenceImportValidator.class);
|
26
|
|
27
|
public boolean validate(GlobisImportState state){
|
28
|
boolean result = true;
|
29
|
GlobisImportConfigurator config = state.getConfig();
|
30
|
logger.warn("Checking for references not yet fully implemented");
|
31
|
// result &= checkTaxonStatus(config);
|
32
|
// result &= checkInactivated(config);
|
33
|
return result;
|
34
|
}
|
35
|
|
36
|
// private boolean checkTaxonStatus(GlobisImportConfigurator bmiConfig){
|
37
|
// try {
|
38
|
// boolean result = true;
|
39
|
// Source source = bmiConfig.getSource();
|
40
|
// 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 " +
|
41
|
// " FROM RelPTaxon " +
|
42
|
// " INNER JOIN PTaxon ON RelPTaxon.PTNameFk1 = PTaxon.PTNameFk AND RelPTaxon.PTRefFk1 = PTaxon.PTRefFk " +
|
43
|
// " INNER JOIN PTaxon AS PTaxon_1 ON RelPTaxon.PTNameFk2 = PTaxon_1.PTNameFk AND RelPTaxon.PTRefFk2 = PTaxon_1.PTRefFk " +
|
44
|
// " INNER JOIN Name ON PTaxon.PTNameFk = Name.NameId " +
|
45
|
// " WHERE (dbo.PTaxon.StatusFk = 1) AND ((RelPTaxon.RelQualifierFk = 7) OR (RelPTaxon.RelQualifierFk = 6) OR (RelPTaxon.RelQualifierFk = 2)) ";
|
46
|
// ResultSet rs = source.getResultSet(strSQL);
|
47
|
// boolean firstRow = true;
|
48
|
// int i = 0;
|
49
|
// while (rs.next()){
|
50
|
// i++;
|
51
|
// if (firstRow){
|
52
|
// System.out.println("========================================================");
|
53
|
// logger.warn("There are taxa that have a 'is synonym of' - relationship but having taxon status 'accepted'!");
|
54
|
// System.out.println("========================================================");
|
55
|
// }
|
56
|
// int rIdentifier = rs.getInt("RIdentifier");
|
57
|
// int nameFk = rs.getInt("PTNameFk");
|
58
|
// int refFk = rs.getInt("PTRefFk");
|
59
|
// int relPTaxonId = rs.getInt("relPTaxonId");
|
60
|
// String taxonName = rs.getString("FullNameCache");
|
61
|
//
|
62
|
// System.out.println("RIdentifier:" + rIdentifier + "\n name: " + nameFk +
|
63
|
// "\n taxonName: " + taxonName + "\n refId: " + refFk + "\n RelPTaxonId: " + relPTaxonId );
|
64
|
// result = firstRow = false;
|
65
|
// }
|
66
|
// if (i > 0){
|
67
|
// System.out.println(" ");
|
68
|
// }
|
69
|
//
|
70
|
// return result;
|
71
|
// } catch (SQLException e) {
|
72
|
// e.printStackTrace();
|
73
|
// return false;
|
74
|
// }
|
75
|
// }
|
76
|
//
|
77
|
|
78
|
|
79
|
}
|