minor
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / common / IImportConfigurator.java
index 2d8ebb4e817b56bca83e8fb547f150163e7c7005..8b776a4dab9e282e0ab992cd8dcd060922ce5a27 100644 (file)
@@ -1,13 +1,29 @@
+/**\r
+* Copyright (C) 2009 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.common;\r
 \r
+import java.util.UUID;\r
+\r
 import eu.etaxonomy.cdm.database.DbSchemaValidation;\r
 import eu.etaxonomy.cdm.database.ICdmDataSource;\r
+import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;\r
 import eu.etaxonomy.cdm.model.agent.Person;\r
-import eu.etaxonomy.cdm.model.common.Language;\r
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;\r
-import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
+import eu.etaxonomy.cdm.model.reference.Reference;\r
 \r
-public interface IImportConfigurator {\r
+/**\r
+ * @author a.mueller\r
+ * @created 29.01.2009\r
+ * @version 1.0\r
+ */\r
+public interface IImportConfigurator extends IIoConfigurator {\r
 \r
        public static enum CHECK{\r
                CHECK_ONLY,\r
@@ -15,6 +31,12 @@ public interface IImportConfigurator {
                CHECK_AND_IMPORT,\r
        }\r
        \r
+       public static enum EDITOR{\r
+               NO_EDITORS,  //leaves out createdBy and updatedBy information\r
+               EDITOR_AS_ANNOTATION,//save createdBy and updatedBy in annotations\r
+               EDITOR_AS_EDITOR, //save createdBy and updatedBy in createdBy and updatedBy\r
+       }\r
+       \r
        public static enum DO_REFERENCES{\r
                NONE,\r
                NOMENCLATURAL,\r
@@ -22,126 +44,144 @@ public interface IImportConfigurator {
                ALL\r
        }\r
        \r
-       public abstract boolean isValid();\r
+       public boolean isValid();\r
+       \r
+       /**\r
+        * Factory method. Creates a new state for the import type and adds this coniguration to it.\r
+        * @return \r
+        */\r
+       public <STATE extends ImportStateBase> STATE getNewState();\r
 \r
        /* ****************** GETTER/SETTER **************************/\r
-       public abstract boolean isDeleteAll();\r
-\r
-       public abstract void setDeleteAll(boolean deleteAll);\r
-\r
-       public abstract boolean isDoAuthors();\r
-\r
-       public abstract void setDoAuthors(boolean doAuthors);\r
 \r
        /**\r
         * @return the doReferences\r
         */\r
-       public abstract DO_REFERENCES getDoReferences();\r
+       public CHECK getCheck();\r
 \r
        /**\r
         * @param doReferences the doReferences to set\r
         */\r
-       public abstract void setDoReferences(DO_REFERENCES doReferences);\r
+       public void setCheck(CHECK check);\r
 \r
        /**\r
-        * @return the doReferences\r
+        * @return the editor \r
         */\r
-       public abstract CHECK getCheck();\r
+       public EDITOR getEditor();\r
 \r
        /**\r
-        * @param doReferences the doReferences to set\r
+        * @param editor sets the way how editing (created, updated) information is handled\r
         */\r
-       public abstract void setCheck(CHECK check);\r
-\r
-       public abstract boolean isDoTaxonNames();\r
-\r
-       public abstract void setDoTaxonNames(boolean doTaxonNames);\r
-\r
-       public abstract boolean isDoRelNames();\r
-\r
-       public abstract void setDoRelNames(boolean doRelNames);\r
-\r
-       public abstract boolean isDoNameStatus();\r
-\r
-       public abstract void setDoNameStatus(boolean doNameStatus);\r
-\r
-       public abstract boolean isDoNameFacts();\r
-\r
-       public abstract void setDoNameFacts(boolean doNameFacts);\r
-\r
-       public abstract boolean isDoTypes();\r
-\r
-       public abstract void setDoTypes(boolean doTypes);\r
-\r
-       public abstract boolean isDoTaxa();\r
-\r
-       public abstract void setDoTaxa(boolean doTaxa);\r
-\r
-       public abstract boolean isDoRelTaxa();\r
-\r
-       public abstract void setDoRelTaxa(boolean doRelTaxa);\r
-\r
-       public abstract boolean isDoFacts();\r
-\r
-       public abstract void setDoFacts(boolean doFacts);\r
-\r
+       public void setEditor(EDITOR editor);\r
+       \r
        /**\r
-        * @return the doOccurrence\r
+        * If true, no errors occurs if objects are not found that should exist. This may\r
+        * be needed e.g. when only subsets of the data are imported.\r
+        * Default value is <cod>false</code>.\r
+        * @return the ignoreNull\r
         */\r
-       public abstract boolean isDoOccurrence();\r
-\r
+       public boolean isIgnoreNull();\r
        /**\r
-        * @param doOccurrence the doOccurrence to set\r
+        * @param ignoreNull the ignoreNull to set\r
         */\r
-       public abstract void setDoOccurrence(boolean doOccurrence);\r
-\r
-       //public abstract String getSource();\r
-\r
-       //public abstract void setSource(String url);\r
-\r
-       public abstract ICdmDataSource getDestination();\r
+       public void setIgnoreNull(boolean ignoreNull);\r
+       \r
+       \r
+       /**\r
+        * The destination data source for the import \r
+        * Don't use when using a spring data source\r
+        * @return\r
+        */\r
+       public ICdmDataSource getDestination();\r
 \r
-       public abstract void setDestination(ICdmDataSource destination);\r
+       public void setDestination(ICdmDataSource destination);\r
 \r
-       public abstract DbSchemaValidation getDbSchemaValidation();\r
+       public DbSchemaValidation getDbSchemaValidation();\r
 \r
-       public abstract void setDbSchemaValidation(\r
+       public void setDbSchemaValidation(\r
                        DbSchemaValidation dbSchemaValidation);\r
 \r
-       public abstract ReferenceBase getSourceReference();\r
-\r
-       \r
        /**\r
-        * A String representation of the used source (e.g. BerlinModel Cichorieae Database)\r
+        * The reference that represents the source. E.g. if the import source is a database\r
+        * the returned reference should be of type eu.etaxonomy.cdm.model.reference.Database and \r
+        * should represent the according database.\r
+        * If the import comes from a file (e.g. XML) the returned value should best represent the \r
+        * source of this file (e.g. if the source of an XML file is a certain database this database\r
+        * should be mentioned as the source. Otherwise a eu.etaxonomy.cdm.model.reference.Generic \r
+        * reference with the name of the XML file should be returned value\r
         * @return\r
         */\r
-       public abstract String getSourceNameString();\r
+       public Reference getSourceReference();\r
+\r
        \r
        /**\r
         * Any object that represents the Source. The implementing class must cast this to \r
         * the correct class type\r
         * @return\r
         */\r
-       public abstract Object getSource();\r
-       \r
-       public abstract void setSourceReference(ReferenceBase sourceReference);\r
+       public Object getSource();\r
 \r
-       public abstract String getSourceReferenceTitle();\r
+       //public abstract void setSource(Object url);\r
 \r
-       public abstract void setSourceReferenceTitle(String sourceReferenceTitle);\r
+       public void setSourceReference(Reference sourceReference);\r
 \r
-       public abstract Person getCommentator();\r
+       public String getSourceReferenceTitle();\r
 \r
-       public abstract void setCommentator(Person commentator);\r
+       public void setSourceReferenceTitle(String sourceReferenceTitle);\r
 \r
-       public abstract Language getFactLanguage();\r
+       public Person getCommentator();\r
 \r
-       public abstract void setFactLanguage(Language factLanguage);\r
+       public void setCommentator(Person commentator);\r
        \r
-       public abstract NomenclaturalCode getNomenclaturalCode();\r
+       public NomenclaturalCode getNomenclaturalCode();\r
        \r
-       public abstract void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode);\r
+       public void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode);\r
        \r
        public Class<ICdmIO>[] getIoClassList();\r
        \r
+//     public String[] getIoBeans();\r
+//     public void setIoBeans(String[] ioBeans);\r
+       \r
+       /**\r
+        * Returns a <code>CdmApplicationController</code> created by the values of this configuration.\r
+        * If a controller was already created before the last created controller is returned.\r
+        * @return\r
+        */\r
+//     public CdmApplicationController getCdmAppController();\r
+//     public CdmApplicationController getCdmAppController(boolean createNew, boolean omitTermLoading);\r
+//     \r
+       public Object getSourceSecId();\r
+\r
+       \r
+       \r
+       /**\r
+        * If this import implicitly represents a classification in the destination CDM database\r
+        * one can define the classification's uuid here. The congrete import class must support this\r
+        * functionality otherwise it will have no effect.\r
+        * @return\r
+        */\r
+       public UUID getClassificationUuid();\r
+       public void setClassificationUuid(UUID treeUuid);\r
+\r
+       /**\r
+        * If one wants do define the uuid of the accepted taxa (except for missaplied names) this can be\r
+        * done here \r
+        * @return\r
+        */\r
+       public UUID getSecUuid();\r
+       public void setSecUuid(UUID secUuid);\r
+       \r
+       \r
+       /**\r
+        * Returns the transformer used during import\r
+        * @return\r
+        */\r
+       public IInputTransformer getTransformer();\r
+       \r
+       /**\r
+        * Sets the transformer used during import\r
+        * @param transformer\r
+        */\r
+       public void setTransformer(IInputTransformer transformer);\r
+       \r
 }
\ No newline at end of file