2 * Copyright (C) 2023 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.
9 package eu
.etaxonomy
.cdm
.app
.lichenes
;
11 import java
.util
.UUID
;
13 import org
.apache
.logging
.log4j
.LogManager
;
14 import org
.apache
.logging
.log4j
.Logger
;
16 import eu
.etaxonomy
.cdm
.app
.common
.CdmDestinations
;
17 import eu
.etaxonomy
.cdm
.common
.URI
;
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
.IImportConfigurator
.CHECK
;
22 import eu
.etaxonomy
.cdm
.io
.lichenes
.CoraImportConfigurator
;
23 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
24 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
25 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
26 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
27 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
28 import eu
.etaxonomy
.cdm
.strategy
.parser
.TimePeriodParser
;
32 * Import for species of lichenes genus Cora.
34 * https://dev.e-taxonomy.eu/redmine/issues/10432
39 public class CoraImportActivator
{
41 @SuppressWarnings("unused")
42 private static final Logger logger
= LogManager
.getLogger();
44 //database validation status (create, update, validate ...)
45 static DbSchemaValidation hbm2dll
= DbSchemaValidation
.CREATE
;
47 static final ICdmDataSource cdmDestination
= CdmDestinations
.localH2();
48 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_cdmtest_mysql();
49 // static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_lichenes_cora();
52 static final UUID classificationUuid
= UUID
.fromString("43183724-1919-4036-84ee-3e0e84938f8d");
53 private static final String classificationName
= "Lichenes";
55 static final UUID secRefUuid
= UUID
.fromString("5c2e5198-6cbd-4d30-97d5-ee2abb1f422c");
56 static final UUID sourceRefUuid
= UUID
.fromString("ac67197e-8668-45cf-82bf-3682d21b3e69");
58 static final String fileName
= "cora_names_EDIT.xlsx";
61 static final CHECK check
= CHECK
.IMPORT_WITHOUT_CHECK
;
63 private void doImport(ICdmDataSource cdmDestination
){
66 URI source
= coraChecklist();
67 // URI source = lichenesChecklist_local();
69 CoraImportConfigurator config
= CoraImportConfigurator
.NewInstance(source
, cdmDestination
);
70 config
.setClassificationUuid(classificationUuid
);
71 config
.setClassificationName(classificationName
);
72 config
.setCheck(check
);
73 config
.setDbSchemaValidation(hbm2dll
);
74 // config.setUuidFeatureTree(featureTreeUuid);
75 // config.setFeatureTreeTitle(featureTreeTitle);
76 config
.setSecReference(getSecReference());
77 config
.setSourceReference(getSourceReference());
78 config
.setNomenclaturalCode(NomenclaturalCode
.Fungi
);
80 CdmDefaultImport
<CoraImportConfigurator
> myImport
= new CdmDefaultImport
<>();
81 myImport
.invoke(config
);
85 private URI
coraChecklist(){
86 return URI
.create("file:////BGBM-PESIHPC/Lichenes/" + fileName
);
89 private Reference secRef
;
90 private Reference
getSecReference(){
94 System
.out
.println("Sec Ref data still need to be updated");
95 Reference result
= ReferenceFactory
.newArticle();
96 result
.setTitle("Corrections and amendments to the 2016 classification of lichenized fungi in the Ascomycota and Basidiomycota");
97 result
.setDatePublished(TimePeriodParser
.parseStringVerbatim("2016"));
99 Team team
= Team
.NewInstance();
101 Person person
= Person
.NewInstance();
102 person
.setInitials("R.");
103 person
.setFamilyName("Lücking");
104 team
.addTeamMember(person
);
106 person
= Person
.NewInstance();
107 person
.setInitials("B.P.");
108 person
.setFamilyName("Hodkinson");
109 team
.addTeamMember(person
);
111 person
= Person
.NewInstance();
112 person
.setInitials("S.D.");
113 person
.setFamilyName("Leavitt");
114 team
.addTeamMember(person
);
116 result
.setAuthorship(team
);
118 // result.setPublisher("Berlin: Botanic Garden and Botanical Museum Berlin-Dahlem; Athens: Hellenic Botanical Society.");
120 result
.setVolume("120(1)");
121 Reference journal
= ReferenceFactory
.newJournal();
122 journal
.setTitle("The Bryologist");
123 result
.setInReference(journal
);
126 secRef
.setUuid(secRefUuid
);
130 private Reference
getSourceReference(){
131 Reference result
= ReferenceFactory
.newGeneric();
132 result
.setTitle("Excelfile (LichenesGeneraImport.xlsx) derived from ");
133 result
.setInReference(getSecReference());
134 result
.setUuid(sourceRefUuid
);
139 public static void main(String
[] args
) {
140 CoraImportActivator me
= new CoraImportActivator();
141 me
.doImport(cdmDestination
);