// Get the internal network group and deregister all the workflows
// being configured for the backend (there is one workflow per
// backend base DN).
NetworkGroup internalNetworkGroup = NetworkGroup.getInternalNetworkGroup();
Workflow workflow = internalNetworkGroup.deregisterWorkflow(baseDN);
WorkflowImpl workflowImpl = (WorkflowImpl) workflow;
// The workflow ID is "backendID + baseDN".
// We cannot use backendID as workflow identifier because a backend
// may handle several base DNs. We cannot use baseDN either because
// we might want to configure several workflows handling the same
// baseDN through different network groups. So a mix of both
// backendID and baseDN should be ok.
String workflowID = backendID + "#" + baseDN.toString();
NDBWorkflowElement.remove(backendID);
workflowImpl.deregister(workflowID);
}