Search in sources :

Example 16 with IConnection

use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.

the class OracleGenerationManagerTest method setUp.

@Before
public void setUp() throws Exception {
    dbMapComponent = new DbMapComponent();
    List<IConnection> incomingConnections = new ArrayList<IConnection>();
    conn = mock(IConnection.class);
    incomingConnections.add(conn);
    dbMapComponent.setIncomingConnections(incomingConnections);
    oracleManager = new OracleGenerationManager();
}
Also used : DbMapComponent(org.talend.designer.dbmap.DbMapComponent) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) Before(org.junit.Before)

Example 17 with IConnection

use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.

the class PostgresGenerationManagerTest method init.

private void init(String schema, String main_table, String lookup_table) {
    List<IConnection> incomingConnections = new ArrayList<IConnection>();
    String[] mainTableEntities = new String[] { "id", "name", "classNum" };
    String[] lookupEndtities = new String[] { "id", "score" };
    incomingConnections.add(mockConnection(schema, main_table, mainTableEntities));
    incomingConnections.add(mockConnection(schema, lookup_table, lookupEndtities));
    component.setIncomingConnections(incomingConnections);
    ExternalDbMapData externalData = new ExternalDbMapData();
    List<ExternalDbMapTable> inputs = new ArrayList<ExternalDbMapTable>();
    List<ExternalDbMapTable> outputs = new ArrayList<ExternalDbMapTable>();
    // main table
    ExternalDbMapTable inputTable = new ExternalDbMapTable();
    inputTable.setTableName(schema + "." + main_table);
    List<ExternalDbMapEntry> entities = getMetadataEntities(mainTableEntities, new String[3]);
    inputTable.setMetadataTableEntries(entities);
    inputs.add(inputTable);
    // lookup table
    inputTable = new ExternalDbMapTable();
    inputTable.setTableName(schema + "." + lookup_table);
    entities = getMetadataEntities(lookupEndtities, new String[2]);
    inputTable.setMetadataTableEntries(entities);
    inputs.add(inputTable);
    // output
    ExternalDbMapTable outputTable = new ExternalDbMapTable();
    outputTable.setName("grade");
    List<ExternalDbMapEntry> conditions = new ArrayList<ExternalDbMapEntry>();
    conditions.add(new ExternalDbMapEntry(schema + "." + main_table + ".id =3"));
    outputTable.setCustomWhereConditionsEntries(conditions);
    String[] names = new String[] { "id", "name", "classNum", "score" };
    String[] expressions = new String[] { schema + "." + main_table + ".id", schema + "." + main_table + ".name", schema + "." + main_table + ".classNum", schema + "." + lookup_table + ".score" };
    outputTable.setMetadataTableEntries(getMetadataEntities(names, expressions));
    outputs.add(outputTable);
    externalData.setInputTables(inputs);
    externalData.setOutputTables(outputs);
    component.setExternalData(externalData);
    List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
    MetadataTable metadataTable = getMetadataTable(names);
    metadataTable.setLabel("grade");
    metadataList.add(metadataTable);
    component.setMetadataList(metadataList);
    Process process = mock(Process.class);
    when(process.getContextManager()).thenReturn(new JobContextManager());
    component.setProcess(process);
}
Also used : ExternalDbMapData(org.talend.designer.dbmap.external.data.ExternalDbMapData) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) Process(org.talend.designer.core.ui.editor.process.Process) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ExternalDbMapTable(org.talend.designer.dbmap.external.data.ExternalDbMapTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) JobContextManager(org.talend.core.model.context.JobContextManager) ExternalDbMapEntry(org.talend.designer.dbmap.external.data.ExternalDbMapEntry)

Example 18 with IConnection

use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.

the class ComponentSettingsView method isAvoidRecoveryByConditions.

/**
     * Need to add recovery category or not by some conditions for current connection
     * 
     * @param elem
     */
