Revision 8422c0cd
Added by Andreas Müller almost 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/caryophyllales/CaryoActivator.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 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 |
*/ |
... | ... | |
33 | 33 |
*/ |
34 | 34 |
public class CaryoActivator extends SourceBase{ |
35 | 35 |
private static final Logger logger = Logger.getLogger(CaryoActivator.class); |
36 |
|
|
36 |
|
|
37 | 37 |
//database validation status (create, update, validate ...) |
38 | 38 |
static final DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE; |
39 | 39 |
static final Source source = caryo_len61(); |
40 | 40 |
|
41 |
|
|
41 |
|
|
42 | 42 |
static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
43 | 43 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql(); |
44 | 44 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest(); |
45 |
|
|
45 |
|
|
46 | 46 |
static final String classificationName = "Caryophyllales"; |
47 |
|
|
47 |
|
|
48 | 48 |
//classification |
49 | 49 |
static final UUID classificationUuid = UUID.fromString("9edc58b5-de3b-43aa-9f31-1ede7c009c2b"); |
50 |
|
|
50 |
|
|
51 | 51 |
//check - import |
52 | 52 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
53 |
|
|
53 |
|
|
54 | 54 |
//taxa |
55 | 55 |
static final boolean doTaxa = true; |
56 | 56 |
static final boolean doDeduplicate = true; |
57 |
|
|
58 |
|
|
57 |
|
|
58 |
|
|
59 | 59 |
private void doImport(ICdmDataSource cdmDestination){ |
60 |
|
|
60 |
|
|
61 | 61 |
//make Source |
62 | 62 |
CaryoImportConfigurator config= CaryoImportConfigurator.NewInstance(source, cdmDestination); |
63 | 63 |
config.setClassificationUuid(classificationUuid); |
... | ... | |
66 | 66 |
config.setDbSchemaValidation(hbm2dll); |
67 | 67 |
config.setSourceReferenceTitle("NCU - Caryophyllales, v0.4"); |
68 | 68 |
config.setClassificationName(classificationName); |
69 |
|
|
69 |
|
|
70 | 70 |
CdmDefaultImport<CaryoImportConfigurator> myImport = new CdmDefaultImport<CaryoImportConfigurator>(); |
71 | 71 |
|
72 |
|
|
72 |
|
|
73 | 73 |
//... |
74 | 74 |
if (true){ |
75 | 75 |
System.out.println("Start import from ("+ source.toString() + ") ..."); |
... | ... | |
77 | 77 |
myImport.invoke(config); |
78 | 78 |
System.out.println("End import from ("+ source.toString() + ")..."); |
79 | 79 |
} |
80 |
|
|
81 |
|
|
82 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 | 83 |
//deduplicate |
84 | 84 |
if (doDeduplicate){ |
85 | 85 |
ICdmApplicationConfiguration app = myImport.getCdmAppController(); |
... | ... | |
90 | 90 |
count = app.getReferenceService().deduplicate(Reference.class, null, null); |
91 | 91 |
logger.warn("Deduplicated " + count + " references."); |
92 | 92 |
} |
93 |
|
|
93 |
|
|
94 | 94 |
} |
95 | 95 |
|
96 |
private Reference<?> getSourceReference(String string) {
|
|
97 |
Reference<?> result = ReferenceFactory.newGeneric();
|
|
96 |
private Reference getSourceReference(String string) { |
|
97 |
Reference result = ReferenceFactory.newGeneric(); |
|
98 | 98 |
result.setTitleCache(string); |
99 | 99 |
return result; |
100 | 100 |
} |
... | ... | |
119 | 119 |
CaryoActivator me = new CaryoActivator(); |
120 | 120 |
me.doImport(cdmDestination); |
121 | 121 |
} |
122 |
|
|
122 |
|
|
123 | 123 |
} |
Also available in: Unified diff
Remove generics from Reference in cdmlib-app #5830