Package org.pentaho.di.core.row

Examples of org.pentaho.di.core.row.ValueMetaInterface


      final int colCount = rowMeta.size();
      final String fieldNames[] = new String[colCount];
      final Class fieldTypes[] = new Class[colCount];
      for (int columnNo = 0; columnNo < colCount; columnNo++)
      {
        final ValueMetaInterface valueMeta = rowMeta.getValueMeta(columnNo);
        fieldNames[columnNo] = valueMeta.getName();

        switch (valueMeta.getType())
        {
          case ValueMetaInterface.TYPE_BIGNUMBER:
            fieldTypes[columnNo] = BigDecimal.class;
            break;
          case ValueMetaInterface.TYPE_BOOLEAN:
View Full Code Here


        final int count = tableModel.getColumnCount();
        final Object dataRow[] = new Object[count];
        for (int columnNo = 0; columnNo < count; columnNo++)
        {
          final ValueMetaInterface valueMeta = rowMeta.getValueMeta(columnNo);

          switch (valueMeta.getType())
          {
            case ValueMetaInterface.TYPE_BIGNUMBER:
              dataRow[columnNo] = rowMeta.getBigNumber(row, columnNo);
              break;
            case ValueMetaInterface.TYPE_BOOLEAN:
View Full Code Here

      // null values don't need no special treatment, they'll become nil
      if (r[i] == null) {
        rubyRow.put(field, null);
      } else {

        ValueMetaInterface vm = rowMeta.getValueMeta(i);

        switch (vm.getType()) {
        case ValueMeta.TYPE_BOOLEAN:
          rubyRow.put(field, vm.getBoolean(r[i]));
          break;
        case ValueMeta.TYPE_INTEGER:
          rubyRow.put(field, vm.getInteger(r[i]));
          break;
        case ValueMeta.TYPE_STRING:
          rubyRow.put(field, vm.getString(r[i]));
          break;
        case ValueMeta.TYPE_NUMBER:
          rubyRow.put(field, vm.getNumber(r[i]));
          break;
        case ValueMeta.TYPE_NONE:
          rubyRow.put(field, r[i]);
          break;
        case ValueMeta.TYPE_SERIALIZABLE:
          if (r[i] instanceof RubyStepMarshalledObject) {
            Object restoredObject = getMarshal().callMethod(data.runtime.getCurrentContext(), "restore", data.runtime.newString(r[i].toString()));
            rubyRow.put(field, restoredObject);
          } else {
            // try to put the object in there as it is.. should create a nice adapter for the java object
            rubyRow.put(field, r[i]);
          }
          break;
        case ValueMeta.TYPE_BINARY:
          // put a ruby array with bytes in there, that is expensive and should probably be avoided
          rubyRow.put(fieldNames[i],
                data.runtime.newArrayNoCopy(JavaUtil.convertJavaArrayToRuby(data.runtime, ArrayUtils.toObject((byte[]) vm.getBinary(r[i]))))
                );

          break;

        case ValueMeta.TYPE_BIGNUMBER:
          IRubyObject bigDecimalObject = getBigDecimal().callMethod(data.runtime.getCurrentContext(), "new", data.runtime.newString((vm.getBigNumber(r[i])).toString()));
          rubyRow.put(field, bigDecimalObject);
          break;

        case ValueMeta.TYPE_DATE:
          rubyRow.put(field, data.runtime.newTime((vm.getDate(r[i])).getTime()));
          break;

        }

      }
View Full Code Here

        // if the field is not there, bail out
        if (idx < 0){
          throw new IllegalStateException("Field "+field.getName()+ "cannot be updated. I cannot find it!");
        }
       
        ValueMetaInterface v = r.getValueMeta(idx);
        if (v.getType() != field.getType()){
          // this field needs to be converted to another type
          ValueMetaInterface newValueMeta = new ValueMeta(field.getName(), field.getType());
          newValueMeta.setOrigin(origin);
          r.setValueMeta(idx, newValueMeta);
        }
       
        // add the field to affected fields
        affectedFields.add(r.getValueMeta(idx));       
       
      }
      else{
        // new field
        ValueMetaInterface v = new ValueMeta(field.getName(), field.getType());
        v.setOrigin(origin);
        r.addValueMeta(v);
       
        // add the last to affected fields (might have been renamed)
        v = r.getValueMetaList().get(r.getValueMetaList().size()-1);
        field.setName(v.getName());
        affectedFields.add(v);
       
      }
     
    }
View Full Code Here

      final int count = tableModel.getColumnCount();
      final Object dataRow[] = new Object[count];
      for (int columnNo = 0; columnNo < count; columnNo++)
      {
        final ValueMetaInterface valueMeta = rowMeta.getValueMeta(columnNo);

        switch (valueMeta.getType())
        {
          case ValueMetaInterface.TYPE_BIGNUMBER:
            dataRow[columnNo] = rowMeta.getBigNumber(row, columnNo);
            break;
          case ValueMetaInterface.TYPE_BOOLEAN:
View Full Code Here

    final int colCount = rowMeta.size();
    final String fieldNames[] = new String[colCount];
    final Class<?> fieldTypes[] = new Class<?>[colCount];
    for (int columnNo = 0; columnNo < colCount; columnNo++)
    {
      final ValueMetaInterface valueMeta = rowMeta.getValueMeta(columnNo);
      fieldNames[columnNo] = valueMeta.getName();

      switch (valueMeta.getType())
      {
        case ValueMetaInterface.TYPE_BIGNUMBER:
          fieldTypes[columnNo] = BigDecimal.class;
          break;
        case ValueMetaInterface.TYPE_BOOLEAN:
View Full Code Here

    /*
     * This implementation appends the outputField to the row-stream
     */
        if(getProcessType() == Process.LIST){
    // a value meta object contains the meta data for a field
    ValueMetaInterface v = new ValueMeta("id", ValueMeta.TYPE_STRING);
   
    // setting trim type to "both"
    v.setTrimType(ValueMeta.TRIM_TYPE_BOTH);

    // the name of the step that adds this field
    v.setOrigin(name);
   
    // modify the row structure and add the field this step generates 
    inputRowMeta.addValueMeta(v);

        ValueMetaInterface v2 = new ValueMeta("type", ValueMeta.TYPE_STRING);
        v2.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
        v2.setOrigin(name);
        inputRowMeta.addValueMeta(v2);

        ValueMetaInterface v3 = new ValueMeta("name", ValueMeta.TYPE_STRING);
        v3.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
        v3.setOrigin(name);
        inputRowMeta.addValueMeta(v3);

        ValueMetaInterface v4 = new ValueMeta("structure", ValueMeta.TYPE_STRING);
        v4.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
        v4.setOrigin(name);
        inputRowMeta.addValueMeta(v4);

        ValueMetaInterface v5 = new ValueMeta("transferstatus", ValueMeta.TYPE_STRING);
        v5.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
        v5.setOrigin(name);
        inputRowMeta.addValueMeta(v5);

        ValueMetaInterface v6 = new ValueMeta("metadata", ValueMeta.TYPE_STRING);
        v6.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
        v6.setOrigin(name);
        inputRowMeta.addValueMeta(v6);
        }
        else{
            ValueMetaInterface v6 = new ValueMeta("export", ValueMeta.TYPE_STRING);
            v6.setTrimType(ValueMeta.TRIM_TYPE_BOTH);
            v6.setOrigin(name);
            inputRowMeta.addValueMeta(v6);
        }
  }
View Full Code Here

    /*
     * This implementation appends the outputField to the row-stream
     */

    // a value meta object contains the meta data for a field
    ValueMetaInterface v = new ValueMeta(outputField, ValueMeta.TYPE_STRING);
   
    // setting trim type to "both"
    v.setTrimType(ValueMeta.TRIM_TYPE_BOTH);

    // the name of the step that adds this field
    v.setOrigin(name);
   
    // modify the row structure and add the field this step generates 
    inputRowMeta.addValueMeta(v);
   
  }
View Full Code Here

    /*
     * This implementation appends the outputField to the row-stream
     */

    // a value meta object contains the meta data for a field
    ValueMetaInterface v = new ValueMeta(outputField, ValueMeta.TYPE_STRING);
   
    // setting trim type to "both"
    v.setTrimType(ValueMeta.TRIM_TYPE_BOTH);

    // the name of the step that adds this field
    v.setOrigin(name);
   
    // modify the row structure and add the field this step generates 
    inputRowMeta.addValueMeta(v);
   
  }
View Full Code Here

    /*
     * This implementation appends the outputField to the row-stream
     */

    // a value meta object contains the meta data for a field
    ValueMetaInterface v = new ValueMeta(outputField, ValueMeta.TYPE_STRING);
   
    // setting trim type to "both"
    v.setTrimType(ValueMeta.TRIM_TYPE_BOTH);

    // the name of the step that adds this field
    v.setOrigin(name);
   
    // modify the row structure and add the field this step generates 
    inputRowMeta.addValueMeta(v);
   
  }
View Full Code Here

TOP

Related Classes of org.pentaho.di.core.row.ValueMetaInterface

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.