public FormTask(IWFElement parent, String name) : base(parent, name) { this.TaskType = TaskTypeEnum.FORM; this.AssignmentStrategy = FormTaskEnum.ANY; this.DefaultView = DefaultViewEnum.VIEWFORM; }
/// <summary>通过Id查找任意元素的序列号</summary> /// <param name="id">流程元素的id</param> /// <returns>流程元素的序列号</returns> public String findSnById(String id) { IWFElement elem = this.findWFElementById(id); if (elem != null) { return(elem.Sn); } return(null); }
public KernelException(IProcessInstance processInstance, IWFElement workflowElement, String errMsg) : base(errMsg) { if (processInstance != null) { this.ProcessInstanceId = processInstance.Id; this.ProcessId = processInstance.ProcessId; this.ProcessName = processInstance.Name; this.ProcessDisplayName = processInstance.DisplayName; } if (workflowElement != null) { this.WorkflowElementId = workflowElement.Id; this.WorkflowElementName = workflowElement.Name; this.WorkflowElementDisplayName = workflowElement.DisplayName; } // TODO Auto-generated constructor stub }
protected void loadTasks(IWFElement parent, List <Task> tasks, XElement xElement) { if (xElement == null) { return; } tasks.Clear(); var partNos = GetXElements(xElement, TASK); foreach (XElement node in partNos) { Task task = createTask(parent, node); if (task != null) { tasks.Add(task); } } }
/// <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; } } }
protected void loadTaskRefs(WorkflowProcess workflowProcess, IWFElement parent, List <TaskRef> taskRefs, XElement xElement) { if (xElement == null) { return; } taskRefs.Clear(); var partNos = GetXElements(xElement, TASKREF); foreach (XElement node in partNos) { String taskId = GetAttributeValue(node, REFERENCE); Task task = (Task)workflowProcess.findWFElementById(taskId); if (task != null) { TaskRef taskRef = new TaskRef(parent, task); taskRef.Sn = Guid.NewGuid().ToString(); taskRefs.Add(taskRef); } } }
/// <summary>节点实例监听器</summary> public void onEdgeInstanceEventFired(EdgeInstanceEvent e) { if (e.EventType == EdgeInstanceEventEnum.ON_TAKING_THE_TOKEN) { IToken token = e.Token; ITransitionInstance transInst = (ITransitionInstance)e.getSource(); String condition = transInst.Transition.Condition; calculateTheAliveValue(token, condition); if (this.RuntimeContext.IsEnableTrace && token.IsAlive) { Transition transition = transInst.Transition; IWFElement fromNode = transition.FromNode; int minorNumber = 1; if (fromNode is Activity) { minorNumber = 2; } else { minorNumber = 1; } ProcessInstanceTrace trace = new ProcessInstanceTrace(); trace.ProcessInstanceId = e.Token.ProcessInstanceId; trace.StepNumber = e.Token.StepNumber; trace.Type = ProcessInstanceTraceEnum.TRANSITION_TYPE; trace.FromNodeId = transInst.Transition.FromNode.Id; trace.ToNodeId = transInst.Transition.ToNode.Id; trace.EdgeId = transInst.Transition.Id; trace.MinorNumber = minorNumber; //TODO wmj2003 这里应该是insert。一旦token从当前边上经过,那么就保存流程运行轨迹. RuntimeContext.PersistenceService.SaveOrUpdateProcessInstanceTrace(trace); } } }
public SubflowTask(IWFElement parent, String name) : base(parent, name) { this.TaskType = TaskTypeEnum.SUBFLOW; }
protected Task createTask(IWFElement parent, XElement xElement) { Task task = null; TaskTypeEnum type = (TaskTypeEnum)Enum.Parse(typeof(TaskTypeEnum), GetAttributeValue(xElement, TYPE), true); switch (type) { case TaskTypeEnum.FORM: task = new FormTask(parent, GetAttributeValue(xElement, NAME)); ((FormTask)task).AssignmentStrategy = (FormTaskEnum)Enum.Parse(typeof(FormTaskEnum), GetAttributeValue(xElement, COMPLETION_STRATEGY), true); ((FormTask)task).DefaultView = (DefaultViewEnum)Enum.Parse(typeof(DefaultViewEnum), GetAttributeValue(xElement, DEFAULT_VIEW), true); break; case TaskTypeEnum.TOOL: task = new ToolTask(parent, GetAttributeValue(xElement, NAME)); break; case TaskTypeEnum.SUBFLOW: task = new SubflowTask(parent, GetAttributeValue(xElement, NAME)); break; default: return(null); } task.Sn = Guid.NewGuid().ToString(); task.DisplayName = GetAttributeValue(xElement, DISPLAY_NAME); task.TaskInstanceCreator = GetAttributeValue(xElement, TASK_INSTANCE_CREATOR); task.TaskInstanceRunner = GetAttributeValue(xElement, TASK_INSTANCE_RUNNER); task.TaskInstanceCompletionEvaluator = GetAttributeValue(xElement, TASK_INSTANCE_COMPLETION_EVALUATOR); task.LoopStrategy = GetEnum <LoopStrategyEnum>(GetAttributeValue(xElement, LOOP_STRATEGY)); int priority = 0; try { priority = Int32.Parse(GetAttributeValue(xElement, PRIORITY)); } catch { } task.Priority = priority; if (task is FormTask) { ((FormTask)task).Performer = createPerformer(xElement.Element("{" + FPDL_URI + "}" + PERFORMER)); ((FormTask)task).EditForm = createForm(xElement.Element("{" + FPDL_URI + "}" + EDIT_FORM)); ((FormTask)task).ViewForm = createForm(xElement.Element("{" + FPDL_URI + "}" + VIEW_FORM)); ((FormTask)task).ListForm = createForm(xElement.Element("{" + FPDL_URI + "}" + LIST_FORM)); } if (task is ToolTask) { ((ToolTask)task).Application = createApplication(xElement.Element("{" + FPDL_URI + "}" + APPLICATION)); } if (task is SubflowTask) { ((SubflowTask)task).SubWorkflowProcess = createSubWorkflowProcess(xElement.Element("{" + FPDL_URI + "}" + SUB_WORKFLOW_PROCESS)); } task.Description = GetElementValue(xElement, "{" + FPDL_URI + "}" + DESCRIPTION); task.Duration = createDuration(xElement.Element("{" + FPDL_URI + "}" + DURATION)); loadExtendedAttributes(task.ExtendedAttributes, xElement.Element("{" + FPDL_URI + "}" + EXTENDED_ATTRIBUTES)); loadEventListeners(task.EventListeners, xElement.Element("{" + FPDL_URI + "}" + EVENT_LISTENERS)); return(task); }
/// <summary></summary> /// <param name="parentElement">父流程元素</param> /// <param name="name">本流程元素的名称</param> public AbstractWFElement(IWFElement parentElement, String name) : this() { this.ParentElement = parentElement; this.Name = name; }
public Task(IWFElement parent, String name) : base(parent, name) { this.TaskType = TaskTypeEnum.FORM; this.Priority = 1; this.LoopStrategy = LoopStrategyEnum.REDO; }
/// <summary> /// /// </summary> /// <param name="processInstance">processInstance 发生异常的流程实例</param> /// <param name="workflowElement">workflowElement 发生异常的流程环节或者Task</param> /// <param name="errMsg">错误信息</param> public EngineException(IProcessInstance processInstance, IWFElement workflowElement, String errMsg) : base(processInstance, workflowElement, errMsg) { }
public TaskRef(IWFElement parent, Task task) : base(parent, task.Name) { referencedTask = task; }
public ToolTask(IWFElement parent, String name) : base(parent, name) { this.TaskType = TaskTypeEnum.TOOL; }