List<Element> actEls = null;
String _xpath = "/ProcessDefine/Activitys/Activity";
actEls = document.selectNodes(_xpath);
for(Element actEl : actEls) {
ActivityElement activityXml = new ActivityElement();
String id = NodeUtil.getNodeAttrValue(actEl, StarFlowNames.ACT_ATTR_ID);
activityXml.setId(id);
String type = NodeUtil.getNodeAttrValue(actEl, StarFlowNames.ACT_ATTR_TYPE);
activityXml.setType(type);
activityXml.setName(NodeUtil.getNodeAttrValue(actEl, StarFlowNames.ACT_ATTR_NAME));
activityXml.setDescription(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_DESC));
if(Constants.ACT_TYPE_START.equalsIgnoreCase(type)) {//开始
activityXml.setSplitMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_SPLIT));
} else if(Constants.ACT_TYPE_END.equalsIgnoreCase(type)) {//结束
activityXml.setJoinMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_JOIN));
activityXml.setActivateRuleType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_ACTIVATE_RULE_TYPE));
activityXml.setStartStrategybyAppAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_STARTSTRATEGYBYAPPACTION));
} else if(Constants.ACT_TYPE_TOOLAPP.equalsIgnoreCase(type)) {//自动
activityXml.setFinishType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_AUTO_FINSISH_TYPE));
activityXml.setInvokePattern(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_AUTO_INVOKE_PATTERN));
activityXml.setTransactionType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_AUTO_TRANSACTION_TYPE));
activityXml.setExceptionStrategy(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_EXCEPTION_STRATEGY));
activityXml.setExceptionAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_EXCEPTION_ACTION));
activityXml.setExecuteAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_AUTO_EXEC_ACTION));
activityXml.setJoinMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_JOIN));
activityXml.setSplitMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_SPLIT));
activityXml.setActivateRuleType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_ACTIVATE_RULE_TYPE));
activityXml.setStartStrategybyAppAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_STARTSTRATEGYBYAPPACTION));
activityXml.setEvents(NodeUtil.getTriggerEvents(actEl));
activityXml.setProperties(NodeUtil.getExtProperties(actEl));
} else if(Constants.ACT_TYPE_SUBPROCESS.equalsIgnoreCase(type)) {//子流程
activityXml.setSubProcess(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_SUBPROCESS));
activityXml.setSpInvokePattern(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_SP_INVOKE_PATTERN));
activityXml.setJoinMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_JOIN));
activityXml.setSplitMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_SPLIT));
activityXml.setActivateRuleType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_ACTIVATE_RULE_TYPE));
activityXml.setStartStrategybyAppAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_STARTSTRATEGYBYAPPACTION));
activityXml.setEvents(NodeUtil.getTriggerEvents(actEl));
} else if(Constants.ACT_TYPE_MANUL.equalsIgnoreCase(type)) {//人工环节
activityXml.setParticipantType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_PARTICI_MODE));
activityXml.setIsAllowAppointParticipants(NodeUtil.getNodeBooleanValue(actEl, StarFlowNames.ACT_CHILD_PARTICI_IS_ALLOW_APPOINT));
activityXml.setParticiLogic(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_PARTICI_LOGIC));
activityXml.setParticiSpecActID(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_PARTICI_ACTID));
activityXml.setIsFreeActivity(NodeUtil.getNodeBooleanValue(actEl, StarFlowNames.ACT_FREE_ISFREEACT));
activityXml.setFreeRangeStrategy(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_FREE_RANGESTRATEGY));
activityXml.setIsOnlyLimitedManualActivity(NodeUtil.getNodeBooleanValue(actEl, StarFlowNames.ACT_FREE_ISONLYLIMITEDMANUALACT));
activityXml.setWiMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_WI_MODE));
activityXml.setIsSequentialExecute(NodeUtil.getNodeBooleanValue(actEl, StarFlowNames.ACT_CHILD_WI_IS_SEQ_EXEC));
activityXml.setWorkitemNumStrategy(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_WI_WORKITEMNUMSTRATEGY));
activityXml.setFinishRule(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_WI_FINISHRULE));
activityXml.setFinishRequiredPercent(NodeUtil.getNodeDoubleValue(actEl, StarFlowNames.ACT_CHILD_WI_FINISHREQUIREDPERCENT));
activityXml.setFinishRquiredNum(NodeUtil.getNodeIntValue(actEl, StarFlowNames.ACT_CHILD_WI_FINISHRQUIREDNUM));
activityXml.setIsAutoCancel(NodeUtil.getNodeBooleanValue(actEl, StarFlowNames.ACT_CHILD_WI_IS_AUTO_CANCEL));
activityXml.setJoinMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_JOIN));
activityXml.setSplitMode(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_SPLIT));
activityXml.setLimitTime(NodeUtil.getNodeLongValue(actEl, StarFlowNames.ACT_CHILD_LIMITTIME));
activityXml.setActivateRuleType(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_ACTIVATE_RULE_TYPE));
activityXml.setStartStrategybyAppAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_STARTSTRATEGYBYAPPACTION));
activityXml.setResetParticipant(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_RESET_PARTICIPANT));
activityXml.setAction(NodeUtil.getNodeStringValue(actEl, StarFlowNames.ACT_CHILD_ACTION));
activityXml.setOperations(NodeUtil.getOperations(actEl));
activityXml.setEvents(NodeUtil.getTriggerEvents(actEl));
activityXml.setProperties(NodeUtil.getExtProperties(actEl));
activityXml.setParticipants(NodeUtil.getActParticipants(actEl));
activityXml.setFreeActs(NodeUtil.getActFreeActs(actEl));
}
for(TransitionElement transitionXml : processXml.getTransitions()) {
if(transitionXml.getTo().equalsIgnoreCase(id))
activityXml.getBeforeTrans().add(transitionXml);
if(transitionXml.getFrom().equalsIgnoreCase(id))
activityXml.getAfterTrans().add(transitionXml);
}
activityXml.setLeft(NodeUtil.getElementLeft(actEl));
activityXml.setTop(NodeUtil.getElementTop(actEl));
aMap.put(id, activityXml);
}
return aMap;
}