/** * Calculate different between requests. * * @param oldRequest old request * @param newRequest new request * @return difference */ private NotificationClientSync diff(NotificationClientSync oldRequest, NotificationClientSync newRequest) { if (oldRequest == null) { return newRequest; } else { if ((newRequest.getAcceptedUnicastNotifications() != null && newRequest.getAcceptedUnicastNotifications().size() > 0) || (newRequest.getSubscriptionCommands() != null && newRequest.getSubscriptionCommands().size() > 0) || (newRequest.getTopicListHash() != oldRequest.getTopicListHash())) { return newRequest; } else { return null; } } }
/** * Calculate notification delta. * * @param appToken application token * @param context context * @param syncRequest the sync request * @return the gets the notification response */ private GetNotificationResponse calculateNotificationDelta(String appToken, NotificationClientSync syncRequest, SyncContext context) { GetNotificationRequest request = new GetNotificationRequest( syncRequest.getTopicListHash(), context.getEndpointProfile(), syncRequest.getSubscriptionCommands(), syncRequest.getAcceptedUnicastNotifications(), syncRequest.getTopicStates()); return notificationDeltaService.getNotificationDelta(request); }