Search in sources :

Example 6 with NodeAndInports

use of org.knime.core.node.workflow.Workflow.NodeAndInports in project knime-core by knime.

the class WorkflowManager method configureNodesConnectedToPortInWFM.

/**
 * Configure the nodes in WorkflowManager, connected to a specific set of ports. If ports == null, configure all
 * nodes. Note that this routine does NOT configure any nodes connected in the parent WFM.
 *
 * @param wfm the WorkflowManager
 * @param inportIndeces indeces of incoming ports (or null if not known)
 */
private void configureNodesConnectedToPortInWFM(final Set<Integer> inportIndeces) {
    try (WorkflowLock lock = lock()) {
        ArrayList<NodeAndInports> nodes = m_workflow.findAllConnectedNodes(inportIndeces);
        for (NodeAndInports nai : nodes) {
            NodeContainer nc = m_workflow.getNode(nai.getID());
            assert nc != null;
            if (nc instanceof SingleNodeContainer) {
                configureSingleNodeContainer((SingleNodeContainer) nc, false);
            } else {
                ((WorkflowManager) nc).configureNodesConnectedToPortInWFM(nai.getInports());
            }
        }
        // and finalize state
        // (note that we must call this even if no node was configured since a predecessor
        // and a THROUGH_Connetion can affect that state of this node, too.)
        lock.queueCheckForNodeStateChangeNotification(true);
    // TODO: clean up flow object stack after we leave WFM?
    }
}
Also used : NodeAndInports(org.knime.core.node.workflow.Workflow.NodeAndInports)

Example 7 with NodeAndInports

use of org.knime.core.node.workflow.Workflow.NodeAndInports in project knime-core by knime.

the class WorkflowManager method cleanOutputPortsInWFMConnectedToInPorts.

/**
 * Clean outports of nodes connected to set of input ports. Used while restarting the loop, whereby the loop body is
 * not to be reset (special option in start nodes). Clearing is done in correct order: downstream nodes first.
 *
 * @param inPorts set of port indices of the WFM.
 */
void cleanOutputPortsInWFMConnectedToInPorts(final Set<Integer> inPorts) {
    try (WorkflowLock lock = lock()) {
        ArrayList<NodeAndInports> nodes = m_workflow.findAllConnectedNodes(inPorts);
        ListIterator<NodeAndInports> li = nodes.listIterator(nodes.size());
        while (li.hasPrevious()) {
            NodeAndInports nai = li.previous();
            NodeContainer nc = m_workflow.getNode(nai.getID());
            if (nc.isResetable()) {
                if (nc instanceof SingleNodeContainer) {
                    ((SingleNodeContainer) nc).cleanOutPorts(true);
                } else {
                    assert nc instanceof WorkflowManager;
                    ((WorkflowManager) nc).cleanOutputPortsInWFMConnectedToInPorts(nai.getInports());
                }
            }
        }
    }
}
Also used : NodeAndInports(org.knime.core.node.workflow.Workflow.NodeAndInports)

Aggregations

NodeAndInports (org.knime.core.node.workflow.Workflow.NodeAndInports)7 RestoredFlowLoopContext (org.knime.core.node.workflow.FlowLoopContext.RestoredFlowLoopContext)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)1 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1 Node (org.knime.core.node.Node)1 NotConfigurableException (org.knime.core.node.NotConfigurableException)1 DialogNode (org.knime.core.node.dialog.DialogNode)1 InputNode (org.knime.core.node.dialog.InputNode)1 MetaNodeDialogNode (org.knime.core.node.dialog.MetaNodeDialogNode)1 OutputNode (org.knime.core.node.dialog.OutputNode)1