FileDocCategorySizeDatePackage
DescriptorEventManager.javaAPI DocGlassfish v2 API36991Tue May 22 16:54:16 BST 2007oracle.toplink.essentials.descriptors

DescriptorEventManager

public class DescriptorEventManager extends Object implements Serializable, Cloneable

Purpose: The event manager allows for a descriptor to specify that an object should be notified when a TopLink event occurs. It also determines how the object will be notified. To specify an event a method name can be registered to be called on the object when the event occurs. Events can be used to extend the TopLink reading and writing behavior.

These events include:

  • pre/postWrite - occurs when an object is written (occurs even if no changes to the object).
  • pre/postInsert - occurs when an object is inserted.
  • pre/postUpdate - occurs when an object is updated (occurs even if no changes to the object).
  • pre/postDeleted - occurs when an object is deleted.
  • postBuild/postRefresh - occurs after a object has been built/refreshed from its database row.
  • aboutTo/Insert/Update - occurs when an object is about to be inserted/update allows for row modification.
  • postClone - occurs when an object is registered/cloned in a unit of work.
  • postMerge - occurs when an object is merged with its original in a unit of work.
see
ClassDescriptor

Fields Summary
protected ClassDescriptor
descriptor
protected Vector
eventSelectors
protected transient Vector
eventMethods
protected transient Vector
eventListeners
protected transient Vector
defaultEventListeners
protected transient Vector
entityListenerEventListeners
protected transient DescriptorEventListener
entityEventListener
protected transient Vector
entityEventManagers
protected transient Vector
entityListenerEventManagers
protected boolean
excludeDefaultListeners
protected boolean
excludeSuperclassListeners
protected boolean
hasAnyEventListeners
PERF: Cache if any events listener exist.
public static final int
PreWriteEvent
public static final int
PostWriteEvent
public static final int
PreDeleteEvent
public static final int
PostDeleteEvent
public static final int
PreInsertEvent
public static final int
PostInsertEvent
public static final int
PreUpdateEvent
public static final int
PostUpdateEvent
public static final int
PostBuildEvent
public static final int
PostRefreshEvent
public static final int
PostCloneEvent
public static final int
PostMergeEvent
public static final int
AboutToInsertEvent
public static final int
AboutToUpdateEvent
public static final int
AboutToDeleteEvent
public static final int
PrePersistEvent
public static final int
PreRemoveEvent
public static final int
PreUpdateWithChangesEvent
public static final int
NumberOfEvents
Constructors Summary
public DescriptorEventManager()
INTERNAL: Returns a new DescriptorEventManager for the specified Descriptor.

    
                  
      
        this.eventSelectors = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(NumberOfEvents);
        this.eventMethods = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(NumberOfEvents);
        this.hasAnyEventListeners = false;
        this.excludeDefaultListeners = false;
        this.excludeSuperclassListeners = false;
        

        for (int index = 0; index < NumberOfEvents; index++) {
            this.eventSelectors.addElement(null);
            this.eventMethods.addElement(null);
        }
    
Methods Summary
public voidaddDefaultEventListener(oracle.toplink.essentials.descriptors.DescriptorEventListener listener)
PUBLIC: EJB 3.0 support for default listeners.

        getDefaultEventListeners().addElement(listener);
    
public voidaddEntityListenerEventListener(oracle.toplink.essentials.descriptors.DescriptorEventListener listener)
PUBLIC: EJB 3.0 support for lifecycle callback events defined on an entity listener class.

        getEntityListenerEventListeners().addElement(listener);
    
public voidaddListener(oracle.toplink.essentials.descriptors.DescriptorEventListener listener)
PUBLIC: Listener objects can be registered with the event manager to be notified when an event occurs on any instance of the descriptor's class.

        getEventListeners().addElement(listener);
        setHasAnyEventListeners(true);
    
