Skip to content

Commit ce915c9

Browse files
committed
snippets were updated
1 parent fc6533f commit ce915c9

12 files changed

Lines changed: 749 additions & 132 deletions

Interfaces/IPersistenceProvider.cs

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using OptimaJet.Workflow.Core.Fault;
34
using OptimaJet.Workflow.Core.Model;
45
using OptimaJet.Workflow.Core.Runtime;
56

@@ -15,78 +16,101 @@ public interface IPersistenceProvider
1516
/// </summary>
1617
/// <param name="runtime">Workflow runtime instance which owned the provider</param>
1718
void Init(WorkflowRuntime runtime);
19+
1820
/// <summary>
1921
/// Initialize a process instance in persistence store
2022
/// </summary>
2123
/// <param name="processInstance">Instance of the process</param>
22-
void InitializeProcess (ProcessInstance processInstance);
24+
/// <exception cref="ProcessAlreadyExistsException"></exception>
25+
void InitializeProcess(ProcessInstance processInstance);
26+
2327
/// <summary>
2428
/// Fills system <see cref="ParameterPurpose.System"/> and persisted <see cref="ParameterPurpose.Persistence"/> parameters of the process
2529
/// </summary>
2630
/// <param name="processInstance">Instance of the process</param>
2731
void FillProcessParameters(ProcessInstance processInstance);
32+
2833
/// <summary>
2934
/// Fills persisted <see cref="ParameterPurpose.Persistence"/> parameters of the process
3035
/// </summary>
3136
/// <param name="processInstance">Instance of the process</param>
3237
void FillPersistedProcessParameters(ProcessInstance processInstance);
38+
3339
/// <summary>
3440
/// Fills system <see cref="ParameterPurpose.System"/> parameters of the process
3541
/// </summary>
3642
/// <param name="processInstance">Instance of the process</param>
3743
void FillSystemProcessParameters(ProcessInstance processInstance);
44+
3845
/// <summary>
3946
/// Saves persisted <see cref="ParameterPurpose.Persistence"/> parameters of the process to store
4047
/// </summary>
4148
/// <param name="processInstance">Instance of the process</param>
4249
void SavePersistenceParameters(ProcessInstance processInstance);
50+
4351
/// <summary>
4452
/// Set process instance status to <see cref="ProcessStatus.Initialized"/>
4553
/// </summary>
4654
/// <param name="processInstance">Instance of the process</param>
55+
/// <exception cref="ImpossibleToSetStatusException"></exception>
4756
void SetWorkflowIniialized(ProcessInstance processInstance);
57+
4858
/// <summary>
4959
/// Set process instance status to <see cref="ProcessStatus.Idled"/>
5060
/// </summary>
5161
/// <param name="processInstance">Instance of the process</param>
62+
/// <exception cref="ImpossibleToSetStatusException"></exception>
5263
void SetWorkflowIdled(ProcessInstance processInstance);
64+
5365
/// <summary>
5466
/// Set process instance status to <see cref="ProcessStatus.Running"/>
5567
/// </summary>
5668
/// <param name="processInstance">Instance of the process</param>
69+
/// <exception cref="ImpossibleToSetStatusException"></exception>
5770
void SetWorkflowRunning(ProcessInstance processInstance);
71+
5872
/// <summary>
5973
/// Set process instance status to <see cref="ProcessStatus.Finalized"/>
6074
/// </summary>
6175
/// <param name="processInstance">Instance of the process</param>
76+
/// <exception cref="ImpossibleToSetStatusException"></exception>
6277
void SetWorkflowFinalized(ProcessInstance processInstance);
78+
6379
/// <summary>
6480
/// Set process instance status to <see cref="ProcessStatus.Terminated"/>
6581
/// </summary>
6682
/// <param name="processInstance">Instance of the process</param>
83+
/// <exception cref="ImpossibleToSetStatusException"></exception>
84+
#pragma warning disable 612
6785
void SetWorkflowTerminated(ProcessInstance processInstance, ErrorLevel level, string errorMessage);
86+
#pragma warning restore 612
87+
6888
/// <summary>
6989
/// Resets all process to <see cref="ProcessStatus.Idled"/> status
7090
/// </summary>
7191
void ResetWorkflowRunning();
92+
7293
/// <summary>
7394
/// Updates system parameters of the process in the store
7495
/// </summary>
7596
/// <param name="processInstance">Instance of the process</param>
7697
/// <param name="transition">Last executed transition</param>
7798
void UpdatePersistenceState(ProcessInstance processInstance, TransitionDefinition transition);
99+
78100
/// <summary>
79101
/// Checks existence of the process
80102
/// </summary>
81103
/// <param name="processId">Id of the process</param>
82104
/// <returns></returns>
83105
bool IsProcessExists(Guid processId);
106+
84107
/// <summary>
85108
/// Returns status of the process <see cref="ProcessStatus"/>
86109
/// </summary>
87110
/// <param name="processId">Id of the process</param>
88111
/// <returns>Status of the process</returns>
89112
ProcessStatus GetInstanceStatus(Guid processId);
113+
90114
/// <summary>
91115
/// Saves information about changed scheme to the store
92116
/// </summary>
@@ -98,7 +122,9 @@ public interface IPersistenceProvider
98122
/// </summary>
99123
/// <param name="processInstance">Instance of the process whith changed scheme <see cref="ProcessInstance.ProcessScheme"/></param>
100124
/// <param name="resetIsDeterminingParametersChanged">True if required to reset IsDeterminingParametersChanged flag <see cref="ProcessInstance.IsDeterminingParametersChanged"/></param>
125+
/// <exception cref="ProcessNotFoundException"></exception>
101126
void BindProcessToNewScheme(ProcessInstance processInstance, bool resetIsDeterminingParametersChanged);
127+
102128
/// <summary>
103129
/// Register a new timer
104130
/// </summary>
@@ -107,49 +133,64 @@ public interface IPersistenceProvider
107133
/// <param name="nextExecutionDateTime">Next date and time of timer's execution</param>
108134
/// <param name="notOverrideIfExists">If true specifies that the existing timer with same name will not be overriden <see cref="TimerDefinition.NotOverrideIfExists"/></param>
109135
void RegisterTimer(Guid processId, string name, DateTime nextExecutionDateTime, bool notOverrideIfExists);
136+
110137
/// <summary>
111138
/// Removes all timers from the store, exlude listed in ignore list
112139
/// </summary>
113140
/// <param name="processId">Id of the process</param>
114141
/// <param name="timersIgnoreList">Ignore list</param>
115142
void ClearTimers(Guid processId, List<string> timersIgnoreList);
143+
116144
/// <summary>
117145
/// Clears sign Ignore for all timers
118146
/// </summary>
119147
void ClearTimersIgnore();
148+
149+
150+
/// <summary>
151+
/// Clears sign Ignore for specific timers
152+
/// </summary>
153+
void ClearTimerIgnore(Guid timerId);
154+
120155
/// <summary>
121156
/// Remove specific timer
122157
/// </summary>
123158
/// <param name="timerId">Id of the timer</param>
124159
void ClearTimer(Guid timerId);
160+
125161
/// <summary>
126162
/// Get closest execution date and time for all timers
127163
/// </summary>
128164
/// <returns></returns>
129165
DateTime? GetCloseExecutionDateTime();
166+
130167
/// <summary>
131168
/// Get all timers which must be executed at this moment of time
132169
/// </summary>
133170
/// <returns>List of timers to execute</returns>
134171
List<TimerToExecute> GetTimersToExecute();
172+
135173
/// <summary>
136174
/// Remove all information about the process from the store
137175
/// </summary>
138176
/// <param name="processId">Id of the process</param>
139177
void DeleteProcess(Guid processId);
178+
140179
/// <summary>
141180
/// Remove all information about the process from the store
142181
/// </summary>
143182
/// <param name="processIds">List of ids of the process</param>
144183
void DeleteProcess(Guid[] processIds);
184+
145185
/// <summary>
146186
/// Saves a global parameter value
147187
/// </summary>
148188
/// <typeparam name="T">System type of the parameter</typeparam>
149189
/// <param name="type">Logical type of the parameter</param>
150190
/// <param name="name">Name of the parameter</param>
151191
/// <param name="value">Value of the parameter</param>
152-
void SaveGlobalParameter<T>(string type, string name, T value);
192+
void SaveGlobalParameter<T>(string type, string name, T value);
193+
153194
/// <summary>
154195
/// Returns a global parameter value
155196
/// </summary>
@@ -158,18 +199,27 @@ public interface IPersistenceProvider
158199
/// <param name="name">Name of the parameter</param>
159200
/// <returns>Value of the parameter</returns>
160201
T LoadGlobalParameter<T>(string type, string name);
202+
161203
/// <summary>
162204
/// Returns a global parameter value
163205
/// </summary>
164206
/// <typeparam name="T">System type of the parameter</typeparam>
165207
/// <param name="type">Logical type of the parameter</param>
166208
/// <returns>List of the values of the parameters</returns>
167209
List<T> LoadGlobalParameters<T>(string type);
210+
168211
/// <summary>
169212
/// Deletes a global parameter
170213
/// </summary>
171214
/// <param name="type">Logical type of the parameter</param>
172215
/// <param name="name">Name of the parameter</param>
173216
void DeleteGlobalParameters(string type, string name = null);
217+
218+
/// <summary>
219+
/// Returns the history of process
220+
/// </summary>
221+
/// <param name="processId">Id of the process</param>
222+
/// <returns></returns>
223+
List<ProcessHistoryItem> GetProcessHistory(Guid processId);
174224
}
175225
}

