com.atlassian.mywork.host.rest
Class NotificationResource

java.lang.Object
  extended by com.atlassian.mywork.host.rest.NotificationResource

public class NotificationResource
extends java.lang.Object

This class provides a REST interface for NotificationService


Constructor Summary
NotificationResource(ClientService clientService, LocalNotificationService notificationService, com.atlassian.sal.api.user.UserManager userManager, UserService userMappingService)
           
 
Method Summary
 javax.ws.rs.core.Response createOrUpdate(javax.servlet.http.HttpServletRequest request, Notification notification, java.lang.String bypass)
          Creates or updates a notification.
 javax.ws.rs.core.Response delete(javax.servlet.http.HttpServletRequest request, long id)
          Deletes a notification permanently.
 javax.ws.rs.core.Response findById(javax.servlet.http.HttpServletRequest request, long id)
          Retrieve a specific notification.
 javax.ws.rs.core.Response findByUser(javax.servlet.http.HttpServletRequest request, long after, long before, int limit, java.lang.String bypass)
          Retrieve a list of notifications as a flat list.
 javax.ws.rs.core.Response findByUserNested(javax.servlet.http.HttpServletRequest request, long after, long before, int limit)
          Retrieve a list of nested notifications, aggregated by their groupingId.
 javax.ws.rs.core.Response setRead(javax.servlet.http.HttpServletRequest request, java.util.List<java.lang.Long> notificationId)
          Marks a list of notifications as read.
 javax.ws.rs.core.Response setRead(javax.servlet.http.HttpServletRequest request, java.lang.Long notificationId)
          Set the id of the last notification that has been seen.
 javax.ws.rs.core.Response setStatus(javax.servlet.http.HttpServletRequest request, long id, Status status)
          Changes the status of a notification.
 javax.ws.rs.core.Response updateMetadata(javax.servlet.http.HttpServletRequest request, UpdateMetadata metadata)
          Updates the metadata for any notification with a given globalId (and matching the provided condition).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationResource

public NotificationResource(ClientService clientService,
                            LocalNotificationService notificationService,
                            com.atlassian.sal.api.user.UserManager userManager,
                            UserService userMappingService)
Method Detail

findByUser

public javax.ws.rs.core.Response findByUser(@Context
                                            javax.servlet.http.HttpServletRequest request,
                                            long after,
                                            long before,
                                            int limit,
                                            java.lang.String bypass)
Retrieve a list of notifications as a flat list.

Parameters:
after - Optional notification id for returning only notifications created after the specified notification. This can be used to reduce both network traffic and seek time.
before - Optional notification id for returning only notifications created before the specified notification. This can be used to reduce both network traffic and seek time.
limit - Number of results to return, defaults to DEFAULT_LIMIT.
bypass - Optional username for allowing administrators to find notifications on behalf of other users.

findByUserNested

public javax.ws.rs.core.Response findByUserNested(@Context
                                                  javax.servlet.http.HttpServletRequest request,
                                                  long after,
                                                  long before,
                                                  int limit)
Retrieve a list of nested notifications, aggregated by their groupingId.

Parameters:
after - Optional notification id for returning only notifications created after the specified notification. This can be used to reduce both network traffic and seek time.
before - Optional notification id returning only notifications created before the specified notification. This can be used to reduce both network traffic and seek time.
limit - Number of results to return, defaults to DEFAULT_LIMIT.

findById

public javax.ws.rs.core.Response findById(@Context
                                          javax.servlet.http.HttpServletRequest request,
                                          long id)
Retrieve a specific notification.

Parameters:
id - Notification id

createOrUpdate

public javax.ws.rs.core.Response createOrUpdate(@Context
                                                javax.servlet.http.HttpServletRequest request,
                                                Notification notification,
                                                java.lang.String bypass)
                                         throws java.lang.Exception
Creates or updates a notification.

Parameters:
bypass - Optional username for allowing administrators to create notifications on behalf of other users.
Throws:
java.lang.Exception

delete

public javax.ws.rs.core.Response delete(@Context
                                        javax.servlet.http.HttpServletRequest request,
                                        long id)
Deletes a notification permanently.

Parameters:
id - Notification id

setRead

public javax.ws.rs.core.Response setRead(@Context
                                         javax.servlet.http.HttpServletRequest request,
                                         java.lang.Long notificationId)
Set the id of the last notification that has been seen. This determines the count of unread notifications that is shown.

Note that this distinct from the number of notifications that are "unread", which must be marked individually.


setRead

public javax.ws.rs.core.Response setRead(@Context
                                         javax.servlet.http.HttpServletRequest request,
                                         java.util.List<java.lang.Long> notificationId)
Marks a list of notifications as read.


setStatus

public javax.ws.rs.core.Response setStatus(@Context
                                           javax.servlet.http.HttpServletRequest request,
                                           long id,
                                           Status status)
Changes the status of a notification. If the status is being changed to Status.TODO this will result in a new task being created.

Parameters:
id - Notification that is being updated.

updateMetadata

public javax.ws.rs.core.Response updateMetadata(@Context
                                                javax.servlet.http.HttpServletRequest request,
                                                UpdateMetadata metadata)
                                         throws java.lang.Exception
Updates the metadata for any notification with a given globalId (and matching the provided condition).

Throws:
java.lang.Exception


Copyright © 2012 Atlassian. All Rights Reserved.