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
.reference
.Reference
;
26 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
33 public class Abcd206ImportConfigurator
extends ImportConfiguratorBase
<Abcd206ImportState
, URI
> implements IImportConfigurator
, IMatchingImportConfigurator
{
34 private static final Logger logger
= Logger
.getLogger(Abcd206ImportConfigurator
.class);
35 private boolean doParsing
= false;
36 private boolean reuseMetadata
= false;
37 private boolean reuseTaxon
= true;
38 private String taxonReference
= null;
39 private boolean doCreateIndividualsAssociations
= true;
40 private boolean doReuseExistingDescription
= false;
41 private boolean doMatchTaxa
= true;
42 private Map
<UUID
, UUID
> taxonToDescriptionMap
= new HashMap
<UUID
, UUID
>();
46 private static IInputTransformer defaultTransformer
= null;
48 @SuppressWarnings("unchecked")
49 protected void makeIoClassList(){
50 System
.out
.println("makeIOClassList");
51 ioClassList
= new Class
[]{
56 public static Abcd206ImportConfigurator
NewInstance(URI uri
,
57 ICdmDataSource destination
){
58 return new Abcd206ImportConfigurator(uri
, destination
);
63 * @param berlinModelSource
64 * @param sourceReference
67 private Abcd206ImportConfigurator(URI uri
, ICdmDataSource destination
) {
68 super(defaultTransformer
);
70 setDestination(destination
);
77 // * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSource()
79 // public String getSource() {
80 // return (String)super.getSource();
84 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
87 public Abcd206ImportState
getNewState() {
88 return new Abcd206ImportState(this);
92 public URI
getSource(){
93 return super.getSource();
99 public void setSource(URI uri
) {
100 super.setSource(uri
);
106 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()
109 public Reference
getSourceReference() {
111 if (this.sourceReference
== null){
112 logger
.warn("getSource Reference not yet fully implemented");
113 ReferenceFactory refFactory
= ReferenceFactory
.newInstance();
114 sourceReference
= refFactory
.newDatabase();
115 sourceReference
.setTitleCache("ABCD specimen import", true);
117 return sourceReference
;
120 public void setTaxonReference(String taxonReference
) {
121 this.taxonReference
= taxonReference
;
124 public Reference
getTaxonReference() {
126 if (this.taxonReference
== null){
127 logger
.info("getTaxonReference not yet fully implemented");
129 return sourceReference
;
132 public void setDoAutomaticParsing(boolean doParsing
){
133 this.doParsing
=doParsing
;
136 public boolean isDoAutomaticParsing(){
137 return this.doParsing
;
140 public void setReUseExistingMetadata(boolean reuseMetadata
){
141 this.reuseMetadata
= reuseMetadata
;
144 public boolean isReUseExistingMetadata(){
145 return this.reuseMetadata
;
148 public void setReUseTaxon(boolean reuseTaxon
){
149 this.reuseTaxon
= reuseTaxon
;
153 * if {@link #doMatchTaxa} is set false or no matching taxon is found new
154 * taxa will be created. If this flag is set <code>true</code> the newly created taxa
155 * will be reused if possible. Setting this flag to <code>false</code> may lead to
156 * multiple identical taxa.
160 public boolean isDoReUseTaxon(){
161 return this.reuseTaxon
;
164 public void setDoCreateIndividualsAssociations(
165 boolean doCreateIndividualsAssociations
) {
166 this.doCreateIndividualsAssociations
= doCreateIndividualsAssociations
;
170 * Create an IndividualsAssociations for each determination element in the ABCD data. ABCD has no such concept as IndividualsAssociations so the only way to
174 public boolean isDoCreateIndividualsAssociations() {
175 return doCreateIndividualsAssociations
;
179 * @param doReuseExistingDescription the doReuseExistingDescription to set
181 public void setDoReuseExistingDescription(boolean doReuseExistingDescription
) {
182 this.doReuseExistingDescription
= doReuseExistingDescription
;
186 * @return the doReuseExistingDescription
188 public boolean isDoMatchToExistingDescription() {
189 return doReuseExistingDescription
;
193 * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#isDoMatchTaxa()
196 public boolean isDoMatchTaxa() {
201 * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#setDoMatchTaxa(boolean)
204 public void setDoMatchTaxa(boolean doMatchTaxa
) {
205 this.doMatchTaxa
= doMatchTaxa
;
211 public Map
<UUID
, UUID
> getTaxonToDescriptionMap() {
212 // TODO Auto-generated method stub
213 return taxonToDescriptionMap
;