public void setWorkflowProcess(WorkflowProcess process)// throws RuntimeException { this.workflowProcess = process; this.ProcessId = workflowProcess.Id; this.Name = workflowProcess.Name; this.DisplayName = workflowProcess.DisplayName; this.Description = workflowProcess.Description; Dom4JFPDLSerializer ser = new Dom4JFPDLSerializer(); //MemoryStream so = new MemoryStream(); //try //{ // ser.serialize(workflowProcess, so); // this.ProcessContent = Encoding.UTF8.GetString(so.ToArray()); //} //catch //{ // throw; //} //finally //{ // if (so != null) so.Close(); //} this.ProcessContent = ser.serialize(process); }
// throws RuntimeException /// <summary>获取业务流程对象</summary> public WorkflowProcess getWorkflowProcess() { if (workflowProcess == null) { if (ProcessContent != null && !String.IsNullOrEmpty(this.ProcessContent.Trim())) { MemoryStream msin = null; try { Dom4JFPDLParser parser = new Dom4JFPDLParser(); msin = new MemoryStream(Encoding.UTF8.GetBytes(this.ProcessContent)); this.workflowProcess = parser.parse(msin); } catch { throw; } finally { if (msin != null) msin.Close(); } } } workflowProcess.Sn = this.Id; return workflowProcess; }
public String ProcessContent { get; set; }// /// <summary>获取业务流程对象</summary> public WorkflowProcess getWorkflowProcess()// throws RuntimeException { if (workflowProcess == null) { if (ProcessContent != null && !String.IsNullOrEmpty(this.ProcessContent.Trim())) { Dom4JFPDLParser parser = new Dom4JFPDLParser(); //MemoryStream msin = null; //try //{ // // msin = new MemoryStream(Encoding.UTF8.GetBytes(this.ProcessContent)); // this.workflowProcess = parser.parse(msin); //} //catch //{ // throw; //} //finally //{ // if (msin != null) msin.Close(); //} //TODO DEBUG this.workflowProcess = parser.parse(this.ProcessContent); } } workflowProcess.Sn = this.Id; return workflowProcess; }
public static void setWorkflowProcess(IWorkflowDefinition wdf, WorkflowProcess workflowProcess) { wdf.ProcessId = workflowProcess.Id; wdf.Name = workflowProcess.Name; wdf.DisplayName = workflowProcess.DisplayName; wdf.Description = workflowProcess.Description; Dom4JFPDLSerializer ser = new Dom4JFPDLSerializer(); wdf.ProcessContent = ser.serialize(workflowProcess); }
/// <summary> /// /// </summary> /// <param name="processInstanceId">发生异常的流程实例Id</param> /// <param name="process">发生异常的流程</param> /// <param name="workflowElementId">发生异常的环节或者Task的Id</param> /// <param name="errMsg">错误信息</param> public EngineException(String processInstanceId, WorkflowProcess process, String workflowElementId, String errMsg) : base(null, null, errMsg) { this.ProcessInstanceId=processInstanceId; if (process != null) { this.ProcessId=process.Id; this.ProcessName=process.Name; this.ProcessDisplayName=process.DisplayName; IWFElement workflowElement = process.findWFElementById(workflowElementId); if (workflowElement != null) { this.WorkflowElementId=workflowElement.Id; this.WorkflowElementName=workflowElement.Name; this.WorkflowElementDisplayName=workflowElement.DisplayName; } } }
public DataField(WorkflowProcess workflowProcess, String name, DataTypeEnum dataType) : base(workflowProcess, name) { this.DataType = dataType; }
/// <summary>wangmj 初始化一个工作流网实例,将引擎的扩展属性,注入到对应的工作流元素中</summary> /// <param name="process"></param> /// <param name="kenelExtensions"></param> public NetInstance(WorkflowProcess process, Dictionary<String, List<IKernelExtension>> kenelExtensions) { this.workflowProcess = process; //开始节点 StartNode startNode = workflowProcess.StartNode; StartNodeInstance = new StartNodeInstance(startNode); List<IKernelExtension> extensionList = kenelExtensions[StartNodeInstance.ExtensionTargetName]; for (int i = 0; extensionList != null && i < extensionList.Count; i++) { IKernelExtension extension = extensionList[i]; StartNodeInstance.registExtension(extension); } //this.StartNodeInstance = StartNodeInstance; 自身赋值自身没用。 wfElementInstanceMap.Add(startNode.Id, StartNodeInstance); //活动节点activity List<Activity> activities = workflowProcess.Activities; for (int i = 0; i < activities.Count; i++) { Activity activity = (Activity)activities[i]; ActivityInstance activityInstance = new ActivityInstance(activity); extensionList = kenelExtensions[activityInstance.ExtensionTargetName]; for (int j = 0; extensionList != null && j < extensionList.Count; j++) { IKernelExtension extension = extensionList[j]; activityInstance.registExtension(extension); } wfElementInstanceMap.Add(activity.Id, activityInstance); } //同步器节点 List<Synchronizer> synchronizers = workflowProcess.Synchronizers; for (int i = 0; i < synchronizers.Count; i++) { Synchronizer synchronizer = (Synchronizer)synchronizers[i]; SynchronizerInstance synchronizerInstance = new SynchronizerInstance(synchronizer); extensionList = kenelExtensions[synchronizerInstance.ExtensionTargetName]; for (int j = 0; extensionList != null && j < extensionList.Count; j++) { IKernelExtension extension = extensionList[j]; synchronizerInstance.registExtension(extension); } wfElementInstanceMap.Add(synchronizer.Id, synchronizerInstance); } //结束节点 List<EndNode> endNodes = workflowProcess.EndNodes; // List<EndNodeInstance> endNodeInstances = netInstance.getEndNodeInstances(); for (int i = 0; i < endNodes.Count; i++) { EndNode endNode = endNodes[i]; EndNodeInstance endNodeInstance = new EndNodeInstance(endNode); // endNodeInstances.add(endNodeInstance); extensionList = kenelExtensions[endNodeInstance.ExtensionTargetName]; for (int j = 0; extensionList != null && j < extensionList.Count; j++) { IKernelExtension extension = extensionList[j]; endNodeInstance.registExtension(extension); } wfElementInstanceMap.Add(endNode.Id, endNodeInstance); } //转移线 List<Transition> transitions = workflowProcess.Transitions; for (int i = 0; i < transitions.Count; i++) { Transition transition = (Transition)transitions[i]; TransitionInstance transitionInstance = new TransitionInstance(transition); String fromNodeId = transition.FromNode.Id; if (fromNodeId != null) { INodeInstance enteringNodeInstance = (INodeInstance)wfElementInstanceMap[fromNodeId]; if (enteringNodeInstance != null) { enteringNodeInstance.AddLeavingTransitionInstance(transitionInstance); transitionInstance.EnteringNodeInstance=enteringNodeInstance; } } String toNodeId = transition.ToNode.Id; if (toNodeId != null) { INodeInstance leavingNodeInstance = (INodeInstance)wfElementInstanceMap[toNodeId]; if (leavingNodeInstance != null) { leavingNodeInstance.AddEnteringTransitionInstance(transitionInstance); transitionInstance.LeavingNodeInstance=leavingNodeInstance; } } extensionList = kenelExtensions[transitionInstance.ExtensionTargetName]; for (int j = 0; extensionList != null && j < extensionList.Count; j++) { IKernelExtension extension = extensionList[j]; transitionInstance.registExtension(extension); } wfElementInstanceMap.Add(transitionInstance.Id, transitionInstance); } //循环线 List<Loop> loops = workflowProcess.Loops; for (int i = 0; i < loops.Count; i++) { Loop loop = (Loop)loops[i]; LoopInstance loopInstance = new LoopInstance(loop); String fromNodeId = loop.FromNode.Id; if (fromNodeId != null) { INodeInstance enteringNodeInstance = (INodeInstance)wfElementInstanceMap[fromNodeId]; if (enteringNodeInstance != null) { enteringNodeInstance.AddLeavingLoopInstance(loopInstance); loopInstance.EnteringNodeInstance=enteringNodeInstance; } } String toNodeId = loop.ToNode.Id; if (toNodeId != null) { INodeInstance leavingNodeInstance = (INodeInstance)wfElementInstanceMap[toNodeId]; if (leavingNodeInstance != null) { leavingNodeInstance.AddEnteringLoopInstance(loopInstance); loopInstance.LeavingNodeInstance=leavingNodeInstance; } } extensionList = kenelExtensions[loopInstance.ExtensionTargetName]; for (int j = 0; extensionList != null && j < extensionList.Count; j++) { IKernelExtension extension = extensionList[j]; loopInstance.registExtension(extension); } wfElementInstanceMap.Add(loopInstance.Id, loopInstance); } }
// throws RuntimeException public void setWorkflowProcess(WorkflowProcess process) { this.workflowProcess = process; this.ProcessId = workflowProcess.Id; this.Name = workflowProcess.Name; this.DisplayName = workflowProcess.DisplayName; this.Description = workflowProcess.Description; Dom4JFPDLSerializer ser = new Dom4JFPDLSerializer(); MemoryStream so = new MemoryStream(); try { ser.serialize(workflowProcess, so); this.ProcessContent = Encoding.UTF8.GetString(so.ToArray()); } catch { throw; } finally { if (so != null) so.Close(); } }
public WorkflowSessionIProcessInstanceCreateProcessInstance(String creatorId, WorkflowProcess wfProcess, WorkflowDefinition workflowDef, String parentProcessInstanceId,String parentTaskInstanceId) { this.creatorId = creatorId; this.wfProcess = wfProcess; this.workflowDef = workflowDef; this.parentProcessInstanceId = parentProcessInstanceId; this.parentTaskInstanceId = parentTaskInstanceId; }