예제 #1
0
        public IWfProcessDescriptor LoadDescriptor(string processKey)
        {
            processKey.CheckStringIsNullOrEmpty("processKey");
            XElement xml = LoadXml(processKey);

            return(WfProcessDescriptorManager.DeserializeXElementToProcessDescriptor(xml));
        }
예제 #2
0
        public void SaveDescriptor(IWfProcessDescriptor processDesp)
        {
            processDesp.NullCheck("processDesp");

            XElementFormatter formatter = WfProcessDescriptorManager.CreateFormatter();

            XElement xml = formatter.Serialize(processDesp);

            SaveXml(processDesp, xml);

            SendCacheNotifyByProcessKey(processDesp.Key);
        }
        public IWfProcessDescriptor GetBranchProcessDescriptor()
        {
            IWfProcessDescriptor result = this.PredefinedProcessDescriptor;

            if (result == null)
            {
                if (this.BranchProcessKey.IsNotEmpty())
                {
                    result = WfProcessDescriptorManager.GetDescriptor(this.BranchProcessKey);
                }
                else
                {
                    this.Key.CheckStringIsNullOrEmpty <WfRuntimeException>("加载分支子流程时,Template的BranchProcessKey不能和Key不能为空");
                    result = WfProcessDescriptorManager.GetDescriptor(this.Key);
                }

                if (this.ExecuteSequence == WfBranchProcessExecuteSequence.SerialInSameProcess)
                {
                    //Activity Matrix
                    WfProcessBuilderInfo builderInfo = WfProcessDescriptorManager.GetBuilderInfo(this.BranchProcessKey);

                    PropertyDefineCollection definedProperties = null;

                    if (builderInfo == null)
                    {
                        definedProperties = new PropertyDefineCollection();
                    }
                    else
                    {
                        definedProperties = builderInfo.Builder.GetDefinedProperties();
                    }

                    //生成活动
                    result.CreateActivities(this.Resources.ToCreateActivityParams(definedProperties), true);
                }

                AutoAdjustAgreeTransitions(result);

                //todo:ydz 2012-07-21
                this.SetBranchProcessActivityEditMode(result);
                //todo:ydz 2012-07-21
                this.CancelSubProcessNotifier.ForEach(wfr =>
                {
                    result.CancelEventReceivers.Add(wfr);
                });
            }

            return(result);
        }
예제 #4
0
        public WfSaveTemplateExecutor(IWfProcessDescriptor processDesp)
            : base(WfDesignerOperationType.CreateTemplate)
        {
            processDesp.NullCheck("processDesp");

            if (WfProcessDescriptorManager.ExsitsProcessKey(processDesp.Key))
            {
                this.OperationType = WfDesignerOperationType.ModifyTemplate;
            }
            else
            {
                this.OperationType = WfDesignerOperationType.CreateTemplate;
            }

            this.ProcessDescriptor = processDesp;
        }
예제 #5
0
 public WfProcessStartupParams(WfServiceStartupProcessParams serviceOP_Paramas, string ProcessDespKey)
 {
     this.ProcessDescriptor     = WfProcessDescriptorManager.GetDescriptor(ProcessDespKey);
     this.ProcessDescriptor.Url = serviceOP_Paramas.DefaultURL;
     this.Assignees.Add(serviceOP_Paramas.Assignees);
     this.AutoStartInitialActivity = serviceOP_Paramas.AutoStartInitialActivity;
     this.Creator          = serviceOP_Paramas.Creator;
     this.DefaultTaskTitle = serviceOP_Paramas.DefaultTaskTitle;
     this.Department       = serviceOP_Paramas.Department;
     this.ResourceID       = serviceOP_Paramas.ResourceID;
     this.RelativeID       = serviceOP_Paramas.RelativeID;
     this.RelativeURL      = serviceOP_Paramas.RelativeURL;
     this.OwnerActivityID  = serviceOP_Paramas.OwnerActivityID;
     this.OwnerTemplateKey = serviceOP_Paramas.OwnerTemplateKey;
     this.CheckStartProcessUserPermission = false;
     this.RuntimeProcessName = serviceOP_Paramas.RuntimeProcessName;
     this.AutoCommit         = serviceOP_Paramas.AutoCommit;
     this.DefaultUrl         = serviceOP_Paramas.DefaultUrl;
 }
예제 #6
0
        public IWfProcessDescriptor GetDescriptor(string processKey)
        {
            processKey.CheckStringIsNullOrEmpty("processKey");

            string cacheKey = NormalizeCacheKey(processKey);

            XElement processXml = WfProcessDescriptorXmlCache.Instance.GetOrAddNewValue(cacheKey, (cache, key) =>
            {
                XElement xml = LoadXml(processKey);

                MixedDependency dependency = new MixedDependency(new UdpNotifierCacheDependency(), new MemoryMappedFileNotifierCacheDependency());

                cache.Add(key, xml, dependency);

                return(xml);
            });

            return(WfProcessDescriptorManager.DeserializeXElementToProcessDescriptor(processXml));
        }
예제 #7
0
 protected override void OnExecute(WfDesignerExecutorDataContext dataContext)
 {
     WfProcessDescriptorManager.SaveDescriptor(this.ProcessDescriptor);
 }
예제 #8
0
 /// <summary>
 /// 启动流程仿真
 /// </summary>
 /// <param name="processDescKey"></param>
 /// <param name="simulationContext"></param>
 public static WfSimulationResult StartSimulation(string processDescKey, WfSimulationParameters simulationParameters)
 {
     return(StartSimulation(WfProcessDescriptorManager.GetDescriptor(processDescKey), simulationParameters));
 }
예제 #9
0
 protected override void OnExecute(WfDesignerExecutorDataContext dataContext)
 {
     WfProcessDescriptorManager.ClearAll();
 }