public java.lang.Objectclone()
INTERNAL: Clone the manager and its private parts.

        DescriptorEventManager clone = null;

        try {
            clone = (DescriptorEventManager)super.clone();
            clone.setEventSelectors((Vector)getEventSelectors().clone());
            clone.setEventMethods((Vector)getEventMethods().clone());
            clone.setEventListeners((Vector)getEventListeners());
        } catch (Exception exception) {
            ;
        }

        return clone;
    
public booleanexcludeDefaultListeners()
INTERNAL: EJB 3.0 support. Returns true if this event manager should exclude the invocation of the default listeners for this descriptor.

        return excludeDefaultListeners;
    
public booleanexcludeSuperclassListeners()
INTERNAL: EJB 3.0 support. Returns true is this event manager should exclude the invocation of the listeners defined by the entity listener classes for the superclasses of this descriptor.

        return excludeSuperclassListeners;
    
public voidexecuteEvent(oracle.toplink.essentials.descriptors.DescriptorEvent event)
INTERNAL: Execute the given selector with the event as argument.

exception
DescriptorException - the method cannot be found or executed

        try {
            event.getSession().startOperationProfile(SessionProfiler.DescriptorEvent);
            // CR#3467758, ensure the descriptor is set on the event.
            event.setDescriptor(getDescriptor());
            notifyListeners(event);
            notifyEJB30Listeners(event);

            if (event.getSource() instanceof DescriptorEventListener) {
                // Allow the object itself to implement the interface.
                notifyListener((DescriptorEventListener)event.getSource(), event);
                return;
            }

            Method eventMethod = (Method)getEventMethods().elementAt(event.getEventCode());
            if (eventMethod == null) {
                return;
            }

            // Now that I have the method, I need to invoke it
            try {
                Object[] runtimeParameters = new Object[1];
                runtimeParameters[0] = event;
                if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
                    try {
                        AccessController.doPrivileged(new PrivilegedMethodInvoker(eventMethod, event.getSource(), runtimeParameters));
                    } catch (PrivilegedActionException exception) {
                        Exception throwableException = exception.getException();
                        if (throwableException instanceof IllegalAccessException) {
                            throw DescriptorException.illegalAccessWhileEventExecution(eventMethod.getName(), getDescriptor(), throwableException);
                        } else {
                            throw DescriptorException.targetInvocationWhileEventExecution(eventMethod.getName(), getDescriptor(), throwableException);
                        }
                    }
                } else {
                    PrivilegedAccessHelper.invokeMethod(eventMethod, event.getSource(), runtimeParameters);
                }
            } catch (IllegalAccessException exception) {
                throw DescriptorException.illegalAccessWhileEventExecution(eventMethod.getName(), getDescriptor(), exception);
            } catch (IllegalArgumentException exception) {
                throw DescriptorException.illegalArgumentWhileObsoleteEventExecute(eventMethod.getName(), getDescriptor(), exception);
            } catch (InvocationTargetException exception) {
                throw DescriptorException.targetInvocationWhileEventExecution(eventMethod.getName(), getDescriptor(), exception);
            }
        } finally {
            event.getSession().endOperationProfile(SessionProfiler.DescriptorEvent);
        }
    
protected java.lang.reflect.MethodfindMethod(int selector)
Find the method corresponding to the event selector. The method MUST take DescriptorEvent as argument, Session is also supported as argument for backward compatibility.

        Class[] declarationParameters = new Class[1];
        declarationParameters[0] = ClassConstants.DescriptorEvent_Class;
        String methodName = (String)getEventSelectors().elementAt(selector);

        try {
            return Helper.getDeclaredMethod(getDescriptor().getJavaClass(), methodName, declarationParameters);
        } catch (NoSuchMethodException exception) {
            throw DescriptorException.noSuchMethodOnFindObsoleteMethod(methodName, getDescriptor(), exception);
        } catch (SecurityException exception) {
            throw DescriptorException.securityOnFindMethod(methodName, getDescriptor(), exception);
        }
    
public java.lang.StringgetAboutToInsertSelector()
INTERNAL:

        return (String)getEventSelectors().elementAt(AboutToInsertEvent);
    
