Example #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())));
            }
          });
    }
  @UiHandler({"form0", "form1", "form2", "form3", "form4"})
  void onSubmitComplete(SubmitCompleteEvent event) {
    if (submittedForms.contains(event.getSource())) {
      submittedForms.remove(event.getSource());
      statList.get(formList.indexOf(event.getSource())).clearStatus("");
    }

    String results2 = event.getResults();
    String results = Format.stripTags(results2);
    Splittable split = StringQuoter.split(results);
    IPCFileUploadField field = fufList.get(formList.indexOf(event.getSource()));
    if (split.isUndefined("file") || (split.get("file") == null)) {
      field.markInvalid(I18N.ERROR.fileUploadFailed(field.getValue()));
      IplantAnnouncer.getInstance()
          .schedule(new ErrorAnnouncementConfig(I18N.ERROR.fileUploadFailed(field.getValue())));
    } else {
      eventBus.fireEvent(new FileUploadedEvent(uploadDest, field.getValue(), results));
    }

    if (submittedForms.size() == 0) {
      hide();
    }
  }
Example #4
0
  /** This method should be called when after okButton is clicked. */
  ArgumentValidator getArgumentValidator() {
    Splittable params = StringQuoter.createIndexed();

    switch (validatorTypeCB.getCurrentValue()) {
      case Regex:
        String regex = regexField.getCurrentValue();
        StringQuoter.create(regex).assign(params, 0);
        break;
      case CharacterLimit:
        int charLimit = charLimitField.getCurrentValue();
        StringQuoter.create(charLimit).assign(params, 0);
        break;

      case IntAbove:
        int intAbove = intAboveField.getCurrentValue();
        StringQuoter.create(intAbove).assign(params, 0);
        break;

      case IntBelow:
        int intBelow = intBelowField.getCurrentValue();
        StringQuoter.create(intBelow).assign(params, 0);
        break;
      case IntRange:
        int intRangeAbove = intRangeAboveField.getCurrentValue();
        int intRangeBelow = intRangeBelowField.getCurrentValue();
        StringQuoter.create(intRangeAbove).assign(params, 0);
        StringQuoter.create(intRangeBelow).assign(params, 1);
        break;

      case DoubleAbove:
        double dblAbove = dblAboveField.getCurrentValue();
        StringQuoter.create(dblAbove).assign(params, 0);
        break;
      case DoubleBelow:
        double dblBelow = dblBelowField.getCurrentValue();
        StringQuoter.create(dblBelow).assign(params, 0);
        break;

      case DoubleRange:
        double dblRangeAbove = dblRangeAboveField.getCurrentValue();
        double dblRangeBelow = dblRangeBelowField.getCurrentValue();
        StringQuoter.create(dblRangeAbove).assign(params, 0);
        StringQuoter.create(dblRangeBelow).assign(params, 1);
        break;
      default:
        break;
    }
    AutoBean<ArgumentValidator> avAutobean = factory.argumentValidator();
    avAutobean.as().setType(validatorTypeCB.getCurrentValue());
    avAutobean.as().setParams(params);

    // JDS Get the actual validator, and add it as metadata to the autobean.
    AbstractArgumentEditor.createAndAttachValidator(avAutobean.as());

    return avAutobean.as();
  }