Package com.isode.dsapi
Class Selection
java.lang.Object
com.isode.dsapi.Selection
- All Implemented Interfaces:
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 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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumConvenience enums to be used when creating a Selection object. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new Selection object which will specifyALL_USER_ATTRIBUTES.Construct a new Selection object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisEmpty()Determine whether this represents an empty selection.booleanDetermine whether this Selection specifies "all operational attributes"booleanDetermine whether this Selection specifies "all user attributes"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.voidSet the flag which specifies all operational attributes.voidSet the flag which specifies all user attributes.voidSelect all user and operational attributes.voidselectAttributeType(AttributeType attrType) Add an attribute to the Selection.voidSet the object to specify no attributes at all (this clears any settings for all user attributes or all operational attributes).toString()Returns String representation of this Selection, useful for debugging.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Selection
Construct a new Selection object.- Parameters:
type- one of the valuesNO_ATTRIBUTES,ALL_USER_ATTRIBUTES,ALL_OPER_ATTRIBUTES,ALL_USER_AND_OPER_ATTRIBUTES- Throws:
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 Details
-
selectAttributeType
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
Returns String representation of this Selection, useful for debugging. -
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
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:
iteratorin interfaceIterable<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.
-