use of org.pentaho.di.ui.spoon.partition.PartitionMethodSelector in project pentaho-kettle by pentaho.
the class Spoon method editPartitioning.
public void editPartitioning(TransMeta transMeta, StepMeta stepMeta) {
String[] schemaNames;
try {
schemaNames = pickupPartitionSchemaNames(transMeta);
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.ErrorDialog.Title"), BaseMessages.getString(PKG, "Spoon.ErrorDialog.ErrorFetchingFromRepo.PartitioningSchemas"), e);
return;
}
try {
/*Check if Partition schema has already defined*/
if (isDefinedSchemaExist(schemaNames)) {
/*Prepare settings for Method selection*/
PluginRegistry registry = PluginRegistry.getInstance();
List<PluginInterface> plugins = registry.getPlugins(PartitionerPluginType.class);
int exactSize = StepPartitioningMeta.methodDescriptions.length + plugins.size();
PartitionSettings settings = new PartitionSettings(exactSize, transMeta, stepMeta, this);
settings.fillOptionsAndCodesByPlugins(plugins);
/*Method selection*/
PartitionMethodSelector methodSelector = new PartitionMethodSelector();
String partitionMethodDescription = methodSelector.askForPartitionMethod(shell, settings);
if (!StringUtil.isEmpty(partitionMethodDescription)) {
String method = settings.getMethodByMethodDescription(partitionMethodDescription);
int methodType = StepPartitioningMeta.getMethodType(method);
settings.updateMethodType(methodType);
settings.updateMethod(method);
/*Schema selection*/
MethodProcessor methodProcessor = MethodProcessorFactory.create(methodType);
methodProcessor.schemaSelection(settings, shell, delegates);
}
addUndoChange(settings.getTransMeta(), new StepMeta[] { settings.getBefore() }, new StepMeta[] { settings.getAfter() }, new int[] { settings.getTransMeta().indexOfStep(settings.getStepMeta()) });
refreshGraph();
}
} catch (Exception e) {
new ErrorDialog(shell, "Error", "There was an unexpected error while editing the partitioning method specifics:", e);
}
}
Aggregations