Project

General

Profile

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

    
11
/**
12
 * @author a.kohlbecker
13
 * @since Mar 22, 2017
14
 *
15
 */
16
public abstract class AbstractEntityEvent {
17

    
18

    
19
    private EntityEventType eventType;
20

    
21
    private Integer entityId = null;
22

    
23
    public AbstractEntityEvent(EntityEventType eventType, Integer entityId) {
24
        this.eventType = eventType;
25
        if(eventType == null){
26
            throw new NullPointerException();
27
        }
28
        this.setEntityId(entityId);
29
    }
30

    
31
    public AbstractEntityEvent(EntityEventType eventType) {
32
        this(eventType, null);
33
    }
34

    
35
    public EntityEventType getEventType() {
36
        return eventType;
37
    }
38

    
39
    public boolean isAddEvent() {
40
        return eventType.equals(EntityEventType.ADD);
41
    }
42
    public boolean isEditEvent() {
43
        return eventType.equals(EntityEventType.EDIT);
44
    }
45
    public boolean isRemoveEvent() {
46
        return eventType.equals(EntityEventType.REMOVE);
47
    }
48

    
49
    /**
50
     * @return the entityId
51
     */
52
    public Integer getEntityId() {
53
        return entityId;
54
    }
55

    
56
    /**
57
     * @param entityId the entityId to set
58
     */
59
    private void setEntityId(Integer entityId) {
60
        this.entityId = entityId;
61
    }
62

    
63
}
(1-1/6)