Is there a way to get jobs in the Activiti process definition without instantiating the process?

I need to expose the Activiti API process using the service of my project.

My requirement:

I want to learn more about the tasks in defining an Activiti process using Java before starting the Process, i.e. before creating Activiti ProcessInstance. Is there any way to achieve this?

I looked through Java docs and the Activiti API user guide many times, but couldn't find a way.

Any help would be appreciated, thanks.

+4
source share
2 answers

You can use the getBpmnModel (processDefinitionId) method, available in the RepositoryService interface.

- Pojo, o , . pojo , ( ). , findFlowElementsOfType ( ).

, ( , , ):

BpmnModel model = processEngine.getRepositoryService().getBpmnModel(someProcessId);
List<Process> processes = model.getProcesses();
List<UserTask> userTasks = new ArrayList<>();
for( Process p : processes ) {
     userTasks.addAll( p.findFlowElementsOfType(UserTask.class))    
}
+4

(bpmn), :

RepositoryService repositoryService = processEngine.getRepositoryService();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
List<Process> processes = bpmnModel.getProcesses();
for (Process p : processes) {
    Collection<FlowElement> elements = p.getFlowElements();
    for (FlowElement element : elements) {
        if (element instanceof UserTask) {
            // do something
        } else if (element instanceof ServiceTask) {
            // do something
        } else if (element instanceof StartEvent) {
            // do something
        }
    }
}
+4

All Articles