use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class ExternalDataConverter method prepareOutputTables.
public ArrayList<OutputTable> prepareOutputTables(List<IOConnection> outputConnections, List<IMetadataTable> outputMetadataTables, ExternalDbMapData externalData) {
Map<String, ExternalDbMapTable> nameToOutpuPersistentTable = new HashMap<String, ExternalDbMapTable>();
if (externalData != null) {
for (ExternalDbMapTable persistentTable : externalData.getOutputTables()) {
nameToOutpuPersistentTable.put(persistentTable.getName(), persistentTable);
}
}
Map<String, IOConnection> nameToOutputConn = new HashMap<String, IOConnection>();
if (outputConnections != null) {
for (IOConnection connection : outputConnections) {
if (connection.getConnectionType().equals(EConnectionType.FLOW_MAIN) || connection.getConnectionType().equals(EConnectionType.FLOW_REF) || connection.getConnectionType().equals(EConnectionType.TABLE) || connection.getConnectionType().equals(EConnectionType.TABLE_REF)) {
nameToOutputConn.put(connection.getUniqueName(), connection);
}
}
}
ArrayList<OutputTable> outputDataMapTables = new ArrayList<OutputTable>();
for (IMetadataTable table : outputMetadataTables) {
IOConnection connection = nameToOutputConn.get(table.getTableName());
OutputTable outputTable = null;
if (connection != null) {
ExternalDbMapTable persistentTable = nameToOutpuPersistentTable.get(connection.getUniqueName());
outputTable = new OutputTable(this.mapperManager, table.clone(), connection.getUniqueName(), connection.getName());
outputTable.initFromExternalData(persistentTable);
} else {
ExternalDbMapTable persistentTable = nameToOutpuPersistentTable.get(table.getTableName());
if (persistentTable != null) {
outputTable = new OutputTable(this.mapperManager, table, persistentTable.getName(), persistentTable.getTableName());
outputTable.initFromExternalData(persistentTable);
} else {
outputTable = new OutputTable(this.mapperManager, table, table.getTableName(), table.getLabel());
}
}
if (outputTable != null) {
outputDataMapTables.add(outputTable);
}
}
return outputDataMapTables;
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class MapperMain method getMetadataListOut.
/**
* DOC amaumont Comment method "getMetadataListOut".
*
* @return
*/
public List<IMetadataTable> getMetadataListOut() {
List<OutputTable> tables = mapperManager.getOutputTables();
List<IMetadataTable> metadataTables = new ArrayList<IMetadataTable>(tables.size());
for (OutputTable table : tables) {
metadataTables.add(table.getMetadataTable());
}
return metadataTables;
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class DataMapTableView method addTablesListeners.
/**
* DOC amaumont Comment method "addTableForColumnsListeners".
*/
private void addTablesListeners() {
tableViewerCreatorForColumns.addCellValueModifiedListener(new ITableCellValueModifiedListener() {
@Override
public void cellValueModified(TableCellValueModifiedEvent e) {
unselectAllEntriesIfErrorDetected(e);
}
});
abstractDataMapTable.getTableColumnsEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {
@Override
public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
mapperManager.getUiManager().refreshSqlExpression();
}
});
final TableViewer tableViewerForEntries = tableViewerCreatorForColumns.getTableViewer();
tableViewerForEntries.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
int[] selectionIndices = tableViewerForEntries.getTable().getSelectionIndices();
if (selectionIndices.length > 0) {
selectThisDataMapTableView();
onSelectedEntries(event.getSelection(), selectionIndices);
// bug 18414
MetadataTableEditorView metadataTableEditorView = null;
if (getZone() == Zone.INPUTS) {
metadataTableEditorView = mapperManager.getUiManager().getInputMetaEditorView();
} else if (getZone() == Zone.OUTPUTS) {
metadataTableEditorView = mapperManager.getUiManager().getOutputMetaEditorView();
}
if (metadataTableEditorView != null) {
metadataTableEditorView.getTableViewerCreator().refresh();
}
}
}
});
tableForEntries.addListener(SWT.DragDetect, new Listener() {
@Override
public void handleEvent(Event event) {
onSelectedEntries(tableViewerForEntries.getSelection(), tableViewerForEntries.getTable().getSelectionIndices());
}
});
tableViewerCreatorForColumns.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {
@Override
public void handle(LineSelectionEvent e) {
if (forceExecuteSelectionEvent) {
forceExecuteSelectionEvent = false;
onSelectedEntries(tableViewerForEntries.getSelection(), tableViewerForEntries.getTable().getSelectionIndices());
}
}
});
tableForEntries.addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event event) {
processEnterKeyDown(tableViewerCreatorForColumns, event);
}
});
abstractDataMapTable.getTableColumnsEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<IColumnEntry>() {
@Override
public void handleEvent(ModifiedBeanEvent<IColumnEntry> event) {
TableViewerCreator tableViewerCreator = tableViewerCreatorForColumns;
ITableEntry tableEntry = event.bean;
parseExpressionIfNeeded(event, tableViewerCreator, tableEntry);
mapperManager.getUiManager().refreshSqlExpression();
}
});
if (abstractDataMapTable instanceof OutputTable) {
OutputTable outputTable = (OutputTable) abstractDataMapTable;
outputTable.getWhereTableFiltersEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {
@Override
public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
resizeAtExpandedSize();
mapperManager.getUiManager().refreshSqlExpression();
}
});
outputTable.getWhereTableFiltersEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<FilterTableEntry>() {
@Override
public void handleEvent(ModifiedBeanEvent<FilterTableEntry> event) {
onOutputTableFiltersModified(event, extendedTableViewerForFilters);
mapperManager.getUiManager().refreshSqlExpression();
}
});
outputTable.getOtherTableFiltersEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {
@Override
public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
resizeAtExpandedSize();
mapperManager.getUiManager().refreshSqlExpression();
}
});
outputTable.getOtherTableFiltersEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<FilterTableEntry>() {
@Override
public void handleEvent(ModifiedBeanEvent<FilterTableEntry> event) {
onOutputTableFiltersModified(event, entendedTableViewerForOtherClauses);
mapperManager.getUiManager().refreshSqlExpression();
}
});
}
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class OutputDataMapTableView method initTableFilters.
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView#initTableConstraints()
*/
@Override
protected void initTableFilters(Composite parent) {
/**
* create whereFiltersTable
*/
// createFiltersTable(parent);
//$NON-NLS-1$
filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalWhereClauses");
extendedTableViewerForFilters = new ExtendedTableViewerForFilters(((OutputTable) abstractDataMapTable).getWhereTableFiltersEntriesModel(), parent) {
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView.ExtendedTableViewerForFilters#
* getTableConstraintSize()
*/
@Override
protected int getTableConstraintSize() {
int retSize = 0;
if (abstractDataMapTable instanceof OutputTable) {
retSize = ((OutputTable) abstractDataMapTable).getWhereFilterEntries().size();
}
return retSize;
}
@Override
protected void setTextCellEditor(TextCellEditor textEditor) {
if (textEditor != null) {
whereConstraintExpressionTextEditor = (Text) textEditor.getControl();
}
}
};
// correct partially layout problem with GTK when cell editor value is applied
((ExtendedTableViewerForFilters) extendedTableViewerForFilters).createFiltersTable();
TableViewerCreator tableViewerCreatorForWhereClauses = extendedTableViewerForFilters.getTableViewerCreator();
tableViewerCreatorForWhereClauses.setAdjustWidthValue(WindowSystem.isGTK() ? -20 : ADJUST_WIDTH_VALUE);
List<FilterTableEntry> whereEntries = ((OutputTable) getDataMapTable()).getWhereFilterEntries();
tableViewerCreatorForWhereClauses.init(whereEntries);
/**
* create otherFiltersTable
*/
IComponent component = getMapperManager().getComponent().getComponent();
if (component != null && "tELTOracleMap".equals(component.getName())) {
//$NON-NLS-1$
//$NON-NLS-1$
filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalOtherClauses.oracle");
} else {
//$NON-NLS-1$
filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalOtherClauses");
}
entendedTableViewerForOtherClauses = new ExtendedTableViewerForFilters(((OutputTable) abstractDataMapTable).getOtherTableFiltersEntriesModel(), parent) {
/*
* (non-Javadoc)
*
* @see org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView.ExtendedTableViewerForFilters#
* getTableConstraintSize()
*/
@Override
public int getTableConstraintSize() {
int retSize = 0;
if (abstractDataMapTable instanceof OutputTable) {
retSize = ((OutputTable) abstractDataMapTable).getOtherFilterEntries().size();
}
return retSize;
}
@Override
protected void setTextCellEditor(TextCellEditor textEditor) {
if (textEditor != null) {
otherConstraintExpressionTextEditor = (Text) textEditor.getControl();
}
}
};
((ExtendedTableViewerForFilters) entendedTableViewerForOtherClauses).createFiltersTable();
TableViewerCreator tableViewerCreatorForOtherClauses = entendedTableViewerForOtherClauses.getTableViewerCreator();
tableViewerCreatorForOtherClauses.setAdjustWidthValue(WindowSystem.isGTK() ? -20 : ADJUST_WIDTH_VALUE);
List<FilterTableEntry> otherEntries = ((OutputTable) getDataMapTable()).getOtherFilterEntries();
tableViewerCreatorForOtherClauses.init(otherEntries);
// updateGridDataHeightForTableConstraints(entendedTableViewerForOtherClauses.getTable());
updateGridDataHeightForTableConstraints();
if (WindowSystem.isGTK()) {
tableViewerCreatorForWhereClauses.layout();
entendedTableViewerForOtherClauses.getTableViewerCreator().layout();
}
}
use of org.talend.designer.dbmap.model.table.OutputTable in project tdi-studio-se by Talend.
the class MapperManager method removeSelectedOutputTable.
public void removeSelectedOutputTable() {
OutputDataMapTableView currentSelectedDataMapTableView = uiManager.getCurrentSelectedOutputTableView();
if (currentSelectedDataMapTableView != null) {
OutputTable outputTable = (OutputTable) currentSelectedDataMapTableView.getDataMapTable();
String tableTitle = ((AbstractDataMapTable) currentSelectedDataMapTableView.getDataMapTable()).getTitle();
if (MessageDialog.openConfirm(currentSelectedDataMapTableView.getShell(), //$NON-NLS-1$
Messages.getString("MapperManager.removeOutputTableTitle"), Messages.getString("MapperManager.removeOutputTableTitleMessage", new Object[] { tableTitle }))) {
//$NON-NLS-1$
IProcess process = mapperComponent.getProcess();
uiManager.removeOutputTableView(currentSelectedDataMapTableView);
uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
process.removeUniqueConnectionName(outputTable.getUniqueName());
uiManager.refreshSqlExpression();
}
}
}
Aggregations