Exemplo n.º 1
0
  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);
  }
  public void loadXML(
      Node entrynode,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers,
      Repository rep,
      IMetaStore metaStore)
      throws KettleXMLException {
    try {
      super.loadXML(entrynode, databases, slaveServers);
      String dbname = XMLHandler.getTagValue(entrynode, "connection");
      connection = DatabaseMeta.findDatabase(databases, dbname);
      schemaname = XMLHandler.getTagValue(entrynode, "schemaname");
      tablename = XMLHandler.getTagValue(entrynode, "tablename");
      successCondition =
          getSucessConditionByCode(
              Const.NVL(XMLHandler.getTagValue(entrynode, "success_condition"), ""));
      limit = Const.NVL(XMLHandler.getTagValue(entrynode, "limit"), "0");
      iscustomSQL = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "is_custom_sql"));
      isUseVars = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "is_usevars"));
      customSQL = XMLHandler.getTagValue(entrynode, "custom_sql");
      isAddRowsResult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "add_rows_result"));
      isClearResultList =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "clear_result_rows"));

    } catch (KettleException e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "JobEntryEvalTableContent.UnableLoadXML"), e);
    }
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();

    wReference.setText(Const.NVL(infoStreams.get(0).getStepname(), ""));
    wCompare.setText(Const.NVL(infoStreams.get(1).getStepname(), ""));
    if (input.getFlagField() != null) {
      wFlagfield.setText(input.getFlagField());
    }

    for (int i = 0; i < input.getKeyFields().length; i++) {
      TableItem item = wKeys.table.getItem(i);
      if (input.getKeyFields()[i] != null) {
        item.setText(1, input.getKeyFields()[i]);
      }
    }
    for (int i = 0; i < input.getValueFields().length; i++) {
      TableItem item = wValues.table.getItem(i);
      if (input.getValueFields()[i] != null) {
        item.setText(1, input.getValueFields()[i]);
      }
    }

    wStepname.selectAll();
    wStepname.setFocus();
  }
  private void getTableName() {
    DatabaseMeta inf = null;
    // New class: SelectTableDialog
    int connr = wConnection.getSelectionIndex();
    if (connr >= 0) inf = transMeta.getDatabase(connr);

    if (inf != null) {
      logDebug(
          BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.Log.LookingAtConnection")
              + inf.toString()); // $NON-NLS-1$

      DatabaseExplorerDialog std =
          new DatabaseExplorerDialog(shell, SWT.NONE, inf, transMeta.getDatabases());
      std.setSelectedSchemaAndTable(wSchema.getText(), wTable.getText());
      if (std.open()) {
        wSchema.setText(Const.NVL(std.getSchemaName(), ""));
        wTable.setText(Const.NVL(std.getTableName(), ""));
      }
    } else {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(
              PKG, "LucidDBBulkLoaderDialog.InvalidConnection.DialogMessage")); // $NON-NLS-1$
      mb.setText(
          BaseMessages.getString(
              PKG, "LucidDBBulkLoaderDialog.InvalidConnection.DialogTitle")); // $NON-NLS-1$
      mb.open();
    }
  }
  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), "");
    }
  }
