Project

General

Profile

Download (1.77 KB) Statistics
| Branch: | Tag: | Revision:
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.vaadin.component;
10

    
11
/**
12
 * Interface to ship around equality problems of entities which have modified data.
13
 *
14
 * TODO as inner type of ToOneRelatedEntityReloader?
15
 *
16
 * @author a.kohlbecker
17
 * @since Feb 8, 2018
18
 *
19
 * @param <V>
20
 */
21
public interface EntitySupport<V> {
22

    
23
    /**
24
     * This method allows updating the value even if the equals check done
25
     * in {@link com.vaadin.ui.AbstractField#setValue(Object)} would return true.
26
     * This is important when working with entity beans which have been modified.
27
     * For entity beans equality given when the type and id are equal, so data
28
     * modification is not respected by this concept of equality. Such entities
29
     * would be skipped in the {@link com.vaadin.ui.AbstractField#setValue(Object) setValue()}
30
     * method and {@link ValueChangeListener ValueChangeListeners} like the
31
     * {@link eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader ToOneRelatedEntityReloader}
32
     *  would not be triggered.
33
     *  <p>
34
     *  To circumvent this problem this method checks for object identity with the internal value of
35
     *  the select field and resets the internal select fields to cause the equality check to fail during
36
     *  the subsequent execution of the setValue() method. By this it is guaranteed the the value will be
37
     *  updated and that
38
     *  the {@link eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityReloader ToOneRelatedEntityReloaders}
39
     *  will be triggered.
40
     *
41
     * @param bean
42
     */
43
    void replaceEntityValue(V bean);
44

    
45
}
(4-4/14)