Search in sources :

Example 1 with GetNotificationsRequest

use of com.willshex.blogwt.shared.api.notification.call.GetNotificationsRequest in project blogwt by billy1380.

the class NotificationJsonServlet method processAction.

@Override
protected String processAction(String action, JsonObject request) {
    String output = "null";
    if ("UpdateMetaNotification".equals(action)) {
        UpdateMetaNotificationRequest input = new UpdateMetaNotificationRequest();
        input.fromJson(request);
        output = new UpdateMetaNotificationActionHandler().handle(input).toString();
    } else if ("AddMetaNotification".equals(action)) {
        AddMetaNotificationRequest input = new AddMetaNotificationRequest();
        input.fromJson(request);
        output = new AddMetaNotificationActionHandler().handle(input).toString();
    } else if ("GetMetaNotification".equals(action)) {
        GetMetaNotificationRequest input = new GetMetaNotificationRequest();
        input.fromJson(request);
        output = new GetMetaNotificationActionHandler().handle(input).toString();
    } else if ("GetNotifications".equals(action)) {
        GetNotificationsRequest input = new GetNotificationsRequest();
        input.fromJson(request);
        output = new GetNotificationsActionHandler().handle(input).toString();
    } else if ("GetMetaNotifications".equals(action)) {
        GetMetaNotificationsRequest input = new GetMetaNotificationsRequest();
        input.fromJson(request);
        output = new GetMetaNotificationsActionHandler().handle(input).toString();
    } else if ("GetNotificationSettings".equals(action)) {
        GetNotificationSettingsRequest input = new GetNotificationSettingsRequest();
        input.fromJson(request);
        output = new GetNotificationSettingsActionHandler().handle(input).toString();
    } else if ("SendAdhocNotification".equals(action)) {
        SendAdhocNotificationRequest input = new SendAdhocNotificationRequest();
        input.fromJson(request);
        output = new SendAdhocNotificationActionHandler().handle(input).toString();
    } else if ("UpdateNotificationSettings".equals(action)) {
        UpdateNotificationSettingsRequest input = new UpdateNotificationSettingsRequest();
        input.fromJson(request);
        output = new UpdateNotificationSettingsActionHandler().handle(input).toString();
    } else if ("SetPushToken".equals(action)) {
        SetPushTokenRequest input = new SetPushTokenRequest();
        input.fromJson(request);
        output = new SetPushTokenActionHandler().handle(input).toString();
    }
    return output;
}
Also used : GetNotificationSettingsActionHandler(com.willshex.blogwt.server.api.notification.action.GetNotificationSettingsActionHandler) UpdateNotificationSettingsActionHandler(com.willshex.blogwt.server.api.notification.action.UpdateNotificationSettingsActionHandler) UpdateMetaNotificationActionHandler(com.willshex.blogwt.server.api.notification.action.UpdateMetaNotificationActionHandler) GetMetaNotificationsRequest(com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationsRequest) GetMetaNotificationActionHandler(com.willshex.blogwt.server.api.notification.action.GetMetaNotificationActionHandler) AddMetaNotificationActionHandler(com.willshex.blogwt.server.api.notification.action.AddMetaNotificationActionHandler) GetMetaNotificationRequest(com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationRequest) UpdateMetaNotificationRequest(com.willshex.blogwt.shared.api.notification.call.UpdateMetaNotificationRequest) SendAdhocNotificationActionHandler(com.willshex.blogwt.server.api.notification.action.SendAdhocNotificationActionHandler) GetNotificationsActionHandler(com.willshex.blogwt.server.api.notification.action.GetNotificationsActionHandler) GetMetaNotificationsActionHandler(com.willshex.blogwt.server.api.notification.action.GetMetaNotificationsActionHandler) GetNotificationSettingsRequest(com.willshex.blogwt.shared.api.notification.call.GetNotificationSettingsRequest) GetNotificationsRequest(com.willshex.blogwt.shared.api.notification.call.GetNotificationsRequest) SetPushTokenActionHandler(com.willshex.blogwt.server.api.notification.action.SetPushTokenActionHandler) UpdateNotificationSettingsRequest(com.willshex.blogwt.shared.api.notification.call.UpdateNotificationSettingsRequest) AddMetaNotificationRequest(com.willshex.blogwt.shared.api.notification.call.AddMetaNotificationRequest) SendAdhocNotificationRequest(com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationRequest) SetPushTokenRequest(com.willshex.blogwt.shared.api.notification.call.SetPushTokenRequest)

Example 2 with GetNotificationsRequest

use of com.willshex.blogwt.shared.api.notification.call.GetNotificationsRequest in project blogwt by billy1380.

the class NotificationService method getNotifications.

