public Partitioner getInstance() { Partitioner partitioner = new ModPartitioner(); partitioner.setId( getId() ); partitioner.setDescription( getDescription() ); return partitioner; }
private void ok() { fieldName = wFieldname.getText(); partitioner.setFieldName( fieldName ); dispose(); }
private void setShellImage( Shell shell ) { PluginInterface plugin = PluginRegistry.getInstance().getPlugin( PartitionerPluginType.class, partitioner.getId() ); if ( !Utils.isEmpty( plugin.getDocumentationUrl() ) ) { createHelpButton( shell, stepMeta, plugin ); } shell.setImage( GUIResource.getInstance().getImageSpoon() ); } }
shell.setText( partitioner.getDescription() );
public ModPartitionerDialog( Shell parent, StepMeta stepMeta, StepPartitioningMeta partitioningMeta, TransMeta transMeta ) { super( parent, (BaseStepMeta) stepMeta.getStepMetaInterface(), transMeta, partitioningMeta .getPartitioner().getDescription() ); this.stepMeta = stepMeta; this.partitioningMeta = partitioningMeta; partitioner = (ModPartitioner) partitioningMeta.getPartitioner(); fieldName = partitioner.getFieldName(); }
public int getPartition( RowMetaInterface rowMeta, Object[] row ) throws KettleException { init( rowMeta ); if ( partitionColumnIndex < 0 ) { partitionColumnIndex = rowMeta.indexOfValue( fieldName ); if ( partitionColumnIndex < 0 ) { throw new KettleStepException( "Unable to find partitioning field name [" + fieldName + "] in the output row..." + rowMeta ); } } long value; ValueMetaInterface valueMeta = rowMeta.getValueMeta( partitionColumnIndex ); Object valueData = row[partitionColumnIndex]; switch ( valueMeta.getType() ) { case ValueMetaInterface.TYPE_INTEGER: Long longValue = rowMeta.getInteger( row, partitionColumnIndex ); if ( longValue == null ) { value = valueMeta.hashCode( valueData ); } else { value = longValue.longValue(); } break; default: value = valueMeta.hashCode( valueData ); } /* * value = rowMeta.getInteger(row, partitionColumnIndex); */ int targetLocation = (int) ( Math.abs( value ) % nrPartitions ); return targetLocation; }