Class ChangeRecord.Builder
- java.lang.Object
-
- com.unboundid.directory.sdk.sync.types.ChangeRecord.Builder
-
- Enclosing class:
- ChangeRecord
public static class ChangeRecord.Builder extends java.lang.Object
This class is used to construct ChangeRecord instances. At least aChangeType
and an identifiableInfoDN
are required; the rest of the parameters are optional. Arbitrary properties can also be added to the object by callingaddProperty(Object, Object)
. The setter methods return the Builder instance itself, so that these calls can be chained. When finished setting up parameters, call thebuild()
method to create a newChangeRecord
.
-
-
Constructor Summary
Constructors Constructor Description Builder(ChangeType type, DN identifiableInfo)
Creates a Builder which can be used to construct a ChangeRecord.Builder(ChangeType type, java.lang.String identifiableInfo)
Creates a Builder which can be used to construct a ChangeRecord.Builder(ChangeType type, java.lang.String identifiableInfo, java.lang.String delimiter)
Creates a Builder which can be used to construct a ChangeRecord.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChangeRecord.Builder
addProperty(java.lang.Object key, java.lang.Object value)
Add an arbitrary attachment or property to the ChangeRecord being built.ChangeRecord
build()
Construct the ChangeRecord.ChangeRecord.Builder
changedAttributes(java.lang.String[] changedAttributes)
Set the set of changed attributes for this change entry.ChangeRecord.Builder
changeNumber(long changeNumber)
Set the change number that identifies this particular change (if applicable).ChangeRecord.Builder
changeTime(long changeTime)
Set the time at which the change occurred.ChangeRecord.Builder
fullEntry(Entry entry)
Set the full source entry on this ChangeRecord.ChangeRecord.Builder
identifiableInfoAfterChange(DN identifiableInfoAfterChange)
Set the DN of the entry after the change.ChangeRecord.Builder
modifier(java.lang.String modifier)
Set the user account name that made the change.
-
-
-
Constructor Detail
-
Builder
public Builder(ChangeType type, DN identifiableInfo)
Creates a Builder which can be used to construct a ChangeRecord.- Parameters:
type
- the ChangeType (ADD/MODIFY/MOD-DN/DELETE). This can benull
to indicate a resync operation.identifiableInfo
- a unique identifier for the entry that changed (i.e. "accountID=123"). If multiple attributes are part of the identifier, they should be separate RDN components of the DN (i.e. "accountID=123,groupID=5").
-
Builder
public Builder(ChangeType type, java.lang.String identifiableInfo)
Creates a Builder which can be used to construct a ChangeRecord.- Parameters:
type
- the ChangeType (ADD/MODIFY/MOD-DN/DELETE). This can benull
to indicate a resync operation.identifiableInfo
- a unique identifier for the entry that changed (i.e. "accountID=123"). If multiple attributes are part of the identifier, they should be delimited with the default delimiter of "%%" (i.e. "accountID=123%%groupID=5").
-
Builder
public Builder(ChangeType type, java.lang.String identifiableInfo, java.lang.String delimiter)
Creates a Builder which can be used to construct a ChangeRecord.- Parameters:
type
- the ChangeType (ADD/MODIFY/MOD-DN/DELETE). This can benull
to indicate a resync operation.identifiableInfo
- a unique identifier for the row that changed (i.e. "accountID=123"). If multiple attributes are part of the identifier, they should be delimited with a unique string (i.e. "accountID=123%%groupID=5") which is specified by the delimiter parameter.delimiter
- The delimiter used to split separate components of the identifiable info. If this is null, the default of "%%" will be used.
-
-
Method Detail
-
changeNumber
public ChangeRecord.Builder changeNumber(long changeNumber)
Set the change number that identifies this particular change (if applicable). If this is not used, a change number will be automatically generated for the ChangeRecord.- Parameters:
changeNumber
- the change number- Returns:
- the Builder instance
-
identifiableInfoAfterChange
public ChangeRecord.Builder identifiableInfoAfterChange(DN identifiableInfoAfterChange)
Set the DN of the entry after the change. This should only be used if the change type was a Modify DN.- Parameters:
identifiableInfoAfterChange
- The final DN of the entry after the change.- Returns:
- the Builder instance.
- Throws:
java.lang.IllegalArgumentException
- if the change type is not Modify DN.
-
changedAttributes
public ChangeRecord.Builder changedAttributes(java.lang.String[] changedAttributes)
Set the set of changed attributes for this change entry.- Parameters:
changedAttributes
- an array of attribute names that were modified as part of the change- Returns:
- the Builder instance
-
modifier
public ChangeRecord.Builder modifier(java.lang.String modifier)
Set the user account name that made the change.- Parameters:
modifier
- the account name or user name of the entity that made the change- Returns:
- the Builder instance
-
changeTime
public ChangeRecord.Builder changeTime(long changeTime)
Set the time at which the change occurred. This should be based on the clock at the source endpoint if possible.- Parameters:
changeTime
- the time of the change (in milliseconds since January 1, 1970 00:00:00.000 GMT)- Returns:
- the Builder instance
-
fullEntry
public ChangeRecord.Builder fullEntry(Entry entry)
Set the full source entry on this ChangeRecord. This may be desirable if the source does not provide logical separation between the "change record" and the entry itself. If this is set on the ChangeRecord, the Data Sync Server will skip the call tofetchEntry()
in your extension and instead use thisEntry
.When using this mechanism, make sure to set it to a non-null Entry even on a DELETE, because this will be used to correlate to the destination entry to delete.
- Parameters:
entry
- the full source entry that was changed- Returns:
- the Builder instance
-
addProperty
public ChangeRecord.Builder addProperty(java.lang.Object key, java.lang.Object value)
Add an arbitrary attachment or property to the ChangeRecord being built. Nor the key or the value are allowed to benull
.- Parameters:
key
- the key for the propertyvalue
- the value of the property- Returns:
- the Builder instance
-
build
public ChangeRecord build()
Construct the ChangeRecord. This method may only be called once.- Returns:
- a ChangeRecord instance
-
-