Package org.forgerock.opendj.ldap
Class AttributeFilter
java.lang.Object
org.forgerock.opendj.ldap.AttributeFilter
A configurable factory for filtering the attributes exposed by an entry. An
AttributeFilter is useful for performing fine-grained access control,
selecting attributes based on search request criteria, and selecting
attributes based on post- and pre- read request control criteria.
In cases where methods accept a string based list of attribute descriptions, the following special attribute descriptions are permitted:
- * - include all user attributes
- + - include all operational attributes
- 1.1 - exclude all attributes
- @objectclass - include all attributes identified by the named object class.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new attribute filter which will include all user attributes but no operational attributes.AttributeFilter(String... attributeDescriptions) Creates a new attribute filter which will include the attributes identified by the provided search request attribute list.AttributeFilter(Collection<String> attributeDescriptions) Creates a new attribute filter which will include the attributes identified by the provided search request attribute list.AttributeFilter(Collection<String> attributeDescriptions, Schema schema) Creates a new attribute filter which will include the attributes identified by the provided search request attribute list. -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeFilterCreates a new attribute filter which will include all user and operational attributes.filterAttributes(Predicate<Attribute> filter) Registers a predicate which should be applied to attributes selected by this attribute filter.filteredCopyOf(Entry entry) Returns a modifiable filtered copy of the provided entry.filteredCopyOf(SearchResultEntry entry) Returns a modifiable filtered copy of the provided search result entry.filteredViewOf(Entry entry) Returns an unmodifiable filtered view of the provided entry.filteredViewOf(SearchResultEntry entry) Returns an unmodifiable filtered view of the provided search result entry.includeAllOperationalAttributes(boolean include) Specifies whether all operational attributes should be included in filtered entries.includeAllUserAttributes(boolean include) Specifies whether all user attributes should be included in filtered entries.includeAttribute(String attributeDescription) Specifies that the named attribute should be included in filtered entries.includeAttribute(String attributeDescription, Schema schema) Specifies that the named attribute should be included in filtered entries.includeAttribute(String attributeDescription, Schema schema, boolean includeAttributesFromSuperiors) Specifies that the named attribute should be included in filtered entries.includeAttribute(AttributeDescription attributeDescription) Specifies that the named attribute should be included in filtered entries.mapAttributes(Function<Attribute, Attribute> mapper) Registers a mapping function which should be applied to attributes selected by this attribute filter.booleanReturnstrueif this attribute filter matches all attributes, regardless of whether they are user or operational attributes.booleanReturnstrueif this attribute filter matches all operational attributes.booleanReturnstrueif this attribute filter matches all user attributes.booleanReturnstrueif this attribute filter may match some attributes, orfalseif it will never match any attributes.booleanmatchesAttribute(AttributeDescription attributeDescription) Returnstrueif this attribute filter matches the provided attribute description.toString()typesOnly(boolean typesOnly) Specifies whether filtered attributes are to contain both attribute descriptions and values, or just attribute descriptions.
-
Constructor Details
-
AttributeFilter
public AttributeFilter()Creates a new attribute filter which will include all user attributes but no operational attributes. -
AttributeFilter
Creates a new attribute filter which will include the attributes identified by the provided search request attribute list. Attributes will be decoded using the default schema. See the class description for details regarding the types of supported attribute description.- Parameters:
attributeDescriptions- The names of the attributes to be included with each entry.
-
AttributeFilter
Creates a new attribute filter which will include the attributes identified by the provided search request attribute list. Attributes will be decoded using the provided schema. See the class description for details regarding the types of supported attribute description.- Parameters:
attributeDescriptions- The names of the attributes to be included with each entry.schema- The schema The schema to use when parsing attribute descriptions and object class names.
-
AttributeFilter
Creates a new attribute filter which will include the attributes identified by the provided search request attribute list. Attributes will be decoded using the default schema. See the class description for details regarding the types of supported attribute description.- Parameters:
attributeDescriptions- The names of the attributes to be included with each entry.
-
-
Method Details
-
allUserAndOperationalAttributesFilter
Creates a new attribute filter which will include all user and operational attributes.- Returns:
- A new attribute filter which includes all user and operational attributes.
-
filteredCopyOf
Returns a modifiable filtered copy of the provided entry.- Parameters:
entry- The entry to be filtered and copied.- Returns:
- The modifiable filtered copy of the provided entry.
-
filteredCopyOf
Returns a modifiable filtered copy of the provided search result entry.- Parameters:
entry- The search result entry to be filtered and copied.- Returns:
- The modifiable filtered copy of the provided search result entry.
-
filteredViewOf
Returns an unmodifiable filtered view of the provided entry. The returned entry supports all operations except those which modify its contents.- Parameters:
entry- The entry to be filtered.- Returns:
- The unmodifiable filtered view of the provided entry.
-
filteredViewOf
Returns an unmodifiable filtered view of the provided search result entry. The returned search result entry supports all operations except those which modify its contents.- Parameters:
entry- The search result entry to be filtered.- Returns:
- The unmodifiable filtered view of the provided search result entry.
-
includeAllOperationalAttributes
Specifies whether all operational attributes should be included in filtered entries. By default operational attributes are not included.- Parameters:
include-trueif operational attributes should be included in filtered entries.- Returns:
- A reference to this attribute filter.
-
includeAllUserAttributes
Specifies whether all user attributes should be included in filtered entries. By default user attributes are included.- Parameters:
include-trueif user attributes should be included in filtered entries.- Returns:
- A reference to this attribute filter.
-
includeAttribute
Specifies that the named attribute should be included in filtered entries.- Parameters:
attributeDescription- The name of the attribute to be included in filtered entries.- Returns:
- A reference to this attribute filter.
-
includeAttribute
Specifies that the named attribute should be included in filtered entries. The attribute will be decoded using the default schema. See the class description for details regarding the types of supported attribute description.- Parameters:
attributeDescription- The name of the attribute to be included in filtered entries.- Returns:
- A reference to this attribute filter.
-
includeAttribute
Specifies that the named attribute should be included in filtered entries. The attribute will be decoded using the provided schema. See the class description for details regarding the types of supported attribute description.- Parameters:
attributeDescription- The name of the attribute to be included in filtered entries.schema- The schema The schema to use when parsing attribute descriptions and object class names.- Returns:
- A reference to this attribute filter.
-
includeAttribute
public AttributeFilter includeAttribute(String attributeDescription, Schema schema, boolean includeAttributesFromSuperiors) Specifies that the named attribute should be included in filtered entries. The attribute will be decoded using the provided schema. See the class description for details regarding the types of supported attribute description.- Parameters:
attributeDescription- The name of the attribute to be included in filtered entries.schema- The schema The schema to use when parsing attribute descriptions and object class names.includeAttributesFromSuperiors-trueif attribute expansion from object classes using the '@OC' syntax should also include attributes from superior classes in the list of requested attributes;falseotherwise.- Returns:
- A reference to this attribute filter.
-
mapAttributes
Registers a mapping function which should be applied to attributes selected by this attribute filter. Mapping functions andfilterpredicates will be applied in registration order and may returnnullindicating that the attribute should not be included in the filtered entry (at which point no further mappings will be applied). Mapping functions must not mutate the passed in attributes and should instead return a new attribute representing the transformed attribute.- Parameters:
mapper- The mapping function responsible for transforming selected attributes. The function may returnnullif the attribute should not be included in the filtered entry.- Returns:
- A reference to this attribute filter.
- See Also:
-
filterAttributes
Registers a predicate which should be applied to attributes selected by this attribute filter. Predicates must returntrueif the attribute should be included in the filtered entry.Mappingfunctions and filter predicates will be applied in registration order.- Parameters:
filter- The predicate which should be applied to attributes selected by this attribute filter. Predicates must returntrueif the attribute should be included in the filtered entry.- Returns:
- A reference to this attribute filter.
- See Also:
-
matchesAllAttributes
public boolean matchesAllAttributes()Returnstrueif this attribute filter matches all attributes, regardless of whether they are user or operational attributes.- Returns:
trueif this attribute filter matches all attributes.
-
matchesAllUserAttributes
public boolean matchesAllUserAttributes()Returnstrueif this attribute filter matches all user attributes.- Returns:
trueif this attribute filter matches all user attributes.
-
matchesAllOperationalAttributes
public boolean matchesAllOperationalAttributes()Returnstrueif this attribute filter matches all operational attributes.- Returns:
trueif this attribute filter matches all operational attributes.
-
matchesAnyAttributes
public boolean matchesAnyAttributes()Returnstrueif this attribute filter may match some attributes, orfalseif it will never match any attributes.- Returns:
trueif this attribute filter may match some attributes.
-
matchesAttribute
Returnstrueif this attribute filter matches the provided attribute description.- Parameters:
attributeDescription- The attribute description.- Returns:
trueif this attribute filter matches the provided attribute description.
-
toString
-
typesOnly
Specifies whether filtered attributes are to contain both attribute descriptions and values, or just attribute descriptions.- Parameters:
typesOnly-trueif only attribute descriptions (and not values) are to be included, orfalse(the default) if both attribute descriptions and values are to be included.- Returns:
- A reference to this attribute filter.
-