Project

General

Profile

« Previous | Next » 

Revision 3776382f

Added by Andreas Kohlbecker about 3 years ago

ref #9475 fixing NameTypeDesignations for existing names in other nom acts can not be created

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java
91 91
@Scope("prototype")
92 92
public class SpecimenTypeDesignationWorkingsetEditorPresenter
93 93
    extends AbstractEditorPresenter<SpecimenTypeDesignationWorkingSetDTO , SpecimenTypeDesignationWorkingsetPopupEditorView>
94
    implements CachingPresenter, DisposableBean {
94
    implements CachingPresenter, NomenclaturalActContext, DisposableBean {
95 95

  
96 96
    private static final long serialVersionUID = 4255636253714476918L;
97 97

  
......
142 142

  
143 143
    private BeanInstantiator<Reference> newReferenceInstantiator;
144 144

  
145
    /**
146
     * possible values:
147
     *
148
     * <ul>
149
     * <li>NULL: undecided, should be treaded like <code>false</code></li>
150
     * <li>false: the typification is published in an nomenclatural act in which no new name or new combination is being published.
151
     * The available {@link TypeDesignationStatusBase} should be limited to those with
152
     * <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</code></li>
153
     * <li>true: only status with <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</li>
154
     * </ul>
155
     */
156 145
    private Optional<Boolean> isInTypedesignationOnlyAct = Optional.empty();
157 146

  
158

  
159 147
    /**
160 148
     * Loads an existing working set from the database. This process actually involves
161 149
     * loading the Registration specified by the <code>RegistrationAndWorkingsetId.registrationId</code> and in
......
196 184
            // need to use load() but put() see #7214
197 185
            cache.load(registration);
198 186
            rootEntities.add(registration);
199
            isInTypedesignationOnlyAct = Optional.of(Boolean.valueOf(registration.getName() == null));
187
            setInTypedesignationOnlyAct(Optional.of(Boolean.valueOf(registration.getName() == null)));
200 188
            try {
201 189
                DescriptionElementSource pubUnitSource = RegistrationDTO.findPublishedUnit(registration);
202 190
                if(pubUnitSource == null) {
......
313 301
                        doReferenceEditorEdit(row.designationReference);
314 302
                    }
315 303
                });
304
                row.designationReference.setRequired(checkInTypeDesignationOnlyAct());
305
                row.designationReference.getSelect().setNullSelectionAllowed(!checkInTypeDesignationOnlyAct());
316 306

  
317 307
                row.mediaSpecimenReference.loadFrom(
318 308
                        referencePagingProvider,
......
346 336
                .filter(t -> t instanceof SpecimenTypeDesignationStatus)
347 337
                .map(t -> (SpecimenTypeDesignationStatus)t)
348 338
                .filter(tsb ->
349
                    !isInTypedesignationOnlyAct.isPresent()
350
                    || isInTypedesignationOnlyAct.get().equals(false)
339
                    !checkInTypeDesignationOnlyAct()
351 340
                    || tsb.hasDesignationSource() == true
352 341
                )
353 342
                .collect(Collectors.toList());
......
541 530
        return rootEntities ;
542 531
    }
543 532

  
544
    /**
545
     * {@inheritDoc}
546
     */
547 533
    @Override
548 534
    public void destroy() throws Exception {
549 535
        super.destroy();
......
576 562
        this.publishedUnit = publishedUnit;
577 563
    }
578 564

  
565
    @Override
566
    public void setInTypedesignationOnlyAct(Optional<Boolean> isInTypedesignationOnlyAct) {
567
        this.isInTypedesignationOnlyAct = isInTypedesignationOnlyAct;
568
    }
569

  
570
    @Override
571
    public Optional<Boolean> isInTypedesignationOnlyAct() {
572
        return isInTypedesignationOnlyAct;
573
    }
574

  
579 575
}

Also available in: Unified diff