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
;
13 import java
.io
.InputStream
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.common
.UriUtils
;
19 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
20 import eu
.etaxonomy
.cdm
.io
.common
.IMatchingImportConfigurator
;
21 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
22 import eu
.etaxonomy
.cdm
.io
.specimen
.SpecimenImportConfiguratorBase
;
23 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
29 public class Abcd206ImportConfigurator
30 extends SpecimenImportConfiguratorBase
<Abcd206ImportConfigurator
, Abcd206ImportState
, InputStream
>
31 implements IMatchingImportConfigurator
{
33 private static final long serialVersionUID
= -7204105522522645681L;
35 @SuppressWarnings("unused")
36 private static final Logger logger
= Logger
.getLogger(Abcd206ImportConfigurator
.class);
40 private static IInputTransformer defaultTransformer
= null;
42 private URI sourceUri
;
44 private boolean getSiblings
= false;
49 @SuppressWarnings("unchecked")
50 protected void makeIoClassList(){
51 System
.out
.println("makeIOClassList");
52 ioClassList
= new Class
[]{
57 public static Abcd206ImportConfigurator
NewInstance(URI uri
,ICdmDataSource destination
){
58 return new Abcd206ImportConfigurator(null, uri
, destination
, false);
67 public static Abcd206ImportConfigurator
NewInstance(URI uri
, ICdmDataSource destination
, boolean interact
) {
68 return new Abcd206ImportConfigurator(null, uri
, destination
, interact
);
77 public static Abcd206ImportConfigurator NewInstance(InputStream stream, ICdmDataSource destination, boolean interact) {
78 return new Abcd206ImportConfigurator(stream, null, destination, interact);
84 * @param berlinModelSource
85 * @param sourceReference
88 private Abcd206ImportConfigurator(InputStream stream
, URI uri
, ICdmDataSource destination
, boolean interact
) {
89 super(defaultTransformer
);
95 setDestination(destination
);
96 setSourceReferenceTitle("ABCD classic");
97 setInteractWithUser(interact
);
105 public Abcd206ImportState
getNewState() {
106 return new Abcd206ImportState(this);
111 public InputStream
getSource(){
112 if (super.getSource() != null){
113 return super.getSource();
114 }else if (this.sourceUri
!= null){
116 InputStream is
= UriUtils
.getInputStream(sourceUri
);
119 } catch (Exception e
) {
120 throw new RuntimeException(e
);
129 public URI
getSourceUri(){
130 return this.sourceUri
;
133 public void setSourceUri(URI sourceUri
) {
134 this.sourceUri
= sourceUri
;
135 super.setSource(null);
142 public Reference
getSourceReference() {
144 return sourceReference
;
148 * @return the getSiblings
150 public boolean isGetSiblings() {
155 * @param getSiblings the getSiblings to set
157 public void setGetSiblings(boolean getSiblings
) {
158 this.getSiblings
= getSiblings
;
165 public String
toString(){
167 StringBuffer result
= new StringBuffer();
168 //the preference value is build like this:
169 //<section1>:true;<section2>:false....
171 result
.append("ignoreImportOfExistingSpecimen");
173 result
.append(this.isIgnoreImportOfExistingSpecimen());
175 result
.append("addIndividualsAssociationsSuchAsSpecimenAndObservations");
177 result
.append(this.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
179 result
.append("reuseExistingTaxaWhenPossible");
181 result
.append(this.isReuseExistingTaxaWhenPossible());
183 result
.append("ignoreAuthorship");
185 result
.append(this.isIgnoreAuthorship());
187 result
.append("addMediaAsMediaSpecimen");
189 result
.append(this.isAddMediaAsMediaSpecimen());
191 result
.append("reuseExistingMetaData");
193 result
.append(this.isReuseExistingMetaData());
195 result
.append("reuseExistingDescriptiveGroups");
197 result
.append(this.isReuseExistingDescriptiveGroups());
199 result
.append("allowReuseOtherClassifications");
201 result
.append(this.isAllowReuseOtherClassifications());
203 result
.append("deduplicateReferences");
205 result
.append(this.isDeduplicateReferences());
207 result
.append("deduplicateClassifications");
209 result
.append(this.isDeduplicateClassifications());
211 result
.append("moveNewTaxaToDefaultClassification");
213 result
.append(this.isMoveNewTaxaToDefaultClassification());
216 result
.append("mapUnitIdToCatalogNumber");
218 result
.append(this.isMapUnitIdToCatalogNumber());
220 result
.append("mapUnitIdToAccessionNumber");
222 result
.append(this.isMapUnitIdToAccessionNumber());
224 result
.append("mapUnitIdToBarcode");
226 result
.append(this.isMapUnitIdToBarcode());
229 result
.append("overwriteExistingSpecimens");
231 result
.append(this.isOverwriteExistingSpecimens());
233 result
.append("nomenclaturalCode");
235 result
.append(this.getNomenclaturalCode() != null ?
this.getNomenclaturalCode().getKey():"");
239 return result
.toString();