KickJava   Java API By Example, From Geeks To Geeks.

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


1 //$Id: MergeEvent.java,v 1.5 2005/05/27 03:53:58 oneovthafew Exp $
2
package org.hibernate.event;
3
4 import java.io.Serializable JavaDoc;
5
6 /**
7  * An event class for merge() and saveOrUpdateCopy()
8  *
9  * @author Gavin King
10  */

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