public java.lang.StringgetAboutToUpdateSelector()
INTERNAL:

        return (String)getEventSelectors().elementAt(AboutToUpdateEvent);
    
public java.util.VectorgetDefaultEventListeners()
INTERNAL: EJB 3.0 support. Returns the default listeners.

        if (defaultEventListeners == null) {
            defaultEventListeners = new Vector();
        }
        
        return defaultEventListeners;
    
protected oracle.toplink.essentials.descriptors.ClassDescriptorgetDescriptor()
INTERNAL:

        return descriptor;
    
public oracle.toplink.essentials.descriptors.DescriptorEventListenergetEntityEventListener()
INTERNAL: EJB 3.0 support. Returns the entity event listener.

        return entityEventListener;
    
public java.util.VectorgetEntityListenerEventListeners()
INTERNAL: EJB 3.0 support. Returns the entity listener event listeners.

        if (entityListenerEventListeners == null) {
            entityListenerEventListeners = new Vector();
        }
        
        return entityListenerEventListeners;
    
public java.util.VectorgetEventListeners()
PUBLIC: Returns the Listener objects that have been added.

see
#addListener(DescriptorEventListener)

        // Lazy initialize to avoid unessisary enumerations.
        if (eventListeners == null) {
            eventListeners = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(1);
        }
        return eventListeners;
    
protected java.util.VectorgetEventMethods()

        //Lazy Initialized to prevent Null Pointer exception after serialization
        if (this.eventMethods == null) {
            this.eventMethods = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(NumberOfEvents);
            for (int index = 0; index < NumberOfEvents; ++index) {
                this.eventMethods.addElement(null);
            }
        }
        return eventMethods;
    
protected java.util.VectorgetEventSelectors()

        if (this.eventSelectors == null) {
            this.eventSelectors = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(NumberOfEvents);
            for (int index = 0; index < NumberOfEvents; ++index) {
                this.eventSelectors.addElement(null);
            }
        }
        return eventSelectors;
    
public java.lang.StringgetPostBuildSelector()
PUBLIC: The name of the method called after an object is built

        return (String)getEventSelectors().elementAt(PostBuildEvent);
    
public java.lang.StringgetPostCloneSelector()
PUBLIC: The name of the method called after an object is cloned

        return (String)getEventSelectors().elementAt(PostCloneEvent);
    
public java.lang.StringgetPostDeleteSelector()
PUBLIC: The name of the method called after an object is deleted

        return (String)getEventSelectors().elementAt(PostDeleteEvent);
    
public java.lang.StringgetPostInsertSelector()
PUBLIC: The name of the method called after an object is inserted

        return (String)getEventSelectors().elementAt(PostInsertEvent);
    
public java.lang.StringgetPostMergeSelector()
PUBLIC: The name of the method called after an object is merged

        return (String)getEventSelectors().elementAt(PostMergeEvent);
    
public java.lang.StringgetPostRefreshSelector()
PUBLIC: The name of the method called after an object is refreshed

        return (String)getEventSelectors().elementAt(PostRefreshEvent);
    
public java.lang.StringgetPostUpdateSelector()
PUBLIC: The name of the method called after an object is updated

        return (String)getEventSelectors().elementAt(PostUpdateEvent);
    
public java.lang.StringgetPostWriteSelector()
PUBLIC: The name of the method called after an object is written

        return (String)getEventSelectors().elementAt(PostWriteEvent);
    
public java.lang.StringgetPreDeleteSelector()
PUBLIC: The name of the method called before an object is deleted

        return (String)getEventSelectors().elementAt(PreDeleteEvent);
    
public java.lang.StringgetPreInsertSelector()
PUBLIC: The name of the method called before an object is inserted

        return (String)getEventSelectors().elementAt(PreInsertEvent);
    
public java.lang.StringgetPrePersistSelector()
PUBLIC: The name of the method called before the create operation is applied to an object

        return (String)getEventSelectors().elementAt(PrePersistEvent);
    
