Package com.ibm.di.entry
Class DeltaEntry
- java.lang.Object
-
- com.ibm.di.entry.DeltaEntry
-
public class DeltaEntry extends java.lang.Object
This class implements static methods to perform Delta operations on Entries and Attributes.
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMPARE_ATTRIBUTE_KEY
static int
COMPARE_ATTRIBUTE_NAMES
static int
COMPARE_ATTRIBUTE_VALUES
-
Constructor Summary
Constructors Constructor Description DeltaEntry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
applyAttributeDelta(Attribute target, Attribute delta)
This method applies the change operations indelta
to thetarget
attribute.static void
applyDelta(Entry target, Entry delta)
Forwards the call to applyDelta(target, delta, false).static void
applyDelta(Entry target, Entry delta, boolean removeUnchanged)
This method applies the delta operations specified in delta to the target entry.static Entry
compareEntries(Entry source, Entry target, boolean unchanged, int level, java.lang.String key)
This method returns an Entry that contains the delta changes needed to make target equal to source.static Entry
compareEntries(Entry source, Entry target, boolean unchanged, int level, java.lang.String key, java.util.List<java.lang.String> attributeList, boolean isInvertedIgnore)
This method returns an Entry that contains delta changes for specific attributes.static Entry
getDeltaEntry(Entry source, Entry target)
This method is a convenience method that callscompareEntries(source, target, false, null);
-
-
-
Field Detail
-
COMPARE_ATTRIBUTE_KEY
public static final int COMPARE_ATTRIBUTE_KEY
- See Also:
- Constant Field Values
-
COMPARE_ATTRIBUTE_NAMES
public static final int COMPARE_ATTRIBUTE_NAMES
- See Also:
- Constant Field Values
-
COMPARE_ATTRIBUTE_VALUES
public static final int COMPARE_ATTRIBUTE_VALUES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDeltaEntry
public static Entry getDeltaEntry(Entry source, Entry target) throws java.lang.Exception
This method is a convenience method that callscompareEntries(source, target, false, null);
- Parameters:
source
- The source entrytarget
- The target entry- Returns:
- Entry with delta information
- Throws:
java.lang.Exception
-
compareEntries
public static Entry compareEntries(Entry source, Entry target, boolean unchanged, int level, java.lang.String key) throws java.lang.Exception
This method returns an Entry that contains the delta changes needed to make target equal to source. If the unchanged parameter is true, then unchanged attributes and values are returned as part of the resulting entry. The level parameter determines how deep the comparison goes.Level 1 Comparison
A level 1 comparison requires the key parameter and sets the result Entry's operation code to OP_ADD, OP_DEL, OP_MOD or OP_UNCHANGED. The result Entry will contain no Attributes.Level 2 Comparison
A level 2 comparison (includes level 1 if key parameter is specified) compares attribute names in the two entries. Each attribute in the result entry has its operation code set to ATTRIBUTE_ADD or ATTRIBUTE_DELETE. If the unchanged parameter is true, then all unchanged attributes are returned as well with the operation code set to ATTRIBUTE_UNCHANGED. The Attributes in the result Entry will contain no values.Level 3 Comparison
Level 3 comparison implicitly includes level 2 and compares values for those attribute whose operation code is ATTRIBUTE_UNCHANGED (e.g. named attribute exists in both entries). In this case, the result Entry will have Attributes with values. Each value in the resulting attribute has its operation code set to AV_ADD, AV_UNCHANGED or AV_DELETE. If there are changes in the value sets of the two entries, the resulting attribute's operation code is changed to ATTRIBUTE_MOD. If the Attribute name is "$dn", logic will be applied to compare the values as LDAP Distinguished Names.After comparing two entries at level 3, you can apply the returned delta entry to make target equal to source by calling the applyDelta ( target, delta ) method.
If no changes are detected an empty Entry is returned.
- Parameters:
source
- The source entrytarget
- The target entryunchanged
- If true, returned entry contains unmodified attributes and values as welllevel
- The number of levels to compare: 1 entry (requires key), 2 attribute names, 3 attribute valueskey
- The name of the key attribute. This parameter must be specified if level == 1.- Returns:
- Entry with delta information
- Throws:
java.lang.Exception
-
compareEntries
public static Entry compareEntries(Entry source, Entry target, boolean unchanged, int level, java.lang.String key, java.util.List<java.lang.String> attributeList, boolean isInvertedIgnore) throws java.lang.Exception
This method returns an Entry that contains delta changes for specific attributes.- Parameters:
source
- The source entrytarget
- The target entryunchanged
- Iftrue
, returned entry contains unmodified Attributes and valueslevel
- The number of levels to compare: 1 entry (requires key), 2 attribute names, 3 attribute valueskey
- The name of the key attribute. This parameter must be specified if level == 1.attributeList
- List of attributes whose changes will be either detected or ignoredisInvertedIgnore
- Iftrue
changes only in attributes listed inattributeList
parameter will be detected; else changes in these attributes will be ignored.- Returns:
- Entry with delta information
- Throws:
java.lang.Exception
- Since:
- TDI 7.1
- See Also:
compareEntries(Entry, Entry, boolean, int, String)
-
applyDelta
public static void applyDelta(Entry target, Entry delta) throws java.lang.Exception
Forwards the call to applyDelta(target, delta, false).- Throws:
java.lang.Exception
-
applyDelta
public static void applyDelta(Entry target, Entry delta, boolean removeUnchanged) throws java.lang.Exception
This method applies the delta operations specified in delta to the target entry. After completing the operation, the target is modified to reflect the delta operations. Attributes from the delta are referenced and not cloned so subsequent changes to the delta entry may affect the target entry as well.Only attributes and values with explicit change operations are processed. Attributes with the ATTRIBUTE_UNCHANGED flag and values with either AV_UNDEFINED or AV_UNCHANGED are not processed.
- Parameters:
target
- The entry to which changes are applieddelta
- The entry that contains the changes to applyremoveUnchanged
- If true, the unmodified attributes are removed from the target entry leaving only modified attributes- Throws:
java.lang.Exception
-
applyAttributeDelta
public static void applyAttributeDelta(Attribute target, Attribute delta)
This method applies the change operations indelta
to thetarget
attribute. Value operations with either AV_UNDEFINED or AV_UNCHANGED are ignored.- Parameters:
target
- The attribute to modifydelta
- The attribute containing value operations
-
-