当前位置: 首页>>代码示例>>Java>>正文


Java ValueMetaAndData.setValueData方法代码示例

本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaAndData.setValueData方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaAndData.setValueData方法的具体用法?Java ValueMetaAndData.setValueData怎么用?Java ValueMetaAndData.setValueData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.row.ValueMetaAndData的用法示例。


在下文中一共展示了ValueMetaAndData.setValueData方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
private ValueMetaAndData getValue(String valuename) throws KettleValueException {
  int valtype = ValueMeta.getType(wValueType.getText());
  ValueMetaAndData val = new ValueMetaAndData(valuename, wInputString.getText());

  ValueMetaInterface valueMeta = val.getValueMeta();
  Object valueData = val.getValueData();

  valueMeta.setType(valtype);
  int formatIndex = wFormat.getSelectionIndex();
  valueMeta.setConversionMask(formatIndex >= 0 ? wFormat.getItem(formatIndex) : wFormat.getText());
  valueMeta.setLength(Const.toInt(wLength.getText(), -1));
  valueMeta.setPrecision(Const.toInt(wPrecision.getText(), -1));

  ValueMetaInterface stringValueMeta = new ValueMeta(valuename, ValueMetaInterface.TYPE_STRING);
  stringValueMeta.setConversionMetadata(valueMeta);

  Object targetData = stringValueMeta.convertDataUsingConversionMetaData(valueData);
  val.setValueData(targetData);

  return val;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:22,代码来源:EnterValueDialog.java

示例2: getValue

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
private ValueMetaAndData getValue(String valuename) throws KettleValueException {
  try {
    int valtype = ValueMeta.getType(wValueType.getText());
    ValueMetaAndData val = new ValueMetaAndData(valuename, wInputString.getText());

    ValueMetaInterface valueMeta = ValueMetaFactory.cloneValueMeta(val.getValueMeta(), valtype);
    Object valueData = val.getValueData();

    int formatIndex = wFormat.getSelectionIndex();
    valueMeta.setConversionMask(formatIndex >= 0 ? wFormat.getItem(formatIndex) : wFormat.getText());
    valueMeta.setLength(Const.toInt(wLength.getText(), -1));
    valueMeta.setPrecision(Const.toInt(wPrecision.getText(), -1));

    ValueMetaInterface stringValueMeta = new ValueMeta(valuename, ValueMetaInterface.TYPE_STRING);
    stringValueMeta.setConversionMetadata(valueMeta);

    Object targetData = stringValueMeta.convertDataUsingConversionMetaData(valueData);
    val.setValueData(targetData);

    return val;
  } catch(Exception e) {
    throw new KettleValueException(e);
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:25,代码来源:EnterValueDialog.java

示例3: attemptIntegerValueExtraction

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public static ValueMetaAndData attemptIntegerValueExtraction(String string) {
  // Try an Integer
  if (!string.contains(".")) {
    try {
      long l = Long.parseLong(string);
      if (Long.toString(l).equals(string)) {
        ValueMetaAndData value = new ValueMetaAndData();
        ValueMetaInterface valueMeta = new ValueMeta("Constant", ValueMetaInterface.TYPE_INTEGER);
        valueMeta.setConversionMask("0");
        valueMeta.setGroupingSymbol(null);
        value.setValueMeta(valueMeta);
        value.setValueData(Long.valueOf(l));
        return value;
      }
    } catch(NumberFormatException e) {
    }
  }
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:ThinUtil.java

示例4: attemptNumberValueExtraction

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public static ValueMetaAndData attemptNumberValueExtraction(String string) {
  // Try a Number
  try {
    double d = Double.parseDouble(string);
    if (Double.toString(d).equals(string)) {
      ValueMetaAndData value = new ValueMetaAndData();
      ValueMetaInterface valueMeta = new ValueMeta("Constant", ValueMetaInterface.TYPE_NUMBER);
      valueMeta.setConversionMask("0.#");
      valueMeta.setGroupingSymbol(null);
      valueMeta.setDecimalSymbol(".");
      value.setValueMeta(valueMeta);
      value.setValueData(Double.valueOf(d));
      return value;
    }
  } catch(NumberFormatException e) {
  }
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:19,代码来源:ThinUtil.java

示例5: getValue

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
private ValueMetaAndData getValue( String valuename ) throws KettleValueException {
  try {
    int valtype = ValueMetaFactory.getIdForValueMeta( wValueType.getText() );
    ValueMetaAndData val = new ValueMetaAndData( valuename, wInputString.getText() );

    ValueMetaInterface valueMeta = ValueMetaFactory.cloneValueMeta( val.getValueMeta(), valtype );
    Object valueData = val.getValueData();

    int formatIndex = wFormat.getSelectionIndex();
    valueMeta.setConversionMask( formatIndex >= 0 ? wFormat.getItem( formatIndex ) : wFormat.getText() );
    valueMeta.setLength( Const.toInt( wLength.getText(), -1 ) );
    valueMeta.setPrecision( Const.toInt( wPrecision.getText(), -1 ) );
    val.setValueMeta( valueMeta );

    ValueMetaInterface stringValueMeta = new ValueMetaString( valuename );
    stringValueMeta.setConversionMetadata( valueMeta );

    Object targetData = stringValueMeta.convertDataUsingConversionMetaData( valueData );
    val.setValueData( targetData );

    return val;
  } catch ( Exception e ) {
    throw new KettleValueException( e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:EnterValueDialog.java

示例6: attemptBigNumberValueExtraction

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public static ValueMetaAndData attemptBigNumberValueExtraction(String string) {
  // Try a BigNumber
  try {
    BigDecimal d = new BigDecimal(string);
    if (d.toString().equals(string)) {
      ValueMetaAndData value = new ValueMetaAndData();
      value.setValueMeta(new ValueMeta("Constant", ValueMetaInterface.TYPE_BIGNUMBER));
      value.setValueData(d);
      return value;
    }
  } catch(NumberFormatException e) {
  }
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:15,代码来源:ThinUtil.java

示例7: attemptStringValueExtraction

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public static ValueMetaAndData attemptStringValueExtraction(String string) {
  if (string.startsWith("'") && string.endsWith("'")) {
    String s = string.substring(1, string.length()-1);
    ValueMetaAndData value = new ValueMetaAndData();
    value.setValueMeta(new ValueMeta("Constant", ValueMetaInterface.TYPE_STRING));
    value.setValueData(s);
    return value;
  }
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:11,代码来源:ThinUtil.java

示例8: attemptBooleanValueExtraction

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public static ValueMetaAndData attemptBooleanValueExtraction(String string) {
  // Try an Integer
  if ("TRUE".equalsIgnoreCase(string) || "FALSE".equalsIgnoreCase(string)) {
    ValueMetaAndData value = new ValueMetaAndData();
    value.setValueMeta(new ValueMeta("Constant", ValueMetaInterface.TYPE_BOOLEAN));
    value.setValueData(Boolean.valueOf( "TRUE".equalsIgnoreCase(string) ));
    return value;
  }
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:11,代码来源:ThinUtil.java

示例9: loadValueMetaAndData

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public ValueMetaAndData loadValueMetaAndData(ObjectId id_value) throws KettleException
  {
ValueMetaAndData valueMetaAndData = new ValueMetaAndData();
      try
      {
          RowMetaAndData r = getValue(id_value);
          if (r!=null)
          {
              String name    = r.getString(KettleDatabaseRepository.FIELD_VALUE_NAME, null);
              int valtype    = ValueMeta.getType( r.getString(KettleDatabaseRepository.FIELD_VALUE_VALUE_TYPE, null) );
              boolean isNull = r.getBoolean(KettleDatabaseRepository.FIELD_VALUE_IS_NULL, false);
              valueMetaAndData.setValueMeta(new ValueMeta(name, valtype));

              if (isNull)
              {
              	valueMetaAndData.setValueData(null);
              }
              else
              {
                  ValueMetaInterface stringValueMeta = new ValueMeta(name, ValueMetaInterface.TYPE_STRING);
                  ValueMetaInterface valueMeta = valueMetaAndData.getValueMeta();
                  stringValueMeta.setConversionMetadata(valueMeta);
                  
                  valueMeta.setDecimalSymbol(ValueMetaAndData.VALUE_REPOSITORY_DECIMAL_SYMBOL);
                  valueMeta.setGroupingSymbol(ValueMetaAndData.VALUE_REPOSITORY_GROUPING_SYMBOL);
                  
                  switch(valueMeta.getType())
                  {
                  case ValueMetaInterface.TYPE_NUMBER:
                  	valueMeta.setConversionMask(ValueMetaAndData.VALUE_REPOSITORY_NUMBER_CONVERSION_MASK);
                  	break;
                  case ValueMetaInterface.TYPE_INTEGER:
                  	valueMeta.setConversionMask(ValueMetaAndData.VALUE_REPOSITORY_INTEGER_CONVERSION_MASK);
                  	break;
                  default:
                  	break;
                  }
                  
                  String string = r.getString("VALUE_STR", null);
                  valueMetaAndData.setValueData(stringValueMeta.convertDataUsingConversionMetaData(string));
                  
                  // OK, now comes the dirty part...
                  // We want the defaults back on there...
                  //
                  valueMeta = new ValueMeta(name, valueMeta.getType());
              }
          }
          
          return valueMetaAndData;
      }
      catch(KettleException dbe)
      {
          throw new KettleException("Unable to load Value from repository with id_value="+id_value, dbe);
      }
  }
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:56,代码来源:KettleDatabaseRepositoryValueDelegate.java

示例10: loadValueMetaAndData

import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public ValueMetaAndData loadValueMetaAndData( ObjectId id_value ) throws KettleException {
  ValueMetaAndData valueMetaAndData = new ValueMetaAndData();
  try {
    RowMetaAndData r = getValue( id_value );
    if ( r != null ) {
      String name = r.getString( KettleDatabaseRepository.FIELD_VALUE_NAME, null );
      int valtype = ValueMetaFactory.getIdForValueMeta(
        r.getString( KettleDatabaseRepository.FIELD_VALUE_VALUE_TYPE, null ) );
      boolean isNull = r.getBoolean( KettleDatabaseRepository.FIELD_VALUE_IS_NULL, false );
      ValueMetaInterface v = ValueMetaFactory.createValueMeta( name, valtype );
      valueMetaAndData.setValueMeta( v );

      if ( isNull ) {
        valueMetaAndData.setValueData( null );
      } else {
        ValueMetaInterface stringValueMeta = new ValueMetaString( name );
        ValueMetaInterface valueMeta = valueMetaAndData.getValueMeta();
        stringValueMeta.setConversionMetadata( valueMeta );

        valueMeta.setDecimalSymbol( ValueMetaAndData.VALUE_REPOSITORY_DECIMAL_SYMBOL );
        valueMeta.setGroupingSymbol( ValueMetaAndData.VALUE_REPOSITORY_GROUPING_SYMBOL );

        switch ( valueMeta.getType() ) {
          case ValueMetaInterface.TYPE_NUMBER:
            valueMeta.setConversionMask( ValueMetaAndData.VALUE_REPOSITORY_NUMBER_CONVERSION_MASK );
            break;
          case ValueMetaInterface.TYPE_INTEGER:
            valueMeta.setConversionMask( ValueMetaAndData.VALUE_REPOSITORY_INTEGER_CONVERSION_MASK );
            break;
          default:
            break;
        }

        String string = r.getString( "VALUE_STR", null );
        valueMetaAndData.setValueData( stringValueMeta.convertDataUsingConversionMetaData( string ) );

        // OK, now comes the dirty part...
        // We want the defaults back on there...
        //
        valueMeta = ValueMetaFactory.createValueMeta( name, valueMeta.getType() );
      }
    }

    return valueMetaAndData;
  } catch ( KettleException dbe ) {
    throw new KettleException( "Unable to load Value from repository with id_value=" + id_value, dbe );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:49,代码来源:KettleDatabaseRepositoryValueDelegate.java


注:本文中的org.pentaho.di.core.row.ValueMetaAndData.setValueData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。