Search in sources :

Example 36 with IDataMapTable

use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.

the class MapperManager method addNewVarEntry.

/**
     * This method is called when "addMetadataTableEditorEntry" is called (event on list of MetadataEditor) , so if you
     * want keep synchronisation between inputs/outputs DataMaps and MetadataEditors don't call this method.
     * 
     * For other uses such as add an entry to VarsTable or add entries to inputs or outputs DataMaps when
     * MetadataEditors are not active, call it.
     * 
     * @param dataMapTableView
     * @param index
     * @param type TODO
     * @param metadataColumn, can be null if added in VarsTable
     */
public VarTableEntry addNewVarEntry(DataMapTableView dataMapTableView, String name, Integer index, String type) {
    IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
    VarTableEntry dataMapTableEntry = null;
    if (dataMapTableView.getZone() == Zone.VARS) {
        dataMapTableEntry = new VarTableEntry(abstractDataMapTable, name, null, type);
    } else {
        //$NON-NLS-1$
        throw new IllegalArgumentException(Messages.getString("MapperManager.exceptionMessage.useOtherSignature"));
    }
    AddVarEntryCommand varEntryCommand = new AddVarEntryCommand(tableEntriesManager, dataMapTableEntry, index);
    executeCommand(varEntryCommand);
    return dataMapTableEntry;
}
Also used : AddVarEntryCommand(org.talend.designer.mapper.ui.commands.AddVarEntryCommand) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) VarTableEntry(org.talend.designer.mapper.model.tableentry.VarTableEntry)

Example 37 with IDataMapTable

use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.

the class MapperManager method replacePreviousLocationInAllExpressions.

/**
     * DOC amaumont Comment method "replacePreviousLocationInAllExpressions".
     */
public void replacePreviousLocationInAllExpressions(final TableEntryLocation previousLocation, final TableEntryLocation newLocation) {
    DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(LanguageProvider.getCurrentLanguage());
    Collection<IDataMapTable> tablesData = getTablesData();
    for (IDataMapTable table : tablesData) {
        List<IColumnEntry> columnEntries = table.getColumnEntries();
        if (table instanceof AbstractInOutTable) {
            replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, ((AbstractInOutTable) table).getExpressionFilter());
        }
        for (IColumnEntry entry : columnEntries) {
            replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
        }
        if (table instanceof OutputTable) {
            List<FilterTableEntry> constraintEntries = ((OutputTable) table).getFilterEntries();
            for (FilterTableEntry entry : constraintEntries) {
                replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
            }
        }
    }
    uiManager.refreshBackground(false, false);
}
Also used : DataMapExpressionParser(org.talend.designer.mapper.utils.DataMapExpressionParser) 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 38 with IDataMapTable

use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.

the class TableEntriesManager method addTableEntry.

/**
     * DOC amaumont Comment method "addTableEntry".
     * 
     * @param dataMapTableEntry
     * @param index
     */
public void addTableEntry(ITableEntry dataMapTableEntry, Integer index) {
    if (dataMapTableEntry == null) {
        throw new IllegalArgumentException(Messages.getString(//$NON-NLS-1$
        "TableEntriesManager.exceptionMessage.dataMapTableEntryCannotNull"));
    }
    add(dataMapTableEntry);
    IDataMapTable dataMapTable = dataMapTableEntry.getParent();
    if (dataMapTableEntry instanceof IColumnEntry) {
        if (index == null) {
            dataMapTable.addColumnEntry((IColumnEntry) dataMapTableEntry);
        } else {
            dataMapTable.addColumnEntry((IColumnEntry) dataMapTableEntry, index);
        }
    } else if (dataMapTableEntry instanceof FilterTableEntry) {
        if (index == null) {
            ((OutputTable) dataMapTable).addFilterEntry((FilterTableEntry) dataMapTableEntry);
        } else {
            ((OutputTable) dataMapTable).addFilterEntry((FilterTableEntry) dataMapTableEntry, index);
        }
    } else if (dataMapTableEntry instanceof GlobalMapEntry) {
        if (index == null) {
            ((InputTable) dataMapTable).addGlobalMapEntry((GlobalMapEntry) dataMapTableEntry);
        } else {
            ((InputTable) dataMapTable).addGlobalMapEntry((GlobalMapEntry) dataMapTableEntry, index);
        }
    } else {
        String exceptionMessage = Messages.getString("TableEntriesManager.exceptionMessage.typeIsNotValid", //$NON-NLS-1$
        dataMapTableEntry.getClass().toString());
        throw new IllegalArgumentException(exceptionMessage);
    }
// TableEntriesManagerEvent event = new TableEntriesManagerEvent(EVENT_TYPE.ADD);
// event.entry = dataMapTableEntry;
// fireEvent(event);
}
Also used : InputTable(org.talend.designer.mapper.model.table.InputTable) FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry)

Example 39 with IDataMapTable

use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.

the class ExternalDataConverter method loadInExternalData.

private void loadInExternalData(Collection<? extends IDataMapTable> tables) {
    for (IDataMapTable table : tables) {
        ExternalDbMapTable externalMapperTable = new ExternalDbMapTable();
        fillExternalTable(table, externalMapperTable);
        ArrayList<ExternalDbMapEntry> perTableEntries = new ArrayList<ExternalDbMapEntry>();
        boolean isInputTable = table instanceof InputTable;
        for (ITableEntry dataMapTableEntry : table.getColumnEntries()) {
            ExternalDbMapEntry externalMapperTableEntry = new ExternalDbMapEntry();
            externalMapperTableEntry.setExpression(dataMapTableEntry.getExpression());
            externalMapperTableEntry.setName(dataMapTableEntry.getName());
            if (isInputTable) {
                externalMapperTableEntry.setOperator(((InputColumnTableEntry) dataMapTableEntry).getOperator());
                externalMapperTableEntry.setJoin(((InputColumnTableEntry) dataMapTableEntry).isJoin());
            }
            perTableEntries.add(externalMapperTableEntry);
        }
        externalMapperTable.setMetadataTableEntries(perTableEntries);
    }
}
Also used : InputTable(org.talend.designer.dbmap.model.table.InputTable) ExternalDbMapTable(org.talend.designer.dbmap.external.data.ExternalDbMapTable) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) ArrayList(java.util.ArrayList) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) ExternalDbMapEntry(org.talend.designer.dbmap.external.data.ExternalDbMapEntry)

Aggregations

IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)39 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)14 ArrayList (java.util.ArrayList)9 OutputTable (org.talend.designer.mapper.model.table.OutputTable)8 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)7 OutputTable (org.talend.designer.dbmap.model.table.OutputTable)7 GlobalMapEntry (org.talend.designer.mapper.model.tableentry.GlobalMapEntry)6 InputTable (org.talend.designer.dbmap.model.table.InputTable)5 FilterTableEntry (org.talend.designer.dbmap.model.tableentry.FilterTableEntry)5 FilterTableEntry (org.talend.designer.mapper.model.tableentry.FilterTableEntry)5 List (java.util.List)4 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)4 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)4 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)4 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)4 AbstractInOutTable (org.talend.designer.mapper.model.table.AbstractInOutTable)4 InputTable (org.talend.designer.mapper.model.table.InputTable)4 VarsTable (org.talend.designer.mapper.model.table.VarsTable)4 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)4 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)3