*/
public void invokeModifiedWorkflow() {
// TODO error handling
Workflow workflow = this.engine.getWorkflow();
Workflow diffWorkflow;
try {
MonitorEventData eventData = this.engine.getMonitor()
.getEventData();
WorkflowModifier modifier = new WorkflowModifier(workflow,
eventData);
diffWorkflow = modifier.createDifference();
// open the diff in a new tab, but do not focus it.
GraphCanvas canvas = this.engine.getGUI().newGraphCanvas(false);
canvas.setWorkflow(diffWorkflow);
} catch (MonitorException e) {
this.engine.getErrorWindow().error(e);
return;
} catch (GraphException e) {
// This should not happen.
this.engine.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR,
e);
return;
} catch (RuntimeException e) {
this.engine.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR,
e);
return;
}
// Change the topic so that messages won't be mixed up with ones for the
// original workflow.
MonitorConfiguration monitorConfiguration = this.engine.getMonitor()
.getConfiguration();
String newTopic = monitorConfiguration.getTopic() + "-diff";
monitorConfiguration.setTopic(newTopic);
// Invoke the workflow without showing the dialog.
GPELInvoker invoker = new GPELInvoker(this.engine);
try {
WorkflowClient.createScript(diffWorkflow);
} catch (GraphException e) {
this.engine.getErrorWindow().error(e); // TODO
return;
}
// Create a GUI without depending on the graph.
// Set the default as an input.
List<WSComponentPort> inputs;
try {
inputs = diffWorkflow.getInputs();
} catch (ComponentException e) {
// This should not happen when we create WSDL here, but if we use
// precompiled workflow, it might happen.
this.engine.getErrorWindow().error(
ErrorMessages.WORKFLOW_WSDL_ERROR, e);
return;
}
for (WSComponentPort input : inputs) {
String defaultValue = input.getDefaultValue();
input.setValue(defaultValue);
}
invoker.invoke(diffWorkflow, inputs, true);
// Change the ID of current display so that we can keep monitoring.
URI instanceID = diffWorkflow.getGPELInstanceID();
workflow.setGPELInstanceID(instanceID);
}