org.apache.directory.shared.ldap.ldif
Class LdifEntry

java.lang.Object
  extended by org.apache.directory.shared.ldap.ldif.LdifEntry
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

public class LdifEntry
extends java.lang.Object
implements java.lang.Cloneable, java.io.Externalizable

A entry to be populated by an ldif parser. We will have different kind of entries : - added entries - deleted entries - modified entries - RDN modified entries - DN modified entries

Version:
$Rev$, $Date$
Author:
Apache Directory Project
See Also:
Serialized Form

Field Summary
static Modification[] EMPTY_MODS
          Used in toArray()
 
Constructor Summary
LdifEntry()
          Creates a new Entry object.
 
Method Summary
 void addAttribute(EntryAttribute attr)
          Add an attribute to the entry
 void addAttribute(java.lang.String id, java.lang.Object value)
          Add an attribute to the entry
 void addModificationItem(Modification modification)
          Add a modification item (used by modify operations)
 void addModificationItem(ModificationOperation modOp, EntryAttribute attr)
          Add a modification item (used by modify operations)
 void addModificationItem(ModificationOperation modOp, java.lang.String id, java.lang.Object value)
          Add a modification item
 LdifEntry clone()
          Clone method
 boolean equals(java.lang.Object o)
           
 EntryAttribute get(java.lang.String attributeId)
          Returns a attribute given it's id
 ChangeType getChangeType()
          Get the change type
 javax.naming.ldap.Control getControl()
           
 LdapDN getDn()
           
 Entry getEntry()
          Get the entry's entry
 java.util.List<Modification> getModificationItems()
           
 Modification[] getModificationItemsArray()
          Gets the modification items as an array.
 java.lang.String getNewRdn()
           
 java.lang.String getNewSuperior()
           
 int hashCode()
           
 boolean isChangeAdd()
           
 boolean isChangeDelete()
           
 boolean isChangeModDn()
           
 boolean isChangeModify()
           
 boolean isChangeModRdn()
           
 boolean isDeleteOldRdn()
           
 boolean isEntry()
          Tells if the current entry is a added one
 void putAttribute(java.lang.String id, java.lang.Object value)
          Add an attribute value to an existing attribute
 void readExternal(java.io.ObjectInput in)
           
 void setChangeType(ChangeType changeType)
          Set the modification type
 void setChangeType(java.lang.String changeType)
          Set the change type
 void setControl(javax.naming.ldap.Control control)
          Add a control to the entry
 void setDeleteOldRdn(boolean deleteOldRdn)
          Set the flage deleteOldRdn
 void setDn(LdapDN dn)
          Set the Distinguished Name
 void setDn(java.lang.String dn)
          Set the Distinguished Name
 void setNewRdn(java.lang.String newRdn)
          Set the new RDN
 void setNewSuperior(java.lang.String newSuperior)
          Set the new superior
 int size()
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_MODS

public static final Modification[] EMPTY_MODS
Used in toArray()

Constructor Detail

LdifEntry

public LdifEntry()
Creates a new Entry object.

Method Detail

setDn

public void setDn(LdapDN dn)
Set the Distinguished Name

Parameters:
dn - The Distinguished Name

setDn

public void setDn(java.lang.String dn)
           throws javax.naming.InvalidNameException
Set the Distinguished Name

Parameters:
dn - The Distinguished Name
Throws:
javax.naming.InvalidNameException

setChangeType

public void setChangeType(ChangeType changeType)
Set the modification type

Parameters:
changeType - The change type

setChangeType

public void setChangeType(java.lang.String changeType)
Set the change type

Parameters:
changeType - The change type

addModificationItem

public void addModificationItem(Modification modification)
Add a modification item (used by modify operations)

Parameters:
modification - The modification to be added

addModificationItem

public void addModificationItem(ModificationOperation modOp,
                                EntryAttribute attr)
Add a modification item (used by modify operations)

Parameters:
modOp - The operation. One of : - ModificationOperation.ADD_ATTRIBUTE - ModificationOperation.REMOVE_ATTRIBUTE - ModificationOperation.REPLACE_ATTRIBUTE
attr - The attribute to be added

addModificationItem

public void addModificationItem(ModificationOperation modOp,
                                java.lang.String id,
                                java.lang.Object value)
