KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > event > DeleteEvent


1 //$Id: DeleteEvent.java,v 1.8 2005/07/11 20:33:59 steveebersole Exp $
2
package org.hibernate.event;
3
4
5 /** Defines an event class for the deletion of an entity.
6  *
7  * @author Steve Ebersole
8  */

9 public class DeleteEvent extends AbstractEvent {
10
11     private Object JavaDoc object;
12     private String JavaDoc entityName;
13     private boolean cascadeDeleteEnabled;
14
15     /**
16      * Constructs a new DeleteEvent instance.
17      *
18      * @param object The entity to be deleted.
19      * @param source The session from which the delete event was generated.
20      */

21     public DeleteEvent(Object JavaDoc object, EventSource source) {
22         super(source);
23         if (object == null) {
24             throw new IllegalArgumentException JavaDoc(
25                     "attempt to create delete event with null entity"
26                 );
27         }
28         this.object = object;
29     }
30
31     public DeleteEvent(String JavaDoc entityName, Object JavaDoc object, EventSource source) {
32         this(object, source);
33         this.entityName = entityName;
34     }
35
36     public DeleteEvent(String JavaDoc entityName, Object JavaDoc object, boolean isCascadeDeleteEnabled, EventSource source) {
37         this(object, source);
38         this.entityName = entityName;
39         cascadeDeleteEnabled = isCascadeDeleteEnabled;
40     }
41
42     /**
43      * Returns the encapsulated entity to be deleed.
44      *
45      * @return The entity to be deleted.
46      */

47     public Object JavaDoc getObject() {
48         return object;
49     }
50
51     public String JavaDoc getEntityName() {
52         return entityName;
53     }
54     
55     public boolean isCascadeDeleteEnabled() {
56         return cascadeDeleteEnabled;
57     }
58
59 }
60
Popular Tags