Exemplo n.º 6
0
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    if (jobEntry.getName() != null) wName.setText(jobEntry.getName());
    wName.selectAll();
    if (jobEntry.getHostname() != null) wHostname.setText(jobEntry.getHostname());

    wPort.setText(Const.NVL(jobEntry.getPort(), String.valueOf(JobEntryTelnet.DEFAULT_PORT)));
    wTimeOut.setText(
        Const.NVL(jobEntry.getTimeOut(), String.valueOf(JobEntryTelnet.DEFAULT_TIME_OUT)));
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    if (jobEntry.getName() != null) wName.setText(jobEntry.getName());
    wName.selectAll();

    wFilename.setText(Const.NVL(jobEntry.getFilename(), ""));
    wMaximumTimeout.setText(Const.NVL(jobEntry.getMaximumTimeout(), ""));
    wCheckCycleTime.setText(Const.NVL(jobEntry.getCheckCycleTime(), ""));
    wSuccesOnTimeout.setSelection(jobEntry.isSuccessOnTimeout());
    wFileSizeCheck.setSelection(jobEntry.isFileSizeCheck());
    wAddFilenameResult.setSelection(jobEntry.isAddFilenameToResult());
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wName.setText(Const.NVL(jobEntry.getName(), ""));
    wMailAddress.setText(Const.NVL(jobEntry.getEmailAddress(), ""));
    wTimeOut.setText(Const.NVL(jobEntry.getTimeOut(), "0"));
    wSMTPCheck.setSelection(jobEntry.isSMTPCheck());
    wDefaultSMTP.setText(Const.NVL(jobEntry.getDefaultSMTP(), ""));
    weMailSender.setText(Const.NVL(jobEntry.geteMailSender(), ""));

    wName.selectAll();
    wName.setFocus();
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    int i;
    if (isDebug())
      logDebug(BaseMessages.getString(PKG, "RestDialog.Log.GettingKeyInfo")); // $NON-NLS-1$

    if (input.getHeaderName() != null) {
      for (i = 0; i < input.getHeaderName().length; i++) {
        TableItem item = wFields.table.getItem(i);
        if (input.getHeaderField()[i] != null) item.setText(1, input.getHeaderField()[i]);
        if (input.getHeaderName()[i] != null) item.setText(2, input.getHeaderName()[i]);
      }
    }

    if (input.getParameterField() != null) {
      for (i = 0; i < input.getParameterField().length; i++) {
        TableItem item = wParameters.table.getItem(i);
        if (input.getParameterField()[i] != null) item.setText(1, input.getParameterField()[i]);
        if (input.getParameterName()[i] != null) item.setText(2, input.getParameterName()[i]);
      }
    }

    wMethod.setText(Const.NVL(input.getMethod(), RestMeta.HTTP_METHOD_GET));
    wMethodInField.setSelection(input.isDynamicMethod());
    if (input.getBodyField() != null) wBody.setText(input.getBodyField());
    if (input.getMethodFieldName() != null) wMethodField.setText(input.getMethodFieldName());
    if (input.getUrl() != null) wUrl.setText(input.getUrl());
    wUrlInField.setSelection(input.isUrlInField());
    if (input.getUrlField() != null) wUrlField.setText(input.getUrlField());
    if (input.getFieldName() != null) wResult.setText(input.getFieldName());
    if (input.getResultCodeFieldName() != null) wResultCode.setText(input.getResultCodeFieldName());
    if (input.getResponseTimeFieldName() != null)
      wResponseTime.setText(input.getResponseTimeFieldName());

    if (input.getHttpLogin() != null) wHttpLogin.setText(input.getHttpLogin());
    if (input.getHttpPassword() != null) wHttpPassword.setText(input.getHttpPassword());
    if (input.getProxyHost() != null) wProxyHost.setText(input.getProxyHost());
    if (input.getProxyPort() != null) wProxyPort.setText(input.getProxyPort());
    wPreemptive.setSelection(input.isPreemptive());

    if (input.getTrustStoreFile() != null) wTrustStoreFile.setText(input.getTrustStoreFile());
    if (input.getTrustStorePassword() != null)
      wTrustStorePassword.setText(input.getTrustStorePassword());

    wApplicationType.setText(Const.NVL(input.getApplicationType(), ""));

    wFields.setRowNums();
    wFields.optWidth(true);
    wStepname.selectAll();
  }
  @Override
  protected void getInfo(SalesforceStepMeta in) throws KettleException {
    SalesforceDeleteMeta meta = (SalesforceDeleteMeta) in;
    stepname = wStepname.getText(); // return value

    // copy info to SalesforceDeleteMeta class (input)
    meta.setTargetURL(Const.NVL(wURL.getText(), SalesforceConnectionUtils.TARGET_DEFAULT_URL));
    meta.setUsername(wUserName.getText());
    meta.setPassword(wPassword.getText());
    meta.setModule(wModule.getText());
    meta.setDeleteField(wDeleteField.getText());
    meta.setBatchSize(wBatchSize.getText());
    meta.setCompression(wUseCompression.getSelection());
    meta.setTimeout(Const.NVL(wTimeOut.getText(), "0"));
    meta.setRollbackAllChangesOnError(wRollbackAllChangesOnError.getSelection());
  }
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String csize;
      String con = XMLHandler.getTagValue(stepnode, "connection");
      databaseMeta = DatabaseMeta.findDatabase(databases, con);
      csize = XMLHandler.getTagValue(stepnode, "commit");
      commitSize = Const.toInt(csize, 0);
      sqlField = XMLHandler.getTagValue(stepnode, "sql_field");

      insertField = XMLHandler.getTagValue(stepnode, "insert_field");
      updateField = XMLHandler.getTagValue(stepnode, "update_field");
      deleteField = XMLHandler.getTagValue(stepnode, "delete_field");
      readField = XMLHandler.getTagValue(stepnode, "read_field");
      sqlFromfile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "sqlFromfile"));

      sendOneStatement =
          "Y"
              .equalsIgnoreCase(
                  Const.NVL(XMLHandler.getTagValue(stepnode, "sendOneStatement"), "Y"));
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "ExecSQLRowMeta.Exception.UnableToLoadStepInfoFromXML"), e);
    }
  }
  public void loadRep(
      Repository rep,
      IMetaStore metaStore,
      ObjectId id_jobentry,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers)
      throws KettleException {
    try {
      connection =
          rep.loadDatabaseMetaFromJobEntryAttribute(
              id_jobentry, "connection", "id_database", databases);

      schemaname = rep.getJobEntryAttributeString(id_jobentry, "schemaname");
      tablename = rep.getJobEntryAttributeString(id_jobentry, "tablename");
      successCondition =
          getSuccessConditionByCode(
              Const.NVL(rep.getJobEntryAttributeString(id_jobentry, "success_condition"), ""));
      limit = rep.getJobEntryAttributeString(id_jobentry, "limit");
      iscustomSQL = rep.getJobEntryAttributeBoolean(id_jobentry, "is_custom_sql");
      isUseVars = rep.getJobEntryAttributeBoolean(id_jobentry, "is_usevars");
      isAddRowsResult = rep.getJobEntryAttributeBoolean(id_jobentry, "add_rows_result");
      isClearResultList = rep.getJobEntryAttributeBoolean(id_jobentry, "clear_result_rows");

      customSQL = rep.getJobEntryAttributeString(id_jobentry, "custom_sql");
    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          BaseMessages.getString(PKG, "JobEntryEvalTableContent.UnableLoadRep", "" + id_jobentry),
          dbe);
    }
  }
  @Override
  public void loadRep(
      Repository rep,
      IMetaStore metaStore,
      ObjectId id_jobentry,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers)
      throws KettleException {
    try {
      connection =
          rep.loadDatabaseMetaFromJobEntryAttribute(
              id_jobentry, "connection", "id_database", databases);

      schemaname = rep.getJobEntryAttributeString(id_jobentry, "schemaname");
      tablename = rep.getJobEntryAttributeString(id_jobentry, "tablename");
      successCondition =
          getSuccessConditionByCode(
              Const.NVL(rep.getJobEntryAttributeString(id_jobentry, "success_condition"), ""));
      rowsCountValue = rep.getJobEntryAttributeString(id_jobentry, "rows_count_value");
      iscustomSQL = rep.getJobEntryAttributeBoolean(id_jobentry, "is_custom_sql");
      isUseVars = rep.getJobEntryAttributeBoolean(id_jobentry, "is_usevars");
      isAddRowsResult = rep.getJobEntryAttributeBoolean(id_jobentry, "add_rows_result");
      customSQL = rep.getJobEntryAttributeString(id_jobentry, "custom_sql");
      maximumTimeout = rep.getJobEntryAttributeString(id_jobentry, "maximum_timeout");
      checkCycleTime = rep.getJobEntryAttributeString(id_jobentry, "check_cycle_time");
      successOnTimeout = rep.getJobEntryAttributeBoolean(id_jobentry, "success_on_timeout");
      isClearResultList = rep.getJobEntryAttributeBoolean(id_jobentry, "clear_result_rows");
    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          BaseMessages.getString(PKG, "JobEntryWaitForSQL.UnableLoadRep", "" + id_jobentry), dbe);
    }
  }
  /** Load the Database Info */
  public DatabaseMeta loadDatabaseMeta(ObjectId id_database) throws KettleException {
    DatabaseMeta databaseMeta = new DatabaseMeta();
    try {
      RowMetaAndData r = getDatabase(id_database);

      if (r != null) {
        ObjectId id_database_type =
            new LongObjectId(
                r.getInteger(
                    KettleDatabaseRepository.FIELD_DATABASE_ID_DATABASE_TYPE, 0)); // con_type
        String dbTypeDesc = getDatabaseTypeCode(id_database_type);
        if (dbTypeDesc != null) {
          databaseMeta.setDatabaseInterface(DatabaseMeta.getDatabaseInterface(dbTypeDesc));
          databaseMeta.setAttributes(new Properties()); // new attributes
        }

        databaseMeta.setObjectId(id_database);
        databaseMeta.setName(r.getString(KettleDatabaseRepository.FIELD_DATABASE_NAME, ""));

        ObjectId id_database_contype =
            new LongObjectId(
                r.getInteger(
                    KettleDatabaseRepository.FIELD_DATABASE_ID_DATABASE_CONTYPE, 0)); // con_access
        databaseMeta.setAccessType(
            DatabaseMeta.getAccessType(getDatabaseConTypeCode(id_database_contype)));

        databaseMeta.setHostname(
            r.getString(KettleDatabaseRepository.FIELD_DATABASE_HOST_NAME, ""));
        databaseMeta.setDBName(
            r.getString(KettleDatabaseRepository.FIELD_DATABASE_DATABASE_NAME, ""));
        databaseMeta.setDBPort(r.getString(KettleDatabaseRepository.FIELD_DATABASE_PORT, ""));
        databaseMeta.setUsername(r.getString(KettleDatabaseRepository.FIELD_DATABASE_USERNAME, ""));
        databaseMeta.setPassword(
            Encr.decryptPasswordOptionallyEncrypted(
                r.getString(KettleDatabaseRepository.FIELD_DATABASE_PASSWORD, "")));
        databaseMeta.setServername(
            r.getString(KettleDatabaseRepository.FIELD_DATABASE_SERVERNAME, ""));
        databaseMeta.setDataTablespace(
            r.getString(KettleDatabaseRepository.FIELD_DATABASE_DATA_TBS, ""));
        databaseMeta.setIndexTablespace(
            r.getString(KettleDatabaseRepository.FIELD_DATABASE_INDEX_TBS, ""));

        // Also, load all the properties we can find...
        final Collection<RowMetaAndData> attrs =
            repository.connectionDelegate.getDatabaseAttributes(id_database);
        for (RowMetaAndData row : attrs) {
          String code = row.getString(KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_CODE, "");
          String attribute =
              row.getString(KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_VALUE_STR, "");
          databaseMeta.getAttributes().put(code, Const.NVL(attribute, ""));
        }
      }

      return databaseMeta;
    } catch (KettleDatabaseException dbe) {
      throw new KettleException(
          "Error loading database connection from repository (id_database=" + id_database + ")",
          dbe);
    }
  }
 private String resolvePath(String rootPath, String entryPath) {
   String extraPath = Const.NVL(entryPath, "/");
   if (needToCheckPathForVariables()) {
     if (containsVariables(entryPath)) {
       return extraPath;
     }
   }
   String newPath = Const.NVL(rootPath, "/");
   if (newPath.endsWith("/") && extraPath.startsWith("/")) {
     newPath = newPath.substring(0, newPath.length() - 1);
   } else if (!newPath.endsWith("/") && !extraPath.startsWith("/")) {
     newPath += "/";
   } else if (extraPath.equals("/")) {
     extraPath = "";
   }
   return newPath + extraPath;
 }
  /**
   * Read the data from the TextFileInputMeta object and show it in this dialog.
   *
   * @param in The SalesforceDeleteMeta object to obtain the data from.
   */
  public void getData(SalesforceDeleteMeta in) {
    wURL.setText(Const.NVL(in.getTargetURL(), ""));
    wUserName.setText(Const.NVL(in.getUsername(), ""));
    wPassword.setText(Const.NVL(in.getPassword(), ""));
    wBatchSize.setText(in.getBatchSize());
    wModule.setText(Const.NVL(in.getModule(), "Account"));
    if (in.getDeleteField() != null) {
      wDeleteField.setText(in.getDeleteField());
    }
    wBatchSize.setText("" + in.getBatchSize());
    wTimeOut.setText(Const.NVL(in.getTimeout(), SalesforceConnectionUtils.DEFAULT_TIMEOUT));
    wUseCompression.setSelection(in.isCompression());
    wRollbackAllChangesOnError.setSelection(in.isRollbackAllChangesOnError());

    wStepname.selectAll();
    wStepname.setFocus();
  }
  /** 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();
  }
Exemplo n.º 18
0
  private void getArgumentsData() {
    wArguments.clearAll(false);

    List<String> argumentNames = new ArrayList<String>(configuration.getArguments().keySet());
    Collections.sort(argumentNames);

    for (int i = 0; i < argumentNames.size(); i++) {
      String argumentName = argumentNames.get(i);
      String argumentValue = configuration.getArguments().get(argumentName);

      TableItem tableItem = new TableItem(wArguments.table, SWT.NONE);
      tableItem.setText(1, Const.NVL(argumentName, ""));
      tableItem.setText(2, Const.NVL(argumentValue, ""));
    }
    wArguments.removeEmptyRows();
    wArguments.setRowNums();
    wArguments.optWidth(true);
  }
Exemplo n.º 19
0
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {

    if (input.getXslFilename() != null) {
      wXSLFilename.setText(input.getXslFilename());
    }
    if (input.getResultfieldname() != null) {
      wResultField.setText(input.getResultfieldname());
    }
    if (input.getFieldname() != null) {
      wField.setText(input.getFieldname());
    }

    if (input.getXSLFileField() != null) {
      wXSLField.setText(input.getXSLFileField());
    }

    wXSLFileField.setSelection(input.useXSLField());
    wXSLFieldIsAFile.setSelection(input.isXSLFieldIsAFile());

    if (input.getXSLFactory() != null) {
      wXSLTFactory.setText(input.getXSLFactory());
    } else {
      wXSLTFactory.setText("JAXP");
    }

    if (input.getParameterName() != null) {
      for (int i = 0; i < input.getParameterName().length; i++) {
        TableItem item = wFields.table.getItem(i);
        item.setText(1, Const.NVL(input.getParameterField()[i], ""));
        item.setText(2, Const.NVL(input.getParameterName()[i], ""));
      }
    }

    if (input.getOutputPropertyName() != null) {
      for (int i = 0; i < input.getOutputPropertyName().length; i++) {
        TableItem item = wOutputProperties.table.getItem(i);
        item.setText(1, Const.NVL(input.getOutputPropertyName()[i], ""));
        item.setText(2, Const.NVL(input.getOutputPropertyValue()[i], ""));
      }
    }

    wStepname.selectAll();
    wStepname.setFocus();
  }
 /* (non-Javadoc)
  * @see org.pentaho.di.repository.RepositoryMeta#loadXML(org.w3c.dom.Node, java.util.List)
  */
 public void loadXML(Node repnode, List<DatabaseMeta> databases) throws KettleException {
   try {
     // Fix for PDI-2508: migrating from 3.2 to 4.0 causes NPE on startup.
     id = Const.NVL(XMLHandler.getTagValue(repnode, "id"), id);
     name = XMLHandler.getTagValue(repnode, "name");
     description = XMLHandler.getTagValue(repnode, "description");
   } catch (Exception e) {
     throw new KettleException("Unable to load repository meta object", e);
   }
 }
