Search in sources :

Example 41 with GluuCustomAttribute

use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.

the class LanguageBean method setLocaleCode.

public void setLocaleCode(String localeCode) {
    if (!identity.isLoggedIn()) {
        return;
    }
    GluuCustomPerson gluuCustomPerson = (GluuCustomPerson) identity.getUser();
    if (gluuCustomPerson == null) {
        return;
    }
    GluuCustomAttribute locale = getLocaleOrNull(gluuCustomPerson);
    if (locale == null) {
        addLocale(gluuCustomPerson, localeCode);
    } else {
        locale.setValue(localeCode);
    }
    personService.updatePerson(gluuCustomPerson);
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson)

Example 42 with GluuCustomAttribute

use of org.gluu.oxtrust.model.GluuCustomAttribute in project oxTrust by GluuFederation.

the class CustomAttributeAction method removePhoto.

public void removePhoto(String inum) {
    if (StringHelper.isEmpty(inum)) {
        return;
    }
    GluuCustomAttribute customAttribute = getCustomAttribute(inum);
    if ((customAttribute == null) || StringHelper.isEmpty(customAttribute.getValue())) {
        return;
    }
    GluuImage image = imageService.getImage(customAttribute);
    if (image != null) {
        image.setStoreTemporary(addedPhotos.contains(image));
        if (image.isStoreTemporary()) {
            imageService.deleteImage(image);
            addedPhotos.remove(image);
        } else {
            removedPhotos.add(image);
        }
    }
    customAttribute.setValue(null);
}
Also used : GluuCustomAttribute(org.gluu.oxtrust.model.GluuCustomAttribute) GluuImage(org.xdi.model.GluuImage)

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