Project

General

Profile

Revision c256784f

IDc256784fcfbe3c4a6b662c58be780f93ecba675c
Parent 9a4a9149
Child 7000c7bf

Added by Andreas Kohlbecker over 1 year ago

turning TaxonNamePopupEditor into dto editor

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/model/name/TaxonNameDTO.java
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.model.name;
10

  
11
import java.util.List;
12
import java.util.Set;
13

  
14
import org.joda.time.DateTime;
15

  
16
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
17
import eu.etaxonomy.cdm.model.common.Annotation;
18
import eu.etaxonomy.cdm.model.common.Credit;
19
import eu.etaxonomy.cdm.model.common.Extension;
20
import eu.etaxonomy.cdm.model.common.Identifier;
21
import eu.etaxonomy.cdm.model.common.User;
22
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
23
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
24
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
25
import eu.etaxonomy.cdm.model.name.Rank;
26
import eu.etaxonomy.cdm.model.name.TaxonName;
27
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
28
import eu.etaxonomy.cdm.vaadin.model.CdmEntityDecoraterDTO;
29

  
30
/**
31
 * @author a.kohlbecker
32
 * @since Apr 23, 2018
33
 *
34
 */
35
public class TaxonNameDTO extends CdmEntityDecoraterDTO<TaxonName> {
36

  
37
    class TN extends TaxonName {
38

  
39
    }
40

  
41
    private static final long serialVersionUID = -8018109905949198530L;
42

  
43
    private TaxonName name;
44

  
45
    /**
46
     * @param entity
47
     */
48
    public TaxonNameDTO(TaxonName entity) {
49
        super(entity);
50
        name = entity;
51
    }
52

  
53
    public String getAcronym() {
54
        return name.getAcronym();
55
    }
56

  
57
    public Set<Annotation> getAnnotations() {
58
        return name.getAnnotations();
59
    }
60

  
61
    public String getAppendedPhrase() {
62
        return name.getAppendedPhrase();
63
    }
64

  
65
    public String getAuthorshipCache() {
66

  
67
        return name.getAuthorshipCache();
68
    }
69

  
70
    public TaxonName getBasionym() {
71
        return name.getBasionym();
72
    }
73

  
74
    public TeamOrPersonBase<?> getBasionymAuthorship() {
75
        return name.getBasionymAuthorship();
76
    }
77

  
78
    public Set<TaxonName> getBasionyms() {
79
        return name.getBasionyms();
80
    }
81

  
82
    public TeamOrPersonBase<?> getCombinationAuthorship() {
83
        return name.getCombinationAuthorship();
84
    }
85

  
86
    public List<Credit> getCredits() {
87
        return name.getCredits();
88
    }
89

  
90
    public String getCultivarName() {
91
        return name.getCultivarName();
92
    }
93

  
94
    public TeamOrPersonBase<?> getExBasionymAuthorship() {
95
        return name.getExBasionymAuthorship();
96
    }
97

  
98
    public TeamOrPersonBase<?> getExCombinationAuthorship() {
99
        return name.getExCombinationAuthorship();
100
    }
101

  
102
    public Set<Extension> getExtensions() {
103
        return name.getExtensions();
104
    }
105

  
106
    public String getFullTitleCache() {
107
        return name.getFullTitleCache();
108
    }
109

  
110
    public String getGenusOrUninomial() {
111
        return name.getGenusOrUninomial();
112
    }
113

  
114
    public HomotypicalGroup getHomotypicalGroup() {
115
        return name.getHomotypicalGroup();
116
    }
117

  
118
    public List<Identifier> getIdentifiers() {
119
        return name.getIdentifiers();
120
    }
121

  
122
    public String getInfraGenericEpithet() {
123
        return name.getInfraGenericEpithet();
124
    }
125

  
126
    public String getInfraSpecificEpithet() {
127
        return name.getInfraSpecificEpithet();
128
    }
129

  
130
    public String getSpecificEpithet() {
131
        return name.getSpecificEpithet();
132
    }
133

  
134
    public String getNameCache() {
135
        return name.getNameCache();
136
    }
137

  
138
    public String getNomenclaturalMicroReference() {
139
        return name.getNomenclaturalMicroReference();
140
    }
141

  
142
    public INomenclaturalReference getNomenclaturalReference() {
143
        return name.getNomenclaturalReference();
144
    }
145

  
146
    public Rank getRank() {
147
        return name.getRank();
148
    }
149

  
150
    public Set<NomenclaturalStatus> getStatus() {
151
        return name.getStatus();
152
    }
153

  
154
    public boolean isProtectedAuthorshipCache() {
155
        return name.isProtectedAuthorshipCache();
156
    }
157

  
158
    public boolean isProtectedFullTitleCache() {
159
        return name.isProtectedFullTitleCache();
160
    }
161

  
162
    public boolean isProtectedNameCache() {
163
        return name.isProtectedNameCache();
164
    }
165

  
166
    public boolean isProtectedTitleCache() {
167
        return name.isProtectedTitleCache();
168
    }
169

  
170
    public void setAcronym(String acronym) {
171
        name.setAcronym(acronym);
172
    }
173

  
174
    public void setAppendedPhrase(String appendedPhrase) {
175
        name.setAppendedPhrase(appendedPhrase);
176
    }
177

  
178
    public void setBasionymAuthorship(TeamOrPersonBase<?> basionymAuthorship) {
179
        name.setBasionymAuthorship(basionymAuthorship);
180
    }
181

  
182
    public void setBinomHybrid(boolean binomHybrid) {
183
        name.setBinomHybrid(binomHybrid);
184
    }
185

  
186
    public void setBreed(String breed) {
187
        name.setBreed(breed);
188
    }
189

  
190
    public void setCombinationAuthorship(TeamOrPersonBase<?> combinationAuthorship) {
191
        name.setCombinationAuthorship(combinationAuthorship);
192
    }
193

  
194
    public void setCultivarName(String cultivarName) {
195
        name.setCultivarName(cultivarName);
196
    }
197

  
198
    public void setExBasionymAuthorship(TeamOrPersonBase<?> exBasionymAuthorship) {
199
        name.setExBasionymAuthorship(exBasionymAuthorship);
200
    }
201

  
202
    public void setExCombinationAuthorship(TeamOrPersonBase<?> exCombinationAuthorship) {
203
        name.setExCombinationAuthorship(exCombinationAuthorship);
204
    }
205

  
206
    public void setFullTitleCache(String fullTitleCache) {
207
        name.setFullTitleCache(fullTitleCache);
208
    }
209

  
210
    public void setGenusOrUninomial(String genusOrUninomial) {
211
        name.setGenusOrUninomial(genusOrUninomial);
212
    }
213

  
214
    public void setHybridFormula(boolean hybridFormula) {
215
        name.setHybridFormula(hybridFormula);
216
    }
217

  
218
    public void setInfraGenericEpithet(String infraGenericEpithet) {
219
        name.setInfraGenericEpithet(infraGenericEpithet);
220
    }
221

  
222
    public void setInfraSpecificEpithet(String infraSpecificEpithet) {
223
        name.setInfraSpecificEpithet(infraSpecificEpithet);
224
    }
225

  
226
    public void setMonomHybrid(boolean monomHybrid) {
227
        name.setMonomHybrid(monomHybrid);
228
    }
229

  
230
    public void setNameApprobation(String nameApprobation) {
231
        name.setNameApprobation(nameApprobation);
232
    }
233

  
234
    public void setNameCache(String nameCache) {
235
        name.setNameCache(nameCache);
236
    }
237

  
238
    public void setNameType(NomenclaturalCode nameType) {
239
        name.setNameType(nameType);
240
    }
241

  
242
    public void setNomenclaturalMicroReference(String nomenclaturalMicroReference) {
243
        name.setNomenclaturalMicroReference(nomenclaturalMicroReference);
244
    }
245

  
246
    public void setNomenclaturalReference(INomenclaturalReference nomenclaturalReference) {
247
        name.setNomenclaturalReference(nomenclaturalReference);
248
    }
249

  
250
    public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache) {
251
        name.setProtectedAuthorshipCache(protectedAuthorshipCache);
252
    }
