1
|
/**
|
2
|
* Copyright (C) 2017 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.Arrays;
|
12
|
import java.util.EnumSet;
|
13
|
import java.util.HashMap;
|
14
|
import java.util.List;
|
15
|
import java.util.Map;
|
16
|
import java.util.UUID;
|
17
|
|
18
|
import org.apache.commons.lang.StringUtils;
|
19
|
import org.apache.log4j.Logger;
|
20
|
import org.hibernate.criterion.Restrictions;
|
21
|
import org.springframework.context.annotation.Scope;
|
22
|
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
23
|
import org.vaadin.viritin.fields.AbstractElementCollection;
|
24
|
|
25
|
import com.vaadin.data.Property;
|
26
|
import com.vaadin.spring.annotation.SpringComponent;
|
27
|
import com.vaadin.ui.AbstractField;
|
28
|
import com.vaadin.ui.Field;
|
29
|
|
30
|
import eu.etaxonomy.cdm.api.service.INameService;
|
31
|
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter.LabelType;
|
32
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
33
|
import eu.etaxonomy.cdm.model.agent.Person;
|
34
|
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
|
35
|
import eu.etaxonomy.cdm.model.common.AnnotationType;
|
36
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
37
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
38
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
39
|
import eu.etaxonomy.cdm.model.name.Rank;
|
40
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
41
|
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
|
42
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
43
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
44
|
import eu.etaxonomy.cdm.model.reference.ReferenceType;
|
45
|
import eu.etaxonomy.cdm.model.term.TermType;
|
46
|
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
|
47
|
import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator;
|
48
|
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
|
49
|
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider;
|
50
|
import eu.etaxonomy.cdm.service.TaxonNameStringFilterablePagingProvider;
|
51
|
import eu.etaxonomy.cdm.service.UserHelperAccess;
|
52
|
import eu.etaxonomy.cdm.service.initstrategies.AgentBaseInit;
|
53
|
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter;
|
54
|
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
|
55
|
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
|
56
|
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
|
57
|
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorActionStrRep;
|
58
|
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater;
|
59
|
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader;
|
60
|
import eu.etaxonomy.cdm.vaadin.model.name.TaxonNameDTO;
|
61
|
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUIDefaults;
|
62
|
import eu.etaxonomy.cdm.vaadin.util.CdmTitleCacheCaptionGenerator;
|
63
|
import eu.etaxonomy.cdm.vaadin.util.ReferenceEllypsisCaptionGenerator;
|
64
|
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
|
65
|
import eu.etaxonomy.cdm.vaadin.view.reference.RegistrationUiReferenceEditorFormConfigurator;
|
66
|
import eu.etaxonomy.vaadin.component.CompositeCustomField;
|
67
|
import eu.etaxonomy.vaadin.component.ReloadableLazyComboBox;
|
68
|
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox;
|
69
|
import eu.etaxonomy.vaadin.component.WeaklyRelatedEntityCombobox;
|
70
|
import eu.etaxonomy.vaadin.component.WeaklyRelatedEntityField;
|
71
|
import eu.etaxonomy.vaadin.event.FieldReplaceEvent;
|
72
|
import eu.etaxonomy.vaadin.mvp.AbstractCdmDTOEditorPresenter;
|
73
|
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor;
|
74
|
import eu.etaxonomy.vaadin.mvp.BeanInstantiator;
|
75
|
import eu.etaxonomy.vaadin.mvp.BoundField;
|
76
|
import eu.etaxonomy.vaadin.ui.view.PopupView;
|
77
|
import eu.etaxonomy.vaadin.util.PropertyIdPath;
|
78
|
|
79
|
/**
|
80
|
* @author a.kohlbecker
|
81
|
* @since May 22, 2017
|
82
|
*
|
83
|
*/
|
84
|
@SpringComponent
|
85
|
@Scope("prototype")
|
86
|
public class TaxonNameEditorPresenter extends AbstractCdmDTOEditorPresenter<TaxonNameDTO, TaxonName, TaxonNamePopupEditorView> {
|
87
|
|
88
|
private static final long serialVersionUID = -3538980627079389221L;
|
89
|
|
90
|
private static final EnumSet<CRUD> SUB_EDITOR_CRUD = EnumSet.of(CRUD.UPDATE, CRUD.DELETE);
|
91
|
|
92
|
private static final List<String> RELATED_NAME_INIT_STRATEGY = Arrays.asList(
|
93
|
"$",
|
94
|
"relationsFromThisName",
|
95
|
"relationsToThisName.type",
|
96
|
"homotypicalGroup.typifiedNames"
|
97
|
);
|
98
|
|
99
|
public static final List<String> REFERENCE_INIT_STRATEGY = Arrays.asList("authorship", "inReference.authorship", "inReference.inReference.authorship", "inReference.inReference.inReference.authorship");
|
100
|
|
101
|
|
102
|
private static final Logger logger = Logger.getLogger(TaxonNameEditorPresenter.class);
|
103
|
|
104
|
private CdmFilterablePagingProvider<Reference, Reference> nomReferencePagingProvider;
|
105
|
|
106
|
private Reference publishedUnit;
|
107
|
|
108
|
private BeanInstantiator<Reference> newReferenceInstantiator;
|
109
|
|
110
|
private Map<ReferencePopupEditor, NomenclaturalStatusRow> statusTypeReferencePopupEditorsRowMap = new HashMap<>();
|
111
|
|
112
|
private TaxonNameStringFilterablePagingProvider genusOrUninomialPartPagingProvider;
|
113
|
|
114
|
private TaxonNameStringFilterablePagingProvider specificEpithetPartPagingProvider;
|
115
|
|
116
|
private Property.ValueChangeListener refreshSpecificEpithetComboBoxListener;
|
117
|
|
118
|
private CdmFilterablePagingProvider<TaxonName, TaxonName> relatedNamePagingProvider;
|
119
|
|
120
|
private CdmFilterablePagingProvider<TaxonName, TaxonName> orthographicVariantNamePagingProvider;
|
121
|
|
122
|
private Restriction<Reference> orthographicCorrectionRestriction;
|
123
|
|
124
|
private Integer taxonNameId;
|
125
|
|
126
|
/**
|
127
|
* {@inheritDoc}
|
128
|
*/
|
129
|
@SuppressWarnings("serial")
|
130
|
@Override
|
131
|
public void handleViewEntered() {
|
132
|
|
133
|
super.handleViewEntered();
|
134
|
|
135
|
getView().getRankSelect().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(TermType.Rank));
|
136
|
getView().getRankSelect().setItemCaptionPropertyId("label");
|
137
|
|
138
|
CdmFilterablePagingProvider<AgentBase, TeamOrPersonBase> termOrPersonPagingProvider = pagingProviderFactory.teamOrPersonPagingProvider();
|
139
|
termOrPersonPagingProvider.setInitStrategy(AgentBaseInit.TEAM_OR_PERSON_INIT_STRATEGY);
|
140
|
CdmFilterablePagingProvider<AgentBase, Person> personPagingProvider = pagingProviderFactory.personPagingProvider();
|
141
|
|
142
|
getView().getCombinationAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
|
143
|
getView().getCombinationAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
|
144
|
|
145
|
getView().getExCombinationAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
|
146
|
getView().getExCombinationAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
|
147
|
|
148
|
getView().getBasionymAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
|
149
|
getView().getBasionymAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
|
150
|
|
151
|
getView().getExBasionymAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this);
|
152
|
getView().getExBasionymAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this);
|
153
|
|
154
|
getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(
|
155
|
new ReferenceEllypsisCaptionGenerator(LabelType.NOMENCLATURAL, getView().getNomReferenceCombobox().getSelect())
|
156
|
);
|
157
|
nomReferencePagingProvider = pagingProviderFactory.referencePagingProvider();
|
158
|
nomReferencePagingProvider.setInitStrategy(REFERENCE_INIT_STRATEGY);
|
159
|
getView().getNomReferenceCombobox().loadFrom(nomReferencePagingProvider, nomReferencePagingProvider, nomReferencePagingProvider.getPageSize());
|
160
|
getView().getNomReferenceCombobox().setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getNomReferenceCombobox()));
|
161
|
getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getNomReferenceCombobox().getSelect())
|
162
|
);
|
163
|
getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getNomReferenceCombobox(), this));
|
164
|
getView().getNomReferenceCombobox().getSelect().addValueChangeListener( e -> updateOrthographicCorrectionRestriction());
|
165
|
|
166
|
CdmFilterablePagingProvider<Reference, Reference> icbnCodesPagingProvider = pagingProviderFactory.referencePagingProvider();
|
167
|
// @formatter:off
|
168
|
// TODO use markers on references instead of isbn. The marker type MarkerType.NOMENCLATURAL_RELEVANT() has already prepared (#7466)
|
169
|
icbnCodesPagingProvider.getCriteria().add(Restrictions.in("isbn", new String[]{
|
170
|
"3-904144-22-7", // Saint Louis Code
|
171
|
"3-906166-48-1", // Vienna Code
|
172
|
"978-3-87429-425-6", // Melbourne Code
|
173
|
"978-3-946583-16-5", // Shenzhen Code
|
174
|
"0-85301-006-4" // ICZN 1999
|
175
|
// ICNB
|
176
|
}));
|
177
|
// @formatter:on
|
178
|
|
179
|
statusTypeReferencePopupEditorsRowMap.clear();
|
180
|
getView().getNomStatusCollectionField().addElementAddedListener(e -> addNomenclaturalStatus(e.getElement()));
|
181
|
getView().getNomStatusCollectionField().setEditorInstantiator(new AbstractElementCollection.Instantiator<NomenclaturalStatusRow>() {
|
182
|
|
183
|
@Override
|
184
|
public NomenclaturalStatusRow create() {
|
185
|
NomenclaturalStatusRow row = new NomenclaturalStatusRow();
|
186
|
|
187
|
row.type.setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(NomenclaturalStatusType.ALTERNATIVE().getVocabulary().getUuid()));
|
188
|
row.type.setNullSelectionAllowed(false);
|
189
|
|
190
|
row.citation.loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize());
|
191
|
row.citation.getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.NOMENCLATURAL, row.citation.getSelect()));
|
192
|
row.citation.getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Reference>(row.citation.getSelect(),
|
193
|
TaxonNameEditorPresenter.this));
|
194
|
row.citation.addClickListenerAddEntity(e -> doReferenceEditorAdd(row));
|
195
|
row.citation.addClickListenerEditEntity(e -> {
|
196
|
if(row.citation.getValue() != null){
|
197
|
doReferenceEditorEdit(row);
|
198
|
}
|
199
|
});
|
200
|
|
201
|
getView().applyDefaultComponentStyle(row.components());
|
202
|
|
203
|
return row;
|
204
|
}
|
205
|
});
|
206
|
|
207
|
relatedNamePagingProvider = pagingProviderFactory.taxonNamesWithoutOrthophicIncorrect();
|
208
|
relatedNamePagingProvider.setInitStrategy(RELATED_NAME_INIT_STRATEGY);
|
209
|
getView().getBasionymComboboxSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>());
|
210
|
getView().getBasionymComboboxSelect().setPagingProviders(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize(), this);
|
211
|
|
212
|
getView().getReplacedSynonymsComboboxSelect().setCaptionGenerator( new CdmTitleCacheCaptionGenerator<TaxonName>());
|
213
|
getView().getReplacedSynonymsComboboxSelect().setPagingProviders(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize(), this);
|
214
|
|
215
|
getView().getValidationField().getRelatedNameComboBox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>());
|
216
|
getView().getValidationField().getRelatedNameComboBox().loadFrom(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize());
|
217
|
getView().getValidationField().getRelatedNameComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getValidationField().getRelatedNameComboBox(), this));
|
218
|
getView().getValidationField().getCitatonComboBox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getValidationField().getCitatonComboBox().getSelect()));
|
219
|
getView().getValidationField().getCitatonComboBox().loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize());
|
220
|
getView().getValidationField().getCitatonComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getValidationField().getCitatonComboBox(), this));
|
221
|
|
222
|
getView().getOrthographicVariantField().getRelatedNameComboBox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>());
|
223
|
getView().getOrthographicVariantField().getRelatedNameComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getOrthographicVariantField().getRelatedNameComboBox(), this));
|
224
|
getView().getOrthographicVariantField().getRelatedNameComboBox().loadFrom(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize());
|
225
|
// The Mode TaxonNamePopupEditorMode.ORTHOGRAPHIC_CORRECTION will be handled in the updateOrthographicCorrectionRestriction() method
|
226
|
getView().getOrthographicVariantField().getCitatonComboBox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getOrthographicVariantField().getCitatonComboBox().getSelect()));
|
227
|
getView().getOrthographicVariantField().getCitatonComboBox().loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize());
|
228
|
getView().getOrthographicVariantField().getCitatonComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getOrthographicVariantField().getCitatonComboBox(), this));
|
229
|
|
230
|
|
231
|
getView().getAnnotationsField().setAnnotationTypeItemContainer(cdmBeanItemContainerFactory.buildTermItemContainer(
|
232
|
AnnotationType.EDITORIAL().getUuid(), AnnotationType.TECHNICAL().getUuid()));
|
233
|
}
|
234
|
|
235
|
/**
|
236
|
* @param element
|
237
|
* @return
|
238
|
*/
|
239
|
private void addNomenclaturalStatus(NomenclaturalStatus element) {
|
240
|
// Nothing to do
|
241
|
}
|
242
|
|
243
|
@Override
|
244
|
protected void adaptDataProviders() {
|
245
|
updateOrthographicCorrectionRestriction();
|
246
|
}
|
247
|
|
248
|
private void updateOrthographicCorrectionRestriction() {
|
249
|
|
250
|
if(getView().isModeEnabled(TaxonNamePopupEditorMode.ORTHOGRAPHIC_CORRECTION)){
|
251
|
if(orthographicVariantNamePagingProvider == null){
|
252
|
orthographicVariantNamePagingProvider = new CdmFilterablePagingProvider<TaxonName, TaxonName>(getRepo().getNameService());
|
253
|
orthographicVariantNamePagingProvider.setInitStrategy(RELATED_NAME_INIT_STRATEGY);
|
254
|
orthographicVariantNamePagingProvider.addRestriction(new Restriction<>("id", Operator.AND_NOT, null, taxonNameId));
|
255
|
getView().getOrthographicVariantField().getRelatedNameComboBox().loadFrom(orthographicVariantNamePagingProvider, orthographicVariantNamePagingProvider, orthographicVariantNamePagingProvider.getPageSize());
|
256
|
}
|
257
|
Reference nomReference = getView().getNomReferenceCombobox().getValue();
|
258
|
if(nomReference == null && orthographicCorrectionRestriction != null){
|
259
|
orthographicVariantNamePagingProvider.getRestrictions().remove(orthographicCorrectionRestriction);
|
260
|
} else {
|
261
|
if(orthographicCorrectionRestriction == null){
|
262
|
orthographicCorrectionRestriction = new Restriction<>("nomenclaturalReference", Operator.AND, null, nomReference);
|
263
|
orthographicVariantNamePagingProvider.addRestriction(orthographicCorrectionRestriction);
|
264
|
} else{
|
265
|
orthographicCorrectionRestriction.setValues(Arrays.asList(nomReference));
|
266
|
}
|
267
|
}
|
268
|
getView().getOrthographicVariantField().getRelatedNameComboBox().getSelect().refresh();
|
269
|
}
|
270
|
}
|
271
|
|
272
|
@Override
|
273
|
protected TaxonName loadCdmEntity(UUID identifier) {
|
274
|
|
275
|
List<String> initStrategy = Arrays.asList(
|
276
|
"$",
|
277
|
"annotations.type",
|
278
|
"annotations.*", // needed as log as we are using a table in FilterableAnnotationsField
|
279
|
"rank.vocabulary", // needed for comparing ranks
|
280
|
|
281
|
"nomenclaturalReference.authorship",
|
282
|
"nomenclaturalReference.inReference.authorship",
|
283
|
"nomenclaturalReference.inReference.inReference.authorship",
|
284
|
"nomenclaturalReference.inReference.inReference.inReference.authorship",
|
285
|
|
286
|
"status.type",
|
287
|
"status.citation.authorship.$",
|
288
|
"status.citation.inReference.authorship.$",
|
289
|
|
290
|
"combinationAuthorship",
|
291
|
"exCombinationAuthorship",
|
292
|
"basionymAuthorship",
|
293
|
"exBasionymAuthorship",
|
294
|
|
295
|
// basionyms: relationsToThisName.fromName
|
296
|
"relationsToThisName.type",
|
297
|
"relationsToThisName.fromName.rank",
|
298
|
"relationsToThisName.fromName.combinationAuthorship",
|
299
|
"relationsToThisName.fromName.exCombinationAuthorship",
|
300
|
"relationsToThisName.fromName.nomenclaturalReference.authorship",
|
301
|
"relationsToThisName.fromName.nomenclaturalReference.inReference.authorship",
|
302
|
"relationsToThisName.fromName.nomenclaturalReference.inReference.inReference.inReference.authorship",
|
303
|
"relationsToThisName.fromName.relationsToThisName",
|
304
|
"relationsToThisName.fromName.relationsFromThisName",
|
305
|
"relationsToThisName.citation.authorship",
|
306
|
"relationsToThisName.citation.inReference.authorship",
|
307
|
|
308
|
"relationsFromThisName",
|
309
|
"homotypicalGroup.typifiedNames"
|
310
|
);
|
311
|
|
312
|
TaxonName taxonName;
|
313
|
if(identifier != null){
|
314
|
taxonName = getRepo().getNameService().load(identifier, initStrategy);
|
315
|
} else {
|
316
|
taxonName = createCdmEntity();
|
317
|
}
|
318
|
|
319
|
if(getView().isModeEnabled(TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY)){
|
320
|
Reference nomRef = taxonName.getNomenclaturalReference();
|
321
|
|
322
|
//getView().getNomReferenceCombobox().setEnabled(nomRef.isOfType(ReferenceType.Section));
|
323
|
publishedUnit = nomRef;
|
324
|
if(publishedUnit != null){
|
325
|
while(publishedUnit.isOfType(ReferenceType.Section) && publishedUnit.getInReference() != null){
|
326
|
publishedUnit = nomRef.getInReference();
|
327
|
}
|
328
|
// reduce available references to those which are sections of the publishedUnit and the publishedUnit itself
|
329
|
// nomReferencePagingProvider
|
330
|
nomReferencePagingProvider.getCriteria().add(Restrictions.or(
|
331
|
Restrictions.and(Restrictions.eq("inReference", publishedUnit), Restrictions.eq("type", ReferenceType.Section)),
|
332
|
Restrictions.idEq(publishedUnit.getId())
|
333
|
)
|
334
|
);
|
335
|
}
|
336
|
// and remove the empty option
|
337
|
getView().getNomReferenceCombobox().getSelect().setNullSelectionAllowed(false);
|
338
|
|
339
|
// new Reference only a sub sections of the publishedUnit
|
340
|
newReferenceInstantiator = new BeanInstantiator<Reference>() {
|
341
|
@Override
|
342
|
public Reference createNewBean() {
|
343
|
Reference newRef = ReferenceFactory.newSection();
|
344
|
newRef.setInReference(publishedUnit);
|
345
|
return newRef;
|
346
|
}
|
347
|
};
|
348
|
|
349
|
}
|
350
|
|
351
|
taxonNameId = Integer.valueOf(taxonName.getId());
|
352
|
relatedNamePagingProvider.addRestriction(new Restriction<>("id", Operator.AND_NOT, null, taxonNameId));
|
353
|
|
354
|
return taxonName;
|
355
|
}
|
356
|
|
357
|
/**
|
358
|
* {@inheritDoc}
|
359
|
*/
|
360
|
@Override
|
361
|
protected void guaranteePerEntityCRUDPermissions(UUID identifier) {
|
362
|
if(crud != null){
|
363
|
newAuthorityCreated = UserHelperAccess.userHelper().createAuthorityForCurrentUser(TaxonName.class, identifier, crud, null);
|
364
|
}
|
365
|
|
366
|
}
|
367
|
|
368
|
/**
|
369
|
* {@inheritDoc}
|
370
|
*/
|
371
|
@Override
|
372
|
protected void guaranteePerEntityCRUDPermissions(TaxonName bean) {
|
373
|
if(crud != null){
|
374
|
newAuthorityCreated = UserHelperAccess.userHelper().createAuthorityForCurrentUser(bean, crud, null);
|
375
|
}
|
376
|
}
|
377
|
|
378
|
/**
|
379
|
* {@inheritDoc}
|
380
|
*/
|
381
|
@Override
|
382
|
protected INameService getService() {
|
383
|
return getRepo().getNameService();
|
384
|
}
|
385
|
|
386
|
|
387
|
public void doReferenceEditorAdd(NomenclaturalStatusRow row) {
|
388
|
|
389
|
ReferencePopupEditor referencePopupEditor = openPopupEditor(ReferencePopupEditor.class, null);
|
390
|
|
391
|
referencePopupEditor.withReferenceTypes(RegistrationUIDefaults.MEDIA_REFERENCE_TYPES);
|
392
|
referencePopupEditor.grantToCurrentUser(SUB_EDITOR_CRUD);
|
393
|
referencePopupEditor.withDeleteButton(true);
|
394
|
referencePopupEditor.loadInEditor(null);
|
395
|
|
396
|
statusTypeReferencePopupEditorsRowMap.put(referencePopupEditor, row);
|
397
|
}
|
398
|
|
399
|
public void doReferenceEditorEdit(NomenclaturalStatusRow row) {
|
400
|
|
401
|
ReferencePopupEditor referencePopupEditor = openPopupEditor(ReferencePopupEditor.class, null);
|
402
|
referencePopupEditor.withReferenceTypes(RegistrationUIDefaults.MEDIA_REFERENCE_TYPES);
|
403
|
referencePopupEditor.grantToCurrentUser(SUB_EDITOR_CRUD);
|
404
|
referencePopupEditor.withDeleteButton(true);
|
405
|
referencePopupEditor.loadInEditor(row.citation.getValue().getUuid());
|
406
|
|
407
|
statusTypeReferencePopupEditorsRowMap.put(referencePopupEditor, row);
|
408
|
}
|
409
|
/**
|
410
|
* @param referenceEditorPopup
|
411
|
*/
|
412
|
private void configureReferencePopupEditor(ReferencePopupEditor referenceEditorPopup, UUID referenceUUID) {
|
413
|
boolean nomRefSectionEditingOnly = getView().isModeEnabled(TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY);
|
414
|
if(nomRefSectionEditingOnly){
|
415
|
referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
|
416
|
}
|
417
|
|
418
|
// TODO this should be configurable per UI - RegistrationUiReferenceEditorFormConfigurator as spring bean, different spring profiles
|
419
|
referenceEditorPopup.setEditorComponentsConfigurator(new RegistrationUiReferenceEditorFormConfigurator(nomRefSectionEditingOnly && newReferenceInstantiator != null));
|
420
|
|
421
|
referenceEditorPopup.loadInEditor(referenceUUID);
|
422
|
if(!nomRefSectionEditingOnly){
|
423
|
referenceEditorPopup.getTypeSelect().setValue(ReferenceType.Article);
|
424
|
}
|
425
|
}
|
426
|
|
427
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
428
|
public void onReferenceEditorActionAdd(ReferenceEditorAction event) {
|
429
|
|
430
|
if(getView() == null || event.getSourceView() != getView() ){
|
431
|
return;
|
432
|
}
|
433
|
|
434
|
ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
|
435
|
|
436
|
referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
|
437
|
referenceEditorPopup.withDeleteButton(true);
|
438
|
configureReferencePopupEditor(referenceEditorPopup, null);
|
439
|
}
|
440
|
|
441
|
|
442
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
443
|
public void onReferenceEditorActionEdit(ReferenceEditorAction event) {
|
444
|
|
445
|
|
446
|
if(!isFromOwnView(event)){
|
447
|
return;
|
448
|
}
|
449
|
ReferencePopupEditor referenceEditorPopup = openPopupEditor(ReferencePopupEditor.class, event);
|
450
|
|
451
|
referenceEditorPopup.withDeleteButton(true);
|
452
|
configureReferencePopupEditor(referenceEditorPopup, event.getEntityUuid());
|
453
|
}
|
454
|
|
455
|
@EventBusListenerMethod
|
456
|
public void onFieldReplaceEvent(FieldReplaceEvent<String> event){
|
457
|
|
458
|
PropertyIdPath boundPropertyIdPath = boundPropertyIdPath(event.getNewField());
|
459
|
if(boundPropertyIdPath != null){
|
460
|
TaxonNameDTO taxonNamedto = ((AbstractPopupEditor<TaxonNameDTO, AbstractCdmDTOEditorPresenter<TaxonNameDTO, TaxonName,?>>)getView()).getBean();
|
461
|
if(boundPropertyIdPath.matches("specificEpithet")){
|
462
|
AbstractField<String> genusOrUninomialField = getView().getGenusOrUninomialField();
|
463
|
if(event.getNewField() instanceof CompositeCustomField){
|
464
|
if(specificEpithetPartPagingProvider == null){
|
465
|
specificEpithetPartPagingProvider = new TaxonNameStringFilterablePagingProvider(getRepo().getNameService(), Rank.SPECIES());
|
466
|
}
|
467
|
specificEpithetPartPagingProvider.listenToFields(
|
468
|
genusOrUninomialField,
|
469
|
null, null, null);
|
470
|
specificEpithetPartPagingProvider.excludeNames(taxonNamedto.cdmEntity());
|
471
|
specificEpithetPartPagingProvider.updateFromFields();
|
472
|
WeaklyRelatedEntityCombobox<TaxonName> specificEpithetField = (WeaklyRelatedEntityCombobox<TaxonName>)event.getNewField();
|
473
|
refreshSpecificEpithetComboBoxListener = e -> { specificEpithetField.getSelect().refresh(); specificEpithetField.setValue(null);};
|
474
|
specificEpithetField.loadFrom(specificEpithetPartPagingProvider, specificEpithetPartPagingProvider, specificEpithetPartPagingProvider.getPageSize());
|
475
|
specificEpithetField.setValue(event.getOldField().getValue());
|
476
|
specificEpithetField.reload();
|
477
|
genusOrUninomialField.addValueChangeListener(refreshSpecificEpithetComboBoxListener);
|
478
|
} else {
|
479
|
if(specificEpithetPartPagingProvider != null){
|
480
|
specificEpithetPartPagingProvider.unlistenAllFields();
|
481
|
}
|
482
|
if(refreshSpecificEpithetComboBoxListener != null){
|
483
|
genusOrUninomialField.removeValueChangeListener(refreshSpecificEpithetComboBoxListener);
|
484
|
refreshSpecificEpithetComboBoxListener = null;
|
485
|
}
|
486
|
}
|
487
|
} else if(boundPropertyIdPath.matches("genusOrUninomial")) {
|
488
|
if(event.getNewField() instanceof CompositeCustomField){
|
489
|
if(genusOrUninomialPartPagingProvider == null){
|
490
|
genusOrUninomialPartPagingProvider = new TaxonNameStringFilterablePagingProvider(getRepo().getNameService());
|
491
|
}
|
492
|
genusOrUninomialPartPagingProvider.listenToFields(
|
493
|
null,
|
494
|
getView().getInfraGenericEpithetField(),
|
495
|
getView().getSpecificEpithetField(),
|
496
|
getView().getInfraSpecificEpithetField()
|
497
|
);
|
498
|
genusOrUninomialPartPagingProvider.excludeNames(taxonNamedto.cdmEntity());
|
499
|
WeaklyRelatedEntityCombobox<TaxonName> genusOrUninomialField = (WeaklyRelatedEntityCombobox<TaxonName>)event.getNewField();
|
500
|
genusOrUninomialField.loadFrom(genusOrUninomialPartPagingProvider, genusOrUninomialPartPagingProvider, genusOrUninomialPartPagingProvider.getPageSize());
|
501
|
genusOrUninomialField.setValue(event.getOldField().getValue());
|
502
|
genusOrUninomialField.reload();
|
503
|
}else {
|
504
|
if(genusOrUninomialPartPagingProvider != null){
|
505
|
genusOrUninomialPartPagingProvider.unlistenAllFields();
|
506
|
}
|
507
|
}
|
508
|
|
509
|
}
|
510
|
}
|
511
|
|
512
|
}
|
513
|
|
514
|
@EventBusListenerMethod
|
515
|
public void onEntityChangeEvent(EntityChangeEvent<?> event){
|
516
|
|
517
|
if(event.getSourceView() instanceof AbstractPopupEditor) {
|
518
|
|
519
|
BoundField boundTargetField = boundTargetField((PopupView) event.getSourceView());
|
520
|
|
521
|
if(boundTargetField != null){
|
522
|
if(boundTargetField.matchesPropertyIdPath("genusOrUninomial")){
|
523
|
if(event.isCreateOrModifiedType()){
|
524
|
getCache().load(event.getEntity());
|
525
|
if(getView().getGenusOrUninomialField() instanceof WeaklyRelatedEntityCombobox){
|
526
|
WeaklyRelatedEntityCombobox<TaxonName> weaklyRelatedEntityCombobox = (WeaklyRelatedEntityCombobox<TaxonName>)getView().getGenusOrUninomialField();
|
527
|
weaklyRelatedEntityCombobox.setValue(((TaxonName)event.getEntity()).getGenusOrUninomial());
|
528
|
// NOTE: in contrast to the ToOneRelatedEntityCombobox the .discard() does not
|
529
|
// work here since no datasource is bound to the field, see weaklyRelatedEntityCombobox.reload()
|
530
|
weaklyRelatedEntityCombobox.updateButtons();
|
531
|
}
|
532
|
}
|
533
|
} else
|
534
|
if(boundTargetField.matchesPropertyIdPath("specificEpithet")){
|
535
|
if(event.isCreateOrModifiedType()){
|
536
|
getCache().load(event.getEntity());
|
537
|
if(getView().getSpecificEpithetField() instanceof WeaklyRelatedEntityCombobox){
|
538
|
WeaklyRelatedEntityCombobox<TaxonName> weaklyRelatedEntityCombobox = (WeaklyRelatedEntityCombobox<TaxonName>)getView().getSpecificEpithetField();
|
539
|
getView().getSpecificEpithetField().setValue(((TaxonName)event.getEntity()).getSpecificEpithet());
|
540
|
weaklyRelatedEntityCombobox.reload();
|
541
|
// NOTE: in contrast to the ToOneRelatedEntityCombobox the .discard() does not
|
542
|
// work here since no datasource is bound to the field, see weaklyRelatedEntityCombobox.reload()
|
543
|
weaklyRelatedEntityCombobox.updateButtons();
|
544
|
}
|
545
|
}
|
546
|
} else
|
547
|
if(boundTargetField.matchesPropertyIdPath("nomenclaturalReference")){
|
548
|
if(event.isCreateOrModifiedType()){
|
549
|
getCache().load(event.getEntity());
|
550
|
if(event.isCreatedType()){
|
551
|
getView().getNomReferenceCombobox().setValue((Reference) event.getEntity());
|
552
|
} else {
|
553
|
getView().getNomReferenceCombobox().reload(); // refreshSelectedValue(modifiedReference);
|
554
|
}
|
555
|
getView().getCombinationAuthorshipField().discard(); //refresh from the datasource
|
556
|
getView().updateAuthorshipFields();
|
557
|
}
|
558
|
} else
|
559
|
if(boundTargetField.matchesPropertyIdPath("validationFor.otherName") || boundTargetField.matchesPropertyIdPath("orthographicVariant.otherName")){
|
560
|
ReloadableLazyComboBox<TaxonName> otherNameField = asReloadableLazyComboBox(boundTargetField.getField(TaxonName.class));
|
561
|
TaxonName otherName = (TaxonName) event.getEntity();
|
562
|
if(event.isCreateOrModifiedType()){
|
563
|
getCache().load(otherName);
|
564
|
if(event.isCreatedType()){
|
565
|
// TODO use reloadWith((TaxonName) event.getEntity()); also in this case?
|
566
|
otherNameField.setValue(otherName);
|
567
|
} else {
|
568
|
otherNameField.reloadWith(otherName);
|
569
|
}
|
570
|
|
571
|
} else
|
572
|
if(event.isRemovedType()){
|
573
|
otherNameField.setValue(null);
|
574
|
}
|
575
|
} else
|
576
|
if(boundTargetField.matchesPropertyIdPath("basionyms")){
|
577
|
ReloadableLazyComboBox<TaxonName> basionymSourceField = asReloadableLazyComboBox(boundTargetField.getField(TaxonName.class));
|
578
|
if(event.isCreateOrModifiedType()){
|
579
|
getCache().load(event.getEntity());
|
580
|
if(event.isCreatedType()){
|
581
|
// TODO use reloadWith((TaxonName) event.getEntity()); also in this case?
|
582
|
basionymSourceField .setValue((TaxonName) event.getEntity());
|
583
|
} else {
|
584
|
basionymSourceField.reloadWith((TaxonName) event.getEntity());
|
585
|
}
|
586
|
getView().getBasionymAuthorshipField().discard(); //refresh from the datasource
|
587
|
getView().getExBasionymAuthorshipField().discard(); //refresh from the datasource
|
588
|
getView().updateAuthorshipFields();
|
589
|
} else
|
590
|
if(event.isRemovedType()){
|
591
|
basionymSourceField.setValue(null);
|
592
|
getView().updateAuthorshipFields();
|
593
|
}
|
594
|
} else
|
595
|
if(boundTargetField.matchesPropertyIdPath("replacedSynonyms")){
|
596
|
ReloadableLazyComboBox<TaxonName> replacedSynonyms = asReloadableLazyComboBox(boundTargetField.getField(TaxonName.class));
|
597
|
if(event.isCreateOrModifiedType()){
|
598
|
getCache().load(event.getEntity());
|
599
|
if(event.isCreatedType()){
|
600
|
// TODO use reloadWith((TaxonName) event.getEntity()); also in this case?
|
601
|
replacedSynonyms .setValue((TaxonName) event.getEntity());
|
602
|
} else {
|
603
|
replacedSynonyms.reloadWith((TaxonName) event.getEntity());
|
604
|
}
|
605
|
getView().getExCombinationAuthorshipField().discard(); //refresh from the datasource
|
606
|
getView().updateAuthorshipFields();
|
607
|
} else
|
608
|
if(event.isRemovedType()){
|
609
|
replacedSynonyms.setValue(null);
|
610
|
getView().updateAuthorshipFields();
|
611
|
}
|
612
|
}
|
613
|
|
614
|
}
|
615
|
}
|
616
|
}
|
617
|
|
618
|
protected <CDM extends CdmBase> ReloadableLazyComboBox<CDM> asReloadableLazyComboBox(Field<CDM> field){
|
619
|
|
620
|
if(field instanceof ToOneRelatedEntityCombobox){
|
621
|
field = ((ToOneRelatedEntityCombobox<CDM>)field).getSelect();
|
622
|
}
|
623
|
return (ReloadableLazyComboBox<CDM>)field;
|
624
|
}
|
625
|
|
626
|
|
627
|
|
628
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
629
|
public void onTaxonNameEditorActionEdit(TaxonNameEditorAction event) {
|
630
|
|
631
|
if(getView() == null || event.getSourceView() != getView() ){
|
632
|
return;
|
633
|
}
|
634
|
|
635
|
PropertyIdPath boundPropertyId = boundPropertyIdPath(event.getTarget());
|
636
|
|
637
|
if(boundPropertyId != null){
|
638
|
if(boundPropertyId.matches("validationFor.otherName") || boundPropertyId.matches("basionyms") || boundPropertyId.matches("replacedSynonyms") || boundPropertyId.matches("orthographicVariant.otherName")){
|
639
|
TaxonNamePopupEditor namePopup = openPopupEditor(TaxonNamePopupEditor.class, event);
|
640
|
namePopup.withDeleteButton(true);
|
641
|
getView().getModesActive().stream()
|
642
|
.filter(m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
|
643
|
.forEach(m -> namePopup.enableMode(m));
|
644
|
if(boundPropertyId.matches("orthographicVariant.otherName") && getView().isModeEnabled(TaxonNamePopupEditorMode.ORTHOGRAPHIC_CORRECTION)){
|
645
|
namePopup.enableMode(TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY);
|
646
|
namePopup.disableMode(TaxonNamePopupEditorMode.VALIDATE_AGAINST_HIGHER_NAME_PART);
|
647
|
namePopup.getOrthographicVariantToggle().setVisible(false);
|
648
|
}
|
649
|
namePopup.loadInEditor(event.getEntityUuid());
|
650
|
}
|
651
|
}
|
652
|
}
|
653
|
|
654
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)
|
655
|
public void onTaxonNameEditorActionStrRepEdit(TaxonNameEditorActionStrRep event) {
|
656
|
|
657
|
if(getView() == null || event.getSourceView() != getView() ){
|
658
|
return;
|
659
|
}
|
660
|
|
661
|
PropertyIdPath boundPropertyId = boundPropertyIdPath(event.getTarget());
|
662
|
|
663
|
if(boundPropertyId != null){
|
664
|
if(boundPropertyId.matches("genusOrUninomial") || boundPropertyId.matches("specificEpithet")){
|
665
|
TaxonNamePopupEditor namePopup = openPopupEditor(TaxonNamePopupEditor.class, event);
|
666
|
namePopup.withDeleteButton(true);
|
667
|
getView().getModesActive().stream()
|
668
|
.filter(m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
|
669
|
.forEach(m -> namePopup.enableMode(m));
|
670
|
namePopup.loadInEditor(event.getEntityUuid());
|
671
|
}
|
672
|
}
|
673
|
}
|
674
|
|
675
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
676
|
public void onTaxonNameEditorActionAdd(TaxonNameEditorAction event) {
|
677
|
|
678
|
if(getView() == null || event.getSourceView() != getView() ){
|
679
|
return;
|
680
|
}
|
681
|
|
682
|
PropertyIdPath boundPropertyId = boundPropertyIdPath(event.getTarget());
|
683
|
|
684
|
if(boundPropertyId != null){
|
685
|
if(boundPropertyId.matches("validationFor.otherName") || boundPropertyId.matches("basionyms") || boundPropertyId.matches("replacedSynonyms") || boundPropertyId.matches("orthographicVariant.otherName")){
|
686
|
TaxonNamePopupEditor namePopup = openPopupEditor(TaxonNamePopupEditor.class, event);
|
687
|
namePopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
|
688
|
namePopup.withDeleteButton(true);
|
689
|
getView().getModesActive().stream()
|
690
|
.filter(m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
|
691
|
.forEach(m -> namePopup.enableMode(m));
|
692
|
if(boundPropertyId.matches("orthographicVariant.otherName") && getView().isModeEnabled(TaxonNamePopupEditorMode.ORTHOGRAPHIC_CORRECTION)){
|
693
|
namePopup.enableMode(TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY);
|
694
|
namePopup.disableMode(TaxonNamePopupEditorMode.VALIDATE_AGAINST_HIGHER_NAME_PART);
|
695
|
Reference nomrefPreset = (Reference)((AbstractPopupEditor<TaxonNameDTO, TaxonNameEditorPresenter>)getView()).getBean().getNomenclaturalReference();
|
696
|
namePopup.setCdmEntityInstantiator(new BeanInstantiator<TaxonName>() {
|
697
|
|
698
|
@Override
|
699
|
public TaxonName createNewBean() {
|
700
|
TaxonName newTaxonName = TaxonNameFactory.NewNameInstance(RegistrationUIDefaults.NOMENCLATURAL_CODE, Rank.SPECIES());
|
701
|
newTaxonName.setNomenclaturalReference(getRepo().getReferenceService().load(nomrefPreset.getUuid(), TaxonNameEditorPresenter.REFERENCE_INIT_STRATEGY ));
|
702
|
return newTaxonName;
|
703
|
}
|
704
|
});
|
705
|
namePopup.getOrthographicVariantToggle().setVisible(false);
|
706
|
}
|
707
|
namePopup.loadInEditor(null);
|
708
|
}
|
709
|
}
|
710
|
}
|
711
|
|
712
|
@EventBusListenerMethod(filter = EditorActionTypeFilter.Add.class)
|
713
|
public void onTaxonNameEditorActionStrRepAdd(TaxonNameEditorActionStrRep event) {
|
714
|
|
715
|
if(getView() == null || event.getSourceView() != getView() ){
|
716
|
return;
|
717
|
}
|
718
|
|
719
|
PropertyIdPath boundPropertyId = boundPropertyIdPath(event.getTarget());
|
720
|
|
721
|
if(boundPropertyId != null){
|
722
|
if(boundPropertyId.matches("genusOrUninomial") || boundPropertyId.matches("specificEpithet")){
|
723
|
TaxonNamePopupEditor namePopup = openPopupEditor(TaxonNamePopupEditor.class, event);
|
724
|
namePopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
|
725
|
namePopup.withDeleteButton(true);
|
726
|
getView().getModesActive().stream()
|
727
|
.filter(m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
|
728
|
.forEach(m -> namePopup.enableMode(m));
|
729
|
namePopup.loadInEditor(null);
|
730
|
if(boundPropertyId.matches("genusOrUninomial")){
|
731
|
namePopup.getRankSelect().setValue(Rank.GENUS());
|
732
|
}
|
733
|
if(boundPropertyId.matches("specificEpithet")){
|
734
|
namePopup.getGenusOrUninomialField().setValue(getView().getGenusOrUninomialField().getValue());
|
735
|
namePopup.getRankSelect().setValue(Rank.SPECIES());
|
736
|
}
|
737
|
if(WeaklyRelatedEntityField.class.isAssignableFrom(event.getTarget().getClass())){
|
738
|
WeaklyRelatedEntityField<TaxonName> taxoNameField = (WeaklyRelatedEntityField<TaxonName>)event.getTarget();
|
739
|
if(!taxoNameField.isValueInOptions()){
|
740
|
String nameString = event.getTarget().getValue();
|
741
|
if(StringUtils.isNotEmpty(nameString)){
|
742
|
if(boundPropertyId.matches("genusOrUninomial")){
|
743
|
namePopup.getGenusOrUninomialField().setValue(nameString);
|
744
|
}
|
745
|
if(boundPropertyId.matches("specificEpithet")){
|
746
|
namePopup.getSpecificEpithetField().setValue(nameString);
|
747
|
}
|
748
|
}
|
749
|
}
|
750
|
}
|
751
|
}
|
752
|
}
|
753
|
}
|
754
|
|
755
|
/**
|
756
|
* {@inheritDoc}
|
757
|
*/
|
758
|
@Override
|
759
|
protected TaxonNameDTO createDTODecorator(TaxonName cdmEntitiy) {
|
760
|
return new TaxonNameDTO(cdmEntitiy);
|
761
|
}
|
762
|
|
763
|
/**
|
764
|
* {@inheritDoc}
|
765
|
*/
|
766
|
@Override
|
767
|
protected BeanInstantiator<TaxonName> defaultCdmEntityInstantiator() {
|
768
|
return new BeanInstantiator<TaxonName>() {
|
769
|
|
770
|
@Override
|
771
|
public TaxonName createNewBean() {
|
772
|
return TaxonNameFactory.NewNameInstance(RegistrationUIDefaults.NOMENCLATURAL_CODE, Rank.SPECIES());
|
773
|
}
|
774
|
};
|
775
|
}
|
776
|
|
777
|
|
778
|
|
779
|
|
780
|
}
|