1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.io.pesi.out;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
import eu.etaxonomy.cdm.io.common.DbExportConfiguratorBase;
|
16
|
import eu.etaxonomy.cdm.io.common.ExportStateBase;
|
17
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
|
18
|
import eu.etaxonomy.cdm.io.common.Source;
|
19
|
import eu.etaxonomy.cdm.io.common.IExportConfigurator.DO_REFERENCES;
|
20
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
21
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
22
|
|
23
|
/**
|
24
|
* @author e.-m.lee
|
25
|
* @date 12.02.2010
|
26
|
*
|
27
|
*/
|
28
|
public class PesiExportConfigurator extends DbExportConfiguratorBase implements IExportConfigurator {
|
29
|
@SuppressWarnings("unused")
|
30
|
private static Logger logger = Logger.getLogger(PesiExportConfigurator.class);
|
31
|
private int limitSave = 1000;
|
32
|
|
33
|
private Reference<?> auctReference;
|
34
|
private boolean doOccurrence = true;
|
35
|
private boolean doFacts = true;
|
36
|
private boolean doNameFacts = true;
|
37
|
private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
|
38
|
private boolean doTaxa = true;
|
39
|
private boolean doRelTaxa = true;
|
40
|
|
41
|
|
42
|
public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source) {
|
43
|
return new PesiExportConfigurator(pesiDestination, source);
|
44
|
}
|
45
|
|
46
|
@SuppressWarnings("unchecked")
|
47
|
protected void makeIoClassList() {
|
48
|
ioClassList = new Class[]{
|
49
|
PesiSourceExport.class,
|
50
|
PesiTaxonExport.class,
|
51
|
PesiRelTaxonExport.class, // RelTaxonId's could be deleted from state hashmap
|
52
|
PesiNoteExport.class,
|
53
|
PesiNoteSourceExport.class, // NoteId's could be deleted from state hashmap
|
54
|
PesiAdditionalTaxonSourceExport.class,
|
55
|
PesiOccurrenceExport.class,
|
56
|
PesiOccurrenceSourceExport.class,
|
57
|
PesiImageExport.class,
|
58
|
};
|
59
|
|
60
|
}
|
61
|
|
62
|
/**
|
63
|
* @param pesiSource
|
64
|
* @param cdmSource
|
65
|
*/
|
66
|
private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource) {
|
67
|
super();
|
68
|
setSource(cdmSource);
|
69
|
setDestination(pesiSource);
|
70
|
}
|
71
|
|
72
|
/* (non-Javadoc)
|
73
|
* @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
|
74
|
*/
|
75
|
@SuppressWarnings("unchecked")
|
76
|
public ExportStateBase getNewState() {
|
77
|
return new PesiExportState(this);
|
78
|
}
|
79
|
|
80
|
/**
|
81
|
* @return the limitSave
|
82
|
*/
|
83
|
public int getLimitSave() {
|
84
|
return limitSave;
|
85
|
}
|
86
|
|
87
|
/**
|
88
|
* @param limitSave the limitSave to set
|
89
|
*/
|
90
|
public void setLimitSave(int limitSave) {
|
91
|
this.limitSave = limitSave;
|
92
|
}
|
93
|
|
94
|
/**
|
95
|
* Returns the Reference for a Misapplied Name.
|
96
|
* Copied from FaunaEuropaeaImportConfigurator.
|
97
|
* @return
|
98
|
*/
|
99
|
public Reference<?> getAuctReference() {
|
100
|
if (auctReference == null){
|
101
|
auctReference = ReferenceFactory.newGeneric();
|
102
|
|
103
|
auctReference.setTitleCache("auct.", true);
|
104
|
}
|
105
|
return auctReference;
|
106
|
}
|
107
|
|
108
|
public boolean isDoOccurrence() {
|
109
|
return doOccurrence;
|
110
|
}
|
111
|
public void setDoOccurrence(boolean doOccurrence) {
|
112
|
this.doOccurrence = doOccurrence;
|
113
|
}
|
114
|
|
115
|
|
116
|
public boolean isDoFacts() {
|
117
|
return doFacts;
|
118
|
}
|
119
|
public void setDoFacts(boolean doFacts) {
|
120
|
this.doFacts = doFacts;
|
121
|
}
|
122
|
|
123
|
public boolean isDoNameFacts() {
|
124
|
return doNameFacts;
|
125
|
}
|
126
|
public void setDoNameFacts(boolean doNameFacts) {
|
127
|
this.doNameFacts = doNameFacts;
|
128
|
}
|
129
|
|
130
|
|
131
|
|
132
|
public DO_REFERENCES getDoReferences() {
|
133
|
return doReferences;
|
134
|
}
|
135
|
public void setDoReferences(DO_REFERENCES doReferences) {
|
136
|
this.doReferences = doReferences;
|
137
|
}
|
138
|
|
139
|
public boolean isDoTaxa() {
|
140
|
return doTaxa;
|
141
|
}
|
142
|
public void setDoTaxa(boolean doTaxa) {
|
143
|
this.doTaxa = doTaxa;
|
144
|
}
|
145
|
|
146
|
public boolean isDoRelTaxa() {
|
147
|
return doRelTaxa;
|
148
|
}
|
149
|
public void setDoRelTaxa(boolean doRelTaxa) {
|
150
|
this.doRelTaxa = doRelTaxa;
|
151
|
}
|
152
|
|
153
|
|
154
|
|
155
|
|
156
|
|
157
|
}
|