org.pentaho.di.trans.step.StepDialogInterface Java Examples
The following examples show how to use
org.pentaho.di.trans.step.StepDialogInterface.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpoonStepsDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public StepDialogInterface getStepDialog( StepMetaInterface stepMeta, TransMeta transMeta, String stepName ) throws KettleException { Class<?>[] paramClasses = new Class<?>[] { Shell.class, Object.class, TransMeta.class, String.class }; Object[] paramArgs = new Object[] { spoon.getShell(), stepMeta, transMeta, stepName }; PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.getPlugin( StepPluginType.class, stepMeta ); String dialogClassName = plugin.getClassMap().get( StepDialogInterface.class ); if ( dialogClassName == null ) { // try the deprecated way log.logDebug( "Use of StepMetaInterface#getDialogClassName is deprecated, use PluginDialog annotation instead." ); dialogClassName = stepMeta.getDialogClassName(); } try { Class<StepDialogInterface> dialogClass = registry.getClass( plugin, dialogClassName ); Constructor<StepDialogInterface> dialogConstructor = dialogClass.getConstructor( paramClasses ); return dialogConstructor.newInstance( paramArgs ); } catch ( Exception e ) { // try the old way for compatibility try { Class<?>[] sig = new Class<?>[] { Shell.class, StepMetaInterface.class, TransMeta.class, String.class }; Method method = stepMeta.getClass().getDeclaredMethod( "getDialog", sig ); if ( method != null ) { log.logDebug( "Use of StepMetaInterface#getDialog is deprecated, use PluginDialog annotation instead." ); return (StepDialogInterface) method.invoke( stepMeta, paramArgs ); } } catch ( Throwable ignored ) { } String errorTitle = BaseMessages.getString( PKG, "Spoon.Dialog.ErrorCreatingStepDialog.Title" ); String errorMsg = BaseMessages.getString( PKG, "Spoon.Dialog.ErrorCreatingStepDialog.Message", dialogClassName ); new ErrorDialog( spoon.getShell(), errorTitle, errorMsg, e ); throw new KettleException( e ); } }
Example #2
Source File: SpoonStepsDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public StepDialogInterface getPartitionerDialog( StepMeta stepMeta, StepPartitioningMeta partitioningMeta, TransMeta transMeta ) throws KettleException { Partitioner partitioner = partitioningMeta.getPartitioner(); String dialogClassName = partitioner.getDialogClassName(); Class<?> dialogClass; Class<?>[] paramClasses = new Class<?>[] { Shell.class, StepMeta.class, StepPartitioningMeta.class, TransMeta.class }; Object[] paramArgs = new Object[] { spoon.getShell(), stepMeta, partitioningMeta, transMeta }; Constructor<?> dialogConstructor; try { dialogClass = partitioner.getClass().getClassLoader().loadClass( dialogClassName ); dialogConstructor = dialogClass.getConstructor( paramClasses ); return (StepDialogInterface) dialogConstructor.newInstance( paramArgs ); } catch ( Exception e ) { // try the old way for compatibility Method method; try { Class<?>[] sig = new Class<?>[] { Shell.class, StepMetaInterface.class, TransMeta.class }; method = stepMeta.getClass().getDeclaredMethod( "getDialog", sig ); if ( method != null ) { return (StepDialogInterface) method.invoke( stepMeta, new Object[] { spoon.getShell(), stepMeta, transMeta } ); } } catch ( Throwable ignored ) { } throw new KettleException( e ); } }
Example #3
Source File: SpecialMethodProcessor.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void askForField( PartitionSettings settings, SpoonDelegates delegates ) throws KettleException { StepDialogInterface partitionDialog = delegates.steps.getPartitionerDialog( settings.getStepMeta(), settings.getStepMeta().getStepPartitioningMeta(), settings.getTransMeta() ); String fieldName = partitionDialog.open(); if ( StringUtil.isEmpty( fieldName ) ) { settings.rollback( settings.getBefore() ); } }
Example #4
Source File: Neo4JOutputMeta.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 4 votes |
public StepDialogInterface getDialog( Shell shell, StepMetaInterface meta, TransMeta transMeta, String name ) { return new Neo4JOutputDialog( shell, meta, transMeta, name ); }
Example #5
Source File: CiviInputMeta.java From civicrm-data-integration with GNU General Public License v3.0 | 4 votes |
public StepDialogInterface getDialog(Shell shell, StepMetaInterface meta, TransMeta transMeta, String name) { return new CiviInputDialog(shell, meta, transMeta, name); }
Example #6
Source File: CiviOutputMeta.java From civicrm-data-integration with GNU General Public License v3.0 | 4 votes |
public StepDialogInterface getDialog(Shell shell, StepMetaInterface meta, TransMeta transMeta, String name) { return new CiviOutputDialog(shell, meta, transMeta, name); }
Example #7
Source File: SpoonStepsDelegate.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public String editStep( TransMeta transMeta, StepMeta stepMeta ) { boolean refresh = false; String stepname = null; try { String name = stepMeta.getName(); // Before we do anything, let's store the situation the way it // was... // StepMeta before = (StepMeta) stepMeta.clone(); StepDialogInterface dialog = spoon.getStepEntryDialog( stepMeta.getStepMetaInterface(), transMeta, name ); if ( dialog != null ) { dialog.setRepository( spoon.getRepository() ); dialog.setMetaStore( spoon.getMetaStore() ); stepname = dialog.open(); } if ( !Utils.isEmpty( stepname ) ) { // Force the recreation of the step IO metadata object. (cached by default) // stepMeta.getStepMetaInterface().resetStepIoMeta(); // // See if the new name the user enter, doesn't collide with // another step. // If so, change the stepname and warn the user! // String newname = stepname; StepMeta smeta = transMeta.findStep( newname, stepMeta ); int nr = 2; while ( smeta != null ) { newname = stepname + " " + nr; smeta = transMeta.findStep( newname ); nr++; } if ( nr > 2 ) { stepname = newname; MessageBox mb = new MessageBox( spoon.getShell(), SWT.OK | SWT.ICON_INFORMATION ); mb.setMessage( BaseMessages.getString( PKG, "Spoon.Dialog.StepnameExists.Message", stepname ) ); mb.setText( BaseMessages.getString( PKG, "Spoon.Dialog.StepnameExists.Title" ) ); mb.open(); } if ( !stepname.equals( name ) ) { refresh = true; } StepMeta newStepMeta = (StepMeta) stepMeta.clone(); newStepMeta.setName( stepname ); transMeta.clearCaches(); transMeta.notifyAllListeners( stepMeta, newStepMeta ); stepMeta.setName( stepname ); // // OK, so the step has changed... // Backup the situation for undo/redo // StepMeta after = (StepMeta) stepMeta.clone(); spoon.addUndoChange( transMeta, new StepMeta[] { before }, new StepMeta[] { after }, new int[] { transMeta .indexOfStep( stepMeta ) } ); } else { // Scenario: change connections and click cancel... // Perhaps new connections were created in the step dialog? if ( transMeta.haveConnectionsChanged() ) { refresh = true; } } spoon.refreshGraph(); // name is displayed on the graph too. // TODO: verify "double pathway" steps for bug #4365 // After the step was edited we can complain about the possible // deadlock here. // } catch ( Throwable e ) { if ( spoon.getShell().isDisposed() ) { return null; } new ErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, "Spoon.Dialog.UnableOpenDialog.Title" ), BaseMessages .getString( PKG, "Spoon.Dialog.UnableOpenDialog.Message" ), e ); } if ( refresh ) { spoon.refreshTree(); // Perhaps new connections were created in // the step // dialog or the step name changed. } return stepname; }
Example #8
Source File: CassandraInputMeta.java From learning-hadoop with Apache License 2.0 | 2 votes |
/** * Get the UI for this step. * * @param shell a <code>Shell</code> value * @param meta a <code>StepMetaInterface</code> value * @param transMeta a <code>TransMeta</code> value * @param name a <code>String</code> value * @return a <code>StepDialogInterface</code> value */ public StepDialogInterface getDialog(Shell shell, StepMetaInterface meta, TransMeta transMeta, String name) { return new CassandraInputDialog(shell, meta, transMeta, name); }