KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: SaveOrUpdateEvent.java,v 1.9 2005/05/27 03:53:58 oneovthafew Exp $
2
package org.hibernate.event;
3
4 import java.io.Serializable JavaDoc;
5
6 import org.hibernate.engine.EntityEntry;
7
8 /**
9  * An event class for saveOrUpdate()
10  *
11  * @author Steve Ebersole
12  */

13 public class SaveOrUpdateEvent extends AbstractEvent {
14
15     private Object JavaDoc object;
16     private Serializable JavaDoc requestedId;
17     private String JavaDoc entityName;
18     private Object JavaDoc entity;
19     private EntityEntry entry;
20
21     public SaveOrUpdateEvent(String JavaDoc entityName, Object JavaDoc original, EventSource source) {
22         this(original, source);
23         this.entityName = entityName;
24     }
25
26     public SaveOrUpdateEvent(String JavaDoc entityName, Object JavaDoc original, Serializable JavaDoc id, EventSource source) {
27         this(entityName, original, source);
28         this.requestedId = id;
29         if ( requestedId == null ) {
30             throw new IllegalArgumentException JavaDoc(
31                     "attempt to create saveOrUpdate event with null identifier"
32             );
33         }
34     }
35
36     public SaveOrUpdateEvent(Object JavaDoc object, EventSource source) {
37         super(source);
38         if ( object == null ) {
39             throw new IllegalArgumentException JavaDoc(
40                     "attempt to create saveOrUpdate event with null entity"
41             );
42         }
43         this.object = object;
44     }
45
46     public Object JavaDoc getObject() {
47         return object;
48     }
49
50     public void setObject(Object JavaDoc object) {
51         this.object = object;
52     }
53
54     public Serializable JavaDoc getRequestedId() {
55         return requestedId;
56     }
57
58     public void setRequestedId(Serializable JavaDoc requestedId) {
59         this.requestedId = requestedId;
60     }
61
62     public String JavaDoc getEntityName() {
63         return entityName;
64     }
65
66     public void setEntityName(String JavaDoc entityName) {
67         this.entityName = entityName;
68     }
69
70     public Object JavaDoc getEntity() {
71         return entity;
72     }
73     
74     public void setEntity(Object JavaDoc entity) {
75         this.entity = entity;
76     }
77     
78     public EntityEntry getEntry() {
79         return entry;
80     }
81     
82     public void setEntry(EntityEntry entry) {
83         this.entry = entry;
84     }
85 }
86
Popular Tags