Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / cdm / api / application / CdmChangeEvent.java
index 1df0b486140aabf90fc0240e0e3c8f1c1efc71bd..c5bec4ece13520a28a553837502546cb5bfda01a 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2015 EDIT
 * European Distributed Institute of Taxonomy
@@ -9,6 +8,7 @@
 */
 package eu.etaxonomy.cdm.api.application;
 
+import java.util.HashSet;
 import java.util.Set;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
@@ -27,17 +27,30 @@ public class CdmChangeEvent {
     }
 
     private final Action action;
-    private final Set<? extends CdmBase> changedObjects;
+    private final Set<CdmBase> changedObjects;
     private final Class sourceType;
+    private Class entityType;
     private Object source;
 
-    public CdmChangeEvent(Action action, Set<? extends CdmBase> changedObjects, Class sourceType) {
+    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType) {
         this.action = action;
         this.changedObjects = changedObjects;
         this.sourceType = sourceType;
     }
 
-    public CdmChangeEvent(Action action, Set<? extends CdmBase> changedObjects, Object source) {
+    public CdmChangeEvent(Action action, CdmBase changedObject, Class sourceType) {
+        this.action = action;
+        changedObjects = new HashSet<CdmBase>();
+        changedObjects.add(changedObject);
+        this.sourceType = sourceType;
+    }
+
+    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType, Class entityType) {
+        this(action, changedObjects, sourceType);
+        this.entityType = entityType;
+    }
+
+    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Object source) {
         this(action, changedObjects, source.getClass());
         this.source = source;
     }
@@ -71,6 +84,10 @@ public class CdmChangeEvent {
         return source;
     }
 
+    public Class getEntityType() {
+        return entityType;
+    }
+
     public boolean hasChanges() {
         return changedObjects != null && !changedObjects.isEmpty();
     }