Java Code Examples for org.pentaho.di.core.row.value.ValueMetaString#getTrimTypeByCode()

The following examples show how to use org.pentaho.di.core.row.value.ValueMetaString#getTrimTypeByCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public FixedFileInputField( Node fnode ) {
  name = XMLHandler.getTagValue( fnode, "name" );
  type = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( fnode, "type" ) );
  format = XMLHandler.getTagValue( fnode, "format" );
  trimType = ValueMetaString.getTrimTypeByCode( XMLHandler.getTagValue( fnode, "trim_type" ) );
  currency = XMLHandler.getTagValue( fnode, "currency" );
  decimal = XMLHandler.getTagValue( fnode, "decimal" );
  grouping = XMLHandler.getTagValue( fnode, "group" );
  width = Const.toInt( XMLHandler.getTagValue( fnode, "width" ), -1 );
  length = Const.toInt( XMLHandler.getTagValue( fnode, "length" ), -1 );
  precision = Const.toInt( XMLHandler.getTagValue( fnode, "precision" ), -1 );

}
 
Example 2
private void readData( Node stepnode ) throws KettleXMLException {
  try {
    splitField = XMLHandler.getTagValue( stepnode, "splitfield" );
    delimiter = XMLHandler.getTagValue( stepnode, "delimiter" );
    enclosure = XMLHandler.getTagValue( stepnode, "enclosure" );

    final Node fields = XMLHandler.getSubNode( stepnode, "fields" );
    final int nrfields = XMLHandler.countNodes( fields, "field" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      final Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );

      fieldName[i] = XMLHandler.getTagValue( fnode, "name" );
      fieldID[i] = XMLHandler.getTagValue( fnode, "id" );
      final String sidrem = XMLHandler.getTagValue( fnode, "idrem" );
      final String stype = XMLHandler.getTagValue( fnode, "type" );
      fieldFormat[i] = XMLHandler.getTagValue( fnode, "format" );
      fieldGroup[i] = XMLHandler.getTagValue( fnode, "group" );
      fieldDecimal[i] = XMLHandler.getTagValue( fnode, "decimal" );
      fieldCurrency[i] = XMLHandler.getTagValue( fnode, "currency" );
      final String slen = XMLHandler.getTagValue( fnode, "length" );
      final String sprc = XMLHandler.getTagValue( fnode, "precision" );
      fieldNullIf[i] = XMLHandler.getTagValue( fnode, "nullif" );
      fieldIfNull[i] = XMLHandler.getTagValue( fnode, "ifnull" );
      final String trim = XMLHandler.getTagValue( fnode, "trimtype" );

      fieldRemoveID[i] = "Y".equalsIgnoreCase( sidrem );
      fieldType[i] = ValueMetaFactory.getIdForValueMeta( stype );
      fieldLength[i] = Const.toInt( slen, -1 );
      fieldPrecision[i] = Const.toInt( sprc, -1 );
      fieldTrimType[i] = ValueMetaString.getTrimTypeByCode( trim );
    }
  } catch ( Exception e ) {
    throw new KettleXMLException( BaseMessages.getString(
      PKG, "FieldSplitterMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
  }
}
 
Example 3
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    splitField = rep.getStepAttributeString( id_step, "splitfield" );
    delimiter = rep.getStepAttributeString( id_step, "delimiter" );
    enclosure = rep.getStepAttributeString( id_step, "enclosure" );

    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      fieldName[i] = rep.getStepAttributeString( id_step, i, "field_name" );
      fieldID[i] = rep.getStepAttributeString( id_step, i, "field_id" );
      fieldRemoveID[i] = rep.getStepAttributeBoolean( id_step, i, "field_idrem" );
      fieldType[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) );
      fieldFormat[i] = rep.getStepAttributeString( id_step, i, "field_format" );
      fieldGroup[i] = rep.getStepAttributeString( id_step, i, "field_group" );
      fieldDecimal[i] = rep.getStepAttributeString( id_step, i, "field_decimal" );
      fieldCurrency[i] = rep.getStepAttributeString( id_step, i, "field_currency" );
      fieldLength[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_length" );
      fieldPrecision[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_precision" );
      fieldNullIf[i] = rep.getStepAttributeString( id_step, i, "field_nullif" );
      fieldIfNull[i] = rep.getStepAttributeString( id_step, i, "field_ifnull" );
      fieldTrimType[i] =
        ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( id_step, i, "field_trimtype" ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "FieldSplitterMeta.Exception.UnexpectedErrorInReadingStepInfo" ), e );
  }
}
 
