openwferu 0.9.10.653 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/README.txt +65 -33
  2. data/examples/README.txt +4 -0
  3. data/examples/flowtracing.rb +2 -0
  4. data/examples/homeworkreview.rb +2 -0
  5. data/examples/mano_tracker.rb +2 -0
  6. data/examples/openwferu.rb +3 -1
  7. data/examples/quotereporter.rb +2 -0
  8. data/examples/scheduler_cron_usage.rb +3 -1
  9. data/examples/scheduler_usage.rb +3 -1
  10. data/lib/openwfe/engine/engine.rb +15 -5
  11. data/lib/openwfe/expool/expressionpool.rb +30 -4
  12. data/lib/openwfe/expool/journal.rb +16 -18
  13. data/lib/openwfe/expool/journal_replay.rb +56 -8
  14. data/lib/openwfe/expool/wfidgen.rb +17 -8
  15. data/lib/openwfe/expressions/condition.rb +41 -26
  16. data/lib/openwfe/expressions/expressionmap.rb +7 -0
  17. data/lib/openwfe/expressions/fe_cancel.rb +1 -1
  18. data/lib/openwfe/expressions/fe_concurrence.rb +14 -5
  19. data/lib/openwfe/expressions/fe_cron.rb +3 -1
  20. data/lib/openwfe/expressions/fe_cursor.rb +1 -1
  21. data/lib/openwfe/expressions/fe_fqv.rb +58 -0
  22. data/lib/openwfe/expressions/fe_if.rb +1 -1
  23. data/lib/openwfe/expressions/fe_iterator.rb +5 -0
  24. data/lib/openwfe/expressions/fe_listen.rb +224 -0
  25. data/lib/openwfe/expressions/fe_misc.rb +32 -9
  26. data/lib/openwfe/expressions/fe_participant.rb +26 -6
  27. data/lib/openwfe/expressions/fe_sleep.rb +5 -7
  28. data/lib/openwfe/expressions/fe_timeout.rb +127 -0
  29. data/lib/openwfe/expressions/fe_when.rb +13 -1
  30. data/lib/openwfe/expressions/flowexpression.rb +4 -1
  31. data/lib/openwfe/expressions/time.rb +10 -27
  32. data/lib/openwfe/expressions/timeout.rb +23 -6
  33. data/lib/openwfe/flowexpressionid.rb +7 -6
  34. data/lib/openwfe/listeners/socketlisteners.rb +1 -1
  35. data/lib/openwfe/participants/enoparticipants.rb +103 -47
  36. data/lib/openwfe/participants/participant.rb +29 -3
  37. data/lib/openwfe/participants/participantmap.rb +10 -2
  38. data/lib/openwfe/participants/participants.rb +31 -19
  39. data/lib/openwfe/participants/socketparticipants.rb +3 -1
  40. data/lib/openwfe/rest/controlclient.rb +5 -18
  41. data/lib/openwfe/rest/oldrestservlet.rb +279 -0
  42. data/lib/openwfe/rest/restclient.rb +55 -25
  43. data/lib/openwfe/rest/worklistclient.rb +35 -44
  44. data/lib/openwfe/rest/xmlcodec.rb +79 -69
  45. data/lib/openwfe/rudefinitions.rb +15 -7
  46. data/lib/openwfe/storage/yamlextras.rb +3 -3
  47. data/lib/openwfe/util/observable.rb +64 -7
  48. data/lib/openwfe/util/scheduler.rb +107 -77
  49. data/lib/openwfe/util/workqueue.rb +5 -11
  50. data/lib/openwfe/utils.rb +3 -3
  51. data/lib/openwfe/version.rb +1 -2
  52. data/lib/openwfe/workitem.rb +3 -4
  53. data/lib/openwfe/worklist/oldrest.rb +244 -0
  54. data/lib/openwfe/worklist/storelocks.rb +288 -0
  55. data/lib/openwfe/worklist/storeparticipant.rb +4 -2
  56. data/lib/openwfe/worklist/worklist.rb +297 -0
  57. data/test/cron_test.rb +8 -9
  58. data/test/eno_test.rb +10 -13
  59. data/test/flowtestbase.rb +26 -17
  60. data/test/ft_15_iterator.rb +19 -0
  61. data/test/ft_23c_wait.rb +2 -2
  62. data/test/ft_2b_concurrence.rb +2 -2
  63. data/test/ft_30_socketlistener.rb +5 -1
  64. data/test/ft_32_journal.rb +1 -1
  65. data/test/ft_32c_journal.rb +102 -0
  66. data/test/ft_32d_journal.rb +85 -0
  67. data/test/ft_45_citerator.rb +25 -0
  68. data/test/ft_49_condition.rb +60 -2
  69. data/test/ft_4_misc.rb +15 -0
  70. data/test/ft_50_xml_attribute.rb +4 -4
  71. data/test/ft_53_null_noop_participant.rb +66 -0
  72. data/test/ft_54_listen.rb +223 -0
  73. data/test/ft_55_ptimeout.rb +64 -0
  74. data/test/ft_56_timeout.rb +55 -0
  75. data/test/ft_57_a.rb +109 -0
  76. data/test/ft_tests.rb +7 -0
  77. data/test/hparticipant_test.rb +3 -3
  78. data/test/obs_test.rb +115 -0
  79. data/test/orest_test.rb +224 -0
  80. data/test/pending.rb +24 -0
  81. data/test/rake_qtest.rb +5 -1
  82. data/test/rake_test.rb +4 -0
  83. data/test/scheduler_test.rb +31 -2
  84. data/test/sec_test.rb +7 -3
  85. data/test/slock_test.rb +82 -0
  86. metadata +19 -3
  87. data/test/ft_32b_journal.rb +0 -76
