Package com.isode.dsapi
Class Selection
- java.lang.Object
-
- com.isode.dsapi.Selection
-
- All Implemented Interfaces:
java.lang.Iterable<AttributeType>
public class Selection extends java.lang.Object implements java.lang.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
selectAttributeType(AttributeType)
, followed by a call either toselectAllOperational()
orselectAllUser()
.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).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Selection.SelectionType
Convenience enums to be used when creating a Selection object.
-
Constructor Summary
Constructors Constructor Description Selection()
Construct a new Selection object which will specifyALL_USER_ATTRIBUTES
.Selection(Selection.SelectionType type)
Construct a new Selection object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isEmpty()
Determine whether this represents an empty selection.boolean
isSelectingAllOper()
Determine whether this Selection specifies "all operational attributes"boolean
isSelectingAllUser()
Determine whether this Selection specifies "all user attributes"java.util.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.void
selectAllOperational()
Set the flag which specifies all operational attributes.void
selectAllUser()
Set the flag which specifies all user attributes.void
selectAllUserAndOper()
Select all user and operational attributes.void
selectAttributeType(AttributeType attrType)
Add an attribute to the Selection.void
selectNoAttributes()
Set the object to specify no attributes at all (this clears any settings for all user attributes or all operational attributes).java.lang.String
toString()
Returns String representation of this Selection, useful for debugging.
-
-
-
Constructor Detail
-
Selection
public Selection(Selection.SelectionType type)
Construct a new Selection object.- Parameters:
type
- one of the valuesNO_ATTRIBUTES
,ALL_USER_ATTRIBUTES
,ALL_OPER_ATTRIBUTES
,ALL_USER_AND_OPER_ATTRIBUTES
- Throws:
java.lang.IllegalArgumentException
- if type is not one of the values listed above.
-
Selection
public Selection()
Construct a new Selection object which will specifyALL_USER_ATTRIBUTES
.
-
-
Method Detail
-
selectAttributeType
public void selectAttributeType(AttributeType attrType) throws java.lang.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:
java.lang.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 java.lang.String toString()
Returns String representation of this Selection, useful for debugging.- Overrides:
toString
in classjava.lang.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 java.util.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 interfacejava.lang.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.
-
-