1
|
/**
|
2
|
* Copyright (C) 2008 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
|
package eu.etaxonomy.cdm.io.excel.distribution;
|
10
|
|
11
|
import org.apache.log4j.Logger;
|
12
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
13
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
|
14
|
import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
|
15
|
import eu.etaxonomy.cdm.io.common.ImportStateBase;
|
16
|
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
|
17
|
import eu.etaxonomy.cdm.io.excel.common.ExcelImportState;
|
18
|
import eu.etaxonomy.cdm.model.reference.IDatabase;
|
19
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
20
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
21
|
|
22
|
/**
|
23
|
* @author a.babadshanjan
|
24
|
* @created 10.11.2008
|
25
|
* @version 1.0
|
26
|
*/
|
27
|
public class DistributionImportConfigurator extends ExcelImportConfiguratorBase implements IImportConfigurator {
|
28
|
|
29
|
private static final Logger logger = Logger.getLogger(DistributionImportConfigurator.class);
|
30
|
|
31
|
@SuppressWarnings("unchecked")
|
32
|
protected void makeIoClassList() {
|
33
|
ioClassList = new Class[] {
|
34
|
DistributionImport.class
|
35
|
};
|
36
|
};
|
37
|
|
38
|
public static DistributionImportConfigurator NewInstance(String url,
|
39
|
ICdmDataSource destination){
|
40
|
return new DistributionImportConfigurator(url, destination);
|
41
|
}
|
42
|
|
43
|
|
44
|
/**
|
45
|
* @param url
|
46
|
* @param destination
|
47
|
*/
|
48
|
private DistributionImportConfigurator(String url, ICdmDataSource destination) {
|
49
|
super(url, destination);
|
50
|
}
|
51
|
|
52
|
|
53
|
|
54
|
|
55
|
/* (non-Javadoc)
|
56
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
|
57
|
*/
|
58
|
public ExcelImportState getNewState() {
|
59
|
return new ExcelImportState(this);
|
60
|
}
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
|
64
|
*/
|
65
|
public String getSource() {
|
66
|
return (String)super.getSource();
|
67
|
}
|
68
|
|
69
|
|
70
|
/**
|
71
|
* @param file
|
72
|
*/
|
73
|
public void setSource(String fileName) {
|
74
|
super.setSource(fileName);
|
75
|
}
|
76
|
|
77
|
|
78
|
/* (non-Javadoc)
|
79
|
* @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
|
80
|
*/
|
81
|
@Override
|
82
|
public ReferenceBase getSourceReference() {
|
83
|
//TODO
|
84
|
if (this.sourceReference == null){
|
85
|
logger.warn("getSource Reference not yet fully implemented");
|
86
|
ReferenceFactory refFactory = ReferenceFactory.newInstance();
|
87
|
sourceReference = refFactory.newDatabase();
|
88
|
sourceReference.setTitleCache("Distribution data import", true);
|
89
|
}
|
90
|
return sourceReference;
|
91
|
}
|
92
|
|
93
|
|
94
|
/* (non-Javadoc)
|
95
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
96
|
*/
|
97
|
public String getSourceNameString() {
|
98
|
if (this.getSource() == null){
|
99
|
return null;
|
100
|
}else{
|
101
|
return this.getSource();
|
102
|
}
|
103
|
}
|
104
|
|
105
|
}
|