public void TestWorkflowWithRetry() { string GCML_FILE_PATH = @"C:\Documents and Settings\jeanr\Desktop\RRComSSysTeam5\RRComSSys\RRComSSys.WorkflowEngine.Tests\TestResources\WorkflowWithRetry.gcml"; Workflow doc = SchemaTransformer.GetObjectModel(GCML_FILE_PATH); WFRunner runner = new WorkflowFactory().CreateWorkflowRuntime(doc); runner.ExecuteWorkflow(); }
public void PrinterMapping_EmptyMappingWithAutoSave_CreatesAutoSaveWorkflow() { _settings.ConversionProfiles[0].AutoSave.Enabled = true; var workflow = WorkflowFactory.CreateWorkflow(_testHelper.JobInfo, _settings); Assert.True(workflow is AutoSaveWorkflow, "AutoSaveWorkflow was expected"); }
public static void ExecuteLoop( RequestMock request, TimeSpan timeout, IErrorHandler <SubRequestMock, RequestStepMock> defaultErrorHandler = null, IInterceptor <SubRequestMock, RequestStepMock> defaultInterceptor = null, IErrorHandler <SubRequestMock, RequestStepMock> customErrorHandler = null, IInterceptor <SubRequestMock, RequestStepMock> customInterceptor = null) { var wf = new RequestWorkflowMock(); var requestPipe = WorkflowFactory.Create <RequestMock, RequestStepMock>(request, new TimeSpan(0, 0, 3), TimeoutLifetime.Step); var wf2 = new SubRequestWorkflowMock(); requestPipe .InvokeStep(wf.ReadString, RequestStepMock.Step1) .InvokeStep(wf.Parse, RequestStepMock.Step2) .InvokeLoop <SubRequestMock, RequestStepMock>(wf.GetStrings, RequestStepMock.Step7, r => { var pipe = WorkflowFactory.Create( r, timeout, TimeoutLifetime.Workflow, defaultErrorHandler, defaultInterceptor); pipe.InvokeStep(wf2.ReadString, RequestStepMock.Step1, customErrorHandler, customInterceptor) .InvokeStep(wf2.Parse, RequestStepMock.Step2, customErrorHandler, customInterceptor) .InvokeStep(wf2.Mul, RequestStepMock.Step3, customErrorHandler, customInterceptor) .InvokeStep(wf2.Sleep, RequestStepMock.Step4, customErrorHandler, customInterceptor) .InvokeStep(wf2.AddValue, RequestStepMock.Step5, customErrorHandler, customInterceptor); }) .InvokeStep(wf.Done, RequestStepMock.Done); }
static Parser() { Splitter = new string[] { " ", "은", "는", "를", "이", "가", "나", "어", "지", "고", "거", "아", "내", "있", "요", "네", "하", "로", "을지", "답니다", "도", "에", "ㅂ니다", "는데요", "었는데", "의", "이르", "어는", "게", "어다", "니", "에게" }; workflow = WorkflowFactory.getPredefinedWorkflow(WorkflowFactory.WORKFLOW_POS_SIMPLE_09); workflow.activateWorkflow(true); }
public void PrinterMapping_WithInvalidPrinter_SelectsDefaultProfile() { _settings.ApplicationSettings.PrinterMappings.Add(new PrinterMapping("InvalidPrinter", "Profile1")); ConversionWorkflow workflow = WorkflowFactory.CreateWorkflow(_testHelper.JobInfo, _settings); Assert.AreEqual(_settings.ConversionProfiles[0], workflow.Job.Profile, "Default profile should have been mapped"); }
public void PrinterMapping_WithProfileMappingWithOtherCasing_PreselectsProfile() { _settings.ApplicationSettings.PrinterMappings.Add(new PrinterMapping("pdfcreator", "Profile1")); ConversionWorkflow workflow = WorkflowFactory.CreateWorkflow(_testHelper.JobInfo, _settings); Assert.AreEqual(_settings.ConversionProfiles[1], workflow.Job.Profile, "Profile1 should have been mapped"); }
private ActionResult GetPageViewData(WorkflowParameters parameters, string viewName, Func <IPageWorkflow, PageViewData> getPageViewData) { var repositoryFactory = new RepositoryFactory(); var workflowFactory = new WorkflowFactory(repositoryFactory); var pageWorkflow = workflowFactory.GetPageWorkflow(parameters); return(View(viewName, getPageViewData.Invoke(pageWorkflow))); }
private static void StartEchoWorkflow() { var client = new AmazonSimpleWorkflowClient(); var activity = WorkflowFactory.CreateActivity <string, string>("echo", Echo, 60, 10, 10, 20) .Complete(); var workflow = WorkflowFactory.CreateWorkflow("theburningmonk.com", "echo_cs", "1") .Attach(activity) .Complete(); workflow.Start(client); }
public async Task <IActionResult> Post([FromBody] CreateWorkflow createWorkflow) { try { var workFlow = WorkflowFactory.CreateNewWorkflow(createWorkflow.WorkflowName, createWorkflow.SourceEmailAddress, createWorkflow.RequestId, 30); await _workflowDataService.SaveWorkflowAsync(workFlow); return(Ok(createWorkflow)); } catch (Exception e) { return(BadRequest(e.Message)); } }
static void Main(string[] args) { Workflow workflow = WorkflowFactory.getPredefinedWorkflow(WorkflowFactory.WORKFLOW_NOUN_EXTRACTOR); try { /* Activate the work flow in the thread mode */ workflow.activateWorkflow(true); string document = File.ReadAllText("sample.txt"); StringBuilder sb = new StringBuilder(); /* Analysis using the work flow */ workflow.analyze(document); LinkedList <Sentence> resultList = workflow.getResultOfDocument(new Sentence(0, 0, false)); foreach (Sentence s in resultList) { Eojeol[] eojeolArray = s.Eojeols; for (int i = 0; i < eojeolArray.Length; i++) { if (eojeolArray[i].length > 0) { String[] morphemes = eojeolArray[i].Morphemes; for (int j = 0; j < morphemes.Length; j++) { sb.Append(morphemes[j]); sb.Append(", "); } } } } File.WriteAllText("sample.output.txt", sb.ToString()); workflow.close(); } catch (Exception e) { Console.WriteLine(e.ToString()); return; } /* Shutdown the work flow */ workflow.close(); }
/// <summary> /// 审批 /// </summary> /// <param name="stepId">当前审批步骤id</param> /// <param name="isPass">是否通过</param> /// <param name="Comment">审批意见</param> /// <param name="flowTo">流转到谁</param> /// <returns></returns> public ActionResult DoCheck(int stepId, bool isPass, string Comment, int flowTo) { //stepId:id, isPass: pass, Comment: $("#Comment").val() } //1、更新当前步骤 var step = WF_StepService.GetEntities(s => s.ID == stepId).FirstOrDefault(); step.ProcessResult = isPass ? "通过" : "不通过"; step.StepStatus = (short)Heima8.OA.Model.Enum.WFStepEnum.Processed; step.ProcessTime = DateTime.Now; step.PorcessComment = Comment; WF_StepService.Update(step); //初始化下一个步骤 WF_Step nextStep = new WF_Step(); nextStep.IsEndStep = false; nextStep.IsStartStep = false; nextStep.ProcessBy = flowTo;//下一个步骤处理人 nextStep.SubTime = DateTime.Now; nextStep.ProcessResult = string.Empty; nextStep.StepStatus = (short)Heima8.OA.Model.Enum.WFStepEnum.UnProecess; nextStep.StepName = string.Empty; nextStep.WF_InstanceID = step.WF_InstanceID; nextStep.ProcessTime = DateTime.Now; nextStep.PorcessComment = string.Empty; WF_StepService.Add(nextStep); //让书签继续往下执行。 var Value = isPass ? 1 : 0; var instance = GetWfInstance(step); var temp = GetWfTemp(instance); var activity = WorkflowFactory.GetActivity(temp.ActityType); Heima8.OA.Workflow.WorkflowApplicationHelper.ResumeBookMark( activity, step.WF_Instance.WFInstanceId, step.StepName, Value); return(Content("ok")); }
private async Task ProcessFiles() { try { var files = this.ReadFiles(); if (files.Count() > 0) { _logger.LogInformation($"{files.Count()} file(s) were found. Starting to process them."); foreach (var file in files) { try { var workflow = WorkflowFactory.GetWorkflow(file); workflow.Execute(); file.MoveTo($"{this.DATA_PATH}\\success\\{file.Name}", true); _logger.LogInformation($"{file} processed successfully."); } catch (Exception ex) // An exception here should not stop the background process from running { var path = $"{file.DirectoryName}\\error\\{file.Name}.error"; file.MoveTo(path, true); _logger.LogError(ex, $"An error occured while processing {file.Name}"); } await Task.Delay(this.throttleRate); } _logger.LogInformation($"Finished processing all files"); } else { _logger.LogInformation($"There are no files to be processed"); } } catch (Exception ex) { _logger.LogCritical($"A fatal exception occurred: {ex.Message}"); } }
public static void ExecuteChain( RequestMock request, TimeSpan timeout, TimeoutLifetime timeoutLifetime, IErrorHandler <RequestMock, RequestStepMock> defaultErrorHandler = null, IInterceptor <RequestMock, RequestStepMock> defaultInterceptor = null, IErrorHandler <RequestMock, RequestStepMock> customErrorHandler = null, IInterceptor <RequestMock, RequestStepMock> customInterceptor = null) { var wf = new RequestWorkflowMock(); var pipe = WorkflowFactory.Create(request, timeout, timeoutLifetime, defaultErrorHandler, defaultInterceptor); pipe.InvokeStep(wf.ReadString, RequestStepMock.Step1, customErrorHandler, customInterceptor) .InvokeStep(wf.Parse, RequestStepMock.Step2, customErrorHandler, customInterceptor) .InvokeStep(wf.Mul, RequestStepMock.Step3, customErrorHandler, customInterceptor) .InvokeStep(wf.Sleep, RequestStepMock.Step4, customErrorHandler, customInterceptor) .InvokeStep(wf.Done, RequestStepMock.Done, customErrorHandler, customInterceptor); }