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();
  }
  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;
    }

    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();
  }
Esempio n. 4
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();
  }
  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 (Const.isEmpty(wStepname.getText())) return;

    int nrheaders = wFields.nrNonEmpty();
    int nrparams = wParameters.nrNonEmpty();
    input.allocate(nrheaders, nrparams);

    if (isDebug())
      logDebug(
          BaseMessages.getString(
              PKG,
              "RestDialog.Log.FoundArguments",
              String.valueOf(nrheaders))); // $NON-NLS-1$ //$NON-NLS-2$
    for (int i = 0; i < nrheaders; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getHeaderField()[i] = item.getText(1);
      input.getHeaderName()[i] = item.getText(2);
    }
    for (int i = 0; i < nrparams; i++) {
      TableItem item = wParameters.getNonEmpty(i);
      input.getParameterField()[i] = item.getText(1);
      input.getParameterName()[i] = item.getText(2);
    }

    input.setDynamicMethod(wMethodInField.getSelection());
    input.setMethodFieldName(wMethodField.getText());
    input.setMethod(wMethod.getText());
    input.setUrl(wUrl.getText());
    input.setUrlField(wUrlField.getText());
    input.setUrlInField(wUrlInField.getSelection());
    input.setBodyField(wBody.getText());
    input.setFieldName(wResult.getText());
    input.setResultCodeFieldName(wResultCode.getText());
    input.setResponseTimeFieldName(wResponseTime.getText());

    input.setHttpLogin(wHttpLogin.getText());
    input.setHttpPassword(wHttpPassword.getText());
    input.setProxyHost(wProxyHost.getText());
    input.setProxyPort(wProxyPort.getText());
    input.setPreemptive(wPreemptive.getSelection());

    input.setTrustStoreFile(wTrustStoreFile.getText());
    input.setTrustStorePassword(wTrustStorePassword.getText());
    input.setApplicationType(wApplicationType.getText());
    stepname = wStepname.getText(); // return value

    dispose();
  }
  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
  }
  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);
  }
Esempio n. 9
0
  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();
  }
  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() {

    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 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());
  }
Esempio n. 13
0
  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 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), "");
    }
  }
Esempio n. 15
0
  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();
  }
    public void applyChanges() {

      int nrLines = wMappingParameters.nrNonEmpty();
      String variables[] = new String[nrLines];
      String inputFields[] = new String[nrLines];
      parameters.setVariable(variables);
      parameters.setInputField(inputFields);
      for (int i = 0; i < nrLines; i++) {
        TableItem item = wMappingParameters.getNonEmpty(i);
        parameters.getVariable()[i] = item.getText(1);
        parameters.getInputField()[i] = item.getText(2);
      }
      parameters.setInheritingAllVariables(wInheritAll.getSelection());
    }
Esempio n. 17
0
  private void getInfoArguments() {
    Map<String, String> map = new HashMap<String, String>();
    int nrNonEmptyArguments = wArguments.nrNonEmpty();
    for (int i = 0; i < nrNonEmptyArguments; i++) {
      TableItem tableItem = wArguments.getNonEmpty(i);
      String varName = tableItem.getText(1);
      String varValue = tableItem.getText(2);

      if (!Const.isEmpty(varName)) {
        map.put(varName, varValue);
      }
    }
    configuration.setArguments(map);
  }
  protected void getInfoVariables() {
    Map<String, String> map = new HashMap<String, String>();
    int nrNonEmptyVariables = wVariables.nrNonEmpty();
    for (int i = 0; i < nrNonEmptyVariables; i++) {
      TableItem tableItem = wVariables.getNonEmpty(i);
      String varName = tableItem.getText(1);
      String varValue = tableItem.getText(2);

      if (!Const.isEmpty(varName)) {
        map.put(varName, varValue);
      }
    }
    configuration.setVariables(map);
  }