public java.lang.StringgetPreRemoveSelector()
PUBLIC: The name of the method called before the remove operation is applied to an object

        return (String)getEventSelectors().elementAt(PreRemoveEvent);
    
public java.lang.StringgetPreUpdateSelector()
PUBLIC: The name of the method called before an object is updated

        return (String)getEventSelectors().elementAt(PreUpdateEvent);
    
public java.lang.StringgetPreWriteSelector()
PUBLIC: The name of the method called before an object is written

        return (String)getEventSelectors().elementAt(PreWriteEvent);
    
public booleanhasAnyEventListeners()
INTERNAL: Return if the event manager has any event listeners, or event methods. If nothing is listening to event they can be avoided.

        // Check listeners in case of collection added to directly as occurs 
        // for aggregates that have a clone of the event manager but not the 
        // listeners.
        return hasAnyEventListeners || hasAnyListeners() || hasEntityEventListener() || hasEntityListenerEventListeners();
    
protected booleanhasAnyListeners()

        return (eventListeners != null) && (!eventListeners.isEmpty());
    
public booleanhasEntityEventListener()
INTERNAL: EJB 3.0 support. Return true if this event manager has any entity event listeners.

        return entityEventListener != null;
    
public booleanhasEntityListenerEventListeners()
INTERNAL: EJB 3.0 support. Return true if this event manager has any entity listener event listeners.

        return entityListenerEventListeners != null && entityListenerEventListeners.size() > 0;
    
