|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.avatar.AvatarServiceImpl
public class AvatarServiceImpl
Implementation of the AvatarService.
Constructor Summary | |
---|---|
AvatarServiceImpl(UserManager userManager,
AvatarManager avatarManager,
UserPropertyManager userPropertyManager,
VelocityRequestContextFactory velocityRequestContextFactory,
ApplicationProperties applicationProperties)
|
Method Summary | |
---|---|
boolean |
canSetCustomUserAvatar(ApplicationUser remoteUser,
ApplicationUser user)
Returns a boolean indicating whether the calling user can edit the custom user avatar for the user with the given username. |
boolean |
canSetCustomUserAvatar(com.atlassian.crowd.embedded.api.User remoteUser,
String username)
Returns a boolean indicating whether the calling user can edit the custom user avatar for the user with the given username. |
protected boolean |
canViewAvatar(ApplicationUser user,
Avatar avatar)
Returns true if the passed in user has permission to view the passed in avatar. |
protected Long |
configuredAvatarIdFor(ApplicationUser user)
Returns the avatar id that is configured for the given User. |
protected static ApplicationUser |
fromStaleUser(com.atlassian.crowd.embedded.api.User user)
|
protected Avatar |
getAnonymousAvatar()
Returns the anonymous avatar, if configured. |
Avatar |
getAvatar(ApplicationUser remoteUser,
ApplicationUser avatarUser)
Returns the Avatar for the given user, if configured. |
Avatar |
getAvatar(com.atlassian.crowd.embedded.api.User remoteUser,
String username)
Returns the Avatar for the given user, if configured. |
URI |
getAvatarAbsoluteURL(ApplicationUser remoteUser,
ApplicationUser avatarUser,
Avatar.Size size)
This is the same as AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String, com.atlassian.jira.avatar.Avatar.Size)
but returns an absolute URL. |
URI |
getAvatarAbsoluteURL(com.atlassian.crowd.embedded.api.User remoteUser,
String username,
Avatar.Size size)
This is the same as AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String, com.atlassian.jira.avatar.Avatar.Size)
but returns an absolute URL. |
URI |
getAvatarURL(ApplicationUser remoteUser,
ApplicationUser avatarUser)
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 |
getAvatarURL(ApplicationUser remoteUser,
ApplicationUser avatarUser,
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 |
getAvatarURL(com.atlassian.crowd.embedded.api.User remoteUser,
String username)
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 |
getAvatarURL(com.atlassian.crowd.embedded.api.User remoteUser,
String username,
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(ApplicationUser avatarUser,
Avatar.Size size)
This is the same as AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String,
com.atlassian.jira.avatar.Avatar.Size) but does no permission checking. |
URI |
getAvatarUrlNoPermCheck(String username,
Avatar.Size size)
This is the same as AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String,
com.atlassian.jira.avatar.Avatar.Size) but does no permission checking. |
protected Avatar |
getDefaultAvatar()
Returns the default avatar, if configured. |
URI |
getProjectAvatarAbsoluteURL(Project project,
Avatar.Size size)
Returns the URL for the avatar of the given project. |
URI |
getProjectAvatarURL(Project project,
Avatar.Size size)
Returns the URL for the avatar of the given project. |
boolean |
hasCustomUserAvatar(ApplicationUser remoteUser,
ApplicationUser user)
Returns true if the user has configured a custom avatar, false otherwise. |
boolean |
hasCustomUserAvatar(com.atlassian.crowd.embedded.api.User remoteUser,
String username)
Returns true if the user has configured a custom avatar, false otherwise. |
boolean |
isGravatarEnabled()
Returns true if Gravatar support is enabled. |
protected void |
setConfiguredAvatarIdFor(ApplicationUser user,
Long avatarId)
Sets the given avatar id as the configured avatar id for a user. |
void |
setCustomUserAvatar(ApplicationUser remoteUser,
ApplicationUser user,
Long avatarId)
Sets a custom avatar for a given user. |
void |
setCustomUserAvatar(com.atlassian.crowd.embedded.api.User remoteUser,
String username,
Long avatarId)
Sets a custom avatar for a given user. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AvatarServiceImpl(UserManager userManager, AvatarManager avatarManager, UserPropertyManager userPropertyManager, VelocityRequestContextFactory velocityRequestContextFactory, ApplicationProperties applicationProperties)
Method Detail |
---|
protected static ApplicationUser fromStaleUser(com.atlassian.crowd.embedded.api.User user)
public Avatar getAvatar(com.atlassian.crowd.embedded.api.User remoteUser, String username) throws AvatarsDisabledException
AvatarService
getAvatar
in interface AvatarService
remoteUser
- the User that wants to view an Avatarusername
- a String containing a username (may have been deleted)
AvatarsDisabledException
- if avatars are disabledpublic Avatar getAvatar(ApplicationUser remoteUser, ApplicationUser avatarUser) throws AvatarsDisabledException
AvatarService
getAvatar
in interface AvatarService
remoteUser
- the User that wants to view an AvataravatarUser
- the User that the avatar will be returned for (if null it will return a default avatar if it's set or null)
AvatarsDisabledException
- if avatars are disabledpublic URI getAvatarURL(com.atlassian.crowd.embedded.api.User remoteUser, String username) throws AvatarsDisabledException
AvatarService
getAvatarURL
in interface AvatarService
remoteUser
- a User object for the currently logged in userusername
- a String containing a username (may have been deleted)
AvatarsDisabledException
- if avatars are disabledAvatarService.getAvatar(com.atlassian.crowd.embedded.api.User, String)
public URI getAvatarURL(ApplicationUser remoteUser, ApplicationUser avatarUser) throws AvatarsDisabledException
AvatarService
getAvatarURL
in interface AvatarService
remoteUser
- a User object for the currently logged in useravatarUser
- a User object to get the avatar for (if null, the default avatar is used)
AvatarsDisabledException
- if avatars are disabledAvatarService.getAvatar(com.atlassian.crowd.embedded.api.User, String)
public URI getAvatarURL(com.atlassian.crowd.embedded.api.User remoteUser, String username, Avatar.Size size) throws AvatarsDisabledException
AvatarService
getAvatarURL
in interface AvatarService
remoteUser
- a User object for the currently logged in userusername
- 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)
AvatarsDisabledException
- if avatars are disabledAvatarService.getAvatar(com.atlassian.crowd.embedded.api.User, String)
public URI getAvatarURL(ApplicationUser remoteUser, ApplicationUser avatarUser, Avatar.Size size) throws AvatarsDisabledException
AvatarService
getAvatarURL
in interface AvatarService
remoteUser
- a User object for the currently logged in useravatarUser
- a User to get the avatar for (if null, the default avatar is used)size
- the size of the avatar to be displayed (if null, the default size is used)
AvatarsDisabledException
- if avatars are disabledAvatarService.getAvatar(com.atlassian.crowd.embedded.api.User, String)
public URI getAvatarUrlNoPermCheck(String username, Avatar.Size size) throws AvatarsDisabledException
AvatarService
AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String,
com.atlassian.jira.avatar.Avatar.Size)
but does no permission checking.
getAvatarUrlNoPermCheck
in interface AvatarService
username
- 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)
AvatarsDisabledException
- if avatars are disabledpublic URI getAvatarUrlNoPermCheck(ApplicationUser avatarUser, Avatar.Size size) throws AvatarsDisabledException
AvatarService
AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String,
com.atlassian.jira.avatar.Avatar.Size)
but does no permission checking.
getAvatarUrlNoPermCheck
in interface AvatarService
avatarUser
- a String containing a username (if null, the default avatar is used)size
- the size of the avatar to be displayed (if null, the default size is used)
AvatarsDisabledException
- if avatars are disabledpublic URI getAvatarAbsoluteURL(com.atlassian.crowd.embedded.api.User remoteUser, String username, Avatar.Size size) throws AvatarsDisabledException
AvatarService
AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String, com.atlassian.jira.avatar.Avatar.Size)
but returns an absolute URL.
getAvatarAbsoluteURL
in interface AvatarService
AvatarsDisabledException
public URI getAvatarAbsoluteURL(ApplicationUser remoteUser, ApplicationUser avatarUser, Avatar.Size size) throws AvatarsDisabledException
AvatarService
AvatarService.getAvatarURL(com.atlassian.crowd.embedded.api.User, String, com.atlassian.jira.avatar.Avatar.Size)
but returns an absolute URL.
getAvatarAbsoluteURL
in interface AvatarService
AvatarsDisabledException
public boolean hasCustomUserAvatar(com.atlassian.crowd.embedded.api.User remoteUser, String username)
AvatarService
hasCustomUserAvatar
in interface AvatarService
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will check
public boolean hasCustomUserAvatar(ApplicationUser remoteUser, ApplicationUser user)
AvatarService
hasCustomUserAvatar
in interface AvatarService
remoteUser
- a User object for the currently logged in useruser
- the username of the user whose avatar we will check
public void setCustomUserAvatar(com.atlassian.crowd.embedded.api.User remoteUser, String username, Long avatarId) throws AvatarsDisabledException, NoPermissionException
AvatarService
setCustomUserAvatar
in interface AvatarService
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will configureavatarId
- the id of the avatar to configure for the user
AvatarsDisabledException
- if avatars are disabled
NoPermissionException
- if the remote user does not have permission to update the given user's avatarAvatarService.canSetCustomUserAvatar(com.atlassian.crowd.embedded.api.User, String)
public void setCustomUserAvatar(ApplicationUser remoteUser, ApplicationUser user, Long avatarId) throws AvatarsDisabledException, NoPermissionException
AvatarService
setCustomUserAvatar
in interface AvatarService
remoteUser
- a User object for the currently logged in useruser
- the user whose avatar we will configureavatarId
- the id of the avatar to configure for the user
AvatarsDisabledException
- if avatars are disabled
NoPermissionException
- if the remote user does not have permission to update the given user's avatarAvatarService.canSetCustomUserAvatar(com.atlassian.crowd.embedded.api.User, String)
public boolean canSetCustomUserAvatar(com.atlassian.crowd.embedded.api.User remoteUser, String username)
AvatarService
canSetCustomUserAvatar
in interface AvatarService
remoteUser
- a User object for the currently logged in userusername
- the username of the user whose avatar we will configure
public boolean canSetCustomUserAvatar(ApplicationUser remoteUser, ApplicationUser user)
AvatarService
canSetCustomUserAvatar
in interface AvatarService
remoteUser
- a User object for the currently logged in useruser
- the user whose avatar we will configure
public URI getProjectAvatarURL(Project project, Avatar.Size size)
AvatarService
getProjectAvatarURL
in interface AvatarService
project
- the Project of which to get the avatar URLsize
- the size of the avatar to be displayed (if null, the default size is used)
public URI getProjectAvatarAbsoluteURL(Project project, Avatar.Size size)
AvatarService
getProjectAvatarAbsoluteURL
in interface AvatarService
project
- the Project of which to get the avatar URLsize
- the size of the avatar to be displayed (if null, the default size is used)
protected Long configuredAvatarIdFor(ApplicationUser user)
user
- the user whose avatar we want
AvatarManager.getDefaultAvatarId(com.atlassian.jira.avatar.Avatar.Type)
,
AvatarManager.getAnonymousAvatarId()
public boolean isGravatarEnabled()
isGravatarEnabled
in interface AvatarService
protected void setConfiguredAvatarIdFor(ApplicationUser user, Long avatarId)
user
- the User whose avatar is being configuredavatarId
- the avatar id to configureprotected boolean canViewAvatar(ApplicationUser user, Avatar avatar)
user
- a Useravatar
- an Avatar
protected Avatar getDefaultAvatar()
protected Avatar getAnonymousAvatar()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |