2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.api
.application
;
11 import java
.util
.HashSet
;
14 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
21 public class CdmChangeEvent
{
29 private final Action action
;
30 private final Set
<CdmBase
> changedObjects
;
31 private final Class sourceType
;
32 private Class entityType
;
33 private Object source
;
35 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Class sourceType
) {
37 this.changedObjects
= changedObjects
;
38 this.sourceType
= sourceType
;
41 public CdmChangeEvent(Action action
, CdmBase changedObject
, Class sourceType
) {
43 changedObjects
= new HashSet
<CdmBase
>();
44 changedObjects
.add(changedObject
);
45 this.sourceType
= sourceType
;
48 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Class sourceType
, Class entityType
) {
49 this(action
, changedObjects
, sourceType
);
50 this.entityType
= entityType
;
53 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Object source
) {
54 this(action
, changedObjects
, source
.getClass());
61 public Action
getAction() {
66 * @return the changedObjects
68 public Set
<?
extends CdmBase
> getChangedObjects() {
69 return changedObjects
;
73 * @return the sourceType
75 public Class
getSourceType() {
83 public Object
getSource() {
87 public Class
getEntityType() {
91 public boolean hasChanges() {
92 return changedObjects
!= null && !changedObjects
.isEmpty();