Search in sources :

Example 1 with AttributesFactory

use of org.apache.directory.api.ldap.model.schema.AttributesFactory 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 AttributesFactory

use of org.apache.directory.api.ldap.model.schema.AttributesFactory 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 AttributesFactory

use of org.apache.directory.api.ldap.model.schema.AttributesFactory 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 AttributesFactory

use of org.apache.directory.api.ldap.model.schema.AttributesFactory 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 AttributesFactory

use of org.apache.directory.api.ldap.model.schema.AttributesFactory 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

ArrayList (java.util.ArrayList)8 DefaultEntry (org.apache.directory.api.ldap.model.entry.DefaultEntry)8 Entry (org.apache.directory.api.ldap.model.entry.Entry)8 AttributesFactory (org.apache.directory.api.ldap.model.schema.AttributesFactory)8 SchemaObject (org.apache.directory.api.ldap.model.schema.SchemaObject)8 SchemaObjectWrapper (org.apache.directory.api.ldap.model.schema.SchemaObjectWrapper)8 DefaultSchema (org.apache.directory.api.ldap.model.schema.registries.DefaultSchema)8 Schema (org.apache.directory.api.ldap.model.schema.registries.Schema)8 AttributeType (org.apache.directory.api.ldap.model.schema.AttributeType)1 DitContentRule (org.apache.directory.api.ldap.model.schema.DitContentRule)1 DitStructureRule (org.apache.directory.api.ldap.model.schema.DitStructureRule)1 LdapSyntax (org.apache.directory.api.ldap.model.schema.LdapSyntax)1 MatchingRule (org.apache.directory.api.ldap.model.schema.MatchingRule)1 MatchingRuleUse (org.apache.directory.api.ldap.model.schema.MatchingRuleUse)1 NameForm (org.apache.directory.api.ldap.model.schema.NameForm)1 ObjectClass (org.apache.directory.api.ldap.model.schema.ObjectClass)1