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.excel.taxa;
|
11
|
|
12
|
|
13
|
import java.net.URI;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
18
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
19
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
|
20
|
import eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator;
|
21
|
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
|
22
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
23
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
24
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
25
|
|
26
|
public class NormalExplicitImportConfigurator extends ExcelImportConfiguratorBase implements IImportConfigurator, IMatchingImportConfigurator {
|
27
|
private static final Logger logger = Logger.getLogger(NormalExplicitImportConfigurator.class);
|
28
|
|
29
|
private boolean isDoMatchTaxa = true;
|
30
|
|
31
|
|
32
|
// @SuppressWarnings("unchecked")
|
33
|
protected void makeIoClassList() {
|
34
|
ioClassList = new Class[] {
|
35
|
NormalExplicitImport.class
|
36
|
};
|
37
|
};
|
38
|
|
39
|
public static NormalExplicitImportConfigurator NewInstance(URI uri, ICdmDataSource destination,
|
40
|
NomenclaturalCode nomenclaturalCode, DbSchemaValidation dbSchemaValidation){
|
41
|
return new NormalExplicitImportConfigurator(uri, destination, nomenclaturalCode, dbSchemaValidation);
|
42
|
}
|
43
|
|
44
|
|
45
|
/**
|
46
|
* @param url
|
47
|
* @param destination
|
48
|
*/
|
49
|
private NormalExplicitImportConfigurator(URI uri, ICdmDataSource destination, NomenclaturalCode nomenclaturalCode, DbSchemaValidation dbSchemaValidation) {
|
50
|
super(uri, destination);
|
51
|
if (dbSchemaValidation == null){
|
52
|
dbSchemaValidation = DbSchemaValidation.CREATE;
|
53
|
}
|
54
|
setSource(uri);
|
55
|
setDestination(destination);
|
56
|
setDbSchemaValidation(dbSchemaValidation);
|
57
|
setNomenclaturalCode(nomenclaturalCode);
|
58
|
}
|
59
|
|
60
|
|
61
|
|
62
|
|
63
|
/* (non-Javadoc)
|
64
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
65
|
*/
|
66
|
public TaxonExcelImportState getNewState() {
|
67
|
return new TaxonExcelImportState(this);
|
68
|
}
|
69
|
|
70
|
|
71
|
/* (non-Javadoc)
|
72
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
73
|
*/
|
74
|
@Override
|
75
|
public Reference getSourceReference() {
|
76
|
//TODO
|
77
|
if (this.sourceReference == null){
|
78
|
logger.warn("getSource Reference not yet fully implemented");
|
79
|
sourceReference = ReferenceFactory.newGeneric();
|
80
|
sourceReference.setTitleCache("Excel Taxon import", true);
|
81
|
}
|
82
|
return sourceReference;
|
83
|
}
|
84
|
|
85
|
|
86
|
public boolean isDoMatchTaxa() {
|
87
|
return isDoMatchTaxa;
|
88
|
}
|
89
|
|
90
|
public void setDoMatchTaxa(boolean isDoMatchTaxa) {
|
91
|
this.isDoMatchTaxa = isDoMatchTaxa;
|
92
|
}
|
93
|
|
94
|
}
|