Search in sources :

Example 1 with AttributeTypeOptions

use of org.apache.directory.api.ldap.model.schema.AttributeTypeOptions in project directory-ldap-api by apache.

the class SearchParams method normalize.

/**
 * Normalize the ReturningAttributes. It reads all the String from the returningAttributesString,
 * and grab the associated AttributeType from the schema to store it into the returningAttributes
 * Set.
 *
 * @param schemaManager The schema manager
 */
public void normalize(SchemaManager schemaManager) {
    for (String returnAttribute : returningAttributesStr) {
        try {
            String id = SchemaUtils.stripOptions(returnAttribute);
            Set<String> options = SchemaUtils.getOptions(returnAttribute);
            AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry(id);
            AttributeTypeOptions attrOptions = new AttributeTypeOptions(attributeType, options);
            returningAttributes.add(attrOptions);
        } catch (LdapException ne) {
            LOG.warn(I18n.msg(I18n.MSG_13500_ATTRIBUTE_NOT_IN_SCHEMA, returnAttribute));
        // Unknown attributes should be silently ignored, as RFC 2251 states
        }
    }
}
Also used : AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) LdapException(org.apache.directory.api.ldap.model.exception.LdapException) AttributeTypeOptions(org.apache.directory.api.ldap.model.schema.AttributeTypeOptions)

Aggregations

LdapException (org.apache.directory.api.ldap.model.exception.LdapException)1 AttributeType (org.apache.directory.api.ldap.model.schema.AttributeType)1 AttributeTypeOptions (org.apache.directory.api.ldap.model.schema.AttributeTypeOptions)1