-// $Id$
/**
* Copyright (C) 2015 EDIT
* European Distributed Institute of Taxonomy
*/
package eu.etaxonomy.cdm.api.application;
+import java.util.HashSet;
import java.util.Set;
import eu.etaxonomy.cdm.model.common.CdmBase;
}
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;
}
return source;
}
+ public Class getEntityType() {
+ return entityType;
+ }
+
public boolean hasChanges() {
return changedObjects != null && !changedObjects.isEmpty();
}