use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method getAllAttributeOrigins.
/**
* Get all origins
*
* @param attributes
* List of attributes
* @return List of origins
*/
public List<String> getAllAttributeOrigins(Collection<GluuAttribute> attributes) {
List<String> attributeOriginList = new ArrayList<String>();
for (GluuAttribute attribute : attributes) {
String origin = attribute.getOrigin();
if (!attributeOriginList.contains(origin)) {
attributeOriginList.add(attribute.getOrigin());
}
}
String customOrigin = getCustomOrigin();
if (!attributeOriginList.contains(customOrigin)) {
attributeOriginList.add(customOrigin);
}
return attributeOriginList;
}
use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method getAllPersonAtributesImpl.
/**
* Get all organization attributes
*
* @param attributes
* List of attributes
* @return List of organization attributes
*/
private List<GluuAttribute> getAllPersonAtributesImpl(GluuUserRole gluuUserRole, Collection<GluuAttribute> attributes) {
List<GluuAttribute> attributeList = new ArrayList<GluuAttribute>();
String[] objectClassTypes = appConfiguration.getPersonObjectClassTypes();
log.debug("objectClassTypes={}", Arrays.toString(objectClassTypes));
for (GluuAttribute attribute : attributes) {
if (StringHelper.equalsIgnoreCase(attribute.getOrigin(), appConfiguration.getPersonCustomObjectClass()) && (GluuUserRole.ADMIN == gluuUserRole)) {
attribute.setCustom(true);
attributeList.add(attribute);
continue;
}
for (String objectClassType : objectClassTypes) {
if (attribute.getOrigin().equals(objectClassType) && ((attribute.allowViewBy(gluuUserRole) || attribute.allowEditBy(gluuUserRole)))) {
attributeList.add(attribute);
break;
}
}
}
return attributeList;
}
use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method removeAttribute.
public void removeAttribute(String inum) {
GluuAttribute attribute = new GluuAttribute();
attribute.setDn(getDnForAttribute(inum));
removeAttribute(attribute);
}
use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method attributeWithSameNameDontExist.
public boolean attributeWithSameNameDontExist(String name) {
Filter nameFilter = Filter.createEqualityFilter("name", name);
List<GluuAttribute> result = persistenceEntryManager.findEntries(getDnForAttribute(null), GluuAttribute.class, nameFilter, null);
return (result != null && !result.isEmpty()) ? false : true;
}
use of org.gluu.model.GluuAttribute in project oxTrust by GluuFederation.
the class AttributeService method getCustomAttributesByAttributeDNs.
/**
* Get custom attributes by attribute DNs
*
* @param customAttributes
* List of attribute DNs
* @param attributes
* List of custom attributes
*/
public List<GluuCustomAttribute> getCustomAttributesByAttributeDNs(List<String> attributeDNs, HashMap<String, GluuAttribute> attributesByDNs) {
List<GluuCustomAttribute> customAttributes = new ArrayList<GluuCustomAttribute>();
if (attributeDNs == null) {
return customAttributes;
}
for (String releasedAttributeDn : attributeDNs) {
GluuAttribute attribute = attributesByDNs.get(releasedAttributeDn);
if (attribute != null) {
GluuCustomAttribute customAttribute = new GluuCustomAttribute(attribute.getName(), releasedAttributeDn);
customAttribute.setMetadata(attribute);
customAttributes.add(customAttribute);
}
}
return customAttributes;
}
Aggregations