@@ -51,11 +51,6 @@ module OpenWFE
51
51
  #
52
52
  class ControlClient < RestClient
53
53
 
54
- def initialize (server, port, username, password)
55
-
56
- super('http://'+server+':'+port.to_s(), username, password)
57
- end
58
-
59
54
  def initialize (url, username, password)
60
55
 
61
56
  super(url, username, password)
@@ -67,7 +62,7 @@ module OpenWFE
67
62
  def list_expressions ()
68
63
 
69
64
  r = self.get('listexpressions', nil, nil)
70
- return decode(r)
65
+ decode(r)
71
66
  end
72
67
 
73
68
  #
@@ -80,7 +75,7 @@ module OpenWFE
80
75
  params['id'] = workflowInstanceId
81
76
 
82
77
  r = self.get('getflowposition', nil, params)
83
- return decode(r)
78
+ decode(r)
84
79
  end
85
80
 
86
81
  #
@@ -92,7 +87,7 @@ module OpenWFE
92
87
 
93
88
  params = {}
94
89
 
95
- return decode(self.post('cancelexpression', nil, params, fei))
90
+ decode(self.post('cancelexpression', nil, params, fei))
96
91
  end
97
92
 
98
93
  #
@@ -104,7 +99,7 @@ module OpenWFE
104
99
 
105
100
  params = {}
106
101
 
107
- return decode(self.post('freezeexpression', nil, params, fei))
102
+ decode(self.post('freezeexpression', nil, params, fei))
108
103
  end
109
104
 
110
105
  #
@@ -116,17 +111,9 @@ module OpenWFE
116
111
 
117
112
  params = {}
118
113
 
119
- return decode(self.post('unfreezeexpression', nil, params, fei))
114
+ decode(self.post('unfreezeexpression', nil, params, fei))
120
115
  end
121
116
 
122
- protected
123
-
124
- def decode (reply)
125
-
126
- xml = REXML::Document.new(reply.body)
127
- return OpenWFE.xml_decode(xml.root)
128
- end
129
-
130
117
  end
131
118
 
132
119
  end
