예제 #1
0
 public RowMetaInterface createResultRowMetaInterface() {
   RowMetaInterface rm = new RowMeta();
   try {
     ValueMetaInterface[] valuesMeta = {
       ValueMetaFactory.createValueMeta("timestamp1", ValueMetaInterface.TYPE_TIMESTAMP),
       ValueMetaFactory.createValueMeta("int1", ValueMetaInterface.TYPE_INTEGER),
       ValueMetaFactory.createValueMeta("timestamp plus 1 day", ValueMetaInterface.TYPE_DATE)
     };
     for (int i = 0; i < valuesMeta.length; i++) {
       rm.addValueMeta(valuesMeta[i]);
     }
   } catch (Exception ex) {
     return null;
   }
   return rm;
 }
  @Override
  public void getFields(
      RowMetaInterface row,
      String name,
      RowMetaInterface[] info,
      StepMeta nextStep,
      VariableSpace space,
      Repository repository,
      IMetaStore metaStore)
      throws KettleStepException {

    for (SasInputField field : outputFields) {
      try {
        ValueMetaInterface valueMeta =
            ValueMetaFactory.createValueMeta(field.getRename(), field.getType());
        valueMeta.setLength(field.getLength(), field.getPrecision());
        valueMeta.setDecimalSymbol(field.getDecimalSymbol());
        valueMeta.setGroupingSymbol(field.getGroupingSymbol());
        valueMeta.setConversionMask(field.getConversionMask());
        valueMeta.setTrimType(field.getTrimType());
        valueMeta.setOrigin(name);

        row.addValueMeta(valueMeta);
      } catch (Exception e) {
        throw new KettleStepException(e);
      }
    }
  }
예제 #3
0
  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++) {
      RssInputField field = inputFields[i];

      int type = field.getType();
      if (type == ValueMeta.TYPE_NONE) type = ValueMeta.TYPE_STRING;
      try {
        ValueMetaInterface v =
            ValueMetaFactory.createValueMeta(space.environmentSubstitute(field.getName()), type);
        v.setLength(field.getLength(), field.getPrecision());
        v.setOrigin(name);
        r.addValueMeta(v);
      } catch (Exception e) {
        throw new KettleStepException(e);
      }
    }

    if (includeUrl) {
      ValueMetaInterface v =
          new ValueMeta(space.environmentSubstitute(urlField), ValueMeta.TYPE_STRING);
      v.setLength(100, -1);
      v.setOrigin(name);
      r.addValueMeta(v);
    }

    if (includeRowNumber) {
      ValueMetaInterface v =
          new ValueMeta(space.environmentSubstitute(rowNumberField), ValueMeta.TYPE_INTEGER);
      v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
      v.setOrigin(name);
      r.addValueMeta(v);
    }
  }
 public void init(int index) throws KettlePluginException {
   m_tmpValueMeta = ValueMetaFactory.createValueMeta(ValueMeta.getType(m_kettleType));
   m_outputIndex = index;
 }
예제 #5
0
  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);
    }
  }