Esempio n. 19
0
  private void getInfo(SapInputMeta meta) {
    meta.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
    meta.setFunction(function);

    // Grab the parameters...
    //
    meta.getParameters().clear();
    int nrParameters = wInput.nrNonEmpty();
    for (int i = 0; i < nrParameters; i++) {
      TableItem item = wInput.getNonEmpty(i);
      int colnr = 1;
      String fieldName = item.getText(colnr++);
      SapType sapType = SapType.findTypeForDescription(item.getText(colnr++));
      String tableName = item.getText(colnr++);
      String parameterName = item.getText(colnr++);
      int targetType = ValueMeta.getType(item.getText(colnr++));
      meta.getParameters()
          .add(new SapParameter(fieldName, sapType, tableName, parameterName, targetType));
    }

    // and the output fields.
    //
    meta.getOutputFields().clear();
    int nrFields = wOutput.nrNonEmpty();
    for (int i = 0; i < nrFields; i++) {
      TableItem item = wOutput.getNonEmpty(i);
      int colnr = 1;
      String sapFieldName = item.getText(colnr++);
      SapType sapType = SapType.findTypeForDescription(item.getText(colnr++));
      String tableName = item.getText(colnr++);
      String newName = item.getText(colnr++);
      int targetType = ValueMeta.getType(item.getText(colnr++));
      meta.getOutputFields()
          .add(new SapOutputField(sapFieldName, sapType, tableName, newName, targetType));
    }
  }
  private void getInfo(RandomCCNumberGeneratorMeta in) throws KettleException {

    stepname = wStepname.getText(); // return value
    int count = wFields.nrNonEmpty();
    in.allocate(count);

    for (int i = 0; i < count; i++) {
      TableItem item = wFields.getNonEmpty(i);
      in.getFieldCCType()[i] = item.getText(1);
      in.getFieldCCLength()[i] = item.getText(2);
      in.getFieldCCSize()[i] = item.getText(3);
    }
    in.setCardNumberFieldName(wCCNumberField.getText());
    in.setCardTypeFieldName(wCCTypeField.getText());
    in.setCardLengthFieldName(wCCLengthField.getText());
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    int nrfields = wFields.nrNonEmpty();
    input.allocate(nrfields);

    for (int i = 0; i < nrfields; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getCompareFields()[i] = item.getText(1);
    }

    stepname = wStepname.getText(); // return value
    input.setStoreValues(wStoreValues.getSelection());

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

    stepname = wStepname.getText(); // return value
    // Table table = wFields.table;

    int count = wFields.nrNonEmpty();
    input.allocate(count);

    for (int i = 0; i < count; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getFieldName()[i] = item.getText(1);
      input.getFieldValue()[i] = item.getText(2);
    }
    dispose();
  }
  private void ok() {
    if (Const.isEmpty(wName.getText())) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setText(Messages.getString("System.StepJobEntryNameMissing.Title"));
      mb.setMessage(Messages.getString("System.JobEntryNameMissing.Msg"));
      mb.open();
      return;
    }
    jobEntry.setName(wName.getText());

    jobEntry.setIncludeSubfolders(wIncludeSubfolders.getSelection());
    jobEntry.setArgFromPrevious(wPrevious.getSelection());

    jobEntry.setNrErrorsLessThan(wNrErrorsLessThan.getText());

    if (wSuccessCondition.getSelectionIndex() == 1)
      jobEntry.setSuccessCondition(jobEntry.SUCCESS_IF_AT_LEAST_X_FILES_WELL_FORMED);
    else if (wSuccessCondition.getSelectionIndex() == 2)
      jobEntry.setSuccessCondition(jobEntry.SUCCESS_IF_BAD_FORMED_FILES_LESS);
    else jobEntry.setSuccessCondition(jobEntry.SUCCESS_IF_NO_ERRORS);

    if (wAddFilenameToResult.getSelectionIndex() == 1)
      jobEntry.setResultFilenames(jobEntry.ADD_WELL_FORMED_FILES_ONLY);
    else if (wAddFilenameToResult.getSelectionIndex() == 2)
      jobEntry.setResultFilenames(jobEntry.ADD_BAD_FORMED_FILES_ONLY);
    else jobEntry.setResultFilenames(jobEntry.ADD_ALL_FILENAMES);

    int nritems = wFields.nrNonEmpty();
    int nr = 0;
    for (int i = 0; i < nritems; i++) {
      String arg = wFields.getNonEmpty(i).getText(1);
      if (arg != null && arg.length() != 0) nr++;
    }
    jobEntry.source_filefolder = new String[nr];
    jobEntry.wildcard = new String[nr];
    nr = 0;
    for (int i = 0; i < nritems; i++) {
      String source = wFields.getNonEmpty(i).getText(1);
      String wild = wFields.getNonEmpty(i).getText(2);
      if (source != null && source.length() != 0) {
        jobEntry.source_filefolder[nr] = source;
        jobEntry.wildcard[nr] = wild;
        nr++;
      }
    }
    dispose();
  }
  /** Get the parameters from the dialog. */
  protected void getInfoParameters() {
    Map<String, String> map = new HashMap<String, String>();
    int nrNonEmptyVariables = wParams.nrNonEmpty();
    for (int i = 0; i < nrNonEmptyVariables; i++) {
      TableItem tableItem = wParams.getNonEmpty(i);
      String paramName = tableItem.getText(1);
      String defaultValue = tableItem.getText(2);
      String paramValue = tableItem.getText(3);

      if (Const.isEmpty(paramValue)) {
        paramValue = Const.NVL(defaultValue, "");
      }

      map.put(paramName, paramValue);
    }
    configuration.setParams(map);
  }
  // Réinitialise la table des paramètres
  private void clearTables() {

    Table paramsTable = wParams.table;
    paramsTable.removeAll();

    if (wInputFormat.getText() != null && !wInputFormat.getText().isEmpty()) {

      String inputFormatKey = getFormatKey(wInputFormat.getText());

      int i = 0;
      for (GisInputFormatParameterDef parameterDef :
          input.getInputFormatDefs().get(inputFormatKey).getParameterDefs()) {

        TableItem tableItem = new TableItem(paramsTable, SWT.NONE);
        tableItem.setText(0, String.valueOf(i));
        tableItem.setText(1, getParamLabel(parameterDef.getKey()));
        tableItem.setText(
            2,
            BaseMessages.getString(
                PKG,
                "GisFileInput.Params.Required."
                    + String.valueOf(parameterDef.isRequired()).toUpperCase()
                    + ".Label"));
        String defaultValue = parameterDef.getDefaultValue();
        if (defaultValue != null && !defaultValue.isEmpty()) {

          String value = getParamValueLabel(parameterDef.getDefaultValue());
          tableItem.setText(3, value);
        }
        i++;
      }

      wParams.setRowNums();
      if (wParams.nrNonEmpty() > 0) {
        wlParams.setEnabled(true);
        wParams.setEnabled(true);
      } else {
        wlParams.setEnabled(false);
        wParams.setEnabled(false);
      }
    }

    wStepname.selectAll();
  }
  /** Called when the user confirms the dialog */
  private void ok() {
    // The "stepname" variable will be the return value for the open() method.
    // Setting to step name from the dialog control
    stepname = wStepname.getText();
    // Setting the  settings to the meta object
    meta.setConsecutiveDelimsAsOne(wRemoveBlanks.getSelection());
    int nrfields = wGroup.nrNonEmpty();
    meta.allocate(nrfields);
    for (int i = 0; i < nrfields; i++) {
      TableItem item = wGroup.getNonEmpty(i);
      meta.getSourceFields()[i] = item.getText(1);
      meta.getSourceDelims()[i] = item.getText(2);
      meta.getOutputFields()[i] = item.getText(3);
      meta.getOutputDelims()[i] = item.getText(4);
    }

    // close the SWT dialog window
    dispose();
  }
