private static void MergeTransferParams(WfTransferParamsBase transferParams, WfClientRuntimeContext runtimeContext)
 {
     if (runtimeContext != null)
     {
         if (transferParams.Operator == null)
         {
             transferParams.Operator = (IUser)runtimeContext.Operator.ToOguObject();
         }
     }
 }
        private static string PrepareNextStepsSelectorsString(IEnumerable <IWfTransitionDescriptor> transitions, WfTransferParamsBase transferParams)
        {
            WfClientNextStepCollection nextSteps = new WfClientNextStepCollection();

            foreach (IWfTransitionDescriptor transition in transitions)
            {
                WfClientNextStep nextStep = new WfClientNextStep();

                nextStep.TransitionKey         = transition.Key;
                nextStep.TransitionName        = transition.Name;
                nextStep.TransitionDescription = transition.Description;

                nextStep.ActivityKey         = transition.ToActivity.Key;
                nextStep.ActivityName        = transition.ToActivity.Name;
                nextStep.ActivityDescription = transition.ToActivity.Description;

                nextSteps.Add(nextStep);
            }

            if (transferParams != null && transferParams.FromTransitionDescriptor != null)
            {
                nextSteps.SelectedKey = transferParams.FromTransitionDescriptor.Key;
            }

            XElement nextStepsRoot = new XElement("NextSteps");

            nextSteps.ToXElement(nextStepsRoot);

            return(nextStepsRoot.ToString());
        }
예제 #3
0
		internal IWfActivity InnerMoveTo(WfTransferParamsBase transferParams)
		{
			ExceptionHelper.FalseThrow<ArgumentNullException>(transferParams != null, "transferParams");

			//如果流程没有启动,且一个点都没有,则自动设为运行状态
			if (this.Status == WfProcessStatus.NotRunning && this.Activities.Count == 0)
				this.Status = WfProcessStatus.Running;
			else
				if (this.Status == WfProcessStatus.Completed) //如果流程已经结束,那么流程状态应该变为运行状态
					this.Status = WfProcessStatus.Running;

			CheckProcessRunningStatus();
			CheckActivityMoveToCondition();

			IWfActivity activity = null;

			//生成下一个新的活动点
			if (transferParams.NextActivityDescriptor is IWfAnchorActivityDescriptor)
				activity = this.Factory.CreateAnchorActivity(this, (WfBranchesTransferParams)transferParams);
			else
				activity = this.Factory.CreateActivity(this, transferParams.NextActivityDescriptor);

			activity.Operator = transferParams.Operator;

			//当前点与新的活动点连接,并设置好相关指针
			if (CurrentActivity != null)
			{
				((WfActivityBase)CurrentActivity).ConnectToNextActivity(activity);
				((WfActivityBase)CurrentActivity).Status = WfActivityStatus.Completed;
			}

			//加入点集合并设置好新的活动点
			Activities.Add(activity);

			activity.Assignees.CopyFrom(transferParams.Receivers);

			///设置的
			if (transferParams.FromTransitionDescriptor != null)
			{
				activity.Context["FromTransitionDescriptor"] = transferParams.FromTransitionDescriptor.Key;
			}

			DoComplete(activity);

			return activity;
		}
예제 #4
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="transferParams"></param>
		/// <returns></returns>
		public IWfActivity MoveTo(WfTransferParamsBase transferParams)
		{
			lock (this)
			{
				IWfActivity activity = InnerMoveTo(transferParams);

				if (this.CurrentActivity.FromTransition == null)
					WorkflowSettings.GetConfig().EnqueueWorkItemExecutor.EnqueueMoveToWorkItem(
						null, this.CurrentActivity);
				else
					WorkflowSettings.GetConfig().EnqueueWorkItemExecutor.EnqueueMoveToWorkItem(
						this.CurrentActivity.FromTransition.FromActivity, this.CurrentActivity);

				return activity;
			}
		}
        private static string PrepareNextStepsSelectorsString(IEnumerable<IWfTransitionDescriptor> transitions, WfTransferParamsBase transferParams)
        {
            WfClientNextStepCollection nextSteps = new WfClientNextStepCollection();

            foreach (IWfTransitionDescriptor transition in transitions)
            {
                WfClientNextStep nextStep = new WfClientNextStep();

                nextStep.TransitionKey = transition.Key;
                nextStep.TransitionName = transition.Name;
                nextStep.TransitionDescription = transition.Description;

                nextStep.ActivityKey = transition.ToActivity.Key;
                nextStep.ActivityName = transition.ToActivity.Name;
                nextStep.ActivityDescription = transition.ToActivity.Description;

                nextSteps.Add(nextStep);
            }

            if (transferParams != null && transferParams.FromTransitionDescriptor != null)
                nextSteps.SelectedKey = transferParams.FromTransitionDescriptor.Key;

            XElement nextStepsRoot = new XElement("NextSteps");

            nextSteps.ToXElement(nextStepsRoot);

            return nextStepsRoot.ToString();
        }
 private static void MergeTransferParams(WfTransferParamsBase transferParams, WfClientRuntimeContext runtimeContext)
 {
     if (runtimeContext != null)
     {
         if (transferParams.Operator == null)
             transferParams.Operator = (IUser)runtimeContext.Operator.ToOguObject();
     }
 }