コード例 #1
0
ファイル: AppendMeta.java プロジェクト: MarsChan/learngit
 public void saveRep(
     Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step)
     throws KettleException {
   try {
     List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
     StreamInterface headStream = infoStreams.get(0);
     StreamInterface tailStream = infoStreams.get(1);
     rep.saveStepAttribute(id_transformation, id_step, "head_name", headStream.getStepname());
     rep.saveStepAttribute(id_transformation, id_step, "tail_name", tailStream.getStepname());
   } catch (Exception e) {
     throw new KettleException(
         BaseMessages.getString(PKG, "AppendMeta.Exception.UnableToSaveStepInfo") + id_step, e);
   }
 }
コード例 #2
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();
  }
コード例 #3
0
ファイル: AppendMeta.java プロジェクト: MarsChan/learngit
  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;

    List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
    StreamInterface headStream = infoStreams.get(0);
    StreamInterface tailStream = infoStreams.get(1);

    if (headStream.getStepname() != null && tailStream.getStepname() != null) {
      cr =
          new CheckResult(
              CheckResultInterface.TYPE_RESULT_OK,
              BaseMessages.getString(PKG, "AppendMeta.CheckResult.SourceStepsOK"),
              stepMeta);
      remarks.add(cr);
    } else if (headStream.getStepname() == null && tailStream.getStepname() == null) {
      cr =
          new CheckResult(
              CheckResultInterface.TYPE_RESULT_ERROR,
              BaseMessages.getString(PKG, "AppendMeta.CheckResult.SourceStepsMissing"),
              stepMeta);
      remarks.add(cr);
    } else {
      cr =
          new CheckResult(
              CheckResultInterface.TYPE_RESULT_OK,
              BaseMessages.getString(PKG, "AppendMeta.CheckResult.OneSourceStepMissing"),
              stepMeta);
      remarks.add(cr);
    }
  }