Search in sources :

Example 1 with GluuCustomAttribute

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();
    }
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson)

Example 2 with GluuCustomAttribute

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);
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuAttribute(org.xdi.model.GluuAttribute)

Example 3 with GluuCustomAttribute

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;
        }
    }
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuAttribute(org.xdi.model.GluuAttribute)

Example 4 with GluuCustomAttribute

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);
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute)

Example 5 with GluuCustomAttribute

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);
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuAttribute(org.xdi.model.GluuAttribute)

Aggregations

GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)42 ArrayList (java.util.ArrayList)19 GluuAttribute (org.xdi.model.GluuAttribute)15 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)12 ScimPersonEmails (org.gluu.oxtrust.model.scim.ScimPersonEmails)5 HashSet (java.util.HashSet)4 ConfigurableTest (org.gluu.oxtrust.action.test.ConfigurableTest)4 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)4 PersonMeta (org.gluu.oxtrust.model.scim.PersonMeta)4 ScimCustomAttributes (org.gluu.oxtrust.model.scim.ScimCustomAttributes)4 ScimName (org.gluu.oxtrust.model.scim.ScimName)4 ScimPerson (org.gluu.oxtrust.model.scim.ScimPerson)4 ScimPersonAddresses (org.gluu.oxtrust.model.scim.ScimPersonAddresses)4 ScimPersonGroups (org.gluu.oxtrust.model.scim.ScimPersonGroups)4 ScimPersonIms (org.gluu.oxtrust.model.scim.ScimPersonIms)4 ScimPersonPhones (org.gluu.oxtrust.model.scim.ScimPersonPhones)4 ScimPersonPhotos (org.gluu.oxtrust.model.scim.ScimPersonPhotos)4 ScimRoles (org.gluu.oxtrust.model.scim.ScimRoles)4 Scimx509Certificates (org.gluu.oxtrust.model.scim.Scimx509Certificates)4 IOException (java.io.IOException)3