Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community
Interface AvatarManager


public interface AvatarManager

Manages the avatar feature. Avatars give a user the ability to specify an image that will be displayed alongside their username throughout the application.


Method Summary
 Avatar createAvatar(User owner, String name, String contentType, InputStream in)
          Creates a new avatar for a user allowing the user to specify an inputstream for the image.
 void deleteAvatar(Avatar avatar)
          Deletes an avatar from the system.
 void deleteUserAvatar(User user)
          Deletes the given user's avatar from the system.
 Avatar getActiveAvatar(User user)
          Returns an avatar for a user, else the SystemDefaultAvatar if the user does not have an active avatar specified.
 Avatar getAvatar(long id)
          Used to acquire an avatar by its id
 int getAvatarCount(User user)
          Used to acquire a count of all the avatars for a specific user
 JiveIterator<Avatar> getAvatars(User user)
          Returns a collection of avatars for a user
 long getDefaultAvatarID()
          Retrieves the ID of the system default avatar, default is -1.
 JiveIterator<Avatar> getGlobalAvatars()
          Returns a collection of all of the global avatars
 int getMaxAllowableHeight()
          Returns the maximum allowable height for an avatar image
 int getMaxAllowableWidth()
          Returns the maximum allowable width for an avatar image
 int getMaxUserAvatars()
          Returns the maximum amount of avatars a user is allowed to have, -1 for limitless
 int getModerationAvatarCount()
          Used to acquire a count of all the avatars that require moderation.
 JiveIterator<Avatar> getModerationAvatars()
          Returns a collection of all of the avatars that require moderation.
 boolean isAllowImageResize()
          Returns true if the system should attempt to resize images
 boolean isAvatarsEnabled()
          Returns true if the avatars feature is enabled, else false
 boolean isModerateUserAvatars()
          Returns whether or not user avatars will be moderated.
 boolean isUserAvatarsEnabled()
          Returns true if users can create their own avatars, false otherwise.
 void setActiveAvatar(User user, Avatar avatar)
          Used to make a user use a global avatar, to set no active avatar pass null for the avatar value.
 void setAllowImageResize(boolean isAllowImageResize)
          Used to set whether the system should attempt to resize images
 void setDefaultAvatarID(long ID)
          Set the default avatar for the system.
 void setMaxAllowableHeight(int height)
          Sets the maximum allowable height for an avatar image
 void setMaxAllowableWidth(int width)
          Sets the maximum allowable width for an avatar image
 void setMaxUserAvatars(int max)
          Sets the maximum number of avatars a user can have
 void setModerateUserAvatars(boolean moderateUserAvatars)
          Sets whether or not user avatars will be moderated.
 void setUserAvatarsEnabled(boolean enableCustomAvatars)
          Sets whether or not users can create their own custom avatars.
 

Method Detail

createAvatar

Avatar createAvatar(User owner,
                    String name,
                    String contentType,
                    InputStream in)
                    throws UnauthorizedException,
                           AvatarException
Creates a new avatar for a user allowing the user to specify an inputstream for the image.

Parameters:
owner - user to create the avatar for
name - image name of the avatar
contentType - mime type of the image
in - input stream of the image
Returns:
newly created avatar
Throws:
UnauthorizedException - if not system admin, community admin, moderator or doesn't have edit avatar permission
AvatarException - if exception occurs while saving avatar

setActiveAvatar

void setActiveAvatar(User user,
                     Avatar avatar)
                     throws UnauthorizedException
Used to make a user use a global avatar, to set no active avatar pass null for the avatar value.

Parameters:
user - user to set an avatar for
avatar - avatar to make active
Throws:
UnauthorizedException - if the avatar does not belong to the user or it is not global

getAvatar

Avatar getAvatar(long id)
Used to acquire an avatar by its id

Parameters:
id - unique id of the avatar
Returns:
avatar matching the id

getAvatars

JiveIterator<Avatar> getAvatars(User user)
Returns a collection of avatars for a user

Parameters:
user - user to find an avatar for
Returns:
Collection of Avatar objects

getActiveAvatar

Avatar getActiveAvatar(User user)
Returns an avatar for a user, else the SystemDefaultAvatar if the user does not have an active avatar specified.

Parameters:
user - user to acquire an avatar for
Returns:
an avatar for a particular user

getGlobalAvatars

JiveIterator<Avatar> getGlobalAvatars()
Returns a collection of all of the global avatars

Returns:
a collection of all of the global avatars

deleteAvatar

void deleteAvatar(Avatar avatar)
                  throws UnauthorizedException
Deletes an avatar from the system.

