com.unboundid.directory.sdk.sync.types
Class DatabaseChangeRecord

java.lang.Object
  extended by com.unboundid.directory.sdk.sync.types.DatabaseChangeRecord

@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class DatabaseChangeRecord
extends java.lang.Object

This class represents the basis for a single database change record. A ScriptedJDBCSyncSource implementation should create instances of this class based on changes detected in the database (either from a changelog table or some other change tracking mechanism). The resync process will also use instances of this class to identify database entries, which can then be fetched.


Nested Class Summary
static class DatabaseChangeRecord.Builder
          This class is used to construct DatabaseChangeRecord instances.
static class DatabaseChangeRecord.ChangeType
          Potential types of database changes.
 
Method Summary
 java.lang.String[] getChangedColumns()
          Get the set of changed columns for this change entry.
 long getChangeNumber()
          Get the change number that identifies this particular change.
 long getChangeTime()
          Get the time at which the change occurred.
 DatabaseChangeRecord.ChangeType getChangeType()
          Get the change type (insert/update/delete/resync).
 CompletionStatus getCompletionStatus()
          Gets the completion status for this change.
 java.lang.String getEntryType()
          Get the database entry type that this change corresponds to (for example "account" or "subscriber").
 DN getIdentifiableInfo()
          Get the DN that identifies the row that changed (for example "account_id=123").
 java.lang.String getModifier()
          Get the database user that made the change.
 java.lang.Object getProperty(java.lang.Object key)
          Get the property value (if one exists) for the given key.
 java.lang.String getTableName()
          Get the database table on which the change occurred.
 void setCompletionStatus(CompletionStatus status)
          This method is used by the Sync Pipe to indicate if the completion status of a synchronization operation.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getChangeNumber

public long getChangeNumber()
Get the change number that identifies this particular change. If a change number is not used by the database for change detection, this method will return a monotonically increasing sequence number for this change record, so that you can still identify the order in which changes were detected.

Returns:
the changeNumber

getChangeType

public DatabaseChangeRecord.ChangeType getChangeType()
Get the change type (insert/update/delete/resync).

Returns:
the changeType

getTableName

public java.lang.String getTableName()
Get the database table on which the change occurred.

Returns:
the table name

getIdentifiableInfo

public DN getIdentifiableInfo()
Get the DN that identifies the row that changed (for example "account_id=123"). If multiple attributes are part of the identifier, they will be represented as different RDN components of the DN in the order they were originally specified (for example "account_id=123,group_id=5").

Returns:
an identifier string

getEntryType

public java.lang.String getEntryType()
Get the database entry type that this change corresponds to (for example "account" or "subscriber").

Returns:
the type of database entry

getChangedColumns

public java.lang.String[] getChangedColumns()
Get the set of changed columns for this change entry.

Returns:
an array of column names that were modified as part of the change

getModifier

public java.lang.String getModifier()
Get the database user that made the change.

Returns:
the database user account

getChangeTime

public long getChangeTime()
Get the time at which the change occurred. This is based on the clock on the database server.

Returns:
the change time (in milliseconds since epoch)

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Get the property value (if one exists) for the given key.

Parameters:
key - the property key whose value to return
Returns:
the property value

setCompletionStatus

@InternalUseOnly
public void setCompletionStatus(CompletionStatus status)
This method is used by the Sync Pipe to indicate if the completion status of a synchronization operation. This is for internal use only and should not be called by clients.

Parameters:
status - the completion status for this DatabaseChangeRecord

getCompletionStatus

public CompletionStatus getCompletionStatus()
Gets the completion status for this change. This will be null if the change has not finished processing yet.

Returns:
the CompletionStatus indicating whether this change completed successfully or else a reason why it failed

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object