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
.model
.agent
.Person
;
26 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
27 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
28 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
35 public class Abcd206ImportConfigurator
extends ImportConfiguratorBase
<Abcd206ImportState
, URI
> implements IImportConfigurator
, IMatchingImportConfigurator
{
36 private static final Logger logger
= Logger
.getLogger(Abcd206ImportConfigurator
.class);
37 private boolean doParsing
= false;
38 private boolean reuseMetadata
= false;
39 private boolean reuseTaxon
= true;
40 private String taxonReference
= null;
41 private boolean doCreateIndividualsAssociations
= true;
42 private boolean doReuseExistingDescription
= false;
43 private boolean doMatchTaxa
= true;
44 private final Map
<UUID
, UUID
> taxonToDescriptionMap
= new HashMap
<UUID
, UUID
>();
45 private Map
<String
, Team
> titleCacheTeam
;
46 private Map
<String
, Person
> titleCachePerson
;
47 private String defaultAuthor
="";
50 private static IInputTransformer defaultTransformer
= null;
53 @SuppressWarnings("unchecked")
54 protected void makeIoClassList(){
55 System
.out
.println("makeIOClassList");
56 ioClassList
= new Class
[]{
61 public static Abcd206ImportConfigurator
NewInstance(URI uri
,
62 ICdmDataSource destination
){
63 return new Abcd206ImportConfigurator(uri
, destination
);
68 * @param berlinModelSource
69 * @param sourceReference
72 private Abcd206ImportConfigurator(URI uri
, ICdmDataSource destination
) {
73 super(defaultTransformer
);
75 setDestination(destination
);
82 // * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
84 // public String getSource() {
85 // return (String)super.getSource();
89 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
92 public Abcd206ImportState
getNewState() {
93 return new Abcd206ImportState(this);
98 public URI
getSource(){
99 return super.getSource();
106 public void setSource(URI uri
) {
107 super.setSource(uri
);
113 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
116 public Reference
getSourceReference() {
118 if (this.sourceReference
== null){
119 logger
.warn("getSource Reference not yet fully implemented");
120 ReferenceFactory refFactory
= ReferenceFactory
.newInstance();
121 sourceReference
= refFactory
.newDatabase();
122 sourceReference
.setTitleCache("ABCD 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
;
139 public void setDoAutomaticParsing(boolean doParsing
){
140 this.doParsing
=doParsing
;
143 public boolean isDoAutomaticParsing(){
144 return this.doParsing
;
147 public void setReUseExistingMetadata(boolean reuseMetadata
){
148 this.reuseMetadata
= reuseMetadata
;
151 public boolean isReUseExistingMetadata(){
152 return this.reuseMetadata
;
155 public void setReUseTaxon(boolean reuseTaxon
){
156 this.reuseTaxon
= reuseTaxon
;
160 * if {@link #doMatchTaxa} is set false or no matching taxon is found new
161 * taxa will be created. If this flag is set <code>true</code> the newly created taxa
162 * will be reused if possible. Setting this flag to <code>false</code> may lead to
163 * multiple identical taxa.
167 public boolean isDoReUseTaxon(){
168 return this.reuseTaxon
;
171 public void setDoCreateIndividualsAssociations(
172 boolean doCreateIndividualsAssociations
) {
173 this.doCreateIndividualsAssociations
= doCreateIndividualsAssociations
;
177 * Create an IndividualsAssociations for each determination element in the ABCD data. ABCD has no such concept as IndividualsAssociations so the only way to
181 public boolean isDoCreateIndividualsAssociations() {
182 return doCreateIndividualsAssociations
;
186 * @param doReuseExistingDescription the doReuseExistingDescription to set
188 public void setDoReuseExistingDescription(boolean doReuseExistingDescription
) {
189 this.doReuseExistingDescription
= doReuseExistingDescription
;
193 * @return the doReuseExistingDescription
195 public boolean isDoMatchToExistingDescription() {
196 return doReuseExistingDescription
;
200 * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#isDoMatchTaxa()
203 public boolean isDoMatchTaxa() {
208 * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#setDoMatchTaxa(boolean)
211 public void setDoMatchTaxa(boolean doMatchTaxa
) {
212 this.doMatchTaxa
= doMatchTaxa
;
218 public Map
<UUID
, UUID
> getTaxonToDescriptionMap() {
219 // TODO Auto-generated method stub
220 return taxonToDescriptionMap
;
225 public Map
<String
, Team
> getTeams() {
226 return titleCacheTeam
;
229 public void setTeams(Map
<String
, Team
> titleCacheTeam
) {
230 this.titleCacheTeam
= titleCacheTeam
;
233 public Map
<String
, Person
> getPersons() {
234 return titleCachePerson
;
237 public void setPersons(Map
<String
, Person
> titleCachePerson
) {
238 this.titleCachePerson
= titleCachePerson
;
244 public void setDefaultAuthor(String string
) {
245 defaultAuthor
=string
;
249 public String
getDefaultAuthor(){
250 return defaultAuthor
;