commit after merge from trunc
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / common / IImportConfigurator.java
1 /**
2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.cdm.io.common;
11
12 import java.util.UUID;
13
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;
20
21 /**
22 * @author a.mueller
23 * @created 29.01.2009
24 * @version 1.0
25 */
26 public interface IImportConfigurator extends IIoConfigurator {
27
28 public static enum CHECK{
29 CHECK_ONLY,
30 IMPORT_WITHOUT_CHECK,
31 CHECK_AND_IMPORT,
32 }
33
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
38 }
39
40 public static enum DO_REFERENCES{
41 NONE,
42 NOMENCLATURAL,
43 CONCEPT_REFERENCES,
44 ALL
45 }
46
47 public boolean isValid();
48
49 /**
50 * Factory method. Creates a new state for the import type and adds this configuration to it.
51 * @return
52 */
53 public <STATE extends ImportStateBase> STATE getNewState();
54
55 /* ****************** GETTER/SETTER **************************/
56
57 /**
58 * @return the doReferences
59 */
60 public CHECK getCheck();
61
62 /**
63 * @param doReferences the doReferences to set
64 */
65 public void setCheck(CHECK check);
66
67 /**
68 * @return the editor
69 */
70 public EDITOR getEditor();
71
72 /**
73 * @param editor sets the way how editing (created, updated) information is handled
74 */
75 public void setEditor(EDITOR editor);
76
77 /**
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
82 */
83 public boolean isIgnoreNull();
84 /**
85 * @param ignoreNull the ignoreNull to set
86 */
87 public void setIgnoreNull(boolean ignoreNull);
88
89
90 /**
91 * The destination data source for the import
92 * Don't use when using a spring data source
93 * @return
94 */
95 public ICdmDataSource getDestination();
96
97 public void setDestination(ICdmDataSource destination);
98
99 public DbSchemaValidation getDbSchemaValidation();
100
101 public void setDbSchemaValidation(
102 DbSchemaValidation dbSchemaValidation);
103
104 /**
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
112 * @return
113 */
114 public Reference getSourceReference();
115
116
117 /**
118 * Any object that represents the Source. The implementing class must cast this to
119 * the correct class type
120 * @return
121 */
122 public Object getSource();
123
124 //public abstract void setSource(Object url);
125
126 public void setSourceReference(Reference sourceReference);
127
128 public String getSourceReferenceTitle();
129
130 public void setSourceReferenceTitle(String sourceReferenceTitle);
131
132 public Person getCommentator();
133
134 public void setCommentator(Person commentator);
135
136 public NomenclaturalCode getNomenclaturalCode();
137
138 public void setNomenclaturalCode(NomenclaturalCode nomenclaturalCode);
139
140 public Class<ICdmIO>[] getIoClassList();
141
142 // public String[] getIoBeans();
143 // public void setIoBeans(String[] ioBeans);
144
145 /**
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.
148 * @return
149 */
150 // public CdmApplicationController getCdmAppController();
151 // public CdmApplicationController getCdmAppController(boolean createNew, boolean omitTermLoading);
152 //
153 public Object getSourceSecId();
154
155
156
157 /**
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.
161 * @return
162 */
163 public UUID getClassificationUuid();
164 public void setClassificationUuid(UUID treeUuid);
165
166 /**
167 * If one wants do define the uuid of the accepted taxa (except for missaplied names) this can be
168 * done here
169 * @return
170 */
171 public UUID getSecUuid();
172 public void setSecUuid(UUID secUuid);
173
174
175 /**
176 * Returns the transformer used during import
177 * @return
178 */
179 public IInputTransformer getTransformer();
180
181 /**
182 * Sets the transformer used during import
183 * @param transformer
184 */
185 public void setTransformer(IInputTransformer transformer);
186
187
188 /**
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.
195 * @return
196 */
197 public boolean isOmitTermLoading();
198
199 /**
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.
205 * @return
206 */
207 public boolean isCreateNew();
208
209 }