use of com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationRequest in project blogwt by billy1380.
the class NotificationService method sendAdhocNotification.
public Request sendAdhocNotification(SendAdhocNotificationRequest input, AsyncSuccess<SendAdhocNotificationRequest, SendAdhocNotificationResponse> onSuccess, AsyncFailure<SendAdhocNotificationRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(NotificationMethodSendAdhocNotification, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
SendAdhocNotificationResponse outputParameter = new SendAdhocNotificationResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(NotificationService.this, NotificationMethodSendAdhocNotification, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(NotificationService.this, NotificationMethodSendAdhocNotification, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(NotificationService.this, NotificationMethodSendAdhocNotification, input, exception);
}
});
onCallStart(NotificationService.this, NotificationMethodSendAdhocNotification, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(NotificationService.this, NotificationMethodSendAdhocNotification, input, exception);
}
return handle;
}
use of com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationRequest 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;
}
Aggregations