com.atlassian.jira.avatar
Interface AvatarService

All Known Implementing Classes:
AvatarServiceImpl

public interface AvatarService

Service for manipulating Avatar's.

Since:
v4.3

Method Summary
 Avatar getAvatar(com.atlassian.crowd.embedded.api.User remoteUser, String avatarUserId)
          Returns the Avatar for the given user, if configured.
 URI getAvatarURL(com.atlassian.crowd.embedded.api.User remoteUser, String avatarUserId, Avatar.Size size)
          Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser.
 URI getAvatarUrlNoPermCheck(String avatarUserId, Avatar.Size size)
          This is the same as getAvatarURL(com.atlassian.crowd.embedded.api.User, String, com.atlassian.jira.avatar.Avatar.Size) but does no permission checking.
 boolean isUserAvatarsEnabled()
          Returns a boolean indicating whether user Avatars are enabled.
 

Method Detail

isUserAvatarsEnabled

boolean isUserAvatarsEnabled()
Returns a boolean indicating whether user Avatars are enabled.

Returns:
true if user avatars are enabled, false otherwise

getAvatar

Avatar getAvatar(com.atlassian.crowd.embedded.api.User remoteUser,
                 String avatarUserId)
                 throws AvatarsDisabledException
Returns the Avatar for the given user, if configured. If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the default avatar. If the user does not exist, this method returns the anonymous avatar.

If this method would return the default user avatar but none is configured, or if this method would return the anonymous avatar but none is configured, this method returns null.

Parameters:
remoteUser - the User that wants to view an Avatar
avatarUserId - a String containing a username (may have been deleted)
Returns:
an Avatar, or null
Throws:
AvatarsDisabledException - if avatars are disabled

getAvatarURL

URI getAvatarURL(com.atlassian.crowd.embedded.api.User remoteUser,
                 String avatarUserId,
                 Avatar.Size size)
                 throws AvatarsDisabledException
Returns the URL for the avatar of the user having the given username for displaying on a page that should be shown for the passed in remoteUser.

If the user does not have a custom avatar, or if the calling user does not have permission to view the Avatar, this method returns the URL of the default avatar. If the user does not exist, this method returns the URL of the anonymous avatar.

Parameters:
remoteUser - a User object for the currently logged in user
avatarUserId - a String containing a username (may have been deleted)
size - the size of the avatar to be displayed (if null, the default size is used)
Returns:
a URL that can be used to display the avatar
Throws:
AvatarsDisabledException - if avatars are disabled
See Also:
getAvatar(com.atlassian.crowd.embedded.api.User, String)

getAvatarUrlNoPermCheck

URI getAvatarUrlNoPermCheck(String avatarUserId,
                            Avatar.Size size)
                            throws AvatarsDisabledException
This is the same as getAvatarURL(com.atlassian.crowd.embedded.api.User, String, com.atlassian.jira.avatar.Avatar.Size) but does no permission checking.

Throws:
AvatarsDisabledException


Copyright © 2002-2011 Atlassian. All Rights Reserved.