• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValueMetaAndData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ValueMetaAndData类属于org.pentaho.di.core.row包,在下文中一共展示了ValueMetaAndData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: test

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
/**
 * Test the entered value
 *
 */
public void test() {
  try {
    ValueMetaAndData v = getValue(valueMeta.getName());
    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);

    StringBuffer result = new StringBuffer();
    result.append(Const.CR).append(Const.CR).append("    ").append(v.toString());
    result.append(Const.CR).append("    ").append(v.toStringMeta());

    mb.setMessage(Messages.getString("EnterValueDialog.TestResult.Message", result.toString()));
    mb.setText(Messages.getString("EnterValueDialog.TestResult.Title"));
    mb.open();
  } catch (KettleValueException e) {
    new ErrorDialog(shell, "Error", "There was an error during data type conversion: ", e);
  }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:21,代码来源:EnterValueDialog.java


示例3: test

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
/**
 * Test the entered value
 *
 */
public void test() {
  try {
    ValueMetaAndData v = getValue(valueMeta.getName());
    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);

    StringBuffer result = new StringBuffer();
    result.append(Const.CR).append(Const.CR).append("    ").append(v.toString());
    result.append(Const.CR).append("    ").append(v.toStringMeta());

    mb.setMessage(BaseMessages.getString(PKG, "EnterValueDialog.TestResult.Message", result.toString()));
    mb.setText(BaseMessages.getString(PKG, "EnterValueDialog.TestResult.Title"));
    mb.open();
  } catch (KettleValueException e) {
    new ErrorDialog(shell, "Error", "There was an error during data type conversion: ", e);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:EnterValueDialog.java


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: test

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
/**
 * Test the entered value
 *
 */
public void test() {
  try {
    ValueMetaAndData v = getValue( valueMeta.getName() );
    MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_INFORMATION );

    StringBuilder result = new StringBuilder();
    result.append( Const.CR ).append( Const.CR ).append( "    " ).append( v.toString() );
    result.append( Const.CR ).append( "    " ).append( v.toStringMeta() );

    mb.setMessage( BaseMessages.getString( PKG, "EnterValueDialog.TestResult.Message", result.toString() ) );
    mb.setText( BaseMessages.getString( PKG, "EnterValueDialog.TestResult.Title" ) );
    mb.open();
  } catch ( KettleValueException e ) {
    new ErrorDialog( shell, "Error", "There was an error during data type conversion: ", e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:EnterValueDialog.java


示例9: Condition

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
public Condition(String valuename, int function, String valuename2, ValueMetaAndData exact)
{
	this();
	this.left_valuename  = valuename;
	this.function        = function;
	this.right_valuename = valuename2;
	this.right_exact     = exact;
	
	clearFieldPositions();
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:11,代码来源:Condition.java


示例10: clone

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
public Object clone()
{
	Condition retval = null;

	retval = new Condition();
	retval.negate = negate;
	retval.operator = operator;

	if (isComposite())
	{
		for (int i=0;i<nrConditions();i++)
		{
			Condition c = getCondition(i);
			Condition cCopy = (Condition)c.clone();
			retval.addCondition(cCopy);	
		}
	}
	else
	{
           retval.negate          = negate;
		retval.left_valuename  = left_valuename;
		retval.operator        = operator;
		retval.right_valuename = right_valuename;
		retval.function        = function;
		if (right_exact!=null)
		{
			retval.right_exact = (ValueMetaAndData) right_exact.clone();
		}
		else
		{
			retval.right_exact = null;
		}
		}
	
	return retval;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:37,代码来源:Condition.java


示例11: convert

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
private Object convert(Object obj, AccessInputField field, int index) throws Exception
{
	// Get column
	Column c = data.t.getColumn(field.getColumn());
	// Find out field type
	ValueMetaAndData sourceValueMetaAndData= AccessInputMeta.getValueMetaAndData(c, field.getName(), obj);

	// DO CONVERSIONS...
	//
	ValueMetaInterface targetValueMeta = data.outputRowMeta.getValueMeta(data.totalpreviousfields+index);
	return targetValueMeta.convertData(sourceValueMetaAndData.getValueMeta(), sourceValueMetaAndData.getValueData());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:13,代码来源:AccessInput.java


示例12: getValueMeta

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
/**
 * Returns kettle type from Microsoft Access database
 * @param : MS Access column
 * @return valuemeta 
 */
public static ValueMetaInterface getValueMeta(Column c)
{
	// get value
	ValueMetaAndData vmd=getValueMetaAndData(c, null, null);
	if(vmd!=null) {
		// returns meta
		return vmd.getValueMeta();
	}
	return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:16,代码来源:AccessInputMeta.java


示例13: getAtomicConditionRightSql

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
private String getAtomicConditionRightSql(Condition atomicCondition) throws KettleValueException {
  ValueMetaAndData right = atomicCondition.getRightExact();
  if (right==null) {
    // right value
    // 
    String rightName = atomicCondition.getRightValuename(); 
    FieldVariableMapping mapping = FieldVariableMapping.findFieldVariableMappingByFieldName(service.getFieldVariableMappings(), atomicCondition.getRightValuename());
    if (mapping!=null) {
      rightName = mapping.getVariableName();
    }
    return rightName;
  }
  if (right.getValueMeta().isNull(right.getValueData())) {
    return "NULL";
  }
  switch(right.getValueMeta().getType()) {
  case ValueMetaInterface.TYPE_STRING: 
    return "'"+right.toString()+"'";
  case ValueMetaInterface.TYPE_NUMBER: 
  case ValueMetaInterface.TYPE_INTEGER: 
  case ValueMetaInterface.TYPE_BIGNUMBER: 
      return sqlNumericFormat.format(right.getValueMeta().convertToNormalStorageType(right.getValueData()));
  case ValueMetaInterface.TYPE_DATE: 
    return sqlDateFormat.format(right.getValueMeta().getDate(right.getValueData()));
  case ValueMetaInterface.TYPE_BOOLEAN:
    return right.getValueMeta().getBoolean(right.getValueData()) ? "TRUE" : "FALSE";
  default:
    throw new KettleValueException("Unsupported conversion of value from "+right.getValueMeta().toStringMeta()+" to SQL");
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:31,代码来源:SqlTransExecutor.java


示例14: getJsonString

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
protected String getJsonString(ValueMetaAndData v) throws KettleValueException {
  ValueMetaInterface meta = v.getValueMeta();
  Object data = v.getValueData();
  
  switch(meta.getType()) {
  case ValueMetaInterface.TYPE_STRING: return '"'+meta.getString(data)+'"';
  case ValueMetaInterface.TYPE_NUMBER: return sqlNumericFormat.format(meta.getNumber(data));
  case ValueMetaInterface.TYPE_INTEGER: return sqlNumericFormat.format(meta.getInteger(data));
  case ValueMetaInterface.TYPE_BIGNUMBER: return sqlNumericFormat.format(meta.getBigNumber(data));
  case ValueMetaInterface.TYPE_DATE: return "{ $date : \""+jsonDateFormat.format(meta.getBigNumber(data))+"\" }";
  default:
    throw new KettleValueException("Converting data type "+meta.toStringMeta()+" to a JSON value is not yet supported");
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:15,代码来源:SqlTransExecutor.java


示例15: attemptDateValueExtraction

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
public static ValueMetaAndData attemptDateValueExtraction(String string) {
  if (string.length()>2 && string.startsWith("[") && string.endsWith("]")) {
    String unquoted=string.substring(1, string.length()-1);
    if (unquoted.length()>=9 && unquoted.charAt(4)=='/' && unquoted.charAt(7)=='/') {
      Date date = XMLHandler.stringToDate(unquoted);
      String format = "yyyy/MM/dd HH:mm:ss.SSS";
      if (date==null) {
        try {
          date = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse(unquoted);
          format = "yyyy/MM/dd HH:mm:ss";
        } catch(ParseException e1) {
          try {
            date = new SimpleDateFormat("yyyy/MM/dd").parse(unquoted);
            format = "yyyy/MM/dd";
          } catch (ParseException e2) {
            date=null;
          }
        }
      }
      if (date!=null) {
        ValueMetaInterface valueMeta = new ValueMeta("iif-date", ValueMetaInterface.TYPE_DATE);
        valueMeta.setConversionMask(format);
        return new ValueMetaAndData(valueMeta, date);
     
      } 
    }
  }
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:30,代码来源:ThinUtil.java


示例16: 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


示例17: 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


示例18: 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


示例19: extractConstant

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
public static ValueMetaAndData extractConstant(String string) {
  // Try a date
  //
  ValueMetaAndData value = attemptDateValueExtraction(string);
  if (value!=null) return value;
  
  // String
  value = attemptStringValueExtraction(string);
  if (value!=null) return value;

  // Boolean
  value = attemptBooleanValueExtraction(string);
  if (value!=null) return value;

  // Integer
  value = attemptIntegerValueExtraction(string);
  if (value!=null) return value;

  // Number
  value = attemptNumberValueExtraction(string);
  if (value!=null) return value;

  // Number
  value = attemptBigNumberValueExtraction(string);
  if (value!=null) return value;
  
  return null;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:29,代码来源:ThinUtil.java


示例20: extractValue

import org.pentaho.di.core.row.ValueMetaAndData; //导入依赖的package包/类
private ValueMetaAndData extractValue(String string, boolean trueIndicator) throws KettleSQLException {
  if (Const.isEmpty(string)) {
    return null;
  }
  
  ValueMetaAndData value = ThinUtil.attemptDateValueExtraction(string);
  if (value!=null) return value;
  
  value = ThinUtil.attemptStringValueExtraction(string);
  if (value!=null) return value;
  
  // See if it's a field...
  //
  int index = serviceFields.indexOfValue(string);
  if (index>=0) {
    if (trueIndicator) {
      trueField=true;
    } else {
      falseField=true;
    }
    return new ValueMetaAndData(serviceFields.getValueMeta(index), null);
  }

  value = ThinUtil.attemptBooleanValueExtraction(string);
  if (value!=null) return value;

  value = ThinUtil.attemptIntegerValueExtraction(string);
  if (value!=null) return value;

  value = ThinUtil.attemptNumberValueExtraction(string);
  if (value!=null) return value;

  value = ThinUtil.attemptBigNumberValueExtraction(string);
  if (value!=null) return value;

  throw new KettleSQLException("Unable to determine value data type for string: ["+string+"]");
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:38,代码来源:IifFunction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SourceCodeModule类代码示例发布时间:2022-05-22
下一篇:
Java Column类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap