Search in sources :

Example 11 with IODataComponent

use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.

the class ChangeMetadataCommand method initializeContainer.

private void initializeContainer() {
    outputdataContainer = new IODataComponentContainer();
    for (Connection connec : (List<Connection>) node.getIncomingConnections()) {
        if (connec.getLineStyle().equals(EConnectionType.FLOW_MAIN)) {
            IODataComponent input = null;
            if (newInputMetadata == null) {
                input = new IODataComponent(connec);
            } else {
                if (connec.getMetaName().equals(newInputMetadata.getTableName())) {
                    input = new IODataComponent(connec, newInputMetadata);
                }
            }
            if (input != null) {
                outputdataContainer.getInputs().add(input);
            }
        }
    }
    for (Connection connec : (List<Connection>) node.getOutgoingConnections()) {
        if (connec.getLineStyle().equals(EConnectionType.FLOW_MAIN) || isinputContainerOutput(connec) || ((connec.getLineStyle().equals(EConnectionType.FLOW_MERGE) && (connec.getInputId() == 1)))) {
            if ((!connec.getSource().getConnectorFromType(connec.getLineStyle()).isMultiSchema()) || (connec.getMetaName().equals(newOutputMetadata.getTableName()))) {
                IODataComponent output = new IODataComponent(connec, newOutputMetadata);
                outputdataContainer.getOuputs().add(output);
            }
        }
    }
    if (inputNode != null) {
        inputdataContainer = new IODataComponentContainer();
        for (Connection connec : (List<Connection>) inputNode.getOutgoingConnections()) {
            if (connec.getTarget().equals(node)) {
                if ((!connec.getSource().getConnectorFromType(connec.getLineStyle()).isMultiSchema()) || (connec.getMetaName().equals(newInputMetadata.getTableName()))) {
                    IODataComponent output = new IODataComponent(connec, newInputMetadata);
                    inputdataContainer.getOuputs().add(output);
                }
            }
        }
    }
}
Also used : IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) ArrayList(java.util.ArrayList) List(java.util.List) IODataComponent(org.talend.core.model.components.IODataComponent) IODataComponentContainer(org.talend.core.model.components.IODataComponentContainer)

Example 12 with IODataComponent

use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.

the class ExternalNodeUtils method prepareExternalNodeReadyToOpen.

/**
     * DOC amaumont Comment method "prepareExternalNodeReadyToOpen".
     * 
     * @param node
     * @param externalNode
     * @return
     */
public static IExternalNode prepareExternalNodeReadyToOpen(IExternalNode externalNode) {
    IODataComponentContainer inAndOut = new IODataComponentContainer();
    List<IODataComponent> inputs = inAndOut.getInputs();
    if (externalNode.getIncomingConnections() != null) {
        for (IConnection currentConnection : externalNode.getIncomingConnections()) {
            IODataComponent component = new IODataComponent(currentConnection);
            inputs.add(component);
        }
    }
    List<IODataComponent> outputs = inAndOut.getOuputs();
    if (externalNode.getOutgoingConnections() != null) {
        for (IConnection currentConnection : externalNode.getOutgoingConnections()) {
            IODataComponent component = new IODataComponent(currentConnection);
            outputs.add(component);
        }
    }
    externalNode.setIODataComponents(inAndOut);
    return externalNode;
}
Also used : IConnection(org.talend.core.model.process.IConnection) IODataComponent(org.talend.core.model.components.IODataComponent) IODataComponentContainer(org.talend.core.model.components.IODataComponentContainer)

Example 13 with IODataComponent

use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.

the class ExternalUtilities method getExternalNodeReadyToOpen.

