2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.app
.eflora
;
12 import java
.util
.UUID
;
14 import org
.apache
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
17 import eu
.etaxonomy
.cdm
.app
.common
.CdmImportSources
;
18 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
19 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
20 import eu
.etaxonomy
.cdm
.io
.common
.CdmDefaultImport
;
21 import eu
.etaxonomy
.cdm
.io
.common
.Source
;
22 import eu
.etaxonomy
.cdm
.io
.common
.IImportConfigurator
.CHECK
;
23 import eu
.etaxonomy
.cdm
.io
.eflora
.centralAfrica
.checklist
.CentralAfricaChecklistImportConfigurator
;
24 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
25 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
32 public class CentralAfricaChecklistActivator
{
33 @SuppressWarnings("unused")
34 private static final Logger logger
= Logger
.getLogger(CentralAfricaChecklistActivator
.class);
36 //database validation status (create, update, validate ...)
37 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.VALIDATE
;
38 static final Source mySource
= CdmImportSources
.AFRICA_CHECKLIST_ACCESS();
40 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_andreasM3();
41 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_preview();
42 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_central_africa_production();
43 static final ICdmDataSource cdmDestination
= CdmDestinations
.localH2();
45 int recordsPerTransaction
= 1000;
48 public static final UUID featureTreeUuid
= UUID
.fromString("ebe558b5-d04d-41d5-83d9-b61c56e6e34a");
50 public static final String sourceReference
= "Flora of Central Africa - Checklist";
52 private UUID uuidGenevaReference
= UUID
.fromString("cf3fd13d-6cad-430c-ab70-7ea841b7159f");
54 private String genevaReferenceTitle
= "Geneva Database";
57 public static final UUID classificationUuid
= UUID
.fromString("ce1d035a-79a9-4a3a-95bf-26641ecb4fbe");
60 static final CHECK check
= CHECK
.IMPORT_WITHOUT_CHECK
;
63 static final boolean doTaxa
= true;
65 private void doImport(ICdmDataSource cdmDestination
){
68 Source source
= mySource
;
70 CentralAfricaChecklistImportConfigurator config
= CentralAfricaChecklistImportConfigurator
.NewInstance(source
, cdmDestination
);
71 config
.setClassificationUuid(classificationUuid
);
72 config
.setDoTaxa(doTaxa
);
73 config
.setCheck(check
);
74 config
.setDbSchemaValidation(hbm2dll
);
75 config
.setRecordsPerTransaction(recordsPerTransaction
);
76 config
.setGenevaReferenceTitle(genevaReferenceTitle
);
77 config
.setUuidGenevaReference(uuidGenevaReference
);
79 CdmDefaultImport
<CentralAfricaChecklistImportConfigurator
> myImport
= new CdmDefaultImport
<CentralAfricaChecklistImportConfigurator
>();
81 System
.out
.println("Start import from ("+ source
.toString() + ") ...");
82 config
.setSourceReference(getSourceReference(sourceReference
));
83 myImport
.invoke(config
);
84 System
.out
.println("End import from ("+ source
.toString() + ")...");
88 // FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
89 // myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
93 private Reference
getSourceReference(String string
) {
94 Reference result
= ReferenceFactory
.newGeneric();
95 result
.setTitleCache(string
);
99 // private FeatureTree makeFeatureNode(ITermService service){
100 // FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();
102 // FeatureTree result = FeatureTree.NewInstance(featureTreeUuid);
103 // result.setTitleCache("Flora Malesiana Presentation Feature Tree");
104 // FeatureNode root = result.getRoot();
105 // FeatureNode newNode;
107 // newNode = FeatureNode.NewInstance(Feature.CITATION());
108 // root.addChild(newNode);
110 // newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
111 // root.addChild(newNode);
121 public static void main(String
[] args
) {
122 CentralAfricaChecklistActivator me
= new CentralAfricaChecklistActivator();
123 me
.doImport(cdmDestination
);