-/**\r
- * Copyright (C) 2007 EDIT\r
- * European Distributed Institute of Taxonomy\r
- * http://www.e-taxonomy.eu\r
- *\r
- * The contents of this file are subject to the Mozilla Public License Version 1.1\r
- * See LICENSE.TXT at the top of this package for the full license terms.\r
- */\r
-\r
-package eu.etaxonomy.cdm.io.specimen.abcd206.in;\r
-\r
-\r
-import java.io.InputStream;\r
-import java.net.URI;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.UUID;\r
-\r
-import org.apache.log4j.Logger;\r
-\r
-import eu.etaxonomy.cdm.common.UriUtils;\r
-import eu.etaxonomy.cdm.database.ICdmDataSource;\r
-import eu.etaxonomy.cdm.io.common.IImportConfigurator;\r
-import eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator;\r
-import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;\r
-import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;\r
-import eu.etaxonomy.cdm.io.specimen.SpecimenUserInteraction;\r
-import eu.etaxonomy.cdm.model.agent.Person;\r
-import eu.etaxonomy.cdm.model.agent.Team;\r
-import eu.etaxonomy.cdm.model.reference.Reference;\r
-\r
-/**\r
- * @author p.kelbert\r
- * @created 20.10.2008\r
- * @version 1.0\r
- */\r
-public class Abcd206ImportConfigurator extends ImportConfiguratorBase<Abcd206ImportState, InputStream> implements IImportConfigurator, IMatchingImportConfigurator {\r
- private static final Logger logger = Logger.getLogger(Abcd206ImportConfigurator.class);\r
-\r
- private static String sourceReferenceTitle = null;\r
- private boolean parseNameAutomatically = false;\r
- private boolean reuseExistingMetadata = true;\r
- private String taxonReference = null;\r
- private boolean addIndividualsAssociationsSuchAsSpecimenAndObservations = true;\r
- private boolean reuseExistingDescriptiveGroups = false;\r
- private boolean reuseExistingTaxaWhenPossible = true;\r
- private final Map<UUID, UUID> taxonToDescriptionMap = new HashMap<UUID, UUID>();\r
- private Map<String, Team> titleCacheTeam;\r
- private Map<String, Person> titleCachePerson;\r
- private String defaultAuthor="";\r
- private boolean allowReuseOtherClassifications =true;\r
- private boolean addMediaAsMediaSpecimen = false;\r
- private boolean determinationOnFieldUnitLevel = false;\r
-\r
-\r
- private final SpecimenUserInteraction specimenUserInteraction = new SpecimenUserInteraction();\r
-\r
- private Map<String,UUID> namedAreaDecisions = new HashMap<String,UUID>();\r
-\r
- //TODO\r
- private static IInputTransformer defaultTransformer = null;\r
-\r
- private URI sourceUri;\r
-\r
-\r
- @Override\r
- @SuppressWarnings("unchecked")\r
- protected void makeIoClassList(){\r
- System.out.println("makeIOClassList");\r
- ioClassList = new Class[]{\r
- Abcd206Import.class,\r
- };\r
- };\r
-\r
- public static Abcd206ImportConfigurator NewInstance(URI uri,ICdmDataSource destination){\r
- return new Abcd206ImportConfigurator(null, uri, destination, false);\r
- }\r
-\r
- /**\r
- * @param uri\r
- * @param object\r
- * @param b\r
- * @return\r
- */\r
- public static Abcd206ImportConfigurator NewInstance(URI uri, ICdmDataSource destination, boolean interact) {\r
- return new Abcd206ImportConfigurator(null, uri, destination, interact);\r
- }\r
-\r
- /**\r
- * @param uri\r
- * @param object\r
- * @param b\r
- * @return\r
- */\r
- public static Abcd206ImportConfigurator NewInstance(InputStream stream, ICdmDataSource destination, boolean interact) {\r
- return new Abcd206ImportConfigurator(stream, null, destination, interact);\r
- }\r
-\r
-\r
-\r
- /**\r
- * @param berlinModelSource\r
- * @param sourceReference\r
- * @param destination\r
- */\r
- private Abcd206ImportConfigurator(InputStream stream, URI uri, ICdmDataSource destination, boolean interact) {\r
- super(defaultTransformer);\r
- if (stream != null){\r
- setSource(stream);\r
- }else{\r
- this.sourceUri = uri;\r
- }\r
- setDestination(destination);\r
- setSourceReferenceTitle("ABCD classic");\r
- setInteractWithUser(interact);\r
- }\r
-\r
-\r
-\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()\r
- */\r
- @Override\r
- public Abcd206ImportState getNewState() {\r
- return new Abcd206ImportState(this);\r
- }\r
-\r
-\r
- @Override\r
- public InputStream getSource(){\r
- if (super.getSource() != null){\r
- return super.getSource();\r
- }else if (this.sourceUri != null){\r
- try {\r
- InputStream is = UriUtils.getInputStream(sourceUri);\r
- setSource(is);\r
- return is;\r
- } catch (Exception e) {\r
- throw new RuntimeException(e);\r
- }\r
- }else{\r
- return null;\r
- }\r
- }\r
-\r
- /**\r
- * @param file\r
- */\r
- @Override\r
- public void setSource(InputStream is) {\r
- this.sourceUri = null;\r
- super.setSource(is);\r
- }\r
-\r
- public URI getSourceUri(){\r
- return this.sourceUri;\r
- }\r
-\r
- /**\r
- * @param file\r
- */\r
- public void setSourceUri(URI sourceUri) {\r
- this.sourceUri = sourceUri;\r
- super.setSource(null);\r
- }\r
-\r
-\r
- @Override\r
- public String getSourceReferenceTitle(){\r
- return this.sourceReferenceTitle;\r
- }\r
-\r
- @Override\r
- public void setSourceReferenceTitle(String name){\r
- this.sourceReferenceTitle=name;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#getSourceReference()\r
- */\r
- @Override\r
- public Reference getSourceReference() {\r
- //TODO\r
- return sourceReference;\r
- }\r
-\r
- public void setTaxonReference(String taxonReference) {\r
- this.taxonReference = taxonReference;\r
- }\r
-\r
- public Reference getTaxonReference() {\r
- //TODO\r
- if (this.taxonReference == null){\r
- logger.info("getTaxonReference not yet fully implemented");\r
- }\r
- return sourceReference;\r
- }\r
-\r
- public void setParseNameAutomatically(boolean doParsing){\r
- this.parseNameAutomatically=doParsing;\r
- }\r
-\r
- public boolean isParseNameAutomatically(){\r
- return this.parseNameAutomatically;\r
- }\r
-\r
- public void setReuseExistingMetadata(boolean reuseMetadata){\r
- this.reuseExistingMetadata = reuseMetadata;\r
- }\r
-\r
- public boolean isReUseExistingMetadata(){\r
- return this.reuseExistingMetadata;\r
- }\r
-\r
- public void setAddIndividualsAssociationsSuchAsSpecimenAndObservations(\r
- boolean doCreateIndividualsAssociations) {\r
- this.addIndividualsAssociationsSuchAsSpecimenAndObservations = doCreateIndividualsAssociations;\r
- }\r
-\r
- /**\r
- * Create an IndividualsAssociations for each determination element in the ABCD data. ABCD has no such concept as IndividualsAssociations so the only way to\r
- *\r
- * @return\r
- */\r
- public boolean isAddIndividualsAssociationsSuchAsSpecimenAndObservations() {\r
- return addIndividualsAssociationsSuchAsSpecimenAndObservations;\r
- }\r
-\r
- /**\r
- * @param doReuseExistingDescription the doReuseExistingDescription to set\r
- * NOT USED YET\r
- */\r
- public void reuseExistingDescriptiveGroups(boolean doReuseExistingDescription) {\r
- this.reuseExistingDescriptiveGroups = doReuseExistingDescription;\r
- }\r
-\r
- /**\r
- * @return the doReuseExistingDescription\r
- */\r
- public boolean isReuseExistingDescriptiveGroups() {\r
- return reuseExistingDescriptiveGroups;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#isDoMatchTaxa()\r
- */\r
- @Override\r
- public boolean isReuseExistingTaxaWhenPossible() {\r
- return reuseExistingTaxaWhenPossible;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator#setDoMatchTaxa(boolean)\r
- */\r
- @Override\r
- public void setReuseExistingTaxaWhenPossible(boolean doMatchTaxa) {\r
- this.reuseExistingTaxaWhenPossible = doMatchTaxa;\r
- }\r
-\r
- /**\r
- * @return\r
- */\r
- public Map<UUID, UUID> getTaxonToDescriptionMap() {\r
- // TODO Auto-generated method stub\r
- return taxonToDescriptionMap ;\r
- }\r
-\r
-\r
-\r
- public Map<String, Team> getTeams() {\r
- return titleCacheTeam;\r
- }\r
-\r
- public void setTeams(Map<String, Team> titleCacheTeam) {\r
- this.titleCacheTeam = titleCacheTeam;\r
- }\r
-\r
- public Map<String, Person> getPersons() {\r
- return titleCachePerson;\r
- }\r
-\r
- public void setPersons(Map<String, Person> titleCachePerson) {\r
- this.titleCachePerson = titleCachePerson;\r
- }\r
-\r
- /**\r
- * @param string\r
- */\r
- public void setDefaultAuthor(String string) {\r
- defaultAuthor=string;\r
-\r
- }\r
-\r
- public String getDefaultAuthor(){\r
- return defaultAuthor;\r
- }\r
-\r
- public Map<String,UUID> getNamedAreaDecisions() {\r
- return namedAreaDecisions;\r
- }\r
-\r
- public void setNamedAreaDecisions(Map<String,UUID> namedAreaDecisions) {\r
- this.namedAreaDecisions = namedAreaDecisions;\r
- }\r
-\r
- public void putNamedAreaDecision(String areaStr,UUID uuid){\r
- this.namedAreaDecisions.put(areaStr,uuid);\r
- }\r
-\r
- public UUID getNamedAreaDecision(String areaStr){\r
- return namedAreaDecisions.get(areaStr);\r
- }\r
-\r
- /**\r
- * @return the doAddMediaAsMediaSpecimen\r
- */\r
- public boolean isAddMediaAsMediaSpecimen() {\r
- return addMediaAsMediaSpecimen;\r
- }\r
-\r
- public void setAddMediaAsMediaSpecimen(boolean addMediaAsMediaSpecimen) {\r
- this.addMediaAsMediaSpecimen = addMediaAsMediaSpecimen;\r
- }\r
-\r
- public boolean isDeterminationOnFieldUnitLevel() {\r
- return determinationOnFieldUnitLevel;\r
- }\r
-\r
- public void setDeterminationOnFieldUnitLevel(boolean determinationOnFieldUnitLevel) {\r
- this.determinationOnFieldUnitLevel = determinationOnFieldUnitLevel;\r
- }\r
-\r
- /**\r
- * @return the allowReuseOtherClassifications\r
- */\r
- public boolean isAllowReuseOtherClassifications() {\r
- return allowReuseOtherClassifications;\r
- }\r
-\r
- /**\r
- * @param allowReuseOtherClassifications the allowReuseOtherClassifications to set\r
- */\r
- public void setAllowReuseOtherClassifications(boolean allowReuseOtherClassifications) {\r
- this.allowReuseOtherClassifications = allowReuseOtherClassifications;\r
- }\r
-\r
- /**\r
- * @return the specimenUserInteraction\r
- */\r
- public SpecimenUserInteraction getSpecimenUserInteraction() {\r
- return specimenUserInteraction;\r
- }\r
-\r
-\r
-\r
-\r
-}\r
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.cdm.io.specimen.abcd206.in;
+
+import java.io.InputStream;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import eu.etaxonomy.cdm.common.URI;
+import eu.etaxonomy.cdm.common.UriUtils;
+import eu.etaxonomy.cdm.database.ICdmDataSource;
+import eu.etaxonomy.cdm.io.common.IMatchingImportConfigurator;
+import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
+import eu.etaxonomy.cdm.io.specimen.SpecimenImportConfiguratorBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+
+/**
+ * @author p.kelbert
+ * @since 20.10.2008
+ */
+public class Abcd206ImportConfigurator
+ extends SpecimenImportConfiguratorBase<Abcd206ImportConfigurator, Abcd206ImportState, InputStream>
+ implements IMatchingImportConfigurator {
+
+ private static final long serialVersionUID = -7204105522522645681L;
+ @SuppressWarnings("unused")
+ private static final Logger logger = LogManager.getLogger();
+
+ //TODO
+ private static IInputTransformer defaultTransformer = null;
+
+ private URI sourceUri;
+
+ private boolean getSiblings = false;
+
+ private URI dnaSoure; // = URI.create("https://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank");
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void makeIoClassList(){
+ System.out.println("makeIOClassList");
+ ioClassList = new Class[]{
+ Abcd206Import.class,
+ };
+ }
+
+ public static Abcd206ImportConfigurator NewInstance(URI uri,ICdmDataSource destination){
+ return new Abcd206ImportConfigurator(null, uri, destination, false);
+ }
+
+ public static Abcd206ImportConfigurator NewInstance(URI uri, ICdmDataSource destination, boolean interact) {
+ return new Abcd206ImportConfigurator(null, uri, destination, interact);
+ }
+
+ private Abcd206ImportConfigurator(InputStream stream, URI uri, ICdmDataSource destination, boolean interact) {
+ super(defaultTransformer);
+ if (stream != null){
+ setSource(stream);
+ }else{
+ this.sourceUri = uri;
+ }
+ setDestination(destination);
+ setSourceReferenceTitle("ABCD classic");
+ setInteractWithUser(interact);
+ }
+
+ @Override
+ public Abcd206ImportState getNewState() {
+ return new Abcd206ImportState(this);
+ }
+
+ @Override
+ public InputStream getSource(){
+ if (super.getSource() != null){
+ return super.getSource();
+ }else if (this.sourceUri != null){
+ try {
+ InputStream is = UriUtils.getInputStream(sourceUri);
+ setSource(is);
+ return is;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }else{
+ return null;
+ }
+ }
+
+ public URI getSourceUri(){
+ return this.sourceUri;
+ }
+
+ public void setSourceUri(URI sourceUri) {
+ this.sourceUri = sourceUri;
+ super.setSource(null);
+ }
+
+ public URI getDnaSoure() {
+ return dnaSoure;
+ }
+
+ public void setDnaSoure(URI dnaSoure) {
+ this.dnaSoure = dnaSoure;
+ }
+
+ @Override
+ public Reference getSourceReference() {
+ //TODO
+ return sourceReference;
+ }
+
+ public boolean isGetSiblings() {
+ return getSiblings;
+ }
+
+ public void setGetSiblings(boolean getSiblings) {
+ this.getSiblings = getSiblings;
+ }
+
+ @Override
+ public String toString(){
+
+ StringBuffer result = new StringBuffer();
+ //the preference value is build like this:
+ //<section1>:true;<section2>:false....
+
+ result.append("ignoreImportOfExistingSpecimen");
+ result.append(":");
+ result.append(this.isIgnoreImportOfExistingSpecimen());
+ result.append(";");
+ result.append("addIndividualsAssociationsSuchAsSpecimenAndObservations");
+ result.append(":");
+ result.append(this.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ result.append(";");
+ result.append("reuseExistingTaxaWhenPossible");
+ result.append(":");
+ result.append(this.isReuseExistingTaxaWhenPossible());
+ result.append(";");
+ result.append("ignoreAuthorship");
+ result.append(":");
+ result.append(this.isIgnoreAuthorship());
+ result.append(";");
+ result.append("addMediaAsMediaSpecimen");
+ result.append(":");
+ result.append(this.isAddMediaAsMediaSpecimen());
+ result.append(";");
+ result.append("reuseExistingMetaData");
+ result.append(":");
+ result.append(this.isReuseExistingMetaData());
+ result.append(";");
+ result.append("reuseExistingDescriptiveGroups");
+ result.append(":");
+ result.append(this.isReuseExistingDescriptiveGroups());
+ result.append(";");
+ result.append("allowReuseOtherClassifications");
+ result.append(":");
+ result.append(this.isAllowReuseOtherClassifications());
+ result.append(";");
+ result.append("deduplicateReferences");
+ result.append(":");
+ result.append(this.isDeduplicateReferences());
+ result.append(";");
+ result.append("deduplicateClassifications");
+ result.append(":");
+ result.append(this.isDeduplicateClassifications());
+ result.append(";");
+ result.append("moveNewTaxaToDefaultClassification");
+ result.append(":");
+ result.append(this.isMoveNewTaxaToDefaultClassification());
+ result.append(";");
+ result.append("getSiblings");
+ result.append(":");
+ result.append(this.isGetSiblings());
+ result.append(";");
+ result.append("removeCountryFromLocalityText");
+ result.append(":");
+ result.append(this.isRemoveCountryFromLocalityText());
+ result.append(";");
+
+ result.append("mapUnitIdToCatalogNumber");
+ result.append(":");
+ result.append(this.isMapUnitIdToCatalogNumber());
+ result.append(";");
+ result.append("mapUnitIdToAccessionNumber");
+ result.append(":");
+ result.append(this.isMapUnitIdToAccessionNumber());
+ result.append(";");
+ result.append("mapUnitIdToBarcode");
+ result.append(":");
+ result.append(this.isMapUnitIdToBarcode());
+ result.append(";");
+
+ result.append("overwriteExistingSpecimens");
+ result.append(":");
+ result.append(this.isOverwriteExistingSpecimens());
+ result.append(";");
+ result.append("nomenclaturalCode");
+ result.append(":");
+ result.append(this.getNomenclaturalCode() != null ? this.getNomenclaturalCode().getKey():"");
+ result.append(";");
+ result.append("dnaSource");
+ result.append(":");
+ result.append(this.getDnaSoure() != null ? this.getDnaSoure().toString():"");
+ result.append(";");
+ result.append("classificationUUID");
+ result.append(":");
+ result.append(this.getClassificationUuid() != null ? this.getClassificationUuid().toString():"");
+ result.append(";");
+ result.append("classificationName");
+ result.append(":");
+ result.append(this.getClassificationName() != null ? this.getClassificationName():"");
+ result.append(";");
+
+ return result.toString();
+ }
+}
\ No newline at end of file