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();
  }
  private void getModulesList() {
    if (!gotModule) {
      SalesforceConnection connection = null;

      try {
        SalesforceDeleteMeta meta = new SalesforceDeleteMeta();
        getInfo(meta);
        String url = transMeta.environmentSubstitute(meta.getTargetURL());

        String selectedField = wModule.getText();
        wModule.removeAll();

        // Define a new Salesforce connection
        connection =
            new SalesforceConnection(
                log,
                url,
                transMeta.environmentSubstitute(meta.getUsername()),
                Utils.resolvePassword(transMeta, meta.getPassword()));
        int realTimeOut = Const.toInt(transMeta.environmentSubstitute(meta.getTimeout()), 0);
        connection.setTimeOut(realTimeOut);
        // connect to Salesforce
        connection.connect();
        // return
        wModule.setItems(connection.getAllAvailableObjects(false));

        if (!Utils.isEmpty(selectedField)) {
          wModule.setText(selectedField);
        }

        gotModule = true;
        getModulesListError = false;

      } catch (Exception e) {
        new ErrorDialog(
            shell,
            BaseMessages.getString(PKG, "SalesforceDeleteDialog.ErrorRetrieveModules.DialogTitle"),
            BaseMessages.getString(
                PKG, "SalesforceDeleteDialog.ErrorRetrieveData.ErrorRetrieveModules"),
            e);
        getModulesListError = true;
      } finally {
        if (connection != null) {
          try {
            connection.close();
          } catch (Exception e) {
            /* Ignore */
          }
        }
      }
    }
  }
 /**
  * Since the exported transformation that runs this will reside in a ZIP file, we can't reference
  * files relatively. So what this does is turn the name of files into absolute paths OR it simply
  * includes the resource in the ZIP file. For now, we'll simply turn it into an absolute path and
  * pray that the file is on a shared drive or something like that.
  *
  * @param space the variable space to use
  * @param definitions
  * @param resourceNamingInterface
  * @param repository The repository to optionally load other resources from (to be converted to
  *     XML)
  * @param metaStore the metaStore in which non-kettle metadata could reside.
  * @return the filename of the exported resource
  */
 public String exportResources(
     VariableSpace space,
     Map<String, ResourceDefinition> definitions,
     ResourceNamingInterface resourceNamingInterface,
     Repository repository,
     IMetaStore metaStore)
     throws KettleException {
   try {
     // The object that we're modifying here is a copy of the original!
     // So let's change the filename from relative to absolute by grabbing the file object...
     // In case the name of the file comes from previous steps, forget about this!
     //
     if (!filefield) {
       for (int i = 0; i < fileName.length; i++) {
         FileObject fileObject =
             KettleVFS.getFileObject(space.environmentSubstitute(fileName[i]), space);
         fileName[i] =
             resourceNamingInterface.nameResource(fileObject, space, Utils.isEmpty(fileMask[i]));
       }
     }
     return null;
   } catch (Exception e) {
     throw new KettleException(e);
   }
 }
 private void getlookup() {
   try {
     String stepFrom = wStep.getText();
     if (!Utils.isEmpty(stepFrom)) {
       RowMetaInterface r = transMeta.getStepFields(stepFrom);
       if (r != null && !r.isEmpty()) {
         BaseStepDialog.getFieldsFromPrevious(
             r, wReturn, 1, new int[] {1}, new int[] {4}, -1, -1, null);
       } else {
         MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
         mb.setMessage(
             BaseMessages.getString(PKG, "FuzzyMatchDialog.CouldNotFindFields.DialogMessage"));
         mb.setText(
             BaseMessages.getString(PKG, "FuzzyMatchDialog.CouldNotFindFields.DialogTitle"));
         mb.open();
       }
     } else {
       MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
       mb.setMessage(
           BaseMessages.getString(PKG, "FuzzyMatchDialog.StepNameRequired.DialogMessage"));
       mb.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.StepNameRequired.DialogTitle"));
       mb.open();
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "FuzzyMatchDialog.FailedToGetFields.DialogTitle"),
         BaseMessages.getString(PKG, "FuzzyMatchDialog.FailedToGetFields.DialogMessage"),
         ke);
   }
 }
Esempio n. 5
0
  private String encodeRecordTerminator(String terminator, String encoding) throws KettleException {
    final String in = substituteRecordTerminator(terminator);
    final StringBuilder out = new StringBuilder();
    byte[] bytes;

    try {
      // use terminator in hex representation due to character set
      // terminator in hex representation must be in character set
      // of data file
      if (Utils.isEmpty(encoding)) {
        bytes = in.getBytes();
      } else {
        bytes = in.getBytes(encoding);
      }
      for (byte aByte : bytes) {
        final String hex = Integer.toHexString(aByte);

        if (hex.length() == 1) {
          out.append('0');
        }
        out.append(hex);
      }
    } catch (UnsupportedEncodingException e) {
      throw new KettleException("Unsupported character encoding: " + encoding, e);
    }

    return out.toString();
  }
Esempio n. 6
0
  synchronized Object[] getOneRow(RowMetaInterface rowMeta, Object[] row) throws KettleException {

    Object[] rowData = RowDataUtil.resizeArray(row, data.outputRowMeta.size());
    int index = 0;
    Set<Integer> numFieldsAlreadyBeenTransformed = new HashSet<Integer>();
    for (int i = 0; i < data.numFields; i++) {

      RowMetaInterface currentRowMeta =
          (numFieldsAlreadyBeenTransformed.contains(data.inStreamNrs[i]))
              ? data.outputRowMeta
              : getInputRowMeta();
      String value =
          replaceString(
              currentRowMeta.getString(rowData, data.inStreamNrs[i]),
              data.patterns[i],
              getResolvedReplaceByString(i, row));

      if (Utils.isEmpty(data.outStreamNrs[i])) {
        // update field value
        rowData[data.inStreamNrs[i]] = value;
        numFieldsAlreadyBeenTransformed.add(data.inStreamNrs[i]);
      } else {
        // add new field value
        rowData[data.inputFieldsNr + index++] = value;
      }
    }
    return rowData;
  }
 public DatabaseMeta getAttributeDatabaseMeta(String code) {
   DataProperty property = dataNode.getProperty(code);
   if (property == null || Utils.isEmpty(property.getString())) {
     return null;
   }
   ObjectId id = new StringObjectId(property.getString());
   return DatabaseMeta.findDatabase(databases, id);
 }
  @Override
  public void callExtensionPoint(LogChannelInterface log, Object object) throws KettleException {
    if (!(object instanceof CommandLineOption[])) {
      return;
    }
    CommandLineOption[] options = (CommandLineOption[]) object;
    StringBuilder optionRepname = getCommandLineOption(options, "rep").getArgument();
    StringBuilder optionFilename = getCommandLineOption(options, "file").getArgument();
    StringBuilder optionUsername = getCommandLineOption(options, "user").getArgument();
    StringBuilder optionPassword = getCommandLineOption(options, "pass").getArgument();

    if (!Utils.isEmpty(optionRepname) && Utils.isEmpty(optionFilename)) {
      RepositoryMeta repositoryMeta =
          repositoryConnectController.getRepositoryMetaByName(optionRepname.toString());
      if (repositoryMeta != null
          && !Utils.isEmpty(optionUsername)
          && !Utils.isEmpty(optionPassword)) {
        repositoryConnectController.connectToRepository(
            repositoryMeta, optionUsername.toString(), optionPassword.toString());
      } else if (repositoryMeta != null) {
        repositoryConnectController.connectToRepository(repositoryMeta, null, null);
      }
      if (!repositoryConnectController.isConnected()) {
        String msg = BaseMessages.getString(PKG, "Repository.NoConnected.Message");
        log.logError(msg); // "No repositories defined on this system."
        MessageBox mb = new MessageBox(getSpoon().getShell(), SWT.OK | SWT.ICON_ERROR);
        mb.setMessage(
            BaseMessages.getString(
                PKG, "Repository.NoConnected.Message", optionRepname.toString()));
        mb.setText(BaseMessages.getString(PKG, "Repository.NoConnected.Message.Title"));
        mb.open();
      }
    } else if (Utils.isEmpty(optionFilename)) {
      RepositoryMeta repositoryMeta = repositoryConnectController.getDefaultRepositoryMeta();
      if (repositoryMeta != null) {
        if (repositoryMeta.getId().equals("KettleFileRepository")) {
          repositoryConnectController.connectToRepository(repositoryMeta);
        } else {
          new RepositoryDialog(getSpoon().getShell(), repositoryConnectController)
              .openLogin(repositoryMeta);
        }
      }
    }
  }
 private void refreshIncludeCatalog() {
   if (!Utils.isEmpty(wschemaname.getText())) {
     wincludeCatalog.setSelection(false);
     wlincludeCatalog.setEnabled(false);
     wincludeCatalog.setEnabled(false);
   } else {
     wlincludeCatalog.setEnabled(true);
     wincludeCatalog.setEnabled(true);
   }
 }
