View Javadoc

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.common;
11  
12  
13  import org.apache.log4j.Logger;
14  
15  import eu.etaxonomy.cdm.database.ICdmDataSource;
16  import eu.etaxonomy.cdm.io.common.IImportConfigurator;
17  import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
18  import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
19  import eu.etaxonomy.cdm.model.reference.ReferenceBase;
20  import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
21  
22  public abstract class ExcelImportConfiguratorBase extends ImportConfiguratorBase implements IImportConfigurator{
23  	private static final Logger logger = Logger.getLogger(ExcelImportConfiguratorBase.class);
24  	
25  	//TODO
26  	private static IInputTransformer defaultTransformer = null;
27  
28  	/**
29  	 * @param url
30  	 * @param destination
31  	 */
32  	protected ExcelImportConfiguratorBase(String url, ICdmDataSource destination) {
33  		super(defaultTransformer);
34  		setSource(url);
35  		setDestination(destination);
36  	}
37  	
38  
39  	/* (non-Javadoc)
40  	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
41  	 */
42  	public String getSource() {
43  		return (String)super.getSource();
44  	}
45  
46  	
47  	/**
48  	 * @param file
49  	 */
50  	public void setSource(String fileName) {
51  		super.setSource(fileName);
52  	}
53  	
54  
55  	/* (non-Javadoc)
56  	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
57  	 */
58  	@Override
59  	public ReferenceBase getSourceReference() {
60  		//TODO
61  		if (this.sourceReference == null){
62  			logger.warn("getSource Reference not yet fully implemented");
63  			ReferenceFactory refFactory = ReferenceFactory.newInstance();
64  			sourceReference = refFactory.newDatabase();
65  			sourceReference.setTitleCache("Distribution data import", true);
66  		}
67  		return sourceReference;
68  	}
69  
70  
71  	/* (non-Javadoc)
72  	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
73  	 */
74  	public String getSourceNameString() {
75  		if (this.getSource() == null){
76  			return null;
77  		}else{
78  			return this.getSource();
79  		}
80  	}
81  	
82  }