-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
54 lines (36 loc) · 1.79 KB
/
README
File metadata and controls
54 lines (36 loc) · 1.79 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
This is a *very* simple framework for workflow within the meaning of converting input object into
output object in several steps.
Goals:
* simple
* programmer-friendliness - most bugs detected on compile time
Features:
* subworkflows - workflow can be used as component in other workflow
Usage:
There are two base definitions:
* enricher - object capable to enrich input object. For example context may be enriched by
information about user and his permissions.
* converter - object capable to convert input object to output object. For example request object
can be converted to response object.
1. Automatic transition
Collection<Stage<YourRequest, YourResponse>> enrichers = ...
YourRequest request = ...
Workflow<YourRequest, YourResponse, YourStateModel> workflow = new Workflow<YourRequest, YourResponse, YourStateModel>();
workflow.addAllEnrichers(enrichers);
workflow.addOutputConverter(new ConvertRequestResponseOutputConverter<YourRequest, YourResponse>());
YourResponse response = workflow.enrichAndConvert(request);
2. SemiAutomatic
Collection<Stage<YourRequest, YourResponse>> enrichers = ...
YourRequest request = ...
Workflow<YourRequest, YourResponse, YourStateModel> workflow = new Workflow<YourRequest, YourResponse, YourStateModel>();
workflow.addAllEnrichers(enrichers);
workflow.addOutputConverter(new ConvertRequestResponseOutputConverter<YourRequest, YourResponse>());
Collection<YourStateModel> state = workflow.enrich(request);
// check state and contiuue processing
...
Collection<YourStateModel> state = workflow.enrich(request, YourStateModel.STATE_X);
// check state - should be final state
...
YourResponse response = workflow.convert(request);
Todo:
* branches
* state achieved when all contributors were executed