Project

General

Profile

« Previous | Next » 

Revision 75860da7

Added by Andreas Müller over 5 years ago

cleanup ERMS validators

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/validation/ErmsRankImportValidator.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
14 14

  
15 15
import org.apache.log4j.Logger;
16 16

  
17

  
18 17
import eu.etaxonomy.cdm.io.common.IOValidator;
19 18
import eu.etaxonomy.cdm.io.common.Source;
20 19
import eu.etaxonomy.cdm.io.pesi.erms.ErmsImportConfigurator;
......
23 22
/**
24 23
 * @author a.mueller
25 24
 * @since 17.02.2010
26
 * @version 1.0
27 25
 */
28 26
public class ErmsRankImportValidator implements IOValidator<ErmsImportState>{
29 27
	private static final Logger logger = Logger.getLogger(ErmsRankImportValidator.class);
30 28

  
31
	public boolean validate(ErmsImportState state){
29
	@Override
30
    public boolean validate(ErmsImportState state){
32 31
		boolean result = true;
33 32
		ErmsImportConfigurator config = state.getConfig();
34 33
		logger.info("Checking for ranks not yet fully implemented");
35 34
		//TODO ranks with not existing kingdoms (e.g. kingdom_id = 8)
36
		
35

  
37 36
		return result;
38 37
	}
39
	
38

  
40 39
	private boolean checkTaxonStatus(ErmsImportConfigurator bmiConfig){
41 40
		try {
42 41
			boolean result = true;
43 42
			Source source = bmiConfig.getSource();
44 43
			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 "  +
45
				" FROM RelPTaxon " + 
46
					" INNER JOIN PTaxon ON RelPTaxon.PTNameFk1 = PTaxon.PTNameFk AND RelPTaxon.PTRefFk1 = PTaxon.PTRefFk " + 
47
					" INNER JOIN PTaxon AS PTaxon_1 ON RelPTaxon.PTNameFk2 = PTaxon_1.PTNameFk AND RelPTaxon.PTRefFk2 = PTaxon_1.PTRefFk  " + 
44
				" FROM RelPTaxon " +
45
					" INNER JOIN PTaxon ON RelPTaxon.PTNameFk1 = PTaxon.PTNameFk AND RelPTaxon.PTRefFk1 = PTaxon.PTRefFk " +
46
					" INNER JOIN PTaxon AS PTaxon_1 ON RelPTaxon.PTNameFk2 = PTaxon_1.PTNameFk AND RelPTaxon.PTRefFk2 = PTaxon_1.PTRefFk  " +
48 47
					" INNER JOIN Name ON PTaxon.PTNameFk = Name.NameId " +
49 48
				" WHERE (dbo.PTaxon.StatusFk = 1) AND ((RelPTaxon.RelQualifierFk = 7) OR (RelPTaxon.RelQualifierFk = 6) OR (RelPTaxon.RelQualifierFk = 2)) ";
50 49
			ResultSet rs = source.getResultSet(strSQL);
......
62 61
				int refFk = rs.getInt("PTRefFk");
63 62
				int relPTaxonId = rs.getInt("relPTaxonId");
64 63
				String taxonName = rs.getString("FullNameCache");
65
				
66
				System.out.println("RIdentifier:" + rIdentifier + "\n  name: " + nameFk + 
64

  
65
				System.out.println("RIdentifier:" + rIdentifier + "\n  name: " + nameFk +
67 66
						"\n  taxonName: " + taxonName + "\n  refId: " + refFk + "\n  RelPTaxonId: " + relPTaxonId );
68 67
				result = firstRow = false;
69 68
			}
70 69
			if (i > 0){
71 70
				System.out.println(" ");
72 71
			}
73
			
72

  
74 73
			return result;
75 74
		} catch (SQLException e) {
76 75
			e.printStackTrace();
77 76
			return false;
78 77
		}
79 78
	}
80

  
81

  
82

  
83 79
}

Also available in: Unified diff