253

  
254
    public void setProtectedFullTitleCache(boolean protectedFullTitleCache) {
255
        name.setProtectedFullTitleCache(protectedFullTitleCache);
256
    }
257

  
258
    public void setProtectedNameCache(boolean protectedNameCache) {
259
        name.setProtectedNameCache(protectedNameCache);
260
    }
261

  
262
    public void setProtectedTitleCache(boolean protectedTitleCache) {
263
        name.setProtectedTitleCache(protectedTitleCache);
264
    }
265

  
266
    public void setRank(Rank rank) {
267
        name.setRank(rank);
268
    }
269

  
270
    public void setSpecificEpithet(String specificEpithet) {
271
        name.setSpecificEpithet(specificEpithet);
272
    }
273

  
274
    public void setTitleCache(String titleCache) {
275
        name.setTitleCache(titleCache);
276
    }
277

  
278
    public void setTrinomHybrid(boolean trinomHybrid) {
279
        name.setTrinomHybrid(trinomHybrid);
280
    }
281

  
282
    public void setUpdated(DateTime updated) {
283
        name.setUpdated(updated);
284
    }
285

  
286
    public void setUpdatedBy(User updatedBy) {
287
        name.setUpdatedBy(updatedBy);
288
    }
289

  
290
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
45 45
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
46 46
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater;
47 47
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader;
48
import eu.etaxonomy.cdm.vaadin.model.name.TaxonNameDTO;
48 49
import eu.etaxonomy.cdm.vaadin.permission.UserHelper;
49 50
import eu.etaxonomy.cdm.vaadin.ui.RegistrationUIDefaults;
50 51
import eu.etaxonomy.cdm.vaadin.util.CdmTitleCacheCaptionGenerator;
51 52
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
52 53
import eu.etaxonomy.vaadin.component.ReloadableLazyComboBox;
53 54
import eu.etaxonomy.vaadin.component.ReloadableSelect;
54
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
55
import eu.etaxonomy.vaadin.mvp.AbstractCdmDTOEditorPresenter;
55 56
import eu.etaxonomy.vaadin.mvp.BeanInstantiator;
56 57

  
57 58
/**
......
61 62
 */
