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
.abcd206
.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
.IMatchingImportConfigurator
;
23 import eu
.etaxonomy
.cdm
.io
.common
.ImportConfiguratorBase
;
24 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
25 import eu
.etaxonomy
.cdm
.io
.specimen
.SpecimenUserInteraction
;
26 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
27 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
28 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
35 public class Abcd206ImportConfigurator
extends ImportConfiguratorBase
<Abcd206ImportState
, URI
> implements IImportConfigurator
, IMatchingImportConfigurator
{
36 private static final Logger logger
= Logger
.getLogger(Abcd206ImportConfigurator
.class);
38 private static String sourceReferenceTitle
= null;
39 private boolean parseNameAutomatically
= false;
40 private boolean reuseExistingMetadata
= true;
41 private String taxonReference
= null;
42 private boolean addIndividualsAssociationsSuchAsSpecimenAndObservations
= true;
43 private boolean reuseExistingDescriptiveGroups
= false;
44 private boolean reuseExistingTaxaWhenPossible
= true;
45 private final Map
<UUID
, UUID
> taxonToDescriptionMap
= new HashMap
<UUID
, UUID
>();
46 private Map
<String
, Team
> titleCacheTeam
;
47 private Map
<String
, Person
> titleCachePerson
;
48 private String defaultAuthor
="";
49 private boolean allowReuseOtherClassifications
=true;
52 private final SpecimenUserInteraction specimenUserInteraction
= new SpecimenUserInteraction();
54 private Map
<String
,UUID
> namedAreaDecisions
= new HashMap
<String
,UUID
>();
57 private static IInputTransformer defaultTransformer
= null;
60 @SuppressWarnings("unchecked")
61 protected void makeIoClassList(){
62 System
.out
.println("makeIOClassList");
63 ioClassList
= new Class
[]{
68 public static Abcd206ImportConfigurator
NewInstance(URI uri
,
69 ICdmDataSource destination
){
70 return new Abcd206ImportConfigurator(uri
, destination
);
79 public static Abcd206ImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
, boolean interact
) {
80 return new Abcd206ImportConfigurator(uri
, destination
,interact
);
85 * @param berlinModelSource
86 * @param sourceReference
89 private Abcd206ImportConfigurator(URI uri
, ICdmDataSource destination
) {
90 super(defaultTransformer
);
92 setDestination(destination
);
93 setSourceReferenceTitle("ABCD classic");
97 * @param berlinModelSource
98 * @param sourceReference
101 private Abcd206ImportConfigurator(URI uri
, ICdmDataSource destination
, boolean interact
) {
102 super(defaultTransformer
);
104 setDestination(destination
);
105 setSourceReferenceTitle("ABCD classic");
106 setInteractWithUser(interact
);
114 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
117 public Abcd206ImportState
getNewState() {
118 return new Abcd206ImportState(this);
123 public URI
getSource(){
124 return super.getSource();
131 public void setSource(URI uri
) {
132 super.setSource(uri
);
137 public String
getSourceReferenceTitle(){
138 return this.sourceReferenceTitle
;
142 public void setSourceReferenceTitle(String name
){
143 this.sourceReferenceTitle
=name
;
147 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
150 public Reference
getSourceReference() {
152 return sourceReference
;
155 public void setTaxonReference(String taxonReference
) {
156 this.taxonReference
= taxonReference
;
159 public Reference
getTaxonReference() {
161 if (this.taxonReference
== null){
162 logger
.info("getTaxonReference not yet fully implemented");
164 return sourceReference
;
167 public void setParseNameAutomatically(boolean doParsing
){
168 this.parseNameAutomatically
=doParsing
;
171 public boolean isParseNameAutomatically(){
172 return this.parseNameAutomatically
;
175 public void setReuseExistingMetadata(boolean reuseMetadata
){
176 this.reuseExistingMetadata
= reuseMetadata
;
179 public boolean isReUseExistingMetadata(){
180 return this.reuseExistingMetadata
;
183 public void setAddIndividualsAssociationsSuchAsSpecimenAndObservations(
184 boolean doCreateIndividualsAssociations
) {
185 this.addIndividualsAssociationsSuchAsSpecimenAndObservations
= doCreateIndividualsAssociations
;
189 * Create an IndividualsAssociations for each determination element in the ABCD data. ABCD has no such concept as IndividualsAssociations so the only way to
193 public boolean isAddIndividualsAssociationsSuchAsSpecimenAndObservations() {
194 return addIndividualsAssociationsSuchAsSpecimenAndObservations
;
198 * @param doReuseExistingDescription the doReuseExistingDescription to set
201 public void reuseExistingDescriptiveGroups(boolean doReuseExistingDescription
) {
202 this.reuseExistingDescriptiveGroups
= doReuseExistingDescription
;
206 * @return the doReuseExistingDescription
208 public boolean isReuseExistingDescriptiveGroups() {
209 return reuseExistingDescriptiveGroups
;
213 * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#isDoMatchTaxa()
216 public boolean isReuseExistingTaxaWhenPossible() {
217 return reuseExistingTaxaWhenPossible
;
221 * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#setDoMatchTaxa(boolean)
224 public void setReuseExistingTaxaWhenPossible(boolean doMatchTaxa
) {
225 this.reuseExistingTaxaWhenPossible
= doMatchTaxa
;
231 public Map
<UUID
, UUID
> getTaxonToDescriptionMap() {
232 // TODO Auto-generated method stub
233 return taxonToDescriptionMap
;
238 public Map
<String
, Team
> getTeams() {
239 return titleCacheTeam
;
242 public void setTeams(Map
<String
, Team
> titleCacheTeam
) {
243 this.titleCacheTeam
= titleCacheTeam
;
246 public Map
<String
, Person
> getPersons() {
247 return titleCachePerson
;
250 public void setPersons(Map
<String
, Person
> titleCachePerson
) {
251 this.titleCachePerson
= titleCachePerson
;
257 public void setDefaultAuthor(String string
) {
258 defaultAuthor
=string
;
262 public String
getDefaultAuthor(){
263 return defaultAuthor
;
266 public Map
<String
,UUID
> getNamedAreaDecisions() {
267 return namedAreaDecisions
;
270 public void setNamedAreaDecisions(Map
<String
,UUID
> namedAreaDecisions
) {
271 this.namedAreaDecisions
= namedAreaDecisions
;
274 public void putNamedAreaDecision(String areaStr
,UUID uuid
){
275 this.namedAreaDecisions
.put(areaStr
,uuid
);
278 public UUID
getNamedAreaDecision(String areaStr
){
279 return namedAreaDecisions
.get(areaStr
);
284 * @return the allowReuseOtherClassifications
286 public boolean isAllowReuseOtherClassifications() {
287 return allowReuseOtherClassifications
;
291 * @param allowReuseOtherClassifications the allowReuseOtherClassifications to set
293 public void setAllowReuseOtherClassifications(boolean allowReuseOtherClassifications
) {
294 this.allowReuseOtherClassifications
= allowReuseOtherClassifications
;
298 * @return the specimenUserInteraction
300 public SpecimenUserInteraction
getSpecimenUserInteraction() {
301 return specimenUserInteraction
;