typeName = AttributedTypeEnum.forType(codeNode.asString());
} else {
throw ROOT_LOGGER.typeNotProvided(LDAP_STORE_MAPPING.getName());
}
LDAPMappingConfigurationBuilder storeMapping = storeConfig
.mapping(this.<AttributedType>loadClass(moduleNode, typeName));
ModelNode relatesToNode = LDAPStoreMappingResourceDefinition.RELATES_TO.resolveModelAttribute(context, ldapMapping);
if (relatesToNode.isDefined()) {
String relatesTo = AttributedTypeEnum.forType(relatesToNode.asString());
if (relatesTo == null) {
relatesTo = relatesToNode.asString();
}
storeMapping.forMapping(this.<AttributedType>loadClass(moduleNode, relatesTo));
} else {
String baseDN = LDAPStoreMappingResourceDefinition.BASE_DN.resolveModelAttribute(context, ldapMapping)
.asString();
storeMapping.baseDN(baseDN);
String objectClasses = LDAPStoreMappingResourceDefinition.OBJECT_CLASSES
.resolveModelAttribute(context, ldapMapping).asString();
for (String objClass : objectClasses.split(",")) {
if (!objClass.trim().isEmpty()) {
storeMapping.objectClasses(objClass);
}
}
ModelNode parentAttributeName = LDAPStoreMappingResourceDefinition.PARENT_ATTRIBUTE
.resolveModelAttribute(context, ldapMapping);
if (parentAttributeName.isDefined()) {
storeMapping.parentMembershipAttributeName(parentAttributeName.asString());
}
}
if (ldapMapping.hasDefined(LDAP_STORE_ATTRIBUTE.getName())) {
for (Property attributeNode : ldapMapping.get(LDAP_STORE_ATTRIBUTE.getName()).asPropertyList()) {
ModelNode attribute = attributeNode.getValue();
String name = LDAPStoreAttributeResourceDefinition.NAME.resolveModelAttribute(context, attribute)
.asString();
String ldapName = LDAPStoreAttributeResourceDefinition.LDAP_NAME.resolveModelAttribute(context, attribute)
.asString();
boolean readOnly = LDAPStoreAttributeResourceDefinition.READ_ONLY.resolveModelAttribute(context, attribute)
.asBoolean();
if (readOnly) {
storeMapping.readOnlyAttribute(name, ldapName);
} else {
boolean isIdentifier = LDAPStoreAttributeResourceDefinition.IS_IDENTIFIER
.resolveModelAttribute(context, attribute).asBoolean();
storeMapping.attribute(name, ldapName, isIdentifier);
}
}
}
}
} else {