Parameters:
avatar - the avatar for the user
Throws:
UnauthorizedException - if not a system admin, community admin or moderator or user doesn't have edit avatar permission

deleteUserAvatar

void deleteUserAvatar(User user)
                      throws UnauthorizedException
Deletes the given user's avatar from the system.

Parameters:
user - the owner of the avatar being deleted.
Throws:
UnauthorizedException - if not a system admin, community admin or moderator or user doesn't have edit avatar permission

isAvatarsEnabled

boolean isAvatarsEnabled()
Returns true if the avatars feature is enabled, else false

Returns:
true if the avatars feature is enabled, else false

getMaxAllowableHeight

int getMaxAllowableHeight()
Returns the maximum allowable height for an avatar image

Returns:
the maximum allowable height for an avatar image

setMaxAllowableHeight

void setMaxAllowableHeight(int height)
                           throws UnauthorizedException
Sets the maximum allowable height for an avatar image

Parameters:
height - the maximum allowable height for an avatar image
Throws:
UnauthorizedException - thrown if not system admin

getMaxAllowableWidth

int getMaxAllowableWidth()
Returns the maximum allowable width for an avatar image

Returns:
the maximum allowable width for an avatar image

setMaxAllowableWidth

void setMaxAllowableWidth(int width)
                          throws UnauthorizedException
Sets the maximum allowable width for an avatar image

Parameters:
width - the maximum allowable width for an avatar image
Throws:
UnauthorizedException - thrown if not system admin

isAllowImageResize

boolean isAllowImageResize()
Returns true if the system should attempt to resize images

Returns:
true if the system should attempt to resize images

setAllowImageResize

void setAllowImageResize(boolean isAllowImageResize)
                         throws UnauthorizedException
Used to set whether the system should attempt to resize images

Parameters:
isAllowImageResize - whether the system should attempt to resize images
Throws:
UnauthorizedException - thrown if not system admin

isUserAvatarsEnabled

boolean isUserAvatarsEnabled()
Returns true if users can create their own avatars, false otherwise. If custom user avatars are enabled, the number of custom avatars allowed per user and whether or not custom avatars should be moderated can be set using setMaxUserAvatars(int max); and setModerateUserAvatars(boolean moderateUserAvatars); respecitvely.

Returns:
true if custom user avatars are enabled, false otherwise

setUserAvatarsEnabled

void setUserAvatarsEnabled(boolean enableCustomAvatars)
Sets whether or not users can create their own custom avatars. If custom user avatars are enabled, the number of custom avatars allowed per user and whether or not custom avatars should be moderated can be set using setMaxUserAvatars(int max); and setModerateUserAvatars(boolean moderateUserAvatars); respecitvely.

Parameters:
enableCustomAvatars - true if custom user avatars are enabled, false otherwise

getMaxUserAvatars

int getMaxUserAvatars()
Returns the maximum amount of avatars a user is allowed to have, -1 for limitless

Returns:
the maximum amount of avatars a user is allowed to have

setMaxUserAvatars

void setMaxUserAvatars(int max)
                       throws UnauthorizedException
Sets the maximum number of avatars a user can have

Parameters:
max - the maximum number of avatars a user can have
Throws:
UnauthorizedException - if not system admin

getAvatarCount

int getAvatarCount(User user)
Used to acquire a count of all the avatars for a specific user

Parameters:
user - user to count avatars for
Returns:
the number avatars the user has

isModerateUserAvatars

boolean isModerateUserAvatars()
Returns whether or not user avatars will be moderated. The default value is true.

Returns:
true if user avatars will be moderated, false otherwise.

setModerateUserAvatars

void setModerateUserAvatars(boolean moderateUserAvatars)
                            throws UnauthorizedException
Sets whether or not user avatars will be moderated. The default value is true.

Parameters:
moderateUserAvatars - whether or not user avatars will be moderated
Throws:
UnauthorizedException - if not system admin

getModerationAvatars

JiveIterator<Avatar> getModerationAvatars()
                                          throws UnauthorizedException
Returns a collection of all of the avatars that require moderation.

Returns:
a collection of all of the avatars that require moderation.
Throws:
UnauthorizedException - if not admin or moderator

getModerationAvatarCount

int getModerationAvatarCount()
Used to acquire a count of all the avatars that require moderation.

Returns:
the number avatars that require moderation.

setDefaultAvatarID

void setDefaultAvatarID(long ID)
Set the default avatar for the system.

Parameters:
ID - the ID of the avatar to set as the system avatar

getDefaultAvatarID

long getDefaultAvatarID()
Retrieves the ID of the system default avatar, default is -1.

Returns:
the ID of the system default avatar, default is -1.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.