Revision 7115f486
Added by Andreas Müller almost 9 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/redlist/RoteListeDbChecklistActivator.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 |
*/ |
... | ... | |
18 | 18 |
import eu.etaxonomy.cdm.database.DbSchemaValidation; |
19 | 19 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
20 | 20 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
21 |
import eu.etaxonomy.cdm.io.common.Source; |
|
22 | 21 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK; |
22 |
import eu.etaxonomy.cdm.io.common.Source; |
|
23 | 23 |
import eu.etaxonomy.cdm.io.redlist.RoteListeDbImportConfigurator; |
24 | 24 |
import eu.etaxonomy.cdm.model.reference.Reference; |
25 | 25 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
... | ... | |
32 | 32 |
public class RoteListeDbChecklistActivator { |
33 | 33 |
@SuppressWarnings("unused") |
34 | 34 |
private static final Logger logger = Logger.getLogger(RoteListeDbChecklistActivator.class); |
35 |
|
|
35 |
|
|
36 | 36 |
//database validation status (create, update, validate ...) |
37 | 37 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE; |
38 | 38 |
static final Source mySource = CdmImportSources.ROTE_LISTE_DB(); |
39 |
|
|
39 |
|
|
40 | 40 |
static final ICdmDataSource cdmDestination = CdmDestinations.localH2(); |
41 | 41 |
|
42 | 42 |
int recordsPerTransaction = 1000; |
43 |
|
|
43 |
|
|
44 | 44 |
//feature tree uuid |
45 | 45 |
public static final UUID featureTreeUuid = UUID.fromString("ebe558b5-d04d-41d5-83d9-b61c56e6e34a"); |
46 |
|
|
46 |
|
|
47 | 47 |
public static final String sourceReference = "Flora of Central Africa - Checklist"; |
48 |
|
|
49 |
private UUID uuidGenevaReference = UUID.fromString("cf3fd13d-6cad-430c-ab70-7ea841b7159f"); |
|
50 |
|
|
51 |
private String genevaReferenceTitle = "Geneva Database"; |
|
52 |
|
|
48 |
|
|
49 |
|
|
53 | 50 |
//classification |
54 | 51 |
public static final UUID classificationUuid = UUID.fromString("ce1d035a-79a9-4a3a-95bf-26641ecb4fbe"); |
55 |
|
|
52 |
|
|
56 | 53 |
//check - import |
57 | 54 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK; |
58 |
|
|
55 |
|
|
59 | 56 |
//taxa |
60 | 57 |
static final boolean doTaxa = true; |
61 | 58 |
|
62 | 59 |
private void doImport(ICdmDataSource cdmDestination){ |
63 |
|
|
60 |
|
|
64 | 61 |
//make Source |
65 | 62 |
Source source = mySource; |
66 |
|
|
63 |
|
|
67 | 64 |
RoteListeDbImportConfigurator config= RoteListeDbImportConfigurator.NewInstance(source, cdmDestination); |
68 | 65 |
config.setClassificationUuid(classificationUuid); |
69 | 66 |
config.setDoTaxa(doTaxa); |
70 | 67 |
config.setCheck(check); |
71 | 68 |
config.setDbSchemaValidation(hbm2dll); |
72 | 69 |
config.setRecordsPerTransaction(recordsPerTransaction); |
73 |
|
|
70 |
|
|
74 | 71 |
CdmDefaultImport<RoteListeDbImportConfigurator> myImport = new CdmDefaultImport<RoteListeDbImportConfigurator>(); |
75 | 72 |
|
76 | 73 |
System.out.println("Start import from ("+ source.toString() + ") ..."); |
77 | 74 |
config.setSourceReference(getSourceReference(sourceReference)); |
78 | 75 |
myImport.invoke(config); |
79 | 76 |
System.out.println("End import from ("+ source.toString() + ")..."); |
80 |
|
|
81 | 77 |
|
82 |
|
|
78 |
|
|
79 |
|
|
83 | 80 |
// FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService()); |
84 | 81 |
// myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree); |
85 |
|
|
82 |
|
|
86 | 83 |
} |
87 |
|
|
84 |
|
|
88 | 85 |
private Reference getSourceReference(String string) { |
89 | 86 |
Reference result = ReferenceFactory.newGeneric(); |
90 | 87 |
result.setTitleCache(string); |
91 | 88 |
return result; |
92 | 89 |
} |
93 | 90 |
|
94 |
// private FeatureTree makeFeatureNode(ITermService service){ |
|
95 |
// FloraMalesianaTransformer transformer = new FloraMalesianaTransformer(); |
|
96 |
// |
|
97 |
// FeatureTree result = FeatureTree.NewInstance(featureTreeUuid); |
|
98 |
// result.setTitleCache("Flora Malesiana Presentation Feature Tree"); |
|
99 |
// FeatureNode root = result.getRoot(); |
|
100 |
// FeatureNode newNode; |
|
101 |
// |
|
102 |
// newNode = FeatureNode.NewInstance(Feature.CITATION()); |
|
103 |
// root.addChild(newNode); |
|
104 |
// |
|
105 |
// newNode = FeatureNode.NewInstance(Feature.DESCRIPTION()); |
|
106 |
// root.addChild(newNode); |
|
107 |
// |
|
108 |
// return result; |
|
109 |
// } |
|
110 |
|
|
111 |
|
|
112 | 91 |
|
113 | 92 |
/** |
114 | 93 |
* @param args |
... | ... | |
117 | 96 |
RoteListeDbChecklistActivator me = new RoteListeDbChecklistActivator(); |
118 | 97 |
me.doImport(cdmDestination); |
119 | 98 |
} |
120 |
|
|
99 |
|
|
121 | 100 |
} |
Also available in: Unified diff
Cleanup BfnXmlImport