Search in sources :

Example 1 with RemoveNotificationRequest

use of com.cmput301w18t05.taskzilla.request.command.RemoveNotificationRequest in project Taskzilla by CMPUT301W18T05.

the class NotificationsController method removeAllNotificationRequest.

/**
 *  Removes all notifications from the elasticsearch server and clears arraylist containing all
 *  notifications
 */
public void removeAllNotificationRequest() {
    GetNotificationsByUserIdRequest request = new GetNotificationsByUserIdRequest(cUser.getId());
    RequestManager.getInstance().invokeRequest(request);
    for (Notification n : request.getResult()) {
        RemoveNotificationRequest removeNotificationRequest = new RemoveNotificationRequest(n.getId());
        RequestManager.getInstance().invokeRequest(removeNotificationRequest);
    }
    notificationList.clear();
    view.notifyChange();
}
Also used : GetNotificationsByUserIdRequest(com.cmput301w18t05.taskzilla.request.command.GetNotificationsByUserIdRequest) RemoveNotificationRequest(com.cmput301w18t05.taskzilla.request.command.RemoveNotificationRequest) Notification(com.cmput301w18t05.taskzilla.Notification)

Example 2 with RemoveNotificationRequest

use of com.cmput301w18t05.taskzilla.request.command.RemoveNotificationRequest in project Taskzilla by CMPUT301W18T05.

the class NotificationsController method removeNotificationRequest.

/**
 *  Removes notification user clicked on.
 *
 * @param id    Notification to be removed from elasticsearch server
 * @param pos   Position in arraylist containing the notification
 */
public void removeNotificationRequest(String id, Integer pos) {
    RemoveNotificationRequest request = new RemoveNotificationRequest(id);
    RequestManager.getInstance().invokeRequest(ctx, request);
    notificationList.remove(pos);
    view.notifyChange();
}
Also used : RemoveNotificationRequest(com.cmput301w18t05.taskzilla.request.command.RemoveNotificationRequest)

Aggregations

RemoveNotificationRequest (com.cmput301w18t05.taskzilla.request.command.RemoveNotificationRequest)2 Notification (com.cmput301w18t05.taskzilla.Notification)1 GetNotificationsByUserIdRequest (com.cmput301w18t05.taskzilla.request.command.GetNotificationsByUserIdRequest)1