a21b13ceac3dc300776383e18722e9a8d113844f
[cdmlib.git] / app-import / src / main / java / eu / etaxonomy / cdm / io / globis / validation / GlobisReferenceImportValidator.java
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 java.sql.ResultSet;
14 import java.sql.SQLException;
15
16 import org.apache.log4j.Logger;
17
18
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;
25
26 /**
27 * @author a.mueller
28 * @created 17.02.2010
29 * @version 1.0
30 */
31 public class GlobisReferenceImportValidator implements IOValidator<GlobisImportState>{
32 private static final Logger logger = Logger.getLogger(GlobisReferenceImportValidator.class);
33
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);
40 return result;
41 }
42
43 // private boolean checkTaxonStatus(GlobisImportConfigurator bmiConfig){
44 // try {
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;
55 // int i = 0;
56 // while (rs.next()){
57 // i++;
58 // if (firstRow){
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("========================================================");
62 // }
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");
68 //
69 // System.out.println("RIdentifier:" + rIdentifier + "\n name: " + nameFk +
70 // "\n taxonName: " + taxonName + "\n refId: " + refFk + "\n RelPTaxonId: " + relPTaxonId );
71 // result = firstRow = false;
72 // }
73 // if (i > 0){
74 // System.out.println(" ");
75 // }
76 //
77 // return result;
78 // } catch (SQLException e) {
79 // e.printStackTrace();
80 // return false;
81 // }
82 // }
83 //
84
85
86 }