Add a modification item

Parameters:
modOp - The operation. One of : - ModificationOperation.ADD_ATTRIBUTE - ModificationOperation.REMOVE_ATTRIBUTE - ModificationOperation.REPLACE_ATTRIBUTE
modOp - The modification operation value
id - The attribute's ID
value - The attribute's value

addAttribute

public void addAttribute(EntryAttribute attr)
                  throws javax.naming.NamingException
Add an attribute to the entry

Parameters:
attr - The attribute to be added
Throws:
javax.naming.NamingException

addAttribute

public void addAttribute(java.lang.String id,
                         java.lang.Object value)
                  throws javax.naming.NamingException
Add an attribute to the entry

Parameters:
id - The attribute ID
value - The attribute value
Throws:
javax.naming.NamingException

putAttribute

public void putAttribute(java.lang.String id,
                         java.lang.Object value)
                  throws javax.naming.NamingException
Add an attribute value to an existing attribute

Parameters:
id - The attribute ID
value - The attribute value
Throws:
javax.naming.NamingException

getChangeType

public ChangeType getChangeType()
Get the change type

Returns:
The change type. One of : ADD = 0; MODIFY = 1; MODDN = 2; MODRDN = 3; DELETE = 4;

getModificationItems

public java.util.List<Modification> getModificationItems()
Returns:
The list of modification items

getModificationItemsArray

public Modification[] getModificationItemsArray()
Gets the modification items as an array.

Returns:
modification items as an array.

getDn

public LdapDN getDn()
Returns:
The entry Distinguished name

size

public int size()
Returns:
The number of entry modifications

get

public EntryAttribute get(java.lang.String attributeId)
Returns a attribute given it's id

Parameters:
attributeId - The attribute Id
Returns:
The attribute if it exists

getEntry

public Entry getEntry()
Get the entry's entry

Returns:
the stored Entry

isDeleteOldRdn

public boolean isDeleteOldRdn()
Returns:
True, if the old RDN should be deleted.

setDeleteOldRdn

public void setDeleteOldRdn(boolean deleteOldRdn)
Set the flage deleteOldRdn

Parameters:
deleteOldRdn - True if the old RDN should be deleted

getNewRdn

public java.lang.String getNewRdn()
Returns:
The new RDN

setNewRdn

public void setNewRdn(java.lang.String newRdn)
Set the new RDN

Parameters:
newRdn - The new RDN

getNewSuperior

public java.lang.String getNewSuperior()
Returns:
The new superior

setNewSuperior

public void setNewSuperior(java.lang.String newSuperior)
Set the new superior

Parameters:
newSuperior - The new Superior

isChangeAdd

public boolean isChangeAdd()
Returns:
True if the entry is an ADD entry

isChangeDelete

public boolean isChangeDelete()
Returns:
True if the entry is a DELETE entry

isChangeModDn

public boolean isChangeModDn()
Returns:
True if the entry is a MODDN entry

isChangeModRdn

public boolean isChangeModRdn()
Returns:
True if the entry is a MODRDN entry

isChangeModify

public boolean isChangeModify()
Returns:
True if the entry is a MODIFY entry

isEntry

public boolean isEntry()
Tells if the current entry is a added one

Returns:
true if the entry is added

getControl

public javax.naming.ldap.Control getControl()
Returns:
The associated control, if any

setControl

public void setControl(javax.naming.ldap.Control control)
Add a control to the entry

Parameters:
control - The control

clone

public LdifEntry clone()
                throws java.lang.CloneNotSupportedException
Clone method

Overrides:
clone in class java.lang.Object
Returns:
a clone of the current instance
Throws:
java.lang.CloneNotSupportedException - If there is some problem while cloning the instance

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representing the Entry

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the instance's hash code
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
Returns:
true if both values are equal
See Also:
Object.equals(Object)

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - The stream from which the LdifEntry is read
Throws:
java.io.IOException - If the stream can't be read
java.lang.ClassNotFoundException - If the LdifEntry can't be created
See Also:
Externalizable.readExternal(ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - The stream in which the ChangeLogEvent will be serialized.
Throws:
java.io.IOException - If the serialization fail
See Also:
Externalizable#readExternal(ObjectInput)



Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.