public static final TransMeta generatePreviewTransformation( VariableSpace parent, StepMetaInterface oneMeta, String oneStepname ) { PluginRegistry registry = PluginRegistry.getInstance(); TransMeta previewMeta = new TransMeta( parent ); // The following operation resets the internal variables! // previewMeta.setName( parent == null ? "Preview transformation" : parent.toString() ); // At it to the first step. StepMeta one = new StepMeta( registry.getPluginId( StepPluginType.class, oneMeta ), oneStepname, oneMeta ); one.setLocation( 50, 50 ); one.setDraw( true ); previewMeta.addStep( one ); DummyTransMeta twoMeta = new DummyTransMeta(); StepMeta two = new StepMeta( registry.getPluginId( StepPluginType.class, twoMeta ), "dummy", twoMeta ); two.setLocation( 250, 50 ); two.setDraw( true ); previewMeta.addStep( two ); TransHopMeta hop = new TransHopMeta( one, two ); previewMeta.addTransHop( hop ); return previewMeta; } }
static StepMeta getReadStepMeta( String name ) { DummyTransMeta twoMeta = new DummyTransMeta(); StepMeta two = new StepMeta( registry.getPluginId( StepPluginType.class, twoMeta ), name, twoMeta ); two.setLocation( 250, 50 ); two.setDraw( true ); return two; }
location.x += diff.x; location.y += diff.y; stepMeta.setLocation( (int) Math.round( location.x ), (int) Math.round( location.y ) );
protected TransMeta createSubTransMeta() { RecordsFromStreamMeta rm = new RecordsFromStreamMeta(); String[] fieldNames = getFieldNames(); int[] empty = new int[ fieldNames.length ]; Arrays.fill( empty, -1 ); rm.setFieldname( fieldNames ); rm.setType( getFieldTypes() ); rm.setLength( empty ); rm.setPrecision( empty ); StepMeta recsFromStream = new StepMeta( "RecordsFromStream", "Get records from stream", rm ); recsFromStream.setLocation( new Point( 100, 100 ) ); recsFromStream.setDraw( true ); TransMeta transMeta = new TransMeta(); transMeta.addStep( recsFromStream ); transMeta.setFilename( "" ); return transMeta; }
private static StepMeta createTestMeta() throws Exception { StepMetaInterface stepMetaInterface = mock( AbstractStepMeta.class ); when( stepMetaInterface.clone() ).thenReturn( stepMetaInterface ); StepMeta meta = new StepMeta( STEP_ID, "stepname", stepMetaInterface ); meta.setSelected( true ); meta.setDistributes( false ); meta.setCopiesString( "2" ); meta.setLocation( 1, 2 ); meta.setDraw( true ); meta.setDescription( "description" ); meta.setTerminator( true ); meta.setClusterSchemaName( "clusterSchemaName" ); boolean shouldDistribute = rand.nextBoolean(); meta.setDistributes( shouldDistribute ); if ( shouldDistribute ) { meta.setRowDistribution( selectRowDistribution() ); } Map<String, Map<String, String>> attributes = new HashMap<String, Map<String, String>>(); Map<String, String> map1 = new HashMap<String, String>(); map1.put( "1", "1" ); Map<String, String> map2 = new HashMap<String, String>(); map2.put( "2", "2" ); attributes.put( "qwerty", map1 ); attributes.put( "asdfg", map2 ); meta.setAttributesMap( attributes ); meta.setStepPartitioningMeta( createStepPartitioningMeta( "stepMethod", "stepSchema" ) ); meta.setTargetStepPartitioningMeta( createStepPartitioningMeta( "targetMethod", "targetSchema" ) ); meta.setClusterSchema( new ClusterSchema( "cluster_schema", Collections.<SlaveServer>emptyList() ) ); return meta; }
public void dupeStep( TransMeta transMeta, StepMeta stepMeta ) { spoon.getLog().logDebug( toString(), BaseMessages.getString( PKG, "Spoon.Log.DuplicateStep" ) + stepMeta.getName() ); // Duplicate // step: StepMeta stMeta = (StepMeta) stepMeta.clone(); if ( stMeta != null ) { String newname = transMeta.getAlternativeStepname( stepMeta.getName() ); int nr = 2; while ( transMeta.findStep( newname ) != null ) { newname = stepMeta.getName() + " (copy " + nr + ")"; nr++; } stMeta.setName( newname ); // Don't select this new step! stMeta.setSelected( false ); Point loc = stMeta.getLocation(); stMeta.setLocation( loc.x + 20, loc.y + 20 ); transMeta.addStep( stMeta ); spoon.addUndoNew( transMeta, new StepMeta[] { (StepMeta) stMeta.clone() }, new int[] { transMeta .indexOfStep( stMeta ) } ); spoon.refreshTree(); spoon.refreshGraph(); } }
stepMeta.setLocation( 10, 20 ); stepMeta.setLocation( new Point( 30, 40 ) );
mb.open(); inf.setLocation( 20, 20 ); // default location at (20,20) transMeta.addStep( inf ); addUndoNew( transMeta, new StepMeta[] { inf }, new int[] { transMeta.indexOfStep( inf ) } );
return; newStep.setLocation( p.x, p.y ); newStep.setDraw( true );
genStep.setLocation( 50, 50 ); scriptStepName, "## SCRIPT ##" ), udjcMeta ); scriptStepName = scriptStep.getName(); scriptStep.setLocation( 150, 50 );
newStep.setLocation( stepMeta.getLocation().x + 20, stepMeta.getLocation().y + 20 ); newStep.setDraw( true );
genStep.setLocation( 50, 50 ); scriptStepName, "## SCRIPT ##" ), scriptMeta ); scriptStepName = scriptStep.getName(); scriptStep.setLocation( 150, 50 );
public static TransMeta generateTestTransformation( VariableSpace parent, StepMetaInterface oneMeta, String oneStepname, RowMetaInterface injectorRowMeta ) { TransMeta previewMeta = new TransMeta( parent ); // First the injector step... StepMeta zero = getInjectorStepMeta( injectorRowMeta ); previewMeta.addStep( zero ); // Then the middle step to test... // StepMeta one = new StepMeta( registry.getPluginId( StepPluginType.class, oneMeta ), oneStepname, oneMeta ); one.setLocation( 150, 50 ); one.setDraw( true ); previewMeta.addStep( one ); // Then we add the dummy step to read the results from StepMeta two = getReadStepMeta(); previewMeta.addStep( two ); // Add the hops between the 3 steps. TransHopMeta zeroOne = new TransHopMeta( zero, one ); previewMeta.addTransHop( zeroOne ); TransHopMeta oneTwo = new TransHopMeta( one, two ); previewMeta.addTransHop( oneTwo ); return previewMeta; }
readMeta.setDatabaseMeta( databaseMeta ); StepMeta read = new StepMeta( registry.getPluginId( StepPluginType.class, readMeta ), "Read data", readMeta ); read.setLocation( 50, 50 ); read.setDraw( true ); transMeta.addStep( read ); calc.setLocation( 250, 50 ); calc.setDraw( true ); transMeta.addStep( calc ); StepMeta result = new StepMeta( registry.getPluginId( StepPluginType.class, dummyMeta ), RESULT_STEP_NAME, dummyMeta ); result.setLocation( 450, 50 ); result.setDraw( true ); transMeta.addStep( result );
fromstep.setLocation( 150, 100 ); fromstep.setDraw( true ); fromstep.setDescription( BaseMessages.getString( String selstepid = registry.getPluginId( StepPluginType.class, svi ); StepMeta selstep = new StepMeta( selstepid, selstepname, svi ); selstep.setLocation( 350, 100 ); selstep.setDraw( true ); selstep.setDescription( BaseMessages.getString( tostep.setLocation( 550, 100 ); tostep.setDraw( true ); tostep.setDescription( BaseMessages.getString(
String name = steps[i].getName(); steps[i].setLocation( p.x + offset.x, p.y + offset.y ); steps[i].setDraw( true );
stepMeta.setLocation( new Point( x, y ) ); stepMeta.setDraw( r.getBoolean( KettleDatabaseRepository.FIELD_STEP_GUI_DRAW, false ) );
static StepMeta getInjectorStepMeta( RowMetaInterface outputRowMeta ) { InjectorMeta zeroMeta = new InjectorMeta(); // Sets output fields for cases when no rows are sent to the test step, but metadata is still needed if ( outputRowMeta != null && outputRowMeta.size() > 0 ) { String[] fieldName = new String[outputRowMeta.size()]; int[] fieldLength = new int[outputRowMeta.size()]; int[] fieldPrecision = new int[outputRowMeta.size()]; int[] fieldType = new int[outputRowMeta.size()]; for ( int i = 0; i < outputRowMeta.size(); i++ ) { ValueMetaInterface field = outputRowMeta.getValueMeta( i ); fieldName[i] = field.getName(); fieldLength[i] = field.getLength(); fieldPrecision[i] = field.getPrecision(); fieldType[i] = field.getType(); } zeroMeta.setFieldname( fieldName ); zeroMeta.setLength( fieldLength ); zeroMeta.setPrecision( fieldPrecision ); zeroMeta.setType( fieldType ); } StepMeta zero = new StepMeta( registry.getPluginId( StepPluginType.class, zeroMeta ), INJECTOR_STEPNAME, zeroMeta ); zero.setLocation( 50, 50 ); zero.setDraw( true ); return zero; }
one.setLocation( 150, 50 ); one.setDraw( true ); previewMeta.addStep( one );
stepMeta.setLocation( transAction.getCurrentLocation()[i] );