2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.io
.specimen
.excel
.in
;
14 import java
.util
.HashMap
;
16 import java
.util
.UUID
;
18 import org
.apache
.log4j
.Logger
;
20 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
21 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
;
22 import eu
.etaxonomy
.cdm
.io
.common
.ImportConfiguratorBase
;
23 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
24 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
25 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
26 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
27 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
34 public class SpecimenSynthesysExcelImportConfigurator
extends ImportConfiguratorBase
<SpecimenSynthesysExcelImportState
, URI
> implements IImportConfigurator
{
35 private static final Logger logger
= Logger
.getLogger(SpecimenSynthesysExcelImportConfigurator
.class);
36 private boolean doParsing
= false;
37 private boolean reuseMetadata
= false;
38 private boolean reuseTaxon
= false;
39 private String taxonReference
= null;
40 private boolean askForDate
= false;
41 private Map
<String
, Team
> titleCacheTeam
;
42 private Map
<String
, Person
> titleCachePerson
;
43 private String defaultAuthor
="";
45 private Map
<String
,UUID
> namedAreaDecisions
= new HashMap
<String
,UUID
>();
46 private Reference
<?
> dataReference
;
47 private boolean debugInstitutionOnly
= false;
51 * @return the debugInstitutionOnly
53 public boolean isDebugInstitutionOnly() {
54 return debugInstitutionOnly
;
58 private static IInputTransformer defaultTransformer
= null;
62 @SuppressWarnings("unchecked")
63 protected void makeIoClassList(){
64 ioClassList
= new Class
[]{
65 SpecimenSythesysExcelImport
.class,
69 public static SpecimenSynthesysExcelImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
){
70 return new SpecimenSynthesysExcelImportConfigurator(uri
, destination
);
73 public static SpecimenSynthesysExcelImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
, boolean interact
){
74 return new SpecimenSynthesysExcelImportConfigurator(uri
, destination
,interact
);
79 * @param berlinModelSource
80 * @param sourceReference
83 private SpecimenSynthesysExcelImportConfigurator(URI uri
, ICdmDataSource destination
) {
84 super(defaultTransformer
);
86 setDestination(destination
);
91 * @param berlinModelSource
92 * @param sourceReference
95 private SpecimenSynthesysExcelImportConfigurator(URI uri
, ICdmDataSource destination
, boolean interact
) {
96 super(defaultTransformer
);
98 setDestination(destination
);
99 setInteractWithUser(interact
);
105 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
108 public SpecimenSynthesysExcelImportState
getNewState() {
109 return new SpecimenSynthesysExcelImportState(this);
114 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
117 public Reference
getSourceReference() {
119 if (this.sourceReference
== null){
120 logger
.warn("getSource Reference not yet fully implemented");
121 sourceReference
= ReferenceFactory
.newDatabase();
122 sourceReference
.setTitleCache("Specimen import", true);
124 return sourceReference
;
127 public void setTaxonReference(String taxonReference
) {
128 this.taxonReference
= taxonReference
;
131 public Reference
getTaxonReference() {
133 if (this.taxonReference
== null){
134 logger
.info("getTaxonReference not yet fully implemented");
136 return sourceReference
;
141 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
144 public String
getSourceNameString() {
145 if (this.getSource() == null){
148 return this.getSource().toString();
152 public void setDoAutomaticParsing(boolean doParsing
){
153 this.doParsing
=doParsing
;
156 public boolean getDoAutomaticParsing(){
157 return this.doParsing
;
160 public void setReUseExistingMetadata(boolean reuseMetadata
){
161 this.reuseMetadata
= reuseMetadata
;
164 public boolean getReUseExistingMetadata(){
165 return this.reuseMetadata
;
168 public void setReUseTaxon(boolean reuseTaxon
){
169 this.reuseTaxon
= reuseTaxon
;
172 public boolean getDoReUseTaxon(){
173 return this.reuseTaxon
;
176 public boolean doAskForDate() {
180 public void setAskForDate(boolean askForDate
) {
181 this.askForDate
= askForDate
;
185 * @param titleCacheTeam
187 public void setTeams(Map
<String
, Team
> titleCacheTeam
) {
188 this.titleCacheTeam
= titleCacheTeam
;
189 System
.out
.println(titleCacheTeam
);
194 * @param titleCachePerson
196 public void setPersons(Map
<String
, Person
> titleCachePerson
) {
197 this.titleCachePerson
=titleCachePerson
;
198 System
.out
.println(titleCachePerson
);
202 public Map
<String
, Team
> getTeams() {
203 return titleCacheTeam
;
207 public Map
<String
, Person
> getPersons() {
208 return titleCachePerson
;
214 public void setDefaultAuthor(String string
) {
215 defaultAuthor
=string
;
219 public String
getDefaultAuthor(){
220 return defaultAuthor
;
224 public Map
<String
,UUID
> getNamedAreaDecisions() {
225 return namedAreaDecisions
;
228 public void setNamedAreaDecisions(Map
<String
,UUID
> namedAreaDecisions
) {
229 this.namedAreaDecisions
= namedAreaDecisions
;
232 public void putNamedAreaDecision(String areaStr
,UUID uuid
){
233 this.namedAreaDecisions
.put(areaStr
,uuid
);
236 public UUID
getNamedAreaDecision(String areaStr
){
237 return namedAreaDecisions
.get(areaStr
);
243 public void setDataReference(Reference
<?
> ref
) {
244 this.dataReference
=ref
;
248 public Reference
<?
> getDataReference() {
249 return dataReference
;
255 public void setDebugInstitutionOnly(boolean b
) {
256 this.debugInstitutionOnly
=b
;