Search in sources :

Example 16 with IDataMapTable

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

the class ExpressionProposalProvider method getProposals.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.fieldassist.IContentProposalProvider#getProposals(java.lang.String, int)
     */
public IContentProposal[] getProposals(String contents, int position) {
    List<IContentProposal> proposals = new ArrayList<IContentProposal>();
    TableEntryLocation sourceEntryLocation = new TableEntryLocation();
    // Proposals based on process context
    for (IDataMapTable table : this.tables) {
        // proposals.add(new TableContentProposal(table, this.currentLanguage));
        List<IColumnEntry> dataMapTableEntries = table.getColumnEntries();
        for (IColumnEntry entrySource : dataMapTableEntries) {
            sourceEntryLocation.tableName = entrySource.getParentName();
            sourceEntryLocation.columnName = entrySource.getName();
            if (mapperManager.getUiManager().checkSourceLocationIsValid(entrySource, currentModifiedEntry)) {
                proposals.add(new EntryContentProposal(entrySource, this.currentLanguage));
            }
        }
    }
    for (IContentProposalProvider contentProposalProvider : otherContentProposalProviders) {
        proposals.addAll(Arrays.asList(contentProposalProvider.getProposals(contents, position)));
    }
    IContentProposal[] res = new IContentProposal[proposals.size()];
    res = proposals.toArray(res);
    return res;
}
Also used : IContentProposalProvider(org.eclipse.jface.fieldassist.IContentProposalProvider) IContentProposal(org.eclipse.jface.fieldassist.IContentProposal) ArrayList(java.util.ArrayList) TableEntryLocation(org.talend.designer.dbmap.model.tableentry.TableEntryLocation) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry)

Example 17 with IDataMapTable

use of org.talend.designer.abstractmap.model.table.IDataMapTable 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 18 with IDataMapTable

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

the class MapperManager method addNewFilterEntry.

public FilterTableEntry addNewFilterEntry(DataMapTableView dataMapTableView, String name, Integer index) {
    IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
    FilterTableEntry constraintEntry = new FilterTableEntry(abstractDataMapTable, name, null);
    tableEntriesManager.addTableEntry(constraintEntry, index);
    return constraintEntry;
}
Also used : FilterTableEntry(org.talend.designer.mapper.model.tableentry.FilterTableEntry) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable)

Example 19 with IDataMapTable

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

the class MapperManager method addNewGlobalMapEntry.

/**
     * 
     * @param dataMapTableView
     * @param index
     * @param type TODO
     * @param metadataColumn, can be null if added in VarsTable
     */
public GlobalMapEntry addNewGlobalMapEntry(DataMapTableView dataMapTableView, ITableEntry tableEntrySource, Integer index) {
    IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
    GlobalMapEntry dataMapTableEntry = null;
    if (dataMapTableView.getZone() == Zone.INPUTS) {
        dataMapTableEntry = new GlobalMapEntry(abstractDataMapTable, "\"" + dataMapTableView.findUniqueName("myKey") + "\"", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
        null);
    } else {
        //$NON-NLS-1$
        throw new IllegalArgumentException(Messages.getString("MapperManager.exceptionMessage.useOtherSignature"));
    }
    AddGlobalMapEntryCommand command = new AddGlobalMapEntryCommand(tableEntriesManager, dataMapTableEntry, index);
    executeCommand(command);
    return dataMapTableEntry;
}
Also used : AddGlobalMapEntryCommand(org.talend.designer.mapper.ui.commands.AddGlobalMapEntryCommand) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) GlobalMapEntry(org.talend.designer.mapper.model.tableentry.GlobalMapEntry)

Example 20 with IDataMapTable

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

the class MapperManager method removeSelectedOutput.

public void removeSelectedOutput() {
    DataMapTableView currentSelectedDataMapTableView = uiManager.getCurrentSelectedOutputTableView();
    String append = "";
    OutputTable outputTable = ((OutputTable) currentSelectedDataMapTableView.getDataMapTable());
    List<DataMapTableView> relatedOutputsTableView = null;
    if (outputTable.getIsJoinTableOf() == null) {
        relatedOutputsTableView = uiManager.getRelatedOutputsTableView(currentSelectedDataMapTableView);
        if (relatedOutputsTableView != null && !relatedOutputsTableView.isEmpty()) {
            append = " and it's join table ";
            for (DataMapTableView tableView : relatedOutputsTableView) {
                IDataMapTable retrieveAbstractDataMapTable = this.retrieveAbstractDataMapTable(tableView);
                if (retrieveAbstractDataMapTable != null) {
                    append = append + "'" + retrieveAbstractDataMapTable.getName() + " ' ,";
                }
            }
            append = append.substring(0, append.length() - 1);
        }
    }
    if (currentSelectedDataMapTableView != null) {
        String tableName = currentSelectedDataMapTableView.getDataMapTable().getName();
        if (MessageDialog.openConfirm(currentSelectedDataMapTableView.getShell(), //$NON-NLS-1$
        Messages.getString("MapperManager.removeOutputTableTitle"), Messages.getString("MapperManager.removeOutputTableTitleMessage") + tableName + " '" + append + "?")) {
            //$NON-NLS-1$ //$NON-NLS-2$
            IProcess process = getAbstractMapComponent().getProcess();
            uiManager.removeOutputTableView(currentSelectedDataMapTableView);
            // remove join table
            if (outputTable.getIsJoinTableOf() == null && relatedOutputsTableView != null) {
                for (DataMapTableView view : relatedOutputsTableView) {
                    uiManager.removeOutputTableView(view);
                    process.removeUniqueConnectionName(view.getDataMapTable().getName());
                }
            }
            uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
            process.removeUniqueConnectionName(currentSelectedDataMapTableView.getDataMapTable().getName());
        }
    }
}
Also used : IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) IProcess(org.talend.core.model.process.IProcess) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

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