Package com.isode.dsapi
Class AddEntry
- java.lang.Object
-
- com.isode.dsapi.GenericEntry
-
- com.isode.dsapi.ChangeEntry
-
- com.isode.dsapi.AddEntry
-
- All Implemented Interfaces:
java.lang.Comparable<GenericEntry>
,java.lang.Iterable<Attribute>
public class AddEntry extends ChangeEntry
An AddEntry is used to store the contents of an entry to add to the directory. It can be generated empty and then filled, or may be loaded from an 'Add' LDIF change-record. Once constructed, it may be applied to a directory, or saved to an LDIF file. Note that only the addAttribute() call is supported, as only add-attributes may be contained within an AddEntry. It cannot include attribute replace or delete operations -- use a ModifyEntry for that.- Author:
- jp
-
-
Field Summary
-
Fields inherited from class com.isode.dsapi.GenericEntry
attributeList, DS_Entry, logger
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(Attribute attr)
Add attribute-values to the AddEntry.java.util.Iterator<Attribute>
getChangeIterator()
Returns an Iterator over the change-attributes associated with this AddEntry.boolean
hasChanges()
Determine whether this entry contains any change-attributes (as would be returned by a call to getChangeIterator()).java.lang.String
toString()
Returns a String representation of this Entry.-
Methods inherited from class com.isode.dsapi.ChangeEntry
append, deleteAttribute, diff, jni_diff, replaceAttribute
-
Methods inherited from class com.isode.dsapi.GenericEntry
compareTo, finalize, getAttributeIterator, getDN, iterator, setDN, sortArrayByDN, toLDIF
-
-
-
-
Constructor Detail
-
AddEntry
public AddEntry(DN dn)
Create a new blank AddEntry using the specified DN- Parameters:
dn
- the distinguished name (must not be null)- Throws:
java.lang.NullPointerException
- if dn is nullNativeLibraryException
- if an unrecoverable error was detected by the native library
-
AddEntry
public AddEntry(Entry entry)
Create an AddEntry from an Entry.Note that any Attributes inside entry which contain no values are treated as if they were not present at all (i.e. they will not appear in the constructed object).
- Parameters:
entry
- the entry from which this object should be created.- Throws:
java.lang.NullPointerException
- if entry is nullNativeLibraryException
- if an unrecoverable error was detected by the native library
-
-
Method Detail
-
getChangeIterator
public java.util.Iterator<Attribute> getChangeIterator()
Returns an Iterator over the change-attributes associated with this AddEntry. The Iterator will contain only AddAttribute instances, since only AddAttribute instances can be stored in an AddEntry.- Overrides:
getChangeIterator
in classGenericEntry
- Returns:
- Iterator
-
hasChanges
public boolean hasChanges()
Determine whether this entry contains any change-attributes (as would be returned by a call to getChangeIterator()).- Overrides:
hasChanges
in classGenericEntry
- Returns:
- true if this AddEntry has modifications associated with it, false otherwise.
-
addAttribute
public void addAttribute(Attribute attr) throws BadValueException, java.lang.NullPointerException, NativeLibraryException
Add attribute-values to the AddEntry. A copy is made of the Attribute as an AddAttribute.- Overrides:
addAttribute
in classChangeEntry
- Parameters:
attr
- Attribute containing values to be added. Must not be null.- Throws:
BadValueException
- if attr contains no values.java.lang.NullPointerException
- if attr is null.NativeLibraryException
- if an unrecoverable error was detected by the native library- See Also:
DirectorySession.add(AddEntry, CommonArgs)
,DirectorySession.apply(ChangeEntry, CommonArgs)
-
toString
public java.lang.String toString()
Returns a String representation of this Entry. The String contains the Entry's DN and a count of the number of attributes that the Entry contains.- Overrides:
toString
in classChangeEntry
- Returns:
- a String representation of the Entry.
-
-