@@ -0,0 +1,279 @@
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
+ #
34
+
35
+ #
36
+ # "made in Japan"
37
+ #
38
+ # John Mettraux at openwfe.org
39
+ #
40
+
41
+ require 'thread'
42
+ require 'webrick'
43
+ require 'rexml/document'
44
+ require 'openwfe/rest/xmlcodec'
45
+
46
+
47
+ module OpenWFE
48
+
49
+ #
50
+ # A common parent class for the worklist and the engine old-style (2002)
51
+ # REST interface.
52
+ #
53
+ class OldRestServlet < WEBrick::HTTPServlet::AbstractServlet
54
+
55
+ MUTEX = Mutex.new
56
+ CT = "Content-Type"
57
+
58
+ def initialize (server, params)
59
+
60
+ super
61
+
62
+ @auth_system = params[:AuthSystem] || {}
63
+
64
+ @realm_name = get_realm_name
65
+
66
+ @last_given_session_id = -1
67
+ @sessions = {}
68
+ end
69
+
70
+ #
71
+ # this default implementation returns "no_realm".
72
+ #
73
+ def get_realm_name
74
+ "no_realm"
75
+ end
76
+
77
+ def service req, res
78
+
79
+ if req.request_method == 'POST'
80
+ class << req
81
+ def parse_query
82
+ @query = WEBrick::HTTPUtils::parse_query(@query_string)
83
+ end
84
+ end
85
+ end
86
+
87
+ username = authenticate req, res
88
+
89
+ if req.query_string == nil
90
+
91
+ get_new_session username, req, res
92
+ return
93
+ end
94
+
95
+ req.attributes['username'] = username
96
+
97
+ action = req.query["action"]
98
+ action = action.downcase if action
99
+
100
+ if action == "endworksession"
101
+ end_work_session req, res
102
+ return
103
+ end
104
+
105
+ action_method = "do__#{action}".intern
106
+
107
+ unless self.respond_to?(action_method)
108
+ action_not_implemented action, res
109
+ return
110
+ end
111
+
112
+ begin
113
+ self.send action_method, req, res
114
+ rescue Exception => e
115
+ reply_with_exception res, e
116
+ end
117
+ end
118
+
119
+ #
120
+ # Returns always the same servlet instance.
121
+ #
122
+ def self.get_instance (server, *options)
123
+ MUTEX.synchronize do
124
+ return @__instance__ if @__instance__
125
+ @__instance__ = self.new(server, *options)
126
+ end
127
+ end
128
+
129
+ protected
130
+
131
+ def reply_with_error (res, code, error_message)
132
+
133
+ res.status = code
134
+ res[CT] = "text/plain"
135
+ res.body = error_message
136
+ end
137
+
138
+ def reply_with_exception (res, exception)
139
+
140
+ message = exception.message
141
+
142
+ ms = message.split
143
+
144
+ code = 500
145
+ body = message
146
+
147
+ if ms.length > 1 and ms[0].to_i != 0
148
+ code = Integer(ms[0])
149
+ body = message[4..-1]
150
+ end
151
+
152
+ message << "\n"
153
+ message << OpenWFE::exception_to_s(exception)
154
+ message << "\n"
155
+
156
+ reply_with_error(res, code, body)
157
+ end
158
+
159
+ def reply_with_xml (res, code, xml)
160
+
161
+ res.status = code
162
+ res[CT] = "application/xml"
163
+
164
+ if xml.kind_of?(REXML::Element)
165
+ doc = REXML::Document.new
166
+ doc << xml
167
+ xml = OpenWFE::xml_to_s(doc)
168
+ end
169
+
170
+ res.body = xml
171
+ end
172
+
173
+ def end_work_session (req, res)
174
+
175
+ sid = req.query['session']
176
+ @sessions.delete(Integer(sid)) if sid
177
+
178
+ @logger.debug "end_work_session() #{sid}"
179
+ #@logger.debug "end_work_session() sessions : #{@sessions.size}"
180
+
181
+ reply_with_xml(res, 200, REXML::Element.new('bye'))
182
+ end
183
+
184
+ def authenticate req, res
185
+
186
+ user = nil
187
+
188
+ WEBrick::HTTPAuth::basic_auth(req, res, @realm_name) do |u, p|
189
+
190
+ user = get_session_user req
191
+
192
+ if user
193
+ true
194
+ else
195
+ user = u
196
+ _authenticate u, p
197
+ end
198
+ end
199
+
200
+ user
201
+ end
202
+
203
+ def _authenticate user, pass
204
+
205
+ if @auth_system.kind_of?(Hash)
206
+ @auth_system[user] == pass
207
+ elsif @auth_system.kind_of?(Proc)
208
+ @auth_system.call user, pass
209
+ elsif @auth_system.respond_to?(:authenticate)
210
+ @auth_system.authenticate user, pass
211
+ else
212
+ false
213
+ end
214
+ end
215
+
216
+ def determine_agent (req)
217
+
218
+ req.addr.join "|"
219
+ end
220
+
221
+ def get_new_session username, req, res
222
+
223
+ sid = new_session_id
224
+
225
+ @sessions[sid] = [
226
+ username,
227
+ determine_agent(req),
228
+ Time.now.to_i
229
+ ]
230
+
231
+ @logger.debug "get_new_session() #{sid}"
232
+ #@logger.debug "get_new_session() sessions : #{@sessions.size}"
233
+
234
+ esess = REXML::Element.new 'session'
235
+ esess.add_attribute 'id', sid
236
+
237
+ reply_with_xml res, 200, esess
238
+ end
239
+
240
+ def action_not_implemented action, res
241
+
242
+ reply_with_error(
243
+ res, 404, "action '#{action}' is not implemented.")
244
+ end
245
+
246
+ def new_session_id
247
+ MUTEX.synchronize do
248
+
249
+ id = Integer(Time.new.to_f * 100000)
250
+
251
+ id = @last_given_session_id + 1 \
252
+ if id <= @last_given_session_id
253
+
254
+ @last_given_session_id = id
255
+ id
256
+ end
257
+ end
258
+
259
+ def get_session_user (req)
260
+
261
+ sid = req.query['session']
262
+
263
+ @logger.debug "get_session_user() sid : #{sid}"
264
+
265
+ return nil unless sid
266
+
267
+ s = @sessions[Integer(sid)]
268
+
269
+ return nil unless s
270
+
271
+ username, agent, last_seen = s
272
+
273
+ return username if agent == determine_agent(req)
274
+
275
+ nil
276
+ end
277
+ end
278
+ end
279
+
@@ -41,6 +41,8 @@ require 'base64'
41
41
  require 'net/http'
