Skip to content

Instantly share code, notes, and snippets.

@henryyan
Created November 29, 2011 07:20
Show Gist options
  • Save henryyan/1403844 to your computer and use it in GitHub Desktop.
Save henryyan/1403844 to your computer and use it in GitHub Desktop.
获取节点坐标
Execution execution = runtimeService.createExecutionQuery().executionId(processInstanceId).singleResult();//执行实例
Object property = PropertyUtils.getProperty(execution, "activityId");
String activityId = "";
if (property != null) {
activityId = property.toString();
}
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<ActivityImpl> activitiList = processDefinition.getActivities();//获得当前任务的所有节点
ActivityImpl activity = null;
for (ActivityImpl activityImpl : activitiList) {
String id = activityImpl.getId();
if (id.equals(activityId)) {//获得执行到那个节点
activity = activityImpl;
break;
}
}
Map<String, Integer> activityImageInfo = new HashMap<String, Integer>();
activityImageInfo.put("x", activity.getX());
activityImageInfo.put("y", activity.getY());
activityImageInfo.put("width", activity.getWidth());
activityImageInfo.put("height", activity.getHeight());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment