[HHH-2926] Pre*Event must inherit AbstractEvent

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15043 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Diego Plentz 2008-08-12 17:50:46 +00:00
parent d5e908eaeb
commit 722a9fb553
7 changed files with 14 additions and 22 deletions

View File

@ -127,7 +127,7 @@ public final class EntityDeleteAction extends EntityAction {
.getPreDeleteEventListeners();
boolean veto = false;
if (preListeners.length>0) {
PreDeleteEvent preEvent = new PreDeleteEvent( getInstance(), getId(), state, getPersister() );
PreDeleteEvent preEvent = new PreDeleteEvent( getInstance(), getId(), state, getPersister() ,(EventSource) getSession() );
for ( int i = 0; i < preListeners.length; i++ ) {
veto = preListeners[i].onPreDelete(preEvent) || veto;
}

View File

@ -137,7 +137,7 @@ public final class EntityIdentityInsertAction extends EntityAction {
.getPreInsertEventListeners();
boolean veto = false;
if (preListeners.length>0) {
PreInsertEvent preEvent = new PreInsertEvent( getInstance(), null, state, getPersister(), getSession() );
PreInsertEvent preEvent = new PreInsertEvent( getInstance(), null, state, getPersister(), (EventSource)getSession() );
for ( int i = 0; i < preListeners.length; i++ ) {
veto = preListeners[i].onPreInsert(preEvent) || veto;
}

View File

@ -173,7 +173,7 @@ public final class EntityInsertAction extends EntityAction {
.getPreInsertEventListeners();
boolean veto = false;
if (preListeners.length>0) {
PreInsertEvent preEvent = new PreInsertEvent( getInstance(), getId(), state, getPersister(), getSession() );
PreInsertEvent preEvent = new PreInsertEvent( getInstance(), getId(), state, getPersister(), (EventSource)getSession() );
for ( int i = 0; i < preListeners.length; i++ ) {
veto = preListeners[i].onPreInsert(preEvent) || veto;
}

View File

@ -231,7 +231,7 @@ public final class EntityUpdateAction extends EntityAction {
state,
previousState,
getPersister(),
getSession()
(EventSource)getSession()
);
for ( int i = 0; i < preListeners.length; i++ ) {
veto = preListeners[i].onPreUpdate(preEvent) || veto;

View File

@ -33,7 +33,7 @@ import org.hibernate.persister.entity.EntityPersister;
*
* @author Gavin King
*/
public class PreDeleteEvent {
public class PreDeleteEvent extends AbstractEvent {
private Object entity;
private EntityPersister persister;
private Serializable id;
@ -56,8 +56,10 @@ public class PreDeleteEvent {
Object entity,
Serializable id,
Object[] deletedState,
EntityPersister persister
EntityPersister persister,
EventSource source
) {
super(source);
this.entity = entity;
this.persister = persister;
this.id = id;

View File

@ -27,28 +27,26 @@ package org.hibernate.event;
import java.io.Serializable;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.engine.SessionImplementor;
/**
* Occurs before inserting an item in the datastore
*
* @author Gavin King
*/
public class PreInsertEvent {
public class PreInsertEvent extends AbstractEvent {
private Object entity;
private EntityPersister persister;
private Object[] state;
private Serializable id;
private SessionImplementor source;
public PreInsertEvent(
Object entity,
Serializable id,
Object[] state,
EntityPersister persister,
SessionImplementor source
EventSource source
) {
this.source = source;
super(source);
this.entity = entity;
this.id = id;
this.state = state;
@ -67,7 +65,4 @@ public class PreInsertEvent {
public Object[] getState() {
return state;
}
public SessionImplementor getSource() {
return source;
}
}

View File

@ -27,20 +27,18 @@ package org.hibernate.event;
import java.io.Serializable;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.engine.SessionImplementor;
/**
* Occurs before updating the datastore
*
* @author Gavin King
*/
public class PreUpdateEvent {
public class PreUpdateEvent extends AbstractEvent {
private Object entity;
private EntityPersister persister;
private Object[] state;
private Object[] oldState;
private Serializable id;
private SessionImplementor source;
public PreUpdateEvent(
Object entity,
@ -48,9 +46,9 @@ public class PreUpdateEvent {
Object[] state,
Object[] oldState,
EntityPersister persister,
SessionImplementor source
EventSource source
) {
this.source = source;
super(source);
this.entity = entity;
this.id = id;
this.state = state;
@ -73,7 +71,4 @@ public class PreUpdateEvent {
public Object[] getState() {
return state;
}
public SessionImplementor getSource() {
return source;
}
}