Class DescriptorEvent

java.lang.Object
java.util.EventObject
org.eclipse.persistence.descriptors.DescriptorEvent
All Implemented Interfaces:
Serializable, CoreDescriptorEvent

public class DescriptorEvent extends EventObject implements CoreDescriptorEvent

Purpose: Encapsulate the information provided with descriptor events. This is used as the argument to any event raised by the descriptor. Events can be registered for through two methods, the first is by providing a method to be called on the object that a particular operation is being performed on. The second is by registering a manager object to be notified when any event occurs for that descriptor. The second method is more similar to the java beans event model but requires the registered object to implement the DescriptorEventListener interface.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.eclipse.persistence.internal.sessions.ObjectChangeSet
    For the post merge event it is possible that there has been a change set generated.
    protected ClassDescriptor
     
    protected int
    The code of the descriptor event being raised.
    protected static String[]
    Event names for toString()
    protected Object
    The source object represents the object the event is being raised on, some events also require a second object, for example the original object in a postClone.
    protected DatabaseQuery
    The query causing the event.
    protected Record
    Optionally a database row may be provided on some events, (such as aboutToUpdate).
    protected org.eclipse.persistence.internal.sessions.AbstractSession
    The session in which the event is raised.

    Fields inherited from class java.util.EventObject

    source
  • Constructor Summary

    Constructors
    Constructor
    Description
    DescriptorEvent(int eventCode, ObjectLevelModifyQuery query)
    PUBLIC: Most events are trigger from queries, so this is a helper method.
    DescriptorEvent(Object sourceObject)
    PUBLIC: All events require a source object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    PUBLIC: Re-populate the database row with the values from the source object based upon the attribute's mapping.
    org.eclipse.persistence.internal.sessions.ObjectChangeSet
    PUBLIC: Returns the Object changeSet if available
    PUBLIC: The source descriptor of the event.
    PUBLIC: The source descriptor of the event.
    int
    PUBLIC: The code of the descriptor event being raised.
    PUBLIC: Synanym for source.
    PUBLIC: The source object represents the object the event is being raised on, some events also require a second object, for example the original object in a postClone.
    PUBLIC: The query causing the event.
    PUBLIC: Return the record that is associated with some events, such as postBuild, and aboutToUpdate.
    org.eclipse.persistence.internal.sessions.AbstractSession
    PUBLIC: The session in which the event is raised.
    void
    setChangeSet(org.eclipse.persistence.internal.sessions.ObjectChangeSet newChangeSet)
    INTERNAL: Sets the Change set in the event if the change Set is available
    void
    INTERNAL: The source descriptor of the event.
    void
    setEventCode(int eventCode)
    INTERNAL: The code of the descriptor event being raised.
    void
    setOriginalObject(Object originalObject)
    INTERNAL: The source object represents the object the event is being raised on, some events also require a second object, for example the original object in a postClone.
    void
    INTERNAL: The query causing the event.
    void
    setRecord(Record record)
    INTERNAL: Optionally a database row may be provided on some events, (such as aboutToUpdate).
    void
    setSession(org.eclipse.persistence.internal.sessions.AbstractSession session)
    INTERNAL: The session in which the event is raised.
    INTERNAL:
    void
    updateAttributeAddObjectToCollection(String attributeName, Object mapKey, Object value)
    ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others.
    void
    ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others.
    void
    updateAttributeWithObject(String attributeName, Object value)
    ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others.

    Methods inherited from class java.util.EventObject

    getSource

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • eventCode

      protected int eventCode
      The code of the descriptor event being raised. This is an integer constant value from DescriptorEventManager.
    • query

      protected DatabaseQuery query
      The query causing the event.
    • record

      protected Record record
      Optionally a database row may be provided on some events, (such as aboutToUpdate).
    • descriptor

      protected ClassDescriptor descriptor
    • originalObject

      protected Object originalObject
      The source object represents the object the event is being raised on, some events also require a second object, for example the original object in a postClone.
    • changeSet

      protected org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet
      For the post merge event it is possible that there has been a change set generated. This attribute will store the changeSet for the object just merged
    • session

      protected org.eclipse.persistence.internal.sessions.AbstractSession session
      The session in which the event is raised.
    • eventNames

      protected static String[] eventNames
      Event names for toString()
  • Constructor Details

    • DescriptorEvent

      public DescriptorEvent(int eventCode, ObjectLevelModifyQuery query)
      PUBLIC: Most events are trigger from queries, so this is a helper method.
    • DescriptorEvent

      public DescriptorEvent(Object sourceObject)
      PUBLIC: All events require a source object.
  • Method Details

    • applyAttributeValuesIntoRow

      public void applyAttributeValuesIntoRow(String attributeName)
      PUBLIC: Re-populate the database row with the values from the source object based upon the attribute's mapping. Provided as a helper method for modifying the row during event handling.
    • getChangeSet

      public org.eclipse.persistence.internal.sessions.ObjectChangeSet getChangeSet()
      PUBLIC: Returns the Object changeSet if available
    • getDescriptor

      public ClassDescriptor getDescriptor()
      PUBLIC: The source descriptor of the event.
    • getClassDescriptor

      public ClassDescriptor getClassDescriptor()
      PUBLIC: The source descriptor of the event.
    • getEventCode

      public int getEventCode()
      PUBLIC: The code of the descriptor event being raised. This is an integer constant value from DescriptorEventManager.
    • getObject

      public Object getObject()
      PUBLIC: Synanym for source.
    • getOriginalObject

      public Object getOriginalObject()
      PUBLIC: The source object represents the object the event is being raised on, some events also require a second object, for example the original object in a postClone.
      See Also:
    • getQuery

      public DatabaseQuery getQuery()
      PUBLIC: The query causing the event.
    • getRecord

      public Record getRecord()
      PUBLIC: Return the record that is associated with some events, such as postBuild, and aboutToUpdate.
    • getSession

      public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
      PUBLIC: The session in which the event is raised.
    • setChangeSet

      public void setChangeSet(org.eclipse.persistence.internal.sessions.ObjectChangeSet newChangeSet)
      INTERNAL: Sets the Change set in the event if the change Set is available
    • setDescriptor

      public void setDescriptor(ClassDescriptor descriptor)
      INTERNAL: The source descriptor of the event.
    • setEventCode

      public void setEventCode(int eventCode)
      INTERNAL: The code of the descriptor event being raised. This is an integer constant value from DescriptorEventManager.
    • setOriginalObject

      public void setOriginalObject(Object originalObject)
      INTERNAL: The source object represents the object the event is being raised on, some events also require a second object, for example the original object in a postClone.
    • setQuery

      public void setQuery(DatabaseQuery query)
      INTERNAL: The query causing the event.
    • setRecord

      public void setRecord(Record record)
      INTERNAL: Optionally a database row may be provided on some events, (such as aboutToUpdate).
    • setSession

      public void setSession(org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: The session in which the event is raised.
    • toString

      public String toString()
      INTERNAL:
      Overrides:
      toString in class EventObject
    • updateAttributeWithObject

      public void updateAttributeWithObject(String attributeName, Object value)
      ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others. in events to ensure that all required objects are updated. EclipseLink will automatically update all objects and changesets involved. EclipseLink will update the field, in the row, to have the new value for the field that this mapping maps to.
    • updateAttributeAddObjectToCollection

      public void updateAttributeAddObjectToCollection(String attributeName, Object mapKey, Object value)
      ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others. in events to ensure that all required objects are updated. EclipseLink will automatically update all objects and changesets involved. EclipseLink will update the field, in the row, to have the new value for the field that this mapping maps to. If the attribute being updated is within an aggregate then pass the updated aggregate and the attribute of the aggregate mapping into this method.
    • updateAttributeRemoveObjectFromCollection

      public void updateAttributeRemoveObjectFromCollection(String attributeName, Object mapKey, Object value)
      ADVANCED: Use this method when updating object attribute values, with unmapped objects Integer, String or others. in events to ensure that all required objects are updated. EclipseLink will automatically update all objects and changesets involved. EclipseLink will update the field, in the row, to have the new value for the field that this mapping maps to.