81e13449c3abacdd3dbcbedeb5c84987e7525c26
[cdmlib-apps.git] / cdmlib-eflora / src / main / java / eu / etaxonomy / cdm / io / eflora / centralAfrica / checklist / CentralAfricaChecklistImportConfigurator.java
1 /**
2 * Copyright (C) 2007 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.eflora.centralAfrica.checklist;
11
12 import java.lang.reflect.Method;
13 import java.util.UUID;
14
15 import org.apache.log4j.Logger;
16
17 import eu.etaxonomy.cdm.database.ICdmDataSource;
18 import eu.etaxonomy.cdm.io.common.IImportConfigurator;
19 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
20 import eu.etaxonomy.cdm.io.common.ImportStateBase;
21 import eu.etaxonomy.cdm.io.common.Source;
22 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
23 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
24 import eu.etaxonomy.cdm.model.reference.Reference;
25 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
26
27
28 /**
29 * @author a.mueller
30 * @created 20.03.2008
31 * @version 1.0
32 */
33 public class CentralAfricaChecklistImportConfigurator extends ImportConfiguratorBase<CentralAfricaChecklistImportState, Source> implements IImportConfigurator{
34 @SuppressWarnings("unused")
35 private static Logger logger = Logger.getLogger(CentralAfricaChecklistImportConfigurator.class);
36
37 private UUID uuidGenevaReference = UUID.fromString("cf3fd13d-6cad-430c-ab70-7ea841b7159f");
38
39 private String genevaReferenceTitle = null;
40
41 public static CentralAfricaChecklistImportConfigurator NewInstance(Source ermsSource, ICdmDataSource destination){
42 return new CentralAfricaChecklistImportConfigurator(ermsSource, destination);
43 }
44
45 /* Max number of records to be saved with one service call */
46 private int recordsPerTransaction = 1000; //defaultValue
47
48 //TODO needed ??
49 private Method userTransformationMethod;
50
51 private boolean doVernaculars = true;
52 private boolean doLinks = true;
53 private boolean doNotes = true;
54 private boolean doImages = true;
55 private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
56 private boolean doTaxa = true;
57
58
59 private static IInputTransformer defaultTransformer = new CentralAfricaChecklistTransformer();
60
61 protected void makeIoClassList(){
62 ioClassList = new Class[]{
63 //ErmsGeneralImportValidator.class
64 CentralAfricaChecklistReferenceImport.class ,
65 CentralAfricaChecklistTaxonImport.class,
66 CentralAfricaChecklistSynonymImport.class
67 };
68 }
69
70
71 /* (non-Javadoc)
72 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
73 */
74 public ImportStateBase getNewState() {
75 return new CentralAfricaChecklistImportState(this);
76 }
77
78
79
80 private CentralAfricaChecklistImportConfigurator(Source source, ICdmDataSource destination) {
81 super(defaultTransformer);
82 setNomenclaturalCode(NomenclaturalCode.ICZN); //default for ERMS
83 setSource(source);
84 setDestination(destination);
85 }
86
87
88 public Source getSource() {
89 return (Source)super.getSource();
90 }
91 public void setSource(Source berlinModelSource) {
92 super.setSource(berlinModelSource);
93 }
94
95 /* (non-Javadoc)
96 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
97 */
98 public Reference getSourceReference() {
99 if (sourceReference == null){
100 sourceReference = ReferenceFactory.newDatabase();
101 if (getSource() != null){
102 sourceReference.setTitleCache(getSource().getDatabase(), true);
103 }
104 }
105 return sourceReference;
106 }
107
108 /* (non-Javadoc)
109 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
110 */
111 public String getSourceNameString() {
112 if (this.getSource() == null){
113 return null;
114 }else{
115 return this.getSource().getDatabase();
116 }
117 }
118
119 /**
120 * @return the userTransformationMethod
121 */
122 public Method getUserTransformationMethod() {
123 return userTransformationMethod;
124 }
125
126 /**
127 * @param userTransformationMethod the userTransformationMethod to set
128 */
129 public void setUserTransformationMethod(Method userTransformationMethod) {
130 this.userTransformationMethod = userTransformationMethod;
131 }
132
133
134 /**
135 * @return the limitSave
136 */
137 public int getRecordsPerTransaction() {
138 return recordsPerTransaction;
139 }
140
141 /**
142 * @param limitSave the limitSave to set
143 */
144 public void setRecordsPerTransaction(int recordsPerTransaction) {
145 this.recordsPerTransaction = recordsPerTransaction;
146 }
147
148 /**
149 * @param doVernaculars the doVernaculars to set
150 */
151 public void setDoVernaculars(boolean doVernaculars) {
152 this.doVernaculars = doVernaculars;
153 }
154
155 /**
156 * @return the doVernaculars
157 */
158 public boolean isDoVernaculars() {
159 return doVernaculars;
160 }
161
162
163
164 /**
165 * @param doLinks the doLinks to set
166 */
167 public void setDoLinks(boolean doLinks) {
168 this.doLinks = doLinks;
169 }
170
171
172
173 /**
174 * @return the doLinks
175 */
176 public boolean isDoLinks() {
177 return doLinks;
178 }
179
180
181
182 /**
183 * @param doNotes the doNotes to set
184 */
185 public void setDoNotes(boolean doNotes) {
186 this.doNotes = doNotes;
187 }
188
189
190
191 /**
192 * @return the doNotes
193 */
194 public boolean isDoNotes() {
195 return doNotes;
196 }
197
198
199
200 /**
201 * @param doImages the doImages to set
202 */
203 public void setDoImages(boolean doImages) {
204 this.doImages = doImages;
205 }
206
207
208
209 /**
210 * @return the doImages
211 */
212 public boolean isDoImages() {
213 return doImages;
214 }
215
216
217 public void setUuidGenevaReference(UUID uuidGenevaReference) {
218 this.uuidGenevaReference = uuidGenevaReference;
219 }
220
221
222 public UUID getUuidGenevaReference() {
223 return uuidGenevaReference;
224 }
225
226
227 public void setGenevaReferenceTitle(String genevaReferenceTitle) {
228 this.genevaReferenceTitle = genevaReferenceTitle;
229 }
230
231
232 public String getGenevaReferenceTitle() {
233 return genevaReferenceTitle;
234 }
235
236
237 public DO_REFERENCES getDoReferences() {
238 return doReferences;
239 }
240 public void setDoReferences(DO_REFERENCES doReferences) {
241 this.doReferences = doReferences;
242 }
243
244 public boolean isDoTaxa() {
245 return doTaxa;
246 }
247 public void setDoTaxa(boolean doTaxa) {
248 this.doTaxa = doTaxa;
249 }
250
251
252
253 }