use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class MapperManager method removeTablePair.
/**
*
* Remove the <code>DataMapTableView</code>-<code>DataMapTable</code> pair.
*
* @param view
*/
public void removeTablePair(DataMapTableView view) {
IDataMapTable dataTable = tableManager.getData(view);
List<IColumnEntry> dataMapTableEntries = dataTable.getColumnEntries();
if (isAdvancedMap() && dataTable instanceof AbstractInOutTable) {
tableEntriesManager.removeAll(Arrays.asList(((AbstractInOutTable) dataTable).getExpressionFilter()));
}
tableEntriesManager.removeAll(dataMapTableEntries);
if (dataTable instanceof OutputTable) {
List<FilterTableEntry> constraintEntries = ((OutputTable) dataTable).getFilterEntries();
tableEntriesManager.removeAll(constraintEntries);
}
tableManager.removeTable(view);
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class MapperManager method removeRejectOutput.
public void removeRejectOutput() {
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
Iterator<DataMapTableView> iterator = outputsTablesView.iterator();
DataMapTableView outputTable = null;
DataMapTableView toRemove = null;
while (iterator.hasNext()) {
outputTable = iterator.next();
if (outputTable.getDataMapTable() instanceof OutputTable && ((OutputTable) outputTable.getDataMapTable()).isErrorRejectTable()) {
toRemove = outputTable;
iterator.remove();
break;
}
}
if (toRemove != null) {
uiManager.removeOutputTableView(toRemove);
uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
IProcess process = getAbstractMapComponent().getProcess();
process.removeUniqueConnectionName(toRemove.getDataMapTable().getName());
}
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class ExternalDataConverter method creatOutputTables.
private void creatOutputTables(ArrayList<OutputTable> outputDataMapTables, List<ExternalMapperTable> persistentTables, IMetadataTable metadataTable, IOConnection connection, String name) {
// tables created by connection
if (persistentTables == null) {
OutputTable outputTable = new OutputTable(this.mapperManager, metadataTable, name);
outputDataMapTables.add(outputTable);
outputTable.initFromExternalData(null);
return;
}
for (ExternalMapperTable persistentTable : persistentTables) {
OutputTable outputTable = null;
if (persistentTable.getIsJoinTableOf() == null) {
// main table
outputTable = new OutputTable(this.mapperManager, metadataTable, connection, name);
} else {
// join table
outputTable = new OutputTable(this.mapperManager, metadataTable, connection, persistentTable.getName());
}
outputTable.initFromExternalData(persistentTable);
outputDataMapTables.add(outputTable);
}
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class ExternalDataConverter method prepareOutputTables.
private ArrayList<OutputTable> prepareOutputTables(List<IOConnection> outputConnections, List<IMetadataTable> outputMetadataTables, ExternalMapperData externalData) {
Map<String, List<ExternalMapperTable>> nameToOutpuPersistentTable = new HashMap<String, List<ExternalMapperTable>>();
if (externalData != null) {
for (ExternalMapperTable persistentTable : externalData.getOutputTables()) {
String key = persistentTable.getName();
if (persistentTable.getIsJoinTableOf() != null) {
key = persistentTable.getIsJoinTableOf();
}
List<ExternalMapperTable> list = nameToOutpuPersistentTable.get(key);
if (list != null) {
list.add(persistentTable);
} else {
list = new ArrayList<ExternalMapperTable>();
list.add(persistentTable);
nameToOutpuPersistentTable.put(key, list);
}
}
}
Map<String, IOConnection> nameMetadataToOutpuConn = 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.FLOW_MERGE)) {
nameMetadataToOutpuConn.put(connection.getTable().getTableName(), connection);
}
}
}
ArrayList<OutputTable> outputDataMapTables = new ArrayList<OutputTable>();
for (IMetadataTable table : outputMetadataTables) {
IOConnection connection = nameMetadataToOutpuConn.get(table.getTableName());
if (connection != null) {
List<ExternalMapperTable> persistentTables = nameToOutpuPersistentTable.get(connection.getName());
creatOutputTables(outputDataMapTables, persistentTables, connection.getTable(), connection, connection.getName());
} else {
List<ExternalMapperTable> persistentTables = nameToOutpuPersistentTable.get(table.getTableName());
creatOutputTables(outputDataMapTables, persistentTables, table, null, table.getTableName());
}
}
return outputDataMapTables;
}
use of org.talend.designer.mapper.model.table.OutputTable in project tdi-studio-se by Talend.
the class MapperManager method addRejectOutput.
public void addRejectOutput() {
String baseName = ERROR_REJECT;
IProcess process = getAbstractMapComponent().getProcess();
String tableName = baseName;
if (!process.checkValidConnectionName(baseName) && process instanceof IProcess2) {
final String uniqueName = ((IProcess2) process).generateUniqueConnectionName("row", baseName);
tableName = uniqueName;
((IProcess2) process).addUniqueConnectionName(uniqueName);
} else if (process instanceof IProcess2) {
tableName = baseName;
((IProcess2) process).addUniqueConnectionName(baseName);
}
IMetadataTable metadataTable = getNewMetadataTable();
metadataTable.setTableName(tableName);
MetadataColumn errorMessageCol = new MetadataColumn();
errorMessageCol.setLabel(ERROR_REJECT_MESSAGE);
errorMessageCol.setTalendType(DesignerPlugin.getDefault().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
errorMessageCol.setNullable(true);
errorMessageCol.setOriginalDbColumnName(ERROR_REJECT_MESSAGE);
errorMessageCol.setReadOnly(true);
errorMessageCol.setCustom(true);
errorMessageCol.setCustomId(0);
metadataTable.getListColumns().add(errorMessageCol);
MetadataColumn errorStackTrace = new MetadataColumn();
errorStackTrace.setLabel(ERROR_REJECT_STACK_TRACE);
errorStackTrace.setTalendType(DesignerPlugin.getDefault().getPreferenceStore().getString(MetadataTypeLengthConstants.FIELD_DEFAULT_TYPE));
errorStackTrace.setNullable(true);
errorStackTrace.setOriginalDbColumnName(ERROR_REJECT_STACK_TRACE);
errorStackTrace.setReadOnly(true);
errorStackTrace.setCustom(true);
errorStackTrace.setCustomId(1);
metadataTable.getListColumns().add(errorStackTrace);
OutputTable abstractDataMapTable = new OutputTable(this, metadataTable, tableName);
abstractDataMapTable.setErrorRejectTable(true);
abstractDataMapTable.initFromExternalData(null);
TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
DataMapTableView rejectDataMapTableView = uiManager.createNewOutputTableView(null, abstractDataMapTable, tablesZoneViewOutputs);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
int sizeList = outputsTablesView.size();
for (int i = 0; i < sizeList; i++) {
if (i + 1 < sizeList) {
FormData formData = (FormData) outputsTablesView.get(i + 1).getLayoutData();
formData.top = new FormAttachment(outputsTablesView.get(i));
}
}
CustomTableManager.addCustomManagementToTable(uiManager.getOutputMetaEditorView(), true);
tablesZoneViewOutputs.setSize(tablesZoneViewOutputs.computeSize(SWT.DEFAULT, SWT.DEFAULT));
tablesZoneViewOutputs.layout();
uiManager.moveOutputScrollBarZoneToMax();
uiManager.refreshBackground(true, false);
uiManager.selectDataMapTableView(rejectDataMapTableView, true, false);
}
Aggregations