Exemplo n.º 21
0
 private void getByReferenceData(ObjectId transObjectId) {
   try {
     RepositoryObject transInf =
         rep.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
     String fullPath =
         Const.NVL(transInf.getRepositoryDirectory().getPath(), "")
             + "/"
             + Const.NVL(transInf.getName(), "");
     wPath.setText(fullPath);
   } catch (KettleException e) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(
             PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Title"),
         BaseMessages.getString(
             PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Message"),
         e);
   }
 }
  private void getTableName() {
    // New class: SelectTableDialog
    int connr = wConnection.getSelectionIndex();
    if (connr >= 0) {
      DatabaseMeta inf = transMeta.getDatabase(connr);

      DatabaseExplorerDialog std =
          new DatabaseExplorerDialog(shell, SWT.NONE, inf, transMeta.getDatabases());
      std.setSelectedSchemaAndTable(wSchemaname.getText(), wTablenameText.getText());
      if (std.open()) {
        wSchemaname.setText(Const.NVL(std.getSchemaName(), ""));
        wTablenameText.setText(Const.NVL(std.getTableName(), ""));
      }
    } else {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(PKG, "ColumnExistsDialog.ConnectionError2.DialogMessage"));
      mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
      mb.open();
    }
  }
Exemplo n.º 23
0
  /** 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();
  }
  public void getData() {
    wName.setText(Const.NVL(slaveServer.getName(), ""));
    wHostname.setText(Const.NVL(slaveServer.getHostname(), ""));
    wPort.setText(Const.NVL(slaveServer.getPort(), ""));
    wWebAppName.setText(Const.NVL(slaveServer.getWebAppName(), ""));
    wUsername.setText(Const.NVL(slaveServer.getUsername(), ""));
    wPassword.setText(Const.NVL(slaveServer.getPassword(), ""));

    wProxyHost.setText(Const.NVL(slaveServer.getProxyHostname(), ""));
    wProxyPort.setText(Const.NVL(slaveServer.getProxyPort(), ""));
    wNonProxyHosts.setText(Const.NVL(slaveServer.getNonProxyHosts(), ""));

    wMaster.setSelection(slaveServer.isMaster());

    wSSL.setSelection(slaveServer.isSslMode());

    wName.setFocus();
  }
Exemplo n.º 25
0
  public void readRep(
      Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleException {
    try {

      int nrkeys = rep.countNrStepAttributes(id_step, "in_stream_name"); // $NON-NLS-1$

      allocate(nrkeys);
      for (int i = 0; i < nrkeys; i++) {
        fieldInStream[i] =
            Const.NVL(rep.getStepAttributeString(id_step, i, "in_stream_name"), ""); // $NON-NLS-1$
        fieldOutStream[i] =
            Const.NVL(rep.getStepAttributeString(id_step, i, "out_stream_name"), "");
        cutFrom[i] =
            Const.NVL(rep.getStepAttributeString(id_step, i, "cut_from"), ""); // $NON-NLS-1$
        cutTo[i] = Const.NVL(rep.getStepAttributeString(id_step, i, "cut_to"), ""); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "StringCutMeta.Exception.UnexpectedErrorInReadingStepInfo"),
          e); //$NON-NLS-1$
    }
  }
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute(id_step, "id_connection", databases);
      tablename = rep.getStepAttributeString(id_step, "table");
      fifoFileName = rep.getStepAttributeString(id_step, "fifo_file_name");
      sqlPath = rep.getStepAttributeString(id_step, "sql_path");
      encoding = rep.getStepAttributeString(id_step, "encoding");
      delimiter = rep.getStepAttributeString(id_step, "delimiter");
      continueOnError = rep.getStepAttributeBoolean(id_step, "continue_on_error");
      errorFileName = rep.getStepAttributeString(id_step, "error_file_name");
      useStandardConversion = rep.getStepAttributeBoolean(id_step, "use_standard_conversion");
      useAuthentication = rep.getStepAttributeBoolean(id_step, "use_authentication");
      useDynamicVNode = rep.getStepAttributeBoolean(id_step, "use_dynamic_vnode");
      useSSV = rep.getStepAttributeBoolean(id_step, "use_SSV_delimiter");
      escapingSpecialCharacters =
          rep.getStepAttributeBoolean(id_step, 0, "escape_special_characters", true);
      usingVwload = rep.getStepAttributeBoolean(id_step, "use_vwload");
      maxNrErrors = rep.getStepAttributeString(id_step, "max_errors");
      truncatingTable = rep.getStepAttributeBoolean(id_step, "truncate_table");
      bufferSize = rep.getStepAttributeString(id_step, "buffer_size");

      int nrCols = rep.countNrStepAttributes(id_step, "column_name");
      int nrStreams = rep.countNrStepAttributes(id_step, "stream_name");

      int nrRows = (nrCols < nrStreams ? nrStreams : nrCols);
      allocate(nrRows);

      for (int idx = 0; idx < nrRows; idx++) {
        fieldDatabase[idx] = Const.NVL(rep.getStepAttributeString(id_step, idx, "column_name"), "");
        fieldStream[idx] = Const.NVL(rep.getStepAttributeString(id_step, idx, "stream_name"), "");
      }
    } catch (Exception e) {
      throw new KettleException("Unexpected error reading step information from the repository", e);
    }
  }
Exemplo n.º 27
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      int nrkeys;

      Node lookup = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      nrkeys = XMLHandler.countNodes(lookup, "field"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(lookup, "field", i); // $NON-NLS-1$
        fieldInStream[i] =
            Const.NVL(XMLHandler.getTagValue(fnode, "in_stream_name"), ""); // $NON-NLS-1$
        fieldOutStream[i] =
            Const.NVL(XMLHandler.getTagValue(fnode, "out_stream_name"), ""); // $NON-NLS-1$
        cutFrom[i] = Const.NVL(XMLHandler.getTagValue(fnode, "cut_from"), ""); // $NON-NLS-1$
        cutTo[i] = Const.NVL(XMLHandler.getTagValue(fnode, "cut_to"), ""); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "StringCutMeta.Exception.UnableToReadStepInfoFromXML"),
          e); //$NON-NLS-1$
    }
  }
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    String[] inputStepNames = joinMeta.getInputSteps();
    if (inputStepNames != null) {
      String inputStepName;
      String[] keyFields = joinMeta.getKeyFields();
      String keyField;
      for (int i = 0; i < inputStepNames.length; i++) {
        inputStepName = Const.NVL(inputStepNames[i], "");
        wInputStepArray[i].setText(inputStepName);

        keyField = Const.NVL(keyFields[i], "");
        keyValTextBox[i].setText(keyField);
      }

      String joinType = joinMeta.getJoinType();
      if (joinType != null && joinType.length() > 0) {
        joinTypeCombo.setText(joinType);
      } else {
        joinTypeCombo.setText(MultiMergeJoinMeta.join_types[0]);
      }
    }
    wStepname.selectAll();
    wStepname.setFocus();
  }
Exemplo n.º 29
0
  /** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    wStepname.setText(stepname);
    wFilename.setText(Const.NVL(inputMeta.getFilename(), ""));
    wLineWidth.setText(Const.NVL(inputMeta.getLineWidth(), ""));
    wLineFeedPresent.setSelection(inputMeta.isLineFeedPresent());
    wBufferSize.setText(Const.NVL(inputMeta.getBufferSize(), ""));
    wLazyConversion.setSelection(inputMeta.isLazyConversionActive());
    wHeaderPresent.setSelection(inputMeta.isHeaderPresent());
    wRunningInParallel.setSelection(inputMeta.isRunningInParallel());
    wFileType.setText(inputMeta.getFileTypeDesc());
    wEncoding.setText(Const.NVL(inputMeta.getEncoding(), ""));
    wAddResult.setSelection(inputMeta.isAddResultFile());

    for (int i = 0; i < inputMeta.getFieldDefinition().length; i++) {
      TableItem item = new TableItem(wFields.table, SWT.NONE);
      int colnr = 1;
      FixedFileInputField field = inputMeta.getFieldDefinition()[i];

      item.setText(colnr++, Const.NVL(field.getName(), ""));
      item.setText(colnr++, ValueMetaFactory.getValueMetaName(field.getType()));
      item.setText(colnr++, Const.NVL(field.getFormat(), ""));
      item.setText(colnr++, field.getWidth() >= 0 ? Integer.toString(field.getWidth()) : "");
      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.getCurrency(), ""));
      item.setText(colnr++, Const.NVL(field.getDecimal(), ""));
      item.setText(colnr++, Const.NVL(field.getGrouping(), ""));
      item.setText(colnr++, ValueMetaString.getTrimTypeCode(field.getTrimType()));
    }
    wFields.removeEmptyRows();
    wFields.setRowNums();
    wFields.optWidth(true);

    enableFields();

    wStepname.selectAll();
    wStepname.setFocus();
  }
Exemplo n.º 30
0
  /** 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);
  }