public void DoNextBranchProcess(WfBranchProcessInfo nextBranchProcessInfo) { lock (this) { CreateBranchProcess(nextBranchProcessInfo.ProcessDescriptor); MoveToOneBranchProcessFirstActivity(nextBranchProcessInfo); } }
private void MoveToOneBranchProcessFirstActivity(WfBranchProcessInfo processInfo) { WfTransferParams initialTransferParams = new WfTransferParams(processInfo.ProcessDescriptor.InitialActivity); ((WfActivityDescriptor)processInfo.ProcessDescriptor.InitialActivity).LevelName = processInfo.OwnerOperation.AnchorActivity.Descriptor.LevelName; initialTransferParams.Receivers.CopyFrom(processInfo.BranchProcessReceiver); WfProcess process = ((WfProcess)processInfo.Process); process.MoveTo(initialTransferParams); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected WfProcess(SerializationInfo info, StreamingContext context) { this._ID = info.GetString("ID"); this._ResourceID = info.GetString("ResourceID"); this._Activities = (WfActivityCollection)info.GetValue("Activities", typeof(WfActivityCollection)); this._Context = (WfProcessContext)info.GetValue("Context", typeof(WfProcessContext)); this._Status = (WfProcessStatus)info.GetValue("Status", typeof(WfProcessStatus)); this._StartTime = info.GetDateTime("StartTime"); this._EndTime = info.GetDateTime("EndTime"); this._Creator = (IUser)info.GetValue("Creator", typeof(IUser)); this._OwnerDepartment = (IOrganization)info.GetValue("OwnerDepartment", typeof(IOrganization)); this._EntryInfo = (WfBranchProcessInfo)info.GetValue("EntryInfo", typeof(WfBranchProcessInfo)); this._LoadingType = (DataLoadingType)info.GetValue("LoadingType", typeof(DataLoadingType)); WfProcessContextCache.Instance[this._ID] = this; }
private void FinalInitBranches() { if (OperationalType == BranchesOperationalType.Serial) { //判断没有正在流转的子流程 if (HasRunningBranchProcess() == false) { //得到 notrunning List <WfBranchProcessInfo> notRunningBranchCollection = GetNotRunningBranchProcesses(); if (notRunningBranchCollection.Count > 0) { WfBranchProcessInfo leastBranchInfo = GetLeastBranchInfo(notRunningBranchCollection); MoveToOneBranchProcessFirstActivity(leastBranchInfo); } } } }
private WfBranchProcessInfo InitializeBranchProcess(IUser user, int i, WfBranchStartupParams branchParam) { WfBranchProcessInfo processInfo = new WfBranchProcessInfo(CreateBranchProcess(branchParam.Descriptor)); processInfo.OwnerOperation = this; processInfo.ProcessDescriptor = branchParam.Descriptor; processInfo.IsSpecificProcess = branchParam.IsSpecificProcess; processInfo.Sequence = i; processInfo.BranchProcessReceiver.CopyFrom(branchParam.BranchReceiverResource); processInfo.BranchInfoState = State.Added; //注意:~~~~~~ processInfo.Process.ResourceID = this.AnchorActivity.Process.ResourceID; processInfo.Process.OwnerDepartment = branchParam.Department; ((WfProcess)processInfo.Process).EntryInfo = processInfo; ((WfProcess)processInfo.Process).Creator = user; this.Branches.Add(processInfo); return(processInfo); }
private void DoComplete(IWfActivity activity) { //下一个点为结束点,进行特殊处理 if (activity.Descriptor is IWfCompletedActivityDescriptor) { ((WfActivityBase)activity).Status = WfActivityStatus.Completed; this.Status = WfProcessStatus.Completed; if (this.EntryInfo != null) { IWfOperation ownerOperation = this.EntryInfo.OwnerOperation; WfBranchProcessInfo currentProcessInfo = ownerOperation.Branches[this.ID]; if (ownerOperation.OperationalType == BranchesOperationalType.Serial) { if (currentProcessInfo.Sequence + 1 < ownerOperation.Branches.Count) { WfBranchProcessInfo nextProcessInfo = ownerOperation.Branches[currentProcessInfo.Sequence + 1]; ((WfOperation)ownerOperation).DoNextBranchProcess(nextProcessInfo); } } } } }