Revision 7d55de9a
Added by Andreas Kohlbecker over 5 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java | ||
---|---|---|
485 | 485 |
@EventBusListenerMethod |
486 | 486 |
public void onDoneWithTaxonnameEditor(DoneWithPopupEvent event) throws RegistrationValidationException{ |
487 | 487 |
if(event.getPopup() instanceof TaxonNamePopupEditor){ |
488 |
if(newNameForRegistrationPopupEditor != null && event.getPopup().equals(newNameForRegistrationPopupEditor)){ |
|
489 |
if(event.getReason().equals(Reason.SAVE)){ |
|
490 |
try { |
|
491 |
TransactionStatus txStatus = getRepo().startTransaction(); |
|
492 |
UUID taxonNameUuid = newNameForRegistrationPopupEditor.getBean().getUuid(); |
|
493 |
if(newNameForRegistrationPopupEditor.getBean().cdmEntity().isPersited()){ |
|
494 |
getRepo().getSession().refresh(newNameForRegistrationPopupEditor.getBean().cdmEntity()); |
|
495 |
} |
|
496 |
Registration reg = getRepo().getRegistrationService().createRegistrationForName(taxonNameUuid); |
|
497 |
if(!newNameBlockingRegistrations.isEmpty()){ |
|
498 |
for(Registration blockingReg : newNameBlockingRegistrations){ |
|
499 |
blockingReg = getRepo().getRegistrationService().load(blockingReg.getUuid()); |
|
500 |
reg.getBlockedBy().add(blockingReg); |
|
501 |
} |
|
502 |
getRepo().getRegistrationService().saveOrUpdate(reg); |
|
503 |
newNameBlockingRegistrations.clear(); |
|
488 |
if(newNameForRegistrationPopupEditor != null && event.getPopup().equals(newNameForRegistrationPopupEditor)){ |
|
489 |
if(event.getReason().equals(Reason.SAVE)){ |
|
490 |
try { |
|
491 |
TransactionStatus txStatus = getRepo().startTransaction(); |
|
492 |
UUID taxonNameUuid = newNameForRegistrationPopupEditor.getBean().getUuid(); |
|
493 |
if(newNameForRegistrationPopupEditor.getBean().cdmEntity().isPersited()){ |
|
494 |
getRepo().getSession().refresh(newNameForRegistrationPopupEditor.getBean().cdmEntity()); |
|
495 |
} |
|
496 |
Registration reg = getRepo().getRegistrationService().createRegistrationForName(taxonNameUuid); |
|
497 |
if(!newNameBlockingRegistrations.isEmpty()){ |
|
498 |
for(Registration blockingReg : newNameBlockingRegistrations){ |
|
499 |
blockingReg = getRepo().getRegistrationService().load(blockingReg.getUuid()); |
|
500 |
reg.getBlockedBy().add(blockingReg); |
|
504 | 501 |
} |
505 |
// reload workingset into current session |
|
506 |
loadWorkingSet(workingset.getCitationUuid()); |
|
507 |
workingset.add(reg); |
|
508 |
getRepo().commitTransaction(txStatus); |
|
509 |
} finally { |
|
510 |
getRepo().getSession().clear(); // #7702 |
|
511 |
refreshView(true); |
|
512 |
getView().getAddNewNameRegistrationButton().setEnabled(true); |
|
502 |
getRepo().getRegistrationService().saveOrUpdate(reg); |
|
503 |
newNameBlockingRegistrations.clear(); |
|
513 | 504 |
} |
514 |
// nullify and clear the memory on this popup editor in any case (SAVE, CANCEL, DELETE) |
|
515 |
newNameForRegistrationPopupEditor = null; |
|
516 |
newNameBlockingRegistrations.clear(); |
|
505 |
// reload workingset into current session |
|
506 |
loadWorkingSet(workingset.getCitationUuid()); |
|
507 |
workingset.add(reg); |
|
508 |
getRepo().commitTransaction(txStatus); |
|
509 |
} finally { |
|
510 |
getRepo().getSession().clear(); // #7702 |
|
511 |
refreshView(true); |
|
512 |
getView().getAddNewNameRegistrationButton().setEnabled(true); |
|
517 | 513 |
} |
518 | 514 |
} |
519 |
|
|
515 |
// nullify and clear the memory on this popup editor in any case (SAVE, CANCEL, DELETE) |
|
516 |
newNameForRegistrationPopupEditor = null; |
|
517 |
newNameBlockingRegistrations.clear(); |
|
518 |
getView().getAddNewNameRegistrationButton().setEnabled(true); |
|
519 |
} |
|
520 | 520 |
} |
521 | 521 |
} |
522 | 522 |
|
Also available in: Unified diff
fix #7893 always re-enabling the new name button when the new name editor is closed