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 AbstractEditorAction {
|
17
|
|
18
|
|
19
|
private EditorActionType actionType;
|
20
|
|
21
|
private Integer entityId = null;
|
22
|
|
23
|
public AbstractEditorAction(EditorActionType eventType, Integer entityId) {
|
24
|
this.actionType = eventType;
|
25
|
if(eventType == null){
|
26
|
throw new NullPointerException();
|
27
|
}
|
28
|
this.setEntityId(entityId);
|
29
|
}
|
30
|
|
31
|
public AbstractEditorAction(EditorActionType actionType) {
|
32
|
this(actionType, null);
|
33
|
}
|
34
|
|
35
|
public EditorActionType getActionType() {
|
36
|
return actionType;
|
37
|
}
|
38
|
|
39
|
public boolean isAddAction() {
|
40
|
return actionType.equals(EditorActionType.ADD);
|
41
|
}
|
42
|
public boolean isEditAction() {
|
43
|
return actionType.equals(EditorActionType.EDIT);
|
44
|
}
|
45
|
public boolean isRemoveAction() {
|
46
|
return actionType.equals(EditorActionType.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
|
}
|