@Override public void onSuccess(final File file) { eventBus.fireEvent(new FileSavedEvent(file)); final Splittable annotatedFile = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(file)); StringQuoter.create(diskResourceUtil.parseParent(file.getPath())) .assign(annotatedFile, "parentFolderId"); StringQuoter.create(event.getPath()).assign(annotatedFile, "sourceUrl"); // Create notification message final Splittable message = StringQuoter.createSplittable(); StringQuoter.create("data").assign(message, "type"); String subject = file.getName().isEmpty() ? appearance.importFailed(event.getPath()) : appearance.fileUploadSuccess(file.getName()); StringQuoter.create(subject).assign(message, "subject"); StringQuoter.create(userInfo.getUsername()).assign(message, "user"); // Create Notification payload and attach message final Splittable payload = StringQuoter.createSplittable(); StringQuoter.create("file_uploaded").assign(payload, "action"); // Attach annotated file and notification message to payload annotatedFile.assign(payload, "data"); payload.assign(message, "payload"); final String notificationMsgPayload = message.getPayload(); userSessionService.postClientNotification( jsonUtil.getObject(notificationMsgPayload), new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { event.getHideable().hide(); announcer.schedule(new ErrorAnnouncementConfig(caught.getMessage())); } @Override public void onSuccess(String result) { event.getHideable().hide(); announcer.schedule( new SuccessAnnouncementConfig(appearance.importRequestSubmit(file.getName()))); } }); }
@Override public void markAsSeen(final List<HasId> seenIds, AsyncCallback<String> callback) { String address = deProperties.getMuleServiceBaseUrl() + "notifications/seen"; // $NON-NLS-1$ Splittable payload = StringQuoter.createSplittable(); diskResourceUtil.createStringIdListSplittable(seenIds).assign(payload, "uuids"); ServiceCallWrapper wrapper = new ServiceCallWrapper(POST, address, payload.getPayload()); deServiceFacade.getServiceData(wrapper, callback); }