42
42
  require 'rexml/document'
43
43
 
44
+ require 'openwfe/version'
45
+
44
46
 
45
47
  module OpenWFE
46
48
 
@@ -63,25 +65,51 @@ module OpenWFE
63
65
  #
64
66
  # Closes this REST client
65
67
  #
66
- def close ()
67
-
68
- post('endWorkSession', nil, {}, nil)
68
+ def close
69
+ get('endWorkSession', nil, {})
69
70
  end
70
71
 
71
72
  protected
72
73
 
74
+ def decode (reply)
75
+
76
+ raise "Error : #{reply.code} - #{reply.body}" \
77
+ if reply.code != "200"
78
+
79
+ begin
80
+ xml = REXML::Document.new reply.body
81
+ OpenWFE::XmlCodec::decode xml.root
82
+ rescue Exception => e
83
+ if $DEBUG
84
+ #puts
85
+ #puts e.to_s
86
+ puts
87
+ puts "failed to decode reply :"
88
+ puts
89
+ puts reply.body
90
+ puts
91
+ end
92
+ raise e
93
+ end
94
+ end
95
+
96
+ #
97
+ # GETs a REST operation
98
+ #
73
99
  def get (action, subResourceName, params)
74
100
 
75
- return @httpclient\
76
- .get(compute_resource(action, subResourceName, params))
101
+ @httpclient.get(
102
+ compute_resource(action, subResourceName, params))
77
103
  end
78
104
 
105
+ #
106
+ # POSTs a REST operation
107
+ #
79
108
  def post (action, subResourceName, params, data)
80
109
 
81
- data = data.to_s()
82
-
83
- return @httpclient\
84
- .post(compute_resource(action, subResourceName, params), data)
110
+ @httpclient.post(
111
+ compute_resource(action, subResourceName, params),
112
+ data.to_s)
85
113
  end
86
114
 
87
115
  private
@@ -95,7 +123,7 @@ module OpenWFE
95
123
  url = url[7..-1] if url[0..6] == 'http://'
96
124
 
97
125
  i = url.index('/')
98
- if i < 0
126
+ unless i
99
127
  @resource = '/defaultrestresource'
100
128
  else
101
129
  @resource = url[i..-1]
@@ -117,31 +145,33 @@ module OpenWFE
117
145
 
118
146
  hs = {}
119
147
  hs['Authorization'] = \
120
- 'Basic ' + Base64.encode64(@username+":"+password)
121
- hs['RestClient'] = 'openwfe-ruby'
148
+ 'Basic ' + Base64.encode64(@username+":"+password).strip
149
+ hs['RestClient'] = "openwfe-ruby #{OPENWFERU_VERSION}"
150
+ hs['User-Agent'] = "openwfe-ruby #{OPENWFERU_VERSION}"
151
+
152
+ #puts "@resource is '#{@resource}'"
153
+ #puts "hs is '#{hs.inspect}'"
122
154
 
