XMLInputFactory xif = XMLInputFactory.newInstance();
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().latestVersion().list();
for (ProcessDefinition definition : list) {
log.info(definition.getName());
log.info(definition.getKey());
log.info(definition.getId());
log.info(definition.getDeploymentId());
InputStream bpmnStream = repositoryService.getResourceAsStream(definition.getDeploymentId(), definition.getResourceName());
InputStreamReader in = new InputStreamReader(bpmnStream, StandardCharsets.UTF_8);
XMLStreamReader xtr = xif.createXMLStreamReader(in);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
Process mainProcess = bpmnModel.getMainProcess();
Collection<FlowElement> flowElements = mainProcess.getFlowElements();
flowElements.stream().filter(r->r instanceof UserTask||r instanceof ServiceTask).forEach((x)-> {
log.info(x.getClass().toString());
log.info(x.getId());
log.info(x.getName());
log.info(x.getDocumentation());
});
}