Package com.atlassian.jira.rest.v2.issue
Class AvatarResourceHelper
java.lang.Object
com.atlassian.jira.rest.v2.issue.AvatarResourceHelper
A helper resource for Project and User avatars.
- Since:
- v5.0
-
Constructor Summary
ConstructorsConstructorDescriptionAvatarResourceHelper
(JiraAuthenticationContext authContext, AvatarManager avatarManager, AvatarService avatarService, AvatarPickerHelper avatarPickerHelper, AttachmentHelper attachmentHelper, UserManager userManager) -
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
createAvatarFromTemporary
(IconType iconType, String ownerId, AvatarCroppingBean croppingInstructions) Converts temporary avatar into a real avatarjavax.ws.rs.core.Response
cropTemporaryAvatar
(IconType iconType, String ownerId, AvatarCroppingBean croppingInstructions) javax.ws.rs.core.Response
deleteAvatar
(Long id) Deletes avatargetAllAvatars
(IconType iconType, String ownerId, Long selectedAvatarId) Returns all avatars which are visible for the currently logged in user.javax.ws.rs.core.Response
getAllSystemAvatars
(IconType iconType) Returns all system avatars of the given type.javax.ws.rs.core.Response
storeTemporaryAvatar
(IconType iconType, String ownerId, String filename, Long size, javax.servlet.http.HttpServletRequest request) Creates temporary avatar and provides instructions for cropping (if needed)javax.ws.rs.core.Response
storeTemporaryAvatarUsingMultiPart
(IconType iconType, String ownerId, com.atlassian.plugins.rest.api.multipart.FilePart filePart, javax.servlet.http.HttpServletRequest request) Creates temporary avatar using multipart.
-
Constructor Details
-
AvatarResourceHelper
@Inject public AvatarResourceHelper(JiraAuthenticationContext authContext, AvatarManager avatarManager, AvatarService avatarService, AvatarPickerHelper avatarPickerHelper, AttachmentHelper attachmentHelper, UserManager userManager)
-
-
Method Details
-
getAllAvatars
public Map<String,List<AvatarBean>> getAllAvatars(IconType iconType, String ownerId, Long selectedAvatarId) Returns all avatars which are visible for the currently logged in user.- Parameters:
iconType
- - Type of avatars (User or Project)ownerId
- - (project id or username)selectedAvatarId
- - id of selected avatar- Returns:
- all avatars, system and custom for given type
-
getAllSystemAvatars
Returns all system avatars of the given type.- Parameters:
iconType
- - Type of avatars (User or Project)- Returns:
- all system avatars for the given type
-
createAvatarFromTemporary
public javax.ws.rs.core.Response createAvatarFromTemporary(IconType iconType, String ownerId, AvatarCroppingBean croppingInstructions) Converts temporary avatar into a real avatar- Parameters:
iconType
- - Type of avatars (User or Project)ownerId
- - (project id or username)croppingInstructions
- - Corrdinates to crop image- Returns:
- created avatar
- Since:
- v5.0
-
storeTemporaryAvatar
public javax.ws.rs.core.Response storeTemporaryAvatar(IconType iconType, String ownerId, String filename, Long size, javax.servlet.http.HttpServletRequest request) Creates temporary avatar and provides instructions for cropping (if needed)- Parameters:
iconType
- - Type of avatars (User or Project)ownerId
- - (project id or username)filename
- - name of file being uploadedsize
- - size of filerequest
- - servlet request- Returns:
- temporary avatar cropping instructions
-
storeTemporaryAvatarUsingMultiPart
public javax.ws.rs.core.Response storeTemporaryAvatarUsingMultiPart(IconType iconType, String ownerId, com.atlassian.plugins.rest.api.multipart.FilePart filePart, javax.servlet.http.HttpServletRequest request) Creates temporary avatar using multipart. The cropping instructions (or validation errors) are sent back as JSON stored in a textarea. This is because the client uses remote iframing to submit avatars using multipart. So we must send them a valid HTML page back from which the client parses the JSON.- Parameters:
iconType
- - Type of avatars (User or Project)ownerId
- - (project id or username)filePart
- - File bodyrequest
- - servlet request- Returns:
- html fragment that will be added to iframe (client will parse this out into JSON)
-
cropTemporaryAvatar
public javax.ws.rs.core.Response cropTemporaryAvatar(IconType iconType, String ownerId, AvatarCroppingBean croppingInstructions) -
deleteAvatar
Deletes avatar- Parameters:
id
- database id for avatar- Returns:
- temporary avatar cropping instructions
- Since:
- v5.0
-