com.atlassian.jira.rest.v2.issue
Class AvatarResourceHelper

java.lang.Object
  extended by com.atlassian.jira.rest.v2.issue.AvatarResourceHelper

public class AvatarResourceHelper
extends Object

A helper resource for Project and User avatars.

Since:
v5.0

Constructor Summary
AvatarResourceHelper(JiraAuthenticationContext authContext, AvatarManager avatarManager, AvatarPickerHelper avatarPickerHelper, AttachmentHelper attachmentHelper)
           
 
Method Summary
 javax.ws.rs.core.Response createAvatarFromTemporary(Avatar.Type type, String ownerId, AvatarCroppingBean croppingInstructions)
          Converts temporary avatar into a real avatar
 javax.ws.rs.core.Response cropTemporaryAvatar(Avatar.Type type, String ownerId, AvatarCroppingBean croppingInstructions)
           
 javax.ws.rs.core.Response deleteAvatar(Long id)
          Deletes avatar
 javax.ws.rs.core.Response getAllAvatars(Avatar.Type type, String ownerId, Long selectedAvatarId)
          Returns all avatars which are visible for the currently logged in user.
 javax.ws.rs.core.Response getAllSystemAvatars(Avatar.Type type)
          Returns all system avatars of the given type.
 javax.ws.rs.core.Response storeTemporaryAvatar(Avatar.Type type, 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(Avatar.Type type, String ownerId, com.atlassian.plugins.rest.common.multipart.FilePart filePart, javax.servlet.http.HttpServletRequest request)
          Creates temporary avatar using multipart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvatarResourceHelper

public AvatarResourceHelper(JiraAuthenticationContext authContext,
                            AvatarManager avatarManager,
                            AvatarPickerHelper avatarPickerHelper,
                            AttachmentHelper attachmentHelper)
Method Detail

getAllAvatars

public javax.ws.rs.core.Response getAllAvatars(Avatar.Type type,
                                               String ownerId,
                                               Long selectedAvatarId)
Returns all avatars which are visible for the currently logged in user.

Parameters:
type - - 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

public javax.ws.rs.core.Response getAllSystemAvatars(Avatar.Type type)
Returns all system avatars of the given type.

Parameters:
type - - Type of avatars (User or Project)
Returns:
all system avatars for the given type

createAvatarFromTemporary

public javax.ws.rs.core.Response createAvatarFromTemporary(Avatar.Type type,
                                                           String ownerId,
                                                           AvatarCroppingBean croppingInstructions)
Converts temporary avatar into a real avatar

Parameters:
type - - 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(Avatar.Type type,
                                                      String ownerId,
                                                      String filename,
                                                      Long size,
                                                      javax.servlet.http.HttpServletRequest request)
Creates temporary avatar and provides instructions for cropping (if needed)

Parameters:
type - - Type of avatars (User or Project)
ownerId - - (project id or username)
filename - - name of file being uploaded
size - - size of file
request - - servlet request
Returns:
temporary avatar cropping instructions

storeTemporaryAvatarUsingMultiPart

public javax.ws.rs.core.Response storeTemporaryAvatarUsingMultiPart(Avatar.Type type,
                                                                    String ownerId,
                                                                    com.atlassian.plugins.rest.common.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:
type - - Type of avatars (User or Project)
ownerId - - (project id or username)
filePart - - File body
request - - 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(Avatar.Type type,
                                                     String ownerId,
                                                     AvatarCroppingBean croppingInstructions)

deleteAvatar

public javax.ws.rs.core.Response deleteAvatar(Long id)
Deletes avatar

Parameters:
id - database id for avatar
Returns:
temporary avatar cropping instructions
Since:
v5.0


Copyright © 2002-2013 Atlassian. All Rights Reserved.