123
155
  r = @httpclient.get(@resource, hs)
124
156
 
125
- xml = REXML::Document.new(r.body)
157
+ #xml = REXML::Document.new(r.body)
158
+ #@session_id = Integer(xml.root.attributes["id"])
126
159
 
127
- @session_id = Integer(xml.root.attributes["id"])
160
+ @session_id = decode r
128
161
  end
129
162
 
130
- def compute_resource (action, subResourceName, params)
163
+ def compute_resource (action, sub_resource_name, params)
131
164
 
132
- resource = @resource
133
- resource = resource+'/'+subResourceName if subResourceName
165
+ reso = @resource.dup
166
+ reso += "/#{sub_resource_name}" if sub_resource_name
134
167
 
135
- resource = resource+\
136
- '?session='+@session_id.to_s()+'&action='+action
168
+ reso += "?session=#{@session_id.to_s}&action=#{action}"
137
169
 
138
- if params
139
- params.keys.each do |k|
140
- resource = resource+'&'+k.to_s()+'='+params[k].to_s()
141
- end
142
- end
170
+ params.each { |k, v|
171
+ reso += "&#{k.to_s}=#{v.to_s}"
172
+ } if params
143
173
 
144
- return resource
174
+ reso
145
175
  end
146
176
  end
147
177
  end
@@ -49,22 +49,16 @@ module OpenWFE
49
49
  #
50
50
  class WorklistClient < RestClient
51
51
 
52
- def initialize (server, port, username, password)
53
-
54
- super('http://'+server+':'+port.to_s(), username, password)
55
- end
56
-
57
52
  def initialize (url, username, password)
58
-
59
- super(url, username, password)
53
+ super
60
54
  end
61
55
 
62
56
  #
63
57
  # Returns the list of stores the worklist hosts
64
58
  #
65
- def list_stores ()
66
- r = self.get('listStores', nil, nil)
67
- return decode(r)
59
+ def list_stores
60
+ r = get('listStores', nil, nil)
61
+ decode(r)
68
62
  end
69
63
 
70
64
  #
@@ -80,15 +74,18 @@ module OpenWFE
80
74
  params = {}
81
75
  params["limit"] = limit
82
76
 
83
- return decode(self.get('getHeaders', storeName, params))
77
+ decode(get('getHeaders', storeName, params))
84
78
  end
85
79
 
86
- def find_flow_instance (storeName, workflowInstanceId)
80
+ #
81
+ # TODO : rdoc me
82
+ #
83
+ def find_flow_instance (store_name, workflow_instance_id)
87
84
 
88
85
  params = {}
89
- params["id"] = workflowInstanceId
86
+ params["id"] = workflow_instance_id
90
87
 
91
- return decode(self.get('findFlowInstance', storeName, params))
88
+ decode(get('findFlowInstance', store_name, params))
92
89
  end
93
90
 
94
91
  #
@@ -98,12 +95,12 @@ module OpenWFE
98
95
  #
99
96
  def launch_flow (engineId, launchitem)
100
97
 
101
- eli = OpenWFE.xml_encode(launchitem)
98
+ eli = OpenWFE::XmlCodec::encode(launchitem)
102
99
 
103
100
  params = {}
104
101
  params[ENGINEID] = engineId
105
102
 
106
- return decode(self.post('launchFlow', nil, params, eli))
103
+ decode(post('launchFlow', nil, params, eli))
107
104
  end
108
105
 
109
106
  #
@@ -113,7 +110,7 @@ module OpenWFE
113
110
  #
114
111
  def get_workitem (storeName, flowExpressionId)
115
112
 
116
- return get_item('getWorkitem', storeName, flowExpressionId)
113
+ get_item('getWorkitem', storeName, flowExpressionId)
117
114
  end
118
115
 
119
116
  #
@@ -125,7 +122,7 @@ module OpenWFE
125
122
 
126
123
  #puts "...getAndLockWorkitem() for #{flowExpressionId}"
127
124
 
128
- return get_item('getAndLockWorkitem', storeName, flowExpressionId)
125
+ get_item('getAndLockWorkitem', storeName, flowExpressionId)
129
126
  end
130
127
 
131
128
  #
@@ -154,16 +151,15 @@ module OpenWFE
154
151
 