62 63
@SpringComponent
63 64
@Scope("prototype")
64
public class TaxonNameEditorPresenter extends AbstractCdmEditorPresenter<TaxonName, TaxonNamePopupEditorView> {
65
public class TaxonNameEditorPresenter extends AbstractCdmDTOEditorPresenter<TaxonNameDTO, TaxonName, TaxonNamePopupEditorView> {
65 66

  
66 67

  
67 68
    private static final List<String> BASIONYM_INIT_STRATEGY = Arrays.asList(
......
236 237
    }
237 238

  
238 239
    @Override
239
    protected TaxonName handleTransientProperties(TaxonName bean) {
240
    protected TaxonNameDTO handleTransientProperties(TaxonNameDTO dto) {
241

  
242
        TaxonName bean = cdmEntity(dto);
240 243

  
241 244
        logger.trace(this._toString() + ".onEditorSaveEvent - handling transient properties");
242 245

  
......
274 277
                bean.addBasionym(addBasionymName);
275 278
            }
276 279
        }
277
        return bean;
280
        return dto;
278 281
    }
279 282

  
280 283
    /**
......
409 412
        basionymNamePopup.getBasionymToggle().setVisible(false);
410 413
    }
411 414

  
415
    /**
416
     * {@inheritDoc}
417
     */
418
    @Override
419
    protected TaxonNameDTO createDTODecorator(TaxonName cdmEntitiy) {
420
        return new TaxonNameDTO(cdmEntitiy);
421
    }
422

  
412 423

  
413 424

  
414 425

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
40 40
import eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField;
41 41
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
42 42
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
43
import eu.etaxonomy.cdm.vaadin.model.name.TaxonNameDTO;
43 44
import eu.etaxonomy.cdm.vaadin.permission.AccessRestrictedView;
44 45
import eu.etaxonomy.cdm.vaadin.permission.CdmEditDeletePermissionTester;
45 46
import eu.etaxonomy.cdm.vaadin.util.TeamOrPersonBaseCaptionGenerator;
......
49 50
import eu.etaxonomy.vaadin.component.ToManyRelatedEntitiesComboboxSelect;
50 51
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox;
51 52
import eu.etaxonomy.vaadin.event.EditorActionType;
52
import eu.etaxonomy.vaadin.mvp.AbstractCdmPopupEditor;
53
import eu.etaxonomy.vaadin.mvp.AbstractCdmDTOPopupEditor;
53 54

  
54 55
/**
55 56
 * @author a.kohlbecker
......
58 59
 */
59 60
@SpringComponent
60 61
@Scope("prototype")
61
public class TaxonNamePopupEditor extends AbstractCdmPopupEditor<TaxonName, TaxonNameEditorPresenter> implements TaxonNamePopupEditorView, AccessRestrictedView {
62
public class TaxonNamePopupEditor extends AbstractCdmDTOPopupEditor<TaxonNameDTO, TaxonName, TaxonNameEditorPresenter> implements TaxonNamePopupEditorView, AccessRestrictedView {
62 63

  
63 64
    private static final long serialVersionUID = -7037436241474466359L;
64 65

  
......
115 116
     * @param dtoType
116 117
     */
117 118
    public TaxonNamePopupEditor() {
118
        super(new GridLayout(GRID_COLS, GRID_ROWS), TaxonName.class);
119
        super(new GridLayout(GRID_COLS, GRID_ROWS), TaxonNameDTO.class);
119 120
    }
120 121

  
121 122
    /**
......
380 381

  
381 382
    @Override
382 383
    protected void afterItemDataSourceSet() {
383
        TaxonName taxonName = getBean();
384
        TaxonNameDTO taxonName = getBean();
384 385
        boolean showBasionymSection = taxonName.getBasionyms().size() > 0
385 386
                || taxonName.getBasionymAuthorship() != null
386 387
                || taxonName.getExBasionymAuthorship() != null;
......
422 423
    @Override
423 424
    public void updateAuthorshipFields() {
424 425

  
425
        TaxonName taxonName = getBean();
426
        TaxonNameDTO taxonName = getBean();
426 427

  
427 428
        // ------------- CombinationAuthors
428 429
        isInferredCombinationAuthorship = updateAuthorshipFieldData(
......
527 528

  
528 529
        // TODO use getField() instead and remove field references
529 530

  
530
        TaxonName taxonName = getBean();
531
        TaxonNameDTO taxonName = getBean();
531 532
        Rank rank = taxonName.getRank();
532 533

  
533 534
        boolean isSpeciesOrBelow = !rank.isHigher(Rank.SPECIES());

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)