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?
}
}
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());
}
}
}
}
}
Aggregations