85 |
85 |
static final Source berlinModelSource = BerlinModelSources.euroMed_BGBM42();
|
86 |
86 |
// static final Source berlinModelSource = BerlinModelSources.euroMed_PESI3();
|
87 |
87 |
|
88 |
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_euroMed();
|
|
88 |
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_euroMed();
|
89 |
89 |
|
90 |
|
static final ICdmDataSource cdmDestination = CdmDestinations.cdm_pesi_euromed();
|
|
90 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_pesi_euromed();
|
91 |
91 |
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_euromed3();
|
92 |
92 |
// static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
93 |
93 |
|
... | ... | |
106 |
106 |
static final int partitionSize = 2500;
|
107 |
107 |
|
108 |
108 |
//check - import
|
109 |
|
static final CHECK check = CHECK.CHECK_AND_IMPORT;
|
|
109 |
static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
110 |
110 |
|
111 |
111 |
//editor - import
|
112 |
112 |
static final EDITOR editor = EDITOR.EDITOR_AS_EDITOR;
|
... | ... | |
329 |
329 |
}
|
330 |
330 |
}
|
331 |
331 |
|
|
332 |
//1. run transmission engine #3979
|
332 |
333 |
private void runTransmissionEngine(BerlinModelImportConfigurator config,
|
333 |
334 |
CdmDefaultImport<BerlinModelImportConfigurator> bmImport) {
|
334 |
335 |
//Transmission engine #3979 .1
|
335 |
|
if (config.isDoOccurrence() && (config.getCheck().isImport() ) ){
|
|
336 |
if (true || config.isDoOccurrence() && (config.getCheck().isImport() ) ){
|
336 |
337 |
ICdmApplicationConfiguration app = bmImport.getCdmAppController();
|
337 |
338 |
|
338 |
339 |
final List<String> term_init_strategy = Arrays.asList(new String []{
|
339 |
340 |
"representations"
|
340 |
341 |
});
|
|
342 |
|
|
343 |
UUID uuidSuperAreaLevel = BerlinModelTransformer.uuidEuroMedAreaLevelFirst;
|
|
344 |
NamedAreaLevel euroMedLevel1 = (NamedAreaLevel)app.getTermService().find(uuidSuperAreaLevel);
|
|
345 |
|
341 |
346 |
Pager<NamedArea> areaPager = app.getTermService().list(
|
342 |
|
NamedAreaLevel.TDWG_LEVEL3(),
|
|
347 |
euroMedLevel1,
|
343 |
348 |
(NamedAreaType) null,
|
344 |
349 |
null,
|
345 |
350 |
null,
|
... | ... | |
356 |
361 |
}
|
357 |
362 |
}
|
358 |
363 |
|
|
364 |
//5.Mark areas to be hidden #3979 .5
|
359 |
365 |
private void markAreasAsHidden(BerlinModelImportConfigurator config,
|
360 |
366 |
CdmDefaultImport<BerlinModelImportConfigurator> bmImport) {
|
361 |
|
//5.Mark areas to be hidden #3979 .5
|
362 |
|
if (config.isDoOccurrence() && (config.getCheck().isImport())){
|
|
367 |
|
|
368 |
if (config.isDoOccurrence() && (config.getCheck().isImport())){
|
363 |
369 |
ICdmApplicationConfiguration app = bmImport.getCdmAppController();
|
|
370 |
TransactionStatus tx = app.startTransaction();
|
364 |
371 |
|
365 |
|
MarkerType hiddenAreaMarkerType = MarkerType.NewInstance("", "Hidden area", null);
|
|
372 |
MarkerType hiddenAreaMarkerType = MarkerType.NewInstance("Used to hide distributions for the named areas in publications", "Hidden Area", null);
|
366 |
373 |
hiddenAreaMarkerType.setUuid(BerlinModelTransformer.uuidHiddenArea);
|
367 |
374 |
@SuppressWarnings("unchecked")
|
368 |
375 |
TermVocabulary<MarkerType> vocUserDefinedMarkerTypes = app.getVocabularyService().find(CdmImportBase.uuidUserDefinedMarkerTypeVocabulary);
|
... | ... | |
382 |
389 |
rs_n.addMarker(Marker.NewInstance(hiddenAreaMarkerType, true));
|
383 |
390 |
app.getTermService().saveOrUpdate(rs_n);
|
384 |
391 |
}
|
|
392 |
app.commitTransaction(tx);
|
385 |
393 |
}
|
386 |
394 |
}
|
387 |
395 |
|
|
396 |
//2. import shapefile attributes #3979 .2
|
388 |
397 |
private void importShapefile(BerlinModelImportConfigurator config,
|
389 |
398 |
CdmDefaultImport<BerlinModelImportConfigurator> bmImport) {
|
390 |
|
// //import shapefile attributes #3979 .2
|
391 |
|
if (config.isDoOccurrence() && (config.getCheck().isImport())){
|
|
399 |
|
|
400 |
if (config.isDoOccurrence() && (config.getCheck().isImport())){
|
392 |
401 |
|
393 |
402 |
UUID areaVocabularyUuid = BerlinModelTransformer.uuidVocEuroMedAreas;
|
394 |
403 |
List<String> idSearchFields = Arrays.asList(new String[]{"EMAREA","PARENT"});
|
... | ... | |
419 |
428 |
}
|
420 |
429 |
}
|
421 |
430 |
|
422 |
|
private void createUsersAndRoles(BerlinModelImportConfigurator config,
|
|
431 |
//4. Create users and assign roles #3979
|
|
432 |
private void createUsersAndRoles(
|
|
433 |
BerlinModelImportConfigurator config,
|
423 |
434 |
CdmDefaultImport<BerlinModelImportConfigurator> bmImport) {
|
424 |
|
//4. Create users and assign roles #3979
|
425 |
|
if (config.isDoRelTaxa() && (config.getCheck().isImport())){
|
|
435 |
|
|
436 |
if (config.isDoRelTaxa() && (config.getCheck().isImport())){
|
426 |
437 |
ICdmApplicationConfiguration app = bmImport.getCdmAppController();
|
427 |
438 |
TransactionStatus tx = app.startTransaction();
|
428 |
439 |
|
... | ... | |
498 |
509 |
System.out.println(message);
|
499 |
510 |
}
|
500 |
511 |
UUID uuidCichorieaeGroup = UUID.fromString("a630938d-dd4f-48c2-9406-91def487b11e");
|
501 |
|
String cichorieaeGroupName = "cichorieae";
|
|
512 |
String cichorieaeGroupName = "Cichorieae";
|
502 |
513 |
Group cichorieaeGroup = checkGroup(app.getGroupService(), uuidCichorieaeGroup, cichorieaeGroupName, cichorieaeRoles);
|
503 |
514 |
cichorieaeGroup.addMember(userCichEditor);
|
504 |
515 |
app.getGroupService().saveOrUpdate(cichorieaeGroup);
|
Improve E+M import for transmission engine #3979