Esempio n. 10
0
  private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
      return;
    }

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

    getInfo(inputMeta);

    dispose();
  }
Esempio n. 11
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      passAllRows = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "all_rows"));
      aggregateIgnored = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ignore_aggregate"));
      aggregateIgnoredField = XMLHandler.getTagValue(stepnode, "field_ignore");

      directory = XMLHandler.getTagValue(stepnode, "directory");
      prefix = XMLHandler.getTagValue(stepnode, "prefix");

      addingLineNrInGroup = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "add_linenr"));
      lineNrInGroupField = XMLHandler.getTagValue(stepnode, "linenr_fieldname");

      Node groupn = XMLHandler.getSubNode(stepnode, "group");
      Node fields = XMLHandler.getSubNode(stepnode, "fields");

      int sizegroup = XMLHandler.countNodes(groupn, "field");
      int nrfields = XMLHandler.countNodes(fields, "field");

      allocate(sizegroup, nrfields);

      for (int i = 0; i < sizegroup; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(groupn, "field", i);
        groupField[i] = XMLHandler.getTagValue(fnode, "name");
      }

      boolean hasNumberOfValues = false;
      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
        aggregateField[i] = XMLHandler.getTagValue(fnode, "aggregate");
        subjectField[i] = XMLHandler.getTagValue(fnode, "subject");
        aggregateType[i] = getType(XMLHandler.getTagValue(fnode, "type"));

        if (aggregateType[i] == TYPE_GROUP_COUNT_ALL
            || aggregateType[i] == TYPE_GROUP_COUNT_DISTINCT
            || aggregateType[i] == TYPE_GROUP_COUNT_ANY) {
          hasNumberOfValues = true;
        }

        valueField[i] = XMLHandler.getTagValue(fnode, "valuefield");
      }

      String giveBackRow = XMLHandler.getTagValue(stepnode, "give_back_row");
      if (Utils.isEmpty(giveBackRow)) {
        alwaysGivingBackOneRow = hasNumberOfValues;
      } else {
        alwaysGivingBackOneRow = "Y".equalsIgnoreCase(giveBackRow);
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "GroupByMeta.Exception.UnableToLoadStepInfoFromXML"), e);
    }
  }
 @Override
 public String toString() {
   if (Utils.isEmpty(filename)) {
     String dir = directory.toString();
     if (dir.endsWith("/")) {
       return dir + name + " (" + objectType.getTypeDescription() + ")";
     } else {
       return dir + "/" + name + " (" + objectType.getTypeDescription() + ")";
     }
   } else {
     return filename;
   }
 }
  private boolean checkUserInput(GetTableNamesMeta meta) {

    if (Utils.isEmpty(meta.getTablenameFieldName())) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(
              PKG, "GetTableNamesDialog.Error.TablenameFieldNameMissingMessage"));
      mb.setText(
          BaseMessages.getString(PKG, "GetTableNamesDialog.Error.TablenameFieldNameMissingTitle"));
      mb.open();

      return false;
    }
    return true;
  }
 private void ok() {
   if (Utils.isEmpty(wStepname.getText())) {
     return;
   }
   stepname = wStepname.getText(); // return value
   getInfo(input);
   if (input.getDatabase() == null) {
     MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
     mb.setMessage(
         BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogMessage"));
     mb.setText(BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogTitle"));
     mb.open();
     return;
   }
   dispose();
 }
Esempio n. 15
0
  protected Analytics.Data.Ga.Get getQuery(Analytics analytics) {

    Analytics.Data dataApi = analytics.data();
    Analytics.Data.Ga.Get query;

    try {
      String metrics = environmentSubstitute(meta.getMetrics());
      if (Utils.isEmpty(metrics)) {
        logError(BaseMessages.getString(PKG, "GoogleAnalytics.Error.NoMetricsSpecified.Message"));
        return null;
      }
      query =
          dataApi
              .ga()
              .get(
                  meta.isUseCustomTableId()
                      ? environmentSubstitute(meta.getGaCustomTableId())
                      : meta.getGaProfileTableId(),
                  // ids
                  environmentSubstitute(meta.getStartDate()), // start date
                  environmentSubstitute(meta.getEndDate()), // end date
                  metrics // metrics
                  );

      String dimensions = environmentSubstitute(meta.getDimensions());
      if (!Utils.isEmpty(dimensions)) {
        query.setDimensions(dimensions);
      }

      if (meta.isUseSegment()) {
        if (meta.isUseCustomSegment()) {
          query.setSegment(environmentSubstitute(meta.getCustomSegment()));
        } else {
          query.setSegment(meta.getSegmentId());
        }
      }

      if (!Utils.isEmpty(meta.getSamplingLevel())) {
        query.setSamplingLevel(environmentSubstitute(meta.getSamplingLevel()));
      }

      if (!Utils.isEmpty(meta.getFilters())
          && !Utils.isEmpty(environmentSubstitute(meta.getFilters()))) {
        query.setFilters(environmentSubstitute(meta.getFilters()));
      }
      if (!Utils.isEmpty(meta.getSort())) {
        query.setSort(environmentSubstitute(meta.getSort()));
      }

      return query;
    } catch (IOException ioe) {
      return null;
    }
  }
Esempio n. 16
0
 @Override
 public String toString() {
   if (Utils.isEmpty(subject)) {
     return description
         + " @ "
         + StringUtil.getFormattedDateTime(date, true)
         + " : "
         + (duration == null ? "-" : duration.toString())
         + (count == null ? "" : " (x" + count + ")");
   } else {
     return description
         + " / "
         + subject
         + " @ "
         + StringUtil.getFormattedDateTime(date, true)
         + " : "
         + (duration == null ? "-" : duration.toString())
         + (count == null ? "" : " (x" + count + ")");
   }
 }
  protected void ok() {
    if (Utils.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());

    try {
      getInfo(jobEntry);
      jobEntry.setChanged();
      dispose();
    } catch (KettleException e) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "JobTrans.Dialog.ErrorShowingTransformation.Title"),
          BaseMessages.getString(PKG, "JobTrans.Dialog.ErrorShowingTransformation.Message"),
          e);
    }
  }
  private void getInfo(JobEntryTrans jet) throws KettleException {
    jet.setName(wName.getText());
    if (rep != null) {
      specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
    } else {
      specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
    }
    jet.setSpecificationMethod(specificationMethod);
    switch (specificationMethod) {
      case FILENAME:
        jet.setFileName(wPath.getText());
        if (jet.getFilename().isEmpty()) {
          throw new KettleException(
              BaseMessages.getString(PKG, "JobTrans.Dialog.Exception.NoValidMappingDetailsFound"));
        }

        jet.setDirectory(null);
        jet.setTransname(null);
        jet.setTransObjectId(null);
        break;
      case REPOSITORY_BY_NAME:
        String transPath = wPath.getText();
        String transName = transPath;
        String directory = "";
        int index = transPath.lastIndexOf("/");
        if (index != -1) {
          transName = transPath.substring(index + 1);
          directory = transPath.substring(0, index);
        }
        jet.setDirectory(directory);
        if (jet.getDirectory().isEmpty()) {
          throw new KettleException(
              BaseMessages.getString(
                  PKG, "JobTrans.Dialog.Exception.UnableToFindRepositoryDirectory"));
        }

        jet.setTransname(transName);
        jet.setFileName(null);
        jet.setTransObjectId(null);
        break;
      default:
        break;
    }

    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++;
      }
    }
    jet.arguments = new String[nr];
    nr = 0;
    for (int i = 0; i < nritems; i++) {
      String arg = wFields.getNonEmpty(i).getText(1);
      if (arg != null && arg.length() != 0) {
        jet.arguments[nr] = arg;
        nr++;
      }
    }

    // Do the parameters
    nritems = wParameters.nrNonEmpty();
    nr = 0;
    for (int i = 0; i < nritems; i++) {
      String param = wParameters.getNonEmpty(i).getText(1);
      if (param != null && param.length() != 0) {
        nr++;
      }
    }
    jet.parameters = new String[nr];
    jet.parameterFieldNames = new String[nr];
    jet.parameterValues = new String[nr];
    nr = 0;
    for (int i = 0; i < nritems; i++) {
      String param = wParameters.getNonEmpty(i).getText(1);
      String fieldName = wParameters.getNonEmpty(i).getText(2);
      String value = wParameters.getNonEmpty(i).getText(3);

      jet.parameters[nr] = param;

      if (!Utils.isEmpty(Const.trim(fieldName))) {
        jet.parameterFieldNames[nr] = fieldName;
      } else {
        jet.parameterFieldNames[nr] = "";
      }

      if (!Utils.isEmpty(Const.trim(value))) {
        jet.parameterValues[nr] = value;
      } else {
        jet.parameterValues[nr] = "";
      }

      nr++;
    }

    jet.setPassingAllParameters(wPassParams.getSelection());

    jet.logfile = wLogfile.getText();
    jet.logext = wLogext.getText();

    if (wLoglevel.getSelectionIndex() >= 0) {
      jet.logFileLevel = LogLevel.values()[wLoglevel.getSelectionIndex()];
    } else {
      jet.logFileLevel = LogLevel.BASIC;
    }

    jet.argFromPrevious = wPrevious.getSelection();
    jet.paramsFromPrevious = wPrevToParams.getSelection();
    jet.execPerRow = wEveryRow.getSelection();
    jet.setLogfile = wSetLogfile.getSelection();
    jet.addDate = wAddDate.getSelection();
    jet.addTime = wAddTime.getSelection();
    jet.clearResultRows = wClearRows.getSelection();
    jet.clearResultFiles = wClearFiles.getSelection();
    jet.setClustering(wCluster.getSelection());
    jet.setLoggingRemoteWork(wLogRemoteWork.getSelection());
    jet.createParentFolder = wCreateParentFolder.getSelection();

    jet.setRemoteSlaveServerName(wSlaveServer.getText());
    jet.setAppendLogfile = wAppendLogfile.getSelection();
    jet.setWaitingToFinish(wWaitingToFinish.getSelection());
    jet.setFollowingAbortRemotely(wFollowingAbortRemotely.getSelection());
  }
