use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method getCustomAttributes.
/**
* Get custom attributes
*
* @return List of cusomt attributes
*/
@SuppressWarnings("unchecked")
public List<GluuAttribute> getCustomAttributes() {
List<GluuAttribute> attributeList = (List<GluuAttribute>) cacheService.get(OxTrustConstants.CACHE_ATTRIBUTE_NAME, OxTrustConstants.CACHE_ATTRIBUTE_CUSTOM_KEY_LIST);
if (attributeList == null) {
attributeList = new ArrayList<GluuAttribute>();
for (GluuAttribute attribute : getAllAttributes()) {
if (attribute.isCustom()) {
attributeList.add(attribute);
}
}
cacheService.put(OxTrustConstants.CACHE_ATTRIBUTE_NAME, OxTrustConstants.CACHE_ATTRIBUTE_CUSTOM_KEY_LIST, attributeList);
}
return attributeList;
}
use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method setAttributeMetadata.
/**
* Set metadata for every custom attribute
*
* @param customAttributes
* List of custom attributes
* @param attributes
* List of attributes
*/
public void setAttributeMetadata(List<GluuCustomAttribute> customAttributes, List<GluuAttribute> attributes) {
if ((customAttributes == null) || (attributes == null)) {
return;
}
for (GluuCustomAttribute personAttribute : customAttributes) {
GluuAttribute tmpAttribute = getAttributeByName(personAttribute.getName(), attributes);
if (tmpAttribute == null) {
log.error("Failed to find attribute '{}' metadata", personAttribute.getName());
}
personAttribute.setMetadata(tmpAttribute);
}
}
use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method getAllAtributesImpl.
@Override
protected List<GluuAttribute> getAllAtributesImpl(String baseDn) {
List<GluuAttribute> attributeList = ldapEntryManager.findEntries(baseDn, GluuAttribute.class, null);
String customOrigin = getCustomOrigin();
for (GluuAttribute attribute : attributeList) {
attribute.setCustom(customOrigin.equals(attribute.getOrigin()));
}
return attributeList;
}
use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method searchAttributes.
/**
* Search groups by pattern
*
* @param pattern
* Pattern
* @param sizeLimit
* Maximum count of results
* @return List of groups
* @throws Exception
*/
public List<GluuAttribute> searchAttributes(String pattern, int sizeLimit) throws Exception {
String[] targetArray = new String[] { pattern };
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter nameFilter = Filter.createSubstringFilter(OxTrustConstants.attributeName, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter, inameFilter, nameFilter);
List<GluuAttribute> result = ldapEntryManager.findEntries(getDnForAttribute(null), GluuAttribute.class, searchFilter, 0, sizeLimit);
String customOrigin = getCustomOrigin();
for (GluuAttribute attribute : result) {
attribute.setCustom(customOrigin.equals(attribute.getOrigin()));
}
return result;
}
use of org.xdi.model.GluuAttribute in project oxTrust by GluuFederation.
the class InumService method containsAttribute.
public boolean containsAttribute(String inum, String gluuInum) {
GluuAttribute attribute = new GluuAttribute();
attribute.setBaseDn("inum=" + inum + ",ou=attributes,o=" + gluuInum + "o=gluu");
return ldapEntryManager.contains(attribute);
}
Aggregations