org.openadaptor.adaptor.ldap
Class LDAPEntryModification

java.lang.Object
  extended by org.openadaptor.adaptor.ldap.LDAPEntryModification

public class LDAPEntryModification
extends java.lang.Object

Contains all the details for a modification to an entry in the LDAP server. Constants ADD, MODIFY and DELETE represent the possible types of modification to an entry. Modifications to the actual attribute use the JNDI ModificationItem class, and the DirContext constants.


Field Summary
static int ADD_ENTRY
          defines modification actions (add, modify, delete)
static int DELETE_ENTRY
           
static int MODIFY_ENTRY
           
 
Constructor Summary
LDAPEntryModification(java.lang.String dn, int modOp)
          Create a new modification.
LDAPEntryModification(java.lang.String dn, int modOp, java.lang.String description, java.lang.Integer changeNumber, java.lang.String changeTime)
          Create a new modification.
 
Method Summary
 void addModification(javax.naming.directory.ModificationItem mod)
          Adds the modification item to this entry modification.
 void addModification(java.lang.String attribName, int modOp, java.lang.Object value)
          Add a new modification to this entry mod.
 void addModifications(javax.naming.directory.ModificationItem[] mods)
          Adds the modification items to this entry modification.
 java.lang.Integer getChangeNumber()
          Get the change number.
 java.lang.String getChangeTime()
          Get the change time.
 java.lang.String getDescription()
          Get the current description.
 java.lang.String getDN()
          Get the current dn.
 javax.naming.directory.ModificationItem[] getModifications()
          Get an array of the attribute modifications.
 int getModOp()
          Get the current modOp.
 boolean isValidModOp(int modOp)
          Check to see if the given integer is a valid value for the modOp field.
 void setChangeNumber(java.lang.Integer changeNumber)
          Set the change number.
 void setChangeTime(java.lang.String changeTime)
          Set the change time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_ENTRY

public static final int ADD_ENTRY
defines modification actions (add, modify, delete)

See Also:
Constant Field Values

MODIFY_ENTRY

public static final int MODIFY_ENTRY
See Also:
Constant Field Values

DELETE_ENTRY

public static final int DELETE_ENTRY
See Also:
Constant Field Values
Constructor Detail

LDAPEntryModification

public LDAPEntryModification(java.lang.String dn,
                             int modOp)
Create a new modification. See 5-arg constructor for details.

Parameters:
dn - The dn of the entry which will be modified. Cannot be null.
modOp - The type of modification to make to the entry. This should be one of constant modification types defined. Cannot be null.

LDAPEntryModification

public LDAPEntryModification(java.lang.String dn,
                             int modOp,
                             java.lang.String description,
                             java.lang.Integer changeNumber,
                             java.lang.String changeTime)
Create a new modification. Throws RunTimeExceptions if the parameters are abused.

Parameters:
dn - The dn of the entry which will be modified. Cannot be null.
modOp - The type of modification to make to the entry. This should be one of constant modification types defined. Cannot be null.
description - A text description of the change. Can be null.
changeNumber - Useful if the change came from the change log. Can be null.
changeTime - Useful if the change came from the change log. Can be null.
Throws:
java.lang.NullPointerException - If either dn or modOp are null.
java.lang.IllegalArgumentException - If the modOp is not one of the constants defined in the class.
Method Detail

isValidModOp

public boolean isValidModOp(int modOp)
Check to see if the given integer is a valid value for the modOp field. True if it equals one of the constants defined, false otherwise.

Parameters:
modOp - The value to test.
Returns:
True if the modOp is valid, false otherwise.

getDN

public java.lang.String getDN()
Get the current dn.

Returns:
The dn. Never null.

getModOp

public int getModOp()
Get the current modOp.

Returns:
The modOp.

getDescription

public java.lang.String getDescription()
Get the current description.

Returns:
The description.

getChangeNumber

public java.lang.Integer getChangeNumber()
Get the change number.

Returns:
The change number.

setChangeNumber

public void setChangeNumber(java.lang.Integer changeNumber)
Set the change number.

Parameters:
changeNumber - The new change number.

getChangeTime

public java.lang.String getChangeTime()
Get the change time.

Returns:
The change time.

setChangeTime

public void setChangeTime(java.lang.String changeTime)
Set the change time.

Parameters:
changeTime - The new change time.

addModification

public void addModification(java.lang.String attribName,
                            int modOp,
                            java.lang.Object value)
Add a new modification to this entry mod.

Parameters:
attribName - The name of the attribute to be modified.
modOp - The modification operation to perform on this attribute. this should be one of the values defined in the DirContext class.
value - This is the value to add. If it is an array, then it is recursed and all contained values are added. If value is null then no value is stored, any nulls in an array are also ignored.

addModification

public void addModification(javax.naming.directory.ModificationItem mod)
Adds the modification item to this entry modification.

Parameters:
mod - The modification item to be added. If null, the method does nothing.

addModifications

public void addModifications(javax.naming.directory.ModificationItem[] mods)
Adds the modification items to this entry modification.

Parameters:
mods - The modification item to be added. Any null values are ignored.

getModifications

public javax.naming.directory.ModificationItem[] getModifications()
Get an array of the attribute modifications.

Returns:
The attribute modifications. Never null. Can be empty.