Search in sources :

Example 1 with GetNotificationsByUserIdRequest

use of com.cmput301w18t05.taskzilla.request.command.GetNotificationsByUserIdRequest 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 GetNotificationsByUserIdRequest

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

the class NotificationsController method getNotificationsRequest.

/**
 * Sends a notification request to the manager which gets all notifications by userid
 */
public void getNotificationsRequest() {
    GetNotificationsByUserIdRequest request = new GetNotificationsByUserIdRequest(cUser.getId());
    RequestManager.getInstance().invokeRequest(ctx, request);
    notificationList.clear();
    notificationList.addAll(request.getResult());
    view.notifyChange();
}
Also used : GetNotificationsByUserIdRequest(com.cmput301w18t05.taskzilla.request.command.GetNotificationsByUserIdRequest)

Aggregations

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