Project

General

Profile

« Previous | Next » 

Revision 850f48f3

Added by Andreas Kohlbecker about 6 years ago

ref #6740 setting typified name when no other type designations are in the registration

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationWorkingsetPresenter.java
427 427
    }
428 428

  
429 429
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
430
    public void onAddNewTypeDesignationWorkingset(TypeDesignationWorkingsetEditorAction event) {
430
    public void onTypeDesignationWorkingsetAdd(TypeDesignationWorkingsetEditorAction event) {
431 431

  
432 432
        if(event.getSourceComponent() != null){
433 433
            return;
......
469 469
            popup.withDeleteButton(true);
470 470
            popup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
471 471
            newNameTypeDesignationTarget = workingset.getRegistrationDTO(event.getRegistrationId()).get();
472

  
472 473
            popup.setBeanInstantiator(new BeanInstantiator<NameTypeDesignation>() {
473 474

  
474 475
                @Override
475 476
                public NameTypeDesignation createNewBean() {
477
                    TaxonName typifiedName = newNameTypeDesignationTarget.getTypifiedName();
478
                    if(typifiedName == null){
479
                        // this will be the first type designation, so the nomenclatural act must contain a name
480
                        typifiedName = newNameTypeDesignationTarget.registration().getName();
481
                    }
476 482
                    NameTypeDesignation nameTypeDesignation  = NameTypeDesignation.NewInstance();
477 483
                    nameTypeDesignation.setCitation(newNameTypeDesignationTarget.getCitation());
478
                    nameTypeDesignation.getTypifiedNames().add(newNameTypeDesignationTarget.getTypifiedName());
484
                    nameTypeDesignation.getTypifiedNames().add(typifiedName);
479 485
                    return nameTypeDesignation;
480 486
                }
481 487
            });

Also available in: Unified diff