private void getInfo(LucidDBBulkLoaderMeta inf) {
    int nrfields = wReturn.nrNonEmpty();

    inf.allocate(nrfields);

    inf.setMaxErrors(Const.toInt(wMaxErrors.getText(), 0));

    logDebug(
        BaseMessages.getString(
            PKG,
            "LucidDBBulkLoaderDialog.Log.FoundFields",
            "" + nrfields)); // $NON-NLS-1$ //$NON-NLS-2$
    for (int i = 0; i < nrfields; i++) {
      TableItem item = wReturn.getNonEmpty(i);
      inf.getFieldTable()[i] = item.getText(1);
      inf.getFieldStream()[i] = item.getText(2);
      inf.getFieldFormatOk()[i] = "Y".equalsIgnoreCase(item.getText(3));
    }

    inf.setSchemaName(wSchema.getText());
    inf.setTableName(wTable.getText());
    inf.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
    inf.setFifoDirectory(wFifoPath.getText());
    inf.setFifoServerName(wFifoServer.getText());

    stepname = wStepname.getText(); // return value
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    int i;
    logDebug(
        BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.Log.GettingKeyInfo")); // $NON-NLS-1$

    wMaxErrors.setText("" + input.getMaxErrors()); // $NON-NLS-1$

    if (input.getFieldTable() != null) {
      for (i = 0; i < input.getFieldTable().length; i++) {
        TableItem item = wReturn.table.getItem(i);
        if (input.getFieldTable()[i] != null) item.setText(1, input.getFieldTable()[i]);
        if (input.getFieldStream()[i] != null) item.setText(2, input.getFieldStream()[i]);
        item.setText(3, input.getFieldFormatOk()[i] ? "Y" : "N");
      }
    }

    if (input.getDatabaseMeta() != null) wConnection.setText(input.getDatabaseMeta().getName());
    else {
      if (transMeta.nrDatabases() == 1) {
        wConnection.setText(transMeta.getDatabase(0).getName());
      }
    }
    if (input.getSchemaName() != null) wSchema.setText(input.getSchemaName());
    if (input.getTableName() != null) wTable.setText(input.getTableName());
    if (input.getFifoDirectory() != null) wFifoPath.setText(input.getFifoDirectory());
    if (input.getFifoServerName() != null) wFifoServer.setText(input.getFifoServerName());

    wStepname.selectAll();
    wReturn.setRowNums();
    wReturn.optWidth(true);
  }
  private void fillStoredData() {

    if (stepname != null) textStepName.setText(stepname);

    int index =
        addConnectionLine.indexOf(
            meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) addConnectionLine.select(index);

    if (meta.getDimension() != null) {
      comboDimension.add(meta.getDimension());
      comboDimension.select(0);
    }

    buttonBaseElementsOnly.setSelection(meta.getBaseElementsOnly());

    tableViewFields.table.removeAll();
    if (meta.getLevels().size() > 0) {
      for (PaloDimensionLevel level : meta.getLevels()) {
        tableViewFields.add(
            level.getLevelName(),
            String.valueOf(level.getLevelNumber()),
            level.getFieldName(),
            level.getFieldType());
      }
      tableViewFields.setRowNums();
      tableViewFields.optWidth(true);
    }
  }
  public void getInfo(SasInputMeta meta) throws KettleStepException {
    // copy info to Meta class (input)
    meta.setAcceptingField(wAccField.getText());

    int nrNonEmptyFields = wFields.nrNonEmpty();
    meta.getOutputFields().clear();

    for (int i = 0; i < nrNonEmptyFields; i++) {
      TableItem item = wFields.getNonEmpty(i);

      int colnr = 1;
      SasInputField field = new SasInputField();
      field.setName(item.getText(colnr++));
      field.setRename(item.getText(colnr++));
      if (Const.isEmpty(field.getRename())) {
        field.setRename(field.getName());
      }
      field.setType(ValueMeta.getType(item.getText(colnr++)));
      field.setConversionMask(item.getText(colnr++));
      field.setLength(Const.toInt(item.getText(colnr++), -1));
      field.setPrecision(Const.toInt(item.getText(colnr++), -1));
      field.setDecimalSymbol(item.getText(colnr++));
      field.setGroupingSymbol(item.getText(colnr++));
      field.setTrimType(ValueMeta.getTrimTypeByDesc(item.getText(colnr++)));

      meta.getOutputFields().add(field);
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    stepname = wStepname.getText(); // return value

    if (transMeta.findDatabase(wConnection.getText()) == null) {
      int answer = showDatabaseWarning(true);
      if (answer == SWT.CANCEL) {
        return;
      }
    }

    // check tablecount
    Set<String> tables = new HashSet<String>();
    int nrParameters = wOutput.nrNonEmpty();
    for (int i = 0; i < nrParameters; i++) {
      TableItem item = wOutput.getNonEmpty(i);
      String tableName = item.getText(3);
      tables.add(tableName);
    }
    if (tables.size() > 1) {
      int answer = showMultipleOutputTablesWarning(true);
      if (answer == SWT.CANCEL) {
        return;
      }
    }

    getInfo(input);

    dispose();
  }
 public void dispose() {
   props.setScreen(new WindowProperty(shell));
   bounds = shell.getBounds();
   hscroll = wFields.getHorizontalBar().getSelection();
   vscroll = wFields.getVerticalBar().getSelection();
   shell.dispose();
 }
Beispiel #7
0
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    int i;
    logDebug(BaseMessages.getString(PKG, "DBProcDialog.Log.GettingKeyInfo")); // $NON-NLS-1$

    if (input.getArgument() != null)
      for (i = 0; i < input.getArgument().length; i++) {
        TableItem item = wFields.table.getItem(i);
        if (input.getArgument()[i] != null) item.setText(1, input.getArgument()[i]);
        if (input.getArgumentDirection()[i] != null)
          item.setText(2, input.getArgumentDirection()[i]);
        item.setText(3, ValueMeta.getTypeDesc(input.getArgumentType()[i]));
      }

    if (input.getDatabase() != null) wConnection.setText(input.getDatabase().getName());
    else if (transMeta.nrDatabases() == 1) {
      wConnection.setText(transMeta.getDatabase(0).getName());
    }
    if (input.getProcedure() != null) wProcName.setText(input.getProcedure());
    if (input.getResultName() != null) wResult.setText(input.getResultName());
    wResultType.setText(ValueMeta.getTypeDesc(input.getResultType()));

    wAutoCommit.setSelection(input.isAutoCommit());

    wFields.setRowNums();
    wFields.optWidth(true);
    wStepname.selectAll();
  }
  private void ok() {

    stepname = wStepname.getText();

    String formatKey = getFormatKey(wInputFormat.getText());
    input.setInputFormat(formatKey);

    List<GisInputFormatParameter> inputFormatParameters = new ArrayList<GisInputFormatParameter>();
    for (int i = 0; i < wParams.nrNonEmpty(); i++) {

      TableItem tableItem = wParams.getNonEmpty(i);

      String paramKey = getParamKey(formatKey, tableItem.getText(1));

      if (tableItem.getText(3) != null && !tableItem.getText(3).isEmpty()) {
        String value = getParamValueKey(formatKey, paramKey, tableItem.getText(3));
        inputFormatParameters.add(new GisInputFormatParameter(paramKey, value));
      } else {
        inputFormatParameters.add(new GisInputFormatParameter(paramKey, ""));
      }
    }

    input.setInputFormatParameters(inputFormatParameters);
    input.setInputFileName(wFileName.getText());
    input.setGeometryFieldName(wGeometryField.getText());
    input.setEncoding(wEncoding.getText());
    input.setRowLimit(Long.valueOf(wRowLimit.getText()));
    dispose();
  }
  private void populateTableWithTupleTemplate() {
    Table table = m_fieldsView.table;

    Set<String> existingRowAliases = new HashSet<String>();
    for (int i = 0; i < table.getItemCount(); i++) {
      TableItem tableItem = table.getItem(i);
      String alias = tableItem.getText(1);
      if (!Const.isEmpty(alias)) {
        existingRowAliases.add(alias);
      }
    }

    int choice = 0;
    if (existingRowAliases.size() > 0) {
      // Ask what we should do with existing mapping data
      MessageDialog md =
          new MessageDialog(
              m_shell,
              Messages.getString("MappingDialog.GetFieldsChoice.Title"),
              null,
              Messages.getString(
                  "MappingDialog.GetFieldsChoice.Message", "" + existingRowAliases.size(), "" + 5),
              MessageDialog.WARNING,
              new String[] {
                Messages.getString("MappingOutputDialog.ClearAndAdd"),
                Messages.getString("MappingOutputDialog.Cancel"),
              },
              0);
      MessageDialog.setDefaultImage(GUIResource.getInstance().getImageSpoon());
      int idx = md.open();
      choice = idx & 0xFF;
    }

    if (choice == 1 || choice == 255 /* 255 = escape pressed */) {
      return; // Cancel
    }

    m_fieldsView.clearAll();
    TableItem item = new TableItem(table, SWT.NONE);
    item.setText(1, "KEY");
    item.setText(2, "Y");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Family");
    item.setText(2, "N");
    item.setText(5, "String");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Column");
    item.setText(2, "N");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Value");
    item.setText(2, "N");
    item = new TableItem(table, SWT.NONE);
    item.setText(1, "Timestamp");
    item.setText(2, "N");
    item.setText(5, "Long");

    m_fieldsView.removeEmptyRows();
    m_fieldsView.setRowNums();
    m_fieldsView.optWidth(true);
  }
  private void getInfo(IngresVectorwiseLoaderMeta input) {
    input.setDatabaseMeta(transMeta.findDatabase(serverConnection.getText()));
    input.setTablename(wTable.getText());
    input.setFifoFileName(wFifoFile.getText());
    input.setSqlPath(wSqlPath.getText());
    input.setUseSSV(wUseSSV.getSelection());
    input.setEscapingSpecialCharacters(wEscapeSpecialChars.getSelection());
    input.setUsingVwload(wUseVwload.getSelection());
    input.setUseAuthentication(wUseAuthentication.getSelection());
    input.setTruncatingTable(wTruncateTable.getSelection());
    input.setDelimiter(wDelimiter.getText());
    input.setEncoding(wCharSet.getText());
    input.setBufferSize(wBufferSize.getText());
    input.setUseStandardConversion(wUseStandardConversion.getSelection());
    input.setContinueOnError(wContinueOnError.getSelection());
    input.setErrorFileName(wErrorFile.getText());
    input.setUseDynamicVNode(wUseDynamicVNode.getSelection());
    input.setMaxNrErrors(wMaxErrors.getText());

    int nrRows = wFields.nrNonEmpty();
    input.allocate(nrRows);
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrRows; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getFieldDatabase()[i] = Const.NVL(item.getText(1), "");
      input.getFieldStream()[i] = Const.NVL(item.getText(2), "");
    }
  }
  private void ok() {
    if (Const.isEmpty(wName.getText())) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setText(BaseMessages.getString(PKG, "System.StepJobEntryNameMissing.Title"));
      mb.setMessage(BaseMessages.getString(PKG, "System.JobEntryNameMissing.Msg"));
      mb.open();
      return;
    }
    jobEntry.setName(wName.getText());

    int nritems = wFields.nrNonEmpty();

    jobEntry.connections = new DatabaseMeta[nritems];
    jobEntry.waitfors = new String[nritems];
    jobEntry.waittimes = new int[nritems];

    for (int i = 0; i < nritems; i++) {
      String arg = wFields.getNonEmpty(i).getText(1);
      DatabaseMeta dbMeta = jobMeta.findDatabase(arg);
      if (dbMeta != null) {
        jobEntry.connections[i] = dbMeta;
        jobEntry.waitfors[i] = "" + Const.toInt(wFields.getNonEmpty(i).getText(2), 0);
        jobEntry.waittimes[i] =
            JobEntryCheckDbConnections.getWaitTimeByDesc(wFields.getNonEmpty(i).getText(3));
      }
    }
    dispose();
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    stepname = wStepname.getText(); // return value
    // copy info to TextFileInputMeta class (input)
    input.setSql(wSQL.getText());
    input.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
    input.setExecutedEachInputRow(wEachRow.getSelection());
    input.setSingleStatement(wSingleStatement.getSelection());
    input.setVariableReplacementActive(wVariables.getSelection());
    input.setQuoteString(wQuoteString.getSelection());
    input.setParams(wSetParams.getSelection());
    input.setInsertField(wInsertField.getText());
    input.setUpdateField(wUpdateField.getText());
    input.setDeleteField(wDeleteField.getText());
    input.setReadField(wReadField.getText());

    int nrargs = wFields.nrNonEmpty();
    input.allocate(nrargs);
    if (log.isDebug())
      logDebug(BaseMessages.getString(PKG, "ExecSQLDialog.Log.FoundArguments", +nrargs + ""));
    for (int i = 0; i < nrargs; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getArguments()[i] = item.getText(1);
    }

    if (input.getDatabaseMeta() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(BaseMessages.getString(PKG, "ExecSQLDialog.InvalidConnection.DialogMessage"));
      mb.setText(BaseMessages.getString(PKG, "ExecSQLDialog.InvalidConnection.DialogTitle"));
      mb.open();
    }

    dispose();
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
    infoStreams.get(0).setStepMeta(transMeta.findStep(wReference.getText()));
    infoStreams.get(1).setStepMeta(transMeta.findStep(wCompare.getText()));
    input.setFlagField(wFlagfield.getText());

    int nrKeys = wKeys.nrNonEmpty();
    int nrValues = wValues.nrNonEmpty();

    input.allocate(nrKeys, nrValues);

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrKeys; i++) {
      TableItem item = wKeys.getNonEmpty(i);
      input.getKeyFields()[i] = item.getText(1);
    }

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrValues; i++) {
      TableItem item = wValues.getNonEmpty(i);
      input.getValueFields()[i] = item.getText(1);
    }

    stepname = wStepname.getText(); // return value

    dispose();
  }
