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
;
20 public class CdmChangeEvent
{
28 private final Action action
;
29 private final Set
<CdmBase
> changedObjects
;
30 private final Class
<?
> sourceType
;
31 private Class
<?
> entityType
;
32 private Object source
;
34 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Class
<?
> sourceType
) {
36 this.changedObjects
= changedObjects
;
37 this.sourceType
= sourceType
;
40 public CdmChangeEvent(Action action
, CdmBase changedObject
, Class
<?
> sourceType
) {
42 changedObjects
= new HashSet
<CdmBase
>();
43 changedObjects
.add(changedObject
);
44 this.sourceType
= sourceType
;
47 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Class sourceType
, Class entityType
) {
48 this(action
, changedObjects
, sourceType
);
49 this.entityType
= entityType
;
52 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Object source
) {
53 this(action
, changedObjects
, source
.getClass());
57 public Action
getAction() {
61 public Set
<?
extends CdmBase
> getChangedObjects() {
62 return changedObjects
;
65 public Class
<?
> getSourceType() {
69 public Object
getSource() {
73 public Class
<?
> getEntityType() {
77 public boolean hasChanges() {
78 return changedObjects
!= null && !changedObjects
.isEmpty();