*/
@SuppressWarnings("static-access")
protected WorkflowProcess parse(Document document) throws FPDLParserException {
Element workflowProcessElement = document.getRootElement();
//流程ID
WorkflowProcess wp = new WorkflowProcess(workflowProcessElement.attributeValue(NAME));
wp.setSn(UUID.randomUUID().toString());//使用UUID作为流程实例ID
//流程整体描述
wp.setDescription(Util4Parser.elementAsString(workflowProcessElement,
DESCRIPTION));
//流程Task creator
wp.setTaskInstanceCreator(workflowProcessElement.attributeValue(TASK_INSTANCE_CREATOR));
wp.setFormTaskInstanceRunner(workflowProcessElement.attributeValue(FORM_TASK_INSTANCE_RUNNER));
wp.setToolTaskInstanceRunner(workflowProcessElement.attributeValue(TOOL_TASK_INSTANCE_RUNNER));
wp.setSubflowTaskInstanceRunner(workflowProcessElement.attributeValue(SUBFLOW_TASK_INSTANCE_RUNNER));
wp.setFormTaskInstanceCompletionEvaluator(workflowProcessElement.attributeValue(FORM_TASK_INSTANCE_COMPLETION_EVALUATOR));
wp.setToolTaskInstanceCompletionEvaluator(workflowProcessElement.attributeValue(TOOL_TASK_INSTANCE_COMPLETION_EVALUATOR));
wp.setSubflowTaskInstanceCompletionEvaluator(workflowProcessElement.attributeValue(SUBFLOW_TASK_INSTANCE_COMPLETION_EVALUATOR));
//流程显示名称
wp.setDisplayName(workflowProcessElement.attributeValue(DISPLAY_NAME));
//下面两个属性,暂时还未使用
wp.setResourceFile(workflowProcessElement.attributeValue(RESOURCE_FILE));
wp.setResourceManager(workflowProcessElement.attributeValue(RESOURCE_MANAGER));
//解析datafields
this.loadDataFields(wp, wp.getDataFields(), Util4Parser.child(
workflowProcessElement, this.DATA_FIELDS));
//开始节点
loadStartNode(wp, Util4Parser.child(workflowProcessElement, START_NODE));
//整体流程对应的task ,这个属性好像暂时未启用
loadTasks(wp, wp.getTasks(),Util4Parser.child(
workflowProcessElement, TASKS) );
//所有业务节点,同时将这个节点的所有的属性都解析出来保存到节点信息中。
loadActivities(wp, wp.getActivities(), Util4Parser.child(
workflowProcessElement, ACTIVITIES));
//工作流同步器节点
loadSynchronizers(wp, wp.getSynchronizers(), Util4Parser.child(
workflowProcessElement, SYNCHRONIZERS));
//结束节点
loadEndNodes(wp, wp.getEndNodes(), Util4Parser.child(
workflowProcessElement, END_NODES));
//转移线
loadTransitions(wp, Util4Parser.child(workflowProcessElement,
TRANSITIONS));
//循环线
loadLoops(wp,Util4Parser.child(workflowProcessElement, LOOPS));
//所有的监听器
loadEventListeners(wp.getEventListeners(), Util4Parser.child(workflowProcessElement, EVENT_LISTENERS));
//加载扩展属性
Map<String, String> extAttrs = wp.getExtendedAttributes();
loadExtendedAttributes(extAttrs, Util4Parser.child(
workflowProcessElement, EXTENDED_ATTRIBUTES));
return wp;