Beispiel #14
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;
    stepname = wStepname.getText(); // return value

    input.setReplaceAllByValue(wReplaceByValue.getText());
    input.setReplaceAllMask(wMask.getText());

    input.setSelectFields(wSelectFields.getSelection());
    input.setSelectValuesType(wSelectValuesType.getSelection());

    int nrtypes = wValueTypes.nrNonEmpty();
    int nrfields = wFields.nrNonEmpty();
    input.allocate(nrtypes, nrfields);

    for (int i = 0; i < nrtypes; i++) {
      TableItem ti = wValueTypes.getNonEmpty(i);
      input.getTypeName()[i] = ti.getText(1);
      input.getTypeReplaceValue()[i] = ti.getText(2);
      input.getTypeReplaceMask()[i] = ti.getText(3);
    }

    for (int i = 0; i < nrfields; i++) {
      TableItem ti = wFields.getNonEmpty(i);
      input.getFieldName()[i] = ti.getText(1);
      input.getReplaceValue()[i] = ti.getText(2);
      input.getReplaceMask()[i] = ti.getText(3);
    }
    dispose();
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wStepname.setText(stepname);

    for (int i = 0; i < input.getFieldCCType().length; i++) {
      TableItem item = wFields.table.getItem(i);
      String type = input.getFieldCCType()[i];
      String len = input.getFieldCCLength()[i];
      String size = input.getFieldCCSize()[i];

      if (type != null) item.setText(1, type);
      if (len != null) item.setText(2, len);
      if (size != null) item.setText(3, size);
    }

    wFields.setRowNums();
    wFields.optWidth(true);

    if (input.getCardNumberFieldName() != null)
      wCCNumberField.setText(input.getCardNumberFieldName());
    if (input.getCardTypeFieldName() != null) wCCTypeField.setText(input.getCardTypeFieldName());
    if (input.getCardLengthFieldName() != null)
      wCCLengthField.setText(input.getCardLengthFieldName());

    wStepname.selectAll();
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    super.getData();

    hasOneTemporalField = ((LoadSatMeta) inputMeta).getFromDateColumn() != null;
    enableFields();

    if (inputMeta.getFields() != null) {
      for (int i = 0; i < inputMeta.getFields().length; i++) {
        TableItem item = wKey.table.getItem(i);
        if (inputMeta.getCols()[i] != null) {
          item.setText(1, inputMeta.getCols()[i]);
        }
        if (inputMeta.getFields()[i] != null) {
          item.setText(2, inputMeta.getFields()[i]);
        }
        if (inputMeta.getTypes()[i] != null) {
          item.setText(3, inputMeta.getTypes()[i]);
        }
      }
    }

    if (((LoadSatMeta) inputMeta).getToDateColumn() != null) {
      wcbToDateCol.setText(((LoadSatMeta) inputMeta).getToDateColumn());
    }
    if (((LoadSatMeta) inputMeta).getToDateMaxFlag() != null) {
      wToDateMax.setText(((LoadSatMeta) inputMeta).getToDateMaxFlag());
    }
    wbIsIdempotentSat.setSelection(((LoadSatMeta) inputMeta).isIdempotent());

    wKey.setRowNums();
    wKey.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
  private void ok() {
    stepname = wStepname.getText(); // return value

    input.setXslFilename(wXSLFilename.getText());
    input.setResultfieldname(wResultField.getText());
    input.setFieldname(wField.getText());
    input.setXSLFileField(wXSLField.getText());
    input.setXSLFactory(wXSLTFactory.getText());

    input.setXSLField(wXSLFileField.getSelection());
    input.setXSLFieldIsAFile(wXSLFieldIsAFile.getSelection());
    int nrparams = wFields.nrNonEmpty();
    int nroutputprops = wOutputProperties.nrNonEmpty();
    input.allocate(nrparams, nroutputprops);

    if (isDebug()) {
      logDebug(
          BaseMessages.getString(PKG, "HTTPDialog.Log.FoundArguments", String.valueOf(nrparams)));
    }
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrparams; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getParameterField()[i] = item.getText(1);
      input.getParameterName()[i] = item.getText(2);
    }
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nroutputprops; i++) {
      TableItem item = wOutputProperties.getNonEmpty(i);
      input.getOutputPropertyName()[i] = item.getText(1);
      input.getOutputPropertyValue()[i] = item.getText(2);
    }
    dispose();
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }

    int sizegroup = wGroup.nrNonEmpty();
    int nrfields = wAgg.nrNonEmpty();

    input.setAlwaysGivingBackOneRow(wAlwaysAddResult.getSelection());

    input.allocate(sizegroup, nrfields);

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < sizegroup; i++) {
      TableItem item = wGroup.getNonEmpty(i);
      input.getGroupField()[i] = item.getText(1);
    }

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrfields; i++) {
      TableItem item = wAgg.getNonEmpty(i);
      input.getAggregateField()[i] = item.getText(1);
      input.getSubjectField()[i] = item.getText(2);
      input.getAggregateType()[i] = MemoryGroupByMeta.getType(item.getText(3));
      input.getValueField()[i] = item.getText(4);
    }

    stepname = wStepname.getText();

    dispose();
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wAccField.setText(Const.NVL(input.getAcceptingField(), ""));

    for (int i = 0; i < input.getOutputFields().size(); i++) {
      SasInputField field = input.getOutputFields().get(i);

      TableItem item = new TableItem(wFields.table, SWT.NONE);
      int colnr = 1;
      item.setText(colnr++, Const.NVL(field.getName(), ""));
      item.setText(colnr++, Const.NVL(field.getRename(), ""));
      item.setText(colnr++, ValueMeta.getTypeDesc(field.getType()));
      item.setText(colnr++, Const.NVL(field.getConversionMask(), ""));
      item.setText(colnr++, field.getLength() >= 0 ? Integer.toString(field.getLength()) : "");
      item.setText(
          colnr++, field.getPrecision() >= 0 ? Integer.toString(field.getPrecision()) : "");
      item.setText(colnr++, Const.NVL(field.getDecimalSymbol(), ""));
      item.setText(colnr++, Const.NVL(field.getGroupingSymbol(), ""));
      item.setText(colnr++, Const.NVL(field.getTrimTypeDesc(), ""));
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
  private void getInfo(StepsMetricsMeta in) {
    stepname = wStepname.getText(); // return value
    int nrsteps = wFields.nrNonEmpty();
    in.allocate(nrsteps);
    for (int i = 0; i < nrsteps; i++) {
      TableItem ti = wFields.getNonEmpty(i);
      StepMeta tm = transMeta.findStep(ti.getText(1));
      // CHECKSTYLE:Indentation:OFF
      if (tm != null) {
        in.getStepName()[i] = tm.getName();
        in.getStepCopyNr()[i] = "" + Const.toInt(ti.getText(2), 0);
        in.getStepRequired()[i] = in.getRequiredStepsCode(ti.getText(3));
      }
    }

    in.setStepNameFieldName(wStepnameField.getText());
    in.setStepIdFieldName(wStepidField.getText());
    in.setStepLinesInputFieldName(wLinesinputField.getText());
    in.setStepLinesOutputFieldName(wLinesoutputField.getText());
    in.setStepLinesReadFieldName(wLinesreadField.getText());
    in.setStepLinesWrittenFieldName(wLineswrittenField.getText());
    in.setStepLinesUpdatedFieldName(wLinesupdatedField.getText());
    in.setStepLinesErrorsFieldName(wLineserrorsField.getText());
    in.setStepSecondsFieldName(wSecondsField.getText());
  }
  /**
   * This helper method puts the step configuration stored in the meta object and puts it into the
   * dialog controls.
   */
  private void populateDialog() {
    wRemoveBlanks.setSelection(meta.isConsecutiveDelimsAsOne());
    if (meta.getSourceFields() != null) {
      for (int i = 0; i < meta.getSourceFields().length; i++) {
        TableItem item = wGroup.table.getItem(i);
        if (meta.getSourceFields()[i] != null) {
          item.setText(1, meta.getSourceFields()[i]);
        }
        if (meta.getSourceDelims()[i] != null) {
          item.setText(2, meta.getSourceDelims()[i]);
        }
        if (meta.getOutputFields()[i] != null) {
          item.setText(3, meta.getOutputFields()[i]);
        }
        if (meta.getOutputDelims()[i] != null) {
          item.setText(4, meta.getOutputDelims()[i]);
        }
      }
    }

    wGroup.setRowNums();
    wGroup.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
  protected void getParamsData() {
    wParams.clearAll(false);
    ArrayList<String> paramNames = new ArrayList<String>(configuration.getParams().keySet());
    Collections.sort(paramNames);

    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = paramNames.get(i);
      String paramValue = configuration.getParams().get(paramName);
      String defaultValue;
      try {
        defaultValue = abstractMeta.getParameterDefault(paramName);
      } catch (UnknownParamException e) {
        defaultValue = "";
      }

      String description;
      try {
        description = abstractMeta.getParameterDescription(paramName);
      } catch (UnknownParamException e) {
        description = "";
      }

      TableItem tableItem = new TableItem(wParams.table, SWT.NONE);
      tableItem.setText(1, paramName);
      tableItem.setText(2, Const.NVL(defaultValue, ""));
      tableItem.setText(3, Const.NVL(paramValue, ""));
      tableItem.setText(4, Const.NVL(description, ""));
    }
    wParams.removeEmptyRows();
    wParams.setRowNums();
    wParams.optWidth(true);
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) {
      return;
    }
    stepname = wStepname.getText(); // return value

    input.setEmptyStringAll(wSetEmptyStringAll.getSelection());

    if (wSetEmptyStringAll.getSelection()) {
      input.setReplaceAllByValue("");
      input.setReplaceAllMask("");

    } else {
      input.setReplaceAllByValue(wReplaceByValue.getText());
      input.setReplaceAllMask(wMask.getText());
    }

    input.setSelectFields(wSelectFields.getSelection());
    input.setSelectValuesType(wSelectValuesType.getSelection());

    int nrtypes = wValueTypes.nrNonEmpty();
    int nrfields = wFields.nrNonEmpty();
    input.allocate(nrtypes, nrfields);

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrtypes; i++) {
      TableItem ti = wValueTypes.getNonEmpty(i);
      input.getValueTypes()[i].setTypeName(ti.getText(1));
      input.getValueTypes()[i].setTypeEmptyString(
          BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(ti.getText(4)));
      if (input.getValueTypes()[i].isSetTypeEmptyString()) {
        input.getValueTypes()[i].setTypereplaceValue("");
        input.getValueTypes()[i].setTypereplaceMask("");
      } else {
        input.getValueTypes()[i].setTypereplaceValue(ti.getText(2));
        input.getValueTypes()[i].setTypereplaceMask(ti.getText(3));
      }
    }

    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrfields; i++) {
      TableItem ti = wFields.getNonEmpty(i);
      input.getFields()[i].setFieldName(ti.getText(1));
      input.getFields()[i].setEmptyString(
          BaseMessages.getString(PKG, "System.Combo.Yes").equalsIgnoreCase(ti.getText(4)));
      if (input.getFields()[i].isSetEmptyString()) {
        input.getFields()[i].setReplaceValue("");
        input.getFields()[i].setReplaceMask("");
      } else {
        input.getFields()[i].setReplaceValue(ti.getText(2));
        input.getFields()[i].setReplaceMask(ti.getText(3));
      }
    }
    dispose();
  }
  private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
      return;
    }

    input.setMainStreamField(wMainStreamField.getText());
    input.setLookupField(wLookupField.getText());

    input.setAlgorithmType(FuzzyMatchMeta.getAlgorithmTypeByDesc(wAlgorithm.getText()));
    input.setCaseSensitive(wcaseSensitive.getSelection());
    input.setGetCloserValue(wgetCloserValue.getSelection());
    input.setMaximalValue(wmaxValue.getText());
    input.setMinimalValue(wminValue.getText());

    input.setOutputMatchField(wmatchField.getText());
    input.setOutputValueField(wvalueField.getText());
    input.setSeparator(wseparator.getText());

    int nrvalues = wReturn.nrNonEmpty();
    input.allocate(nrvalues);
    if (isDebug()) {
      logDebug(BaseMessages.getString(PKG, "FuzzyMatchDialog.Log.FoundFields", nrvalues + ""));
    }
    // CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrvalues; i++) {
      TableItem item = wReturn.getNonEmpty(i);
      input.getValue()[i] = item.getText(1);
      input.getValueName()[i] = item.getText(2);
      if (input.getValueName()[i] == null || input.getValueName()[i].length() == 0) {
        input.getValueName()[i] = input.getValue()[i];
      }
    }

    StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
    infoStream.setStepMeta(transMeta.findStep(wStep.getText()));
    if (infoStream.getStepMeta() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      if (Utils.isEmpty(wStep.getText())) {
        mb.setMessage(
            BaseMessages.getString(
                PKG, "FuzzyMatchDialog.NotStepSpecified.DialogMessage", wStep.getText()));
      } else {
        mb.setMessage(
            BaseMessages.getString(
                PKG, "FuzzyMatchDialog.StepCanNotFound.DialogMessage", wStep.getText()));
      }

      mb.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.StepCanNotFound.DialogTitle"));
      mb.open();
    }

    stepname = wStepname.getText(); // return value

    dispose();
  }