public Request getNotifications(GetNotificationsRequest input, AsyncSuccess<GetNotificationsRequest, GetNotificationsResponse> onSuccess, AsyncFailure<GetNotificationsRequest> onFailure) {
    Request handle = null;
    try {
        handle = sendRequest(NotificationMethodGetNotifications, input, new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                try {
                    GetNotificationsResponse outputParameter = new GetNotificationsResponse();
                    parseResponse(response, outputParameter);
                    if (onSuccess != null) {
                        onSuccess.call(input, outputParameter);
                    }
                    onCallSuccess(NotificationService.this, NotificationMethodGetNotifications, input, outputParameter);
                } catch (JSONException | HttpException exception) {
                    if (onFailure != null) {
                        onFailure.call(input, exception);
                    }
                    onCallFailure(NotificationService.this, NotificationMethodGetNotifications, input, exception);
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                if (onFailure != null) {
                    onFailure.call(input, exception);
                }
                onCallFailure(NotificationService.this, NotificationMethodGetNotifications, input, exception);
            }
        });
        onCallStart(NotificationService.this, NotificationMethodGetNotifications, input, handle);
    } catch (RequestException exception) {
        if (onFailure != null) {
            onFailure.call(input, exception);
        }
        onCallFailure(NotificationService.this, NotificationMethodGetNotifications, input, exception);
    }
    return handle;
}
Also used : GetMetaNotificationResponse(com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationResponse) GetMetaNotificationsResponse(com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationsResponse) UpdateNotificationSettingsResponse(com.willshex.blogwt.shared.api.notification.call.UpdateNotificationSettingsResponse) SetPushTokenResponse(com.willshex.blogwt.shared.api.notification.call.SetPushTokenResponse) AddMetaNotificationResponse(com.willshex.blogwt.shared.api.notification.call.AddMetaNotificationResponse) Response(com.google.gwt.http.client.Response) GetNotificationSettingsResponse(com.willshex.blogwt.shared.api.notification.call.GetNotificationSettingsResponse) GetNotificationsResponse(com.willshex.blogwt.shared.api.notification.call.GetNotificationsResponse) UpdateMetaNotificationResponse(com.willshex.blogwt.shared.api.notification.call.UpdateMetaNotificationResponse) SendAdhocNotificationResponse(com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationResponse) GetNotificationsResponse(com.willshex.blogwt.shared.api.notification.call.GetNotificationsResponse) RequestCallback(com.google.gwt.http.client.RequestCallback) UpdateNotificationSettingsRequest(com.willshex.blogwt.shared.api.notification.call.UpdateNotificationSettingsRequest) GetMetaNotificationRequest(com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationRequest) UpdateMetaNotificationRequest(com.willshex.blogwt.shared.api.notification.call.UpdateMetaNotificationRequest) GetMetaNotificationsRequest(com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationsRequest) SendAdhocNotificationRequest(com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationRequest) Request(com.google.gwt.http.client.Request) GetNotificationSettingsRequest(com.willshex.blogwt.shared.api.notification.call.GetNotificationSettingsRequest) GetNotificationsRequest(com.willshex.blogwt.shared.api.notification.call.GetNotificationsRequest) SetPushTokenRequest(com.willshex.blogwt.shared.api.notification.call.SetPushTokenRequest) AddMetaNotificationRequest(com.willshex.blogwt.shared.api.notification.call.AddMetaNotificationRequest) JSONException(com.google.gwt.json.client.JSONException) HttpException(com.willshex.gson.web.service.client.HttpException) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

AddMetaNotificationRequest (com.willshex.blogwt.shared.api.notification.call.AddMetaNotificationRequest)2 GetMetaNotificationRequest (com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationRequest)2 GetMetaNotificationsRequest (com.willshex.blogwt.shared.api.notification.call.GetMetaNotificationsRequest)2 GetNotificationSettingsRequest (com.willshex.blogwt.shared.api.notification.call.GetNotificationSettingsRequest)2 GetNotificationsRequest (com.willshex.blogwt.shared.api.notification.call.GetNotificationsRequest)2 SendAdhocNotificationRequest (com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationRequest)2 SetPushTokenRequest (com.willshex.blogwt.shared.api.notification.call.SetPushTokenRequest)2 UpdateMetaNotificationRequest (com.willshex.blogwt.shared.api.notification.call.UpdateMetaNotificationRequest)2 UpdateNotificationSettingsRequest (com.willshex.blogwt.shared.api.notification.call.UpdateNotificationSettingsRequest)2 Request (com.google.gwt.http.client.Request)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 JSONException (com.google.gwt.json.client.JSONException)1 AddMetaNotificationActionHandler (com.willshex.blogwt.server.api.notification.action.AddMetaNotificationActionHandler)1 GetMetaNotificationActionHandler (com.willshex.blogwt.server.api.notification.action.GetMetaNotificationActionHandler)1 GetMetaNotificationsActionHandler (com.willshex.blogwt.server.api.notification.action.GetMetaNotificationsActionHandler)1 GetNotificationSettingsActionHandler (com.willshex.blogwt.server.api.notification.action.GetNotificationSettingsActionHandler)1 GetNotificationsActionHandler (com.willshex.blogwt.server.api.notification.action.GetNotificationsActionHandler)1 SendAdhocNotificationActionHandler (com.willshex.blogwt.server.api.notification.action.SendAdhocNotificationActionHandler)1