Class MapEntry

java.lang.Object
com.isode.dsapi.util.MapEntry
All Implemented Interfaces:
ISeqEntry, Iterable<Attribute>

public class MapEntry extends Object implements ISeqEntry
MapEntry is a JNI-free representation of an entry designed for fast random access to attributes, designed for extensively modifying an entry in place.
Author:
jp
  • Field Details

  • Constructor Details

    • MapEntry

      public MapEntry(SeqEntry entry)
      Constructor from SeqEntry
    • MapEntry

      public MapEntry(DN dn)
      Constructor from a DN
    • MapEntry

      public MapEntry(Entry entry)
      Constructor from Entry
    • MapEntry

      public MapEntry(AddEntry entry)
      Constructor from AddEntry
  • Method Details

    • iterator

      public Iterator<Attribute> iterator()
      Iterator
      Specified by:
      iterator in interface ISeqEntry
      Specified by:
      iterator in interface Iterable<Attribute>
      Returns:
      Iterator
    • isEmpty

      public boolean isEmpty()
      Is the entry empty (no attributes)?
      Specified by:
      isEmpty in interface ISeqEntry
    • getAttributes

      public Collection<Attribute> getAttributes()
      Get the Collection of Attributes contained in the map.
      Returns:
      Collection
    • getAttribute

      public Attribute getAttribute(AttributeType at)
      Get a particular attribute by attribute-type.
      Parameters:
      at - AttributeType
      Returns:
      Attribute found, or null if not found
    • toSeqEntry

      public SeqEntry toSeqEntry()
      Convert to a SeqEntry
      Returns:
      SeqEntry
    • toAddEntry

      public AddEntry toAddEntry()
      Convert to an AddEntry
      Specified by:
      toAddEntry in interface ISeqEntry
      Returns:
      AddEntry
    • toEntry

      public Entry toEntry()
      Convert to an Entry
      Specified by:
      toEntry in interface ISeqEntry
      Returns:
      Entry
    • getMapEntry

      public MapEntry getMapEntry()
      Get the MapEntry.
      Specified by:
      getMapEntry in interface ISeqEntry
      Returns:
      MapEntry
    • getDN

      public DN getDN()
      Get the DN
      Specified by:
      getDN in interface ISeqEntry
      Returns:
      DN
    • setDN

      public void setDN(DN dn)
      Set the DN
      Specified by:
      setDN in interface ISeqEntry
    • getOrigDN

      public DN getOrigDN()
      Get the original DN
      Specified by:
      getOrigDN in interface ISeqEntry
      Returns:
      DN
    • setOrigDN

      public void setOrigDN(DN dn)
      Set the original DN. This is normally a bad idea, as the original DN must usually be maintained to refer back to the original source of the entry correctly.
      Specified by:
      setOrigDN in interface ISeqEntry
    • hasDNChanged

      public boolean hasDNChanged()
      Check whether the DN has changed.
      Specified by:
      hasDNChanged in interface ISeqEntry
    • add

      public void add(Attribute attr)
      Add a new attribute, for compatibility with ISeqEntry. Does the same as replace().
      Specified by:
      add in interface ISeqEntry
      Parameters:
      attr - Attribute to add
    • replace

      public void replace(Attribute attr)
      Add a new attribute, or replace an existing attribute; if there are no values in the attribute, then any existing attribute is deleted and nothing is put in its place.
      Parameters:
      attr - Attribute to add or replace
    • delete

      public void delete(AttributeType at)
      Delete an attribute by type; no error if it is not there.
    • deleteAll

      public void deleteAll()
      Delete all attributes. This makes this a blank entry, which will return 'null' when converted to a SeqEntry.
    • add

      public boolean add(AttributeType at, AttributeValue av) throws BadSyntaxException
      Add a value to an attribute, creating the Attribute if necessary, and eliminating duplicate values (if they are exactly the same).
      Parameters:
      at -
      av -
      Returns:
      'true' if the value was added, 'false' if this was a duplicate
      Throws:
      BadSyntaxException - if the syntax of av is not valid for this attribute.
    • remove

      public boolean remove(AttributeType at, AttributeValue av) throws BadSyntaxException
      Remove a value from an attribute. This means recreating the Attribute each time, so it may be faster to use replace() if many deletions have to be done.
      Returns:
      'true' if the value was found and removed, 'false' if it was not found.
      Throws:
      BadSyntaxException
    • toString

      public String toString()
      Overrides:
      toString in class Object