forked from optimajet/WorkflowEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkflowInit.cs
More file actions
97 lines (83 loc) · 3.26 KB
/
WorkflowInit.cs
File metadata and controls
97 lines (83 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using OptimaJet.Workflow.Core.Builder;
using OptimaJet.Workflow.Core.Bus;
using OptimaJet.Workflow.Core.Model;
using OptimaJet.Workflow.Core.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace WorkflowApp
{
public class WorkflowInit
{
private static volatile WorkflowRuntime _runtime;
private static readonly object _sync = new object();
public static WorkflowRuntime Runtime
{
get
{
if (_runtime == null)
{
lock (_sync)
{
if (_runtime == null)
{
//TODO CONNECTION STRING TO DATABASE
var connectionString = "Data Source=(local);Initial Catalog=WFTemp;Integrated Security=True;User ID=sa;Password=1";
var builder = new WorkflowBuilder<XElement>(
new OptimaJet.Workflow.DbPersistence.DbXmlWorkflowGenerator(connectionString),
new OptimaJet.Workflow.Core.Parser.XmlWorkflowParser(),
new OptimaJet.Workflow.DbPersistence.DbSchemePersistenceProvider(connectionString)
).WithDefaultCache();
_runtime = new WorkflowRuntime(new Guid("{8D38DB8F-F3D5-4F26-A989-4FDD40F32D9D}"))
.WithBuilder(builder)
.WithActionProvider(new ActionProvider())
.WithRuleProvider(new RuleProvider())
.WithPersistenceProvider(new OptimaJet.Workflow.DbPersistence.DbPersistenceProvider(connectionString))
.WithTimerManager(new TimerManager())
.WithBus(new NullBus())
.SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOn()
.Start();
}
}
}
return _runtime;
}
}
}
public class RuleProvider : IWorkflowRuleProvider
{
public bool Check(Guid processId, string identityId, string ruleName, string parameter)
{
throw new NotImplementedException();
}
public IEnumerable<string> GetIdentities(Guid processId, string ruleName, string parameter)
{
throw new NotImplementedException();
}
public System.Collections.Generic.List<string> GetRules()
{
//LIST YOUR RULES NAMES HERE
return new List<string>() { };
}
}
public class ActionProvider : IWorkflowActionProvider
{
public void ExecuteAction(string name, ProcessInstance processInstance, string actionParameter)
{
}
public bool ExecuteCondition(string name, ProcessInstance processInstance, string actionParameter)
{
return true;
}
public List<string> GetActions()
{
//LIST YOUR ACTIONS NAMES HERE
return new List<string>()
{
};
}
}
}