private void rebuildScriptSourceEdges(OperationWrapperNode opNode) {
for (PipelineActivityNode child : opNode.getChildren()) {
child.removeScriptSourceEdges();
}
OperationWrapper op = opNode.getDataObject();
for (Route route : op.getOutgoingRoutes().keepAll(RoutePredicates.FROM_SCRIPT_SOURCE)) {
PipelineActivityNode sourceNode = opNode.getChildFor(route.getSourceActivity());
// When an scripted activity is deleted from the pipeline, there are two
// separate events: one activityRemoved event, and then a FlowChanged event
// from the OperationFlow. When we reach this point, the second event has not
// have been processed yet, so the operation wrapper still has its
// scripted routes, even though the scripted activity itself (and its node)
// has been removed.
if (sourceNode != null && op.getPipeline().contains(sourceNode.getDataObject())) {
OperationWrapperNode linkedOpNode = operationNodes.get(route.getTo());
ScriptSourceEdge edge = new ScriptSourceEdge(sourceNode, linkedOpNode);
sourceNode.addOutgoingRoute(edge);
}
}