openwferu 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{README → README.txt} +16 -13
- data/bin/validate-workflow.rb +46 -22
- data/examples/README.txt +8 -0
- data/examples/homeworkreview.rb +66 -0
- data/examples/quotereporter.rb +154 -0
- data/lib/{openwferu.rb → openwfe.rb} +6 -8
- data/lib/{ru → openwfe}/contextual.rb +11 -3
- data/lib/{ru → openwfe/engine}/engine.rb +50 -36
- data/lib/{ru/participant.rb → openwfe/engine/file_persisted_engine.rb} +21 -22
- data/lib/openwfe/expool/expressionpool.rb +534 -0
- data/lib/openwfe/expool/expstorage.rb +184 -0
- data/lib/openwfe/expool/journalexpstorage.rb +312 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +127 -0
- data/lib/{ru → openwfe/expressions}/environment.rb +19 -14
- data/lib/{ru → openwfe/expressions}/expressionmap.rb +48 -21
- data/lib/{ru → openwfe/expressions}/fe_concurrence.rb +111 -35
- data/lib/openwfe/expressions/fe_cursor.rb +236 -0
- data/lib/{ru → openwfe/expressions}/fe_define.rb +5 -5
- data/lib/openwfe/expressions/fe_fqv.rb +99 -0
- data/lib/openwfe/expressions/fe_iterator.rb +182 -0
- data/lib/{ru/fe_misc.rb → openwfe/expressions/fe_losfor.rb} +14 -56
- data/lib/openwfe/expressions/fe_misc.rb +102 -0
- data/lib/{ru → openwfe/expressions}/fe_participant.rb +25 -14
- data/lib/{ru → openwfe/expressions}/fe_raw.rb +39 -75
- data/lib/{ru/fe_base.rb → openwfe/expressions/fe_sequence.rb} +40 -35
- data/lib/{ru → openwfe/expressions}/fe_subprocess.rb +30 -14
- data/lib/{ru → openwfe/expressions}/fe_time.rb +59 -31
- data/lib/{ru → openwfe/expressions}/fe_utils.rb +42 -26
- data/lib/{ru → openwfe/expressions}/fe_value.rb +20 -14
- data/lib/openwfe/expressions/flowexpression.rb +434 -0
- data/lib/openwfe/expressions/raw_prog.rb +391 -0
- data/lib/openwfe/expressions/raw_xml.rb +128 -0
- data/lib/openwfe/flowexpressionid.rb +148 -0
- data/lib/{ru → openwfe}/logging.rb +10 -6
- data/lib/{osocket.rb → openwfe/osocket.rb} +36 -35
- data/lib/{otime.rb → openwfe/otime.rb} +71 -21
- data/lib/openwfe/participants/atomparticipants.rb +144 -0
- data/lib/openwfe/participants/enoparticipant.rb +73 -0
- data/lib/openwfe/participants/participant.rb +85 -0
- data/lib/{ru → openwfe/participants}/participantmap.rb +40 -12
- data/lib/{ru → openwfe/participants}/participants.rb +41 -12
- data/lib/openwfe/participants/soapparticipants.rb +96 -0
- data/lib/{controlclient.rb → openwfe/rest/controlclient.rb} +12 -13
- data/lib/{definitions.rb → openwfe/rest/definitions.rb} +3 -3
- data/lib/{exception.rb → openwfe/rest/exception.rb} +3 -3
- data/lib/{restclient.rb → openwfe/rest/restclient.rb} +13 -22
- data/lib/{worklistclient.rb → openwfe/rest/worklistclient.rb} +33 -46
- data/lib/openwfe/rest/xmlcodec.rb +575 -0
- data/lib/{ru → openwfe}/rudefinitions.rb +32 -4
- data/lib/{ru → openwfe}/service.rb +20 -8
- data/lib/openwfe/storage/yamlfilestorage.rb +159 -0
- data/lib/{ru → openwfe/util}/dollar.rb +10 -8
- data/lib/openwfe/util/lru_cache.rb +149 -0
- data/lib/{ru → openwfe/util}/scheduler.rb +18 -10
- data/lib/{ru → openwfe/util}/schedulers.rb +7 -7
- data/lib/{utils.rb → openwfe/utils.rb} +93 -9
- data/lib/openwfe/workitem.rb +366 -0
- data/lib/openwfe/worklist/worklists.rb +175 -0
- data/test/README.txt +27 -0
- data/test/atomtest.rb +99 -0
- data/test/crontest.rb +58 -0
- data/test/dollartest.rb +3 -3
- data/test/feitest.rb +42 -14
- data/test/file_persistence_test.rb +93 -0
- data/test/flowtestbase.rb +72 -26
- data/test/ft_0.rb +1 -97
- data/test/ft_0b_sequence.rb +33 -0
- data/test/ft_0c_testname.rb +29 -0
- data/test/ft_10_loop.rb +48 -0
- data/test/ft_11_ppd.rb +292 -0
- data/test/ft_12_blockparticipant.rb +45 -0
- data/test/ft_13_eno.rb +51 -0
- data/test/ft_14_subprocess.rb +90 -0
- data/test/ft_14b_subprocess.rb +40 -0
- data/test/ft_15_iterator.rb +70 -0
- data/test/ft_16_fqv.rb +57 -0
- data/test/ft_1_unset.rb +25 -1
- data/test/ft_2_concurrence.rb +10 -5
- data/test/ft_3_equals.rb +35 -1
- data/test/ft_4_misc.rb +16 -1
- data/test/ft_5_time.rb +26 -1
- data/test/ft_6_lambda.rb +2 -1
- data/test/{ft_7_losfor.rb → ft_7_lose.rb} +41 -35
- data/test/ft_8_forget.rb +46 -0
- data/test/ft_9_cursor.rb +94 -0
- data/test/journal_persistence_test.rb +147 -0
- data/test/misctest.rb +13 -9
- data/test/rake_ptest.rb +18 -0
- data/test/rake_qtest.rb +43 -0
- data/test/{fulltest.rb → rake_test.rb} +2 -2
- data/test/raw_prog_test.rb +236 -0
- data/test/rest_test.rb +189 -0
- data/test/rutest_utils.rb +1 -1
- data/test/timetest.rb +42 -34
- metadata +125 -82
- data/lib/codec.rb +0 -573
- data/lib/flowexpressionid.rb +0 -139
- data/lib/ru/expressionpool.rb +0 -382
- data/lib/ru/expressionstorage.rb +0 -99
- data/lib/ru/flowexpression.rb +0 -272
- data/lib/ru/ruutils.rb +0 -70
- data/lib/test.rb +0 -222
- data/lib/workitem.rb +0 -249
- data/test/quicktest.rb +0 -21
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#
|
|
2
|
+
#--
|
|
3
|
+
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
|
8
|
+
#
|
|
9
|
+
# . Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
# list of conditions and the following disclaimer.
|
|
11
|
+
#
|
|
12
|
+
# . Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
# and/or other materials provided with the distribution.
|
|
15
|
+
#
|
|
16
|
+
# . Neither the name of the "OpenWFE" nor the names of its contributors may be
|
|
17
|
+
# used to endorse or promote products derived from this software without
|
|
18
|
+
# specific prior written permission.
|
|
19
|
+
#
|
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
23
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
24
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
28
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
29
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
30
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
+
#++
|
|
32
|
+
#
|
|
33
|
+
# $Id$
|
|
34
|
+
#
|
|
35
|
+
|
|
36
|
+
#
|
|
37
|
+
# "made in Japan"
|
|
38
|
+
#
|
|
39
|
+
# John Mettraux at openwfe.org
|
|
40
|
+
#
|
|
41
|
+
|
|
42
|
+
require 'soap/rpc/driver'
|
|
43
|
+
|
|
44
|
+
require 'openwfe/participants/participants'
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
module OpenWFE
|
|
48
|
+
|
|
49
|
+
#
|
|
50
|
+
# Stores the incoming workitem into an 'atom feed'
|
|
51
|
+
#
|
|
52
|
+
class SoapParticipant < LocalParticipant
|
|
53
|
+
|
|
54
|
+
def initialize \
|
|
55
|
+
(endpoint_url, namespace, method_name, params, param_prefix="")
|
|
56
|
+
|
|
57
|
+
super()
|
|
58
|
+
|
|
59
|
+
@driver = SOAP::RPC::Driver.new(endpoint_url, namespace)
|
|
60
|
+
|
|
61
|
+
@method_name = method_name
|
|
62
|
+
@params = params
|
|
63
|
+
@param_prefix = param_prefix
|
|
64
|
+
|
|
65
|
+
@driver.add_method(method_name, *params)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def consume (workitem)
|
|
69
|
+
|
|
70
|
+
call_params = []
|
|
71
|
+
|
|
72
|
+
@params.each do |param|
|
|
73
|
+
call_params << get_param(workitem, param)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
result = @driver.send(@method_name, *call_params)
|
|
77
|
+
|
|
78
|
+
workitem.attributes["__result__"] = result
|
|
79
|
+
|
|
80
|
+
reply_to_engine(workitem)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
protected
|
|
84
|
+
|
|
85
|
+
def get_param (workitem, param_name)
|
|
86
|
+
|
|
87
|
+
param_name = @param_prefix + param_name if @param_prefix
|
|
88
|
+
r = workitem.attributes[param_name]
|
|
89
|
+
return r if r
|
|
90
|
+
return ""
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
|
-
# Copyright (c) 2005-
|
|
3
|
+
# Copyright (c) 2005-2007, John Mettraux, OpenWFE.org
|
|
4
4
|
# All rights reserved.
|
|
5
5
|
#
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -39,12 +39,16 @@
|
|
|
39
39
|
|
|
40
40
|
require 'definitions'
|
|
41
41
|
require 'restclient'
|
|
42
|
-
require '
|
|
42
|
+
require 'xmlcodec'
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
module OpenWFE
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
#
|
|
48
|
+
# This client is used to connect to an OpenWFE engine to call
|
|
49
|
+
# 'control methods' for monitoring process instances, freezing or
|
|
50
|
+
# cancelling them
|
|
51
|
+
#
|
|
48
52
|
class ControlClient < RestClient
|
|
49
53
|
|
|
50
54
|
def initialize (server, port, username, password)
|
|
@@ -60,7 +64,7 @@ module OpenWFE
|
|
|
60
64
|
#
|
|
61
65
|
# Returns the list of controlable expressions
|
|
62
66
|
#
|
|
63
|
-
def
|
|
67
|
+
def list_expressions ()
|
|
64
68
|
|
|
65
69
|
r = self.get('listexpressions', nil, nil)
|
|
66
70
|
return decode(r)
|
|
@@ -82,7 +86,7 @@ module OpenWFE
|
|
|
82
86
|
#
|
|
83
87
|
# Cancels a given expression (and potentially its whole subtree)
|
|
84
88
|
#
|
|
85
|
-
def
|
|
89
|
+
def cancel_expression (flowExpressionId)
|
|
86
90
|
|
|
87
91
|
fei = OpenWFE.encode(flowExpressionId)
|
|
88
92
|
|
|
@@ -94,7 +98,7 @@ module OpenWFE
|
|
|
94
98
|
#
|
|
95
99
|
# Freezes an expression (and potentially its whole subtree)
|
|
96
100
|
#
|
|
97
|
-
def
|
|
101
|
+
def freeze_expression (flowExpressionId)
|
|
98
102
|
|
|
99
103
|
fei = OpenWFE.encode(flowExpressionId)
|
|
100
104
|
|
|
@@ -106,7 +110,7 @@ module OpenWFE
|
|
|
106
110
|
#
|
|
107
111
|
# Unfreezes an expression (and potentially its whole subtree)
|
|
108
112
|
#
|
|
109
|
-
def
|
|
113
|
+
def unfreeze_expression (flowExpressionId)
|
|
110
114
|
|
|
111
115
|
fei = OpenWFE.encode(flowExpressionId)
|
|
112
116
|
|
|
@@ -115,17 +119,12 @@ module OpenWFE
|
|
|
115
119
|
return decode(self.post('unfreezeexpression', nil, params, fei))
|
|
116
120
|
end
|
|
117
121
|
|
|
118
|
-
alias list_expressions listExpressions
|
|
119
|
-
alias cancel_expression cancelExpression
|
|
120
|
-
alias freeze_expression freezeExpression
|
|
121
|
-
alias unfreeze_expression unfreezeExpression
|
|
122
|
-
|
|
123
122
|
protected
|
|
124
123
|
|
|
125
124
|
def decode (reply)
|
|
126
125
|
|
|
127
126
|
xml = REXML::Document.new(reply.body)
|
|
128
|
-
return OpenWFE.
|
|
127
|
+
return OpenWFE.xml_decode(xml.root)
|
|
129
128
|
end
|
|
130
129
|
|
|
131
130
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2005-
|
|
2
|
+
#--
|
|
3
|
+
# Copyright (c) 2005-2007, John Mettraux, OpenWFE.org
|
|
4
4
|
# All rights reserved.
|
|
5
5
|
#
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
29
29
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
30
30
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
-
|
|
31
|
+
#++
|
|
32
32
|
#
|
|
33
33
|
# $Id: definitions.rb 3454 2006-10-08 16:51:00Z jmettraux $
|
|
34
34
|
#
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
|
-
|
|
3
|
-
# Copyright (c) 2005-
|
|
2
|
+
#--
|
|
3
|
+
# Copyright (c) 2005-2007, John Mettraux, OpenWFE.org
|
|
4
4
|
# All rights reserved.
|
|
5
5
|
#
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
29
29
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
30
30
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
31
|
-
|
|
31
|
+
#++
|
|
32
32
|
#
|
|
33
33
|
# $Id: exception.rb 3454 2006-10-08 16:51:00Z jmettraux $
|
|
34
34
|
#
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
|
-
# Copyright (c) 2005-
|
|
3
|
+
# Copyright (c) 2005-2007, John Mettraux, OpenWFE.org
|
|
4
4
|
# All rights reserved.
|
|
5
5
|
#
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -44,13 +44,17 @@ require 'rexml/document'
|
|
|
44
44
|
|
|
45
45
|
module OpenWFE
|
|
46
46
|
|
|
47
|
+
#
|
|
48
|
+
# A basic REST client for OpenWFE services (control and worklist)
|
|
49
|
+
#
|
|
47
50
|
class RestClient
|
|
48
51
|
|
|
49
|
-
attr_reader
|
|
52
|
+
attr_reader \
|
|
53
|
+
:host, :port, :resource, :session_id
|
|
50
54
|
|
|
51
55
|
def initialize (url, username, password)
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
split_url(url)
|
|
54
58
|
@username = username
|
|
55
59
|
|
|
56
60
|
connect(password)
|
|
@@ -69,7 +73,7 @@ module OpenWFE
|
|
|
69
73
|
def get (action, subResourceName, params)
|
|
70
74
|
|
|
71
75
|
return @httpclient\
|
|
72
|
-
.get(
|
|
76
|
+
.get(compute_resource(action, subResourceName, params))
|
|
73
77
|
end
|
|
74
78
|
|
|
75
79
|
def post (action, subResourceName, params, data)
|
|
@@ -77,12 +81,12 @@ module OpenWFE
|
|
|
77
81
|
data = data.to_s()
|
|
78
82
|
|
|
79
83
|
return @httpclient\
|
|
80
|
-
.post(
|
|
84
|
+
.post(compute_resource(action, subResourceName, params), data)
|
|
81
85
|
end
|
|
82
86
|
|
|
83
87
|
private
|
|
84
88
|
|
|
85
|
-
def
|
|
89
|
+
def split_url (url)
|
|
86
90
|
|
|
87
91
|
@host = nil
|
|
88
92
|
@port = nil
|
|
@@ -120,16 +124,16 @@ module OpenWFE
|
|
|
120
124
|
|
|
121
125
|
xml = REXML::Document.new(r.body)
|
|
122
126
|
|
|
123
|
-
@
|
|
127
|
+
@session_id = Integer(xml.root.attributes["id"])
|
|
124
128
|
end
|
|
125
129
|
|
|
126
|
-
def
|
|
130
|
+
def compute_resource (action, subResourceName, params)
|
|
127
131
|
|
|
128
132
|
resource = @resource
|
|
129
133
|
resource = resource+'/'+subResourceName if subResourceName
|
|
130
134
|
|
|
131
135
|
resource = resource+\
|
|
132
|
-
'?session='+@
|
|
136
|
+
'?session='+@session_id.to_s()+'&action='+action
|
|
133
137
|
|
|
134
138
|
if params
|
|
135
139
|
params.keys.each do |k|
|
|
@@ -142,16 +146,3 @@ module OpenWFE
|
|
|
142
146
|
end
|
|
143
147
|
end
|
|
144
148
|
|
|
145
|
-
|
|
146
|
-
# for test purposes
|
|
147
|
-
#
|
|
148
|
-
#client = RestClient::RestClient\
|
|
149
|
-
# .new("127.0.0.1:5080/worklist", "alice", "alice")
|
|
150
|
-
#client = OpenWFE::RestClient\
|
|
151
|
-
# .new("http://127.0.0.1:5080/worklist", "alice", "alice")
|
|
152
|
-
#
|
|
153
|
-
#puts "sessionId : #{client.sessionId}"
|
|
154
|
-
#
|
|
155
|
-
#puts client.get('getstorenames', nil, nil)
|
|
156
|
-
#puts client.get('getheaders', 'Store.alpha', nil)
|
|
157
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
#--
|
|
3
|
-
# Copyright (c) 2005-
|
|
3
|
+
# Copyright (c) 2005-2007, John Mettraux, OpenWFE.org
|
|
4
4
|
# All rights reserved.
|
|
5
5
|
#
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
@@ -39,11 +39,14 @@
|
|
|
39
39
|
|
|
40
40
|
require 'definitions'
|
|
41
41
|
require 'restclient'
|
|
42
|
-
require '
|
|
42
|
+
require 'xmlcodec'
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
module OpenWFE
|
|
46
46
|
|
|
47
|
+
#
|
|
48
|
+
# a client to an OpenWFE worklists.
|
|
49
|
+
#
|
|
47
50
|
class WorklistClient < RestClient
|
|
48
51
|
|
|
49
52
|
def initialize (server, port, username, password)
|
|
@@ -59,7 +62,7 @@ module OpenWFE
|
|
|
59
62
|
#
|
|
60
63
|
# Returns the list of stores the worklist hosts
|
|
61
64
|
#
|
|
62
|
-
def
|
|
65
|
+
def list_stores ()
|
|
63
66
|
r = self.get('listStores', nil, nil)
|
|
64
67
|
return decode(r)
|
|
65
68
|
end
|
|
@@ -67,14 +70,14 @@ module OpenWFE
|
|
|
67
70
|
#
|
|
68
71
|
# A synonym for listStores()
|
|
69
72
|
#
|
|
70
|
-
def
|
|
73
|
+
def get_store_names ()
|
|
71
74
|
return listStores()
|
|
72
75
|
end
|
|
73
76
|
|
|
74
77
|
#
|
|
75
78
|
# Returns the headers of a given store.
|
|
76
79
|
#
|
|
77
|
-
def
|
|
80
|
+
def get_headers (storeName, limit=1000)
|
|
78
81
|
|
|
79
82
|
params = {}
|
|
80
83
|
params["limit"] = limit
|
|
@@ -82,7 +85,7 @@ module OpenWFE
|
|
|
82
85
|
return decode(self.get('getHeaders', storeName, params))
|
|
83
86
|
end
|
|
84
87
|
|
|
85
|
-
def
|
|
88
|
+
def find_flow_instance (storeName, workflowInstanceId)
|
|
86
89
|
|
|
87
90
|
params = {}
|
|
88
91
|
params["id"] = workflowInstanceId
|
|
@@ -95,9 +98,9 @@ module OpenWFE
|
|
|
95
98
|
# The 'engineId' corresponds to an engine's participant name
|
|
96
99
|
# (see etc/engine/participant-map.xml)
|
|
97
100
|
#
|
|
98
|
-
def
|
|
101
|
+
def launch_flow (engineId, launchitem)
|
|
99
102
|
|
|
100
|
-
eli = OpenWFE.
|
|
103
|
+
eli = OpenWFE.xml_encode(launchitem)
|
|
101
104
|
|
|
102
105
|
params = {}
|
|
103
106
|
params[ENGINEID] = engineId
|
|
@@ -110,9 +113,9 @@ module OpenWFE
|
|
|
110
113
|
# to it cannot be communicated with saveWorkitem() or forwardWorkitem()
|
|
111
114
|
# to the worklist)
|
|
112
115
|
#
|
|
113
|
-
def
|
|
116
|
+
def get_workitem (storeName, flowExpressionId)
|
|
114
117
|
|
|
115
|
-
return
|
|
118
|
+
return get_item('getWorkitem', storeName, flowExpressionId)
|
|
116
119
|
end
|
|
117
120
|
|
|
118
121
|
#
|
|
@@ -120,20 +123,20 @@ module OpenWFE
|
|
|
120
123
|
# the usage of the methods saveWorkitem() and forwardWorkitem() is
|
|
121
124
|
# possible.
|
|
122
125
|
#
|
|
123
|
-
def
|
|
126
|
+
def get_and_lock_workitem (storeName, flowExpressionId)
|
|
124
127
|
|
|
125
128
|
#puts "...getAndLockWorkitem() for #{flowExpressionId}"
|
|
126
129
|
|
|
127
|
-
return
|
|
130
|
+
return get_item('getAndLockWorkitem', storeName, flowExpressionId)
|
|
128
131
|
end
|
|
129
132
|
|
|
130
133
|
#
|
|
131
134
|
# Given a queryMap (a dict of keys and values), locks and returns
|
|
132
135
|
# the first workitem matching.
|
|
133
136
|
#
|
|
134
|
-
def
|
|
137
|
+
def query_and_lock_workitem (storeName, queryMap)
|
|
135
138
|
|
|
136
|
-
hs =
|
|
139
|
+
hs = get_headers(storeName)
|
|
137
140
|
hs.each do |h|
|
|
138
141
|
|
|
139
142
|
#puts "...h.id #{h.flowExpressionId}"
|
|
@@ -158,7 +161,8 @@ module OpenWFE
|
|
|
158
161
|
|
|
159
162
|
#puts " .id is #{h.flowExpressionId}"
|
|
160
163
|
|
|
161
|
-
return
|
|
164
|
+
return get_and_lock_workitem(storeName, h.flowExpressionId) \
|
|
165
|
+
if ok
|
|
162
166
|
end
|
|
163
167
|
|
|
164
168
|
return nil
|
|
@@ -168,33 +172,33 @@ module OpenWFE
|
|
|
168
172
|
# Notifies the worklist that the given workitem has to be unlocked
|
|
169
173
|
# any local (client-side) modification to it are ignored.
|
|
170
174
|
#
|
|
171
|
-
def
|
|
175
|
+
def release_workitem (workitem)
|
|
172
176
|
|
|
173
|
-
return
|
|
177
|
+
return post_item('releaseWorkitem', workitem)
|
|
174
178
|
end
|
|
175
179
|
|
|
176
180
|
#
|
|
177
181
|
# Saves back the workitem in the worklist (and releases it)
|
|
178
182
|
#
|
|
179
|
-
def
|
|
183
|
+
def save_workitem (workitem)
|
|
180
184
|
|
|
181
|
-
return
|
|
185
|
+
return post_item('saveWorkitem', workitem)
|
|
182
186
|
end
|
|
183
187
|
|
|
184
188
|
#
|
|
185
189
|
# Returns the workitem to the worklist so that it can resume
|
|
186
190
|
# its flow (changes to the workitem are saved).
|
|
187
191
|
#
|
|
188
|
-
def
|
|
192
|
+
def proceed_workitem (workitem)
|
|
189
193
|
|
|
190
|
-
return
|
|
194
|
+
return post_item('forwardWorkitem', workitem)
|
|
191
195
|
end
|
|
192
196
|
|
|
193
197
|
#
|
|
194
198
|
# Returns the list of flow URLs the user owning this session may
|
|
195
199
|
# launch.
|
|
196
200
|
#
|
|
197
|
-
def
|
|
201
|
+
def list_launchables ()
|
|
198
202
|
|
|
199
203
|
params = {}
|
|
200
204
|
|
|
@@ -219,7 +223,7 @@ module OpenWFE
|
|
|
219
223
|
# Delegate the workitem (ask the worklist to deliver it to
|
|
220
224
|
# another participant).
|
|
221
225
|
#
|
|
222
|
-
def
|
|
226
|
+
def delegate_to_participant (workitem, targetParticipantName)
|
|
223
227
|
|
|
224
228
|
ewi = OpenWFE.encode(workitem)
|
|
225
229
|
|
|
@@ -232,35 +236,18 @@ module OpenWFE
|
|
|
232
236
|
#def queryStore (storeName, query)
|
|
233
237
|
#end
|
|
234
238
|
|
|
235
|
-
alias list_stores listStores
|
|
236
|
-
alias get_store_names getStoreNames
|
|
237
|
-
alias get_headers getHeaders
|
|
238
|
-
alias find_flow_instance findFlowInstance
|
|
239
|
-
alias launch_flow launchFlow
|
|
240
|
-
alias get_workitem getWorkitem
|
|
241
|
-
alias get_and_lock_workitem getAndLockWorkitem
|
|
242
|
-
alias query_and_lock_workitem queryAndLockWorkitem
|
|
243
|
-
alias release_workitem releaseWorkitem
|
|
244
|
-
alias save_workitem saveWorkitem
|
|
245
|
-
alias proceed_workitem proceedWorkitem
|
|
246
|
-
alias forwardWorkitem proceedWorkitem
|
|
247
|
-
alias forward_workitem proceedWorkitem
|
|
248
|
-
alias list_launchables listLaunchables
|
|
249
|
-
alias delegate_to_participant delegateToParticipant
|
|
250
|
-
|
|
251
|
-
|
|
252
239
|
protected
|
|
253
240
|
|
|
254
241
|
def decode (reply)
|
|
255
242
|
|
|
256
243
|
xml = REXML::Document.new(reply.body)
|
|
257
|
-
return OpenWFE.
|
|
244
|
+
return OpenWFE.xml_decode(xml.root)
|
|
258
245
|
end
|
|
259
246
|
|
|
260
|
-
def
|
|
247
|
+
def get_item (restMethodName, storeName, flowExpressionId)
|
|
261
248
|
|
|
262
|
-
fei = OpenWFE.
|
|
263
|
-
fei = OpenWFE.
|
|
249
|
+
fei = OpenWFE.xml_encode(flowExpressionId)
|
|
250
|
+
fei = OpenWFE.xmldoc_to_string(fei, false)
|
|
264
251
|
|
|
265
252
|
params = {}
|
|
266
253
|
|
|
@@ -271,9 +258,9 @@ module OpenWFE
|
|
|
271
258
|
return wi
|
|
272
259
|
end
|
|
273
260
|
|
|
274
|
-
def
|
|
261
|
+
def post_item (restMethodName, workitem)
|
|
275
262
|
|
|
276
|
-
ewi = OpenWFE.
|
|
263
|
+
ewi = OpenWFE.xml_encode(workitem)
|
|
277
264
|
|
|
278
265
|
params = {}
|
|
279
266
|
|