Revision 3776382f
Added by Andreas Kohlbecker about 3 years ago
src/main/java/eu/etaxonomy/cdm/service/SpecimenTypeDesignationWorkingSetServiceImpl.java | ||
---|---|---|
170 | 170 |
// associate the new typeDesignations with the registration |
171 | 171 |
for(SpecimenTypeDesignation std : newTypeDesignations){ |
172 | 172 |
assureFieldUnit(fieldUnit, std); |
173 |
// here the TypeDesignation.typifiedName is also set internally |
|
173 | 174 |
dto.getTypifiedName().addTypeDesignation(std, false); |
174 | 175 |
regPremerge.addTypeDesignation(std); |
175 | 176 |
} |
... | ... | |
182 | 183 |
|
183 | 184 |
Session session = repo.getSession(); |
184 | 185 |
|
185 |
session.merge(dto.getOwner());
|
|
186 |
session.merge(regPremerge);
|
|
186 | 187 |
session.flush(); |
187 | 188 |
|
188 | 189 |
// ------------------------ perform delete of removed SpecimenTypeDesignations |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationEditorView.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
10 | 10 |
|
11 |
import java.util.Optional; |
|
12 |
|
|
13 | 11 |
import com.vaadin.ui.NativeSelect; |
14 | 12 |
|
15 | 13 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
16 |
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase; |
|
17 | 14 |
import eu.etaxonomy.cdm.model.reference.Reference; |
18 | 15 |
import eu.etaxonomy.cdm.vaadin.view.AnnotationsEditor; |
19 | 16 |
import eu.etaxonomy.vaadin.component.ToManyRelatedEntitiesComboboxSelect; |
... | ... | |
25 | 22 |
* @since Jan 26, 2018 |
26 | 23 |
* |
27 | 24 |
*/ |
28 |
public interface NameTypeDesignationEditorView extends ApplicationView<NameTypeDesignationPresenter>, AnnotationsEditor { |
|
25 |
public interface NameTypeDesignationEditorView extends ApplicationView<NameTypeDesignationPresenter>, AnnotationsEditor, NomenclaturalActContext {
|
|
29 | 26 |
|
30 | 27 |
ToOneRelatedEntityCombobox<Reference> getDesignationReferenceCombobox(); |
31 | 28 |
|
... | ... | |
40 | 37 |
boolean isShowTypeFlags(); |
41 | 38 |
|
42 | 39 |
|
43 |
/** |
|
44 |
* possible values: |
|
45 |
* |
|
46 |
* <ul> |
|
47 |
* <li>NULL: undecided, should be treated like <code>false</code>. This can happen in cases when the typified name is missing the nomref</li> |
|
48 |
* <li>false: the typification is published in an nomenclatural act in which no new name or new combination is being published. |
|
49 |
* The available {@link TypeDesignationStatusBase} should be limited to those with |
|
50 |
* <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</code></li> |
|
51 |
* <li>true: only status with <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</li> |
|
52 |
* </ul> |
|
53 |
*/ |
|
54 |
public void setInTypedesignationOnlyAct(Optional<Boolean> isInTypedesignationOnlyAct); |
|
55 |
|
|
56 |
/** |
|
57 |
* possible values: |
|
58 |
* |
|
59 |
* <ul> |
|
60 |
* <li>NULL: undecided, should be treated like <code>false</code>. This can happen in cases when the typified name is missing the nomref</li> |
|
61 |
* <li>false: the typification is published in an nomenclatural act in which no new name or new combination is being published. |
|
62 |
* The available {@link TypeDesignationStatusBase} should be limited to those with |
|
63 |
* <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</code></li> |
|
64 |
* <li>true: only status with <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</li> |
|
65 |
* </ul> |
|
66 |
*/ |
|
67 |
public Optional<Boolean> isInTypedesignationOnlyAct(); |
|
68 |
|
|
69 | 40 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPopupEditor.java | ||
---|---|---|
72 | 72 |
|
73 | 73 |
private boolean showTypeFlags = true; |
74 | 74 |
|
75 |
Optional<Boolean> inTypedesignationOnlyAct = Optional.empty(); |
|
75 |
private Optional<Boolean> inTypedesignationOnlyAct = Optional.empty();
|
|
76 | 76 |
|
77 | 77 |
private FilterableAnnotationsField annotationsListField; |
78 | 78 |
|
... | ... | |
250 | 250 |
// need to check for isInTypedesignationOnlyAct also, otherwise the reference field will not show up |
251 | 251 |
// and the type designation might not be associated with the registration |
252 | 252 |
// TODO discuss with Henning |
253 |
typeStatusSelect.setRequired(typeStatusRequired || isInTypedesignationOnlyAct);
|
|
254 |
if(typeStatusRequired && isInTypedesignationOnlyAct) {
|
|
253 |
typeStatusSelect.setRequired(typeStatusRequired || checkInTypeDesignationOnlyAct());
|
|
254 |
if(typeStatusRequired && checkInTypeDesignationOnlyAct()) {
|
|
255 | 255 |
designationReferenceCombobox.setRequiredError(TYPE_STATUS_MUST_BE_SET); |
256 | 256 |
} else { |
257 | 257 |
designationReferenceCombobox.setRequiredError(TYPE_STATUS_OR_FLAG_MUST_BE_SET); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java | ||
---|---|---|
210 | 210 |
|
211 | 211 |
protected BeanItemContainer<NameTypeDesignationStatus> provideTypeStatusTermItemContainer() { |
212 | 212 |
|
213 |
Optional<Boolean> isInTypedesignationOnlyAct = getView().isInTypedesignationOnlyAct(); |
|
214 | 213 |
BeanItemContainer<NameTypeDesignationStatus> container = cdmBeanItemContainerFactory.buildBeanItemContainer(NameTypeDesignationStatus.class); |
215 | 214 |
List<NameTypeDesignationStatus> filteredItems = container.getItemIds().stream().filter(tsb -> |
216 |
!isInTypedesignationOnlyAct.isPresent() |
|
217 |
|| isInTypedesignationOnlyAct.get().equals(false) |
|
215 |
getView().checkInTypeDesignationOnlyAct() |
|
218 | 216 |
|| tsb.hasDesignationSource() == true |
219 | 217 |
) |
220 | 218 |
.collect(Collectors.toList()); |
... | ... | |
224 | 222 |
|
225 | 223 |
} |
226 | 224 |
|
227 |
/** |
|
228 |
* {@inheritDoc} |
|
229 |
*/ |
|
230 | 225 |
@Override |
231 | 226 |
public void handleViewEntered() { |
232 | 227 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NomenclaturalActContext.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2021 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
|
10 |
|
|
11 |
import java.util.Optional; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase; |
|
14 |
|
|
15 |
/** |
|
16 |
* @author a.kohlbecker |
|
17 |
* @since Feb 25, 2021 |
|
18 |
*/ |
|
19 |
public interface NomenclaturalActContext { |
|
20 |
|
|
21 |
|
|
22 |
/** |
|
23 |
* see {@link #isInTypedesignationOnlyAct()}. |
|
24 |
*/ |
|
25 |
public void setInTypedesignationOnlyAct(Optional<Boolean> isInTypedesignationOnlyAct); |
|
26 |
|
|
27 |
/** |
|
28 |
* Possible values of the Optional: |
|
29 |
* |
|
30 |
* <ul> |
|
31 |
* <li><code>!isPresent()</code> (value = NULL): undecided, is treated by {@link #checkInTypeDesignationOnlyAct()} like <code>false</code>. |
|
32 |
* This for example can happen in cases when the typified name misses the nomenclatural reference.</li> |
|
33 |
* <li><code>TRUE</code>: the typification is published in an nomenclatural act in which no new name or new combination is being published. |
|
34 |
* Consequently for example {@link TypeDesignationStatusBase} terms available in an editor should be limited to those with |
|
35 |
* <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</code>. Other consequences depend on the |
|
36 |
* type of designation and editor.</li> |
|
37 |
* <li><code>FALSE</code>: In the example from above all with <code>{@link TypeDesignationStatusBase}</code> terms are allowed.</li> |
|
38 |
* </ul> |
|
39 |
*/ |
|
40 |
public Optional<Boolean> isInTypedesignationOnlyAct(); |
|
41 |
|
|
42 |
/** |
|
43 |
* Interprets the value of the Optional according to the rules described in {@link #isInTypedesignationOnlyAct()} and returns |
|
44 |
* an easy to use <code>boolean</code> value. |
|
45 |
*/ |
|
46 |
public default boolean checkInTypeDesignationOnlyAct() { |
|
47 |
return !isInTypedesignationOnlyAct().isPresent() |
|
48 |
|| isInTypedesignationOnlyAct().get(); |
|
49 |
} |
|
50 |
|
|
51 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationDTORow.java | ||
---|---|---|
142 | 142 |
|
143 | 143 |
boolean withDesignationReference = typeStatus.getValue() != null && ((SpecimenTypeDesignationStatus)typeStatus.getValue()).hasDesignationSource(); |
144 | 144 |
|
145 |
designationReference.setEnabled(withDesignationReference); |
|
145 |
designationReference.setEnabled(withDesignationReference || designationReference.isRequired()); |
|
146 |
designationReference.setImmediate(designationReference.isRequired()); |
|
147 |
// if(designationReference.isRequired() && designationReference.isEmpty()) { |
|
148 |
// designationReference.selectFirst(); |
|
149 |
// designationReference.commitSelect(); |
|
150 |
// } |
|
146 | 151 |
designationReferenceDetail.setEnabled(withDesignationReference); |
147 | 152 |
|
148 | 153 |
mediaSpecimenReference.setEnabled(publishedImageType || unPublishedImageType); |
... | ... | |
152 | 157 |
} |
153 | 158 |
|
154 | 159 |
/** |
155 |
* |
|
156 | 160 |
* @return the 0-based position index of the <code>kindOfUnit</code> field in this class |
157 | 161 |
* which are visible according to {@link #visibleFields()) |
158 | 162 |
*/ |
... | ... | |
173 | 177 |
@Override |
174 | 178 |
public void updateRowItemsEnabledStates() { |
175 | 179 |
row.updateRowItemsEnablement(); |
176 |
|
|
177 | 180 |
} |
178 | 181 |
|
179 | 182 |
} |
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 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetIds.java | ||
---|---|---|
19 | 19 |
*/ |
20 | 20 |
public class SpecimenTypeDesignationWorkingsetIds extends TypeDesignationWorkingsetIds<FieldUnit> { |
21 | 21 |
|
22 |
/** |
|
23 |
* @param registrationUuid |
|
24 |
* @param baseEntityRef |
|
25 |
* @param typifiedNameUuid |
|
26 |
*/ |
|
27 | 22 |
public SpecimenTypeDesignationWorkingsetIds(UUID publishedUnitUuid, UUID registrationUuid, TypedEntityReference<FieldUnit> baseEntityRef, UUID typifiedNameUuid) { |
28 | 23 |
super(publishedUnitUuid, registrationUuid, baseEntityRef, typifiedNameUuid); |
29 | 24 |
} |
Also available in: Unified diff
ref #9475 fixing NameTypeDesignations for existing names in other nom acts can not be created