Package com.atlassian.bamboo.avatar
Interface AvatarService
-
- All Known Implementing Classes:
AvatarServiceImpl
public interface AvatarService
- Since:
- 9.5
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deleteForUser(@NotNull String userName)
Delete the avatar associated with a user's name.void
deleteForUser(@NotNull Principal user)
Delete the avatar associated with a user.@Nullable CacheableAvatarSupplier
getForUser(@NotNull Principal user, int size)
Retrieves the current avatar for the specifieduser
.long
getMaxUploadSize()
Retrieves the maximum size, in bytes, for uploaded avatars.@NotNull CacheableAvatarSupplier
getUserDefault(int size)
Retrieves a stable default user avatar, suitable for display in anonymous contexts.boolean
isUserAvatarStored(@NotNull Principal user)
Checks whether the user has an avatar stored.void
moveForUser(@NotNull String oldUserName, @NotNull String newUserName)
Moves the avatar associated with a user to another user.void
saveForUser(@NotNull Principal user, @NotNull Supplier<AvatarSupplier> metaSupplier)
Saves the avatar contained in the providedavatarSupplier
obtained from the providedmetaSupplier
as the new avatar for the specifiedUser
, removing any previously-stored avatar.
-
-
-
Method Detail
-
getUserDefault
@NotNull @NotNull CacheableAvatarSupplier getUserDefault(int size)
Retrieves a stable default user avatar, suitable for display in anonymous contexts.- Parameters:
size
- the size to retrieve the avatar in- Returns:
- an
AvatarSupplier
which can be used to read the avatar
-
getForUser
@Nullable @Nullable CacheableAvatarSupplier getForUser(@NotNull @NotNull Principal user, int size)
Retrieves the current avatar for the specifieduser
. If no explicit avatar has been set, a null will be returned.- Parameters:
user
- the user to retrieve the avatar forsize
- the size to retrieve the avatar in- Returns:
- an
AvatarSupplier
which can be used to read the avatar
-
saveForUser
void saveForUser(@NotNull @NotNull Principal user, @NotNull @NotNull Supplier<AvatarSupplier> metaSupplier)
Saves the avatar contained in the providedavatarSupplier
obtained from the providedmetaSupplier
as the new avatar for the specifiedUser
, removing any previously-stored avatar.Previous avatars are not maintained. The only way to restore a previous avatar is to save it again.
- Parameters:
user
- the user whose avatar is being setmetaSupplier
- a supplier providing access to the new avatar to use
-
isUserAvatarStored
boolean isUserAvatarStored(@NotNull @NotNull Principal user)
Checks whether the user has an avatar stored.- Parameters:
user
- the user to check- Returns:
true
if the user's avatar is stored.
-
deleteForUser
void deleteForUser(@NotNull @NotNull Principal user)
Delete the avatar associated with a user.This will revert the avatar of the user in the UI to their Gravatar image (if the Gravatar integration is enabled) or to the default user avatar (if the Gravatar integration is disabled)
- Parameters:
user
- the user whose (local) avatar will be removed
-
deleteForUser
void deleteForUser(@NotNull @NotNull String userName)
Delete the avatar associated with a user's name.This will revert the avatar of the user in the UI to their Gravatar image (if the Gravatar integration is enabled) or to the default user avatar (if the Gravatar integration is disabled)
- Parameters:
userName
- the user's name whose (local) avatar will be removed
-
moveForUser
void moveForUser(@NotNull @NotNull String oldUserName, @NotNull @NotNull String newUserName)
Moves the avatar associated with a user to another user.- Parameters:
oldUserName
- the user whose avatar will be movednewUserName
- the user whose avatar will be replaced
-
getMaxUploadSize
long getMaxUploadSize()
Retrieves the maximum size, in bytes, for uploaded avatars. Avatars larger than this will be rejected by the server.- Returns:
- the maximum size, in bytes, for uploaded avatars
-
-