Project

General

Profile

Download (2.88 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.ReferenceBase;
21
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
22

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

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

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

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

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

    
92

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