Search in sources :

Example 1 with OutputTable

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);
}
Also used : AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 2 with OutputTable

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());
    }
}
Also used : DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) IProcess(org.talend.core.model.process.IProcess) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 3 with OutputTable

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);
    }
}
Also used : ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Example 4 with 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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) OutputTable(org.talend.designer.mapper.model.table.OutputTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IOConnection(org.talend.designer.mapper.external.connection.IOConnection) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with OutputTable

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);
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) FormData(org.eclipse.swt.layout.FormData) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) IProcess2(org.talend.core.model.process.IProcess2) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) TablesZoneView(org.talend.designer.mapper.ui.visualmap.zone.scrollable.TablesZoneView) IProcess(org.talend.core.model.process.IProcess) FormAttachment(org.eclipse.swt.layout.FormAttachment) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Aggregations

OutputTable (org.talend.designer.mapper.model.table.OutputTable)30 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)11 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)10 AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)8 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)6 ArrayList (java.util.ArrayList)5 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)5 IProcess (org.talend.core.model.process.IProcess)5 InputTable (org.talend.designer.mapper.model.table.InputTable)5 FilterTableEntry (org.talend.designer.mapper.model.tableentry.FilterTableEntry)5 OutputDataMapTableView (org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView)5 Point (org.eclipse.swt.graphics.Point)4 TableItem (org.eclipse.swt.widgets.TableItem)4 ExternalMapperTable (org.talend.designer.mapper.external.data.ExternalMapperTable)4 GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)4 InputDataMapTableView (org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView)4 VarsDataMapTableView (org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView)4 HashMap (java.util.HashMap)3 TableViewer (org.eclipse.jface.viewers.TableViewer)3 GridData (org.eclipse.swt.layout.GridData)3