1
|
package eu.etaxonomy.cdm.app.caryophyllales;
|
2
|
|
3
|
|
4
|
import org.apache.log4j.Logger;
|
5
|
|
6
|
import eu.etaxonomy.cdm.app.common.CdmDestinations;
|
7
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
8
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
9
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
10
|
import eu.etaxonomy.cdm.io.common.DeleteNonReferencedReferencesConfigurator;
|
11
|
import eu.etaxonomy.cdm.io.common.ImportResult;
|
12
|
|
13
|
|
14
|
public class DeleteNonReferencedReferences {
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
|
20
|
private static final Logger logger = Logger.getLogger(DeleteNonReferencedReferences.class);
|
21
|
|
22
|
//database validation status (create, update, validate ...)
|
23
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
|
24
|
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_caryo();
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30
|
private ImportResult doInvoke(ICdmDataSource destination){
|
31
|
ImportResult result = new ImportResult();
|
32
|
|
33
|
DeleteNonReferencedReferencesConfigurator config;
|
34
|
config = DeleteNonReferencedReferencesConfigurator.NewInstance(cdmDestination);
|
35
|
|
36
|
// invoke import
|
37
|
CdmDefaultImport<DeleteNonReferencedReferencesConfigurator> myImport = new CdmDefaultImport<DeleteNonReferencedReferencesConfigurator>();
|
38
|
result = myImport.invoke(config);
|
39
|
//String successString = success ? "successful" : " with errors ";
|
40
|
//System.out.println("End updating caches for "+ destination.getDatabase() + "..." + successString);
|
41
|
return result;
|
42
|
}
|
43
|
|
44
|
/**
|
45
|
* @param args
|
46
|
*/
|
47
|
public static void main(String[] args) {
|
48
|
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination;
|
49
|
|
50
|
System.out.println("Start deleting non referenced objects for "+ destination.getDatabase() + "...");
|
51
|
DeleteNonReferencedReferences me = new DeleteNonReferencedReferences();
|
52
|
me.doInvoke(destination);
|
53
|
|
54
|
}
|
55
|
|
56
|
}
|
57
|
|
58
|
|
59
|
|
60
|
|