@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( outputIDField ) { if ( outputIDFieldName == null || outputIDFieldName.length() == 0 ) { throw new KettleStepException( "Error while retrieving fields", new Exception( "ID field name is null" ) ); } ValueMetaInterface v = new ValueMetaInteger( outputIDFieldName ); v.setOrigin( name ); row.addValueMeta( v ); } }
@Override public Object getNativeDataType( Object object ) throws KettleValueException { return getInteger( object ); }
@Override public String getFormatMask() { return getIntegerFormatMask(); } }
@Test public void calculatorShouldClearDataInstance() throws Exception { RowMeta inputRowMeta = new RowMeta(); ValueMetaInteger valueMeta = new ValueMetaInteger( "Value" ); inputRowMeta.addValueMeta( valueMeta ); RowSet inputRowSet = smh.getMockInputRowSet( new Object[] { -1L } ); inputRowSet.setRowMeta( inputRowMeta ); Calculator calculator = new Calculator( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans ); calculator.addRowSetToInputRowSets( inputRowSet ); calculator.setInputRowMeta( inputRowMeta ); calculator.init( smh.initStepMetaInterface, smh.initStepDataInterface ); CalculatorMeta meta = new CalculatorMeta(); meta.setCalculation( new CalculatorMetaFunction[] { new CalculatorMetaFunction( "test", CalculatorMetaFunction.CALC_ABS, "Value", null, null, ValueMetaInterface.TYPE_STRING, 0, 0, false, "", "", "", "" ) } ); CalculatorData data = new CalculatorData(); data = spy( data ); calculator.processRow( meta, data ); verify( data ).getValueMetaFor( eq( valueMeta.getType() ), anyString() ); calculator.processRow( meta, data ); verify( data ).clearValuesMetaMapping(); }
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaInteger( valuename ); // v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0); Removed for 2.5.x compatibility reasons. v.setOrigin( name ); row.addValueMeta( v ); }
public synchronized void insertJobNote( ObjectId id_job, ObjectId id_note ) throws KettleException { RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_NOTE_ID_JOB ), id_job ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_NOTE_ID_NOTE ), id_note ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_JOB_NOTE, table ); }
public synchronized void insertTransNote( ObjectId id_transformation, ObjectId id_note ) throws KettleException { RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_NOTE_ID_TRANSFORMATION ), id_transformation ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_NOTE_ID_NOTE ), id_note ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_TRANS_NOTE, table ); }
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaInteger( valuename ); v.setOrigin( name ); row.addValueMeta( v ); }
public synchronized void insertTransStepCondition( ObjectId id_transformation, ObjectId id_step, ObjectId id_condition ) throws KettleException { String tablename = KettleDatabaseRepository.TABLE_R_TRANS_STEP_CONDITION; RowMetaAndData table = new RowMetaAndData(); table .addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_TRANSFORMATION ), id_transformation ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_STEP ), id_step ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_CONDITION ), id_condition ); connectionDelegate.insertTableRow( tablename, table ); }
public synchronized ObjectId insertTransformationCluster( ObjectId id_transformation, ObjectId id_cluster ) throws KettleException { ObjectId id = connectionDelegate.getNextTransformationClusterID(); RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_CLUSTER_ID_TRANS_CLUSTER ), id ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_CLUSTER_ID_TRANSFORMATION ), id_transformation ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_CLUSTER_ID_CLUSTER ), id_cluster ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_TRANS_CLUSTER, table ); return id; }
public synchronized ObjectId insertTransformationSlave( ObjectId id_transformation, ObjectId id_slave ) throws KettleException { ObjectId id = connectionDelegate.getNextTransformationSlaveID(); RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_SLAVE_ID_TRANS_SLAVE ), id ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_SLAVE_ID_TRANSFORMATION ), id_transformation ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_SLAVE_ID_SLAVE ), id_slave ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_TRANS_SLAVE, table ); return id; }
public synchronized ObjectId insertTransformationPartitionSchema( ObjectId id_transformation, ObjectId id_partition_schema ) throws KettleException { ObjectId id = connectionDelegate.getNextTransformationPartitionSchemaID(); RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_PARTITION_SCHEMA_ID_TRANS_PARTITION_SCHEMA ), id ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_PARTITION_SCHEMA_ID_TRANSFORMATION ), id_transformation ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_TRANS_PARTITION_SCHEMA_ID_PARTITION_SCHEMA ), id_partition_schema ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_TRANS_PARTITION_SCHEMA, table ); return id; }
public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Just add the returning key field... if ( returningGeneratedKeys && generatedKeyField != null && generatedKeyField.length() > 0 ) { ValueMetaInterface key = new ValueMetaInteger( space.environmentSubstitute( generatedKeyField ) ); key.setOrigin( origin ); row.addValueMeta( key ); } }
public synchronized ObjectId insertClusterSlave( ClusterSchema clusterSchema, SlaveServer slaveServer ) throws KettleException { ObjectId id = connectionDelegate.getNextClusterSlaveID(); RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_CLUSTER_SLAVE_ID_CLUSTER_SLAVE ), id ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_CLUSTER_SLAVE_ID_CLUSTER ), clusterSchema .getObjectId() ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_CLUSTER_SLAVE_ID_SLAVE ), slaveServer .getObjectId() ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_CLUSTER_SLAVE, table ); return id; }
public RowMetaAndData getParameterMetaData( ObjectId... ids ) throws KettleException { RowMetaInterface parameterMeta = new RowMeta(); Object[] parameterData = new Object[ ids.length ]; for ( int i = 0; i < ids.length; i++ ) { parameterMeta.addValueMeta( new ValueMetaInteger( "id" + ( i + 1 ) ) ); parameterData[ i ] = Long.valueOf( ids[ i ].getId() ); } return new RowMetaAndData( parameterMeta, parameterData ); }
public synchronized void insertJobEntryDatabase( ObjectId id_job, ObjectId id_jobentry, ObjectId id_database ) throws KettleException { // First check if the relationship is already there. // There is no need to store it twice! RowMetaAndData check = getJobEntryDatabase( id_jobentry ); if ( check.getInteger( 0 ) == null ) { RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_DATABASE_ID_JOB ), id_job ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_DATABASE_ID_JOBENTRY ), id_jobentry ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_DATABASE_ID_DATABASE ), id_database ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_JOBENTRY_DATABASE, table ); } }
public synchronized void insertStepDatabase( ObjectId id_transformation, ObjectId id_step, ObjectId id_database ) throws KettleException { // First check if the relationship is already there. // There is no need to store it twice! RowMetaAndData check = getStepDatabase( id_step ); if ( check.getInteger( 0 ) == null ) { RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_TRANSFORMATION ), id_transformation ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_STEP ), id_step ); table .addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_STEP_DATABASE_ID_DATABASE ), id_database ); connectionDelegate.insertTableRow( KettleDatabaseRepository.TABLE_R_STEP_DATABASE, table ); } }
public static final RowMetaAndData getResultRow( Result result, String upd, String ins, String del, String read ) { RowMetaAndData resultRow = new RowMetaAndData(); if ( upd != null && upd.length() > 0 ) { ValueMetaInterface meta = new ValueMetaInteger( upd ); meta.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); resultRow.addValue( meta, new Long( result.getNrLinesUpdated() ) ); } if ( ins != null && ins.length() > 0 ) { ValueMetaInterface meta = new ValueMetaInteger( ins ); meta.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); resultRow.addValue( meta, new Long( result.getNrLinesOutput() ) ); } if ( del != null && del.length() > 0 ) { ValueMetaInterface meta = new ValueMetaInteger( del ); meta.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); resultRow.addValue( meta, new Long( result.getNrLinesDeleted() ) ); } if ( read != null && read.length() > 0 ) { ValueMetaInterface meta = new ValueMetaInteger( read ); meta.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); resultRow.addValue( meta, new Long( result.getNrLinesRead() ) ); } return resultRow; }
public synchronized ObjectId insertJobEntryCopy( ObjectId id_job, ObjectId id_jobentry, ObjectId id_jobentry_type, int nr, long gui_location_x, long gui_location_y, boolean gui_draw, boolean parallel ) throws KettleException { ObjectId id = repository.connectionDelegate.getNextJobEntryCopyID(); RowMetaAndData table = new RowMetaAndData(); //CHECKSTYLE:LineLength:OFF table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_ID_JOBENTRY_COPY ), id ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_ID_JOBENTRY ), id_jobentry ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_ID_JOB ), id_job ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_ID_JOBENTRY_TYPE ), id_jobentry_type ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_NR ), new Long( nr ) ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_GUI_LOCATION_X ), new Long( gui_location_x ) ); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_GUI_LOCATION_Y ), new Long( gui_location_y ) ); table.addValue( new ValueMetaBoolean( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_GUI_DRAW ), Boolean.valueOf( gui_draw ) ); table.addValue( new ValueMetaBoolean( KettleDatabaseRepository.FIELD_JOBENTRY_COPY_PARALLEL ), Boolean.valueOf( parallel ) ); repository.connectionDelegate.getDatabase().prepareInsert( table.getRowMeta(), KettleDatabaseRepository.TABLE_R_JOBENTRY_COPY ); repository.connectionDelegate.getDatabase().setValuesInsert( table ); repository.connectionDelegate.getDatabase().insertRow(); repository.connectionDelegate.getDatabase().closeInsert(); return id; }
@Override public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( !Utils.isEmpty( resultfieldName ) ) { ValueMetaInterface v = new ValueMetaInteger( resultfieldName ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); r.addValueMeta( v ); } }