com.apelon.dts.client.events
Class DataChangeEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.apelon.dts.client.events.DataChangeEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ConceptEvent, KBTypeEvent, NamespaceEvent, TermEvent

public class DataChangeEvent
extends EventObject

Defines basic data change event.

Since:
DTS 3.4
Version:
DTS 3.4
Author:
Apelon Inc.
See Also:
Serialized Form

Field Summary
static int EVENT_TYPE_DELETE
          EVENT Type Delete Event ID = 1001
static int EVENT_TYPE_FIRST
          Starts the ID sequence at 1000 for Data Change events.
static int EVENT_TYPE_LAST
          Reflects the current end of the ID sequence at EVENT_TYPE_FIRST + 2 for Data change events.
static int EVENT_TYPE_MODIFY
          EVENT Type Modify Event ID = 1002
static int EVENT_TYPE_NEW
          New EVENT Type Event ID = 1000
static int INVALID_TYPE_EVENT
          Value of -1 to flag an unitialized or invalid setting for eventType
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DataChangeEvent(Object source, Object data, int eventType)
          Constructs a DataChangeEvent object.
DataChangeEvent(Object source, Object oldData, Object newData)
          Constructs a DataChangeEvent object.
 
Method Summary
protected  Object getChangedData()
          Get the data which has changed.
 int getEventType()
          Get Event Type.
protected  Object getNewData()
          Get the New Data.
protected  Object getOldData()
          Get the Old Data.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EVENT_TYPE_FIRST

public static final int EVENT_TYPE_FIRST
Starts the ID sequence at 1000 for Data Change events.

See Also:
EVENT_TYPE_NEW, EVENT_TYPE_MODIFY, EVENT_TYPE_DELETE, EVENT_TYPE_LAST, Constant Field Values

EVENT_TYPE_LAST

public static final int EVENT_TYPE_LAST
Reflects the current end of the ID sequence at EVENT_TYPE_FIRST + 2 for Data change events.

See Also:
EVENT_TYPE_NEW, EVENT_TYPE_MODIFY, EVENT_TYPE_DELETE, EVENT_TYPE_FIRST, Constant Field Values

EVENT_TYPE_NEW

public static final int EVENT_TYPE_NEW
New EVENT Type Event ID = 1000

See Also:
EVENT_TYPE_DELETE, EVENT_TYPE_MODIFY, Constant Field Values

EVENT_TYPE_DELETE

public static final int EVENT_TYPE_DELETE
EVENT Type Delete Event ID = 1001

See Also:
EVENT_TYPE_NEW, EVENT_TYPE_MODIFY, Constant Field Values

EVENT_TYPE_MODIFY

public static final int EVENT_TYPE_MODIFY
EVENT Type Modify Event ID = 1002

See Also:
EVENT_TYPE_NEW, EVENT_TYPE_DELETE, Constant Field Values

INVALID_TYPE_EVENT

public static final int INVALID_TYPE_EVENT
Value of -1 to flag an unitialized or invalid setting for eventType

See Also:
EVENT_TYPE_NEW, EVENT_TYPE_DELETE, EVENT_TYPE_MODIFY, Constant Field Values
Constructor Detail

DataChangeEvent

public DataChangeEvent(Object source,
                       Object oldData,
                       Object newData)
Constructs a DataChangeEvent object. Initializes the event type based on the value passed.

Parameters:
source - Should be an object that is a valid source of Data Change events.
oldData - For adding a new data, the oldData should null; For updating a data, the oldData should be the data before being updated; For deleting a data, the oldData should be the data that is deleted.
newData - For adding a new data, the newData should be the data that is added; For updating a data, the newData should be the data after being updated; For deleting a data, the newData should be null.

DataChangeEvent

public DataChangeEvent(Object source,
                       Object data,
                       int eventType)
Constructs a DataChangeEvent object. Initializes the changedData as the data which has changed.

Parameters:
source - Should be an object that is a valid source of Data Change events.
data - The data which has changed. In the case of modifiy, this should be the data after change.
eventType - If adding a new data, the eventType should be EVENT_TYPE_NEW If modifying a data, the eventType should be EVENT_TYPE_MODIFY If deleting a data, the eventType should be EVENT_TYPE_DELETE
Method Detail

getEventType

public int getEventType()
Get Event Type. The Event Type can be EVENT_TYPE_NEW, EVENT_TYPE_MODIFY, or EVENT_TYPE_DELETE.

Returns:
int If the data is added, return EVENT_TYPE_NEW; If the data is updated, return EVENT_TYPE_MODIFY; If the data is deleted, return EVENT_TYPE_DELETE.

getNewData

protected Object getNewData()
Get the New Data.

Returns:
Object If a data is added, return the new data that is added; If a data is updated, return the new data after updating; If a data is deleted, return null.

getOldData

protected Object getOldData()
Get the Old Data.

Returns:
Object If a data is added, return null; If a data is updated, return the old data before updating; If a data is deleted, return the data that is deleted.

getChangedData

protected Object getChangedData()
Get the data which has changed.

Returns:
Object If a data is added, return the data that is added; If a data is updated, return the data after updating; If a data is deleted, return the data is deleted.


Copyright © 2011. All Rights Reserved.