コード例 #1
0
        public void setDefinitionFiles()// throws IOException, FPDLParserException,EngineException
        {
            if (DefinitionFiles != null && workflowDefinitionMap == null)
            {
                workflowDefinitionMap = new Dictionary <String, WorkflowDefinition>();
                Dom4JFPDLParser parser = new Dom4JFPDLParser();

                for (int i = 0; i < DefinitionFiles.Count; i++)
                {
                    Stream inStream = new FileStream(DefinitionFiles[i].Trim(), FileMode.Open);
                    if (inStream == null)
                    {
                        throw new IOException("没有找到名称为" + DefinitionFiles[i] + "的流程定义文件");
                    }
                    WorkflowProcess workflowProcess = parser.parse(inStream);

                    WorkflowDefinition workflowDef = new WorkflowDefinition();
                    workflowDef.Version = 1;

                    workflowDef.setWorkflowProcess(workflowProcess);

                    String latestVersionKey = workflowProcess.Id + "_V_" + workflowDef.Version;
                    workflowDefinitionMap.Add(latestVersionKey, workflowDef);
                    latestVersionKeyMap.Add(workflowProcess.Id, latestVersionKey);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 保存流程定义,如果同一个ProcessId的流程定义已经存在,则版本号自动加1。
        /// </summary>
        /// <param name="workflowProcessXml">保存的WorkflowProcess XML 文本.</param>
        /// <param name="version">保存的版本,当版本为小于等于0时,添加新流程,如存在相同ProcessId则版本号加1</param>
        /// <param name="isState">是否发布</param>
        public bool SaveOrUpdateWorkflowProcess(string workflowProcessXml, int version, bool isState)
        {
            Dom4JFPDLParser parser = new Dom4JFPDLParser();
            MemoryStream msin = new MemoryStream(Encoding.UTF8.GetBytes(workflowProcessXml));
            WorkflowProcess workflowProcess = parser.parse(msin);
            if (workflowProcess == null) return false;

            WorkflowDefinition wd = RuntimeContextFactory.getRuntimeContext().PersistenceService.FindWorkflowDefinitionByProcessIdAndVersionNumber(workflowProcess.Id, version);
            if (wd == null)
            {
                wd = new WorkflowDefinition();
                wd.PublishTime = DateTime.Now;
                wd.PublishUser = "******";
            }

            wd.UploadTime = DateTime.Now;
            wd.UploadUser = "******";
            wd.State = isState;

            wd.Name = workflowProcess.Name;
            wd.DisplayName = workflowProcess.DisplayName;
            wd.Description = workflowProcess.Description;
            wd.setWorkflowProcess(workflowProcess);

            if (RuntimeContextFactory.getRuntimeContext().PersistenceService.SaveOrUpdateWorkflowDefinition(wd))
            {
                return true;
            }

            return false;
        }
コード例 #3
0
        }                                         //

        /// <summary>获取业务流程对象</summary>
        public WorkflowProcess getWorkflowProcess()// throws RuntimeException
        {
            if (workflowProcess == null)
            {
                if (ProcessContent != null && !String.IsNullOrEmpty(this.ProcessContent.Trim()))
                {
                    Dom4JFPDLParser parser = new Dom4JFPDLParser();
                    //MemoryStream msin = null;

                    //try
                    //{
                    //
                    //    msin = new MemoryStream(Encoding.UTF8.GetBytes(this.ProcessContent));
                    //    this.workflowProcess = parser.parse(msin);
                    //}
                    //catch
                    //{
                    //    throw;
                    //}
                    //finally
                    //{
                    //    if (msin != null) msin.Close();
                    //}

                    //TODO DEBUG
                    this.workflowProcess = parser.parse(this.ProcessContent);
                }
            }
            workflowProcess.Sn = this.Id;
            return(workflowProcess);
        }
コード例 #4
0
        public String ProcessContent { get; set; }//

        /// <summary>获取业务流程对象</summary>
        public WorkflowProcess getWorkflowProcess()// throws RuntimeException
        {
            if (workflowProcess == null)
            {
                if (ProcessContent != null && !String.IsNullOrEmpty(this.ProcessContent.Trim()))
                {
                    Dom4JFPDLParser parser = new Dom4JFPDLParser();
                    //MemoryStream msin = null;

                    //try
                    //{
                    //    
                    //    msin = new MemoryStream(Encoding.UTF8.GetBytes(this.ProcessContent));
                    //    this.workflowProcess = parser.parse(msin);
                    //}
                    //catch
                    //{
                    //    throw;
                    //}
                    //finally
                    //{
                    //    if (msin != null) msin.Close();
                    //}

                    //TODO DEBUG
                    this.workflowProcess = parser.parse(this.ProcessContent);

                }
            }
            workflowProcess.Sn = this.Id;
            return workflowProcess;
        }
コード例 #5
0
        // throws RuntimeException
        /// <summary>获取业务流程对象</summary>
        public WorkflowProcess getWorkflowProcess()
        {
            if (workflowProcess == null)
            {
                if (ProcessContent != null && !String.IsNullOrEmpty(this.ProcessContent.Trim()))
                {
                    MemoryStream msin = null;

                    try
                    {
                        Dom4JFPDLParser parser = new Dom4JFPDLParser();
                        msin = new MemoryStream(Encoding.UTF8.GetBytes(this.ProcessContent));
                        this.workflowProcess = parser.parse(msin);
                    }
                    catch
                    {
                        throw;
                    }
                    finally
                    {
                        if (msin != null) msin.Close();
                    }

                }
            }
            workflowProcess.Sn = this.Id;
            return workflowProcess;
        }
コード例 #6
0
        }                                         //

        /// <summary>获取业务流程对象</summary>
        public WorkflowProcess getWorkflowProcess()// throws RuntimeException
        {
            if (workflowProcess == null)
            {
                if (ProcessContent != null && !String.IsNullOrEmpty(this.ProcessContent.Trim()))
                {
                    MemoryStream msin = null;

                    try
                    {
                        Dom4JFPDLParser parser = new Dom4JFPDLParser();
                        msin = new MemoryStream(Encoding.UTF8.GetBytes(this.ProcessContent));
                        this.workflowProcess = parser.parse(msin);
                    }
                    catch
                    {
                        throw;
                    }
                    finally
                    {
                        if (msin != null)
                        {
                            msin.Close();
                        }
                    }
                }
            }
            workflowProcess.Sn = this.Id;
            return(workflowProcess);
        }
コード例 #7
0
        public void setDefinitionFiles()// throws IOException, FPDLParserException,EngineException 
        {
            if (DefinitionFiles != null && workflowDefinitionMap == null)
            {
                workflowDefinitionMap = new Dictionary<String, WorkflowDefinition>();
                Dom4JFPDLParser parser = new Dom4JFPDLParser();

                for (int i = 0; i < DefinitionFiles.Count; i++)
                {
                    Stream inStream = new FileStream(DefinitionFiles[i].Trim(), FileMode.Open);
                    if (inStream == null)
                    {
                        throw new IOException("没有找到名称为" + DefinitionFiles[i] + "的流程定义文件");
                    }
                    WorkflowProcess workflowProcess = parser.parse(inStream);

                    WorkflowDefinition workflowDef = new WorkflowDefinition();
                    workflowDef.Version = 1;

                    workflowDef.setWorkflowProcess(workflowProcess);

                    String latestVersionKey = workflowProcess.Id + "_V_" + workflowDef.Version;
                    workflowDefinitionMap.Add(latestVersionKey, workflowDef);
                    latestVersionKeyMap.Add(workflowProcess.Id, latestVersionKey);
                }
            }
        }
コード例 #8
0
        /// <summary>获取业务流程对象</summary>
        public static WorkflowProcess getWorkflowProcess(IWorkflowDefinition wdf)// throws RuntimeException
        {

            if (!dic_wp.ContainsKey(wdf.Id))
            {
                if (wdf.ProcessContent != null && !String.IsNullOrEmpty(wdf.ProcessContent.Trim()))
                {
                    Dom4JFPDLParser parser = new Dom4JFPDLParser();
                    WorkflowProcess workflowProcess = parser.parse(wdf.ProcessContent);
                    if (workflowProcess != null)
                        dic_wp[wdf.Id] = workflowProcess;
                }
            }
            dic_wp[wdf.Id].Sn = wdf.Id;
            return dic_wp[wdf.Id];
        }
コード例 #9
0
 /// <summary>获取业务流程对象</summary>
 public static WorkflowProcess getWorkflowProcess(IWorkflowDefinition wdf)// throws RuntimeException
 {
     if (!dic_wp.ContainsKey(wdf.Id))
     {
         if (wdf.ProcessContent != null && !String.IsNullOrEmpty(wdf.ProcessContent.Trim()))
         {
             Dom4JFPDLParser parser          = new Dom4JFPDLParser();
             WorkflowProcess workflowProcess = parser.parse(wdf.ProcessContent);
             if (workflowProcess != null)
             {
                 dic_wp[wdf.Id] = workflowProcess;
             }
         }
     }
     dic_wp[wdf.Id].Sn = wdf.Id;
     return(dic_wp[wdf.Id]);
 }
コード例 #10
0
ファイル: MainPage.xaml.cs プロジェクト: spenleeV/fireflow
        void dsc_GetWorkflowProcessXmlCompleted(object sender, GetWorkflowProcessXmlCompletedEventArgs e)
        {
            if (String.IsNullOrEmpty(e.Result))
            {
                return;
            }
            //流程图初始化
            MemoryStream    msin = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
            Dom4JFPDLParser djp  = new Dom4JFPDLParser();

            this.WorkflowProcessCurrent = djp.parse(msin);
            loadWorkflow.LoadWorkflowProcessToFrom(this.WorkflowProcessCurrent);

            //流程跟踪
            if (queryString.ContainsKey("ProcessInstanceId"))
            {
                GetProcessInstanceTraceXml(queryString["ProcessInstanceId"]);
            }
        }
コード例 #11
0
        /// <summary>
        /// 保存流程定义,如果同一个ProcessId的流程定义已经存在,则版本号自动加1。
        /// </summary>
        /// <param name="workflowProcessXml">保存的WorkflowProcess XML 文本.</param>
        /// <param name="version">保存的版本,当版本为小于等于0时,添加新流程,如存在相同ProcessId则版本号加1</param>
        /// <param name="isState">是否发布</param>
        public bool SaveOrUpdateWorkflowProcess(string workflowProcessXml, int version, bool isState)
        {
            Dom4JFPDLParser parser          = new Dom4JFPDLParser();
            MemoryStream    msin            = new MemoryStream(Encoding.UTF8.GetBytes(workflowProcessXml));
            WorkflowProcess workflowProcess = parser.parse(msin);

            if (workflowProcess == null)
            {
                return(false);
            }

            WorkflowDefinition wd = RuntimeContextFactory.getRuntimeContext().PersistenceService.FindWorkflowDefinitionByProcessIdAndVersionNumber(workflowProcess.Id, version);

            if (wd == null)
            {
                wd             = new WorkflowDefinition();
                wd.PublishTime = DateTime.Now;
                wd.PublishUser = "******";
            }

            wd.UploadTime = DateTime.Now;
            wd.UploadUser = "******";
            wd.State      = isState;


            wd.Name        = workflowProcess.Name;
            wd.DisplayName = workflowProcess.DisplayName;
            wd.Description = workflowProcess.Description;
            wd.setWorkflowProcess(workflowProcess);

            if (RuntimeContextFactory.getRuntimeContext().PersistenceService.SaveOrUpdateWorkflowDefinition(wd))
            {
                return(true);
            }

            return(false);
        }
コード例 #12
0
ファイル: MainPage.xaml.cs プロジェクト: magoo-lau/fireflow
        void dsc_GetWorkflowProcessXmlProcessIdOrVersionCompleted(object sender, GetWorkflowProcessXmlProcessIdOrVersionCompletedEventArgs e)
        {
            if (String.IsNullOrEmpty(e.Result)) return;
            //流程图初始化
            MemoryStream msin = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
            Dom4JFPDLParser djp = new Dom4JFPDLParser();
            this.WorkflowProcessCurrent = djp.parse(msin);
            loadWorkflow.LoadWorkflowProcessToFrom(this.WorkflowProcessCurrent);

            //流程跟踪
            if (queryString.ContainsKey("ProcessInstanceId"))
            {
                GetProcessInstanceTraceXml(queryString["ProcessInstanceId"]);
            }
        }
コード例 #13
0
        public void ok_Click(object sender, AjaxEventArgs e)
        {
            WorkflowDefinition wd = new WorkflowDefinition();
            //如是修改。
            string id = this.HProcessId.Value.ToString().Trim();
            if (!string.IsNullOrEmpty(id))
            {
                wd = RuntimeContextExamples.GetRuntimeContext().PersistenceService.FindWorkflowDefinitionById(id);
            }
            else
            {
                wd.PublishTime = DateTime.Now;
                wd.PublishUser = "******";
            }
            wd.UploadTime = DateTime.Now;
            wd.UploadUser = "******";
            wd.State = Boolean.Parse(this.state.SelectedItem.Value);

            if (this.BasicField.HasFile)
            {
                //string filename = this.Server.MapPath("~/WorkFlowTemp/" + BasicField.PostedFile.FileName);
                //BasicField.PostedFile.SaveAs(filename);

                WorkflowProcess workflowProcess;
                using (Stream inStream = BasicField.PostedFile.InputStream)//new FileStream(filename, FileMode.Open))
                {
                    if (inStream == null)
                    {
                        throw new IOException("没有上传流程定义文件!");
                    }
                    Dom4JFPDLParser parser = new Dom4JFPDLParser();
                    workflowProcess = parser.parse(inStream);
                }
                if (workflowProcess != null)
                {
                    if (string.IsNullOrEmpty(id)) wd.ProcessId = workflowProcess.Id;
                    wd.Name = workflowProcess.Name;
                    wd.DisplayName = workflowProcess.DisplayName;
                    wd.Description = workflowProcess.Description;
                    wd.setWorkflowProcess(workflowProcess);
                    //wd.ProcessContent = File.ReadAllText(filename);// twd.ProcessContent;
                }
                else
                {
                    Ext.Msg.Show(new MessageBox.Config
                    {
                        Buttons = MessageBox.Button.OK,
                        Icon = MessageBox.Icon.INFO,
                        Title = "Success",
                        Message = "错误的流程文件。"
                    });
                    return;
                }
            }

            if (RuntimeContextExamples.GetRuntimeContext().PersistenceService.SaveOrUpdateWorkflowDefinition(wd))
            {
                WorkflowEdit.Hide();

                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.INFO,
                    Title = "Success",
                    Message = "保存成功。"
                });

                query_Click(null, null);
            }
            else
            {
                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.INFO,
                    Title = "Success",
                    Message = "保存出错。"
                });
            }
        }
