oracle.ldap.util
Class LDIFRecord

java.lang.Object
  |
  +--oracle.ldap.util.LDIFRecord
All Implemented Interfaces:
java.lang.Cloneable

public class LDIFRecord
extends java.lang.Object
implements java.lang.Cloneable

LDIFRecord represents a single entry in an LDIF file, consisting of a distinguished name (DN) and zero or more attributes.


Constructor Summary
LDIFRecord()
          Constructs a LDIFRecord object without dn and attribute values set.
LDIFRecord(java.lang.String dn)
          Constructs a record with the specified dn.
 
Method Summary
 void addAttribute(LDIFAttribute atr)
          Adds an attribute to this record.
 java.lang.Object clone()
          to create a replica of this object.
 boolean contains(java.lang.String attrName)
          Returns true if the ldifrecord contains the specified attribute.
 java.util.Enumeration getAll()
          Returns an Enumeration of the attributes in this record.
 LDIFAttribute getAttribute(int index)
          Returns the LDIFAttribute object at the specified index in a record
 LDIFAttribute getAttribute(java.lang.String attrName)
          Returns the LDIFAttribute object of the specified attribute name.
 int getChangeType()
          Retrieves the change type of this record.
 boolean getDeleteOldRdn()
          Returns true if deleteOldRdn is set.
 java.lang.String getDN()
          Returns the distinguished name of the current record.
 java.util.Enumeration getIDs()
          Retrieves an enumeration of the ids of the attributes in this record as String objects.
 javax.naming.directory.Attributes getJNDIAttributes()
          Use this method to Obtain all the attriubtes of an LDIFRecord represented as javax.naming.directory.Attributes object.
 javax.naming.directory.ModificationItem[] getJNDIModificationItems()
          Use this method to Obtain all the attriubtes of an LDIFRecord represented as an array of javax.naming.directory.ModificationItem objects.
 java.lang.String getNewRdn()
          Returns the newRdn if the record change type is moddn
 java.lang.String getNewSuperior()
          Returns the newSuperior if the record change type is moddn
 void setDN(java.lang.String dn)
          Set the Dn of this record.
 int size()
          Returns the number of attributes in this record.
 java.lang.String toString()
          A string representation of this object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDIFRecord

public LDIFRecord()
Constructs a LDIFRecord object without dn and attribute values set.

LDIFRecord

public LDIFRecord(java.lang.String dn)
Constructs a record with the specified dn.
Parameters:
dn - the distinguished name of the new entry
Method Detail

getNewRdn

public java.lang.String getNewRdn()
Returns the newRdn if the record change type is moddn
Returns:
the new RDN of the LDIFRecord. If the change type of the record is not moddn/modrdn then null is returned.

getNewSuperior

public java.lang.String getNewSuperior()
Returns the newSuperior if the record change type is moddn
Returns:
the new superior of the LDIFRecord. If the change type of the record is not moddn/modrdn then null is returned.

getDeleteOldRdn

public boolean getDeleteOldRdn()
Returns true if deleteOldRdn is set. Otherwise false is returned in all other cases.
Returns:
true if deleteOldRdn is true.

addAttribute

public void addAttribute(LDIFAttribute atr)
Adds an attribute to this record. If the attribute already exists and its change type is same as the specified attribute then only the value of the specified attribute will be added to that attribute which which is existing in the record. However if the record contains two attributes which are same but with different change type then the comparison will be done with the attribute that was added most recently.
Parameters:
atr - The LDIFAttribute object which is to be added.

getDN

public java.lang.String getDN()
Returns the distinguished name of the current record.
Returns:
distinguished name of the current record.

setDN

public void setDN(java.lang.String dn)
Set the Dn of this record.
Parameters:
dn - the distinguished name that will be set in the current record.

getAttribute

public LDIFAttribute getAttribute(java.lang.String attrName)
Returns the LDIFAttribute object of the specified attribute name.
Parameters:
attrName - Name of the attribute.

getAttribute

public LDIFAttribute getAttribute(int index)
Returns the LDIFAttribute object at the specified index in a record
Parameters:
index - - an index into this ldifrecord
Returns:
LDIFAttribute at the specified index
Throws:
ArrayIndexOutOfBoundsException - if an invalid index was given.

contains

public boolean contains(java.lang.String attrName)
Returns true if the ldifrecord contains the specified attribute.
Parameters:
attrName - the attribute Name
Returns:
boolean true if the record contains specified attribute, false otherwise

getAll

public java.util.Enumeration getAll()
Returns an Enumeration of the attributes in this record.
Returns:
an enumeration containing all the LDIFAttribute objects.

getIDs

public java.util.Enumeration getIDs()
Retrieves an enumeration of the ids of the attributes in this record as String objects.
Returns:
A non-null enumeration of the attributes' ids in this record set. If attribute set has zero attributes, an empty enumeration is returned.

getChangeType

public int getChangeType()
Retrieves the change type of this record. Change type constants are defined in LDIF class.

size

public int size()
Returns the number of attributes in this record. Count does not include the dn.
Returns:
number of attributes in this record.

clone

public java.lang.Object clone()
to create a replica of this object.
Returns:
a replica of this object.

getJNDIAttributes

public javax.naming.directory.Attributes getJNDIAttributes()
Use this method to Obtain all the attriubtes of an LDIFRecord represented as javax.naming.directory.Attributes object.
Returns:
javax.naming.directory.Attributes object representing all the attributes in this record. Returns null if this record does not contain any attribute.

getJNDIModificationItems

public javax.naming.directory.ModificationItem[] getJNDIModificationItems()
Use this method to Obtain all the attriubtes of an LDIFRecord represented as an array of javax.naming.directory.ModificationItem objects.
Returns:
javax.naming.directory.Attributes object representing all the attributes in this record. Returns null if this record does not contain any attribute.

toString

public java.lang.String toString()
A string representation of this object
Overrides:
toString in class java.lang.Object