cleanup
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / specimen / abcd206 / in / Abcd206ImportConfigurator.java
index 7a082fc25909aed2f90e4ded0a2eae6f3a623d07..4930fbd6741e253adb52c43c2342d6ad84d7ae93 100644 (file)
-/**\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
-\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.IMatchingImportConfigurator;\r
-import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;\r
-import eu.etaxonomy.cdm.io.specimen.SpecimenImportConfiguratorBase;\r
-import eu.etaxonomy.cdm.model.reference.Reference;\r
-\r
-/**\r
- * @author p.kelbert\r
- * @since 20.10.2008\r
- */\r
-public class Abcd206ImportConfigurator\r
-        extends SpecimenImportConfiguratorBase<Abcd206ImportConfigurator, Abcd206ImportState, InputStream>\r
-        implements IMatchingImportConfigurator {\r
-\r
-    private static final long serialVersionUID = -7204105522522645681L;\r
-\r
-    @SuppressWarnings("unused")\r
-    private static final Logger logger = Logger.getLogger(Abcd206ImportConfigurator.class);\r
-\r
-\r
-    //TODO\r
-    private static IInputTransformer defaultTransformer = null;\r
-\r
-    private URI sourceUri;\r
-\r
-    private boolean getSiblings = false;\r
-\r
-    private URI dnaSoure = URI.create("https://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank");\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
-    @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
-\r
-    public URI getSourceUri(){\r
-       return this.sourceUri;\r
-    }\r
-\r
-    public void setSourceUri(URI sourceUri) {\r
-        this.sourceUri = sourceUri;\r
-        super.setSource(null);\r
-    }\r
-\r
-\r
-\r
-\r
-    public URI getDnaSoure() {\r
-        return dnaSoure;\r
-    }\r
-\r
-    public void setDnaSoure(URI dnaSoure) {\r
-        this.dnaSoure = dnaSoure;\r
-    }\r
-\r
-    @Override\r
-    public Reference getSourceReference() {\r
-        //TODO\r
-        return sourceReference;\r
-    }\r
-\r
-    /**\r
-     * @return the getSiblings\r
-     */\r
-    public boolean isGetSiblings() {\r
-        return getSiblings;\r
-    }\r
-\r
-    /**\r
-     * @param getSiblings the getSiblings to set\r
-     */\r
-    public void setGetSiblings(boolean getSiblings) {\r
-        this.getSiblings = getSiblings;\r
-    }\r
-\r
-\r
-\r
-\r
-@Override\r
-public String toString(){\r
-\r
-    StringBuffer result = new StringBuffer();\r
-    //the preference value is build like this:\r
-      //<section1>:true;<section2>:false....\r
-\r
-      result.append("ignoreImportOfExistingSpecimen");\r
-      result.append(":");\r
-      result.append(this.isIgnoreImportOfExistingSpecimen());\r
-      result.append(";");\r
-      result.append("addIndividualsAssociationsSuchAsSpecimenAndObservations");\r
-      result.append(":");\r
-      result.append(this.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());\r
-      result.append(";");\r
-      result.append("reuseExistingTaxaWhenPossible");\r
-      result.append(":");\r
-      result.append(this.isReuseExistingTaxaWhenPossible());\r
-      result.append(";");\r
-      result.append("ignoreAuthorship");\r
-      result.append(":");\r
-      result.append(this.isIgnoreAuthorship());\r
-      result.append(";");\r
-      result.append("addMediaAsMediaSpecimen");\r
-      result.append(":");\r
-      result.append(this.isAddMediaAsMediaSpecimen());\r
-      result.append(";");\r
-      result.append("reuseExistingMetaData");\r
-      result.append(":");\r
-      result.append(this.isReuseExistingMetaData());\r
-      result.append(";");\r
-      result.append("reuseExistingDescriptiveGroups");\r
-      result.append(":");\r
-      result.append(this.isReuseExistingDescriptiveGroups());\r
-      result.append(";");\r
-      result.append("allowReuseOtherClassifications");\r
-      result.append(":");\r
-      result.append(this.isAllowReuseOtherClassifications());\r
-      result.append(";");\r
-      result.append("deduplicateReferences");\r
-      result.append(":");\r
-      result.append(this.isDeduplicateReferences());\r
-      result.append(";");\r
-      result.append("deduplicateClassifications");\r
-      result.append(":");\r
-      result.append(this.isDeduplicateClassifications());\r
-      result.append(";");\r
-      result.append("moveNewTaxaToDefaultClassification");\r
-      result.append(":");\r
-      result.append(this.isMoveNewTaxaToDefaultClassification());\r
-      result.append(";");\r
-      result.append("getSiblings");\r
-      result.append(":");\r
-      result.append(this.isGetSiblings());\r
-      result.append(";");\r
-      result.append("removeCountryFromLocalityText");\r
-      result.append(":");\r
-      result.append(this.isRemoveCountryFromLocalityText());\r
-      result.append(";");\r
-\r
-      result.append("mapUnitIdToCatalogNumber");\r
-      result.append(":");\r
-      result.append(this.isMapUnitIdToCatalogNumber());\r
-      result.append(";");\r
-      result.append("mapUnitIdToAccessionNumber");\r
-      result.append(":");\r
-      result.append(this.isMapUnitIdToAccessionNumber());\r
-      result.append(";");\r
-      result.append("mapUnitIdToBarcode");\r
-      result.append(":");\r
-      result.append(this.isMapUnitIdToBarcode());\r
-      result.append(";");\r
-\r
-      result.append("overwriteExistingSpecimens");\r
-      result.append(":");\r
-      result.append(this.isOverwriteExistingSpecimens());\r
-      result.append(";");\r
-      result.append("nomenclaturalCode");\r
-      result.append(":");\r
-      result.append(this.getNomenclaturalCode() != null ? this.getNomenclaturalCode().getKey():"");\r
-      result.append(";");\r
-\r
-\r
-    return result.toString();\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\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