public class DescriptorEvent
extends java.util.EventObject
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 paticular operation is being performed on. The second is by registering an event listener to be notified when any event occurs for that descriptor. The second method is more similar to the java beans event model and requires the registered listener to implement the DescriptorEventListener interface.
Modifier and Type | Field and Description |
---|---|
protected ObjectChangeSet |
changeSet
For the post merge event it is possible that there has been a change set generated.
|
protected ClassDescriptor |
descriptor |
protected int |
eventCode
The code of the descriptor event being raised.
|
protected static java.lang.String[] |
eventNames
Event names for toString()
|
protected java.lang.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.
|
protected DatabaseQuery |
query
The query causing the event.
|
protected Record |
record
Optionally a database row may be provided on some events, (such as aboutToUpdate).
|
protected AbstractSession |
session
The session in which the event is raised.
|
Constructor and Description |
---|
DescriptorEvent(int eventCode,
ObjectLevelModifyQuery query)
PUBLIC:
Most events are trigger from queries, so this is a helper method.
|
DescriptorEvent(java.lang.Object sourceObject)
PUBLIC:
All events require a source object.
|
Modifier and Type | Method and Description |
---|---|
void |
applyAttributeValuesIntoRow(java.lang.String attributeName)
PUBLIC:
Re-populate the database row with the values from the source object based upon the
attribute's mapping.
|
ObjectChangeSet |
getChangeSet()
PUBLIC:
Returns the Object changeSet if available
|
ClassDescriptor |
getClassDescriptor()
PUBLIC:
The source descriptor of the event.
|
ClassDescriptor |
getDescriptor()
PUBLIC:
The source descriptor of the event.
|
int |
getEventCode()
PUBLIC:
The code of the descriptor event being raised.
|
java.lang.Object |
getObject()
PUBLIC:
Synanym for source.
|
java.lang.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.
|
DatabaseQuery |
getQuery()
PUBLIC:
The query causing the event.
|
Record |
getRecord()
PUBLIC:
Return the record that is associated with some events,
such as postBuild, and aboutToUpdate.
|
AbstractSession |
getSession()
PUBLIC:
The session in which the event is raised.
|
void |
setChangeSet(ObjectChangeSet newChangeSet)
INTERNAL:
Sets the Change set in the event if the change Set is available
|
void |
setDescriptor(ClassDescriptor descriptor)
INTERNAL:
The source descriptor of the event.
|
void |
setEventCode(int eventCode)
INTERNAL:
The code of the descriptor event being raised.
|
void |
setOriginalObject(java.lang.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 |
setQuery(DatabaseQuery query)
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(AbstractSession session)
INTERNAL:
The session in which the event is raised.
|
java.lang.String |
toString()
INTERNAL:
|
void |
updateAttributeAddObjectToCollection(java.lang.String attributeName,
java.lang.Object mapKey,
java.lang.Object value)
ADVANCED:
Use this method when updating object attribute values, with unmapped objects Integer, String or others.
|
void |
updateAttributeRemoveObjectFromCollection(java.lang.String attributeName,
java.lang.Object mapKey,
java.lang.Object value)
ADVANCED:
Use this method when updating object attribute values, with unmapped objects Integer, String or others.
|
void |
updateAttributeWithObject(java.lang.String attributeName,
java.lang.Object value)
ADVANCED:
Use this method when updating object attribute values, with unmapped objects Integer, String or others.
|
protected int eventCode
protected DatabaseQuery query
protected Record record
protected ClassDescriptor descriptor
protected java.lang.Object originalObject
protected ObjectChangeSet changeSet
protected AbstractSession session
protected static java.lang.String[] eventNames
public DescriptorEvent(int eventCode, ObjectLevelModifyQuery query)
public DescriptorEvent(java.lang.Object sourceObject)
public void applyAttributeValuesIntoRow(java.lang.String attributeName)
public ObjectChangeSet getChangeSet()
public ClassDescriptor getDescriptor()
public ClassDescriptor getClassDescriptor()
public int getEventCode()
public java.lang.Object getObject()
public java.lang.Object getOriginalObject()
EventObject.getSource()
public DatabaseQuery getQuery()
public Record getRecord()
public AbstractSession getSession()
public void setChangeSet(ObjectChangeSet newChangeSet)
public void setDescriptor(ClassDescriptor descriptor)
public void setEventCode(int eventCode)
public void setOriginalObject(java.lang.Object originalObject)
public void setQuery(DatabaseQuery query)
public void setRecord(Record record)
public void setSession(AbstractSession session)
public java.lang.String toString()
toString
in class java.util.EventObject
public void updateAttributeWithObject(java.lang.String attributeName, java.lang.Object value)
public void updateAttributeAddObjectToCollection(java.lang.String attributeName, java.lang.Object mapKey, java.lang.Object value)
public void updateAttributeRemoveObjectFromCollection(java.lang.String attributeName, java.lang.Object mapKey, java.lang.Object value)