Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DbAvatarManager

java.lang.Object
  extended by com.jivesoftware.forum.database.DbAvatarManager
All Implemented Interfaces:
AvatarManager

public class DbAvatarManager
extends java.lang.Object
implements AvatarManager


Field Summary
static int DEFAULT_HEIGHT
           
static int DEFAULT_WIDTH
           
static java.lang.String PROPERTY_ALLOW_IMAGE_RESIZE
           
static java.lang.String PROPERTY_CUSTOM_ENABLED
           
static java.lang.String PROPERTY_MAX_ALLOWABLE_HEIGHT
           
static java.lang.String PROPERTY_MAX_ALLOWABLE_WIDTH
           
static java.lang.String PROPERTY_MAX_USER_AVATARS
           
static java.lang.String PROPERTY_MOD_USER_AVATARS
           
 
Constructor Summary
DbAvatarManager()
           
 
Method Summary
 Avatar createAvatar(User owner, java.lang.String name, java.lang.String contentType, java.io.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.
 Avatar getActiveAvatar(User user)
          Returns an avatar for a user, else null if no avatar exists for this user
 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
 java.util.Iterator getAvatars(User user)
          Returns a collection of avatars for a user
 java.util.Iterator 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.
 java.util.Iterator 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 setAvatarsEnabled(boolean enabled)
          Used to disable or enable the avatars feature
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_ALLOW_IMAGE_RESIZE

public static final java.lang.String PROPERTY_ALLOW_IMAGE_RESIZE
See Also:
Constant Field Values

PROPERTY_MAX_ALLOWABLE_HEIGHT

public static final java.lang.String PROPERTY_MAX_ALLOWABLE_HEIGHT
See Also:
Constant Field Values

PROPERTY_MAX_ALLOWABLE_WIDTH

public static final java.lang.String PROPERTY_MAX_ALLOWABLE_WIDTH
See Also:
Constant Field Values

PROPERTY_CUSTOM_ENABLED

public static final java.lang.String PROPERTY_CUSTOM_ENABLED
See Also:
Constant Field Values

PROPERTY_MAX_USER_AVATARS

public static final java.lang.String PROPERTY_MAX_USER_AVATARS
See Also:
Constant Field Values

PROPERTY_MOD_USER_AVATARS

public static final java.lang.String PROPERTY_MOD_USER_AVATARS
See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
See Also:
Constant Field Values
Constructor Detail

DbAvatarManager

public DbAvatarManager()
Method Detail

createAvatar

public Avatar createAvatar(User owner,
                           java.lang.String name,
                           java.lang.String contentType,
                           java.io.InputStream in)
                    throws UnauthorizedException,
                           AvatarException
Description copied from interface: AvatarManager
Creates a new avatar for a user allowing the user to specify an inputstream for the image.

Specified by:
createAvatar in interface AvatarManager
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
AvatarException

setActiveAvatar

public void setActiveAvatar(User user,
                            Avatar avatar)
                     throws UnauthorizedException
Description copied from interface: AvatarManager
Used to make a user use a global avatar, to set no active avatar pass null for the avatar value.

Specified by:
setActiveAvatar in interface AvatarManager
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

public Avatar getAvatar(long id)
                 throws AvatarNotFoundException
Description copied from interface: AvatarManager
Used to acquire an avatar by its id

Specified by:
getAvatar in interface AvatarManager
Parameters:
id - unique id of the avatar
Returns:
avatar matching the id
Throws:
AvatarNotFoundException - thrown if the avatar does not exist

getAvatars

public java.util.Iterator getAvatars(User user)
Description copied from interface: AvatarManager
Returns a collection of avatars for a user

Specified by:
getAvatars in interface AvatarManager
Parameters:
user - user to find an avatar for
Returns:
Collection of Avatar objects

getAvatarCount

public int getAvatarCount(User user)
Description copied from interface: AvatarManager
Used to acquire a count of all the avatars for a specific user

Specified by:
getAvatarCount in interface AvatarManager
Parameters:
user - user to count avatars for
Returns:
the number avatars the user has

getActiveAvatar

public Avatar getActiveAvatar(User user)
Description copied from interface: AvatarManager
Returns an avatar for a user, else null if no avatar exists for this user

Specified by:
getActiveAvatar in interface AvatarManager
Parameters:
user - user to acquire an avatar for
Returns:
an avatar for a particular user

getGlobalAvatars

public java.util.Iterator getGlobalAvatars()
Description copied from interface: AvatarManager
Returns a collection of all of the global avatars

Specified by:
getGlobalAvatars in interface AvatarManager
Returns:
a collection of all of the global avatars

deleteAvatar

public void deleteAvatar(Avatar avatar)
                  throws UnauthorizedException
Description copied from interface: AvatarManager
Deletes an avatar from the system.

Specified by:
deleteAvatar in interface AvatarManager
Parameters:
avatar - the avatar for the user
Throws:
UnauthorizedException

setAvatarsEnabled

public void setAvatarsEnabled(boolean enabled)
                       throws UnauthorizedException
Description copied from interface: AvatarManager
Used to disable or enable the avatars feature

Specified by:
setAvatarsEnabled in interface AvatarManager
Parameters:
enabled - true to enable, false to disable
Throws:
UnauthorizedException

isAvatarsEnabled

public boolean isAvatarsEnabled()
Description copied from interface: AvatarManager
Returns true if the avatars feature is enabled, else false

Specified by:
isAvatarsEnabled in interface AvatarManager
Returns:
true if the avatars feature is enabled, else false

getMaxAllowableHeight

public int getMaxAllowableHeight()
Description copied from interface: AvatarManager
Returns the maximum allowable height for an avatar image

Specified by:
getMaxAllowableHeight in interface AvatarManager
Returns:
the maximum allowable height for an avatar image

setMaxAllowableHeight

public void setMaxAllowableHeight(int height)
                           throws UnauthorizedException
Description copied from interface: AvatarManager
Sets the maximum allowable height for an avatar image

Specified by:
setMaxAllowableHeight in interface AvatarManager
Parameters:
height - the maximum allowable height for an avatar image
Throws:
UnauthorizedException - thrown if not system admin

getMaxAllowableWidth

public int getMaxAllowableWidth()
Description copied from interface: AvatarManager
Returns the maximum allowable width for an avatar image

Specified by:
getMaxAllowableWidth in interface AvatarManager
Returns:
the maximum allowable width for an avatar image

setMaxAllowableWidth

public void setMaxAllowableWidth(int width)
                          throws UnauthorizedException
Description copied from interface: AvatarManager
Sets the maximum allowable width for an avatar image

Specified by:
setMaxAllowableWidth in interface AvatarManager
Parameters:
width - the maximum allowable width for an avatar image
Throws:
UnauthorizedException - thrown if not system admin

isAllowImageResize

public boolean isAllowImageResize()
Description copied from interface: AvatarManager
Returns true if the system should attempt to resize images

Specified by:
isAllowImageResize in interface AvatarManager
Returns:
true if the system should attempt to resize images

setAllowImageResize

public void setAllowImageResize(boolean isAllowImageResize)
                         throws UnauthorizedException
Description copied from interface: AvatarManager
Used to set whether the system should attempt to resize images

Specified by:
setAllowImageResize in interface AvatarManager
Parameters:
isAllowImageResize - whether the system should attempt to resize images
Throws:
UnauthorizedException - thrown if not system admin

isUserAvatarsEnabled

public boolean isUserAvatarsEnabled()
Description copied from interface: AvatarManager
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.

Specified by:
isUserAvatarsEnabled in interface AvatarManager
Returns:
true if custom user avatars are enabled, false otherwise

setUserAvatarsEnabled

public void setUserAvatarsEnabled(boolean enableCustomAvatars)
Description copied from interface: AvatarManager
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.

Specified by:
setUserAvatarsEnabled in interface AvatarManager
Parameters:
enableCustomAvatars - true if custom user avatars are enabled, false otherwise

getMaxUserAvatars

public int getMaxUserAvatars()
Description copied from interface: AvatarManager
Returns the maximum amount of avatars a user is allowed to have, -1 for limitless

Specified by:
getMaxUserAvatars in interface AvatarManager
Returns:
the maximum amount of avatars a user is allowed to have

setMaxUserAvatars

public void setMaxUserAvatars(int max)
                       throws UnauthorizedException
Description copied from interface: AvatarManager
Sets the maximum number of avatars a user can have

Specified by:
setMaxUserAvatars in interface AvatarManager
Parameters:
max - the maximum number of avatars a user can have
Throws:
UnauthorizedException - if not system admin

isModerateUserAvatars

public boolean isModerateUserAvatars()
Description copied from interface: AvatarManager
Returns whether or not user avatars will be moderated. The default value is true.

Specified by:
isModerateUserAvatars in interface AvatarManager
Returns:
true if user avatars will be moderated, false otherwise.

setModerateUserAvatars

public void setModerateUserAvatars(boolean moderateUserAvatars)
                            throws UnauthorizedException
Description copied from interface: AvatarManager
Sets whether or not user avatars will be moderated. The default value is true.

Specified by:
setModerateUserAvatars in interface AvatarManager
Parameters:
moderateUserAvatars - whether or not user avatars will be moderated
Throws:
UnauthorizedException - if not system admin

getModerationAvatars

public java.util.Iterator getModerationAvatars()
Description copied from interface: AvatarManager
Returns a collection of all of the avatars that require moderation.

Specified by:
getModerationAvatars in interface AvatarManager
Returns:
a collection of all of the avatars that require moderation.

getModerationAvatarCount

public int getModerationAvatarCount()
Description copied from interface: AvatarManager
Used to acquire a count of all the avatars that require moderation.

Specified by:
getModerationAvatarCount in interface AvatarManager
Returns:
the number avatars that require moderation.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.