Esempio n. 19
0
  public SQLStatement getSQLStatements(
      TransMeta transMeta,
      StepMeta stepMeta,
      RowMetaInterface prev,
      Repository repository,
      IMetaStore metaStore) {
    SQLStatement retval =
        new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!

    if (databaseMeta != null) {
      if (prev != null && prev.size() > 0) {
        if (!Utils.isEmpty(tableName)) {
          Database db = new Database(loggingObject, databaseMeta);
          db.shareVariablesWith(transMeta);
          try {
            db.connect();

            String schemaTable =
                databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
            String cr_table = db.getDDL(schemaTable, prev, null, false, null, true);

            String cr_index = "";
            String[] idx_fields = null;

            if (keyLookup != null && keyLookup.length > 0) {
              idx_fields = new String[keyLookup.length];
              for (int i = 0; i < keyLookup.length; i++) {
                idx_fields[i] = keyLookup[i];
              }
            } else {
              retval.setError(
                  BaseMessages.getString(PKG, "DeleteMeta.CheckResult.KeyFieldsRequired"));
            }

            // Key lookup dimensions...
            if (idx_fields != null
                && idx_fields.length > 0
                && !db.checkIndexExists(schemaTable, idx_fields)) {
              String indexname = "idx_" + tableName + "_lookup";
              cr_index =
                  db.getCreateIndexStatement(
                      schemaName, tableName, indexname, idx_fields, false, false, false, true);
            }

            String sql = cr_table + cr_index;
            if (sql.length() == 0) {
              retval.setSQL(null);
            } else {
              retval.setSQL(sql);
            }
          } catch (KettleException e) {
            retval.setError(
                BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.ErrorOccurred")
                    + e.getMessage());
          }
        } else {
          retval.setError(
              BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.NoTableDefinedOnConnection"));
        }
      } else {
        retval.setError(BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.NoReceivingAnyFields"));
      }
    } else {
      retval.setError(BaseMessages.getString(PKG, "DeleteMeta.Returnvalue.NoConnectionDefined"));
    }

    return retval;
  }
  protected void pickFileVFS() {

    FileDialog dialog = new FileDialog(shell, SWT.OPEN);
    dialog.setFilterExtensions(Const.STRING_TRANS_FILTER_EXT);
    dialog.setFilterNames(Const.getTransformationFilterNames());
    String prevName = jobMeta.environmentSubstitute(wPath.getText());
    String parentFolder = null;
    try {
      parentFolder =
          KettleVFS.getFilename(
              KettleVFS.getFileObject(jobMeta.environmentSubstitute(jobMeta.getFilename()))
                  .getParent());
    } catch (Exception e) {
      // not that important
    }
    if (!Utils.isEmpty(prevName)) {
      try {
        if (KettleVFS.fileExists(prevName)) {
          dialog.setFilterPath(
              KettleVFS.getFilename(KettleVFS.getFileObject(prevName).getParent()));
        } else {

          if (!prevName.endsWith(".ktr")) {
            prevName = getEntryName(Const.trim(wPath.getText()) + ".ktr");
          }
          if (KettleVFS.fileExists(prevName)) {
            specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
            wPath.setText(prevName);
            return;
          } else {
            // File specified doesn't exist. Ask if we should create the file...
            //
            MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION);
            mb.setMessage(
                BaseMessages.getString(
                    PKG, "JobTrans.Dialog.CreateTransformationQuestion.Message"));
            mb.setText(
                BaseMessages.getString(
                    PKG, "JobTrans.Dialog.CreateTransformationQuestion.Title")); // Sorry!
            int answer = mb.open();
            if (answer == SWT.YES) {

              Spoon spoon = Spoon.getInstance();
              spoon.newTransFile();
              TransMeta transMeta = spoon.getActiveTransformation();
              transMeta.initializeVariablesFrom(jobEntry);
              transMeta.setFilename(jobMeta.environmentSubstitute(prevName));
              wPath.setText(prevName);
              specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
              spoon.saveFile();
              return;
            }
          }
        }
      } catch (Exception e) {
        dialog.setFilterPath(parentFolder);
      }
    } else if (!Utils.isEmpty(parentFolder)) {
      dialog.setFilterPath(parentFolder);
    }

    String fname = dialog.open();
    if (fname != null) {
      File file = new File(fname);
      String name = file.getName();
      String parentFolderSelection = file.getParentFile().toString();

      if (!Utils.isEmpty(parentFolder) && parentFolder.equals(parentFolderSelection)) {
        wPath.setText(getEntryName(name));
      } else {
        wPath.setText(fname);
      }
    }
  }
  public void getData() {
    wName.setText(Const.NVL(jobEntry.getName(), ""));

    specificationMethod = jobEntry.getSpecificationMethod();
    switch (specificationMethod) {
      case FILENAME:
        wPath.setText(Const.NVL(jobEntry.getFilename(), ""));
        break;
      case REPOSITORY_BY_NAME:
        String fullPath =
            Const.NVL(jobEntry.getDirectory(), "") + "/" + Const.NVL(jobEntry.getTransname(), "");
        wPath.setText(fullPath);
        break;
      case REPOSITORY_BY_REFERENCE:
        referenceObjectId = jobEntry.getTransObjectId();
        if (rep != null && jobEntry.getTransObjectId() != null) {
          getByReferenceData(jobEntry.getTransObjectId());
        }
        break;
      default:
        break;
    }

    // Arguments
    if (jobEntry.arguments != null) {
      for (int i = 0; i < jobEntry.arguments.length; i++) {
        TableItem ti = wFields.table.getItem(i);
        if (jobEntry.arguments[i] != null) {
          ti.setText(1, jobEntry.arguments[i]);
        }
      }
      wFields.setRowNums();
      wFields.optWidth(true);
    }

    // Parameters
    if (jobEntry.parameters != null) {
      for (int i = 0; i < jobEntry.parameters.length; i++) {
        TableItem ti = wParameters.table.getItem(i);
        if (!Utils.isEmpty(jobEntry.parameters[i])) {
          ti.setText(1, Const.NVL(jobEntry.parameters[i], ""));
          ti.setText(2, Const.NVL(jobEntry.parameterFieldNames[i], ""));
          ti.setText(3, Const.NVL(jobEntry.parameterValues[i], ""));
        }
      }
      wParameters.setRowNums();
      wParameters.optWidth(true);
    }

    wPassParams.setSelection(jobEntry.isPassingAllParameters());

    if (jobEntry.logfile != null) {
      wLogfile.setText(jobEntry.logfile);
    }
    if (jobEntry.logext != null) {
      wLogext.setText(jobEntry.logext);
    }

    wPrevious.setSelection(jobEntry.argFromPrevious);
    wPrevToParams.setSelection(jobEntry.paramsFromPrevious);
    wEveryRow.setSelection(jobEntry.execPerRow);
    wSetLogfile.setSelection(jobEntry.setLogfile);
    wAddDate.setSelection(jobEntry.addDate);
    wAddTime.setSelection(jobEntry.addTime);
    wClearRows.setSelection(jobEntry.clearResultRows);
    wClearFiles.setSelection(jobEntry.clearResultFiles);
    if (jobEntry.isClustering()) {
      wCluster.setSelection(true);
    } else if (jobEntry.getRemoteSlaveServerName() != null
        && !Utils.isEmpty(jobEntry.getRemoteSlaveServerName())) {
      wbServer.setSelection(true);
    } else {
      wbLocal.setSelection(true);
    }
    wLogRemoteWork.setSelection(jobEntry.isLoggingRemoteWork());
    if (jobEntry.getRemoteSlaveServerName() != null) {
      wSlaveServer.setText(jobEntry.getRemoteSlaveServerName());
    }
    wWaitingToFinish.setSelection(jobEntry.isWaitingToFinish());
    wFollowingAbortRemotely.setSelection(jobEntry.isFollowingAbortRemotely());
    wAppendLogfile.setSelection(jobEntry.setAppendLogfile);

    wbLogFilename.setSelection(jobEntry.setAppendLogfile);

    wCreateParentFolder.setSelection(jobEntry.createParentFolder);
    if (jobEntry.logFileLevel != null) {
      wLoglevel.select(jobEntry.logFileLevel.getLevel());
    }
  }
  public void readRep(
      Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases)
      throws KettleException {
    try {
      fileType = rep.getStepAttributeString(id_step, "file_type");
      section = rep.getStepAttributeString(id_step, "section");
      encoding = rep.getStepAttributeString(id_step, "encoding");
      includeIniSection = rep.getStepAttributeBoolean(id_step, "ini_section");
      iniSectionField = rep.getStepAttributeString(id_step, "ini_section_field");
      includeFilename = rep.getStepAttributeBoolean(id_step, "include");
      filenameField = rep.getStepAttributeString(id_step, "include_field");
      dynamicFilenameField = rep.getStepAttributeString(id_step, "filename_Field");
      includeRowNumber = rep.getStepAttributeBoolean(id_step, "rownum");

      String addresult = rep.getStepAttributeString(id_step, "isaddresult");
      if (Utils.isEmpty(addresult)) {
        isaddresult = true;
      } else {
        isaddresult = rep.getStepAttributeBoolean(id_step, "isaddresult");
      }

      filefield = rep.getStepAttributeBoolean(id_step, "filefield");
      rowNumberField = rep.getStepAttributeString(id_step, "rownum_field");
      resetRowNumber = rep.getStepAttributeBoolean(id_step, "reset_rownumber");
      resolvevaluevariable = rep.getStepAttributeBoolean(id_step, "resolve_value_variable");

      rowLimit = rep.getStepAttributeInteger(id_step, "limit");
      int nrFiles = rep.countNrStepAttributes(id_step, "file_name");
      int nrFields = rep.countNrStepAttributes(id_step, "field_name");

      allocate(nrFiles, nrFields);

      for (int i = 0; i < nrFiles; i++) {
        fileName[i] = rep.getStepAttributeString(id_step, i, "file_name");
        fileMask[i] = rep.getStepAttributeString(id_step, i, "file_mask");
        excludeFileMask[i] = rep.getStepAttributeString(id_step, i, "exclude_file_mask");
        fileRequired[i] = rep.getStepAttributeString(id_step, i, "file_required");
        if (!YES.equalsIgnoreCase(fileRequired[i])) {
          fileRequired[i] = RequiredFilesCode[0];
        }
        includeSubFolders[i] = rep.getStepAttributeString(id_step, i, "include_subfolders");
        if (!YES.equalsIgnoreCase(includeSubFolders[i])) {
          includeSubFolders[i] = RequiredFilesCode[0];
        }
      }

      for (int i = 0; i < nrFields; i++) {
        PropertyInputField field = new PropertyInputField();

        field.setName(rep.getStepAttributeString(id_step, i, "field_name"));
        field.setColumn(
            PropertyInputField.getColumnByCode(
                rep.getStepAttributeString(id_step, i, "field_column")));
        field.setType(
            ValueMetaFactory.getIdForValueMeta(
                rep.getStepAttributeString(id_step, i, "field_type")));
        field.setFormat(rep.getStepAttributeString(id_step, i, "field_format"));
        field.setCurrencySymbol(rep.getStepAttributeString(id_step, i, "field_currency"));
        field.setDecimalSymbol(rep.getStepAttributeString(id_step, i, "field_decimal"));
        field.setGroupSymbol(rep.getStepAttributeString(id_step, i, "field_group"));
        field.setLength((int) rep.getStepAttributeInteger(id_step, i, "field_length"));
        field.setPrecision((int) rep.getStepAttributeInteger(id_step, i, "field_precision"));
        field.setTrimType(
            PropertyInputField.getTrimTypeByCode(
                rep.getStepAttributeString(id_step, i, "field_trim_type")));
        field.setRepeated(rep.getStepAttributeBoolean(id_step, i, "field_repeat"));

        inputFields[i] = field;
      }
      shortFileFieldName = rep.getStepAttributeString(id_step, "shortFileFieldName");
      pathFieldName = rep.getStepAttributeString(id_step, "pathFieldName");
      hiddenFieldName = rep.getStepAttributeString(id_step, "hiddenFieldName");
      lastModificationTimeFieldName =
          rep.getStepAttributeString(id_step, "lastModificationTimeFieldName");
      uriNameFieldName = rep.getStepAttributeString(id_step, "uriNameFieldName");
      rootUriNameFieldName = rep.getStepAttributeString(id_step, "rootUriNameFieldName");
      extensionFieldName = rep.getStepAttributeString(id_step, "extensionFieldName");
      sizeFieldName = rep.getStepAttributeString(id_step, "sizeFieldName");
    } catch (Exception e) {
      throw new KettleException(
          BaseMessages.getString(PKG, "PropertyInputMeta.Exception.ErrorReadingRepository"), e);
    }
  }
  public void getFields(
      RowMetaInterface r,
      String name,
      RowMetaInterface[] info,
      StepMeta nextStep,
      VariableSpace space,
      Repository repository,
      IMetaStore metaStore)
      throws KettleStepException {

    int i;
    for (i = 0; i < inputFields.length; i++) {
      PropertyInputField field = inputFields[i];

      int type = field.getType();
      if (type == ValueMetaInterface.TYPE_NONE) {
        type = ValueMetaInterface.TYPE_STRING;
      }
      try {
        ValueMetaInterface v =
            ValueMetaFactory.createValueMeta(space.environmentSubstitute(field.getName()), type);
        v.setLength(field.getLength());
        v.setPrecision(field.getPrecision());
        v.setOrigin(name);
        v.setConversionMask(field.getFormat());
        v.setDecimalSymbol(field.getDecimalSymbol());
        v.setGroupingSymbol(field.getGroupSymbol());
        v.setCurrencySymbol(field.getCurrencySymbol());
        r.addValueMeta(v);
      } catch (Exception e) {
        throw new KettleStepException(e);
      }
    }
    String realFilenameField = space.environmentSubstitute(filenameField);
    if (includeFilename && !Utils.isEmpty(realFilenameField)) {
      ValueMetaInterface v = new ValueMetaString(realFilenameField);
      v.setLength(500);
      v.setPrecision(-1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }

    String realRowNumberField = space.environmentSubstitute(rowNumberField);
    if (includeRowNumber && !Utils.isEmpty(realRowNumberField)) {
      ValueMetaInterface v = new ValueMetaInteger(realRowNumberField);
      v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
    String realSectionField = space.environmentSubstitute(iniSectionField);
    if (includeIniSection && !Utils.isEmpty(realSectionField)) {
      ValueMetaInterface v = new ValueMetaString(realSectionField);
      v.setLength(500);
      v.setPrecision(-1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
    // Add additional fields

    if (getShortFileNameField() != null && getShortFileNameField().length() > 0) {
      ValueMetaInterface v =
          new ValueMetaString(space.environmentSubstitute(getShortFileNameField()));
      v.setLength(100, -1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
    if (getExtensionField() != null && getExtensionField().length() > 0) {
      ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getExtensionField()));
      v.setLength(100, -1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
    if (getPathField() != null && getPathField().length() > 0) {
      ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getPathField()));
      v.setLength(100, -1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
    if (getSizeField() != null && getSizeField().length() > 0) {
      ValueMetaInterface v = new ValueMetaInteger(space.environmentSubstitute(getSizeField()));
      v.setOrigin(name);
      v.setLength(9);
      r.addValueMeta(v);
    }
    if (isHiddenField() != null && isHiddenField().length() > 0) {
      ValueMetaInterface v = new ValueMetaBoolean(space.environmentSubstitute(isHiddenField()));
      v.setOrigin(name);
      r.addValueMeta(v);
    }

    if (getLastModificationDateField() != null && getLastModificationDateField().length() > 0) {
      ValueMetaInterface v =
          new ValueMetaDate(space.environmentSubstitute(getLastModificationDateField()));
      v.setOrigin(name);
      r.addValueMeta(v);
    }
    if (getUriField() != null && getUriField().length() > 0) {
      ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getUriField()));
      v.setLength(100, -1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }

    if (getRootUriField() != null && getRootUriField().length() > 0) {
      ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getRootUriField()));
      v.setLength(100, -1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
  }
Esempio n. 24
0
  /**
   * Get the contents of the control file as specified in the meta object
   *
   * @param meta the meta object to model the control file after
   * @return a string containing the control file contents
   */
  public String getControlFileContents(OraBulkLoaderMeta meta, RowMetaInterface rm, Object[] r)
      throws KettleException {
    DatabaseMeta dm = meta.getDatabaseMeta();
    String inputName = "'" + environmentSubstitute(meta.getDataFile()) + "'";

    String loadAction = meta.getLoadAction();

    StringBuilder contents = new StringBuilder(500);
    contents.append("OPTIONS(").append(Const.CR);
    contents.append("  ERRORS=\'").append(meta.getMaxErrors()).append("\'").append(Const.CR);

    if (meta.getCommitSizeAsInt(this) != 0
        && !(meta.isDirectPath() && getStepMeta().getCopies() > 1)) {
      // For the second part of the above expressions: ROWS is not supported
      // in parallel mode (by sqlldr).
      contents.append("  , ROWS=\'").append(meta.getCommitSize()).append("\'").append(Const.CR);
    }

    if (meta.getBindSizeAsInt(this) != 0) {
      contents.append("  , BINDSIZE=\'").append(meta.getBindSize()).append("\'").append(Const.CR);
    }

    if (meta.getReadSizeAsInt(this) != 0) {
      contents.append("  , READSIZE=\'").append(meta.getReadSize()).append("\'").append(Const.CR);
    }

    contents.append(")").append(Const.CR);

    contents.append("LOAD DATA").append(Const.CR);
    if (!Utils.isEmpty(meta.getCharacterSetName())) {
      contents.append("CHARACTERSET ").append(meta.getCharacterSetName()).append(Const.CR);
    }
    if (!OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod())
        || !Utils.isEmpty(meta.getAltRecordTerm())) {
      String infile = inputName;

      if (OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod())) {
        infile = "''";
      }

      // For concurrent input, data command line argument must be specified
      contents.append("INFILE ").append(infile);
      if (!Utils.isEmpty(meta.getAltRecordTerm())) {
        contents
            .append(" \"STR x'")
            .append(encodeRecordTerminator(meta.getAltRecordTerm(), meta.getEncoding()))
            .append("'\"");
      }
      contents.append(Const.CR);
    }
    contents
        .append("INTO TABLE ")
        .append(
            dm.getQuotedSchemaTableCombination(
                environmentSubstitute(meta.getSchemaName()),
                environmentSubstitute(meta.getTableName())))
        .append(Const.CR)
        .append(loadAction)
        .append(Const.CR)
        .append("FIELDS TERMINATED BY ',' ENCLOSED BY '\"'")
        .append(Const.CR)
        .append("(");

    String[] streamFields = meta.getFieldStream();
    String[] tableFields = meta.getFieldTable();
    String[] dateMask = meta.getDateMask();

    if (streamFields == null || streamFields.length == 0) {
      throw new KettleException("No fields defined to load to database");
    }

    for (int i = 0; i < streamFields.length; i++) {
      if (i != 0) {
        contents.append(", ").append(Const.CR);
      }
      contents.append(dm.quoteField(tableFields[i]));

      int pos = rm.indexOfValue(streamFields[i]);
      if (pos < 0) {
        throw new KettleException("Could not find field " + streamFields[i] + " in stream");
      }
      ValueMetaInterface v = rm.getValueMeta(pos);
      switch (v.getType()) {
        case ValueMetaInterface.TYPE_STRING:
          if (v.getLength() > 255) {
            contents.append(" CHAR(").append(v.getLength()).append(")");
          } else {
            contents.append(" CHAR");
          }
          break;
        case ValueMetaInterface.TYPE_INTEGER:
        case ValueMetaInterface.TYPE_NUMBER:
        case ValueMetaInterface.TYPE_BIGNUMBER:
          break;
        case ValueMetaInterface.TYPE_DATE:
          if (OraBulkLoaderMeta.DATE_MASK_DATE.equals(dateMask[i])) {
            contents.append(" DATE 'yyyy-mm-dd'");
          } else if (OraBulkLoaderMeta.DATE_MASK_DATETIME.equals(dateMask[i])) {
            contents.append(" TIMESTAMP 'yyyy-mm-dd hh24:mi:ss.ff'");
          } else {
            // If not specified the default is date.
            contents.append(" DATE 'yyyy-mm-dd'");
          }
          break;
        case ValueMetaInterface.TYPE_BINARY:
          contents.append(" ENCLOSED BY '<startlob>' AND '<endlob>'");
          break;
        case ValueMetaInterface.TYPE_TIMESTAMP:
          contents.append(" TIMESTAMP 'yyyy-mm-dd hh24:mi:ss.ff'");
          break;
        default:
          break;
      }
    }
    contents.append(")");

    return contents.toString();
  }
Esempio n. 25
0
  @Override
  public void getFields(
      RowMetaInterface rowMeta,
      String origin,
      RowMetaInterface[] info,
      StepMeta nextStep,
      VariableSpace space,
      Repository repository,
      IMetaStore metaStore) {
    // re-assemble a new row of metadata
    //
    RowMetaInterface fields = new RowMeta();

    if (!passAllRows) {
      // Add the grouping fields in the correct order...
      //
      for (int i = 0; i < groupField.length; i++) {
        ValueMetaInterface valueMeta = rowMeta.searchValueMeta(groupField[i]);
        if (valueMeta != null) {
          fields.addValueMeta(valueMeta);
        }
      }
    } else {
      // Add all the original fields from the incoming row meta
      //
      fields.addRowMeta(rowMeta);
    }

    // Re-add aggregates
    //
    for (int i = 0; i < subjectField.length; i++) {
      ValueMetaInterface subj = rowMeta.searchValueMeta(subjectField[i]);
      if (subj != null || aggregateType[i] == TYPE_GROUP_COUNT_ANY) {
        String valueName = aggregateField[i];
        int valueType = ValueMetaInterface.TYPE_NONE;
        int length = -1;
        int precision = -1;

        switch (aggregateType[i]) {
          case TYPE_GROUP_SUM:
          case TYPE_GROUP_AVERAGE:
          case TYPE_GROUP_CUMULATIVE_SUM:
          case TYPE_GROUP_CUMULATIVE_AVERAGE:
          case TYPE_GROUP_FIRST:
          case TYPE_GROUP_LAST:
          case TYPE_GROUP_FIRST_INCL_NULL:
          case TYPE_GROUP_LAST_INCL_NULL:
          case TYPE_GROUP_MIN:
          case TYPE_GROUP_MAX:
            valueType = subj.getType();
            break;
          case TYPE_GROUP_COUNT_DISTINCT:
          case TYPE_GROUP_COUNT_ANY:
          case TYPE_GROUP_COUNT_ALL:
            valueType = ValueMetaInterface.TYPE_INTEGER;
            break;
          case TYPE_GROUP_CONCAT_COMMA:
            valueType = ValueMetaInterface.TYPE_STRING;
            break;
          case TYPE_GROUP_STANDARD_DEVIATION:
          case TYPE_GROUP_MEDIAN:
          case TYPE_GROUP_PERCENTILE:
            valueType = ValueMetaInterface.TYPE_NUMBER;
            break;
          case TYPE_GROUP_CONCAT_STRING:
            valueType = ValueMetaInterface.TYPE_STRING;
            break;
          default:
            break;
        }

        // Change type from integer to number in case off averages for cumulative average
        //
        if (aggregateType[i] == TYPE_GROUP_CUMULATIVE_AVERAGE
            && valueType == ValueMetaInterface.TYPE_INTEGER) {
          valueType = ValueMetaInterface.TYPE_NUMBER;
          precision = -1;
          length = -1;
        } else if (aggregateType[i] == TYPE_GROUP_COUNT_ALL
            || aggregateType[i] == TYPE_GROUP_COUNT_DISTINCT
            || aggregateType[i] == TYPE_GROUP_COUNT_ANY) {
          length = ValueMetaInterface.DEFAULT_INTEGER_LENGTH;
          precision = 0;
        } else if (aggregateType[i] == TYPE_GROUP_SUM
            && valueType != ValueMetaInterface.TYPE_INTEGER
            && valueType != ValueMetaInterface.TYPE_NUMBER
            && valueType != ValueMetaInterface.TYPE_BIGNUMBER) {
          // If it ain't numeric, we change it to Number
          //
          valueType = ValueMetaInterface.TYPE_NUMBER;
          precision = -1;
          length = -1;
        }

        if (valueType != ValueMetaInterface.TYPE_NONE) {
          ValueMetaInterface v = new ValueMeta(valueName, valueType);
          v.setOrigin(origin);
          v.setLength(length, precision);
          fields.addValueMeta(v);
        }
      }
    }

    if (passAllRows) {
      // If we pass all rows, we can add a line nr in the group...
      if (addingLineNrInGroup && !Utils.isEmpty(lineNrInGroupField)) {
        ValueMetaInterface lineNr = new ValueMetaInteger(lineNrInGroupField);
        lineNr.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
        lineNr.setOrigin(origin);
        fields.addValueMeta(lineNr);
      }
    }

    // Now that we have all the fields we want, we should clear the original row and replace the
    // values...
    //
    rowMeta.clear();
    rowMeta.addRowMeta(fields);
  }
  /**
   * <div id="mindtouch">
   *
   * <h1>/kettle/prepareExec</h1>
   *
   * <a name="GET"></a>
   *
   * <h2>GET</h2>
   *
   * <p>Prepares previously loaded transformation for execution. Method is used for preparing
   * previously uploaded transformation for execution by its name.
   *
   * <p><b>Example Request:</b><br>
   *
   * <pre function="syntax.xml">
   * GET /kettle/prepareExec/?name=dummy-trans2&xml=Y
   * </pre>
   *
   * <h3>Parameters</h3>
   *
   * <table class="pentaho-table">
   * <tbody>
   * <tr>
   * <th>name</th>
   * <th>description</th>
   * <th>type</th>
   * </tr>
   * <tr>
   * <td>name</td>
   * <td>Name of the transformation to be prepared for execution.</td>
   * <td>query</td>
   * </tr>
   * <tr>
   * <td>xml</td>
   * <td>Boolean flag which sets the output format required. Use <code>Y</code> to receive XML response.</td>
   * <td>boolean</td>
   * </tr>
   * <tr>
   * <td>id</td>
   * <td>Carte transformation ID of the transformation to be prepared for execution.</td>
   * <td>query, optional</td>
   * </tr>
   * </tbody>
   * </table>
   *
   * <h3>Response Body</h3>
   *
   * <table class="pentaho-table">
   * <tbody>
   * <tr>
   * <td align="right">text:</td>
   * <td>HTML</td>
   * </tr>
   * <tr>
   * <td align="right">media types:</td>
   * <td>text/xml, text/html</td>
   * </tr>
   * </tbody>
   * </table>
   *
   * <p>Response XML or HTML containing operation result. When using xml=Y <code>result</code> field
   * indicates whether operation was successful (<code>OK</code>) or not (<code>ERROR</code>).
   *
   * <p><b>Example Response:</b>
   *
   * <pre function="syntax.xml">
   * <?xml version="1.0" encoding="UTF-8"?>
   * <webresult>
   * <result>OK</result>
   * <message/>
   * <id/>
   * </webresult>
   * </pre>
   *
   * <h3>Status Codes</h3>
   *
   * <table class="pentaho-table">
   * <tbody>
   * <tr>
   * <th>code</th>
   * <th>description</th>
   * </tr>
   * <tr>
   * <td>200</td>
   * <td>Request was processed.</td>
   * </tr>
   * <tr>
   * <td>500</td>
   * <td>Internal server error occurs during request processing.</td>
   * </tr>
   * </tbody>
   * </table>
   *
   * </div>
   */
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    if (isJettyMode() && !request.getContextPath().startsWith(CONTEXT_PATH)) {
      return;
    }

    if (log.isDebug()) {
      logDebug(
          BaseMessages.getString(
              PKG, "PrepareExecutionTransServlet.TransPrepareExecutionRequested"));
    }

    String transName = request.getParameter("name");
    String id = request.getParameter("id");
    boolean useXML = "Y".equalsIgnoreCase(request.getParameter("xml"));

    response.setStatus(HttpServletResponse.SC_OK);

    PrintWriter out = response.getWriter();
    if (useXML) {
      response.setContentType("text/xml");
      out.print(XMLHandler.getXMLHeader(Const.XML_ENCODING));
    } else {

      response.setCharacterEncoding("UTF-8");
      response.setContentType("text/html;charset=UTF-8");

      out.println("<HTML>");
      out.println("<HEAD>");
      out.println(
          "<TITLE>"
              + BaseMessages.getString(PKG, "PrepareExecutionTransServlet.TransPrepareExecution")
              + "</TITLE>");
      out.println(
          "<META http-equiv=\"Refresh\" content=\"2;url="
              + convertContextPath(GetTransStatusServlet.CONTEXT_PATH)
              + "?name="
              + URLEncoder.encode(transName, "UTF-8")
              + "\">");
      out.println("<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
      out.println("</HEAD>");
      out.println("<BODY>");
    }

    try {
      // ID is optional...
      //
      Trans trans;
      CarteObjectEntry entry;
      if (Utils.isEmpty(id)) {
        // get the first transformation that matches...
        //
        entry = getTransformationMap().getFirstCarteObjectEntry(transName);
        if (entry == null) {
          trans = null;
        } else {
          id = entry.getId();
          trans = getTransformationMap().getTransformation(entry);
        }
      } else {
        // Take the ID into account!
        //
        entry = new CarteObjectEntry(transName, id);
        trans = getTransformationMap().getTransformation(entry);
      }

      TransConfiguration transConfiguration = getTransformationMap().getConfiguration(entry);

      if (trans != null && transConfiguration != null) {
        TransExecutionConfiguration executionConfiguration =
            transConfiguration.getTransExecutionConfiguration();
        // Set the appropriate logging, variables, arguments, replay date, ...
        // etc.
        trans.setArguments(executionConfiguration.getArgumentStrings());
        trans.setReplayDate(executionConfiguration.getReplayDate());
        trans.setSafeModeEnabled(executionConfiguration.isSafeModeEnabled());
        trans.setGatheringMetrics(executionConfiguration.isGatheringMetrics());
        trans.injectVariables(executionConfiguration.getVariables());
        trans.setPreviousResult(executionConfiguration.getPreviousResult());

        try {
          trans.prepareExecution(null);

          if (useXML) {
            out.println(WebResult.OK.getXML());
          } else {

            out.println(
                "<H1>"
                    + Encode.forHtml(
                        BaseMessages.getString(
                            PKG, "PrepareExecutionTransServlet.TransPrepared", transName))
                    + "</H1>");
            out.println(
                "<a href=\""
                    + convertContextPath(GetTransStatusServlet.CONTEXT_PATH)
                    + "?name="
                    + URLEncoder.encode(transName, "UTF-8")
                    + "&id="
                    + URLEncoder.encode(id, "UTF-8")
                    + "\">"
                    + BaseMessages.getString(PKG, "TransStatusServlet.BackToTransStatusPage")
                    + "</a><p>");
          }
        } catch (Exception e) {

          String logText =
              KettleLogStore.getAppender()
                  .getBuffer(trans.getLogChannel().getLogChannelId(), true)
                  .toString();
          if (useXML) {
            out.println(
                new WebResult(
                    WebResult.STRING_ERROR,
                    BaseMessages.getString(
                        PKG,
                        "PrepareExecutionTransServlet.Error.TransInitFailed",
                        Const.CR + logText + Const.CR + Const.getStackTracker(e))));
          } else {
            out.println(
                "<H1>"
                    + Encode.forHtml(
                        BaseMessages.getString(
                            PKG, "PrepareExecutionTransServlet.Log.TransNotInit", transName))
                    + "</H1>");

            out.println("<pre>");
            out.println(Encode.forHtml(logText));
            out.println(Encode.forHtml(Const.getStackTracker(e)));
            out.println("</pre>");
            out.println(
                "<a href=\""
                    + convertContextPath(GetTransStatusServlet.CONTEXT_PATH)
                    + "?name="
                    + URLEncoder.encode(transName, "UTF-8")
                    + "&id="
                    + id
                    + "\">"
                    + BaseMessages.getString(PKG, "TransStatusServlet.BackToTransStatusPage")
                    + "</a><p>");
          }
        }
      } else {
        if (useXML) {
          out.println(
              new WebResult(
                  WebResult.STRING_ERROR,
                  BaseMessages.getString(
                      PKG, "TransStatusServlet.Log.CoundNotFindSpecTrans", transName)));
        } else {
          out.println(
              "<H1>"
                  + Encode.forHtml(
                      BaseMessages.getString(
                          PKG, "TransStatusServlet.Log.CoundNotFindTrans", transName))
                  + "</H1>");
          out.println(
              "<a href=\""
                  + convertContextPath(GetStatusServlet.CONTEXT_PATH)
                  + "\">"
                  + BaseMessages.getString(PKG, "TransStatusServlet.BackToStatusPage")
                  + "</a><p>");
        }
      }
    } catch (Exception ex) {
      if (useXML) {
        out.println(
            new WebResult(
                WebResult.STRING_ERROR,
                BaseMessages.getString(
                    PKG,
                    "PrepareExecutionTransServlet.Error.UnexpectedError",
                    Const.CR + Const.getStackTracker(ex))));

      } else {
        out.println("<p>");
        out.println("<pre>");
        out.println(Encode.forHtml(Const.getStackTracker(ex)));
        out.println("</pre>");
      }
    }

    if (!useXML) {
      out.println("<p>");
      out.println("</BODY>");
      out.println("</HTML>");
    }
  }
Esempio n. 27
0
  /**
   * Create the command line for an sqlldr process depending on the meta information supplied.
   *
   * @param meta The meta data to create the command line from
   * @param password Use the real password or not
   * @return The string to execute.
   * @throws KettleException Upon any exception
   */
  public String createCommandLine(OraBulkLoaderMeta meta, boolean password) throws KettleException {
    StringBuilder sb = new StringBuilder(300);

    if (meta.getSqlldr() != null) {
      try {
        FileObject fileObject =
            KettleVFS.getFileObject(environmentSubstitute(meta.getSqlldr()), getTransMeta());
        String sqlldr = KettleVFS.getFilename(fileObject);
        sb.append(sqlldr);
      } catch (KettleFileException ex) {
        throw new KettleException("Error retrieving sqlldr string", ex);
      }
    } else {
      throw new KettleException("No sqlldr application specified");
    }

    if (meta.getControlFile() != null) {
      try {
        FileObject fileObject =
            KettleVFS.getFileObject(environmentSubstitute(meta.getControlFile()), getTransMeta());

        sb.append(" control=\'");
        sb.append(KettleVFS.getFilename(fileObject));
        sb.append("\'");
      } catch (KettleFileException ex) {
        throw new KettleException("Error retrieving controlfile string", ex);
      }
    } else {
      throw new KettleException("No control file specified");
    }

    if (OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod())) {
      sb.append(" data=\'-\'");
    }

    if (meta.getLogFile() != null) {
      try {
        FileObject fileObject =
            KettleVFS.getFileObject(environmentSubstitute(meta.getLogFile()), getTransMeta());

        sb.append(" log=\'");
        sb.append(KettleVFS.getFilename(fileObject));
        sb.append("\'");
      } catch (KettleFileException ex) {
        throw new KettleException("Error retrieving logfile string", ex);
      }
    }

    if (meta.getBadFile() != null) {
      try {
        FileObject fileObject =
            KettleVFS.getFileObject(environmentSubstitute(meta.getBadFile()), getTransMeta());

        sb.append(" bad=\'");
        sb.append(KettleVFS.getFilename(fileObject));
        sb.append("\'");
      } catch (KettleFileException ex) {
        throw new KettleException("Error retrieving badfile string", ex);
      }
    }

    if (meta.getDiscardFile() != null) {
      try {
        FileObject fileObject =
            KettleVFS.getFileObject(environmentSubstitute(meta.getDiscardFile()), getTransMeta());

        sb.append(" discard=\'");
        sb.append(KettleVFS.getFilename(fileObject));
        sb.append("\'");
      } catch (KettleFileException ex) {
        throw new KettleException("Error retrieving discardfile string", ex);
      }
    }

    DatabaseMeta dm = meta.getDatabaseMeta();
    if (dm != null) {
      String user = Const.NVL(dm.getUsername(), "");
      String pass =
          Const.NVL(
              Encr.decryptPasswordOptionallyEncrypted(environmentSubstitute(dm.getPassword())), "");
      if (!password) {
        pass = "******";
      }
      String dns = Const.NVL(dm.getDatabaseName(), "");
      sb.append(" userid=")
          .append(environmentSubstitute(user))
          .append("/")
          .append(environmentSubstitute(pass))
          .append("@");

      String overrideName = meta.getDbNameOverride();
      if (Utils.isEmpty(Const.rtrim(overrideName))) {
        sb.append(environmentSubstitute(dns));
      } else {
        // if the database name override is filled in, do that one.
        sb.append(environmentSubstitute(overrideName));
      }
    } else {
      throw new KettleException("No connection specified");
    }

    if (meta.isDirectPath()) {
      sb.append(" DIRECT=TRUE");

      if (getStepMeta().getCopies() > 1 || meta.isParallel()) {
        sb.append(" PARALLEL=TRUE");
      }
    }

    return sb.toString();
  }
Esempio n. 28
0
  public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException {
    meta = (OraBulkLoaderMeta) smi;
    data = (OraBulkLoaderData) sdi;

    try {
      Object[] r = getRow(); // Get row from input rowset & set row busy!
      if (r == null) {
        // no more input to be expected...

        setOutputDone();

        if (!preview) {
          if (output != null) {
            // Close the output
            try {
              output.close();
            } catch (IOException e) {
              throw new KettleException("Error while closing output", e);
            }

            output = null;
          }

          String loadMethod = meta.getLoadMethod();
          if (OraBulkLoaderMeta.METHOD_AUTO_END.equals(loadMethod)) {
            // if this is the first line, we do not need to execute loader
            // control file may not exists
            if (!first) {
              execute(meta, true);
              sqlldrProcess = null;
            }
          } else if (OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod())) {
            try {
              if (sqlldrProcess != null) {
                int exitVal = sqlldrProcess.waitFor();
                sqlldrProcess = null;
                logBasic(
                    BaseMessages.getString(PKG, "OraBulkLoader.Log.ExitValueSqlldr", "" + exitVal));
                checkExitVal(exitVal);
              } else if (!first) {
                throw new KettleException("Internal error: no sqlldr process running");
              }
            } catch (Exception ex) {
              throw new KettleException("Error while executing sqlldr", ex);
            }
          }
        }
        return false;
      }

      if (!preview) {
        if (first) {
          first = false;

          String recTerm = Const.CR;
          if (!Utils.isEmpty(meta.getAltRecordTerm())) {
            recTerm = substituteRecordTerminator(meta.getAltRecordTerm());
          }

          createControlFile(environmentSubstitute(meta.getControlFile()), r, meta);
          output = new OraBulkDataOutput(meta, recTerm);

          if (OraBulkLoaderMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod())) {
            execute(meta, false);
          }
          output.open(this, sqlldrProcess);
        }
        output.writeLine(getInputRowMeta(), r);
      }
      putRow(getInputRowMeta(), r);
      incrementLinesOutput();

    } catch (KettleException e) {
      logError(BaseMessages.getString(PKG, "OraBulkLoader.Log.ErrorInStep") + e.getMessage());
      setErrors(1);
      stopAll();
      setOutputDone(); // signal end to receiver(s)
      return false;
    }

    return true;
  }
  public JobExecutionConfiguration(Node trecNode) throws KettleException {
    this();

    executingLocally = "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "exec_local"));

    executingRemotely = "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "exec_remote"));
    Node remoteHostNode = XMLHandler.getSubNode(trecNode, SlaveServer.XML_TAG);
    if (remoteHostNode != null) {
      remoteServer = new SlaveServer(remoteHostNode);
    }
    passingExport = "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "pass_export"));
    expandingRemoteJob =
        "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "expand_remote_job"));

    // Read the variables...
    //
    Node varsNode = XMLHandler.getSubNode(trecNode, "variables");
    int nrVariables = XMLHandler.countNodes(varsNode, "variable");
    for (int i = 0; i < nrVariables; i++) {
      Node argNode = XMLHandler.getSubNodeByNr(varsNode, "variable", i);
      String name = XMLHandler.getTagValue(argNode, "name");
      String value = XMLHandler.getTagValue(argNode, "value");
      if (!Utils.isEmpty(name) && !Utils.isEmpty(value)) {
        variables.put(name, value);
      }
    }

    // Read the arguments...
    //
    Node argsNode = XMLHandler.getSubNode(trecNode, "arguments");
    int nrArguments = XMLHandler.countNodes(argsNode, "argument");
    for (int i = 0; i < nrArguments; i++) {
      Node argNode = XMLHandler.getSubNodeByNr(argsNode, "argument", i);
      String name = XMLHandler.getTagValue(argNode, "name");
      String value = XMLHandler.getTagValue(argNode, "value");
      if (!Utils.isEmpty(name) && !Utils.isEmpty(value)) {
        arguments.put(name, value);
      }
    }

    // Read the parameters...
    //
    Node parmsNode = XMLHandler.getSubNode(trecNode, "parameters");
    int nrParams = XMLHandler.countNodes(parmsNode, "parameter");
    for (int i = 0; i < nrParams; i++) {
      Node parmNode = XMLHandler.getSubNodeByNr(parmsNode, "parameter", i);
      String name = XMLHandler.getTagValue(parmNode, "name");
      String value = XMLHandler.getTagValue(parmNode, "value");
      if (!Utils.isEmpty(name)) {
        params.put(name, value);
      }
    }

    replayDate = XMLHandler.stringToDate(XMLHandler.getTagValue(trecNode, "replay_date"));
    safeModeEnabled = "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "safe_mode"));
    logLevel = LogLevel.getLogLevelForCode(XMLHandler.getTagValue(trecNode, "log_level"));
    clearingLog = "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "clear_log"));

    startCopyName = XMLHandler.getTagValue(trecNode, "start_copy_name");
    startCopyNr = Const.toInt(XMLHandler.getTagValue(trecNode, "start_copy_nr"), 0);

    gatheringMetrics = "Y".equalsIgnoreCase(XMLHandler.getTagValue(trecNode, "gather_metrics"));

    String sPassedBatchId = XMLHandler.getTagValue(trecNode, "passedBatchId");
    if (!StringUtils.isEmpty(sPassedBatchId)) {
      passedBatchId = Long.parseLong(sPassedBatchId);
    }

    Node resultNode = XMLHandler.getSubNode(trecNode, Result.XML_TAG);
    if (resultNode != null) {
      try {
        previousResult = new Result(resultNode);
      } catch (KettleException e) {
        throw new KettleException("Unable to hydrate previous result", e);
      }
    }

    // Try to get a handle to the repository from here...
    //
    Node repNode = XMLHandler.getSubNode(trecNode, "repository");
    if (repNode != null) {
      String repositoryName = XMLHandler.getTagValue(repNode, "name");
      String username = XMLHandler.getTagValue(repNode, "login");
      String password = Encr.decryptPassword(XMLHandler.getTagValue(repNode, "password"));
      connectRepository(repositoryName, username, password);
    }
  }
Esempio n. 30
0
  public void check(
      List<CheckResultInterface> remarks,
      TransMeta transMeta,
      StepMeta stepMeta,
      RowMetaInterface prev,
      String[] input,
      String[] output,
      RowMetaInterface info,
      VariableSpace space,
      Repository repository,
      IMetaStore metaStore) {
    CheckResult cr;
    String error_message = "";

    if (databaseMeta != null) {
      Database db = new Database(loggingObject, databaseMeta);
      db.shareVariablesWith(transMeta);
      try {
        db.connect();

        if (!Utils.isEmpty(tableName)) {
          cr =
              new CheckResult(
                  CheckResultInterface.TYPE_RESULT_OK,
                  BaseMessages.getString(PKG, "DeleteMeta.CheckResult.TablenameOK"),
                  stepMeta);
          remarks.add(cr);

          boolean first = true;
          boolean error_found = false;
          error_message = "";

          // Check fields in table
          String schemaTable = databaseMeta.getQuotedSchemaTableCombination(schemaName, tableName);
          RowMetaInterface r = db.getTableFields(schemaTable);
          if (r != null) {
            cr =
                new CheckResult(
                    CheckResultInterface.TYPE_RESULT_OK,
                    BaseMessages.getString(PKG, "DeleteMeta.CheckResult.VisitTableSuccessfully"),
                    stepMeta);
            remarks.add(cr);

            for (int i = 0; i < keyLookup.length; i++) {
              String lufield = keyLookup[i];

              ValueMetaInterface v = r.searchValueMeta(lufield);
              if (v == null) {
                if (first) {
                  first = false;
                  error_message +=
                      BaseMessages.getString(
                              PKG, "DeleteMeta.CheckResult.MissingCompareFieldsInTargetTable")
                          + Const.CR;
                }
                error_found = true;
                error_message += "\t\t" + lufield + Const.CR;
              }
            }
            if (error_found) {
              cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
            } else {
              cr =
                  new CheckResult(
                      CheckResultInterface.TYPE_RESULT_OK,
                      BaseMessages.getString(PKG, "DeleteMeta.CheckResult.FoundLookupFields"),
                      stepMeta);
            }
            remarks.add(cr);
          } else {
            error_message =
                BaseMessages.getString(PKG, "DeleteMeta.CheckResult.CouldNotReadTableInfo");
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
            remarks.add(cr);
          }
        }

        // Look up fields in the input stream <prev>
        if (prev != null && prev.size() > 0) {
          cr =
              new CheckResult(
                  CheckResultInterface.TYPE_RESULT_OK,
                  BaseMessages.getString(
                      PKG,
                      "DeleteMeta.CheckResult.ConnectedStepSuccessfully",
                      String.valueOf(prev.size())),
                  stepMeta);
          remarks.add(cr);

          boolean first = true;
          error_message = "";
          boolean error_found = false;

          for (int i = 0; i < keyStream.length; i++) {
            ValueMetaInterface v = prev.searchValueMeta(keyStream[i]);
            if (v == null) {
              if (first) {
                first = false;
                error_message +=
                    BaseMessages.getString(PKG, "DeleteMeta.CheckResult.MissingFields") + Const.CR;
              }
              error_found = true;
              error_message += "\t\t" + keyStream[i] + Const.CR;
            }
          }
          for (int i = 0; i < keyStream2.length; i++) {
            if (keyStream2[i] != null && keyStream2[i].length() > 0) {
              ValueMetaInterface v = prev.searchValueMeta(keyStream2[i]);
              if (v == null) {
                if (first) {
                  first = false;
                  error_message +=
                      BaseMessages.getString(PKG, "DeleteMeta.CheckResult.MissingFields2")
                          + Const.CR;
                }
                error_found = true;
                error_message += "\t\t" + keyStream[i] + Const.CR;
              }
            }
          }
          if (error_found) {
            cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
          } else {
            cr =
                new CheckResult(
                    CheckResultInterface.TYPE_RESULT_OK,
                    BaseMessages.getString(PKG, "DeleteMeta.CheckResult.AllFieldsFound"),
                    stepMeta);
          }
          remarks.add(cr);

          // How about the fields to insert/update the table with?
          first = true;
          error_found = false;
          error_message = "";
        } else {
          error_message =
              BaseMessages.getString(PKG, "DeleteMeta.CheckResult.MissingFields3") + Const.CR;
          cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
          remarks.add(cr);
        }
      } catch (KettleException e) {
        error_message =
            BaseMessages.getString(PKG, "DeleteMeta.CheckResult.DatabaseError") + e.getMessage();
        cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
        remarks.add(cr);
      } finally {
        db.disconnect();
      }
    } else {
      error_message = BaseMessages.getString(PKG, "DeleteMeta.CheckResult.InvalidConnection");
      cr = new CheckResult(CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta);
      remarks.add(cr);
    }

    // See if we have input streams leading to this step!
    if (input.length > 0) {
      cr =
          new CheckResult(
              CheckResultInterface.TYPE_RESULT_OK,
              BaseMessages.getString(PKG, "DeleteMeta.CheckResult.StepReceivingInfo"),
              stepMeta);
      remarks.add(cr);
    } else {
      cr =
          new CheckResult(
              CheckResultInterface.TYPE_RESULT_ERROR,
              BaseMessages.getString(PKG, "DeleteMeta.CheckResult.NoInputReceived"),
              stepMeta);
      remarks.add(cr);
    }
  }