use of org.pentaho.di.trans.steps.jobexecutor.JobExecutorParameters in project pentaho-kettle by pentaho.
the class JobExecutorDialog method collectInformation.
private void collectInformation() {
// The parameters...
//
JobExecutorParameters parameters = jobExecutorMeta.getParameters();
int nrLines = wJobExecutorParameters.nrNonEmpty();
String[] variables = new String[nrLines];
String[] fields = new String[nrLines];
String[] input = new String[nrLines];
parameters.setVariable(variables);
parameters.setField(fields);
parameters.setInput(input);
for (int i = 0; i < nrLines; i++) {
TableItem item = wJobExecutorParameters.getNonEmpty(i);
variables[i] = item.getText(1);
fields[i] = item.getText(2);
input[i] = item.getText(3);
}
parameters.setInheritingAllVariables(wInheritAll.getSelection());
// The group definition
//
jobExecutorMeta.setGroupSize(wGroupSize.getText());
jobExecutorMeta.setGroupField(wGroupField.getText());
jobExecutorMeta.setGroupTime(wGroupTime.getText());
jobExecutorMeta.setExecutionResultTargetStep(wExecutionResultTarget.getText());
jobExecutorMeta.setExecutionResultTargetStepMeta(transMeta.findStep(wExecutionResultTarget.getText()));
jobExecutorMeta.setExecutionTimeField(tiExecutionTimeField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionResultField(tiExecutionResultField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionNrErrorsField(tiExecutionNrErrorsField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesReadField(tiExecutionLinesReadField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesWrittenField(tiExecutionLinesWrittenField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesInputField(tiExecutionLinesInputField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesOutputField(tiExecutionLinesOutputField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesRejectedField(tiExecutionLinesRejectedField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesUpdatedField(tiExecutionLinesUpdatedField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLinesDeletedField(tiExecutionLinesDeletedField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionFilesRetrievedField(tiExecutionFilesRetrievedField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionExitStatusField(tiExecutionExitStatusField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLogTextField(tiExecutionLogTextField.getText(FIELD_NAME));
jobExecutorMeta.setExecutionLogChannelIdField(tiExecutionLogChannelIdField.getText(FIELD_NAME));
jobExecutorMeta.setResultFilesTargetStepMeta(transMeta.findStep(wResultFilesTarget.getText()));
jobExecutorMeta.setResultFilesFileNameField(wResultFileNameField.getText());
// Result row info
//
jobExecutorMeta.setResultRowsTargetStepMeta(transMeta.findStep(wResultRowsTarget.getText()));
int nrFields = wResultRowsFields.nrNonEmpty();
jobExecutorMeta.setResultRowsField(new String[nrFields]);
jobExecutorMeta.setResultRowsType(new int[nrFields]);
jobExecutorMeta.setResultRowsLength(new int[nrFields]);
jobExecutorMeta.setResultRowsPrecision(new int[nrFields]);
// CHECKSTYLE:Indentation:OFF
for (int i = 0; i < nrFields; i++) {
TableItem item = wResultRowsFields.getNonEmpty(i);
jobExecutorMeta.getResultRowsField()[i] = item.getText(1);
jobExecutorMeta.getResultRowsType()[i] = ValueMetaFactory.getIdForValueMeta(item.getText(2));
jobExecutorMeta.getResultRowsLength()[i] = Const.toInt(item.getText(3), -1);
jobExecutorMeta.getResultRowsPrecision()[i] = Const.toInt(item.getText(4), -1);
}
}
use of org.pentaho.di.trans.steps.jobexecutor.JobExecutorParameters in project pentaho-kettle by pentaho.
the class JobExecutorDialog method addParametersTab.
private void addParametersTab() {
CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.Title"));
wParametersTab.setToolTipText(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.Tooltip"));
Composite wParametersComposite = new Composite(wTabFolder, SWT.NONE);
props.setLook(wParametersComposite);
FormLayout parameterTabLayout = new FormLayout();
parameterTabLayout.marginWidth = 15;
parameterTabLayout.marginHeight = 15;
wParametersComposite.setLayout(parameterTabLayout);
// Add a button: get parameters
//
wGetParameters = new Button(wParametersComposite, SWT.PUSH);
wGetParameters.setText(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.GetParameters"));
props.setLook(wGetParameters);
FormData fdGetParameters = new FormData();
fdGetParameters.bottom = new FormAttachment(100, 0);
fdGetParameters.right = new FormAttachment(100, 0);
wGetParameters.setLayoutData(fdGetParameters);
wGetParameters.setSelection(jobExecutorMeta.getParameters().isInheritingAllVariables());
wGetParameters.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// null : reload file
getParametersFromJob(null);
}
});
// Now add a table view with the 3 columns to specify: variable name, input field & optional static input
//
parameterColumns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.column.Variable"), ColumnInfo.COLUMN_TYPE_TEXT, false, false), new ColumnInfo(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.column.Field"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {}, false), new ColumnInfo(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.column.Input"), ColumnInfo.COLUMN_TYPE_TEXT, false, false) };
parameterColumns[1].setUsingVariables(true);
JobExecutorParameters parameters = jobExecutorMeta.getParameters();
wJobExecutorParameters = new TableView(transMeta, wParametersComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, parameterColumns, parameters.getVariable().length, lsMod, props);
props.setLook(wJobExecutorParameters);
FormData fdJobExecutors = new FormData();
fdJobExecutors.left = new FormAttachment(0, 0);
fdJobExecutors.right = new FormAttachment(100, 0);
fdJobExecutors.top = new FormAttachment(0, 0);
fdJobExecutors.bottom = new FormAttachment(wGetParameters, -10);
wJobExecutorParameters.setLayoutData(fdJobExecutors);
wJobExecutorParameters.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 33, 33, 33));
for (int i = 0; i < parameters.getVariable().length; i++) {
TableItem tableItem = wJobExecutorParameters.table.getItem(i);
tableItem.setText(1, Const.NVL(parameters.getVariable()[i], ""));
tableItem.setText(2, Const.NVL(parameters.getField()[i], ""));
tableItem.setText(3, Const.NVL(parameters.getInput()[i], ""));
}
wJobExecutorParameters.setRowNums();
wJobExecutorParameters.optWidth(true);
// Add a checkbox: inherit all variables...
//
wInheritAll = new Button(wParametersComposite, SWT.CHECK);
wInheritAll.setText(BaseMessages.getString(PKG, "JobExecutorDialog.Parameters.InheritAll"));
props.setLook(wInheritAll);
FormData fdInheritAll = new FormData();
fdInheritAll.left = new FormAttachment(0, 0);
fdInheritAll.top = new FormAttachment(wJobExecutorParameters, 15);
wInheritAll.setLayoutData(fdInheritAll);
wInheritAll.setSelection(jobExecutorMeta.getParameters().isInheritingAllVariables());
FormData fdParametersComposite = new FormData();
fdParametersComposite.left = new FormAttachment(0, 0);
fdParametersComposite.top = new FormAttachment(0, 0);
fdParametersComposite.right = new FormAttachment(100, 0);
fdParametersComposite.bottom = new FormAttachment(100, 0);
wParametersComposite.setLayoutData(fdParametersComposite);
wParametersComposite.layout();
wParametersTab.setControl(wParametersComposite);
}
Aggregations