BpmnModel model = repositoryService.getBpmnModel(task.getProcessDefinitionId());
UserTask userTask = (UserTask) model.getFlowElement(destId);
List<String> groups = userTask.getCandidateGroups();
List<IdentityLink> ilList = taskService.getIdentityLinksForTask(currtask.getId());
List<Comment> comlist = taskService.getTaskComments(task.getId());
List<Attachment> attachments = taskService.getTaskAttachments(taskId);
List<HistoricTaskInstance> his = historyService
.createHistoricTaskInstanceQuery().finished()
.orderByHistoricTaskInstanceEndTime().desc()
.processInstanceId(c.getProcessInstanceId()).list();
public JSONArray findHistoryTask(String processInstanceId){
JSONArray array = new JSONArray();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
String processDefinitionId = processInstance.getProcessDefinitionId();
BpmnModel model = repositoryService.getBpmnModel(processDefinitionId);
Process process = model.getProcesses().get(0);
Collection<FlowElement> flowElements = process.getFlowElements();
for (FlowElement flowElement : flowElements) {
if(flowElement instanceof StartEvent){
StartEvent startEvent = (StartEvent)flowElement;
System.out.println(startEvent);
}
if(flowElement instanceof UserTask) {
UserTask userTask = (UserTask)flowElement;
List<String> candidateUsers = userTask.getCandidateUsers();
for (String string : candidateUsers) {
System.out.println("-------"+string);
}
System.out.println(userTask);
}
if(flowElement instanceof EndEvent) {
EndEvent endEvent = (EndEvent)flowElement;
System.out.println(endEvent);
}
if(flowElement instanceof SequenceFlow) {
SequenceFlow sequenceFlow = (SequenceFlow) flowElement;
System.out.println(sequenceFlow);
String name=sequenceFlow.getName();
String str =sequenceFlow.getConditionExpression();
String value = str.substring(str.lastIndexOf("=") + 1, str.lastIndexOf("}"));
}
}
}