コード例 #14
0
ファイル: MainPage.xaml.cs プロジェクト: magoo-lau/fireflow
        private void btnLocalOpen_Checked(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog myOpenDialog = new OpenFileDialog();
                myOpenDialog.Filter = "流程文件*.xml | *.xml";
                //myOpenDialog.DefaultExt = "xml";

                bool? ret = myOpenDialog.ShowDialog();
                if (ret == true)
                {
                    using (StreamReader fs = (StreamReader)myOpenDialog.File.OpenText())
                    {
                        string xmlWorkflow = fs.ReadToEnd();
                        fs.Close();

                        MemoryStream msin = new MemoryStream(Encoding.UTF8.GetBytes(xmlWorkflow));
                        Dom4JFPDLParser djp = new Dom4JFPDLParser();

                        SelectWorkflowDefinition = null;
                        this.WorkflowProcessCurrent = djp.parse(msin);

                        btnLocalSave.IsEnabled = true;
                        btnSave.IsEnabled = true; //临时屏蔽
                        listBox.IsEnabled = true;

                        canvas.Width = EventViewer.ActualWidth - 28;
                        canvas.Height = EventViewer.ActualHeight - 10;

                        canvas.Children.Clear();
                        UserControls.Clear();
                        selectionControls.Clear();

                        loadWorkflow.LoadWorkflowProcessToFrom(this.WorkflowProcessCurrent);
                    }
                }

            }
            catch
            {
                throw;
            }
        }