Esempio n. 27
0
  private void getInfo(FixedInputMeta fixedInputMeta) {

    fixedInputMeta.setFilename(wFilename.getText());
    fixedInputMeta.setLineWidth(wLineWidth.getText());
    fixedInputMeta.setBufferSize(wBufferSize.getText());
    fixedInputMeta.setLazyConversionActive(wLazyConversion.getSelection());
    fixedInputMeta.setHeaderPresent(wHeaderPresent.getSelection());
    fixedInputMeta.setLineFeedPresent(wLineFeedPresent.getSelection());
    fixedInputMeta.setRunningInParallel(wRunningInParallel.getSelection());
    fixedInputMeta.setFileType(FixedInputMeta.getFileType(wFileType.getText()));
    fixedInputMeta.setEncoding(wEncoding.getText());
    fixedInputMeta.setAddResultFile(wAddResult.getSelection());

    int nrNonEmptyFields = wFields.nrNonEmpty();
    fixedInputMeta.allocate(nrNonEmptyFields);

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

      FixedFileInputField field = new FixedFileInputField();

      field.setName(item.getText(colnr++));
      field.setType(ValueMetaFactory.getIdForValueMeta(item.getText(colnr++)));
      field.setFormat(item.getText(colnr++));
      field.setWidth(Const.toInt(item.getText(colnr++), -1));
      field.setLength(Const.toInt(item.getText(colnr++), -1));
      field.setPrecision(Const.toInt(item.getText(colnr++), -1));
      field.setCurrency(item.getText(colnr++));
      field.setDecimal(item.getText(colnr++));
      field.setGrouping(item.getText(colnr++));
      field.setTrimType(ValueMetaString.getTrimTypeByDesc(item.getText(colnr++)));

      // CHECKSTYLE:Indentation:OFF
      fixedInputMeta.getFieldDefinition()[i] = field;
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);

    fixedInputMeta.setChanged();
  }
