protected ValueMetaInterface cloneValueMeta( ValueMetaInterface valueMeta, int type ) throws KettlePluginException { return ValueMetaFactory.cloneValueMeta( valueMeta, type ); }
public static ValueMetaInterface cloneValueMeta( ValueMetaInterface source ) throws KettlePluginException { return cloneValueMeta( source, source.getType() ); }
/** * Copy constructor for clone * * @param rowMeta * @throws KettlePluginException */ private RowMeta( RowMeta rowMeta, Integer targetType ) throws KettlePluginException { this( new ArrayList<ValueMetaInterface>( rowMeta.valueMetaList.size() ), new RowMetaCache( rowMeta.cache ) ); for ( ValueMetaInterface valueMetaInterface : rowMeta.valueMetaList ) { valueMetaList.add( ValueMetaFactory .cloneValueMeta( valueMetaInterface, targetType == null ? valueMetaInterface.getType() : targetType ) ); } this.needRealClone = rowMeta.needRealClone; }
private void initLookupMeta() throws KettleException { // Count the number of values in the lookup as well as the metadata to send along with it. // data.lookupMeta = new RowMeta(); for ( int i = 0; i < meta.getStreamKeyField1().length; i++ ) { if ( data.keynrs[ i ] >= 0 ) { ValueMetaInterface inputValueMeta = getInputRowMeta().getValueMeta( data.keynrs[ i ] ); // Try to convert type if needed in a clone, we don't want to // change the type in the original row // ValueMetaInterface value = ValueMetaFactory.cloneValueMeta( inputValueMeta, data.keytypes[ i ] ); data.lookupMeta.addValueMeta( value ); } if ( data.keynrs2[ i ] >= 0 ) { ValueMetaInterface inputValueMeta = getInputRowMeta().getValueMeta( data.keynrs2[ i ] ); // Try to convert type if needed in a clone, we don't want to // change the type in the original row // ValueMetaInterface value = ValueMetaFactory.cloneValueMeta( inputValueMeta, data.keytypes[ i ] ); data.lookupMeta.addValueMeta( value ); } } }
case TYPE_AGGREGATE_COUNT: case TYPE_AGGREGATE_SUM: values[i] = ValueMetaFactory.cloneValueMeta( v, ValueMetaInterface.TYPE_NUMBER ); values[i].setLength( -1, -1 ); break; default: values[i] = ValueMetaFactory.cloneValueMeta( v );
private void ok() { try { stringRowMeta = new RowMeta(); for ( ValueMetaInterface valueMeta : rowMeta.getValueMetaList() ) { ValueMetaInterface stringValueMeta = ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_STRING ); stringRowMeta.addValueMeta( stringValueMeta ); } List<Object[]> list = new ArrayList<Object[]>(); // Now read all the rows in the dialog, including the empty rows... // for ( int i = 0; i < wFields.getItemCount(); i++ ) { TableItem item = wFields.getTable().getItem( i ); Object[] row = getRowForData( item, i + 1 ); list.add( row ); } outputList = list; dispose(); } catch ( Exception e ) { new ErrorDialog( shell, "Error", BaseMessages.getString( PKG, "EditRowsDialog.ErrorConvertingData" ), e ); } }
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 ); } }
private ValueMetaInterface constructValueMeta( ValueMetaInterface sourceValueMeta, String fieldName, int i, String name ) throws KettlePluginException { int type = fieldType[i]; if ( type == ValueMetaInterface.TYPE_NONE ) { type = ValueMetaInterface.TYPE_STRING; } ValueMetaInterface v; if ( sourceValueMeta == null ) { v = ValueMetaFactory.createValueMeta( fieldName, type ); } else { v = ValueMetaFactory.cloneValueMeta( sourceValueMeta, type ); } v.setLength( fieldLength[i] ); v.setPrecision( fieldPrecision[i] ); v.setOrigin( name ); v.setConversionMask( fieldFormat[i] ); v.setDecimalSymbol( fieldDecimal[i] ); v.setGroupingSymbol( fieldGroup[i] ); v.setCurrencySymbol( fieldCurrency[i] ); v.setTrimType( fieldTrimType[i] ); return v; }
conversionMeta = ValueMetaFactory.cloneValueMeta( returnMeta, ValueMetaInterface.TYPE_STRING ); conversionMeta.setConversionMask( meta.getConversionMask()[ i ] ); conversionMeta.setDecimalSymbol( "." ); // google analytics is en-US
for ( int i = 0; i < data.convertRowMeta.size(); i++ ) { ValueMetaInterface valueMeta = data.convertRowMeta.getValueMeta( i ); data.convertRowMeta.setValueMeta( i, ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_STRING ) );
/** * @see StepInterface#init(org.pentaho.di.trans.step.StepMetaInterface , org.pentaho.di.trans.step.StepDataInterface) */ public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; if ( !super.init( smi, sdi ) ) { return false; } data.outputMap = meta.isContains() ? new ContainsKeyToRowSetMap() : new KeyToRowSetMap(); if ( Utils.isEmpty( meta.getFieldname() ) ) { logError( BaseMessages.getString( PKG, "SwitchCase.Log.NoFieldSpecifiedToSwitchWith" ) ); return false; } try { data.valueMeta = ValueMetaFactory.createValueMeta( meta.getFieldname(), meta.getCaseValueType() ); data.valueMeta.setConversionMask( meta.getCaseValueFormat() ); data.valueMeta.setGroupingSymbol( meta.getCaseValueGroup() ); data.valueMeta.setDecimalSymbol( meta.getCaseValueDecimal() ); data.stringValueMeta = ValueMetaFactory.cloneValueMeta( data.valueMeta, ValueMetaInterface.TYPE_STRING ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "SwitchCase.Log.UnexpectedError", e ) ); } return true; }
v = ValueMetaFactory.cloneValueMeta( source, type[i] ); row.setValueMeta( valueIndex, v ); } else {
ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_STRING );
try { if ( v.getType() == ValueMetaInterface.TYPE_STRING ) { ValueMetaInterface storageMeta = ValueMetaFactory.cloneValueMeta( v ); storageMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); v.setStorageMetadata( storageMeta );
ValueMetaInterface valueMeta = inputRowMeta.getValueMeta( replaceIndex ); ValueMetaInterface replaceMeta = ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_BOOLEAN ); replaceMeta.setOrigin( name ); inputRowMeta.setValueMeta( replaceIndex, replaceMeta );
ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_STRING ); storageMetadata.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );
ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_STRING ); storageMetadata.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); storageMetadata.setLength( -1, -1 ); // we don't really know the lengths of the strings read in advance.
ValueMetaFactory.cloneValueMeta( valueMeta, ValueMetaInterface.TYPE_STRING ); storageMetadata.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); storageMetadata.setLength( -1, -1 ); // we don't really know the lengths of the strings read in advance.
public static void cloneInfo( ValueMetaInterface source, ValueMetaInterface target ) throws KettlePluginException { target.setConversionMask( source.getConversionMask() ); target.setDecimalSymbol( source.getDecimalSymbol() ); target.setGroupingSymbol( source.getGroupingSymbol() ); target.setStorageType( source.getStorageType() ); if ( source.getStorageMetadata() != null ) { target.setStorageMetadata( cloneValueMeta( source.getStorageMetadata(), source .getStorageMetadata().getType() ) ); } target.setStringEncoding( source.getStringEncoding() ); target.setTrimType( source.getTrimType() ); target.setDateFormatLenient( source.isDateFormatLenient() ); target.setDateFormatLocale( source.getDateFormatLocale() ); target.setDateFormatTimeZone( source.getDateFormatTimeZone() ); target.setLenientStringToNumber( source.isLenientStringToNumber() ); target.setLargeTextField( source.isLargeTextField() ); target.setComments( source.getComments() ); target.setCaseInsensitive( source.isCaseInsensitive() ); target.setCollatorDisabled( source.isCollatorDisabled() ); target.setCollatorStrength( source.getCollatorStrength() ); target.setIndex( source.getIndex() ); target.setOrigin( source.getOrigin() ); target.setOriginalAutoIncrement( source.isOriginalAutoIncrement() ); target.setOriginalColumnType( source.getOriginalColumnType() ); target.setOriginalColumnTypeName( source.getOriginalColumnTypeName() ); target.setOriginalNullable( source.isOriginalNullable() ); target.setOriginalPrecision( source.getOriginalPrecision() ); target.setOriginalScale( source.getOriginalScale() ); target.setOriginalSigned( source.isOriginalSigned() ); }
v = ValueMetaFactory.cloneValueMeta( v, metaChange.getType() ); } else { v = ValueMetaFactory.createValueMeta( v.getName(), metaChange.getType() );