Example 4
Source Project: pentaho-kettle   File: SasInputField.java    License: Apache License 2.0 5 votes vote down vote up
public SasInputField( Repository rep, ObjectId stepId, int fieldNr ) throws KettleException {
  name = rep.getStepAttributeString( stepId, fieldNr, "field_name" );
  rename = rep.getStepAttributeString( stepId, fieldNr, "field_rename" );
  type = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( stepId, fieldNr, "field_type" ) );
  length = (int) rep.getStepAttributeInteger( stepId, fieldNr, "field_length" );
  precision = (int) rep.getStepAttributeInteger( stepId, fieldNr, "field_precision" );
  conversionMask = rep.getStepAttributeString( stepId, fieldNr, "field_conversion_mask" );
  decimalSymbol = rep.getStepAttributeString( stepId, fieldNr, "field_decimal" );
  groupingSymbol = rep.getStepAttributeString( stepId, fieldNr, "field_grouping" );
  trimType = ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( stepId, fieldNr, "field_trim_type" ) );
}
 
Example 5
Source Project: pentaho-kettle   File: SasInputField.java    License: Apache License 2.0 5 votes vote down vote up
public SasInputField( Node node ) throws KettleXMLException {
  name = XMLHandler.getTagValue( node, "name" );
  rename = XMLHandler.getTagValue( node, "rename" );
  type = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "type" ) );
  length = Const.toInt( XMLHandler.getTagValue( node, "length" ), -1 );
  precision = Const.toInt( XMLHandler.getTagValue( node, "precision" ), -1 );
  conversionMask = XMLHandler.getTagValue( node, "conversion_mask" );
  decimalSymbol = XMLHandler.getTagValue( node, "decimal" );
  groupingSymbol = XMLHandler.getTagValue( node, "grouping" );
  trimType = ValueMetaString.getTrimTypeByCode( XMLHandler.getTagValue( node, "trim_type" ) );
}
 
Example 6
Source Project: pentaho-kettle   File: RegexEvalMeta.java    License: Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
  try {
    script = rep.getStepAttributeString( id_step, "script" );
    matcher = rep.getStepAttributeString( id_step, "matcher" );
    resultfieldname = rep.getStepAttributeString( id_step, "resultfieldname" );
    usevar = rep.getStepAttributeBoolean( id_step, "usevar" );
    allowcapturegroups = rep.getStepAttributeBoolean( id_step, "allowcapturegroups" );
    replacefields = rep.getStepAttributeBoolean( id_step, "replacefields" );
    canoneq = rep.getStepAttributeBoolean( id_step, "canoneq" );
    caseinsensitive = rep.getStepAttributeBoolean( id_step, "caseinsensitive" );
    comment = rep.getStepAttributeBoolean( id_step, "comment" );
    multiline = rep.getStepAttributeBoolean( id_step, "multiline" );
    dotall = rep.getStepAttributeBoolean( id_step, "dotall" );
    unicode = rep.getStepAttributeBoolean( id_step, "unicode" );
    unix = rep.getStepAttributeBoolean( id_step, "unix" );

    int nrfields = rep.countNrStepAttributes( id_step, "field_name" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      fieldName[i] = rep.getStepAttributeString( id_step, i, "field_name" );
      fieldType[i] = ValueMetaFactory.getIdForValueMeta( rep.getStepAttributeString( id_step, i, "field_type" ) );

      fieldFormat[i] = rep.getStepAttributeString( id_step, i, "field_format" );
      fieldGroup[i] = rep.getStepAttributeString( id_step, i, "field_group" );
      fieldDecimal[i] = rep.getStepAttributeString( id_step, i, "field_decimal" );
      fieldLength[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_length" );
      fieldPrecision[i] = (int) rep.getStepAttributeInteger( id_step, i, "field_precision" );
      fieldNullIf[i] = rep.getStepAttributeString( id_step, i, "field_nullif" );
      fieldIfNull[i] = rep.getStepAttributeString( id_step, i, "field_ifnull" );
      fieldCurrency[i] = rep.getStepAttributeString( id_step, i, "field_currency" );
      fieldTrimType[i] =
        ValueMetaString.getTrimTypeByCode( rep.getStepAttributeString( id_step, i, "field_trimtype" ) );
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "RegexEvalMeta.Exception.UnexpectedErrorInReadingStepInfo" ), e );
  }
}
 