public voidinitialize(oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL: Configure inherited selectors.

        // Initialize the EJB 3.0 supported listeners.
        initializeEJB30EventManagers();
        
        // Initialize if events are required at all.
        if (hasAnyListeners() || DescriptorEventListener.class.isAssignableFrom(getDescriptor().getJavaClass())) {
            setHasAnyEventListeners(true);
        }

        for (int index = 0; index < NumberOfEvents; index++) {
            if (getEventSelectors().elementAt(index) != null) {
                setHasAnyEventListeners(true);
                getEventMethods().setElementAt(findMethod(index), index);
            }
        }

        // Inherit all parent defined event method
        // Do NOT inherit the listener as the events are broadcast to the parent.
        if (getDescriptor().isChildDescriptor()) {
            DescriptorEventManager parentEventManager = getDescriptor().getInheritancePolicy().getParentDescriptor().getEventManager();

            for (int index = 0; index < NumberOfEvents; index++) {
                if (getEventSelectors().elementAt(index) == null) {
                    setHasAnyEventListeners(true);
                    getEventSelectors().setElementAt(parentEventManager.getEventSelectors().elementAt(index), index);
                    getEventMethods().setElementAt(parentEventManager.getEventMethods().elementAt(index), index);
                }
            }
        }
    
protected voidinitializeEJB30EventManagers()
INTERNAL: EJB 3.0 support. Builds our chains of descriptor event managers that will need to be notified. The chains are cache so we only need to build them once.

        entityEventManagers = new Vector();
        entityListenerEventManagers = new Vector();
             
        if (hasEntityEventListener()) {
            entityEventManagers.add(this);
        }
        
        if (hasEntityListenerEventListeners()) {
            entityListenerEventManagers.add(this);
        }
        
        ClassDescriptor currentDescriptor = getDescriptor();     
        boolean excludeEntityListeners = excludeSuperclassListeners();
            
        while (currentDescriptor.isChildDescriptor()) {
            currentDescriptor = currentDescriptor.getInheritancePolicy().getParentDescriptor();
            
            DescriptorEventManager eventManager = currentDescriptor.getEventManager();
            
            if (eventManager.hasEntityEventListener()) {
                entityEventManagers.add(eventManager);
            }
            
            if (eventManager.hasEntityListenerEventListeners()) {
                if (!excludeEntityListeners) {
                    entityListenerEventManagers.add(eventManager);
                }
            }
            
            excludeEntityListeners = eventManager.excludeSuperclassListeners();
        }
    
protected voidnotifyEJB30Listeners(oracle.toplink.essentials.descriptors.DescriptorEvent event)
INTERNAL: Notify the EJB 3.0 event listeners.

        // Step 1 - notify our default listeners.
        if (! excludeDefaultListeners()) {
            for (int i = 0; i < getDefaultEventListeners().size(); i++) {
                DescriptorEventListener listener = (DescriptorEventListener) getDefaultEventListeners().get(i);
                notifyListener(listener, event);
            }
        }
             
        // Step 2 - Notify the Entity Listener's first, top -> down.
        for (int index = entityListenerEventManagers.size() - 1; index >= 0; index--) {
            Vector entityListenerEventListeners = ((DescriptorEventManager) entityListenerEventManagers.get(index)).getEntityListenerEventListeners();
                 
            for (int i = 0; i < entityListenerEventListeners.size(); i++) {
                DescriptorEventListener listener = (DescriptorEventListener) entityListenerEventListeners.get(i);
                notifyListener(listener, event);        
            }
        }
             
        // Step 3 - Notify the Entity event listeners. top -> down, unless 
        // they are overriden in a subclass.
        for (int index = entityEventManagers.size() - 1; index >= 0; index--) {
            DescriptorEventListener entityEventListener = ((DescriptorEventManager) entityEventManagers.get(index)).getEntityEventListener();     
            
            if (! entityEventListener.isOverriddenEvent(event, entityEventManagers)) {
                notifyListener(entityEventListener, event);
            }
        }
    
protected voidnotifyListener(oracle.toplink.essentials.descriptors.DescriptorEventListener listener, oracle.toplink.essentials.descriptors.DescriptorEvent event)
INTERNAL: Big ugly case statement to notify listeners.

        switch (event.getEventCode()) {
        case PreWriteEvent:
            listener.preWrite(event);
            break;
        case PostWriteEvent:
            listener.postWrite(event);
            break;
        case PreDeleteEvent:
            listener.preDelete(event);
            break;
        case PostDeleteEvent:
            listener.postDelete(event);
            break;
        case PreInsertEvent:
            listener.preInsert(event);
            break;
        case PostInsertEvent:
            listener.postInsert(event);
            break;
        case PreUpdateEvent:
            listener.preUpdate(event);
            break;
        case PostUpdateEvent:
            listener.postUpdate(event);
            break;
        case PostMergeEvent:
            listener.postMerge(event);
            break;
        case PostCloneEvent:
            listener.postClone(event);
            break;
        case PostBuildEvent:
            listener.postBuild(event);
            break;
        case PostRefreshEvent:
            listener.postRefresh(event);
            break;
        case AboutToInsertEvent:
            listener.aboutToInsert(event);
            break;
        case AboutToUpdateEvent:
            listener.aboutToUpdate(event);
            break;
        case AboutToDeleteEvent:
            listener.aboutToDelete(event);
            break;
        case PrePersistEvent:
            listener.prePersist(event);
            break;
        case PreRemoveEvent:
            listener.preRemove(event);
            break;
        case PreUpdateWithChangesEvent:
            listener.preUpdateWithChanges(event);
            break;
        default:
            throw DescriptorException.invalidDescriptorEventCode(event, getDescriptor());
        }
    
public voidnotifyListeners(oracle.toplink.essentials.descriptors.DescriptorEvent event)
INTERNAL: Notify the event listeners.

        if (hasAnyListeners()) {
            for (int index = 0; index < getEventListeners().size(); index++) {
                DescriptorEventListener listener = (DescriptorEventListener)getEventListeners().get(index);
                notifyListener(listener, event);
            }
        }
  
        // Also must notify any inherited listeners.
        if (getDescriptor().isChildDescriptor()) {
            getDescriptor().getInheritancePolicy().getParentDescriptor().getEventManager().notifyListeners(event);
        }
    
public voidremoteInitialization(oracle.toplink.essentials.internal.sessions.AbstractSession session)
INTERNAL: Used to initialize a remote DescriptorEventManager.

        this.eventMethods = new Vector(NumberOfEvents);

        for (int index = 0; index < NumberOfEvents; index++) {
            this.eventMethods.addElement(null);
        }

        initialize(session);
    
public voidremoveListener(oracle.toplink.essentials.descriptors.DescriptorEventListener listener)
PUBLIC: Remove a event listener.

        getEventListeners().removeElement(listener);
    
public voidsetAboutToInsertSelector(java.lang.String aboutToInsertSelector)
PUBLIC: A method can be registered to be called when an object's row it about to be inserted. This uses the optional event argument of the DatabaseRow. This is different from pre/postInsert because it occurs after the row has already been built. This event can be used to modify the row before insert, such as adding a user inserted by.

        getEventSelectors().setElementAt(aboutToInsertSelector, AboutToInsertEvent);
    
public voidsetAboutToUpdateSelector(java.lang.String aboutToUpdateSelector)
PUBLIC: A method can be registered to be called when an object's row it about to be updated. This uses the optional event argument of the DatabaseRow. This is different from pre/postUpdate because it occurs after the row has already been built, and it ONLY called if the update is required (changed within a unit of work), as the other occur ALWAYS. This event can be used to modify the row before insert, such as adding a user inserted by.

        getEventSelectors().setElementAt(aboutToUpdateSelector, AboutToUpdateEvent);
    
public voidsetDescriptor(oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Set the descriptor.

        this.descriptor = descriptor;
    
public voidsetEntityEventListener(oracle.toplink.essentials.descriptors.DescriptorEventListener listener)
PUBLIC: EJB 3.0 support for lifecycle callback events defined on an entity class.

        this.entityEventListener = listener;
    
protected voidsetEventListeners(java.util.Vector eventListeners)

        this.eventListeners = eventListeners;
    
protected voidsetEventMethods(java.util.Vector eventMethods)

        this.eventMethods = eventMethods;
    
protected voidsetEventSelectors(java.util.Vector eventSelectors)

        this.eventSelectors = eventSelectors;
    
public voidsetExcludeDefaultListeners(boolean excludeDefaultListeners)
INTERNAL: EJB 3.0 support. Default listeners apply to all entities in a persistence unit. Set this flag to true to exclude the invocation of the default listeners for this descriptor.

        this.excludeDefaultListeners = excludeDefaultListeners;
    
public voidsetExcludeSuperclassListeners(boolean excludeSuperclassListeners)
INTERNAL: EJB 3.0 support. If multiple entity classes in an inheritance hierarchy define entity listeners, the listeners defined for a superclass are invoked before the listeners defined for its subclasses. Set this flag to true to exclude the invocation of the listeners defined by the entity listener classes for the superclasses of this descriptor.

        this.excludeSuperclassListeners = excludeSuperclassListeners;
    
protected voidsetHasAnyEventListeners(boolean hasAnyEventListeners)
INTERNAL: Set if the event manager has any event listeners, or event methods. If nothing is listening to event they can be avoided.

        this.hasAnyEventListeners = hasAnyEventListeners;
    
public voidsetPostBuildSelector(java.lang.String postBuildSelector)
PUBLIC: A method can be registered to be called on a object that has just been built from the database. This uses the optional event argument of the DatabaseRow. This event can be used to correctly initialize an object's non-persistent attributes or to perform complex optimizations or mappings. This event is called whenever an object is built.

        getEventSelectors().setElementAt(postBuildSelector, PostBuildEvent);
    
public voidsetPostCloneSelector(java.lang.String postCloneSelector)
PUBLIC: A method can be registered to be called on a object that has just been cloned into a unit of work. This uses the optional event argument of the orignial object (the source object it the clone). This event can be used to correctly initialize an object's non-persistent attributes.

        getEventSelectors().setElementAt(postCloneSelector, PostCloneEvent);
    
public voidsetPostDeleteSelector(java.lang.String postDeleteSelector)
PUBLIC: A method can be registered to be called on a object that has just been deleted from the database. This event can notify/remove any dependents on the object.

        getEventSelectors().setElementAt(postDeleteSelector, PostDeleteEvent);
    
public voidsetPostInsertSelector(java.lang.String postInsertSelector)
PUBLIC: A method can be registered to be called on a object that has just been inserted into the database. This event can be used to notify any dependent on the object, or to update information not accessible until the object has been inserted.

        getEventSelectors().setElementAt(postInsertSelector, PostInsertEvent);
    
public voidsetPostMergeSelector(java.lang.String postMergeSelector)
PUBLIC: A method can be registered to be called on a object that has just been merge from a unit of work. This uses the optional event argument of the orignial object which is the object being merged from, the source object is the object being merged into. This event can be used to correctly initialize an object's non-persistent attributes.

        getEventSelectors().setElementAt(postMergeSelector, PostMergeEvent);
    
public voidsetPostRefreshSelector(java.lang.String postRefreshSelector)
PUBLIC: A method can be registered to be called on a object that has just been refreshed from the database. This uses the optional event argument of the DatabaseRow. This event can be used to correctly initialize an object's non-persistent attributes or to perform complex optimizations or mappings. This event is only called on refreshes of existing objects.

        getEventSelectors().setElementAt(postRefreshSelector, PostRefreshEvent);
    
public voidsetPostUpdateSelector(java.lang.String postUpdateSelector)
PUBLIC: A method can be registered to be called on a object that has just been updated into the database.

        getEventSelectors().setElementAt(postUpdateSelector, PostUpdateEvent);
    
public voidsetPostWriteSelector(java.lang.String postWriteSelector)
PUBLIC: A method can be registered to be called on a object that has just been written to the database. This event is raised on any registered object in a unit of work, even if it has not changed, refer to the "aboutToUpdate" selector if it is required for the event to be raised only when the object has been changed. This will be called on all inserts and updates, after the "postInsert/Update" event has been raised. This event can be used to notify any dependent on the object.

        getEventSelectors().setElementAt(postWriteSelector, PostWriteEvent);
    
public voidsetPreDeleteSelector(java.lang.String preDeleteSelector)
PUBLIC: A method can be registered to be called on a object that is going to be deleted from the database. This event can notify/remove any dependents on the object.

        getEventSelectors().setElementAt(preDeleteSelector, PreDeleteEvent);
    
public voidsetPreInsertSelector(java.lang.String preInsertSelector)
PUBLIC: A method can be registered to be called on a object that is going to be inserted into the database. This event can be used to notify any dependent on the object or acquire the object's id through a custom mechanism.

        getEventSelectors().setElementAt(preInsertSelector, PreInsertEvent);
    
public voidsetPrePersistSelector(java.lang.String prePersistSelector)
PUBLIC: A method can be registered to be called on a object when that object has the create operation applied to it.

        getEventSelectors().setElementAt(prePersistSelector, PrePersistEvent);
    
public voidsetPreRemoveSelector(java.lang.String preRemoveSelector)
PUBLIC: A method can be registered to be called on a object when that object has the remove operation applied to it.

        getEventSelectors().setElementAt(preRemoveSelector, PreRemoveEvent);
    
public voidsetPreUpdateSelector(java.lang.String preUpdateSelector)
PUBLIC: A method can be registered to be called on a object that is going to be updated into the database. This event is raised on any registered object in a unit of work, even if it has not changed, refer to the "aboutToUpdate" selector if it is required for the event to be raised only when the object has been changed. This event can be used to notify any dependent on the object.

        getEventSelectors().setElementAt(preUpdateSelector, PreUpdateEvent);
    
public voidsetPreWriteSelector(java.lang.String preWriteSelector)
PUBLIC: A method can be registered to be called on a object that is going to be written to the database. This event is raised on any registered object in a unit of work, even if it has not changed, refer to the "aboutToUpdate" selector if it is required for the event to be raised only when the object has been changed. This will be called on all inserts and updates, before the "preInsert/Update" event has been raised. This event can be used to notify any dependent on the object.

        getEventSelectors().setElementAt(preWriteSelector, PreWriteEvent);