Revision 7c429b09
Added by Andreas Müller almost 7 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiExportActivatorERMS.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2009 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
35 | 35 |
static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI(); |
36 | 36 |
// static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_FE2PESI(); |
37 | 37 |
// static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI(); |
38 |
|
|
38 |
|
|
39 | 39 |
static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql_erms(); |
40 | 40 |
//Taxon names can't be mapped to their CDM ids as PESI Taxon table mainly holds taxa and there IDs. We ad nameIdStart to the TaxonName id to get a unique id |
41 | 41 |
static final int nameIdStart = 10000000; |
42 | 42 |
static final IdType idType = IdType.CDM_ID_WITH_EXCEPTIONS; |
43 | 43 |
|
44 | 44 |
static final int partitionSize = 1000; |
45 |
|
|
45 |
|
|
46 | 46 |
//check - export |
47 | 47 |
static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK; |
48 | 48 |
|
49 | 49 |
//NomenclaturalCode |
50 | 50 |
static final NomenclaturalCode nomenclaturalCode = NomenclaturalCode.ICNAFP; |
51 |
|
|
51 |
|
|
52 | 52 |
static final boolean deleteAll = true; |
53 |
|
|
54 |
|
|
53 |
|
|
54 |
|
|
55 | 55 |
// ****************** ALL ***************************************** |
56 |
|
|
56 |
|
|
57 | 57 |
//references |
58 | 58 |
static final DO_REFERENCES doReferences = DO_REFERENCES.ALL; |
59 |
|
|
59 |
|
|
60 | 60 |
//taxa |
61 | 61 |
static final boolean doTaxa = true; |
62 | 62 |
static final boolean doTreeIndex = true; |
... | ... | |
64 | 64 |
static final boolean doInferredSynonyms = false; |
65 | 65 |
static final boolean doRelTaxa = true; |
66 | 66 |
static final boolean doDescriptions = true; |
67 |
|
|
67 |
|
|
68 | 68 |
static final boolean doNotes = true; |
69 | 69 |
static final boolean doNoteSources = true; |
70 | 70 |
static final boolean doAdditionalTaxonSource = true; |
71 | 71 |
static final boolean doOccurrence = true; |
72 | 72 |
static final boolean doOccurrenceSource = true; |
73 | 73 |
static final boolean doImage = true; |
74 |
|
|
74 |
|
|
75 | 75 |
|
76 | 76 |
// ************************ NONE **************************************** // |
77 |
|
|
77 |
|
|
78 | 78 |
// //references |
79 | 79 |
// static final DO_REFERENCES doReferences = DO_REFERENCES.NONE; |
80 |
//
|
|
80 |
// |
|
81 | 81 |
// //taxa |
82 | 82 |
// static final boolean doTaxa = false; |
83 | 83 |
// static final boolean doRelTaxa = false; |
... | ... | |
90 | 90 |
// static final boolean doTreeIndex = true; |
91 | 91 |
// static final boolean doRank = true; |
92 | 92 |
// static final boolean doInferredSynonyms = true; |
93 |
|
|
94 |
|
|
93 |
|
|
94 |
|
|
95 | 95 |
public boolean doExport(ICdmDataSource source){ |
96 | 96 |
System.out.println("Start export to PESI ("+ pesiDestination.getDatabase() + ") ..."); |
97 |
|
|
97 |
|
|
98 | 98 |
//make PESI Source |
99 | 99 |
Source destination = pesiDestination; |
100 | 100 |
PesiTransformer transformer = new PesiTransformer(destination); |
101 |
|
|
101 |
|
|
102 | 102 |
PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer); |
103 |
|
|
103 |
|
|
104 | 104 |
config.setDoTaxa(doTaxa); |
105 | 105 |
config.setDoRelTaxa(doRelTaxa); |
106 | 106 |
config.setDoOccurrence(doOccurrence); |
... | ... | |
113 | 113 |
config.setDoRank(doRank); |
114 | 114 |
config.setDoInferredSynonyms(doInferredSynonyms); |
115 | 115 |
config.setDoDescription(doDescriptions); |
116 |
|
|
116 |
|
|
117 | 117 |
config.setCheck(check); |
118 | 118 |
config.setLimitSave(partitionSize); |
119 | 119 |
config.setIdType(idType); |
... | ... | |
124 | 124 |
|
125 | 125 |
// invoke export |
126 | 126 |
CdmDefaultExport<PesiExportConfigurator> pesiExport = new CdmDefaultExport<PesiExportConfigurator>(); |
127 |
boolean result = pesiExport.invoke(config); |
|
128 |
|
|
127 |
boolean result = pesiExport.invoke(config).isSuccess();
|
|
128 |
|
|
129 | 129 |
System.out.println("End export to PESI ("+ destination.getDatabase() + ")..." + (result? "(successful)":"(with errors)")); |
130 | 130 |
return result; |
131 | 131 |
} |
132 |
|
|
132 |
|
|
133 | 133 |
/** |
134 | 134 |
* @param args |
135 | 135 |
*/ |
Also available in: Unified diff
ref #6541 adapt pesi to ImportResult