Example 7
@Override
public int string2intPrimitive( String v ) throws KettleValueException {
  return ValueMetaString.getTrimTypeByCode( v );
}
 
Example 8
Source Project: pentaho-kettle   File: RegexEvalMeta.java    License: Apache License 2.0 4 votes vote down vote up
private void readData( Node stepnode, List<? extends SharedObjectInterface> databases ) throws KettleXMLException {
  try {
    script = XMLHandler.getTagValue( stepnode, "script" );
    matcher = XMLHandler.getTagValue( stepnode, "matcher" );
    resultfieldname = XMLHandler.getTagValue( stepnode, "resultfieldname" );
    usevar = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "usevar" ) );
    allowcapturegroups = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "allowcapturegroups" ) );
    replacefields = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "replacefields" ) );
    canoneq = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "canoneq" ) );
    caseinsensitive = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "caseinsensitive" ) );
    comment = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "comment" ) );
    dotall = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "dotall" ) );
    multiline = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "multiline" ) );
    unicode = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "unicode" ) );
    unix = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "unix" ) );

    Node fields = XMLHandler.getSubNode( stepnode, "fields" );
    int nrfields = XMLHandler.countNodes( fields, "field" );

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );

      fieldName[i] = XMLHandler.getTagValue( fnode, "name" );
      final String stype = XMLHandler.getTagValue( fnode, "type" );
      fieldFormat[i] = XMLHandler.getTagValue( fnode, "format" );
      fieldGroup[i] = XMLHandler.getTagValue( fnode, "group" );
      fieldDecimal[i] = XMLHandler.getTagValue( fnode, "decimal" );
      fieldCurrency[i] = XMLHandler.getTagValue( fnode, "currency" );
      final String slen = XMLHandler.getTagValue( fnode, "length" );
      final String sprc = XMLHandler.getTagValue( fnode, "precision" );
      fieldNullIf[i] = XMLHandler.getTagValue( fnode, "nullif" );
      fieldIfNull[i] = XMLHandler.getTagValue( fnode, "ifnull" );
      final String trim = XMLHandler.getTagValue( fnode, "trimtype" );
      fieldType[i] = ValueMetaFactory.getIdForValueMeta( stype );
      fieldLength[i] = Const.toInt( slen, -1 );
      fieldPrecision[i] = Const.toInt( sprc, -1 );
      fieldTrimType[i] = ValueMetaString.getTrimTypeByCode( trim );
    }
  } catch ( Exception e ) {
    throw new KettleXMLException( BaseMessages.getString(
      PKG, "RegexEvalMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
  }
}
 
Example 9
Source Project: pentaho-kettle   File: BaseFileField.java    License: Apache License 2.0 4 votes vote down vote up
@Injection( name = "FIELD_TRIM_TYPE", group = "FIELDS" )
public void setTrimType( String value ) {
  this.trimtype = ValueMetaString.getTrimTypeByCode( value );
}