more generic for export io classes
[cdmlib-apps.git] / cdm-pesi / src / main / java / eu / etaxonomy / cdm / io / pesi / out / PesiExportConfigurator.java
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.IExportConfigurator;
17 import eu.etaxonomy.cdm.io.common.Source;
18 import eu.etaxonomy.cdm.model.reference.Reference;
19 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
20
21 /**
22 * @author e.-m.lee
23 * @date 12.02.2010
24 *
25 */
26 public class PesiExportConfigurator extends DbExportConfiguratorBase<PesiExportState> implements IExportConfigurator<PesiExportState> {
27 @SuppressWarnings("unused")
28 private static Logger logger = Logger.getLogger(PesiExportConfigurator.class);
29 private int limitSave = 2000;
30
31 private Reference<?> auctReference;
32 private boolean doOccurrence = true;
33 private boolean doFacts = true;
34 private boolean doNameFacts = true;
35 private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
36 private boolean doTaxa = true;
37 private boolean doRelTaxa = true;
38
39
40 public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source) {
41 return new PesiExportConfigurator(pesiDestination, source);
42 }
43
44 @SuppressWarnings("unchecked")
45 protected void makeIoClassList() {
46 ioClassList = new Class[]{
47 PesiSourceExport.class,
48 PesiTaxonExport.class,
49 PesiRelTaxonExport.class, // RelTaxonId's could be deleted from state hashmap
50 PesiNoteExport.class,
51 PesiNoteSourceExport.class, // NoteId's could be deleted from state hashmap
52 PesiAdditionalTaxonSourceExport.class,
53 PesiOccurrenceExport.class,
54 PesiOccurrenceSourceExport.class,
55 PesiImageExport.class,
56 };
57
58 }
59
60 /**
61 * @param pesiSource
62 * @param cdmSource
63 */
64 private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource) {
65 super();
66 setSource(cdmSource);
67 setDestination(pesiSource);
68 }
69
70 /* (non-Javadoc)
71 * @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
72 */
73 public PesiExportState getNewState() {
74 return new PesiExportState(this);
75 }
76
77 /**
78 * @return the limitSave
79 */
80 public int getLimitSave() {
81 return limitSave;
82 }
83
84 /**
85 * @param limitSave the limitSave to set
86 */
87 public void setLimitSave(int limitSave) {
88 this.limitSave = limitSave;
89 }
90
91 /**
92 * Returns the Reference for a Misapplied Name.
93 * Copied from FaunaEuropaeaImportConfigurator.
94 * @return
95 */
96 public Reference<?> getAuctReference() {
97 if (auctReference == null){
98 auctReference = ReferenceFactory.newGeneric();
99
100 auctReference.setTitleCache("auct.", true);
101 }
102 return auctReference;
103 }
104
105 public boolean isDoOccurrence() {
106 return doOccurrence;
107 }
108 public void setDoOccurrence(boolean doOccurrence) {
109 this.doOccurrence = doOccurrence;
110 }
111
112
113 public boolean isDoFacts() {
114 return doFacts;
115 }
116 public void setDoFacts(boolean doFacts) {
117 this.doFacts = doFacts;
118 }
119
120 public boolean isDoNameFacts() {
121 return doNameFacts;
122 }
123 public void setDoNameFacts(boolean doNameFacts) {
124 this.doNameFacts = doNameFacts;
125 }
126
127
128
129 public DO_REFERENCES getDoReferences() {
130 return doReferences;
131 }
132 public void setDoReferences(DO_REFERENCES doReferences) {
133 this.doReferences = doReferences;
134 }
135
136 public boolean isDoTaxa() {
137 return doTaxa;
138 }
139 public void setDoTaxa(boolean doTaxa) {
140 this.doTaxa = doTaxa;
141 }
142
143 public boolean isDoRelTaxa() {
144 return doRelTaxa;
145 }
146 public void setDoRelTaxa(boolean doRelTaxa) {
147 this.doRelTaxa = doRelTaxa;
148 }
149
150
151
152
153
154 }