Esempio n. 28
0
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    int i;

    int nrargs = wFields.nrNonEmpty();

    input.allocate(nrargs);

    logDebug(
        BaseMessages.getString(
            PKG,
            "DBProcDialog.Log.FoundArguments",
            String.valueOf(nrargs))); // $NON-NLS-1$ //$NON-NLS-2$
    for (i = 0; i < nrargs; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getArgument()[i] = item.getText(1);
      input.getArgumentDirection()[i] = item.getText(2);
      input.getArgumentType()[i] = ValueMeta.getType(item.getText(3));
    }

    input.setDatabase(transMeta.findDatabase(wConnection.getText()));
    input.setProcedure(wProcName.getText());
    input.setResultName(wResult.getText());
    input.setResultType(ValueMeta.getType(wResultType.getText()));
    input.setAutoCommit(wAutoCommit.getSelection());

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

    if (input.getDatabase() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(
              PKG, "DBProcDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$
      mb.setText(
          BaseMessages.getString(PKG, "DBProcDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$
      mb.open();
    }

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

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

    input.setTypeField(wTypefield.getText());

    int i;
    // Table table = wFields.table;

    int nrfields = wFields.nrNonEmpty();
    input.allocate(nrfields);

    for (i = 0; i < nrfields; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getFieldName()[i] = item.getText(1);
      input.getFieldValue()[i] = item.getText(2);
      input.getFieldNorm()[i] = item.getText(3);
    }

    dispose();
  }
    public void applyChanges() {

      // The input step
      definition.setInputStepname(wInputStep.getText());

      // The output step
      definition.setOutputStepname(wOutputStep.getText());

      // The description
      definition.setDescription(wDescription.getText());

      // The main path flag
      definition.setMainDataPath(wMainPath.getSelection());

      // The grid
      //
      int nrLines = wFieldMappings.nrNonEmpty();
      definition.getValueRenames().clear();
      for (int i = 0; i < nrLines; i++) {
        TableItem item = wFieldMappings.getNonEmpty(i);
        definition.getValueRenames().add(new MappingValueRename(item.getText(1), item.getText(2)));
      }
    }