e42b3d6b8d53ce1d0944a6a79be37b30d8835cad
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / excel / common / ExcelImportConfiguratorBase.java
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 java.net.URI;
14
15 import org.apache.log4j.Logger;
16
17 import eu.etaxonomy.cdm.database.ICdmDataSource;
18 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
19 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
20 import eu.etaxonomy.cdm.model.reference.Reference;
21 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
22
23 public abstract class ExcelImportConfiguratorBase
24 extends ImportConfiguratorBase<ExcelImportState, URI>{
25
26 private static final long serialVersionUID = 9031559773350645304L;
27 private static final Logger logger = Logger.getLogger(ExcelImportConfiguratorBase.class);
28
29 //TODO
30 private static IInputTransformer defaultTransformer = null;
31 private byte[] stream;
32
33 /**
34 * @param url
35 * @param destination
36 */
37 protected ExcelImportConfiguratorBase(URI uri, ICdmDataSource destination) {
38 this(uri, destination, defaultTransformer);
39 }
40
41 /**
42 * @param url
43 * @param destination
44 */
45 protected ExcelImportConfiguratorBase(URI uri, ICdmDataSource destination, IInputTransformer transformer) {
46 super(transformer);
47 setSource(uri);
48 setDestination(destination);
49 }
50
51 @Override
52 public Reference getSourceReference() {
53 //TODO
54 if (this.sourceReference == null){
55 logger.warn("getSource Reference not yet fully implemented");
56 sourceReference = ReferenceFactory.newDatabase();
57 sourceReference.setTitleCache("Excel import " + getDateString(), true);
58 }
59 return sourceReference;
60 }
61
62 public boolean isReuseExistingTaxaWhenPossible() {
63 return false;
64 }
65 public byte[] getStream(){
66 return stream;
67 }
68
69
70 public void setStream(byte[] stream) {
71 this.stream = stream;
72 }
73 }