Project

General

Profile

Download (2.98 KB) Statistics
| Branch: | Tag: | 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.excel.taxa;
11

    
12

    
13
import org.apache.log4j.Logger;
14

    
15
import eu.etaxonomy.cdm.database.DbSchemaValidation;
16
import eu.etaxonomy.cdm.database.ICdmDataSource;
17
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
18
import eu.etaxonomy.cdm.io.excel.common.ExcelImportConfiguratorBase;
19
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
20
import eu.etaxonomy.cdm.model.reference.IDatabase;
21
import eu.etaxonomy.cdm.model.reference.IGeneric;
22
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
23
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
24

    
25
public class NormalExplicitImportConfigurator extends ExcelImportConfiguratorBase implements IImportConfigurator {
26
	private static final Logger logger = Logger.getLogger(NormalExplicitImportConfigurator.class);
27
	
28
//	@SuppressWarnings("unchecked")
29
	protected void makeIoClassList() {
30
		ioClassList = new Class[] {
31
				NormalExplicitImport.class
32
		};
33
	};
34
	
35
	public static NormalExplicitImportConfigurator NewInstance(String url,
36
			ICdmDataSource destination, NomenclaturalCode nomenclaturalCode){
37
		return new NormalExplicitImportConfigurator(url, destination, nomenclaturalCode);
38
	}
39
	
40
	
41
	/**
42
	 * @param url
43
	 * @param destination
44
	 */
45
	private NormalExplicitImportConfigurator(String url, ICdmDataSource destination, NomenclaturalCode nomenclaturalCode) {
46
		super(url, destination);
47
		setSource(url);
48
		setDestination(destination);
49
		setDbSchemaValidation(DbSchemaValidation.CREATE);
50
		setNomenclaturalCode(nomenclaturalCode);
51
	}
52
	
53
	
54
	
55

    
56
	/* (non-Javadoc)
57
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
58
	 */
59
	public TaxonExcelImportState getNewState() {
60
		return new TaxonExcelImportState(this);
61
	}
62

    
63
	/* (non-Javadoc)
64
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
65
	 */
66
	public String getSource() {
67
		return (String)super.getSource();
68
	}
69

    
70
	
71
	/**
72
	 * @param file
73
	 */
74
	public void setSource(String fileName) {
75
		super.setSource(fileName);
76
	}
77
	
78

    
79
	/* (non-Javadoc)
80
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
81
	 */
82
	@Override
83
	public ReferenceBase getSourceReference() {
84
		//TODO
85
		if (this.sourceReference == null){
86
			logger.warn("getSource Reference not yet fully implemented");
87
			ReferenceFactory refFactory = ReferenceFactory.newInstance();
88
			sourceReference = refFactory.newGeneric();
89
			sourceReference.setTitleCache("Excel Taxon import", true);
90
		}
91
		return sourceReference;
92
	}
93

    
94

    
95
	/* (non-Javadoc)
96
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
97
	 */
98
	public String getSourceNameString() {
99
		if (this.getSource() == null){
100
			return null;
101
		}else{
102
			return this.getSource();
103
		}
104
	}
105
	
106
}
(2-2/5)