Project

General

Profile

Download (3.57 KB) Statistics
| Branch: | Revision:
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.algaterra.validation;
12

    
13
import java.sql.ResultSet;
14
import java.sql.SQLException;
15

    
16
import org.apache.commons.lang.StringUtils;
17
import org.apache.log4j.Logger;
18

    
19
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
20
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportState;
21
import eu.etaxonomy.cdm.io.common.IOValidator;
22
import eu.etaxonomy.cdm.io.common.Source;
23

    
24
/**
25
 * @author a.mueller
26
 * @created 17.02.2010
27
 * @version 1.0
28
 */
29
public class AlgaTerraSpecimenImportValidator implements IOValidator<BerlinModelImportState> {
30
	private static final Logger logger = Logger.getLogger(AlgaTerraSpecimenImportValidator.class);
31

    
32
	/* (non-Javadoc)
33
	 * @see eu.etaxonomy.cdm.io.common.IOValidator#validate(eu.etaxonomy.cdm.io.common.IoStateBase)
34
	 */
35
	public boolean validate(BerlinModelImportState state) {
36
		boolean result = true;
37
		BerlinModelImportConfigurator bmiConfig = state.getConfig();
38
//		result &= checkTaxonIsAccepted(bmiConfig);
39
		//result &= checkPartOfJournal(bmiConfig);
40
		System.out.println("Checking for Specimen not yet fully implemented");
41
		return result;
42
	}
43
	
44
	
45
	//******************************** CHECK *************************************************
46
		
47
//		private static boolean checkTaxonIsAccepted(BerlinModelImportConfigurator config){
48
//			try {
49
//				boolean result = true;
50
//				Source source = config.getSource();
51
//				String strQuery = "SELECT emOccurrence.OccurrenceId, PTaxon.StatusFk, Name.FullNameCache, Status.Status, PTaxon.PTRefFk, Reference.RefCache " + 
52
//							" FROM emOccurrence INNER JOIN " +
53
//								" PTaxon ON emOccurrence.PTNameFk = PTaxon.PTNameFk AND emOccurrence.PTRefFk = PTaxon.PTRefFk INNER JOIN " + 
54
//				                " Name ON PTaxon.PTNameFk = Name.NameId INNER JOIN " +
55
//				                " Status ON PTaxon.StatusFk = Status.StatusId LEFT OUTER JOIN " +
56
//				                " Reference ON PTaxon.PTRefFk = Reference.RefId " + 
57
//							" WHERE (PTaxon.StatusFk <> 1)  ";
58
//
59
//				if (StringUtils.isNotBlank(config.getOccurrenceFilter())){
60
//					strQuery += String.format(" AND (%s) ", config.getOccurrenceFilter()) ; 
61
//				}
62
//
63
//				
64
//				ResultSet resulSet = source.getResultSet(strQuery);
65
//				boolean firstRow = true;
66
//				while (resulSet.next()){
67
//					if (firstRow){
68
//						System.out.println("========================================================");
69
//						System.out.println("There are Occurrences for a taxon that is not accepted!");
70
//						System.out.println("========================================================");
71
//					}
72
//					int occurrenceId = resulSet.getInt("OccurrenceId");
73
////					int statusFk = resulSet.getInt("StatusFk");
74
//					String status = resulSet.getString("Status");
75
//					String fullNameCache = resulSet.getString("FullNameCache");
76
//					String ptRefFk = resulSet.getString("PTRefFk");
77
//					String ptRef = resulSet.getString("RefCache");
78
//					
79
//					System.out.println("OccurrenceId:" + occurrenceId + "\n  Status: " + status + 
80
//							"\n  FullNameCache: " + fullNameCache +  "\n  ptRefFk: " + ptRefFk +
81
//							"\n  sec: " + ptRef );
82
//					
83
//					result = firstRow = false;
84
//				}
85
//				
86
//				return result;
87
//			} catch (SQLException e) {
88
//				e.printStackTrace();
89
//				return false;
90
//			}
91
//		}
92

    
93
}
    (1-1/1)