Search in sources :

Example 1 with SchemaObject

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

the class DefaultSchemaLoader method loadNameForms.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadNameForms(Schema... schemas) throws LdapException, IOException {
    List<Entry> nameFormEntries = new ArrayList<>();
    if (schemas == null) {
        return nameFormEntries;
    }
    AttributesFactory factory = new AttributesFactory();
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof NameForm) {
                NameForm nameForm = (NameForm) schemaObject;
                Entry nameFormEntry = factory.convert(nameForm, schema, null);
                nameFormEntries.add(nameFormEntry);
            }
        }
    }
    return nameFormEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) AttributesFactory(org.apache.directory.api.ldap.model.schema.AttributesFactory) NameForm(org.apache.directory.api.ldap.model.schema.NameForm) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Example 2 with SchemaObject

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

the class DefaultSchemaLoader method loadMatchingRules.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadMatchingRules(Schema... schemas) throws LdapException, IOException {
    List<Entry> matchingRuleEntries = new ArrayList<>();
    if (schemas == null) {
        return matchingRuleEntries;
    }
    AttributesFactory factory = new AttributesFactory();
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof MatchingRule) {
                MatchingRule matchingRule = (MatchingRule) schemaObject;
                Entry matchingRuleEntry = factory.convert(matchingRule, schema, null);
                matchingRuleEntries.add(matchingRuleEntry);
            }
        }
    }
    return matchingRuleEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) AttributesFactory(org.apache.directory.api.ldap.model.schema.AttributesFactory) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper) MatchingRule(org.apache.directory.api.ldap.model.schema.MatchingRule)

Example 3 with SchemaObject

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

the class DefaultSchemaLoader method loadObjectClasses.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadObjectClasses(Schema... schemas) throws LdapException, IOException {
    List<Entry> objectClassEntries = new ArrayList<>();
    if (schemas == null) {
        return objectClassEntries;
    }
    AttributesFactory factory = new AttributesFactory();
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof ObjectClass) {
                ObjectClass objectClass = (ObjectClass) schemaObject;
                Entry objectClassEntry = factory.convert(objectClass, schema, null);
                objectClassEntries.add(objectClassEntry);
            }
        }
    }
    return objectClassEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) AttributesFactory(org.apache.directory.api.ldap.model.schema.AttributesFactory) ObjectClass(org.apache.directory.api.ldap.model.schema.ObjectClass) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Example 4 with SchemaObject

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

the class DefaultSchemaLoader method loadAttributeTypes.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadAttributeTypes(Schema... schemas) throws LdapException, IOException {
    List<Entry> attributeTypeEntries = new ArrayList<>();
    if (schemas == null) {
        return attributeTypeEntries;
    }
    AttributesFactory factory = new AttributesFactory();
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof AttributeType) {
                AttributeType attributeType = (AttributeType) schemaObject;
                Entry attributeTypeEntry = factory.convert(attributeType, schema, null);
                attributeTypeEntries.add(attributeTypeEntry);
            }
        }
    }
    return attributeTypeEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) AttributesFactory(org.apache.directory.api.ldap.model.schema.AttributesFactory) AttributeType(org.apache.directory.api.ldap.model.schema.AttributeType) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Example 5 with SchemaObject

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

the class DefaultSchemaLoader method loadSyntaxes.

/**
 * {@inheritDoc}
 */
@Override
public List<Entry> loadSyntaxes(Schema... schemas) throws LdapException, IOException {
    List<Entry> syntaxEntries = new ArrayList<>();
    if (schemas == null) {
        return syntaxEntries;
    }
    AttributesFactory factory = new AttributesFactory();
    for (Schema schema : schemas) {
        Set<SchemaObjectWrapper> schemaObjectWrappers = schema.getContent();
        for (SchemaObjectWrapper schemaObjectWrapper : schemaObjectWrappers) {
            SchemaObject schemaObject = schemaObjectWrapper.get();
            if (schemaObject instanceof LdapSyntax) {
                LdapSyntax ldapSyntax = (LdapSyntax) schemaObject;
                Entry ldapSyntaxEntry = factory.convert(ldapSyntax, schema, null);
                syntaxEntries.add(ldapSyntaxEntry);
            }
        }
    }
    return syntaxEntries;
}
Also used : SchemaObject(org.apache.directory.api.ldap.model.schema.SchemaObject) DefaultEntry(org.apache.directory.api.ldap.model.entry.DefaultEntry) Entry(org.apache.directory.api.ldap.model.entry.Entry) AttributesFactory(org.apache.directory.api.ldap.model.schema.AttributesFactory) DefaultSchema(org.apache.directory.api.ldap.model.schema.registries.DefaultSchema) Schema(org.apache.directory.api.ldap.model.schema.registries.Schema) ArrayList(java.util.ArrayList) LdapSyntax(org.apache.directory.api.ldap.model.schema.LdapSyntax) SchemaObjectWrapper(org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)

Aggregations

SchemaObject (org.apache.directory.api.ldap.model.schema.SchemaObject)37 SchemaObjectWrapper (org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)14 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)13 ArrayList (java.util.ArrayList)12 DefaultEntry (org.apache.directory.api.ldap.model.entry.DefaultEntry)12 Entry (org.apache.directory.api.ldap.model.entry.Entry)11 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)11 LoadableSchemaObject (org.apache.directory.api.ldap.model.schema.LoadableSchemaObject)10 AttributesFactory (org.apache.directory.api.ldap.model.schema.AttributesFactory)8 ParseException (java.text.ParseException)6 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)4 DitStructureRule (org.apache.directory.api.ldap.model.schema.DitStructureRule)4 LdapSyntax (org.apache.directory.api.ldap.model.schema.LdapSyntax)4 ObjectClass (org.apache.directory.api.ldap.model.schema.ObjectClass)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 Set (java.util.Set)3 AttributeType (org.apache.directory.api.ldap.model.schema.AttributeType)3 DitContentRule (org.apache.directory.api.ldap.model.schema.DitContentRule)3