1 19 package org.apache.cayenne.map; 20 21 import java.io.Serializable ; 22 23 import org.apache.cayenne.LifecycleListener; 24 25 31 public class CallbackMap implements Serializable { 32 33 36 40 public static final int[] CALLBACKS = new int[] { 41 LifecycleListener.PRE_PERSIST, LifecycleListener.PRE_REMOVE, 42 LifecycleListener.PRE_UPDATE, LifecycleListener.POST_PERSIST, 43 LifecycleListener.POST_REMOVE, LifecycleListener.POST_UPDATE, 44 LifecycleListener.POST_LOAD 45 }; 46 47 protected CallbackDescriptor prePersist; 48 protected CallbackDescriptor postPersist; 49 protected CallbackDescriptor preUpdate; 50 protected CallbackDescriptor postUpdate; 51 protected CallbackDescriptor preRemove; 52 protected CallbackDescriptor postRemove; 53 protected CallbackDescriptor postLoad; 54 55 public CallbackMap() { 56 this.prePersist = new CallbackDescriptor(LifecycleListener.PRE_PERSIST); 57 this.postPersist = new CallbackDescriptor(LifecycleListener.POST_PERSIST); 58 this.preUpdate = new CallbackDescriptor(LifecycleListener.PRE_UPDATE); 59 this.postUpdate = new CallbackDescriptor(LifecycleListener.POST_UPDATE); 60 this.preRemove = new CallbackDescriptor(LifecycleListener.PRE_REMOVE); 61 this.postRemove = new CallbackDescriptor(LifecycleListener.POST_REMOVE); 62 this.postLoad = new CallbackDescriptor(LifecycleListener.POST_LOAD); 63 } 64 65 69 public CallbackDescriptor[] getCallbacks() { 70 return new CallbackDescriptor[] { 71 prePersist, preRemove, preUpdate, postPersist, postRemove, postUpdate, 72 postLoad 73 }; 74 } 75 76 public CallbackDescriptor getPostLoad() { 77 return postLoad; 78 } 79 80 public CallbackDescriptor getPostPersist() { 81 return postPersist; 82 } 83 84 public CallbackDescriptor getPostRemove() { 85 return postRemove; 86 } 87 88 public CallbackDescriptor getPostUpdate() { 89 return postUpdate; 90 } 91 92 public CallbackDescriptor getPrePersist() { 93 return prePersist; 94 } 95 96 public CallbackDescriptor getPreRemove() { 97 return preRemove; 98 } 99 100 public CallbackDescriptor getPreUpdate() { 101 return preUpdate; 102 } 103 } 104 | Popular Tags |