Revision 5b647198
Added by Katja Luther over 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/app/caryophyllales/DeleteNonReferencedReferences.java | ||
---|---|---|
6 | 6 |
import eu.etaxonomy.cdm.app.common.CdmDestinations; |
7 | 7 |
import eu.etaxonomy.cdm.database.DbSchemaValidation; |
8 | 8 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
9 |
import eu.etaxonomy.cdm.io.caryo.CaryoImportConfigurator; |
|
10 |
import eu.etaxonomy.cdm.io.common.CacheUpdaterConfigurator; |
|
11 | 9 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
12 | 10 |
import eu.etaxonomy.cdm.io.common.DeleteNonReferencedReferencesConfigurator; |
13 |
import eu.etaxonomy.cdm.io.common.DeleteNonReferencedreferencesUpdater; |
|
11 |
|
|
14 | 12 |
|
15 | 13 |
public class DeleteNonReferencedReferences { |
16 |
|
|
17 |
|
|
18 | 14 |
|
19 | 15 |
|
20 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
21 | 19 |
private static final Logger logger = Logger.getLogger(DeleteNonReferencedReferences.class); |
22 | 20 |
|
23 | 21 |
//database validation status (create, update, validate ...) |
24 | 22 |
static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE; |
25 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_caryophyllales(); |
|
23 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_caryo(); |
|
24 |
|
|
25 |
|
|
26 |
|
|
26 | 27 |
|
27 |
|
|
28 | 28 |
|
29 |
|
|
30 |
|
|
31 | 29 |
private boolean doInvoke(ICdmDataSource destination){ |
32 | 30 |
boolean success = true; |
33 | 31 |
|
34 | 32 |
DeleteNonReferencedReferencesConfigurator config; |
35 | 33 |
config = DeleteNonReferencedReferencesConfigurator.NewInstance(cdmDestination); |
36 |
|
|
34 |
|
|
37 | 35 |
// invoke import |
38 | 36 |
CdmDefaultImport<DeleteNonReferencedReferencesConfigurator> myImport = new CdmDefaultImport<DeleteNonReferencedReferencesConfigurator>(); |
39 | 37 |
success &= myImport.invoke(config); |
40 | 38 |
String successString = success ? "successful" : " with errors "; |
41 | 39 |
System.out.println("End updating caches for "+ destination.getDatabase() + "..." + successString); |
42 |
return success;
|
|
40 |
return success; |
|
43 | 41 |
} |
44 |
|
|
42 |
|
|
45 | 43 |
/** |
46 | 44 |
* @param args |
47 | 45 |
*/ |
48 | 46 |
public static void main(String[] args) { |
49 | 47 |
ICdmDataSource destination = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmDestination; |
50 |
|
|
51 |
System.out.println("Start updating caches for "+ destination.getDatabase() + "...");
|
|
48 |
|
|
49 |
System.out.println("Start deleting non referenced objects for "+ destination.getDatabase() + "...");
|
|
52 | 50 |
DeleteNonReferencedReferences me = new DeleteNonReferencedReferences(); |
53 | 51 |
me.doInvoke(destination); |
54 |
|
|
52 |
|
|
55 | 53 |
} |
56 | 54 |
|
57 | 55 |
} |
Also available in: Unified diff
minor for Caryophyllales