本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaAndData.getValueMeta方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaAndData.getValueMeta方法的具体用法?Java ValueMetaAndData.getValueMeta怎么用?Java ValueMetaAndData.getValueMeta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaAndData
的用法示例。
在下文中一共展示了ValueMetaAndData.getValueMeta方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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");
}
}
示例4: 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;
}
示例5: insertCondition
import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public synchronized long insertCondition(long id_condition_parent, Condition condition) throws KettleException
{
long id = getNextConditionID();
String tablename = TABLE_R_CONDITION;
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMeta(FIELD_CONDITION_ID_CONDITION, ValueMetaInterface.TYPE_INTEGER), Long.valueOf(id));
table.addValue(new ValueMeta(FIELD_CONDITION_ID_CONDITION_PARENT, ValueMetaInterface.TYPE_INTEGER), Long.valueOf(id_condition_parent));
table.addValue(new ValueMeta(FIELD_CONDITION_NEGATED, ValueMetaInterface.TYPE_BOOLEAN), Boolean.valueOf(condition.isNegated()));
table.addValue(new ValueMeta(FIELD_CONDITION_OPERATOR, ValueMetaInterface.TYPE_STRING), condition.getOperatorDesc());
table.addValue(new ValueMeta(FIELD_CONDITION_LEFT_NAME, ValueMetaInterface.TYPE_STRING), condition.getLeftValuename());
table.addValue(new ValueMeta(FIELD_CONDITION_CONDITION_FUNCTION, ValueMetaInterface.TYPE_STRING), condition.getFunctionDesc());
table.addValue(new ValueMeta(FIELD_CONDITION_RIGHT_NAME, ValueMetaInterface.TYPE_STRING), condition.getRightValuename());
long id_value = -1L;
ValueMetaAndData v = condition.getRightExact();
if (v != null)
{
// We have to make sure that all data is saved irrespective of locale differences.
// Here is where we force that
//
ValueMetaInterface valueMeta = v.getValueMeta();
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;
case ValueMetaInterface.TYPE_DATE:
valueMeta.setConversionMask(ValueMetaAndData.VALUE_REPOSITORY_DATE_CONVERSION_MASK);
break;
default:
break;
}
String stringValue = valueMeta.getString(v.getValueData());
id_value = insertValue(valueMeta.getName(), valueMeta.getTypeDesc(), stringValue, valueMeta.isNull(v.getValueData()), condition.getRightExactID());
condition.setRightExactID(id_value);
}
table.addValue(new ValueMeta(FIELD_CONDITION_ID_VALUE_RIGHT, ValueMetaInterface.TYPE_INTEGER), new Long(id_value));
database.prepareInsert(table.getRowMeta(), tablename);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
return id;
}
示例6: insertCondition
import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public synchronized ObjectId insertCondition(ObjectId id_condition_parent, Condition condition) throws KettleException
{
ObjectId id = repository.connectionDelegate.getNextConditionID();
String tablename = KettleDatabaseRepository.TABLE_R_CONDITION;
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_ID_CONDITION, ValueMetaInterface.TYPE_INTEGER), id);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_ID_CONDITION_PARENT, ValueMetaInterface.TYPE_INTEGER), id_condition_parent);
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_NEGATED, ValueMetaInterface.TYPE_BOOLEAN), Boolean.valueOf(condition.isNegated()));
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_OPERATOR, ValueMetaInterface.TYPE_STRING), condition.getOperatorDesc());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_LEFT_NAME, ValueMetaInterface.TYPE_STRING), condition.getLeftValuename());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_CONDITION_FUNCTION, ValueMetaInterface.TYPE_STRING), condition.getFunctionDesc());
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_RIGHT_NAME, ValueMetaInterface.TYPE_STRING), condition.getRightValuename());
ObjectId id_value = null;
ValueMetaAndData v = condition.getRightExact();
if (v != null)
{
// We have to make sure that all data is saved irrespective of locale differences.
// Here is where we force that
//
ValueMetaInterface valueMeta = v.getValueMeta();
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;
case ValueMetaInterface.TYPE_DATE:
valueMeta.setConversionMask(ValueMetaAndData.VALUE_REPOSITORY_DATE_CONVERSION_MASK);
break;
default:
break;
}
String stringValue = valueMeta.getString(v.getValueData());
id_value = insertValue(valueMeta.getName(), valueMeta.getTypeDesc(), stringValue, valueMeta.isNull(v.getValueData()), condition.getRightExactID());
condition.setRightExactID(id_value);
}
table.addValue(new ValueMeta(KettleDatabaseRepository.FIELD_CONDITION_ID_VALUE_RIGHT, ValueMetaInterface.TYPE_INTEGER), id_value);
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), tablename);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:55,代码来源:KettleDatabaseRepositoryConditionDelegate.java
示例7: 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);
}
}
示例8: 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 );
}
}
示例9: insertCondition
import org.pentaho.di.core.row.ValueMetaAndData; //导入方法依赖的package包/类
public synchronized ObjectId insertCondition( ObjectId id_condition_parent, Condition condition ) throws KettleException {
ObjectId id = repository.connectionDelegate.getNextConditionID();
String tablename = KettleDatabaseRepository.TABLE_R_CONDITION;
RowMetaAndData table = new RowMetaAndData();
table.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_CONDITION_ID_CONDITION ), id );
table.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_CONDITION_ID_CONDITION_PARENT ),
id_condition_parent );
table.addValue( new ValueMetaBoolean(
KettleDatabaseRepository.FIELD_CONDITION_NEGATED ), Boolean
.valueOf( condition.isNegated() ) );
table.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_CONDITION_OPERATOR ), condition
.getOperatorDesc() );
table.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_CONDITION_LEFT_NAME ), condition
.getLeftValuename() );
table.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_CONDITION_CONDITION_FUNCTION ), condition
.getFunctionDesc() );
table.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_CONDITION_RIGHT_NAME ), condition
.getRightValuename() );
ObjectId id_value = null;
ValueMetaAndData v = condition.getRightExact();
if ( v != null ) {
// We have to make sure that all data is saved irrespective of locale differences.
// Here is where we force that
//
ValueMetaInterface valueMeta = v.getValueMeta();
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;
case ValueMetaInterface.TYPE_DATE:
valueMeta.setConversionMask( ValueMetaAndData.VALUE_REPOSITORY_DATE_CONVERSION_MASK );
break;
default:
break;
}
String stringValue = valueMeta.getString( v.getValueData() );
id_value =
insertValue( valueMeta.getName(), valueMeta.getTypeDesc(), stringValue, valueMeta.isNull( v
.getValueData() ), condition.getRightExactID() );
condition.setRightExactID( id_value );
}
table.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_CONDITION_ID_VALUE_RIGHT ), id_value );
repository.connectionDelegate.getDatabase().prepareInsert( table.getRowMeta(), tablename );
repository.connectionDelegate.getDatabase().setValuesInsert( table );
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}