protected void printDetails(String pid) {
ProcessEngine pe = this.getProcessEngine();
RepositoryService repo = pe.getRepositoryService();
RuntimeService rt = pe.getRuntimeService();
HistoryService hs = pe.getHistoryService();
ProcessInstance pi = rt.createProcessInstanceQuery().processInstanceId(pid).singleResult();
HistoricProcessInstance hpi = hs.createHistoricProcessInstanceQuery().processInstanceId(pid)
.singleResult();
if (pi == null && hpi == null) {
// both null means. no process with that id.
out().printf("No process details found with process id %s \n", pid);
return;
}
String pdId = null;
if (pi != null) {
pdId = pi.getProcessDefinitionId();
} else if (hpi != null) {
pdId = hpi.getProcessDefinitionId();
}
ProcessDefinition pd = repo.createProcessDefinitionQuery().processDefinitionId(pdId).singleResult();
Deployment depInfo = repo.createDeploymentQuery().deploymentId(pd.getDeploymentId()).singleResult();
// print
if (isVerbose()) {
out().println("======== Deployment Details");
printDeploymentInfo(depInfo);
out().println("======== Process Definition Details");
printProcessDefinitionInfo(pd);
}
out().println("======== Process Instance Details");
printProcessInstanceInfo(hpi);
List<HistoricActivityInstance> actInstList = hs.createHistoricActivityInstanceQuery()
.processInstanceId(hpi.getId()).orderByHistoricActivityInstanceStartTime().asc().list();
if (actInstList != null && actInstList.size() > 0) {
out().println("======== Activity Execution Details");
for (HistoricActivityInstance actInst : actInstList) {
printActivityInstanceInfo(actInst);