PVM classes code adaption when switch from Actitivi 5.15.1 to Flowable 6.5.0

Hello,
I am migrating from Activiti 5.15.1 to Flowable 6.5.0, and get some issues with PVM classes. I read the guide here Flowable Migration Guide : Flowable or Activiti v5 to Flowable V6 · Flowable Open Source Documentation but still not have any idea to make use of bpmnModel and repositoryService. I got some issues as:

  1. I can get the activity name by doing like this:
Execution execution = ...
ProcessDefinitionEntityImpl processDefinition = ...
ActivityImpl activity = processDefinition.findActivity(execution.getActivityId());
String.valueOf(activity.getProperty("name"));
  1. I use the method findPropertyById in org.activiti.engine.impl.persistence.entity.PropertyEntityManager

How can I achieve these in Flowable 6?
Thanks for your help

Hey @minh,

  1. The DelegateExecution has the getCurrentFlowElement that provides access to the FlowElement, by doing that you can get access to the FlowElement and all of its information. If you need to go through the BpmnModel you can do something like:
BpmnModel model = repositoryService.getBpmnModel(execution.getProcessDefinitionId());
Process process = model.getMainProcess();
FlowElement element = process.getFlowElement(execution.getActivityId());
  1. You can use ManagementService#getProperties for getting all properties

Cheers,
Filip