forked from optimajet/WorkflowEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathITimerManager.cs
More file actions
123 lines (104 loc) · 5.6 KB
/
ITimerManager.cs
File metadata and controls
123 lines (104 loc) · 5.6 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using OptimaJet.Workflow.Core.Model;
using OptimaJet.Workflow.Core.Persistence;
namespace OptimaJet.Workflow.Core.Runtime
{
/// <summary>
/// Interface of a timer manager, which control timers functioning inside a workflow runtime
/// </summary>
public interface ITimerManager
{
/// <summary>
/// Value of Unspecified Timer which indicates that the timer transition will be executed immediately
/// </summary>
string ImmediateTimerValue { get; }
/// <summary>
/// Value of Unspecified Timer which indicates that the timer transition will be never executed
/// </summary>
string InfinityTimerValue { get; }
/// <summary>
/// Raises when the timer value must be obtained
/// </summary>
event EventHandler<NeedTimerValueEventArgs> NeedTimerValue;
/// <summary>
/// Sends request for timer value for all timer transitions that are outgoing from the CurrentActivity if timer value is equal 0 or -1
/// </summary>
/// <param name="activity">Activity to get outbound transition, if null the CurrentActivity will be used</param>
/// <param name="processInstance">Process instance</param>
void RequestTimerValue(ProcessInstance processInstance, ActivityDefinition activity = null);
/// <summary>
/// Returns transitions triggered by a timer which value is equal to 0
/// </summary>
/// <param name="processInstance">Process instance</param>
/// <param name="activity">Activity to get outbound transition, if null the CurrentActivity will be used</param>
/// <returns></returns>
IEnumerable<TransitionDefinition> GetTransitionsForImmediateExecution(ProcessInstance processInstance, ActivityDefinition activity = null);
/// <summary>
/// Sets new value of named timer
/// </summary>
/// <param name="processInstance">Process instance</param>
/// <param name="timerName">Timer name in Scheme</param>
/// <param name="newValue">New value of the timer</param>
void SetTimerValue(ProcessInstance processInstance, string timerName, DateTime newValue);
/// <summary>
/// Sets new value of named timer
/// </summary>
/// <param name="processId">Process id</param>
/// <param name="timerName">Timer name in Scheme</param>
/// <param name="newValue">New value of the timer</param>
Task SetTimerValue(Guid processId, string timerName, DateTime newValue);
/// <summary>
/// Resets value of named timer
/// </summary>
/// <param name="processInstance">Process instance</param>
/// <param name="timerName">Timer name in Scheme</param>
void ResetTimerValue(ProcessInstance processInstance, string timerName);
/// <summary>
/// Resets value of named timer
/// </summary>
/// <param name="processId">Process id</param>
/// <param name="timerName">Timer name in Scheme</param>
Task ResetTimerValue(Guid processId, string timerName);
/// <summary>
/// Register all timers for all outgouing timer transitions for current actvity of the specified process.
/// All timers registered before which are present in transitions will be rewrited except timers marked as NotOverrideIfExists <see cref="TimerDefinition"/>
/// </summary>
/// <param name="processInstance">Process instance whose timers need to be registered</param>
void RegisterTimers(ProcessInstance processInstance);
List<TimerToRegister> GetTimersToRegister(ProcessDefinition processDefinition, string activityName);
List<TimerToRegister> GetTimersToRegister(ProcessInstance processInstance, string activityName);
///// <summary>
///// Register all timers for all outgouing timer transitions for current actvity of the specified process.
///// All timers registered before which are present in transitions will be rewrited except timers marked as NotOverrideIfExists <see cref="TimerDefinition"/>
///// </summary>
///// <param name="processInstances">List of Process instance whose timers need to be registered</param>
//void BulkRegisterTimers(List<ProcessInstance> processInstances);
/// <summary>
/// Clear timers <see cref="ClearTimers"/> and then register new timers <see cref="RegisterTimers"/>
/// </summary>
/// <param name="processInstance">Process instance whose timers need to be cleared an registered</param>
void ClearAndRegisterTimers(ProcessInstance processInstance);
/// <summary>
/// Clear all registerd timers except present in outgouing timer transitions for current actvity of the specified process and marked as NotOverrideIfExists <see cref="TimerDefinition"/>
/// </summary>
/// <param name="processInstance">Process instance whose timers need to be cleared</param>
void ClearTimers(ProcessInstance processInstance);
void Init(WorkflowRuntime runtime);
/// <summary>
/// Starts the timer
/// </summary>
///<param name="timeout">Wait timeout in milliseconds</param>
void Start(int? timeout = null);
/// <summary>
/// Stops the timer
/// </summary>
///<param name="timeout">Wait timeout in milliseconds</param>
void Stop(int? timeout = null);
/// <summary>
/// Refresh interval of the timer
/// </summary>
void Refresh();
}
}