155
152
  #puts " .ok is #{ok}"
156
153
  #puts " .id is #{h.flowExpressionId}"
157
- break if not ok
154
+ break unless ok
158
155
  end
159
156
 
160
157
  #puts " .id is #{h.flowExpressionId}"
161
158
 
162
- return get_and_lock_workitem(storeName, h.flow_expression_id) \
163
- if ok
159
+ get_and_lock_workitem(storeName, h.flow_expression_id) if ok
164
160
  end
165
161
 
166
- return nil
162
+ nil
167
163
  end
168
164
 
169
165
  #
@@ -172,7 +168,7 @@ module OpenWFE
172
168
  #
173
169
  def release_workitem (workitem)
174
170
 
175
- return post_item('releaseWorkitem', workitem)
171
+ post_item('releaseWorkitem', workitem)
176
172
  end
177
173
 
178
174
  #
@@ -180,7 +176,7 @@ module OpenWFE
180
176
  #
181
177
  def save_workitem (workitem)
182
178
 
183
- return post_item('saveWorkitem', workitem)
179
+ post_item('saveWorkitem', workitem)
184
180
  end
185
181
 
186
182
  #
@@ -189,9 +185,11 @@ module OpenWFE
189
185
  #
190
186
  def proceed_workitem (workitem)
191
187
 
192
- return post_item('forwardWorkitem', workitem)
188
+ post_item('forwardWorkitem', workitem)
193
189
  end
194
190
 
191
+ alias :forward_workitem :proceed_workitem
192
+
195
193
  #
196
194
  # Returns the list of flow URLs the user owning this session may
197
195
  # launch.
@@ -200,8 +198,7 @@ module OpenWFE
200
198
 
201
199
  params = {}
202
200
 
203
- #return decode(post('listLaunchables', nil, params, nil))
204
- return decode(get('listLaunchables', nil, params))
201
+ decode(get('listLaunchables', nil, params))
205
202
  end
206
203
 
207
204
  #
@@ -214,7 +211,7 @@ module OpenWFE
214
211
  params = {}
215
212
  params[TARGETSTORE] = targetStoreName
216
213
 
217
- return decode(post('delegate', workitem.store, params, ewi))
214
+ decode(post('delegate', workitem.store, params, ewi))
218
215
  end
219
216
 
220
217
  #
@@ -228,7 +225,7 @@ module OpenWFE
228
225
  params = {}
229
226
  params[TARGETPARTICIPANT] = targetParticipantName
230
227
 
231
- return decode(post('delegate', workitem.store, params, ewi))
228
+ decode(post('delegate', workitem.store, params, ewi))
232
229
  end
233
230
 
234
231
  #def queryStore (storeName, query)
@@ -236,33 +233,27 @@ module OpenWFE
236
233
 
237
234
  protected
238
235
 
239
- def decode (reply)
240
-
241
- xml = REXML::Document.new(reply.body)
242
- return OpenWFE.xml_decode(xml.root)
243
- end
244
-
245
- def get_item (restMethodName, storeName, flowExpressionId)
236
+ def get_item (rest_method_name, store_name, flow_expression_id)
246
237
 
247
- fei = OpenWFE.xml_encode(flowExpressionId)
248
- fei = OpenWFE.xmldoc_to_string(fei, false)
238
+ fei = OpenWFE::XmlCodec::encode flow_expression_id
239
+ fei = OpenWFE::xmldoc_to_string fei, false
249
240
 
250
241
  params = {}
251
242
 
252
- wi = decode(self.post(restMethodName, storeName, params, fei))
243
+ wi = decode(post(rest_method_name, store_name, params, fei))
253
244
 
254
- wi.store = storeName if wi
245
+ wi.store = store_name if wi
255
246
 
256
- return wi
247
+ wi
257
248
  end
258
249
 
259
- def post_item (restMethodName, workitem)
250
+ def post_item (rest_method_name, workitem)
260
251
 
261
- ewi = OpenWFE.xml_encode(workitem)
252
+ ewi = OpenWFE::XmlCodec::encode(workitem)
262
253
 
263
254
  params = {}
264
255
 
265
- return decode(post(restMethodName, workitem.store, params, ewi))
256
+ decode(post(rest_method_name, workitem.store, params, ewi))
266
257
  end
267
258
 
268
259
  end