Hello,
I want to create a behavior that cancels associated workflows after file deletion. After some research, I found out that I need to implement the following Behavior/Policie:
public void beforeDeleteNode(final NodeRef nodeRef) {
List<WorkflowInstance> activeWorkflow = serviceRegistry.getWorkflowService().getWorkflowsForContent(nodeRef,true);
for (WorkflowInstance w : activeWorkflow) {
wIds.add(w.getId());
}
}
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived) {
if (wIds.size() > 0) {
serviceRegistry.getWorkflowService().cancelWorkflows(wIds);
}
wIds.clear();
}My problem is I don't know where or how to implement this, any help is appreciated.