use of org.xdi.config.oxtrust.ImportPerson in project oxTrust by GluuFederation.
the class ImportPersonConfiguration method prepareAttributes.
private List<GluuAttribute> prepareAttributes() throws Exception {
List<GluuAttribute> result = new ArrayList<GluuAttribute>();
List<ImportPerson> mappings = configurationFactory.getImportPersonConfig().getMappings();
Iterator<ImportPerson> it = mappings.iterator();
while (it.hasNext()) {
ImportPerson importPerson = (ImportPerson) it.next();
String attributeName = importPerson.getLdapName();
boolean required = importPerson.getRequired();
if (StringHelper.isNotEmpty(attributeName)) {
GluuAttribute attr = null;
try {
attr = attributeService.getAttributeByName(attributeName);
} catch (EntryPersistenceException ex) {
log.error("Failed to load attribute '{}' definition from LDAP", attributeName, ex);
}
if (attr == null) {
log.warn("Failed to find attribute '{}' definition in LDAP", attributeName);
attr = createAttributeFromConfig(importPerson);
if (attr == null) {
log.error("Failed to find attribute '{}' definition in '{}'", attributeName, GLUU_IMPORT_PERSON_PROPERTIES_FILE);
continue;
}
} else {
attr.setRequred(required);
}
result.add(attr);
}
// }
}
return result;
}
Aggregations