@Override public Object clone() { ValueMetaAndData vmad = new ValueMetaAndData(); try { vmad.valueData = valueMeta.cloneValueData( valueData ); } catch ( KettleValueException e ) { vmad.valueData = null; // TODO: should we really do this? Is it safe? } vmad.valueMeta = valueMeta.clone(); return vmad; }
@Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters ) throws KettleXMLException { try { value = new ValueMetaAndData(); Node valnode = XMLHandler.getSubNode( stepnode, "values", "value" ); if ( valnode != null ) { System.out.println( "reading value in " + valnode ); value.loadXML( valnode ); } } catch ( Exception e ) { throw new KettleXMLException( "Unable to read step info from XML node", e ); } }
@Override public void setDefault() { value = new ValueMetaAndData( new ValueMetaNumber( "valuename" ), new Double( 123.456 ) ); value.getValueMeta().setLength( 12 ); value.getValueMeta().setPrecision( 4 ); }
ValueMetaAndData valueMetaData = new ValueMetaAndData();
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 ); } }
Node exactnode = XMLHandler.getSubNode( condnode, ValueMetaAndData.XML_TAG ); if ( exactnode != null ) { ValueMetaAndData exact = new ValueMetaAndData( exactnode ); setRightExact( exact );
@Override public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters ) throws KettleException { try { String name = rep.getStepAttributeString( id_step, 0, "value_name" ); String typedesc = rep.getStepAttributeString( id_step, 0, "value_type" ); String text = rep.getStepAttributeString( id_step, 0, "value_text" ); boolean isnull = rep.getStepAttributeBoolean( id_step, 0, "value_null" ); int length = (int) rep.getStepAttributeInteger( id_step, 0, "value_length" ); int precision = (int) rep.getStepAttributeInteger( id_step, 0, "value_precision" ); int type = ValueMetaFactory.getIdForValueMeta( typedesc ); value = new ValueMetaAndData( new ValueMeta( name, type ), null ); value.getValueMeta().setLength( length ); value.getValueMeta().setPrecision( precision ); if ( isnull ) { value.setValueData( null ); } else { ValueMetaInterface stringMeta = new ValueMetaString( name ); if ( type != ValueMetaInterface.TYPE_STRING ) { text = Const.trim( text ); } value.setValueData( value.getValueMeta().convertData( stringMeta, text ) ); } } catch ( KettleDatabaseException dbe ) { throw new KettleException( "error reading step with id_step=" + id_step + " from the repository", dbe ); } catch ( Exception e ) { throw new KettleException( "Unexpected error reading step with id_step=" + id_step + " from the repository", e ); } }
condition.setFunction( Condition.getFunction( comparator ) ); condition.setRightValuename( field ); condition.setRightExact( new ValueMetaAndData( "value", value ) ); } else { for ( int i = 0; i < nrkeys; i++ ) { subc.setFunction( Condition.getFunction( comparator ) ); subc.setRightValuename( field ); subc.setRightExact( new ValueMetaAndData( "value", value ) );
public ValueMetaAndData loadValueMetaAndData( ObjectId id_value ) throws KettleException { ValueMetaAndData valueMetaAndData = new ValueMetaAndData(); try { RowMetaAndData r = getValue( id_value );
try { v = new ValueMetaAndData( ValueMetaFactory.createValueMeta( "constant", leftval.getType() ), null ); } catch ( Exception exception ) { v = new ValueMetaAndData( new ValueMetaString( "constant" ), null );
condition.setOperator( convertOperator( constraint.orig.getCombinationType() ) ); condition.setFunction( Condition.FUNC_EQUAL ); condition.setRightExact( new ValueMetaAndData( "dummy", true ) ); //$NON-NLS-1$ rootCondition.addCondition( condition ); c++; condition.setOperator( convertOperator( constraint.orig.getCombinationType() ) ); condition.setFunction( Condition.FUNC_EQUAL ); condition.setRightExact( new ValueMetaAndData( "dummy", true ) ); //$NON-NLS-1$ rootCondition2.addCondition( condition ); c++;