Beispiel #25
0
 private void activeFields() {
   wlFields.setEnabled(wSelectFields.getSelection());
   wFields.setEnabled(wSelectFields.getSelection());
   wGet.setEnabled(wSelectFields.getSelection());
   wlValueTypes.setEnabled(wSelectValuesType.getSelection());
   wValueTypes.setEnabled(wSelectValuesType.getSelection());
   wlReplaceByValue.setEnabled(!wSelectFields.getSelection() && !wSelectValuesType.getSelection());
   wReplaceByValue.setEnabled(!wSelectFields.getSelection() && !wSelectValuesType.getSelection());
   wlMask.setEnabled(!wSelectFields.getSelection() && !wSelectValuesType.getSelection());
   wMask.setEnabled(!wSelectFields.getSelection() && !wSelectValuesType.getSelection());
 }
 protected void ok() {
   setCheckboxFlag();
   if (Const.isOSX()) {
     // OSX bug workaround.
     wVariables.applyOSXChanges();
     wParams.applyOSXChanges();
   }
   getInfo();
   retval = true;
   dispose();
 }
 public void getDatabases() {
   wFields.removeAll();
   for (int i = 0; i < jobMeta.nrDatabases(); i++) {
     DatabaseMeta ci = jobMeta.getDatabase(i);
     if (ci != null) {
       wFields.add(new String[] {ci.getName(), "0", JobEntryCheckDbConnections.unitTimeDesc[0]});
     }
   }
   wFields.removeEmptyRows();
   wFields.setRowNums();
   wFields.optWidth(true);
 }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    if (isDebug()) {
      logDebug(BaseMessages.getString(PKG, "FuzzyMatchDialog.Log.GettingKeyInfo"));
    }

    wAlgorithm.setText(FuzzyMatchMeta.getAlgorithmTypeDesc(input.getAlgorithmType()));

    if (input.getMainStreamField() != null) {
      wMainStreamField.setText(input.getMainStreamField());
    }
    if (input.getLookupField() != null) {
      wLookupField.setText(input.getLookupField());
    }
    wcaseSensitive.setSelection(input.isCaseSensitive());
    wgetCloserValue.setSelection(input.isGetCloserValue());
    if (input.getMinimalValue() != null) {
      wminValue.setText(input.getMinimalValue());
    }
    if (input.getMaximalValue() != null) {
      wmaxValue.setText(input.getMaximalValue());
    }
    if (input.getOutputMatchField() != null) {
      wmatchField.setText(input.getOutputMatchField());
    }
    if (input.getOutputValueField() != null) {
      wvalueField.setText(input.getOutputValueField());
    }
    if (input.getSeparator() != null) {
      wseparator.setText(input.getSeparator());
    }

    if (input.getValue() != null) {
      for (int i = 0; i < input.getValue().length; i++) {
        TableItem item = wReturn.table.getItem(i);
        if (input.getValue()[i] != null) {
          item.setText(1, input.getValue()[i]);
        }
        if (input.getValueName()[i] != null
            && !input.getValueName()[i].equals(input.getValue()[i])) {
          item.setText(2, input.getValueName()[i]);
        }
      }
    }

    StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
    wStep.setText(Const.NVL(infoStream.getStepname(), ""));

    wReturn.setRowNums();
    wReturn.optWidth(true);

    wStepname.selectAll();
    wStepname.setFocus();
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wStoreValues.setSelection(input.getStoreValues());

    for (int i = 0; i < input.getCompareFields().length; i++) {
      TableItem item = wFields.table.getItem(i);
      if (input.getCompareFields()[i] != null) item.setText(1, input.getCompareFields()[i]);
    }
    wFields.setRowNums();
    wFields.optWidth(true);

    wStepname.selectAll();
  }
  public void setMapping(Mapping mapping) {
    if (mapping == null) {
      return;
    }

    m_fieldsView.clearAll();

    // do the key first
    TableItem keyItem = new TableItem(m_fieldsView.table, SWT.NONE);
    keyItem.setText(1, mapping.getKeyName());
    keyItem.setText(2, "Y");
    keyItem.setText(5, mapping.getKeyType().toString());
    if (mapping.isTupleMapping() && !Const.isEmpty(mapping.getTupleFamilies())) {
      keyItem.setText(3, mapping.getTupleFamilies());
    }

    // the rest of the fields in the mapping
    Map<String, HBaseValueMeta> mappedFields = mapping.getMappedColumns();
    for (String alias : mappedFields.keySet()) {
      HBaseValueMeta vm = mappedFields.get(alias);
      TableItem item = new TableItem(m_fieldsView.table, SWT.NONE);
      item.setText(1, alias);
      item.setText(2, "N");
      item.setText(3, vm.getColumnFamily());
      item.setText(4, vm.getColumnName());

      if (vm.isInteger()) {
        if (vm.getIsLongOrDouble()) {
          item.setText(5, "Long");
        } else {
          item.setText(5, "Integer");
        }
      } else if (vm.isNumber()) {
        if (vm.getIsLongOrDouble()) {
          item.setText(5, "Double");
        } else {
          item.setText(5, "Float");
        }
      } else {
        item.setText(5, vm.getTypeDesc());
      }

      if (vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_INDEXED) {
        item.setText(6, HBaseValueMeta.objectIndexValuesToString(vm.getIndex()));
      }
    }

    m_fieldsView.removeEmptyRows();
    m_fieldsView.setRowNums();
    m_fieldsView.optWidth(true);
  }