1
|
package eu.etaxonomy.cdm.app.caryophyllales;
|
2
|
import java.util.Arrays;
|
3
|
import java.util.List;
|
4
|
|
5
|
import org.apache.log4j.Logger;
|
6
|
|
7
|
import eu.etaxonomy.cdm.app.common.CdmDestinations;
|
8
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
9
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
10
|
import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator;
|
11
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
12
|
import eu.etaxonomy.cdm.io.common.ImportResult;
|
13
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
14
|
|
15
|
public class CaryophyllalesCacheUpdater {
|
16
|
|
17
|
private static final Logger logger = Logger.getLogger(CaryophyllalesCacheUpdater.class);
|
18
|
|
19
|
//database validation status (create, update, validate ...)
|
20
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
21
|
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_caryo();
|
22
|
|
23
|
static final List<String> classListStrings = Arrays.asList(new String[]{
|
24
|
//IdentifiableEntity.class.getName(),
|
25
|
// IdentifiableEntity.class.getName(),
|
26
|
//AgentBase.class.getName(),
|
27
|
//Reference.class.getName(),
|
28
|
//TaxonNameBase.class.getName(),
|
29
|
TaxonBase.class.getName()
|
30
|
|
31
|
|
32
|
});
|
33
|
//new ArrayList<Class<? extends IdentifiableEntity>>();
|
34
|
|
35
|
// **************** ALL *********************
|
36
|
|
37
|
// //DescriptionBase
|
38
|
// static final boolean doTaxonDescription = true;
|
39
|
// static final boolean doSpecimenDescription = true;
|
40
|
// static final boolean doNameDescription = true;
|
41
|
//
|
42
|
// //AgentBase
|
43
|
// static final boolean doPerson = true;
|
44
|
// static final boolean doTeam = true;
|
45
|
// static final boolean doInstitution = true;
|
46
|
//
|
47
|
// //MediaEntities
|
48
|
// static final boolean doCollection = true;
|
49
|
// static final boolean doReferenceBase = true;
|
50
|
//
|
51
|
// //SpecimenOrObservationBase
|
52
|
// static final boolean doFieldObservation = true;
|
53
|
// static final boolean doDeriveUnit = true;
|
54
|
// static final boolean doLivingBeing = true;
|
55
|
// static final boolean doObservation = true;
|
56
|
// static final boolean doSpecimen = true;
|
57
|
//
|
58
|
// //Media
|
59
|
// static final boolean doMedia = true;
|
60
|
// static final boolean doMediaKey = true;
|
61
|
// static final boolean doFigure = true;
|
62
|
// static final boolean doPhylogenticTree = true;
|
63
|
//
|
64
|
//
|
65
|
// //TaxonBase
|
66
|
// static final boolean doTaxon = true;
|
67
|
// static final boolean doSynonym = true;
|
68
|
//
|
69
|
// static final boolean doSequence = true;
|
70
|
//
|
71
|
// //Names
|
72
|
// static final boolean doViralName = true;
|
73
|
// static final boolean doNonViralName = true;
|
74
|
// static final boolean doBotanicalName = true;
|
75
|
// static final boolean doZoologicalName = true;
|
76
|
// static final boolean doCultivarPlantName = true;
|
77
|
//
|
78
|
// static final boolean doClassification = true;
|
79
|
//
|
80
|
// //TermBase
|
81
|
// static final boolean doFeatureTree = true;
|
82
|
// static final boolean doPolytomousKey = true;
|
83
|
//
|
84
|
// static final boolean doTermVocabulary = true;
|
85
|
// static final boolean doDefinedTermBase = true;
|
86
|
//
|
87
|
|
88
|
|
89
|
private ImportResult doInvoke(ICdmDataSource destination){
|
90
|
ImportResult result = new ImportResult();
|
91
|
|
92
|
CacheUpdaterConfigurator config;
|
93
|
try {
|
94
|
config = CacheUpdaterConfigurator.NewInstance(destination, classListStrings, true);
|
95
|
|
96
|
// invoke import
|
97
|
CdmDefaultImport<CacheUpdaterConfigurator> myImport = new CdmDefaultImport<CacheUpdaterConfigurator>();
|
98
|
result=myImport.invoke(config);
|
99
|
//String successString = success ? "successful" : " with errors ";
|
100
|
//System.out.println("End updating caches for "+ destination.getDatabase() + "..." + successString);
|
101
|
return result;
|
102
|
} catch (ClassNotFoundException e) {
|
103
|
logger.error(e);
|
104
|
result.setSuccess(false);
|
105
|
return result;
|
106
|
}
|
107
|
}
|
108
|
|
109
|
/**
|
110
|
* @param args
|
111
|
*/
|
112
|
public static void main(String[] args) {
|
113
|
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
|
114
|
|
115
|
System.out.println("Start updating caches for "+ destination.getDatabase() + "...");
|
116
|
CaryophyllalesCacheUpdater me = new CaryophyllalesCacheUpdater();
|
117
|
me.doInvoke(destination);
|
118
|
|
119
|
}
|
120
|
|
121
|
}
|
122
|
|
123
|
|