Class AvatarResourceHelper

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

@Component public class AvatarResourceHelper extends Object
A helper resource for Project and User avatars.
Since:
v5.0
  • Constructor Details

  • 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

      public javax.ws.rs.core.Response getAllSystemAvatars(IconType iconType)
      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 uploaded
      size - - size of file
      request - - 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 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(IconType iconType, String ownerId, AvatarCroppingBean croppingInstructions)
    • deleteAvatar

      public javax.ws.rs.core.Response deleteAvatar(@PathParam("id") Long id)
      Deletes avatar
      Parameters:
      id - database id for avatar
      Returns:
      temporary avatar cropping instructions
      Since:
      v5.0