Пример #1
0
  @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);
  }
    @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 onAnalysisParamValueSelected(AnalysisParamValueSelectedEvent event) {
    final AnalysisParameter value = event.getValue();

    if (!((Input.equals(value.getType())
        || FileInput.equals(value.getType())
        || FolderInput.equals(value.getType())
        || FileFolderInput.equals(value.getType())
        || MultiFileSelector.equals(value.getType())))) {
      return;
    }
    String infoType = value.getInfoType();
    if (infoType.equalsIgnoreCase("ReferenceGenome")
        || infoType.equalsIgnoreCase("ReferenceSequence")
        || infoType.equalsIgnoreCase("ReferenceAnnotation")) {
      return;
    }

    final File hasPath = factory.file().as();
    hasPath.setPath(value.getDisplayValue());
    final FastMap<TYPE> typeFastMap =
        diskResourceUtil.asStringPathTypeMap(Lists.newArrayList(hasPath), TYPE.FILE);
    diskResourceServiceAsyncProvider.get(
        new AsyncCallback<DiskResourceServiceFacade>() {
          @Override
          public void onFailure(Throwable caught) {
            ErrorHandler.post(caught);
          }

          @Override
          public void onSuccess(DiskResourceServiceFacade service) {
            service.getStat(
                typeFastMap, new GetStatCallback(value, eventBus, announcer, appearance));
          }
        });
  }