Search in sources :

Example 81 with IMetadataColumn

use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.

the class TableEntriesManager method renameEntryName.

/**
     * DOC amaumont Comment method "renameEntryName".
     * 
     * @param dataMapTableEntry
     * @param newColumnName
     * @param newColumnName
     */
public void renameEntryName(ITableEntry dataMapTableEntry, String previousColumnName, String newColumnName) {
    TableEntryLocation tableEntryLocationKey = new TableEntryLocation(dataMapTableEntry.getParentName(), previousColumnName);
    // TableEntriesManager.buildLocation(dataMapTableEntry);
    ITableEntry entry = tableEntries.get(tableEntryLocationKey);
    if (entry != dataMapTableEntry) {
        //$NON-NLS-1$
        throw new IllegalStateException(Messages.getString("TableEntriesManager.exceptionMessage.tableEntriesNotSame"));
    }
    tableEntries.remove(tableEntryLocationKey);
    tableEntryLocationKey.columnName = newColumnName;
    tableEntries.put(tableEntryLocationKey, dataMapTableEntry);
    // update matching column
    IMetadataColumn metadataColumn = null;
    InputTable inputTable = isPhysicalTable(dataMapTableEntry.getParent());
    if (inputTable != null) {
        metadataColumn = getColumnFromDbTable(inputTable.getName(), dataMapTableEntry.getName());
        removeMetadataColumnFromDbTable(inputTable.getTableName(), dataMapTableEntry.getName());
        addMetadataColumnFromDbTable(inputTable.getTableName(), newColumnName, metadataColumn);
    }
    dataMapTableEntry.setName(newColumnName);
}
Also used : InputTable(org.talend.designer.dbmap.model.table.InputTable) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) TableEntryLocation(org.talend.designer.dbmap.model.tableentry.TableEntryLocation) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 82 with IMetadataColumn

use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.

the class TableEntriesManager method addInternal.

/**
     * DOC amaumont Comment method "add".
     * 
     * @param dataMapTableEntry
     */
private void addInternal(ITableEntry dataMapTableEntry) {
    tableEntries.put(TableEntryLocation.getNewInstance(dataMapTableEntry), dataMapTableEntry);
    IDataMapTable dataMapTable = dataMapTableEntry.getParent();
    InputTable inputTable = isPhysicalTable(dataMapTable);
    if (inputTable != null) {
        IMetadataColumn metadataColumn = ((InputColumnTableEntry) dataMapTableEntry).getMetadataColumn();
        addMetadataColumnFromDbTable(inputTable.getTableName(), metadataColumn.getLabel(), metadataColumn);
    }
}
Also used : InputTable(org.talend.designer.dbmap.model.table.InputTable) IDataMapTable(org.talend.designer.abstractmap.model.table.IDataMapTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) InputColumnTableEntry(org.talend.designer.dbmap.model.tableentry.InputColumnTableEntry)

Example 83 with IMetadataColumn

use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.

the class HL7OutputUI method initSchemaTable.

protected void initSchemaTable() {
    if (externalNode.isHL7Output()) {
        // !externalNode.istWriteXMLField() && !externalNode.istMDMOutput()) {
        IMetadataTable metadataTable = null;
        List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(externalNode, IConnectionCategory.FLOW);
        if (incomingConnections.size() <= 0) {
            metadataTable = this.externalNode.getMetadataList().get(0);
        } else {
            metadataTable = incomingConnections.get(0).getMetadataTable();
        }
        if (metadataTable != null) {
            List<IMetadataColumn> columnList = metadataTable.getListColumns();
            schemaViewer.setInput(columnList);
        } else {
            schemaViewer.setInput(new ArrayList<IMetadataColumn>());
        }
    } else {
        IConnection inConn = null;
        for (IConnection conn : externalNode.getIncomingConnections()) {
            if ((conn.getLineStyle().equals(EConnectionType.FLOW_MAIN)) || (conn.getLineStyle().equals(EConnectionType.FLOW_REF))) {
                inConn = conn;
                break;
            }
        }
        if (inConn != null) {
            List<IMetadataColumn> columnList = inConn.getMetadataTable().getListColumns();
            schemaViewer.setInput(columnList);
        } else {
            schemaViewer.setInput(new ArrayList<IMetadataColumn>());
        }
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IConnection(org.talend.core.model.process.IConnection) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 84 with IMetadataColumn

use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.

the class HL7OutputUI method initLinker.

private void initLinker(TreeItem node, TableItem[] tableItems) {
    HL7TreeNode treeNode = (HL7TreeNode) node.getData();
    IMetadataColumn column = null;
    if (treeNode != null) {
        column = treeNode.getColumn();
    }
    if (column != null) {
        if (this.gethl7Manager().getHl7Component().isHL7Output() && treeNode.getChildren().size() <= 0) {
            for (TableItem tableItem : tableItems) {
                IMetadataColumn mColumn = (IMetadataColumn) tableItem.getData();
                if (mColumn.getLabel().equals(column.getLabel())) {
                    linker.addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), treeNode, true);
                    break;
                }
            }
        }
        for (TableItem tableItem : tableItems) {
            IMetadataColumn mColumn = (IMetadataColumn) tableItem.getData();
            if (mColumn.getLabel().equals(column.getLabel())) {
                linker.addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), treeNode, true);
                break;
            }
        }
    }
    TreeItem[] children = node.getItems();
    for (TreeItem element : children) {
        initLinker(element, tableItems);
    }
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) TableItem(org.eclipse.swt.widgets.TableItem) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 85 with IMetadataColumn

use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.

the class OracleGenerationManagerTest method createMetadataTable.

private IMetadataTable createMetadataTable(String... columnLabels) {
    IMetadataTable metadataTable = new MetadataTable();
    // will be error, strange
    // List<IMetadataColumn> columns = mock(List.class);
    List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
    if (columnLabels != null) {
        for (String columnlabel : columnLabels) {
            columns.add(createColumn(columnlabel));
        }
    }
    // when(metadataTable.getListColumns()).thenReturn(columns);
    metadataTable.setListColumns(columns);
    return metadataTable;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Aggregations

IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)149 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)82 ArrayList (java.util.ArrayList)73 List (java.util.List)34 IConnection (org.talend.core.model.process.IConnection)34 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)31 HashMap (java.util.HashMap)30 IElementParameter (org.talend.core.model.process.IElementParameter)26 Map (java.util.Map)24 INode (org.talend.core.model.process.INode)24 MetadataTable (org.talend.core.model.metadata.MetadataTable)23 Node (org.talend.designer.core.ui.editor.nodes.Node)16 Point (org.eclipse.swt.graphics.Point)15 Connection (org.talend.designer.core.ui.editor.connections.Connection)10 INodeConnector (org.talend.core.model.process.INodeConnector)9 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)9 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)9 MetadataTableEditor (org.talend.core.ui.metadata.editor.MetadataTableEditor)8 IComponent (org.talend.core.model.components.IComponent)7 IODataComponent (org.talend.core.model.components.IODataComponent)7