smaller changes in specimen import and excel import
[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 private boolean deduplicateReferences = true;
33 private boolean deduplicateAuthors = false;
34 /**
35 * @param url
36 * @param destination
37 */
38 protected ExcelImportConfiguratorBase(URI uri, ICdmDataSource destination) {
39 this(uri, destination, defaultTransformer);
40 }
41
42 /**
43 * @param url
44 * @param destination
45 */
46 protected ExcelImportConfiguratorBase(URI uri, ICdmDataSource destination, IInputTransformer transformer) {
47 super(transformer);
48 setSource(uri);
49 setDestination(destination);
50 }
51
52 @Override
53 public Reference getSourceReference() {
54 //TODO
55 if (this.sourceReference == null){
56 logger.warn("getSource Reference not yet fully implemented");
57 sourceReference = ReferenceFactory.newDatabase();
58 sourceReference.setTitleCache("Excel import " + getDateString(), true);
59 }
60 return sourceReference;
61 }
62
63 public boolean isReuseExistingTaxaWhenPossible() {
64 return false;
65 }
66 public byte[] getStream(){
67 return stream;
68 }
69
70
71 public void setStream(byte[] stream) {
72 this.stream = stream;
73 }
74
75 /**
76 * @return the deduplicateReferences
77 */
78 public boolean isDeduplicateReferences() {
79 return deduplicateReferences;
80 }
81
82 /**
83 * @param deduplicateReferences the deduplicateReferences to set
84 */
85 public void setDeduplicateReferences(boolean deduplicateReferences) {
86 this.deduplicateReferences = deduplicateReferences;
87 }
88
89 public boolean isDeduplicateAuthors() {
90 return deduplicateAuthors;
91 }
92
93 public void setDeduplicateAuthors(boolean deduplicateAuthors) {
94 this.deduplicateAuthors = deduplicateAuthors;
95 }
96 }