2 * Copyright (C) 2009 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
.common
;
12 import java
.util
.UUID
;
14 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
15 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
16 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.IInputTransformer
;
17 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
18 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
19 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
26 public interface IImportConfigurator
extends IIoConfigurator
{
28 public static enum CHECK
{
34 public static enum EDITOR
{
35 NO_EDITORS
, //leaves out createdBy and updatedBy information
36 EDITOR_AS_ANNOTATION
,//save createdBy and updatedBy in annotations
37 EDITOR_AS_EDITOR
, //save createdBy and updatedBy in createdBy and updatedBy
40 public static enum DO_REFERENCES
{
47 public boolean isValid();
50 * Factory method. Creates a new state for the import type and adds this configuration to it.
53 public <STATE
extends ImportStateBase
> STATE
getNewState();
55 /* ****************** GETTER/SETTER **************************/
58 * @return the doReferences
60 public CHECK
getCheck();
63 * @param doReferences the doReferences to set
65 public void setCheck(CHECK check
);
70 public EDITOR
getEditor();
73 * @param editor sets the way how editing (created, updated) information is handled
75 public void setEditor(EDITOR editor
);
78 * If true, no errors occurs if objects are not found that should exist. This may
79 * be needed e.g. when only subsets of the data are imported.
80 * Default value is <cod>false</code>.
81 * @return the ignoreNull
83 public boolean isIgnoreNull();
85 * @param ignoreNull the ignoreNull to set
87 public void setIgnoreNull(boolean ignoreNull
);
91 * The destination data source for the import
92 * Don't use when using a spring data source
95 public ICdmDataSource
getDestination();
97 public void setDestination(ICdmDataSource destination
);
99 public DbSchemaValidation
getDbSchemaValidation();
101 public void setDbSchemaValidation(
102 DbSchemaValidation dbSchemaValidation
);
105 * The reference that represents the source. E.g. if the import source is a database
106 * the returned reference should be of type eu.etaxonomy.cdm.model.reference.Database and
107 * should represent the according database.
108 * If the import comes from a file (e.g. XML) the returned value should best represent the
109 * source of this file (e.g. if the source of an XML file is a certain database this database
110 * should be mentioned as the source. Otherwise a eu.etaxonomy.cdm.model.reference.Generic
111 * reference with the name of the XML file should be returned value
114 public Reference
getSourceReference();
118 * Any object that represents the Source. The implementing class must cast this to
119 * the correct class type
122 public Object
getSource();
124 //public abstract void setSource(Object url);
126 public void setSourceReference(Reference sourceReference
);
128 public String
getSourceReferenceTitle();
130 public void setSourceReferenceTitle(String sourceReferenceTitle
);
132 public Person
getCommentator();
134 public void setCommentator(Person commentator
);
136 public NomenclaturalCode
getNomenclaturalCode();
138 public void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode
);
140 public Class
<ICdmIO
>[] getIoClassList();
142 // public String[] getIoBeans();
143 // public void setIoBeans(String[] ioBeans);
146 * Returns a <code>CdmApplicationController</code> created by the values of this configuration.
147 * If a controller was already created before the last created controller is returned.
150 // public CdmApplicationController getCdmAppController();
151 // public CdmApplicationController getCdmAppController(boolean createNew, boolean omitTermLoading);
153 public Object
getSourceSecId();
158 * If this import implicitly represents a classification in the destination CDM database
159 * one can define the classification's uuid here. The congrete import class must support this
160 * functionality otherwise it will have no effect.
163 public UUID
getClassificationUuid();
164 public void setClassificationUuid(UUID treeUuid
);
167 * If one wants do define the uuid of the accepted taxa (except for missaplied names) this can be
171 public UUID
getSecUuid();
172 public void setSecUuid(UUID secUuid
);
176 * Returns the transformer used during import
179 public IInputTransformer
getTransformer();
182 * Sets the transformer used during import
185 public void setTransformer(IInputTransformer transformer
);
189 * Defines if term loading should take place if a new application controller
190 * is created. Usually should return false as imports run into existing databases.
191 * However, some imports like the current implementation of the JAXB import require
192 * to create ALL data anew and import the data itself. Therefore they need to
193 * allow omitting term loading.
194 * This may be replaced by a more sophisticated solution in future.
197 public boolean isOmitTermLoading();
200 * Defines if the database will be created anew. Usually should return false as imports
201 * run into existing databases.
202 * However, some imports like the current implementation of the JAXB import require
203 * to create ALL data anew. Therefore they need to allow to create all data anew.
204 * This may be replaced by a more sophisticated solution in future.
207 public boolean isCreateNew();