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.app.common;
|
11
|
|
12
|
import java.util.HashSet;
|
13
|
import java.util.List;
|
14
|
import java.util.Set;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.application.CdmApplicationController;
|
19
|
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
|
20
|
import eu.etaxonomy.cdm.api.service.config.impl.TaxonServiceConfiguratorImpl;
|
21
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
22
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
23
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
24
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
25
|
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
|
26
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
27
|
import eu.etaxonomy.cdm.model.location.TdwgArea;
|
28
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
29
|
import eu.etaxonomy.cdm.persistence.query.MatchMode;
|
30
|
|
31
|
/**
|
32
|
* @author a.babadshanjan
|
33
|
* @created 12.05.2009
|
34
|
*/
|
35
|
public class TestActivator {
|
36
|
private static final Logger logger = Logger.getLogger(TestActivator.class);
|
37
|
|
38
|
//static final Source faunaEuropaeaSource = FaunaEuropaeaSources.faunEu();
|
39
|
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_edit_cichorieae_a();
|
40
|
|
41
|
static final int limitSave = 2000;
|
42
|
|
43
|
// static final CHECK check = CHECK.CHECK_AND_IMPORT;
|
44
|
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
45
|
static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.VALIDATE;
|
46
|
// static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.UPDATE;
|
47
|
// static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.VALIDATE;
|
48
|
static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICZN;
|
49
|
|
50
|
|
51
|
|
52
|
/**
|
53
|
* @param args
|
54
|
*/
|
55
|
public static void main(String[] args) {
|
56
|
|
57
|
ICdmDataSource destination = cdmDestination;
|
58
|
|
59
|
CdmApplicationController app;
|
60
|
app = CdmApplicationController.NewInstance(destination, dbSchemaValidation);
|
61
|
|
62
|
|
63
|
app.changeDataSource(destination);
|
64
|
ICdmDataSource cdmDestination = CdmDestinations.cdm_edit_cichorieae_a();
|
65
|
app.changeDataSource(cdmDestination);
|
66
|
ITaxonServiceConfigurator conf = TaxonServiceConfiguratorImpl.NewInstance();
|
67
|
conf.setDoSynonyms(true);
|
68
|
conf.setDoTaxa(true);
|
69
|
conf.setMatchMode(MatchMode.BEGINNING);
|
70
|
conf.setSearchString("L*");
|
71
|
conf.setPageNumber(0);
|
72
|
conf.setPageSize(50);
|
73
|
Set<NamedArea> areas = new HashSet<NamedArea>();
|
74
|
areas.add(TdwgArea.getAreaByTdwgAbbreviation("GER"));
|
75
|
//conf.setNamedAreas(areas);
|
76
|
|
77
|
Pager<IdentifiableEntity> taxaAndSyn = app.getTaxonService().findTaxaAndNames(conf);
|
78
|
List<IdentifiableEntity> taxList = taxaAndSyn.getRecords();
|
79
|
|
80
|
for (IdentifiableEntity ent: taxList){
|
81
|
|
82
|
System.err.println(ent.getTitleCache());
|
83
|
}
|
84
|
|
85
|
|
86
|
|
87
|
System.out.println("End importing Fauna Europaea data");
|
88
|
}
|
89
|
|
90
|
}
|