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
{
46 public DO_REFERENCES
invers(){
47 if (this == DO_REFERENCES
.NONE
){
49 }else if (this == ALL
){
51 }else if (this == NOMENCLATURAL
){ //don't change
53 }else if (this == CONCEPT_REFERENCES
){ //don't change
54 return CONCEPT_REFERENCES
;
56 throw new RuntimeException("inverse for DO_REFERENCE type: " + this + " not yet handled");
63 public boolean isValid();
66 * Factory method. Creates a new state for the import type and adds this configuration to it.
69 public <STATE
extends ImportStateBase
> STATE
getNewState();
71 /* ****************** GETTER/SETTER **************************/
74 * @return the doReferences
76 public CHECK
getCheck();
79 * @param doReferences the doReferences to set
81 public void setCheck(CHECK check
);
86 public EDITOR
getEditor();
89 * @param editor sets the way how editing (created, updated) information is handled
91 public void setEditor(EDITOR editor
);
94 * If true, no errors occurs if objects are not found that should exist. This may
95 * be needed e.g. when only subsets of the data are imported.
96 * Default value is <cod>false</code>.
97 * @return the ignoreNull
99 public boolean isIgnoreNull();
101 * @param ignoreNull the ignoreNull to set
103 public void setIgnoreNull(boolean ignoreNull
);
107 * The destination data source for the import
108 * Don't use when using a spring data source
111 public ICdmDataSource
getDestination();
113 public void setDestination(ICdmDataSource destination
);
115 public DbSchemaValidation
getDbSchemaValidation();
117 public void setDbSchemaValidation(
118 DbSchemaValidation dbSchemaValidation
);
121 * The reference that represents the source. E.g. if the import source is a database
122 * the returned reference should be of type eu.etaxonomy.cdm.model.reference.Database and
123 * should represent the according database.
124 * If the import comes from a file (e.g. XML) the returned value should best represent the
125 * source of this file (e.g. if the source of an XML file is a certain database this database
126 * should be mentioned as the source. Otherwise a eu.etaxonomy.cdm.model.reference.Generic
127 * reference with the name of the XML file should be returned value
130 public Reference
getSourceReference();
134 * Any object that represents the Source. The implementing class must cast this to
135 * the correct class type
138 public Object
getSource();
140 //public abstract void setSource(Object url);
142 public void setSourceReference(Reference sourceReference
);
144 public String
getSourceReferenceTitle();
146 public void setSourceReferenceTitle(String sourceReferenceTitle
);
148 public Person
getCommentator();
150 public void setCommentator(Person commentator
);
152 public NomenclaturalCode
getNomenclaturalCode();
154 public void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode
);
156 public Class
<ICdmIO
>[] getIoClassList();
158 // public String[] getIoBeans();
159 // public void setIoBeans(String[] ioBeans);
162 * Returns a <code>CdmApplicationController</code> created by the values of this configuration.
163 * If a controller was already created before the last created controller is returned.
166 // public CdmApplicationController getCdmAppController();
167 // public CdmApplicationController getCdmAppController(boolean createNew, boolean omitTermLoading);
169 public Object
getSourceSecId();
174 * If this import implicitly represents a classification in the destination CDM database
175 * one can define the classification's uuid here. The congrete import class must support this
176 * functionality otherwise it will have no effect.
179 public UUID
getClassificationUuid();
180 public void setClassificationUuid(UUID treeUuid
);
183 * If one wants do define the uuid of the accepted taxa (except for missaplied names) this can be
187 public UUID
getSecUuid();
188 public void setSecUuid(UUID secUuid
);
192 * Returns the transformer used during import
195 public IInputTransformer
getTransformer();
198 * Sets the transformer used during import
201 public void setTransformer(IInputTransformer transformer
);
205 * Defines if term loading should take place if a new application controller
206 * is created. Usually should return false as imports run into existing databases.
207 * However, some imports like the current implementation of the JAXB import require
208 * to create ALL data anew and import the data itself. Therefore they need to
209 * allow omitting term loading.
210 * This may be replaced by a more sophisticated solution in future.
213 public boolean isOmitTermLoading();
216 * Defines if the database will be created anew. Usually should return false as imports
217 * run into existing databases.
218 * However, some imports like the current implementation of the JAXB import require
219 * to create ALL data anew. Therefore they need to allow to create all data anew.
220 * This may be replaced by a more sophisticated solution in future.
223 public boolean isCreateNew();