Project

General

Profile

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

    
12
import org.apache.log4j.Logger;
13

    
14
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
15
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportState;
16
import eu.etaxonomy.cdm.io.common.IOValidator;
17

    
18
/**
19
 * @author a.mueller
20
 * @since 17.02.2010
21
 * @version 1.0
22
 */
23
public class AlgaTerraCollectionImportValidator implements IOValidator<BerlinModelImportState> {
24
	private static final Logger logger = Logger.getLogger(AlgaTerraCollectionImportValidator.class);
25

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

    
87
}
(1-1/5)