private boolean isAvoidRecoveryByConditions(IElement elem) {
    if (elem instanceof IConnection) {
        INode source = ((IConnection) elem).getSource();
        List<? extends IConnection> conns = source.getIncomingConnections();
        for (IConnection conn : conns) {
            Object propertyValue = conn.getPropertyValue(Connection.LINESTYLE_PROP);
            if (propertyValue.equals(EConnectionType.ON_COMPONENT_OK) || propertyValue.equals(EConnectionType.ON_COMPONENT_ERROR) || propertyValue.equals(EConnectionType.RUN_IF) || propertyValue.equals(EConnectionType.ON_SUBJOB_ERROR) || propertyValue.equals(EConnectionType.PARALLELIZE)) {
                return true;
            } else {
                if (isAvoidRecoveryByConditions(conn)) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : INode(org.talend.core.model.process.INode) IConnection(org.talend.core.model.process.IConnection)

Example 19 with IConnection

use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.

the class MultiUIManager method autoMap.

/**
     * 
     * DOC wzhang Comment method "autoMap". for multiSchema.
     */
public void autoMap() {
    List<FOXTreeNode> treeData = foxManager.getTreeData(foxManager.getCurrentSchema());
    if (treeData == null || treeData.size() < 1) {
        return;
    }
    FOXTreeNode root = treeData.get(0);
    List<FOXTreeNode> mappableNodes = new ArrayList<FOXTreeNode>();
    getMappableNode((Element) root, mappableNodes);
    IConnection connection = foxUI.getConnection();
    if (connection != null) {
        IMetadataTable metadataTable = connection.getMetadataTable();
        if (metadataTable != null) {
            List<IMetadataColumn> schemaData = metadataTable.getListColumns();
            for (FOXTreeNode node : mappableNodes) {
                for (IMetadataColumn column : schemaData) {
                    if (node.getLabel().equals(column.getLabel())) {
                        node.setTable(metadataTable);
                        node.setColumn(column);
                        node.setDefaultValue(null);
                        node.setRow(foxManager.getCurrentSchema());
                        break;
                    }
                }
            }
        }
    }
    this.foxUI.refreshXMLViewer(root);
    this.foxUI.redrawLinkers();
}
Also used : FOXTreeNode(org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 20 with IConnection

use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.

the class FOXManager method getOriginalNodes.

/**
     * 
     * DOC wzhang Comment method "getOriginalNodes".
     * 
     * @return
     */
protected List<FOXTreeNode> getOriginalNodes() {
    List<FOXTreeNode> tmpTreeData = new ArrayList<FOXTreeNode>();
    List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(this.getFoxComponent(), IConnectionCategory.FLOW);
    if (incomingConnections.size() > 0) {
        for (IConnection conn : incomingConnections) {
            String uniqueName = conn.getUniqueName();
            List<FOXTreeNode> list = contents.get(uniqueName);
            tmpTreeData.addAll(list);
        }
    }
    return tmpTreeData;
}
Also used : FOXTreeNode(org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection)

Aggregations

IConnection (org.talend.core.model.process.IConnection)149 ArrayList (java.util.ArrayList)79 INode (org.talend.core.model.process.INode)63 List (java.util.List)60 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)57 Node (org.talend.designer.core.ui.editor.nodes.Node)47 HashMap (java.util.HashMap)36 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)33 IElementParameter (org.talend.core.model.process.IElementParameter)31 Map (java.util.Map)25 Connection (org.talend.designer.core.ui.editor.connections.Connection)25 INodeConnector (org.talend.core.model.process.INodeConnector)24 Point (org.eclipse.swt.graphics.Point)13 Process (org.talend.designer.core.ui.editor.process.Process)13 IJobletProviderService (org.talend.core.ui.IJobletProviderService)12 HashSet (java.util.HashSet)11 MetadataTable (org.talend.core.model.metadata.MetadataTable)10 IProcess (org.talend.core.model.process.IProcess)10 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)9 IExternalNode (org.talend.core.model.process.IExternalNode)8