protected WfAddAndEditActivityExecutorBase(IWfActivity operatorActivity, IWfActivity targetActivity, WfActivityDescriptorCreateParams createParams, WfControlOperationType operationType)
            : base(operatorActivity, targetActivity, operationType)
        {
            createParams.NullCheck("createParams");

            this.CreateParams = createParams;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newActDesp"></param>
        /// <param name="createParams"></param>
        private static void AdjustActivityDescriptorProperties(WfActivityDescriptor newActDesp, WfActivityDescriptorCreateParams createParams)
        {
            newActDesp.Name = createParams.Name;

            if (createParams.Variables != null)
            {
                foreach (WfVariableDescriptor variable in createParams.Variables)
                {
                    if (newActDesp.Properties.ContainsKey(variable.Key) == false)
                    {
                        PropertyDefine pd = new PropertyDefine();

                        pd.Name = variable.Key;
                        pd.DataType = PropertyDataType.Boolean;
                        pd.DefaultValue = variable.OriginalValue;

                        newActDesp.Properties.Add(new PropertyValue(pd));
                    }

                    newActDesp.Properties.SetValue(variable.Key, variable.ActualValue);
                }
            }

            if (createParams.Users != null)
            {
                newActDesp.Resources.Clear();
                createParams.Users.ForEach(u => newActDesp.Resources.Add(new WfUserResourceDescriptor(u)));
            }

            if (createParams.CirculateUsers != null)
            {
                newActDesp.EnterEventReceivers.Clear();
                createParams.CirculateUsers.ForEach(u => newActDesp.EnterEventReceivers.Add(new WfUserResourceDescriptor(u)));
            }

            newActDesp.BranchProcessTemplates.Clear();

            if (createParams.AllAgreeWhenConsign && newActDesp.Resources.Count > 1)
            {
                newActDesp.Properties.SetValue("AutoMoveAfterPending", true);

				if (newActDesp.BranchProcessTemplates.ContainsKey(WfTemplateBuilder.AutoStartSubProcessTemplateKey))
					newActDesp.BranchProcessTemplates.Remove(t => t.Key == WfTemplateBuilder.AutoStartSubProcessTemplateKey);

				WfBranchProcessTemplateDescriptor template = new WfBranchProcessTemplateDescriptor(WfTemplateBuilder.AutoStartSubProcessTemplateKey);

                template.BranchProcessKey = WfProcessDescriptorManager.DefaultConsignProcessKey;
                template.ExecuteSequence = WfBranchProcessExecuteSequence.Parallel;
                template.BlockingType = WfBranchProcessBlockingType.WaitAllBranchProcessesComplete;

                template.Resources.CopyFrom(newActDesp.Resources);

                newActDesp.BranchProcessTemplates.Add(template);
            }
        }
Ejemplo n.º 3
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfActivityDescriptorCreateParams result = new WfActivityDescriptorCreateParams();

            result.AllAgreeWhenConsign = DictionaryHelper.GetValue(dictionary, "allAgreeWhenConsign", false);
            result.Operation           = DictionaryHelper.GetValue(dictionary, "operation", string.Empty);
            result.CurrentActivityKey  = DictionaryHelper.GetValue(dictionary, "currentActivityKey", string.Empty);
            result.Name = DictionaryHelper.GetValue(dictionary, "name", string.Empty);
            if (dictionary.ContainsKey("users"))
            {
                result.Users = DeserializeUsers((IList)dictionary["users"]);
            }
            if (dictionary.ContainsKey("circulateUsers"))
            {
                result.CirculateUsers = DeserializeUsers((IList)dictionary["circulateUsers"]);
            }
            if (dictionary.ContainsKey("variables"))
            {
                result.Variables =
                    JSONSerializerExecute.Deserialize <WfVariableDescriptor[]>(dictionary["variables"]);
            }

            return(result);
        }
		public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
		{
			WfActivityDescriptorCreateParams result = new WfActivityDescriptorCreateParams();

			result.AllAgreeWhenConsign = DictionaryHelper.GetValue(dictionary, "allAgreeWhenConsign", false);
			result.Operation = DictionaryHelper.GetValue(dictionary, "operation", string.Empty);
			result.CurrentActivityKey = DictionaryHelper.GetValue(dictionary, "currentActivityKey", string.Empty);
			result.Name = DictionaryHelper.GetValue(dictionary, "name", string.Empty);
			if (dictionary.ContainsKey("users"))
			{
				result.Users = DeserializeUsers((IList)dictionary["users"]);
			}
			if (dictionary.ContainsKey("circulateUsers"))
			{
				result.CirculateUsers = DeserializeUsers((IList)dictionary["circulateUsers"]);
			}
			if (dictionary.ContainsKey("variables"))
			{
				result.Variables =
					JSONSerializerExecute.Deserialize<WfVariableDescriptor[]>(dictionary["variables"]);
			}

			return result;
		}