コード例 #15
0
        public void ok_Click(object sender, AjaxEventArgs e)
        {
            WorkflowDefinition wd = new WorkflowDefinition();
            //如是修改。
            string id = this.HProcessId.Value.ToString().Trim();

            if (!string.IsNullOrEmpty(id))
            {
                wd = RuntimeContextExamples.GetRuntimeContext().PersistenceService.FindWorkflowDefinitionById(id);
            }
            else
            {
                wd.PublishTime = DateTime.Now;
                wd.PublishUser = "******";
            }
            wd.UploadTime = DateTime.Now;
            wd.UploadUser = "******";
            wd.State      = Boolean.Parse(this.state.SelectedItem.Value);

            if (this.BasicField.HasFile)
            {
                string filename = this.Server.MapPath("~/WorkFlowTemp/" + BasicField.PostedFile.FileName);
                BasicField.PostedFile.SaveAs(filename);

                WorkflowProcess workflowProcess;
                using (Stream inStream = new FileStream(filename, FileMode.Open))
                {
                    if (inStream == null)
                    {
                        throw new IOException("没有找到名称为" + filename + "的流程定义文件");
                    }
                    Dom4JFPDLParser parser = new Dom4JFPDLParser();
                    workflowProcess = parser.parse(inStream);
                }
                if (workflowProcess != null)
                {
                    if (string.IsNullOrEmpty(id))
                    {
                        wd.ProcessId = workflowProcess.Id;
                    }
                    wd.Name           = workflowProcess.Name;
                    wd.DisplayName    = workflowProcess.DisplayName;
                    wd.Description    = workflowProcess.Description;
                    wd.ProcessContent = File.ReadAllText(filename);// twd.ProcessContent;
                }
                else
                {
                    Ext.Msg.Show(new MessageBox.Config
                    {
                        Buttons = MessageBox.Button.OK,
                        Icon    = MessageBox.Icon.INFO,
                        Title   = "Success",
                        Message = "错误的流程文件。"
                    });
                    return;
                }
            }

            if (RuntimeContextExamples.GetRuntimeContext().PersistenceService.SaveOrUpdateWorkflowDefinition(wd))
            {
                WorkflowEdit.Hide();

                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Title   = "Success",
                    Message = "保存成功。"
                });

                query_Click(null, null);
            }
            else
            {
                Ext.Msg.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon    = MessageBox.Icon.INFO,
                    Title   = "Success",
                    Message = "保存出错。"
                });
            }
        }