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.
9 package eu
.etaxonomy
.cdm
.io
.specimen
.abcd206
.in
;
11 import java
.io
.InputStream
;
13 import org
.apache
.log4j
.Logger
;
15 import eu
.etaxonomy
.cdm
.common
.URI
;
16 import eu
.etaxonomy
.cdm
.common
.UriUtils
;
17 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
18 import eu
.etaxonomy
.cdm
.io
.common
.IMatchingImportConfigurator
;
19 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
20 import eu
.etaxonomy
.cdm
.io
.specimen
.SpecimenImportConfiguratorBase
;
21 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
27 public class Abcd206ImportConfigurator
28 extends SpecimenImportConfiguratorBase
<Abcd206ImportConfigurator
, Abcd206ImportState
, InputStream
>
29 implements IMatchingImportConfigurator
{
31 private static final long serialVersionUID
= -7204105522522645681L;
33 @SuppressWarnings("unused")
34 private static final Logger logger
= Logger
.getLogger(Abcd206ImportConfigurator
.class);
38 private static IInputTransformer defaultTransformer
= null;
40 private URI sourceUri
;
42 private boolean getSiblings
= false;
44 private URI dnaSoure
; // = URI.create("https://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank");
47 @SuppressWarnings("unchecked")
48 protected void makeIoClassList(){
49 System
.out
.println("makeIOClassList");
50 ioClassList
= new Class
[]{
55 public static Abcd206ImportConfigurator
NewInstance(URI uri
,ICdmDataSource destination
){
56 return new Abcd206ImportConfigurator(null, uri
, destination
, false);
65 public static Abcd206ImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
, boolean interact
) {
66 return new Abcd206ImportConfigurator(null, uri
, destination
, interact
);
75 public static Abcd206ImportConfigurator NewInstance(InputStream stream, ICdmDataSource destination, boolean interact) {
76 return new Abcd206ImportConfigurator(stream, null, destination, interact);
82 * @param berlinModelSource
83 * @param sourceReference
86 private Abcd206ImportConfigurator(InputStream stream
, URI uri
, ICdmDataSource destination
, boolean interact
) {
87 super(defaultTransformer
);
93 setDestination(destination
);
94 setSourceReferenceTitle("ABCD classic");
95 setInteractWithUser(interact
);
103 public Abcd206ImportState
getNewState() {
104 return new Abcd206ImportState(this);
109 public InputStream
getSource(){
110 if (super.getSource() != null){
111 return super.getSource();
112 }else if (this.sourceUri
!= null){
114 InputStream is
= UriUtils
.getInputStream(sourceUri
);
117 } catch (Exception e
) {
118 throw new RuntimeException(e
);
127 public URI
getSourceUri(){
128 return this.sourceUri
;
131 public void setSourceUri(URI sourceUri
) {
132 this.sourceUri
= sourceUri
;
133 super.setSource(null);
139 public URI
getDnaSoure() {
143 public void setDnaSoure(URI dnaSoure
) {
144 this.dnaSoure
= dnaSoure
;
148 public Reference
getSourceReference() {
150 return sourceReference
;
154 * @return the getSiblings
156 public boolean isGetSiblings() {
161 * @param getSiblings the getSiblings to set
163 public void setGetSiblings(boolean getSiblings
) {
164 this.getSiblings
= getSiblings
;
171 public String
toString(){
173 StringBuffer result
= new StringBuffer();
174 //the preference value is build like this:
175 //<section1>:true;<section2>:false....
177 result
.append("ignoreImportOfExistingSpecimen");
179 result
.append(this.isIgnoreImportOfExistingSpecimen());
181 result
.append("addIndividualsAssociationsSuchAsSpecimenAndObservations");
183 result
.append(this.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
185 result
.append("reuseExistingTaxaWhenPossible");
187 result
.append(this.isReuseExistingTaxaWhenPossible());
189 result
.append("ignoreAuthorship");
191 result
.append(this.isIgnoreAuthorship());
193 result
.append("addMediaAsMediaSpecimen");
195 result
.append(this.isAddMediaAsMediaSpecimen());
197 result
.append("reuseExistingMetaData");
199 result
.append(this.isReuseExistingMetaData());
201 result
.append("reuseExistingDescriptiveGroups");
203 result
.append(this.isReuseExistingDescriptiveGroups());
205 result
.append("allowReuseOtherClassifications");
207 result
.append(this.isAllowReuseOtherClassifications());
209 result
.append("deduplicateReferences");
211 result
.append(this.isDeduplicateReferences());
213 result
.append("deduplicateClassifications");
215 result
.append(this.isDeduplicateClassifications());
217 result
.append("moveNewTaxaToDefaultClassification");
219 result
.append(this.isMoveNewTaxaToDefaultClassification());
221 result
.append("getSiblings");
223 result
.append(this.isGetSiblings());
225 result
.append("removeCountryFromLocalityText");
227 result
.append(this.isRemoveCountryFromLocalityText());
230 result
.append("mapUnitIdToCatalogNumber");
232 result
.append(this.isMapUnitIdToCatalogNumber());
234 result
.append("mapUnitIdToAccessionNumber");
236 result
.append(this.isMapUnitIdToAccessionNumber());
238 result
.append("mapUnitIdToBarcode");
240 result
.append(this.isMapUnitIdToBarcode());
243 result
.append("overwriteExistingSpecimens");
245 result
.append(this.isOverwriteExistingSpecimens());
247 result
.append("nomenclaturalCode");
249 result
.append(this.getNomenclaturalCode() != null ?
this.getNomenclaturalCode().getKey():"");
251 result
.append("dnaSource");
253 result
.append(this.getDnaSoure() != null ?
this.getDnaSoure().toString():"");
255 result
.append("classificationUUID");
257 result
.append(this.getClassificationUuid() != null ?
this.getClassificationUuid().toString():"");
259 result
.append("classificationName");
261 result
.append(this.getClassificationName() != null ?
this.getClassificationName():"");
265 return result
.toString();