new DbImportBase and DbImportConfigurator
[cdmlib-apps.git] / app-import / src / main / java / eu / etaxonomy / cdm / io / redlist / RoteListeDbImportConfigurator.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.redlist;
11
12 import org.apache.log4j.Logger;
13
14 import eu.etaxonomy.cdm.database.ICdmDataSource;
15 import eu.etaxonomy.cdm.io.common.DbImportConfiguratorBase;
16 import eu.etaxonomy.cdm.io.common.IImportConfigurator;
17 import eu.etaxonomy.cdm.io.common.ImportStateBase;
18 import eu.etaxonomy.cdm.io.common.Source;
19 import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
20 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
21 import eu.etaxonomy.cdm.model.reference.Reference;
22 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
23
24
25 /**
26 * @author a.mueller
27 * @created 27.08.2012
28 * @version 1.0
29 */
30 public class RoteListeDbImportConfigurator extends DbImportConfiguratorBase<RoteListeDbImportState> implements IImportConfigurator{
31 @SuppressWarnings("unused")
32 private static Logger logger = Logger.getLogger(RoteListeDbImportConfigurator.class);
33
34 public static RoteListeDbImportConfigurator NewInstance(Source ermsSource, ICdmDataSource destination){
35 return new RoteListeDbImportConfigurator(ermsSource, destination);
36 }
37
38 /* Max number of records to be saved with one service call */
39 private int recordsPerTransaction = 1000; //defaultValue
40
41 private DO_REFERENCES doReferences = DO_REFERENCES.ALL;
42 private boolean doTaxa = true;
43
44
45 private static IInputTransformer defaultTransformer = new RoteListeDbTransformer();
46
47 protected void makeIoClassList(){
48 ioClassList = new Class[]{
49 RoteListeDbTaxonImport.class,
50 };
51 }
52
53
54 /* (non-Javadoc)
55 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
56 */
57 public ImportStateBase getNewState() {
58 return new RoteListeDbImportState(this);
59 }
60
61
62
63 private RoteListeDbImportConfigurator(Source source, ICdmDataSource destination) {
64 super(source, destination, NomenclaturalCode.ICBN, defaultTransformer);
65 }
66
67
68 /**
69 * @return the limitSave
70 */
71 public int getRecordsPerTransaction() {
72 return recordsPerTransaction;
73 }
74
75 /**
76 * @param limitSave the limitSave to set
77 */
78 public void setRecordsPerTransaction(int recordsPerTransaction) {
79 this.recordsPerTransaction = recordsPerTransaction;
80 }
81
82 public DO_REFERENCES getDoReferences() {
83 return doReferences;
84 }
85 public void setDoReferences(DO_REFERENCES doReferences) {
86 this.doReferences = doReferences;
87 }
88
89 public boolean isDoTaxa() {
90 return doTaxa;
91 }
92 public void setDoTaxa(boolean doTaxa) {
93 this.doTaxa = doTaxa;
94 }
95
96
97
98 }