1
|
/**
|
2
|
* Copyright (C) 2018 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.ArrayList;
|
12
|
import java.util.Arrays;
|
13
|
import java.util.EnumSet;
|
14
|
import java.util.HashSet;
|
15
|
import java.util.List;
|
16
|
import java.util.Optional;
|
17
|
import java.util.UUID;
|
18
|
import java.util.stream.Collectors;
|
19
|
|
20
|
import org.apache.log4j.Logger;
|
21
|
import org.hibernate.criterion.Restrictions;
|
22
|
import org.springframework.beans.factory.annotation.Autowired;
|
23
|
import org.springframework.context.annotation.Scope;
|
24
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
25
|
|
26
|
import com.vaadin.data.util.BeanItemContainer;
|
27
|
import com.vaadin.spring.annotation.SpringComponent;
|
28
|
|
29
|
import eu.etaxonomy.cdm.api.service.DeleteResult;
|
30
|
import eu.etaxonomy.cdm.api.service.IService;
|
31
|
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO;
|
32
|
import eu.etaxonomy.cdm.api.service.name.TypeDesignationWorkingSet;
|
33
|
import eu.etaxonomy.cdm.api.service.registration.IRegistrationWorkingSetService;
|
34
|
import eu.etaxonomy.cdm.format.reference.ReferenceEllypsisFormatter;
|
35
|
import eu.etaxonomy.cdm.format.reference.ReferenceEllypsisFormatter.LabelType;
|
36
|
import eu.etaxonomy.cdm.model.common.Annotation;
|
37
|
import eu.etaxonomy.cdm.model.common.AnnotationType;
|
38
|
import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
|
39
|
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
|
40
|
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
|
41
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
42
|
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
|
43
|
import eu.etaxonomy.cdm.model.permission.CRUD;
|
44
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
45
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
46
|
import eu.etaxonomy.cdm.model.reference.ReferenceType;
|
47
|
import eu.etaxonomy.cdm.persistence.dao.initializer.EntityInitStrategy;
|
48
|
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
|
49
|
import eu.etaxonomy.cdm.service.CdmStore;
|
50
|
import eu.etaxonomy.cdm.service.UserHelperAccess;
|
51
|
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
|
52
|
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
|
53
|
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent.Type;
|
54
|
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
|
55
|
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
|
56
|
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater;
|
57
|
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader;
|
58
|
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUIDefaults;
|
59
|
import eu.etaxonomy.cdm.vaadin.ui.config.TaxonNamePopupEditorConfig;
|
60
|
import eu.etaxonomy.cdm.vaadin.util.ReferenceEllypsisCaptionGenerator;
|
61
|
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
|
62
|
import eu.etaxonomy.cdm.vaadin.view.reference.RegistrationUiReferenceEditorFormConfigurator;
|
63
|
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
|
64
|
import eu.etaxonomy.vaadin.mvp.AbstractView;
|
65
|
import eu.etaxonomy.vaadin.mvp.BeanInstantiator;
|
66
|
import eu.etaxonomy.vaadin.mvp.BoundField;
|
67
|
import eu.etaxonomy.vaadin.ui.view.PopupView;
|
68
|
|
69
|
/**
|
70
|
* @author a.kohlbecker
|
71
|
* @since Jan 26, 2018
|
72
|
*
|
73
|
*/
|
74
|
@SpringComponent
|
75
|
@Scope("prototype")
|
76
|
public class NameTypeDesignationPresenter
|
77
|
extends AbstractCdmEditorPresenter<NameTypeDesignation, NameTypeDesignationEditorView> {
|
78
|
|
79
|
private static final long serialVersionUID = 896305051895903033L;
|
80
|
|
81
|
public static final Logger logger = Logger.getLogger(SpecimenTypeDesignationWorkingsetEditorPresenter.class);
|
82
|
|
83
|
@Autowired
|
84
|
private IRegistrationWorkingSetService registrationWorkingSetService;
|
85
|
|
86
|
HashSet<TaxonName> typifiedNamesAsLoaded;
|
87
|
|
88
|
private TaxonName typifiedNameInContext;
|
89
|
|
90
|
/**
|
91
|
* The unit of publication in which the type designation has been published.
|
92
|
* This may be any type listed in {@link RegistrationUIDefaults#NOMECLATURAL_PUBLICATION_UNIT_TYPES}
|
93
|
* but never a {@link ReferenceType#Section}
|
94
|
*/
|
95
|
private DescriptionElementSource publishedUnit;
|
96
|
|
97
|
/**
|
98
|
* possible values:
|
99
|
*
|
100
|
* <ul>
|
101
|
* <li>NULL: undecided, should be treaded like <code>false</code></li>
|
102
|
* <li>false: the typification is published in an nomenclatural act in which no new name or new combination is being published.
|
103
|
* The available {@link TypeDesignationStatusBase} should be limited to those with
|
104
|
* <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</code></li>
|
105
|
* <li>true: only status with <code>{@link TypeDesignationStatusBase#hasDesignationSource() hasDesignationSource} == true</li>
|
106
|
* </ul>
|
107
|
*/
|
108
|
private Optional<Boolean> isInTypedesignationOnlyAct = Optional.empty();
|
109
|
|
110
|
|
111
|
protected static BeanInstantiator<NameTypeDesignation> defaultBeanInstantiator = new BeanInstantiator<NameTypeDesignation>() {
|
112
|
|
113
|
@Override
|
114
|
public NameTypeDesignation createNewBean() {
|
115
|
return NameTypeDesignation.NewInstance();
|
116
|
}
|
117
|
};
|
118
|
|
119
|
private CdmFilterablePagingProvider<Reference,Reference> referencePagingProvider;
|
120
|
|
121
|
private BeanInstantiator<Reference> newReferenceInstantiator;
|
122
|
|
123
|
|
124
|
@Override
|
125
|
protected BeanInstantiator<NameTypeDesignation> defaultBeanInstantiator(){
|
126
|
return defaultBeanInstantiator;
|
127
|
}
|
128
|
|
129
|
/**
|
130
|
* {@inheritDoc}
|
131
|
*/
|
132
|
@Override
|
133
|
protected NameTypeDesignation loadBeanById(Object identifier) {
|
134
|
NameTypeDesignation bean;
|
135
|
|
136
|
NameTypeDesignationWorkingsetIds idset = (NameTypeDesignationWorkingsetIds)identifier;
|
137
|
RegistrationDTO regDTO = registrationWorkingSetService.loadDtoByUuid(idset.registrationUuid);
|
138
|
typifiedNameInContext = regDTO.typifiedName();
|
139
|
// find the working set
|
140
|
if(idset.baseEntityRef != null) {
|
141
|
TypeDesignationWorkingSet typeDesignationWorkingSet = regDTO.getTypeDesignationWorkingSet(idset.baseEntityRef);
|
142
|
if(!typeDesignationWorkingSet.getBaseEntityReference().getType().equals(NameTypeDesignation.class)){
|
143
|
throw new RuntimeException("TypeDesignationWorkingsetEditorIdSet references not a NameTypeDesignation");
|
144
|
} else {
|
145
|
// TypeDesignationWorkingSet for NameTyped only contain one item!!!
|
146
|
UUID nameTypeDesignationUuid = typeDesignationWorkingSet.getTypeDesignations().get(0).getUuid();
|
147
|
bean = super.loadBeanById(nameTypeDesignationUuid);
|
148
|
}
|
149
|
} else {
|
150
|
bean = super.loadBeanById(null);
|
151
|
}
|
152
|
isInTypedesignationOnlyAct = Optional.of(Boolean.valueOf(regDTO.getNameRef() == null));
|
153
|
|
154
|
try {
|
155
|
setPublishedUnit(bean.getTypifiedNames().iterator().next().getNomenclaturalSource());
|
156
|
} catch (Exception e) {
|
157
|
// FIXME report error state instead
|
158
|
logger.error("Error on finding published unit in " + bean, e);
|
159
|
}
|
160
|
|
161
|
if (getPublishedUnit() != null) {
|
162
|
// reduce available references to those which are sections of
|
163
|
// the publicationUnit and the publishedUnit itself
|
164
|
referencePagingProvider.getCriteria()
|
165
|
.add(Restrictions.or(
|
166
|
Restrictions.and(
|
167
|
Restrictions.eq("inReference", publishedUnit.getCitation()),
|
168
|
Restrictions.eq("type", ReferenceType.Section)),
|
169
|
Restrictions.idEq(publishedUnit.getCitation().getId()))
|
170
|
);
|
171
|
|
172
|
// new Reference only a sub sections of the publishedUnit
|
173
|
newReferenceInstantiator = new BeanInstantiator<Reference>() {
|
174
|
@Override
|
175
|
public Reference createNewBean() {
|
176
|
Reference newRef = ReferenceFactory.newSection();
|
177
|
newRef.setInReference(publishedUnit.getCitation());
|
178
|
return newRef;
|
179
|
}
|
180
|
};
|
181
|
}
|
182
|
|
183
|
getView().getTypeStatusSelect().setContainerDataSource(provideTypeStatusTermItemContainer());
|
184
|
|
185
|
return bean;
|
186
|
}
|
187
|
|
188
|
|
189
|
/**
|
190
|
* {@inheritDoc}
|
191
|
*/
|
192
|
@Override
|
193
|
protected NameTypeDesignation loadCdmEntity(UUID uuid) {
|
194
|
EntityInitStrategy initStrategy = new EntityInitStrategy(Arrays.asList(new String []{
|
195
|
"$",
|
196
|
"annotations.*", // * is needed as log as we are using a table in FilterableAnnotationsField
|
197
|
"typifiedNames.typeDesignations", // important !!
|
198
|
"typifiedNames.nomenclaturalSource.citation",
|
199
|
"typeName.$",
|
200
|
"source.citation",
|
201
|
"source.annotations",
|
202
|
"source.markers",
|
203
|
"source.links",
|
204
|
}
|
205
|
));
|
206
|
|
207
|
initStrategy.extend("citation", ReferenceEllypsisFormatter.INIT_STRATEGY, false);
|
208
|
NameTypeDesignation typeDesignation;
|
209
|
if(uuid != null){
|
210
|
typeDesignation = (NameTypeDesignation) getRepo().getNameService().loadTypeDesignation(uuid, initStrategy.getPropertyPaths());
|
211
|
} else {
|
212
|
typeDesignation = createNewBean();
|
213
|
}
|
214
|
|
215
|
typifiedNamesAsLoaded = new HashSet<>(typeDesignation.getTypifiedNames());
|
216
|
|
217
|
return typeDesignation;
|
218
|
}
|
219
|
|
220
|
protected BeanItemContainer<NameTypeDesignationStatus> provideTypeStatusTermItemContainer() {
|
221
|
|
222
|
BeanItemContainer<NameTypeDesignationStatus> container = cdmBeanItemContainerFactory.buildBeanItemContainer(NameTypeDesignationStatus.class);
|
223
|
List<NameTypeDesignationStatus> filteredItems = container.getItemIds().stream().filter(tsb ->
|
224
|
!isInTypedesignationOnlyAct.isPresent()
|
225
|
|| isInTypedesignationOnlyAct.get().equals(false)
|
226
|
|| tsb.hasDesignationSource() == true
|
227
|
)
|
228
|
.collect(Collectors.toList());
|
229
|
container.removeAllItems();
|
230
|
container.addAll(filteredItems);
|
231
|
return container;
|
232
|
|
233
|
}
|
234
|
|
235
|
/**
|
236
|
* {@inheritDoc}
|
237
|
*/
|
238
|
@Override
|
239
|
public void handleViewEntered() {
|
240
|
|
241
|
getView().getTypeStatusSelect().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(NameTypeDesignationStatus.class));
|
242
|
getView().getTypeStatusSelect().setItemCaptionPropertyId("description");
|
243
|
|
244
|
getView().getDesignationReferenceCombobox().getSelect().setCaptionGenerator(
|
245
|
new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getDesignationReferenceCombobox().getSelect())
|
246
|
);
|
247
|
referencePagingProvider = pagingProviderFactory.referencePagingProvider();
|
248
|
getView().getDesignationReferenceCombobox().loadFrom(referencePagingProvider, referencePagingProvider, referencePagingProvider.getPageSize());
|
249
|
getView().getDesignationReferenceCombobox().setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getDesignationReferenceCombobox()));
|
250
|
getView().getDesignationReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getDesignationReferenceCombobox(), this));
|
251
|
|
252
|
CdmFilterablePagingProvider<TaxonName,TaxonName> namePagingProvider = pagingProviderFactory.taxonNamesWithoutOrthophicIncorrect();
|
253
|
getView().getTypeNameField().loadFrom(namePagingProvider, namePagingProvider, namePagingProvider.getPageSize());
|
254
|
getView().getTypeNameField().setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<TaxonName>(getView().getTypeNameField()));
|
255
|
getView().getTypeNameField().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getTypeNameField(), this));
|
256
|
|
257
|
getView().getTypifiedNamesComboboxSelect().setPagingProviders(namePagingProvider, namePagingProvider, namePagingProvider.getPageSize(), this);
|
258
|
|
259
|
getView().getAnnotationsField().setAnnotationTypeItemContainer(cdmBeanItemContainerFactory.buildVocabularyTermsItemContainer(
|
260
|
AnnotationType.EDITORIAL().getVocabulary().getUuid()));
|
261
|
|
262
|
}
|
263
|
|
264
|
@Override
|
265
|
protected void guaranteePerEntityCRUDPermissions(UUID identifier) {
|
266
|
if(crud != null){
|
267
|
newAuthorityCreated = UserHelperAccess.userHelper().createAuthorityForCurrentUser(NameTypeDesignation.class, identifier, crud, null);
|
268
|
}
|
269
|
}
|
270
|
|
271
|
@Override
|
272
|
protected void guaranteePerEntityCRUDPermissions(NameTypeDesignation bean) {
|
273
|
// TODO Auto-generated method stub
|
274
|
|
275
|
}
|
276
|
|
277
|
|
278
|
@Override
|
279
|
protected IService<NameTypeDesignation> getService() {
|
280
|
// No TypeDesignationService :( so I need override the generic save and delete methods
|
281
|
return null;
|
282
|
}
|
283
|
|
284
|
@Override
|
285
|
protected void deleteBean(NameTypeDesignation bean){
|
286
|
// deleteTypedesignation(uuid, uuid) needs to be called so the name is loaded in the transaction of the method and is saved.
|
287
|
DeleteResult deletResult = getRepo().getNameService().deleteTypeDesignation(typifiedNameInContext.getUuid(), bean.getUuid());
|
288
|
if(deletResult.isOk()){
|
289
|
EntityChangeEvent changeEvent = new EntityChangeEvent(bean, Type.REMOVED, (AbstractView) getView());
|
290
|
viewEventBus.publish(this, changeEvent);
|
291
|
} else {
|
292
|
CdmStore.handleDeleteresultInError(deletResult);
|
293
|
}
|
294
|
}
|
295
|
|
296
|
|
297
|
/**
|
298
|
* {@inheritDoc}
|
299
|
*/
|
300
|
@Override
|
301
|
protected NameTypeDesignation preSaveBean(NameTypeDesignation bean) {
|
302
|
|
303
|
if(!bean.hasDesignationSource()) {
|
304
|
bean.setSource(null); // this effectively removes the designation reference and reference detail
|
305
|
}
|
306
|
|
307
|
// the typifiedNames can only be set on the name side, so we need to
|
308
|
// handle changes explicitly here
|
309
|
HashSet<TaxonName> typifiedNames = new HashSet<>(bean.getTypifiedNames());
|
310
|
|
311
|
// handle adds
|
312
|
for(TaxonName name : typifiedNames){
|
313
|
if(name == null){
|
314
|
throw new NullPointerException("typifiedName must not be null");
|
315
|
}
|
316
|
if(!name.getTypeDesignations().contains(bean)){
|
317
|
name.addTypeDesignation(bean, false);
|
318
|
}
|
319
|
}
|
320
|
// handle removed
|
321
|
for(TaxonName name : typifiedNamesAsLoaded){
|
322
|
if(!typifiedNames.contains(name)){
|
323
|
name.removeTypeDesignation(bean);
|
324
|
}
|
325
|
// FIXME do we need to save the names here or is the delete cascaded from the typedesignation to the name?
|
326
|
}
|
327
|
|
328
|
// handle annotation changes
|
329
|
List<Annotation> annotations = getView().getAnnotationsField().getValue();
|
330
|
List<Annotation> currentAnnotations = new ArrayList<>(bean.getAnnotations());
|
331
|
List<Annotation> annotationsSeen = new ArrayList<>();
|
332
|
for(Annotation a : annotations){
|
333
|
if(a == null){
|
334
|
continue;
|
335
|
}
|
336
|
if(!currentAnnotations.contains(a)){
|
337
|
bean.addAnnotation(a);
|
338
|
}
|
339
|
annotationsSeen.add(a);
|
340
|
}
|
341
|
for(Annotation a : currentAnnotations){
|
342
|
if(!annotationsSeen.contains(a)){
|
343
|
bean.removeAnnotation(a);
|
344
|
}
|
345
|
}
|
346
|
|
347
|
|
348
|
return bean;
|
349
|
}
|
350
|
|
351
|
|
352
|
|
353
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
354
|
public void onTaxonNameEditorActionAdd(TaxonNameEditorAction action){
|
355
|
|
356
|
if(!isFromOwnView(action)){
|
357
|
return;
|
358
|
}
|
359
|
|
360
|
TaxonNamePopupEditor typeNamePopup = openPopupEditor(TaxonNamePopupEditor.class, action);
|
361
|
typeNamePopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
|
362
|
typeNamePopup.withDeleteButton(true);
|
363
|
TaxonNamePopupEditorConfig.configure(typeNamePopup);
|
364
|
typeNamePopup.loadInEditor(null);
|
365
|
|
366
|
}
|
367
|
|
368
|
|
369
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
370
|
public void onTaxonNameEditorActionEdit(TaxonNameEditorAction action){
|
371
|
|
372
|
if(!isFromOwnView(action)){
|
373
|
return;
|
374
|
}
|
375
|
|
376
|
TaxonNamePopupEditor typeNamePopup = openPopupEditor(TaxonNamePopupEditor.class, action);
|
377
|
typeNamePopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
|
378
|
typeNamePopup.withDeleteButton(true);
|
379
|
TaxonNamePopupEditorConfig.configure(typeNamePopup);
|
380
|
typeNamePopup.loadInEditor(action.getEntityUuid());
|
381
|
|
382
|
}
|
383
|
|
384
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
385
|
public void onReferenceEditorActionAdd(ReferenceEditorAction event) {
|
386
|
|
387
|
if (getView() == null || event.getSourceView() != getView()) {
|
388
|
return;
|
389
|
}
|
390
|
|
391
|
ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
|
392
|
|
393
|
referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
|
394
|
referenceEditorPopup.withDeleteButton(true);
|
395
|
configureReferencePopupEditor(referenceEditorPopup, null);
|
396
|
}
|
397
|
|
398
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
399
|
public void onReferenceEditorActionEdit(ReferenceEditorAction event) {
|
400
|
|
401
|
if (!isFromOwnView(event)) {
|
402
|
return;
|
403
|
}
|
404
|
ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
|
405
|
|
406
|
referenceEditorPopup.withDeleteButton(true);
|
407
|
configureReferencePopupEditor(referenceEditorPopup, event.getEntityUuid());
|
408
|
}
|
409
|
|
410
|
@EventBusListenerMethod
|
411
|
public void onEntityChangeEvent(EntityChangeEvent<?>event){
|
412
|
|
413
|
BoundField boundTargetField = boundTargetField((PopupView) event.getSourceView());
|
414
|
|
415
|
if(boundTargetField != null){
|
416
|
if(boundTargetField.matchesPropertyIdPath("typeName")){
|
417
|
if(event.isCreateOrModifiedType()){
|
418
|
getCache().load(event.getEntity());
|
419
|
if(event.isCreatedType()){
|
420
|
getView().getTypeNameField().setValue((TaxonName) event.getEntity());
|
421
|
} else {
|
422
|
getView().getTypeNameField().reload();
|
423
|
}
|
424
|
}
|
425
|
if(event.isRemovedType()){
|
426
|
getView().getTypeNameField().selectNewItem(null);
|
427
|
}
|
428
|
|
429
|
}
|
430
|
}
|
431
|
}
|
432
|
|
433
|
/**
|
434
|
* @return
|
435
|
* the {@link #publishedUnit}
|
436
|
*/
|
437
|
public DescriptionElementSource getPublishedUnit() {
|
438
|
return publishedUnit;
|
439
|
}
|
440
|
|
441
|
/**
|
442
|
* @param publishedUnit
|
443
|
* The unit of publication in which the type designation has been published.
|
444
|
* This may be any type listed in {@link RegistrationUIDefaults#NOMECLATURAL_PUBLICATION_UNIT_TYPES}
|
445
|
*/
|
446
|
protected void setPublishedUnit(DescriptionElementSource publishedUnit) throws Exception {
|
447
|
if(publishedUnit == null) {
|
448
|
throw new NullPointerException();
|
449
|
}
|
450
|
if(publishedUnit.getCitation() == null) {
|
451
|
throw new NullPointerException("The citation of the published unit must not be null.");
|
452
|
}
|
453
|
if(!RegistrationUIDefaults.NOMECLATURAL_PUBLICATION_UNIT_TYPES.contains(publishedUnit.getCitation().getType())) {
|
454
|
throw new Exception("The referrence type '" + publishedUnit.getType() + "'is not allowed for publishedUnit.");
|
455
|
}
|
456
|
this.publishedUnit = publishedUnit;
|
457
|
}
|
458
|
|
459
|
/**
|
460
|
* @param referenceEditorPopup
|
461
|
*/
|
462
|
private void configureReferencePopupEditor(ReferencePopupEditor referenceEditorPopup, UUID referenceUUID) {
|
463
|
|
464
|
if (newReferenceInstantiator != null) {
|
465
|
referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
|
466
|
}
|
467
|
|
468
|
// TODO this should be configurable per UI -
|
469
|
// RegistrationUiReferenceEditorFormConfigurator as spring bean,
|
470
|
// different spring profiles
|
471
|
// see also similar methods in TaxonName and SpecimenTypeDesigationEditors
|
472
|
referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(newReferenceInstantiator != null));
|
473
|
|
474
|
referenceEditorPopup.loadInEditor(referenceUUID);
|
475
|
// TODO limit ??? referenceEditorPopup.getTypeSelect().setValue(ReferenceType.Article);
|
476
|
|
477
|
}
|
478
|
|
479
|
}
|