Search in sources :

Example 11 with GluuImage

use of org.xdi.model.GluuImage in project oxTrust by GluuFederation.

the class UpdateOrganizationAction method setCustLogoImageImpl.

private void setCustLogoImageImpl(UploadedFile uploadedFile) {
    removeLogoImage();
    GluuImage newLogoImage = imageService.constructImage(currentPerson, uploadedFile);
    newLogoImage.setStoreTemporary(true);
    newLogoImage.setLogo(true);
    try {
        if (imageService.createImageFiles(newLogoImage)) {
            this.curLogoImage = newLogoImage;
        }
        this.organization.setLogoImage(imageService.getXMLFromGluuImage(newLogoImage));
    } catch (Exception ex) {
        log.error("Failed to store icon image: '{}'", ex, newLogoImage);
    }
}
Also used : GluuImage(org.xdi.model.GluuImage) MessagingException(javax.mail.MessagingException) LdapMappingException(org.gluu.site.ldap.persistence.exception.LdapMappingException) AuthenticationFailedException(javax.mail.AuthenticationFailedException) ParseException(java.text.ParseException) IOException(java.io.IOException)

Example 12 with GluuImage

use of org.xdi.model.GluuImage in project oxTrust by GluuFederation.

the class CustomAttributeAction method savePhotos.

public void savePhotos() {
    // Move added photos to persistent location
    for (GluuImage image : addedPhotos) {
        imageService.moveImageToPersistentStore(image);
    }
    addedPhotos.clear();
    removeRemovedPhotos();
}
Also used : GluuImage(org.xdi.model.GluuImage)

Example 13 with GluuImage

use of org.xdi.model.GluuImage in project oxTrust by GluuFederation.

the class CustomAttributeAction method setIconImageImpl.

private void setIconImageImpl(GluuCustomAttribute customAttribute, GluuImage image) {
    GluuImage oldImage = imageService.getGluuImageFromXML(customAttribute.getValue());
    if (oldImage != null) {
        removedPhotos.add(oldImage);
    }
    customAttribute.setValue(imageService.getXMLFromGluuImage(image));
    addedPhotos.add(image);
}
Also used : GluuImage(org.xdi.model.GluuImage)

Example 14 with GluuImage

use of org.xdi.model.GluuImage 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

GluuImage (org.xdi.model.GluuImage)14 IOException (java.io.IOException)6 LdapMappingException (org.gluu.site.ldap.persistence.exception.LdapMappingException)4 Date (java.util.Date)3 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)3 File (java.io.File)2 InputStream (java.io.InputStream)2 OutputStream (java.io.OutputStream)2 ParseException (java.text.ParseException)2 AuthenticationFailedException (javax.mail.AuthenticationFailedException)2 MessagingException (javax.mail.MessagingException)2 GluuOrganization (org.gluu.oxtrust.model.GluuOrganization)2 GluuAttribute (org.xdi.model.GluuAttribute)2 DownloadWrapper (org.xdi.util.io.DownloadWrapper)2 ExternalContext (javax.faces.context.ExternalContext)1 FacesContext (javax.faces.context.FacesContext)1 ServletException (javax.servlet.ServletException)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 UploadedFile (org.richfaces.model.UploadedFile)1 ScopeDescription (org.xdi.oxauth.model.uma.persistence.ScopeDescription)1