in plugins/transforms/orabulkloader/src/main/java/org/apache/hop/pipeline/transforms/orabulkloader/OraBulkLoaderDialog.java [140:964]
public String open() {
CTabFolder wTabFolder;
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
shell.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Shell.Title"));
PropsUi.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = e -> input.setChanged();
ModifyListener lsTableMod =
arg0 -> {
input.setChanged();
setTableFieldCombo();
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = PropsUi.getFormMargin();
formLayout.marginHeight = PropsUi.getFormMargin();
shell.setLayout(formLayout);
int middle = props.getMiddlePct();
int margin = PropsUi.getMargin();
// Transform name line
wlTransformName = new Label(shell, SWT.RIGHT);
wlTransformName.setText(BaseMessages.getString(PKG, "System.TransformName.Label"));
wlTransformName.setToolTipText(BaseMessages.getString(PKG, "System.TransformName.Tooltip"));
PropsUi.setLook(wlTransformName);
FormData fdlTransformName = new FormData();
fdlTransformName.left = new FormAttachment(0, 0);
fdlTransformName.right = new FormAttachment(middle, -margin);
fdlTransformName.top = new FormAttachment(0, margin);
wlTransformName.setLayoutData(fdlTransformName);
wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wTransformName.setText(transformName);
PropsUi.setLook(wTransformName);
wTransformName.addModifyListener(lsMod);
FormData fdTransformName = new FormData();
fdTransformName.left = new FormAttachment(middle, 0);
fdTransformName.top = new FormAttachment(0, margin);
fdTransformName.right = new FormAttachment(100, 0);
wTransformName.setLayoutData(fdTransformName);
// The buttons
wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOk.addListener(SWT.Selection, e -> ok());
wSql = new Button(shell, SWT.PUSH);
wSql.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.SQL.Button"));
wSql.addListener(SWT.Selection, e -> create());
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
setButtonPositions(new Button[] {wOk, wCancel, wSql}, margin, null);
// Tab folder
wTabFolder = new CTabFolder(shell, SWT.BORDER);
PropsUi.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wTransformName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
wTabFolder.setLayoutData(fdTabFolder);
CTabItem wBulkLoaderTab = new CTabItem(wTabFolder, SWT.NONE);
wBulkLoaderTab.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.BulkLoader.Label"));
Composite wBulkLoaderComposite = new Composite(wTabFolder, SWT.NONE);
FormLayout fdBulkLoaderLayout = new FormLayout();
fdBulkLoaderLayout.marginWidth = 3;
fdBulkLoaderLayout.marginHeight = 3;
wBulkLoaderComposite.setLayout(fdBulkLoaderLayout);
PropsUi.setLook(wBulkLoaderComposite);
FormData fdComp = new FormData();
fdComp.left = new FormAttachment(0, 0);
fdComp.top = new FormAttachment(0, 0);
fdComp.right = new FormAttachment(100, 0);
fdComp.bottom = new FormAttachment(100, 0);
wBulkLoaderComposite.setLayoutData(fdComp);
SelectionListener lsSelection =
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
setTableFieldCombo();
}
};
// Connection line
wConnection =
addConnectionLine(wBulkLoaderComposite, wTransformName, input.getConnection(), lsMod);
wConnection.addSelectionListener(lsSelection);
// Schema line...
Label wlSchema = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlSchema.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.TargetSchema.Label"));
PropsUi.setLook(wlSchema);
FormData fdlSchema = new FormData();
fdlSchema.left = new FormAttachment(0, 0);
fdlSchema.right = new FormAttachment(middle, -margin);
fdlSchema.top = new FormAttachment(wConnection, margin * 2);
wlSchema.setLayoutData(fdlSchema);
Button wbSchema = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbSchema);
wbSchema.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
wbSchema.addListener(SWT.Selection, e -> getSchemaNames());
FormData fdbSchema = new FormData();
fdbSchema.top = new FormAttachment(wConnection, 2 * margin);
fdbSchema.right = new FormAttachment(100, 0);
wbSchema.setLayoutData(fdbSchema);
wSchema = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wSchema);
wSchema.addModifyListener(lsTableMod);
FormData fdSchema = new FormData();
fdSchema.left = new FormAttachment(middle, 0);
fdSchema.top = new FormAttachment(wConnection, margin * 2);
fdSchema.right = new FormAttachment(wbSchema, -margin);
wSchema.setLayoutData(fdSchema);
// Table line...
Label wlTable = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlTable.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.TargetTable.Label"));
PropsUi.setLook(wlTable);
FormData fdlTable = new FormData();
fdlTable.left = new FormAttachment(0, 0);
fdlTable.right = new FormAttachment(middle, -margin);
fdlTable.top = new FormAttachment(wbSchema, margin);
wlTable.setLayoutData(fdlTable);
Button wbTable = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
wbTable.addListener(SWT.Selection, e -> getTableName());
FormData fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wbSchema, margin);
wbTable.setLayoutData(fdbTable);
wTable = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wTable);
wTable.addModifyListener(lsTableMod);
FormData fdTable = new FormData();
fdTable.left = new FormAttachment(middle, 0);
fdTable.top = new FormAttachment(wbSchema, margin);
fdTable.right = new FormAttachment(wbTable, -margin);
wTable.setLayoutData(fdTable);
// Sqlldr line...
Label wlSqlldr = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlSqlldr.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Sqlldr.Label"));
PropsUi.setLook(wlSqlldr);
FormData fdlSqlldr = new FormData();
fdlSqlldr.left = new FormAttachment(0, 0);
fdlSqlldr.right = new FormAttachment(middle, -margin);
fdlSqlldr.top = new FormAttachment(wTable, margin);
wlSqlldr.setLayoutData(fdlSqlldr);
Button wbSqlldr = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbSqlldr);
wbSqlldr.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
FormData fdbSqlldr = new FormData();
fdbSqlldr.right = new FormAttachment(100, 0);
fdbSqlldr.top = new FormAttachment(wTable, margin);
wbSqlldr.setLayoutData(fdbSqlldr);
wSqlldr = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wSqlldr);
wSqlldr.addModifyListener(lsMod);
FormData fdSqlldr = new FormData();
fdSqlldr.left = new FormAttachment(middle, 0);
fdSqlldr.top = new FormAttachment(wTable, margin);
fdSqlldr.right = new FormAttachment(wbSqlldr, -margin);
wSqlldr.setLayoutData(fdSqlldr);
// Load Method line
Label wlLoadMethod = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlLoadMethod.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.LoadMethod.Label"));
PropsUi.setLook(wlLoadMethod);
FormData fdlLoadMethod = new FormData();
fdlLoadMethod.left = new FormAttachment(0, 0);
fdlLoadMethod.right = new FormAttachment(middle, -margin);
fdlLoadMethod.top = new FormAttachment(wSqlldr, margin);
wlLoadMethod.setLayoutData(fdlLoadMethod);
wLoadMethod = new CCombo(wBulkLoaderComposite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLoadMethod.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.AutoEndLoadMethod.Label"));
wLoadMethod.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.ManualLoadMethod.Label"));
wLoadMethod.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.AutoConcLoadMethod.Label"));
wLoadMethod.select(0); // +1: starts at -1
wLoadMethod.addModifyListener(lsMod);
PropsUi.setLook(wLoadMethod);
FormData fdLoadMethod = new FormData();
fdLoadMethod.left = new FormAttachment(middle, 0);
fdLoadMethod.top = new FormAttachment(wSqlldr, margin);
fdLoadMethod.right = new FormAttachment(100, 0);
wLoadMethod.setLayoutData(fdLoadMethod);
fdLoadMethod = new FormData();
fdLoadMethod.left = new FormAttachment(middle, 0);
fdLoadMethod.top = new FormAttachment(wSqlldr, margin);
fdLoadMethod.right = new FormAttachment(100, 0);
wLoadMethod.setLayoutData(fdLoadMethod);
// Load Action line
Label wlLoadAction = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlLoadAction.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.LoadAction.Label"));
PropsUi.setLook(wlLoadAction);
FormData fdlLoadAction = new FormData();
fdlLoadAction.left = new FormAttachment(0, 0);
fdlLoadAction.right = new FormAttachment(middle, -margin);
fdlLoadAction.top = new FormAttachment(wLoadMethod, margin);
wlLoadAction.setLayoutData(fdlLoadAction);
wLoadAction = new CCombo(wBulkLoaderComposite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLoadAction.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.AppendLoadAction.Label"));
wLoadAction.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.InsertLoadAction.Label"));
wLoadAction.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.ReplaceLoadAction.Label"));
wLoadAction.add(BaseMessages.getString(PKG, "OraBulkLoaderDialog.TruncateLoadAction.Label"));
wLoadAction.select(0); // +1: starts at -1
wLoadAction.addModifyListener(lsMod);
PropsUi.setLook(wLoadAction);
FormData fdLoadAction = new FormData();
fdLoadAction.left = new FormAttachment(middle, 0);
fdLoadAction.top = new FormAttachment(wLoadMethod, margin);
fdLoadAction.right = new FormAttachment(100, 0);
wLoadAction.setLayoutData(fdLoadAction);
// MaxErrors file line
Label wlMaxErrors = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlMaxErrors.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.MaxErrors.Label"));
PropsUi.setLook(wlMaxErrors);
FormData fdlMaxErrors = new FormData();
fdlMaxErrors.left = new FormAttachment(0, 0);
fdlMaxErrors.top = new FormAttachment(wLoadAction, margin);
fdlMaxErrors.right = new FormAttachment(middle, -margin);
wlMaxErrors.setLayoutData(fdlMaxErrors);
wMaxErrors = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wMaxErrors);
wMaxErrors.addModifyListener(lsMod);
FormData fdMaxErrors = new FormData();
fdMaxErrors.left = new FormAttachment(middle, 0);
fdMaxErrors.top = new FormAttachment(wLoadAction, margin);
fdMaxErrors.right = new FormAttachment(100, 0);
wMaxErrors.setLayoutData(fdMaxErrors);
// Commmit/batch file line
Label wlCommit = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlCommit.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Commit.Label"));
PropsUi.setLook(wlCommit);
FormData fdlCommit = new FormData();
fdlCommit.left = new FormAttachment(0, 0);
fdlCommit.top = new FormAttachment(wMaxErrors, margin);
fdlCommit.right = new FormAttachment(middle, -margin);
wlCommit.setLayoutData(fdlCommit);
wCommit = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCommit);
wCommit.addModifyListener(lsMod);
FormData fdCommit = new FormData();
fdCommit.left = new FormAttachment(middle, 0);
fdCommit.top = new FormAttachment(wMaxErrors, margin);
fdCommit.right = new FormAttachment(100, 0);
wCommit.setLayoutData(fdCommit);
// Bind size line
Label wlBindSize = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlBindSize.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.BindSize.Label"));
PropsUi.setLook(wlBindSize);
FormData fdlBindSize = new FormData();
fdlBindSize.left = new FormAttachment(0, 0);
fdlBindSize.top = new FormAttachment(wCommit, margin);
fdlBindSize.right = new FormAttachment(middle, -margin);
wlBindSize.setLayoutData(fdlBindSize);
wBindSize = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wBindSize);
wBindSize.addModifyListener(lsMod);
FormData fdBindSize = new FormData();
fdBindSize.left = new FormAttachment(middle, 0);
fdBindSize.top = new FormAttachment(wCommit, margin);
fdBindSize.right = new FormAttachment(100, 0);
wBindSize.setLayoutData(fdBindSize);
// Read size line
Label wlReadSize = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlReadSize.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.ReadSize.Label"));
PropsUi.setLook(wlReadSize);
FormData fdlReadSize = new FormData();
fdlReadSize.left = new FormAttachment(0, 0);
fdlReadSize.top = new FormAttachment(wBindSize, margin);
fdlReadSize.right = new FormAttachment(middle, -margin);
wlReadSize.setLayoutData(fdlReadSize);
wReadSize = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wReadSize);
wReadSize.addModifyListener(lsMod);
FormData fdReadSize = new FormData();
fdReadSize.left = new FormAttachment(middle, 0);
fdReadSize.top = new FormAttachment(wBindSize, margin);
fdReadSize.right = new FormAttachment(100, 0);
wReadSize.setLayoutData(fdReadSize);
// Control file line
Label wlControlFile = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlControlFile.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.ControlFile.Label"));
PropsUi.setLook(wlControlFile);
FormData fdlControlFile = new FormData();
fdlControlFile.left = new FormAttachment(0, 0);
fdlControlFile.top = new FormAttachment(wReadSize, margin);
fdlControlFile.right = new FormAttachment(middle, -margin);
wlControlFile.setLayoutData(fdlControlFile);
Button wbControlFile = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbControlFile);
wbControlFile.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
FormData fdbControlFile = new FormData();
fdbControlFile.right = new FormAttachment(100, 0);
fdbControlFile.top = new FormAttachment(wReadSize, margin);
wbControlFile.setLayoutData(fdbControlFile);
wControlFile = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wControlFile);
wControlFile.addModifyListener(lsMod);
FormData fdControlFile = new FormData();
fdControlFile.left = new FormAttachment(middle, 0);
fdControlFile.top = new FormAttachment(wReadSize, margin);
fdControlFile.right = new FormAttachment(wbControlFile, -margin);
wControlFile.setLayoutData(fdControlFile);
// Data file line
Label wlDataFile = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlDataFile.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.DataFile.Label"));
PropsUi.setLook(wlDataFile);
FormData fdlDataFile = new FormData();
fdlDataFile.left = new FormAttachment(0, 0);
fdlDataFile.top = new FormAttachment(wControlFile, margin);
fdlDataFile.right = new FormAttachment(middle, -margin);
wlDataFile.setLayoutData(fdlDataFile);
Button wbDataFile = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbDataFile);
wbDataFile.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
FormData fdbDataFile = new FormData();
fdbDataFile.right = new FormAttachment(100, 0);
fdbDataFile.top = new FormAttachment(wControlFile, margin);
wbDataFile.setLayoutData(fdbDataFile);
wDataFile = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wDataFile);
wDataFile.addModifyListener(lsMod);
FormData fdDataFile = new FormData();
fdDataFile.left = new FormAttachment(middle, 0);
fdDataFile.top = new FormAttachment(wControlFile, margin);
fdDataFile.right = new FormAttachment(wbDataFile, -margin);
wDataFile.setLayoutData(fdDataFile);
// Log file line
Label wlLogFile = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlLogFile.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.LogFile.Label"));
PropsUi.setLook(wlLogFile);
FormData fdlLogFile = new FormData();
fdlLogFile.left = new FormAttachment(0, 0);
fdlLogFile.top = new FormAttachment(wDataFile, margin);
fdlLogFile.right = new FormAttachment(middle, -margin);
wlLogFile.setLayoutData(fdlLogFile);
Button wbLogFile = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbLogFile);
wbLogFile.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
FormData fdbLogFile = new FormData();
fdbLogFile.right = new FormAttachment(100, 0);
fdbLogFile.top = new FormAttachment(wDataFile, margin);
wbLogFile.setLayoutData(fdbLogFile);
wLogFile = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wLogFile);
wLogFile.addModifyListener(lsMod);
FormData fdLogFile = new FormData();
fdLogFile.left = new FormAttachment(middle, 0);
fdLogFile.top = new FormAttachment(wDataFile, margin);
fdLogFile.right = new FormAttachment(wbLogFile, -margin);
wLogFile.setLayoutData(fdLogFile);
// Bad file line
Label wlBadFile = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlBadFile.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.BadFile.Label"));
PropsUi.setLook(wlBadFile);
FormData fdlBadFile = new FormData();
fdlBadFile.left = new FormAttachment(0, 0);
fdlBadFile.top = new FormAttachment(wLogFile, margin);
fdlBadFile.right = new FormAttachment(middle, -margin);
wlBadFile.setLayoutData(fdlBadFile);
Button wbBadFile = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbBadFile);
wbBadFile.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
FormData fdbBadFile = new FormData();
fdbBadFile.right = new FormAttachment(100, 0);
fdbBadFile.top = new FormAttachment(wLogFile, margin);
wbBadFile.setLayoutData(fdbBadFile);
wBadFile = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wBadFile);
wBadFile.addModifyListener(lsMod);
FormData fdBadFile = new FormData();
fdBadFile.left = new FormAttachment(middle, 0);
fdBadFile.top = new FormAttachment(wLogFile, margin);
fdBadFile.right = new FormAttachment(wbBadFile, -margin);
wBadFile.setLayoutData(fdBadFile);
// Discard file line
Label wlDiscardFile = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlDiscardFile.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.DiscardFile.Label"));
PropsUi.setLook(wlDiscardFile);
FormData fdlDiscardFile = new FormData();
fdlDiscardFile.left = new FormAttachment(0, 0);
fdlDiscardFile.top = new FormAttachment(wBadFile, margin);
fdlDiscardFile.right = new FormAttachment(middle, -margin);
wlDiscardFile.setLayoutData(fdlDiscardFile);
Button wbDiscardFile = new Button(wBulkLoaderComposite, SWT.PUSH | SWT.CENTER);
PropsUi.setLook(wbDiscardFile);
wbDiscardFile.setText(BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_BROWSE_BUTTON));
FormData fdbDiscardFile = new FormData();
fdbDiscardFile.right = new FormAttachment(100, 0);
fdbDiscardFile.top = new FormAttachment(wBadFile, margin);
wbDiscardFile.setLayoutData(fdbDiscardFile);
wDiscardFile = new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wDiscardFile);
wDiscardFile.addModifyListener(lsMod);
FormData fdDiscardFile = new FormData();
fdDiscardFile.left = new FormAttachment(middle, 0);
fdDiscardFile.top = new FormAttachment(wBadFile, margin);
fdDiscardFile.right = new FormAttachment(wbDiscardFile, -margin);
wDiscardFile.setLayoutData(fdDiscardFile);
//
// Control encoding line
//
// The drop down is editable as it may happen an encoding may not be present
// on one machine, but you may want to use it on your execution server
//
Label wlEncoding = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlEncoding.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Encoding.Label"));
PropsUi.setLook(wlEncoding);
FormData fdlEncoding = new FormData();
fdlEncoding.left = new FormAttachment(0, 0);
fdlEncoding.top = new FormAttachment(wDiscardFile, margin);
fdlEncoding.right = new FormAttachment(middle, -margin);
wlEncoding.setLayoutData(fdlEncoding);
wEncoding = new Combo(wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wEncoding.setToolTipText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Encoding.Tooltip"));
wEncoding.setItems(encodings);
PropsUi.setLook(wEncoding);
FormData fdEncoding = new FormData();
fdEncoding.left = new FormAttachment(middle, 0);
fdEncoding.top = new FormAttachment(wDiscardFile, margin);
fdEncoding.right = new FormAttachment(100, 0);
wEncoding.setLayoutData(fdEncoding);
wEncoding.addModifyListener(lsMod);
// Oracle character set name line
Label wlCharacterSetName = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlCharacterSetName.setText(
BaseMessages.getString(PKG, "OraBulkLoaderDialog.CharacterSetName.Label"));
PropsUi.setLook(wlCharacterSetName);
FormData fdlCharacterSetName = new FormData();
fdlCharacterSetName.left = new FormAttachment(0, 0);
fdlCharacterSetName.top = new FormAttachment(wEncoding, margin);
fdlCharacterSetName.right = new FormAttachment(middle, -margin);
wlCharacterSetName.setLayoutData(fdlCharacterSetName);
wCharacterSetName = new Combo(wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wCharacterSetName.setToolTipText(
BaseMessages.getString(PKG, "OraBulkLoaderDialog.CharacterSetName.Tooltip"));
wCharacterSetName.setItems(characterSetNames);
PropsUi.setLook(wCharacterSetName);
FormData fdCharacterSetName = new FormData();
fdCharacterSetName.left = new FormAttachment(middle, 0);
fdCharacterSetName.top = new FormAttachment(wEncoding, margin);
fdCharacterSetName.right = new FormAttachment(100, 0);
wCharacterSetName.setLayoutData(fdCharacterSetName);
wCharacterSetName.addModifyListener(lsMod);
// Alternate Record Terminator
Label wlAltRecordTerm = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlAltRecordTerm.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.AltRecordTerm.Label"));
PropsUi.setLook(wlAltRecordTerm);
FormData fdlAltRecordTerm = new FormData();
fdlAltRecordTerm.left = new FormAttachment(0, 0);
fdlAltRecordTerm.top = new FormAttachment(wCharacterSetName, margin);
fdlAltRecordTerm.right = new FormAttachment(middle, -margin);
wlAltRecordTerm.setLayoutData(fdlAltRecordTerm);
wAltRecordTerm =
new TextVar(variables, wBulkLoaderComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAltRecordTerm);
FormData fdAltRecordTerm = new FormData();
fdAltRecordTerm.left = new FormAttachment(middle, 0);
fdAltRecordTerm.top = new FormAttachment(wCharacterSetName, margin);
fdAltRecordTerm.right = new FormAttachment(100, 0);
wAltRecordTerm.setLayoutData(fdAltRecordTerm);
wAltRecordTerm.addModifyListener(lsMod);
// DirectPath line
Label wlDirectPath = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlDirectPath.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.DirectPath.Label"));
PropsUi.setLook(wlDirectPath);
FormData fdlDirectPath = new FormData();
fdlDirectPath.left = new FormAttachment(0, 0);
fdlDirectPath.top = new FormAttachment(wAltRecordTerm, margin);
fdlDirectPath.right = new FormAttachment(middle, -margin);
wlDirectPath.setLayoutData(fdlDirectPath);
wDirectPath = new Button(wBulkLoaderComposite, SWT.CHECK);
PropsUi.setLook(wDirectPath);
FormData fdDirectPath = new FormData();
fdDirectPath.left = new FormAttachment(middle, 0);
fdDirectPath.top = new FormAttachment(wAltRecordTerm, margin);
fdDirectPath.right = new FormAttachment(100, 0);
wDirectPath.setLayoutData(fdDirectPath);
wDirectPath.addListener(
SWT.Selection,
e -> {
input.setChanged();
// Parallel loading is only possible with a direct path option...
//
if (!wDirectPath.getSelection()) {
wParallel.setSelection(false);
}
wParallel.setEnabled(wDirectPath.getSelection());
});
// Erase files line
Label wlEraseFiles = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlEraseFiles.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.EraseFiles.Label"));
PropsUi.setLook(wlEraseFiles);
FormData fdlEraseFiles = new FormData();
fdlEraseFiles.left = new FormAttachment(0, 0);
fdlEraseFiles.top = new FormAttachment(wDirectPath, margin);
fdlEraseFiles.right = new FormAttachment(middle, -margin);
wlEraseFiles.setLayoutData(fdlEraseFiles);
wEraseFiles = new Button(wBulkLoaderComposite, SWT.CHECK);
PropsUi.setLook(wEraseFiles);
FormData fdEraseFiles = new FormData();
fdEraseFiles.left = new FormAttachment(middle, 0);
fdEraseFiles.top = new FormAttachment(wDirectPath, margin);
fdEraseFiles.right = new FormAttachment(100, 0);
wEraseFiles.setLayoutData(fdEraseFiles);
wEraseFiles.addListener(SWT.Selection, e -> input.setChanged());
// Fail on warning line
Label wlFailOnWarning = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlFailOnWarning.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.FailOnWarning.Label"));
PropsUi.setLook(wlFailOnWarning);
FormData fdlFailOnWarning = new FormData();
fdlFailOnWarning.left = new FormAttachment(0, 0);
fdlFailOnWarning.top = new FormAttachment(wEraseFiles, margin);
fdlFailOnWarning.right = new FormAttachment(middle, -margin);
wlFailOnWarning.setLayoutData(fdlFailOnWarning);
wFailOnWarning = new Button(wBulkLoaderComposite, SWT.CHECK);
PropsUi.setLook(wFailOnWarning);
FormData fdFailOnWarning = new FormData();
fdFailOnWarning.left = new FormAttachment(middle, 0);
fdFailOnWarning.top = new FormAttachment(wEraseFiles, margin);
fdFailOnWarning.right = new FormAttachment(100, 0);
wFailOnWarning.setLayoutData(fdFailOnWarning);
wFailOnWarning.addListener(SWT.Selection, e -> input.setChanged());
// Fail on error line
Label wlFailOnError = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlFailOnError.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.FailOnError.Label"));
PropsUi.setLook(wlFailOnError);
FormData fdlFailOnError = new FormData();
fdlFailOnError.left = new FormAttachment(0, 0);
fdlFailOnError.top = new FormAttachment(wFailOnWarning, margin);
fdlFailOnError.right = new FormAttachment(middle, -margin);
wlFailOnError.setLayoutData(fdlFailOnError);
wFailOnError = new Button(wBulkLoaderComposite, SWT.CHECK);
PropsUi.setLook(wFailOnError);
FormData fdFailOnError = new FormData();
fdFailOnError.left = new FormAttachment(middle, 0);
fdFailOnError.top = new FormAttachment(wFailOnWarning, margin);
fdFailOnError.right = new FormAttachment(100, 0);
wFailOnError.setLayoutData(fdFailOnError);
wFailOnError.addListener(SWT.Selection, e -> input.setChanged());
// Fail on error line
Label wlParallel = new Label(wBulkLoaderComposite, SWT.RIGHT);
wlParallel.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Parallel.Label"));
PropsUi.setLook(wlParallel);
FormData fdlParallel = new FormData();
fdlParallel.left = new FormAttachment(0, 0);
fdlParallel.top = new FormAttachment(wFailOnError, margin);
fdlParallel.right = new FormAttachment(middle, -margin);
wlParallel.setLayoutData(fdlParallel);
wParallel = new Button(wBulkLoaderComposite, SWT.CHECK);
PropsUi.setLook(wParallel);
FormData fdParallel = new FormData();
fdParallel.left = new FormAttachment(middle, 0);
fdParallel.top = new FormAttachment(wFailOnError, margin);
fdParallel.right = new FormAttachment(100, 0);
wParallel.setLayoutData(fdParallel);
wParallel.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
// Parallel loading is only possible with a direct path option...
//
if (wParallel.getSelection()) {
wDirectPath.setSelection(true);
}
}
});
CTabItem wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.Fields.Label"));
Composite wFieldsComposite = new Composite(wTabFolder, SWT.NONE);
PropsUi.setLook(wFieldsComposite);
FormLayout fFieldsLayout = new FormLayout();
fFieldsLayout.marginWidth = 3;
fFieldsLayout.marginHeight = 3;
wFieldsComposite.setLayout(fFieldsLayout);
FormData fdDataComp = new FormData();
fdDataComp.left = new FormAttachment(0, 0);
fdDataComp.top = new FormAttachment(0, 0);
fdDataComp.right = new FormAttachment(100, 0);
fdDataComp.bottom = new FormAttachment(100, 0);
wFieldsComposite.setLayoutData(fdDataComp);
int upInsCols = 3;
int upInsRows = (input.getMappings() != null ? input.getMappings().size() : 1);
ciReturn = new ColumnInfo[upInsCols];
ciReturn[0] =
new ColumnInfo(
BaseMessages.getString(PKG, "OraBulkLoaderDialog.ColumnInfo.TableField"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
new String[] {""},
false);
ciReturn[1] =
new ColumnInfo(
BaseMessages.getString(PKG, "OraBulkLoaderDialog.ColumnInfo.StreamField"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
new String[] {""},
false);
ciReturn[2] =
new ColumnInfo(
BaseMessages.getString(PKG, "OraBulkLoaderDialog.ColumnInfo.DateMask"),
ColumnInfo.COLUMN_TYPE_CCOMBO,
new String[] {
"",
BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_DATE_MASK_LABEL),
BaseMessages.getString(PKG, CONST_ORA_BULK_LOADER_DIALOG_DATE_TIME_MASK_LABEL)
},
true);
tableFieldColumns.add(ciReturn[0]);
wReturn =
new TableView(
variables,
wFieldsComposite,
SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL,
ciReturn,
upInsRows,
lsMod,
props);
Button wGetLU = new Button(wFieldsComposite, SWT.PUSH);
wGetLU.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.GetFields.Label"));
wGetLU.addListener(SWT.Selection, e -> getUpdate());
FormData fdGetLU = new FormData();
fdGetLU.top = new FormAttachment(0, 0);
fdGetLU.right = new FormAttachment(100, 0);
fdGetLU.left = new FormAttachment(wReturn, margin);
wGetLU.setLayoutData(fdGetLU);
Button wDoMapping = new Button(wFieldsComposite, SWT.PUSH);
wDoMapping.setText(BaseMessages.getString(PKG, "OraBulkLoaderDialog.EditMapping.Label"));
FormData fdDoMapping = new FormData();
fdDoMapping.top = new FormAttachment(wGetLU, margin);
fdDoMapping.right = new FormAttachment(100, 0);
wDoMapping.setLayoutData(fdDoMapping);
wDoMapping.addListener(SWT.Selection, e -> generateMappings());
FormData fdReturn = new FormData();
fdReturn.left = new FormAttachment(0, 0);
fdReturn.top = new FormAttachment(0, 0);
fdReturn.right = new FormAttachment(wDoMapping, -margin);
fdReturn.bottom = new FormAttachment(100, 0);
wReturn.setLayoutData(fdReturn);
wBulkLoaderTab.setControl(wBulkLoaderComposite);
wFieldsTab.setControl(wFieldsComposite);
//
// Search the fields in the background
//
final Runnable runnable =
() -> {
TransformMeta transformMeta = pipelineMeta.findTransform(transformName);
if (transformMeta != null) {
try {
IRowMeta row = pipelineMeta.getPrevTransformFields(variables, transformMeta);
// Remember these fields...
for (int i = 0; i < row.size(); i++) {
inputFields.add(row.getValueMeta(i).getName());
}
setComboBoxes();
} catch (HopException e) {
logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
}
}
};
new Thread(runnable).start();
wbSqlldr.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] {"*"});
if (wSqlldr.getText() != null) {
dialog.setFileName(wSqlldr.getText());
}
dialog.setFilterNames(ALL_FILETYPES);
if (dialog.open() != null) {
wSqlldr.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
wbControlFile.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] {"*"});
if (wControlFile.getText() != null) {
dialog.setFileName(wControlFile.getText());
}
dialog.setFilterNames(ALL_FILETYPES);
if (dialog.open() != null) {
wControlFile.setText(
dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
wbDataFile.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] {"*"});
if (wDataFile.getText() != null) {
dialog.setFileName(wDataFile.getText());
}
dialog.setFilterNames(ALL_FILETYPES);
if (dialog.open() != null) {
wDataFile.setText(
dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
wbLogFile.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] {"*"});
if (wLogFile.getText() != null) {
dialog.setFileName(wLogFile.getText());
}
dialog.setFilterNames(ALL_FILETYPES);
if (dialog.open() != null) {
wLogFile.setText(
dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
wbBadFile.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] {"*"});
if (wBadFile.getText() != null) {
dialog.setFileName(wBadFile.getText());
}
dialog.setFilterNames(ALL_FILETYPES);
if (dialog.open() != null) {
wBadFile.setText(
dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
wbDiscardFile.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] {"*"});
if (wDiscardFile.getText() != null) {
dialog.setFileName(wDiscardFile.getText());
}
dialog.setFilterNames(ALL_FILETYPES);
if (dialog.open() != null) {
wDiscardFile.setText(
dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
getData();
wTabFolder.setSelection(0);
setTableFieldCombo();
input.setChanged(changed);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformName;
}