@Override public void widgetSelected( SelectionEvent arg0 ) { ValueMetaAndData v = (ValueMetaAndData) value.clone(); EnterValueDialog evd = new EnterValueDialog( shell, SWT.NONE, v.getValueMeta(), v.getValueData() ); ValueMetaAndData newval = evd.open(); if ( newval != null ) { value = newval; getData(); } } } );
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() ); } }
@Override public void saveRep( Repository rep, ObjectId id_transformation, ObjectId id_step ) throws KettleException { try { rep.saveStepAttribute( id_transformation, id_step, "value_name", value.getValueMeta().getName() ); rep.saveStepAttribute( id_transformation, id_step, 0, "value_type", value.getValueMeta().getTypeDesc() ); rep.saveStepAttribute( id_transformation, id_step, 0, "value_text", value.getValueMeta().getString( value.getValueData() ) ); rep.saveStepAttribute( id_transformation, id_step, 0, "value_null", value.getValueMeta().isNull( value.getValueData() ) ); rep.saveStepAttribute( id_transformation, id_step, 0, "value_length", value.getValueMeta().getLength() ); rep.saveStepAttribute( id_transformation, id_step, 0, "value_precision", value.getValueMeta().getPrecision() ); } catch ( KettleDatabaseException dbe ) { throw new KettleException( "Unable to save step information to the repository, id_step=" + id_step, dbe ); } }
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 ); } }
Object field2 = right_exact != null ? right_exact.getValueData() : null; if ( field2 == null && right_fieldnr >= 0 ) { fieldMeta2 = rowMeta.getValueMeta( right_fieldnr );
@Override public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (DummyPluginMeta) smi; data = (DummyPluginData) sdi; Object[] r = getRow(); // get row, blocks when needed! if ( r == null ) { // no more input to be expected... setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this ); } Object extraValue = meta.getValue().getValueData(); Object[] outputRow = RowDataUtil.addValueData( r, data.outputRowMeta.size() - 1, extraValue ); putRow( data.outputRowMeta, outputRow ); // copy row to possible alternate rowset(s). if ( checkFeedback( getLinesRead() ) ) { logBasic( "Linenr " + getLinesRead() ); // Some basic logging every 5000 rows. } return true; }
break; String stringValue = valueMeta.getString( v.getValueData() ); .getValueData() ), condition.getRightExactID() ); condition.setRightExactID( id_value );
EnterValueDialog evd = new EnterValueDialog( shell, SWT.NONE, v.getValueMeta(), v.getValueData() ); evd.setModalDialog( true ); // To keep the condition editor from being closed with a value dialog still