Class Selection

java.lang.Object
com.isode.dsapi.Selection
All Implemented Interfaces:
Iterable<AttributeType>

public class Selection extends Object implements Iterable<AttributeType>
Representation of an attribute selection (used in directory searches and reads). A selection may specify:
  • no attributes at all
  • a set of "named" attribute types
  • a flag to indicate all user attributes
  • a flag to indicate all operational attributes
It is permitted to specify a set of "named" attribute types as well as either all operational attributes or all user attributes. To do this, use a series of calls to selectAttributeType(AttributeType), followed by a call either to selectAllOperational() or selectAllUser().

The class will not allow the creation of Selection objects that contain a set of "named" attribute types and "all user attributes" and "all operational attributes". Such a selection is specifically disallowed by X.511-205 (7.6).

  • Constructor Details

  • Method Details

    • selectAttributeType

      public void selectAttributeType(AttributeType attrType) throws NullPointerException
      Add an attribute to the Selection. If the selected attribute was already in the selection, then this method does not change the Selection.

      If the Selection currently specifies all operational attributes or all user attributes, those flags will be cleared.

      Parameters:
      attrType - an AttributeType
      Throws:
      NullPointerException - if attrType is null.
    • selectAllUser

      public void selectAllUser()
      Set the flag which specifies all user attributes. This operation clears the "all operational attributes" flag.
    • selectAllOperational

      public void selectAllOperational()
      Set the flag which specifies all operational attributes. This operation clears the "all user attributes" flag.
    • selectAllUserAndOper

      public void selectAllUserAndOper()
      Select all user and operational attributes. If the Selection contains any named attributes, they will be removed from the selection.
    • selectNoAttributes

      public void selectNoAttributes()
      Set the object to specify no attributes at all (this clears any settings for all user attributes or all operational attributes).
    • toString

      public String toString()
      Returns String representation of this Selection, useful for debugging.
      Overrides:
      toString in class Object
      Returns:
      a String representation of the Selection
    • isEmpty

      public boolean isEmpty()
      Determine whether this represents an empty selection. An empty selection does not specify "all operational attributes" or "all user attributes" or any named attributes.
      Returns:
      true if this is an empty selection.
    • iterator

      public Iterator<AttributeType> iterator()
      For a Selection which names a set of attribute types, return an iterator over the AttributeTypes held by this Selection, or otherwise return an iterator over an empty list.
      Specified by:
      iterator in interface Iterable<AttributeType>
      Returns:
      an iterator which returns all the AttributeTypes in this Selection
    • isSelectingAllUser

      public boolean isSelectingAllUser()
      Determine whether this Selection specifies "all user attributes"
      Returns:
      true if "all user attributes" are specified, false otherwise.
    • isSelectingAllOper

      public boolean isSelectingAllOper()
      Determine whether this Selection specifies "all operational attributes"
      Returns:
      true if "all operational attributes" are specified, false otherwise.