default void getAllNotifications(NotificationType type, NotificationStatus status, OperationCallback callback) { if (type == NotificationType.LOCAL) { getAllLocalNotifications(status, callback); } else { getAllRemoteNotifications(status, callback); } }
@Override protected Void call() throws Exception { OperationCallback callback = new OperationCallback.Builder().onSuccess(o -> onNewNotificationsLoaded(o)).build(); notificationsManagement.getAllLocalNotifications(null, callback); return null; } };
/** * @{inheritedDoc} */ @Override protected void process() { super.process(); VLViewComponentXML root = getRootComponent(); String notifiableComponent = root.getPropertyValue("notifiableComponent"); if (StringUtils.isNotBlank(notifiableComponent)) { VLViewComponentXML notifiableComponentCgf = ComponentUtils.resolveDefinition(this, notifiableComponent).orElse(null); button = new SimpleCountableHyperlinkButton(); button.buildFrom(this, notifiableComponentCgf); processedView(button.getDisplay()); } String delegateId = getRootComponent().getPropertyValue("countDelegate"); button.countProperty().bind(newElementsCount); if (StringUtils.isNotBlank(delegateId)) { countDelegate = (INotificationsManagement) Services.getBean(delegateId); OperationCallback countCallback = new OperationCallback.Builder().onSuccess(this::onCountNewElementsSuccess).build(); countDelegate.getLocalElementsCount(NotificationStatus.NEW.status(), countCallback); countDelegate.getRemoteElementsCount(NotificationStatus.NEW.status(), countCallback); } }
private void handEvent(MarkAllNotificationsReadenEvent ev) { OperationCallback callback = new OperationCallback.Builder().onSuccess(this::onAllNotificationsMarkedAsReaden).build(); notificationsManagement.markAllReaden(callback); }
private void handEvent(DeleteAllNotificationsEvent ev) { OperationCallback callback = new OperationCallback.Builder().onSuccess(this::onAllNotificationsDeleted).build(); notificationsManagement.deleteAll(callback); }
private void delete() { OperationCallback callback = new OperationCallback.Builder().onSuccess(this::onDeleteSuccess).build(); notificationsManagement.delete(notification, callback); }
/** * @{inheritedDoc} */ @Override public synchronized <T extends GenericEvent> void handle(T e) { super.handle(e); if (e.isA(CoreEvent.NotificationEvent)) { NewNotificationEvent ev = (NewNotificationEvent) e; if (ev.getModel() instanceof Notification) { OperationCallback createCallback = new OperationCallback.Builder().onSuccess(this::onCreateSuccess).build(); countDelegate.create((Notification) ev.getModel(), createCallback); } } else if (e.isA(CoreEvent.NotificationDeletedEvent)) { NotificationDeletedEvent ev = (NotificationDeletedEvent) e; NotificationView nv = (NotificationView) ev.getModel(); if (nv.getNotification().getStatus() == NotificationStatus.NEW) { updateCount(-1); } } else if (e.isA(CoreEvent.AllNotificationsClearedEvent)) { Platform.runLater(() -> { newElementsCount.set(0); }); } }