2 * Copyright (C) 2007 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
.eflora
.centralAfrica
.checklist
;
12 import java
.lang
.reflect
.Method
;
13 import java
.util
.UUID
;
15 import org
.apache
.log4j
.Logger
;
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
;
33 public class CentralAfricaChecklistImportConfigurator
extends ImportConfiguratorBase
<CentralAfricaChecklistImportState
, Source
> implements IImportConfigurator
{
34 @SuppressWarnings("unused")
35 private static Logger logger
= Logger
.getLogger(CentralAfricaChecklistImportConfigurator
.class);
37 private UUID uuidGenevaReference
= UUID
.fromString("cf3fd13d-6cad-430c-ab70-7ea841b7159f");
39 private String genevaReferenceTitle
= null;
41 public static CentralAfricaChecklistImportConfigurator
NewInstance(Source ermsSource
, ICdmDataSource destination
){
42 return new CentralAfricaChecklistImportConfigurator(ermsSource
, destination
);
45 /* Max number of records to be saved with one service call */
46 private int recordsPerTransaction
= 1000; //defaultValue
49 private Method userTransformationMethod
;
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;
59 private static IInputTransformer defaultTransformer
= new CentralAfricaChecklistTransformer();
61 protected void makeIoClassList(){
62 ioClassList
= new Class
[]{
63 //ErmsGeneralImportValidator.class
64 CentralAfricaChecklistReferenceImport
.class ,
65 CentralAfricaChecklistTaxonImport
.class,
66 CentralAfricaChecklistSynonymImport
.class
72 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
74 public ImportStateBase
getNewState() {
75 return new CentralAfricaChecklistImportState(this);
80 private CentralAfricaChecklistImportConfigurator(Source source
, ICdmDataSource destination
) {
81 super(defaultTransformer
);
82 setNomenclaturalCode(NomenclaturalCode
.ICZN
); //default for ERMS
84 setDestination(destination
);
88 public Source
getSource() {
89 return (Source
)super.getSource();
91 public void setSource(Source berlinModelSource
) {
92 super.setSource(berlinModelSource
);
96 * @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
98 public Reference
getSourceReference() {
99 if (sourceReference
== null){
100 sourceReference
= ReferenceFactory
.newDatabase();
101 if (getSource() != null){
102 sourceReference
.setTitleCache(getSource().getDatabase(), true);
105 return sourceReference
;
109 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
111 public String
getSourceNameString() {
112 if (this.getSource() == null){
115 return this.getSource().getDatabase();
120 * @return the userTransformationMethod
122 public Method
getUserTransformationMethod() {
123 return userTransformationMethod
;
127 * @param userTransformationMethod the userTransformationMethod to set
129 public void setUserTransformationMethod(Method userTransformationMethod
) {
130 this.userTransformationMethod
= userTransformationMethod
;
135 * @return the limitSave
137 public int getRecordsPerTransaction() {
138 return recordsPerTransaction
;
142 * @param limitSave the limitSave to set
144 public void setRecordsPerTransaction(int recordsPerTransaction
) {
145 this.recordsPerTransaction
= recordsPerTransaction
;
149 * @param doVernaculars the doVernaculars to set
151 public void setDoVernaculars(boolean doVernaculars
) {
152 this.doVernaculars
= doVernaculars
;
156 * @return the doVernaculars
158 public boolean isDoVernaculars() {
159 return doVernaculars
;
165 * @param doLinks the doLinks to set
167 public void setDoLinks(boolean doLinks
) {
168 this.doLinks
= doLinks
;
174 * @return the doLinks
176 public boolean isDoLinks() {
183 * @param doNotes the doNotes to set
185 public void setDoNotes(boolean doNotes
) {
186 this.doNotes
= doNotes
;
192 * @return the doNotes
194 public boolean isDoNotes() {
201 * @param doImages the doImages to set
203 public void setDoImages(boolean doImages
) {
204 this.doImages
= doImages
;
210 * @return the doImages
212 public boolean isDoImages() {
217 public void setUuidGenevaReference(UUID uuidGenevaReference
) {
218 this.uuidGenevaReference
= uuidGenevaReference
;
222 public UUID
getUuidGenevaReference() {
223 return uuidGenevaReference
;
227 public void setGenevaReferenceTitle(String genevaReferenceTitle
) {
228 this.genevaReferenceTitle
= genevaReferenceTitle
;
232 public String
getGenevaReferenceTitle() {
233 return genevaReferenceTitle
;
237 public DO_REFERENCES
getDoReferences() {
240 public void setDoReferences(DO_REFERENCES doReferences
) {
241 this.doReferences
= doReferences
;
244 public boolean isDoTaxa() {
247 public void setDoTaxa(boolean doTaxa
) {
248 this.doTaxa
= doTaxa
;