Disabling a Node in Java

Hello all,

I am running a Graph from Java and I want to enable/disable one of the phases in the Graph, based on user input.

My code reads the TransformationGraph from an XML-file.
I then try to disable all nodes in phase 0 of my graph, like this:

Node node0= Node graph.getNodes().get(“DB_EXECUTE0”);
node0.setEnabled(“disabled”);
System.out.println("DEBUG: Node0: "+node0.getEnabled());

The DEBUG-print shows that the node is now correctly disabled, but when I execute the Graph, the disabled node executes as well.

What am i missing?

Thanks, for reading this message.
Paul.

Hello Paul.

Unfortunately disabling of components is not as simple as you maybe expected. Nonetheless your usecase is not impossible. Two suggestions:

  1. After graph initialization is almost completely impossible to change graph topology. Every changes have to be done before graph.init().

  2. Only node0.setEnabled(“disabled”) invocation is not sufficient. Please try to call this static method immediately after that:

TransformationGraphAnalyzer.disableNodesInPhases(graph);

which should remove all disabled components and their edges.

In the future releases this invocation should be part of the graph initialization.

Martin