public static IExternalNode getExternalNodeReadyToOpen(Node node) {
    IExternalNode externalNode = node.getExternalNode();
    if (externalNode == null) {
        return null;
    }
    externalNode.setExternalData(node.getExternalData());
    externalNode.setOriginalNode(node);
    IODataComponentContainer inAndOut = new IODataComponentContainer();
    List<IODataComponent> inputs = inAndOut.getInputs();
    for (IConnection currentConnection : node.getIncomingConnections()) {
        if (currentConnection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
            IODataComponent component = new IODataComponent(currentConnection);
            inputs.add(component);
        }
    }
    List<IODataComponent> outputs = inAndOut.getOuputs();
    for (IConnection currentConnection : node.getOutgoingConnections()) {
        if (currentConnection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
            IODataComponent component = new IODataComponent(currentConnection, currentConnection.getMetadataTable().clone(true));
            outputs.add(component);
        }
    }
    externalNode.setIODataComponents(inAndOut);
    return externalNode;
}
Also used : IConnection(org.talend.core.model.process.IConnection) IODataComponent(org.talend.core.model.components.IODataComponent) IExternalNode(org.talend.core.model.process.IExternalNode) IODataComponentContainer(org.talend.core.model.components.IODataComponentContainer)

Example 14 with IODataComponent

use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.

the class RowGeneratorComponent method getIODataComponents.

@Override
public IODataComponentContainer getIODataComponents() {
    IODataComponentContainer inAndOut = new IODataComponentContainer();
    List<IODataComponent> outputs = inAndOut.getOuputs();
    for (IConnection currentConnection : getOutgoingConnections()) {
        if (currentConnection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
            IODataComponent component = new IODataComponent(currentConnection, metadataListOut.get(0));
            outputs.add(component);
        }
    }
    return inAndOut;
}
Also used : IConnection(org.talend.core.model.process.IConnection) IODataComponent(org.talend.core.model.components.IODataComponent) IODataComponentContainer(org.talend.core.model.components.IODataComponentContainer)

Example 15 with IODataComponent

use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.

the class RowGenMain method createModelFromExternalData.

/**
     * qzhang Comment method "createModelFromExternalData".
     * 
     * @param dataComponents
     * @param metadataList
     * @param externalData
     * @param b
     */
public void createModelFromExternalData(IODataComponentContainer dataComponents, List<IMetadataTable> metadataList, ExternalRowGeneratorData externalData, boolean b) {
    List<IODataComponent> inputsData = dataComponents.getInputs();
    List<IODataComponent> ouputsData = dataComponents.getOuputs();
    ArrayList<IOConnection> inputs = new ArrayList<IOConnection>(inputsData.size());
    for (IODataComponent iData : inputsData) {
        inputs.add(new IOConnection(iData));
    }
    ArrayList<IOConnection> outputs = new ArrayList<IOConnection>(ouputsData.size());
    for (IODataComponent oData : ouputsData) {
        outputs.add(new IOConnection(oData));
    }
    createModelFromExternalData(inputs, outputs, metadataList, externalData, false);
}
Also used : IOConnection(org.talend.designer.rowgenerator.external.data.IOConnection) ArrayList(java.util.ArrayList) IODataComponent(org.talend.core.model.components.IODataComponent)

Aggregations

IODataComponent (org.talend.core.model.components.IODataComponent)20 IConnection (org.talend.core.model.process.IConnection)11 ArrayList (java.util.ArrayList)10 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)10 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)7 List (java.util.List)6 IODataComponentContainer (org.talend.core.model.components.IODataComponentContainer)6 INode (org.talend.core.model.process.INode)5 Connection (org.talend.designer.core.ui.editor.connections.Connection)5 Node (org.talend.designer.core.ui.editor.nodes.Node)4 IExternalNode (org.talend.core.model.process.IExternalNode)3 INodeConnector (org.talend.core.model.process.INodeConnector)3 HashMap (java.util.HashMap)2 ColumnNameChanged (org.talend.core.model.metadata.ColumnNameChanged)2 Process (org.talend.designer.core.ui.editor.process.Process)2 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)2 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 EList (org.eclipse.emf.common.util.EList)1