Interfaces/IRuntimePersistence.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using OptimaJet.Workflow.Core.Runtime;
3-
4-
namespace OptimaJet.Workflow.Core.Persistence
1+
namespace OptimaJet.Workflow.Core.Persistence
52
{
63
/// <summary>
74
/// Provides save and load of workflow runtime parameters. as timers etc

Interfaces/ISchemePersistenceProvider.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using OptimaJet.Workflow.Core.Fault;
34
using OptimaJet.Workflow.Core.Model;
45

56
namespace OptimaJet.Workflow.Core.Persistence
@@ -16,12 +17,15 @@ public interface ISchemePersistenceProvider<TSchemeMedium> where TSchemeMedium :
1617
/// </summary>
1718
/// <param name="processId">Id of the process</param>
1819
/// <returns>Not parsed scheme of the process</returns>
20+
/// <exception cref="ProcessNotFoundException"></exception>
21+
/// <exception cref="SchemeNotFoundException"></exception>
1922
SchemeDefinition<TSchemeMedium> GetProcessSchemeByProcessId(Guid processId);
2023
/// <summary>
2124
/// Gets not parsed scheme by id
2225
/// </summary>
2326
/// <param name="schemeId">Id of the scheme</param>
2427
/// <returns>Not parsed scheme of the process</returns>
28+
/// <exception cref="SchemeNotFoundException"></exception>
2529
SchemeDefinition<TSchemeMedium> GetProcessSchemeBySchemeId(Guid schemeId);
2630

2731
/// <summary>
@@ -32,6 +36,7 @@ public interface ISchemePersistenceProvider<TSchemeMedium> where TSchemeMedium :
3236
/// <param name="rootSchemeId">Id of the root scheme in case of subprocess</param>
3337
/// <param name="ignoreObsolete">True if you need to ignore obsolete schemes</param>
3438
/// <returns>Not parsed scheme of the process</returns>
39+
/// <exception cref="SchemeNotFoundException"></exception>
3540
SchemeDefinition<TSchemeMedium> GetProcessSchemeWithParameters(string schemeCode,
3641
string parameters,
3742
Guid? rootSchemeId,
@@ -43,12 +48,14 @@ SchemeDefinition<TSchemeMedium> GetProcessSchemeWithParameters(string schemeCode
4348
/// </summary>
4449
/// <param name="code">Name of the scheme</param>
4550
/// <returns>Not parsed scheme of the process</returns>
51+
/// <exception cref="SchemeNotFoundException"></exception>
4652
TSchemeMedium GetScheme(string code);
4753

4854
/// <summary>
4955
/// Saves scheme to a store
5056
/// </summary>
5157
/// <param name="scheme">Not parsed scheme of the process</param>
58+
/// <exception cref="SchemeAlredyExistsException"></exception>
5259
void SaveScheme(SchemeDefinition<TSchemeMedium> scheme);
5360

5461
/// <summary>

Interfaces/ITimerManager.cs

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using OptimaJet.Workflow.Core.Model;
1+
using System;
2+
using System.Collections.Generic;
3+
using OptimaJet.Workflow.Core.Model;
24
using OptimaJet.Workflow.Core.Persistence;
35

46
namespace OptimaJet.Workflow.Core.Runtime
@@ -8,6 +10,56 @@ namespace OptimaJet.Workflow.Core.Runtime
810
/// </summary>
911
public interface ITimerManager
1012
{
13+
/// <summary>
14+
/// Raises when the timer value must be obtained
15+
/// </summary>
16+
event EventHandler<NeedTimerValueEventArgs> NeedTimerValue;
17+
18+
/// <summary>
19+
/// Sends request for timer value for all timer transitions that are outgoing from the CurrentActivity if timer value is equal 0 or -1
20+
/// </summary>
21+
/// <param name="activity">Activity to get outbound transition, if null the CurrentActivity will be used</param>
22+
/// <param name="processInstance">Process instance</param>
23+
void RequestTimerValue(ProcessInstance processInstance, ActivityDefinition activity = null);
24+
25+
/// <summary>
26+
/// Returns transitions triggered by a timer which value is equal to 0
27+
/// </summary>
28+
/// <param name="processInstance">Process instance</param>
29+
/// <param name="activity">Activity to get outbound transition, if null the CurrentActivity will be used</param>
30+
/// <returns></returns>
31+
IEnumerable<TransitionDefinition> GetTransitionsForImmediateExecution(ProcessInstance processInstance, ActivityDefinition activity = null);
32+
33+
/// <summary>
34+
/// Sets new value of named timer
35+
/// </summary>
36+
/// <param name="processInstance">Process instance</param>
37+
/// <param name="timerName">Timer name in Scheme</param>
38+
/// <param name="newValue">New value of the timer</param>
39+
void SetTimerValue(ProcessInstance processInstance, string timerName, DateTime newValue);
40+
41+
/// <summary>
42+
/// Sets new value of named timer
43+
/// </summary>
44+
/// <param name="processId">Process id</param>
45+
/// <param name="timerName">Timer name in Scheme</param>
46+
/// <param name="newValue">New value of the timer</param>
47+
void SetTimerValue(Guid processId, string timerName, DateTime newValue);
48+
49+
/// <summary>
50+
/// Resets value of named timer
51+
/// </summary>
52+
/// <param name="processInstance">Process instance</param>
53+
/// <param name="timerName">Timer name in Scheme</param>
54+
void ResetTimerValue(ProcessInstance processInstance, string timerName);
55+
56+
/// <summary>
57+
/// Resets value of named timer
58+
/// </summary>
59+
/// <param name="processId">Process id</param>
60+
/// <param name="timerName">Timer name in Scheme</param>
61+
void ResetTimerValue(Guid processId, string timerName);
62+
1163
/// <summary>
1264
/// Register all timers for all outgouing timer transitions for current actvity of the specified process.
1365
/// All timers registered before which are present in transitions will be rewrited except timers marked as NotOverrideIfExists <see cref="TimerDefinition"/>
@@ -30,14 +82,16 @@ public interface ITimerManager
3082
void Init(WorkflowRuntime runtime);
3183

3284
/// <summary>
33-
/// Start the timer
85+
/// Starts the timer
3486
/// </summary>
35-
void Start();
87+
///<param name="timeout">Wait timeout in milliseconds</param>
88+
void Start(int? timeout = null);
3689

3790
/// <summary>
38-
/// Stop the timer
91+
/// Stops the timer
3992
/// </summary>
40-
void Stop();
93+
///<param name="timeout">Wait timeout in milliseconds</param>
94+
void Stop(int? timeout = null);
4195

4296
/// <summary>
4397
/// Refresh interval of the timer

Interfaces/IWorkflowActionProvider.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ bool ExecuteCondition(string name, ProcessInstance processInstance, WorkflowRunt
3030
string actionParameter);
3131

3232
/// <summary>
33-
/// Return all user conditions and actions names
33+
/// Return all user actions names
3434
/// </summary>
35-
/// <returns>List of conditions and actions names</returns>
35+
/// <returns>List of actions names</returns>
3636
List<string> GetActions();
37+
38+
/// <summary>
39+
/// Return all user conditions names
40+
/// </summary>
41+
/// <returns>List of conditions names</returns>
42+
List<string> GetConditions();
3743
}
3844
}

Interfaces/IWorkflowBus.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ public interface IWorkflowBus
3434
void QueueExecution(ExecutionRequestParameters requestParameters, bool notFireExecutionComplete = false);
3535

3636
/// <summary>
37-
/// Event raised after the execution was complete
37+
/// Raises after the execution was complete
3838
/// </summary>
3939
event EventHandler<ExecutionResponseEventArgs> ExecutionComplete;
40+
41+
/// <summary>
42+
/// Raises before execution of choosen activity
43+
/// </summary>
44+
event EventHandler<BeforeActivityExecutionEventArgs> BeforeExecution;
45+
4046
/// <summary>
4147
/// Returns true if the bus supports asynchronous model of execution
4248
/// </summary>

0 commit comments

Comments
 (0)