コード例 #1
0
  @Override
  public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
    Date startDate = new Date(0L);
    if (first) {
      first = false;
      try {
        startDate = getIncrementalFieldValue();
        if (startDate == null) {
          setOutputDone();
          return false;
        }
      } catch (KettleStepException e) {
        setErrors(1L);
        logError(e.getMessage());
        setOutputDone();
        return false;
      }
      if (data.rowMeta == null) {
        data.rowMeta = new RowMeta();
        data.rowMeta.addValueMeta(
            new ValueMetaInteger(environmentSubstitute(meta.getOutputFieldName())));
      }
    }

    switch (meta.getDownloadType()) {
      case TICKETS:
        for (Ticket ticket : data.conn.getTicketsIncrementally(startDate)) {
          putRow(data.rowMeta, processTicket(ticket));
          incrementLinesOutput();
        }
        break;
      case USERS:
        for (User user : data.conn.getUsersIncrementally(startDate)) {
          putRow(data.rowMeta, processUser(user));
          incrementLinesOutput();
        }
        break;
      case ORGANIZATIONS:
        for (Organization org : data.conn.getOrganizationsIncrementally(startDate)) {
          putRow(data.rowMeta, processOrganization(org));
          incrementLinesOutput();
        }
        break;
      case HELPCENTER_ARTICLES:
        for (Article article : data.conn.getArticlesIncrementally(startDate)) {
          putRow(data.rowMeta, processArticle(article));
        }
        break;
    }
    setOutputDone();
    return false;
  }
コード例 #2
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    try {
      stepname = wStepname.getText(); // return value
      getInfo(input);
    } catch (KettleStepException e) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(e.toString());
      mb.setText(BaseMessages.getString(PKG, "System.Warning"));
      mb.open();
    }
    dispose();
  }