1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.io.berlinModel.in.validation;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportState;
|
15
|
import eu.etaxonomy.cdm.io.common.IOValidator;
|
16
|
|
17
|
/**
|
18
|
* @author a.mueller
|
19
|
* @since 17.02.2010
|
20
|
*/
|
21
|
public class BerlinModelAreaImportValidator implements IOValidator<BerlinModelImportState> {
|
22
|
@SuppressWarnings("unused")
|
23
|
private static final Logger logger = Logger.getLogger(BerlinModelAreaImportValidator.class);
|
24
|
|
25
|
@Override
|
26
|
public boolean validate(BerlinModelImportState state) {
|
27
|
boolean result = true;
|
28
|
// BerlinModelImportConfigurator config = state.getConfig();
|
29
|
// result &= checkSourcesWithWhitespace(config);
|
30
|
return result;
|
31
|
}
|
32
|
|
33
|
|
34
|
//******************************** CHECK *************************************************
|
35
|
|
36
|
|
37
|
// private static boolean checkSourcesWithWhitespace(BerlinModelImportConfigurator config){
|
38
|
// try {
|
39
|
// boolean result = true;
|
40
|
// Source source = config.getSource();
|
41
|
// String strSelect = "SELECT OccurrenceId, PTNameFk, PTRefFk, AreaFk, Sources, Created_When, Created_Who, Updated_When, Updated_Who, Notes, Occurrence ";
|
42
|
// String strCount = " SELECT count(*) as n";
|
43
|
// String strQueryBase =
|
44
|
// " FROM emOccurrence " +
|
45
|
// " WHERE (Sources LIKE '% %') OR (Sources LIKE '% ') OR (Sources LIKE ' %') ";
|
46
|
//
|
47
|
// ResultSet rs = source.getResultSet(strCount + strQueryBase);
|
48
|
// rs.next();
|
49
|
// int n = rs.getInt("n");
|
50
|
// if (n > 0){
|
51
|
// System.out.println("=======================================================================");
|
52
|
// System.out.println("There are "+n+" occurrences with source attribute has unexpected whitespace!");
|
53
|
// System.out.println("---------------------------------------------------------------");
|
54
|
// System.out.println(strSelect + strQueryBase);
|
55
|
// System.out.println("=======================================================================");
|
56
|
// }
|
57
|
//
|
58
|
// rs = source.getResultSet(strSelect + strQueryBase);
|
59
|
// while (rs.next()){
|
60
|
// int occurrenceId = rs.getInt("OccurrenceId");
|
61
|
// String sources = rs.getString("Sources");
|
62
|
//
|
63
|
// System.out.println("OccurrenceSourceId:" + occurrenceId +
|
64
|
// "\n Sources: " + sources)
|
65
|
// ;
|
66
|
// }
|
67
|
// return result;
|
68
|
// } catch (SQLException e) {
|
69
|
// e.printStackTrace();
|
70
|
// return false;
|
71
|
// }
|
72
|
// }
|
73
|
}
|