}
List<NodeInstance> nis = pi.retrieveNodeInstances();
Map<String, NodeInstance> nodeIMap = new HashMap<String, NodeInstance>();
for (Iterator<NodeInstance> it = nis.iterator(); it.hasNext();) {
NodeInstance ni = it.next();
if (nodeIMap.get(ni.getNode().getObjUid()) == null) {
nodeIMap.put(ni.getNode().getObjUid(), ni);
} else if (ni.getExeStatus().intValue() == NodeInstance.STATUS_FINISH) {
nodeIMap.put(ni.getNode().getObjUid(), ni);
}
}
ProcessTemplate pt = pi.getProcessTemplate();
StringBuilder xml = new StringBuilder("<wf> <processtemplate name='")
.append(pt.getPtName()).append("'>");
StringBuilder strNodeList = new StringBuilder("<nodes>");
StringBuilder strFlowList = new StringBuilder("<transitions>");
for (Iterator<PTNode> it = pt.retrieveNodes().iterator(); it.hasNext();) {
PTNode aNode = it.next();
String autoServiceName = "";
String deciType = "";
String authType = "";
if (aNode.getAutoExcutesService() != null) {
autoServiceName = aNode.getAutoExcutesService().getName();
}
if (aNode.getDecisionType() != null) {
deciType = aNode.getDecisionType().toString();
}
if (aNode.getAuthType() != null) {
authType = aNode.getAuthType().toString();
}
String paneName = "";
if (aNode.getPane() != null) {
paneName = aNode.getPane().getName();
}
String nodeName = aNode.getNodeName();
NodeInstance nodeI = nodeIMap.get(aNode.getObjUid());
if (nodeI != null && nodeI.getPerformer() != null) {
String name = null;
try {
BOInstance user = OrgParter.getDefaultEmployee().getDoBO()
.getInstance(nodeI.getPerformer());
if (user != null) {
name = user.getName();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (name != null) {
nodeName = nodeName + "(操作人:" + name + ")";
}
}
//当流程是下一步执行人可选时,当前节点操作人若为上一步操作人所选择的,
//则在当前节点显示当前节点的操作人.--by stone
else if (nodeI != null && nodeI.getPerformer() == null) {
String name = null;
String nodeUUid = null;
String nextUserId = null;
nodeUUid = nodeI.getObjUid();
if (nodeUUid != null) {
List nextUserList = DOAuthorization.getAuthConfigOfWhat(""
+ DOAuthorization.WHAT_WF_NODEINSTANCE, nodeUUid);
if (nextUserList.size() > 0) {
DOAuthorization nextuserDO = (DOAuthorization) nextUserList
.iterator().next();
if (nextuserDO != null) {
nextUserId = nextuserDO.getOuUid();
}
if (nextUserId != null) {
BOInstance ouUser = OrgParter.getDefaultEmployee()
.getDoBO().getInstance(nextUserId);
if (ouUser != null) {
name = ouUser.getName();
}
}
}
}
if (name != null) {
nodeName = nodeName + "(操作人:" + name + ")";
}
}
String status = "init";
if (nodeI != null && nodeI.getExeStatus() != null) {
switch (nodeI.getExeStatus().intValue()) {
case NodeInstance.STATUS_RUN:
status = "run";
break;
case NodeInstance.STATUS_FINISH:
status = "finish";