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.Serializable, java.lang.Cloneable

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

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 ModificationItemImpl[] EMPTY_MODS
          Used in toArray()
 
Constructor Summary
LdifEntry()
          Creates a new Entry object.
 
Method Summary
 void addAttribute(javax.naming.directory.Attribute 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(int modOp, javax.naming.directory.Attribute attr)
          Add a modification item (used by modify operations)
 void addModificationItem(int modOp, java.lang.String id, java.lang.Object value)
          Add a modification item
 void addModificationItem(ModificationItemImpl modification)
          Add a modification item (used by modify operations)
 LdifEntry clone()
          Clone method
 boolean equals(java.lang.Object o)
           
 javax.naming.directory.Attribute get(java.lang.String attributeId)
          Returns a attribute given it's id
 javax.naming.directory.Attributes getAttributes()
          Get the entry's attributes
 ChangeType getChangeType()
          Get the change type
 javax.naming.ldap.Control getControl()
           
 java.lang.String getDn()
           
 java.util.List<ModificationItemImpl> getModificationItems()
           
 ModificationItemImpl[] 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 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(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()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_MODS

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

Constructor Detail

LdifEntry

public LdifEntry()
Creates a new Entry object.

Method Detail

setDn

public void setDn(java.lang.String dn)
Set the Distinguished Name

Parameters:
dn - The Distinguished Name

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(ModificationItemImpl modification)
Add a modification item (used by modify operations)

Parameters:
modification - The modification to be added

addModificationItem

public void addModificationItem(int modOp,
                                javax.naming.directory.Attribute attr)
Add a modification item (used by modify operations)

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

addModificationItem

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

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

addAttribute

public void addAttribute(javax.naming.directory.Attribute attr)
Add an attribute to the entry

Parameters:
attr - The attribute to be added

addAttribute

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

Parameters:
id - The attribute ID
value - The attribute value

putAttribute

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

Parameters:
id - The attribute ID
value - The attribute value

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<ModificationItemImpl> getModificationItems()
Returns:
The list of modification items

getModificationItemsArray

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

Returns:
modification items as an array.

getDn

public java.lang.String getDn()
Returns:
The entry Distinguished name

size

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

get

public javax.naming.directory.Attribute get(java.lang.String attributeId)
Returns a attribute given it's id

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

getAttributes

public javax.naming.directory.Attributes getAttributes()
Get the entry's attributes

Returns:
An Attributes

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)


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.