Comflow Documentation

Comflow Documentation

  • Comflow 2.22

›User Avatar

Presentation

  • Release Notes
  • Migration Notes
  • Master Sitedef

Chart Implementations

  • Comflow Chart Implementations
  • Comflow Custom Chart Setup

Comflow IPP

  • Comflow IPP Basics
  • Using ppd files
  • Windows Printer Server Setup

Comflow Styling

  • Comflow Styling Basics
  • _config.scss
  • _custom-class.scss
  • Portal Header

Copy to Clipboard

  • Copy to Clipboard Basics
  • External Resources

Datepicker Exceptions

  • Datepicker Exceptions

Desktop Functions

  • Desktop Functions Basics
  • Modes
  • Style

My Functions

  • My Functions Basics

My Settings

  • My Settings Basics

Open API

  • OpenAPI Basics

Portal Menu Options

  • Portal Menu Options Basics
  • Mega Menu
  • Side Menu
  • Top Menu

Quick Search

  • Quick Search Basics

Quick Start

  • Quick Start Basics

Removed Classes/Methods

  • AbstractEnvironment
  • AbstractSegmentChangeObject
  • ApplicationObject
  • CadModel
  • ChangeObject
  • Changes in Rendering Classes
  • ClientInfo
  • Component
  • CoreSessionManager
  • DataInstance
  • Database
  • DriverHelper
  • DynamicModels
  • Environment
  • ErrorUtils
  • FieldChangeObject
  • Field
  • FlexIdImplementation
  • FlexId
  • Introduction
  • Logical Unit of Work
  • PromptRequest
  • RendererInfo
  • RendererModelUtils
  • RendererModel
  • RepositoryUtil
  • Root
  • SegmentChangeObjectImpl
  • SegmentChangeObject
  • SessionMessage
  • SimpleModel
  • Site
  • StringUtil
  • SystemWorkspace

Repository Constant

  • Repository Constant Basics

Sitedef

  • Site definition Settings

Sound Events

  • Sound Events Basics
  • Sound Events in Errors
  • Sound Events in Rules
  • Test Case in Verify

User Avatar

  • User Avatar Basics
  • Changes in Classes and Tables
  • References

User Info

  • User Info Basics

Changes in Classes and Tables

UserData

net.comactivity.core.session.UserData has two new fields, both with initial values null.

private BufferedImage avatar
private AvatarType avatarType

avatar

The field avatar has a BufferedImage. It should be set in the User Manager's implementation of net.comactivity.core.authorization.UserManagement#complementUserData. Default implementation exists in abstract class net.comactivity.core.authorization.AbstractUserManager.

If avatarType changes, net.comactivity.core.authorization.AbstractUserManager#refreshAvatar should be called to set a new value in avatar.

avatarType

The field avatarType has an AvatarType. It should be set in the User Manager's implementation of net.comactivity.core.authorization.UserManagement#getUser. There's a fallback in net.comactivity.core.authorization.UserManagement#complementUserData, with a default implementation in abstract class net.comactivity.core.authorization.AbstractUserManager.

EnvUsers

Table CACORE.EnvUsers has a new column, AvatarType.

Customizations and Guides

Setting Up Gravatar

Users that want to use Gravatars will have to create accounts with the same email address as their user account has.

Gravatar

User Upload of Local Avatar Images

Users can upload their own avatar images to be used with avatar type local. The file format has to be PNG, unless set in sitedef with property portal.user.avatar.images.format. The uploaded image file will be stored at the file location $PersistanceRoot/Avatars, or location set with portal.user.avatar.images.location. The name will be user's login name, and set file format as extension. Uploaded files will overwrite previously saved files without warning or notification.

Custom Avatar Service

The Custom Avatar Service is available for customer specific implementations. The service has to setup like a regular ApplicationService and implement net.comactivity.core.avatar.AvatarService.

Application Service Setup

Example: Services/CustomAvatarService.service

<Service id="CustomAvatarService" model="singleton" interface="net.comactivity.core.avatar.AvatarService">
    <Implementation class="solutions.company.cust.services.impl.CustomAvatarService"/>
</Service>

Example: solutions.company.cust.services.impl.CustomAvatarService

public class CustomAvatarService implements AvatarService {
    @Override
    public void init() {
    }
    @Override
    public void destroy() {
    }
    @Override
    public Optional<BufferedImage> getAvatarImage(UserData userData) {
    String format = SystemWorkspace.getSite().getPortalUserAvatarImagesFormat();
        try {
            URL url = new URL("https://cust.company.solutions/employees/" + userData.getEMail() + "." + format);
            return Optional.ofNullable(ImageIO.read(url));
        } catch (IOException e) {
            return Optional.empty();
        }
    }
}

References

New Site Definition Properties

<Property name="portal.user.avatar.enabled" value="true"/>
<!-- Possible values are true and false. Default value is false.-->

<Property name="portal.user.avatar.type.default" value="local"/>
<!-- Possible values are gravatar, local, and custom. Default value is local.-->

<Property name="portal.user.avatar.images.location" value="../../../../tomcat/avatars/"/>
<!-- Possible values are absolute or relative paths.-->

<Property name="portal.user.avatar.images.format" value="png"/>
<!-- Possible values are lowercase representations if file formats available to javax.imageio.ImageIO.-->
<!-- Possible values should include jpg, png, gif, bmp, and wbmp.-->

<Property name="portal.user.avatar.custom.service" value="CustomAvatarService"/>
<!-- Possible values are registered application services. -->

Java Image I/O API

Package javax.imageio

← User Avatar BasicsNext →
Comflow Documentation
Docs
Corzia Info
Community
User ShowcaseCorzia WebsiteTwitter
More
Update Sitetech@corzia.com
Copyright © 2019 Corzia AB