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
.berlinModelImport
;
12 import java
.util
.UUID
;
14 import org
.apache
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
17 import eu
.etaxonomy
.cdm
.database
.DbSchemaValidation
;
18 import eu
.etaxonomy
.cdm
.database
.ICdmDataSource
;
19 import eu
.etaxonomy
.cdm
.io
.berlinModel
.in
.BerlinModelImportConfigurator
;
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
.common
.IImportConfigurator
.DO_REFERENCES
;
24 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
28 * TODO add the following to a wiki page:
29 * HINT: If you are about to import into a mysql data base running under windows and if you wish to dump and restore the resulting data bas under another operation systen
30 * you must set the mysql system variable lower_case_table_names = 0 in order to create data base with table compatible names.
36 public class AlgaTerraActivator
{
37 private static final Logger logger
= Logger
.getLogger(AlgaTerraActivator
.class);
39 //database validation status (create, update, validate ...)
40 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.CREATE
;
41 static final Source berlinModelSource
= BerlinModelSources
.AlgaTerra();
42 // static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
43 static final ICdmDataSource cdmDestination
= CdmDestinations
.cdm_algaterra_preview();
45 static final UUID treeUuid
= UUID
.fromString("1f617402-78dc-4bf1-ac77-d260600a8879");
46 static final int sourceSecId
= 7331;
48 static final UUID featureTreeUuid
= UUID
.fromString("a970168a-36fd-4c7c-931e-87214a965c14");
49 static final Object
[] featureKeyList
= new Integer
[]{7,201,202,203,204,205,206,207};
52 static final CHECK check
= CHECK
.CHECK_AND_IMPORT
;
56 static final NomenclaturalCode nomenclaturalCode
= NomenclaturalCode
.ICBN
;
58 // ****************** ALL *****************************************
61 static final boolean doAuthors
= true;
63 static final DO_REFERENCES doReferences
= DO_REFERENCES
.ALL
;
65 static final boolean doTaxonNames
= true;
66 static final boolean doRelNames
= true;
67 static final boolean doNameStatus
= true;
68 static final boolean doTypes
= false;
69 static final boolean doNameFacts
= false;
72 static final boolean doTaxa
= true;
73 static final boolean doRelTaxa
= true;
74 static final boolean doFacts
= true;
75 static final boolean doOccurences
= false;
76 static final boolean doCommonNames
= false;
78 // ************************ NONE **************************************** //
81 // static final boolean doAuthors = false;
83 // static final DO_REFERENCES doReferences = DO_REFERENCES.NONE;
85 // static final boolean doTaxonNames = true;
86 // static final boolean doRelNames = false;
87 // static final boolean doNameStatus = false;
88 // static final boolean doTypes = false;
89 // static final boolean doNameFacts = false;
92 // static final boolean doTaxa = false;
93 // static final boolean doRelTaxa = false;
94 // static final boolean doFacts = true;
95 // static final boolean doOccurences = false;
102 public static void main(String
[] args
) {
103 System
.out
.println("Start import from BerlinModel("+ berlinModelSource
.getDatabase() + ") ...");
104 logger
.debug("Start");
105 //make BerlinModel Source
106 Source source
= berlinModelSource
;
107 ICdmDataSource destination
= CdmDestinations
.chooseDestination(args
) != null ? CdmDestinations
.chooseDestination(args
) : cdmDestination
;
109 BerlinModelImportConfigurator bmImportConfigurator
= BerlinModelImportConfigurator
.NewInstance(source
, destination
);
111 bmImportConfigurator
.setClassificationUuid(treeUuid
);
112 bmImportConfigurator
.setSourceSecId(sourceSecId
);
113 bmImportConfigurator
.setNomenclaturalCode(nomenclaturalCode
);
115 bmImportConfigurator
.setDoAuthors(doAuthors
);
116 bmImportConfigurator
.setDoReferences(doReferences
);
117 bmImportConfigurator
.setDoTaxonNames(doTaxonNames
);
118 bmImportConfigurator
.setDoRelNames(doRelNames
);
119 bmImportConfigurator
.setDoNameStatus(doNameStatus
);
120 bmImportConfigurator
.setDoTypes(doTypes
);
121 bmImportConfigurator
.setDoNameFacts(doNameFacts
);
123 bmImportConfigurator
.setDoTaxa(doTaxa
);
124 bmImportConfigurator
.setDoRelTaxa(doRelTaxa
);
125 bmImportConfigurator
.setDoFacts(doFacts
);
126 bmImportConfigurator
.setDoOccurrence(doOccurences
);
127 bmImportConfigurator
.setDoCommonNames(doCommonNames
);
129 bmImportConfigurator
.setDbSchemaValidation(hbm2dll
);
131 bmImportConfigurator
.setCheck(check
);
134 CdmDefaultImport
<BerlinModelImportConfigurator
> bmImport
= new CdmDefaultImport
<BerlinModelImportConfigurator
>();
135 bmImport
.invoke(bmImportConfigurator
);
138 System
.out
.println("End import from BerlinModel ("+ source
.getDatabase() + ")...");