Project

General

Profile

Download (3.43 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 org.apache.log4j.Logger;
14

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

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

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

    
88
}
(1-1/3)