|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AvatarManager
Manager interface for Avatar
domain objects.
Field Summary | |
---|---|
static java.lang.String |
AVATAR_IMAGE_FORMAT
|
static AvatarSize |
LARGE
|
static AvatarSize |
SMALL
|
static java.lang.String |
USER_AVATAR_ID_KEY
|
Method Summary | |
---|---|
Avatar |
create(Avatar avatar)
Creates a database record for the given avatar. |
Avatar |
create(Avatar avatar,
java.io.InputStream image,
Selection selection)
Creates a database record for the given avatar and uses the content of the InputStream as the image. |
boolean |
delete(java.lang.Long avatarId)
Delete the avatar with the given id and the file on disk. |
boolean |
delete(java.lang.Long avatarId,
boolean alsoDeleteAvatarFile)
Delete the avatar with the given id. |
java.util.List<Avatar> |
getAllSystemAvatars(Avatar.Type type)
Provides a list of all system avatars. |
java.io.File |
getAvatarBaseDirectory()
Returns the directory for storing avatars. |
Avatar |
getById(java.lang.Long avatarId)
Retrieve the avatar with the given id. |
java.util.List<Avatar> |
getCustomAvatarsForOwner(Avatar.Type type,
java.lang.String ownerId)
Provides a list of all avatars that are of the given type which have the given owner. |
java.lang.Long |
getDefaultAvatarId(Avatar.Type ofType)
Gets the default avatar for the given type. |
boolean |
hasPermissionToEdit(com.opensymphony.user.User remoteUser,
Avatar.Type type,
java.lang.String ownerId)
Determines if the remoteUser provided has permission to edit avatars of a certain type for the owner provided. |
boolean |
hasPermissionToView(com.opensymphony.user.User remoteUser,
Avatar.Type type,
java.lang.String ownerId)
Determines if the remoteUser provided has permission to view avatars of a certain type for the owner provided. |
boolean |
isAvatarOwner(Avatar avatar,
java.lang.String owner)
Tells whether the given avatar is owned by the given owner. |
boolean |
isUserAvatarsEnabled()
Returns true if user avatars are enabled. |
void |
readLargeAvatarData(Avatar avatar,
Consumer<java.io.InputStream> dataAccessor)
Provides read-only access to the data of the large avatar image as an InputStream passed to the
provided dataProcessor. |
void |
readSmallAvatarData(Avatar avatar,
Consumer<java.io.InputStream> dataAccessor)
Provides read-only access to the data of the small avatar image as an InputStream passed to the
provided dataProcessor. |
void |
update(Avatar avatar)
Saves the avatar as an updated version of the avatar with the same id that is already in the database. |
Field Detail |
---|
static final AvatarSize LARGE
static final AvatarSize SMALL
static final java.lang.String AVATAR_IMAGE_FORMAT
static final java.lang.String USER_AVATAR_ID_KEY
Method Detail |
---|
Avatar getById(java.lang.Long avatarId) throws DataAccessException
avatarId
- must not be null.
DataAccessException
- if there is a back-end database problem.boolean delete(java.lang.Long avatarId) throws DataAccessException
avatarId
- must not be null.
DataAccessException
- if there is a back-end database problem.boolean delete(java.lang.Long avatarId, boolean alsoDeleteAvatarFile)
avatarId
- must not be null.alsoDeleteAvatarFile
- if false, the avatar file will be left on disk.
DataAccessException
- if there is a back-end database problem.void update(Avatar avatar) throws DataAccessException
avatar
- must not be null.
DataAccessException
- if there is a back-end database problem.@NotNull Avatar create(Avatar avatar) throws DataAccessException
avatar
- must not be null, must have a null id.
DataAccessException
- if there is a back-end database problem.@NotNull Avatar create(Avatar avatar, java.io.InputStream image, Selection selection) throws DataAccessException, java.io.IOException
avatar
- must not be null, must have a null id.image
- the data of the original avatar image.selection
- the cropping selection for the image or null to take whole image.
DataAccessException
- if there is a back-end database problem.
java.io.IOException
@NotNull java.util.List<Avatar> getAllSystemAvatars(Avatar.Type type) throws DataAccessException
type
- The type of system avatars to return
DataAccessException
- if there is a back-end database problem.@NotNull java.util.List<Avatar> getCustomAvatarsForOwner(Avatar.Type type, java.lang.String ownerId) throws DataAccessException
type
- the desired type of the avatars to retrieve.ownerId
- the id of the owner, matches the type.
DataAccessException
- if there is a back-end database problem.boolean isAvatarOwner(Avatar avatar, java.lang.String owner)
avatar
- the avatar to check, must not be null.owner
- the owner to check, must not be null.
void readLargeAvatarData(Avatar avatar, Consumer<java.io.InputStream> dataAccessor) throws java.io.IOException
InputStream
passed to the
provided dataProcessor. The InputStream is closed after the dataProcessor completes. The dataProcessor is
immediately invoked on the data for the avatar.
avatar
- the avatar for which the data is to be processed.dataAccessor
- something to read the data.
java.io.IOException
- if an IOException occurs in the dataProcessor or in acquiring the InputStream for the
avatar.void readSmallAvatarData(Avatar avatar, Consumer<java.io.InputStream> dataAccessor) throws java.io.IOException
InputStream
passed to the
provided dataProcessor. The InputStream is closed after the dataProcessor completes. The dataProcessor is
immediately invoked on the data for the avatar.
avatar
- the avatar for which the data is to be processed.dataAccessor
- something to read the data.
java.io.IOException
- if an IOException acquiring the InputStream for the avatar.@NotNull java.io.File getAvatarBaseDirectory()
@NotNull java.lang.Long getDefaultAvatarId(Avatar.Type ofType)
ofType
- the Avatar type.
boolean hasPermissionToView(com.opensymphony.user.User remoteUser, Avatar.Type type, java.lang.String ownerId)
remoteUser
- The remote user trying to view an avatartype
- The type of avatarownerId
- The owner id of the avatar being viewed
boolean hasPermissionToEdit(com.opensymphony.user.User remoteUser, Avatar.Type type, java.lang.String ownerId)
remoteUser
- The remote user trying to edit an avatartype
- The type of avatarownerId
- The owner id of the avatar being edited
boolean isUserAvatarsEnabled()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |