Migrate to Flowable from Activiti - BpmParseHandler

Hi
I’m migrating an old activiti app to Flowable. I’m having trouble with some code we had to attach create/complete/cancel listeners to user tasks. I could not find any examples on how to migrate this code. Any help would be appreciated.

Simplified example below:


public class HumanTaskParseHandler implements BpmnParseHandler{
 private IHumanTaskCreateListener listener;

  @Override
  public Collection<Class<? extends BaseElement>> getHandledTypes()
  {
    return Lists.<Class<? extends BaseElement>>newArrayList(UserTask.class);
  }

  @Override
  public void parse(BpmnParse bpmnParse, BaseElement element)
  {
    String taskDefinitionKey = element.getId();
    TaskDefinition taskDefinition =
        bpmnParse.getCurrentProcessDefinition().getTaskDefinitions().get(taskDefinitionKey);
    taskDefinition.addTaskListener(TaskListener.EVENTNAME_CREATE, listener);
}
}