Ejemplo n.º 5
0
		private IWfActivity FindCurrentActivity(WfActivityDescriptorCreateParams createParams)
		{
			return CurrentActivity.Process.OpinionRootProcess.Activities.FindActivityByDescriptorKey(createParams.CurrentActivityKey);
		}
        /// <summary>
        ///
        /// </summary>
        /// <param name="newActDesp"></param>
        /// <param name="createParams"></param>
        private static void AdjustActivityDescriptorProperties(WfActivityDescriptor newActDesp, WfActivityDescriptorCreateParams createParams)
        {
            newActDesp.Name = createParams.Name;

            if (createParams.Variables != null)
            {
                foreach (WfVariableDescriptor variable in createParams.Variables)
                {
                    if (newActDesp.Properties.ContainsKey(variable.Key) == false)
                    {
                        PropertyDefine pd = new PropertyDefine();

                        pd.Name         = variable.Key;
                        pd.DataType     = PropertyDataType.Boolean;
                        pd.DefaultValue = variable.OriginalValue;

                        newActDesp.Properties.Add(new PropertyValue(pd));
                    }

                    newActDesp.Properties.SetValue(variable.Key, variable.ActualValue);
                }
            }

            if (createParams.Users != null)
            {
                newActDesp.Resources.Clear();
                createParams.Users.ForEach(u => newActDesp.Resources.Add(new WfUserResourceDescriptor(u)));
            }

            if (createParams.CirculateUsers != null)
            {
                newActDesp.EnterEventReceivers.Clear();
                createParams.CirculateUsers.ForEach(u => newActDesp.EnterEventReceivers.Add(new WfUserResourceDescriptor(u)));
            }

            newActDesp.BranchProcessTemplates.Clear();

            if (createParams.AllAgreeWhenConsign && newActDesp.Resources.Count > 1)
            {
                newActDesp.Properties.SetValue("AutoMoveAfterPending", true);

                if (newActDesp.BranchProcessTemplates.ContainsKey(WfTemplateBuilder.AutoStartSubProcessTemplateKey))
                {
                    newActDesp.BranchProcessTemplates.Remove(t => t.Key == WfTemplateBuilder.AutoStartSubProcessTemplateKey);
                }

                WfBranchProcessTemplateDescriptor template = new WfBranchProcessTemplateDescriptor(WfTemplateBuilder.AutoStartSubProcessTemplateKey);

                template.BranchProcessKey = WfProcessDescriptorManager.DefaultConsignProcessKey;
                template.ExecuteSequence  = WfBranchProcessExecuteSequence.Parallel;
                template.BlockingType     = WfBranchProcessBlockingType.WaitAllBranchProcessesComplete;

                template.Resources.CopyFrom(newActDesp.Resources);

                newActDesp.BranchProcessTemplates.Add(template);
            }
        }
        protected WfAddAndEditActivityExecutorBase(IWfActivity operatorActivity, IWfActivity targetActivity, WfActivityDescriptorCreateParams createParams, WfControlOperationType operationType)
            : base(operatorActivity, targetActivity, operationType)
        {
            createParams.NullCheck("createParams");

            this.CreateParams = createParams;
        }
		public WfEditActivityExecutor(IWfActivity operatorActivity, IWfActivity targetActivity, WfActivityDescriptorCreateParams createParams)
			: base(operatorActivity, targetActivity, createParams, WfControlOperationType.EditActivity)
		{
		}
 public WfAddActivityExecutor(IWfActivity operatorActivity, IWfActivity targetActivity, WfActivityDescriptorCreateParams createParams)
     : base(operatorActivity, targetActivity, createParams, WfControlOperationType.AddActivity)
 {
 }