use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.
the class LanguageBean method getLocaleCode.
public String getLocaleCode() {
GluuCustomPerson gluuCustomPerson = (GluuCustomPerson) identity.getUser();
if (gluuCustomPerson == null) {
return null;
}
GluuCustomAttribute locale = getLocaleOrNull(gluuCustomPerson);
if (locale == null) {
return null;
} else {
return locale.getValue();
}
}
use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.
the class CustomAttributeAction method removeMultiValuesInAttributes.
public void removeMultiValuesInAttributes(String inum, boolean mandatory) {
if (StringHelper.isEmpty(inum)) {
return;
}
GluuAttribute tmpAttribute = this.attributeInums.get(inum);
if (tmpAttribute == null) {
return;
}
String id = this.attributeIds.get(tmpAttribute);
this.availableAttributeIds.remove(id);
String[] values = null;
int index = 0;
for (GluuCustomAttribute customAttribute : this.customAttributes) {
if (tmpAttribute.equals(customAttribute.getMetadata())) {
values = customAttribute.getValues();
if (values.length == 1)
return;
break;
}
index++;
}
String[] newValues = new String[values.length - 1];
System.arraycopy(values, 0, newValues, 0, values.length - 1);
removeCustomAttribute(inum);
GluuCustomAttribute tmpGluuPersonAttribute = new GluuCustomAttribute(tmpAttribute.getName(), newValues, true, mandatory);
tmpGluuPersonAttribute.setMetadata(tmpAttribute);
this.customAttributes.add(index, tmpGluuPersonAttribute);
}
use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.
the class CustomAttributeAction method removeCustomAttribute.
public void removeCustomAttribute(String inum) {
if (StringHelper.isEmpty(inum)) {
return;
}
GluuAttribute tmpAttribute = attributeInums.get(inum);
if ((tmpAttribute == null) || !containsCustomAttribute(tmpAttribute)) {
return;
}
String id = this.attributeIds.get(tmpAttribute);
this.availableAttributeIds.add(id);
for (Iterator<GluuCustomAttribute> iterator = this.customAttributes.iterator(); iterator.hasNext(); ) {
GluuCustomAttribute tmpGluuPersonAttribute = iterator.next();
if (tmpAttribute.equals(tmpGluuPersonAttribute.getMetadata())) {
iterator.remove();
break;
}
}
}
use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.
the class CustomAttributeAction method addPhoto.
public void addPhoto(String inum) {
if (this.uploadedImage == null) {
return;
}
GluuCustomAttribute customAttribute = getCustomAttribute(inum);
if (customAttribute == null) {
return;
}
setIconImageImpl(customAttribute, this.uploadedImage);
}
use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.
the class CustomAttributeAction method addCustomAttribute.
public void addCustomAttribute(String inum, boolean mandatory) {
if (StringHelper.isEmpty(inum)) {
return;
}
GluuAttribute tmpAttribute = attributeInums.get(inum);
if ((tmpAttribute == null) || containsCustomAttribute(tmpAttribute)) {
return;
}
String id = this.attributeIds.get(tmpAttribute);
this.availableAttributeIds.remove(id);
GluuCustomAttribute tmpGluuPersonAttribute = new GluuCustomAttribute(tmpAttribute.getName(), (String) null, true, mandatory);
tmpGluuPersonAttribute.setMetadata(tmpAttribute);
this.customAttributes.add(tmpGluuPersonAttribute);
}
Aggregations