3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.api
.application
;
12 import java
.util
.HashSet
;
15 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
22 public class CdmChangeEvent
{
30 private final Action action
;
31 private final Set
<CdmBase
> changedObjects
;
32 private final Class sourceType
;
33 private Class entityType
;
34 private Object source
;
36 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Class sourceType
) {
38 this.changedObjects
= changedObjects
;
39 this.sourceType
= sourceType
;
42 public CdmChangeEvent(Action action
, CdmBase changedObject
, Class sourceType
) {
44 changedObjects
= new HashSet
<CdmBase
>();
45 changedObjects
.add(changedObject
);
46 this.sourceType
= sourceType
;
49 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Class sourceType
, Class entityType
) {
50 this(action
, changedObjects
, sourceType
);
51 this.entityType
= entityType
;
54 public CdmChangeEvent(Action action
, Set
<CdmBase
> changedObjects
, Object source
) {
55 this(action
, changedObjects
, source
.getClass());
62 public Action
getAction() {
67 * @return the changedObjects
69 public Set
<?
extends CdmBase
> getChangedObjects() {
70 return changedObjects
;
74 * @return the sourceType
76 public Class
getSourceType() {
84 public Object
getSource() {
88 public Class
getEntityType() {
92 public boolean hasChanges() {
93 return changedObjects
!= null && !changedObjects
.isEmpty();