openwferu 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Copyright (c) 2006, John Mettraux, OpenWFE.org
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2006-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 2725 2006-06-02 13:26:32Z jmettraux $
|
34
34
|
#
|
@@ -40,11 +40,12 @@
|
|
40
40
|
#
|
41
41
|
|
42
42
|
require 'monitor'
|
43
|
-
require 'otime'
|
44
|
-
require 'ru/ruutils'
|
45
43
|
|
44
|
+
require 'openwfe/otime'
|
45
|
+
require 'openwfe/utils'
|
46
46
|
|
47
|
-
|
47
|
+
|
48
|
+
module OpenWFE
|
48
49
|
|
49
50
|
class Scheduler
|
50
51
|
include MonitorMixin
|
@@ -110,7 +111,7 @@ module OpenWFEru
|
|
110
111
|
rescue Exception => e
|
111
112
|
#puts \
|
112
113
|
# "step() caught exception\n" +
|
113
|
-
#
|
114
|
+
# OpenWFE::exception_to_s(e)
|
114
115
|
end
|
115
116
|
|
116
117
|
#
|
@@ -156,11 +157,18 @@ module OpenWFEru
|
|
156
157
|
def schedule_at (at, schedulable, params)
|
157
158
|
synchronize do
|
158
159
|
|
160
|
+
#puts "0 at is '#{at.to_s}' (#{at.class})"
|
161
|
+
|
159
162
|
at = OpenWFE::to_ruby_time(at) \
|
160
|
-
if at.kind_of?
|
163
|
+
if at.kind_of? String
|
164
|
+
|
165
|
+
at = OpenWFE::to_gm_time(at) \
|
166
|
+
if at.kind_of? DateTime
|
161
167
|
|
162
168
|
at = at.to_f \
|
163
|
-
if at.kind_of?
|
169
|
+
if at.kind_of? Time
|
170
|
+
|
171
|
+
#puts "1 at is '#{at.to_s}' (#{at.class})"
|
164
172
|
|
165
173
|
job = JobEntry.new(at, schedulable, params)
|
166
174
|
|
@@ -210,7 +218,7 @@ module OpenWFEru
|
|
210
218
|
synchronize do
|
211
219
|
|
212
220
|
for i in 0...@pending_jobs.length
|
213
|
-
if @pending_jobs[i].
|
221
|
+
if @pending_jobs[i].eid == entry_id
|
214
222
|
@pending_jobs.delete_at(i)
|
215
223
|
return true
|
216
224
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
|
-
|
3
|
-
# Copyright (c) 2006, John Mettraux, OpenWFE.org
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2006-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 2725 2006-06-02 13:26:32Z jmettraux $
|
34
34
|
#
|
@@ -39,15 +39,15 @@
|
|
39
39
|
# John Mettraux at openwfe.org
|
40
40
|
#
|
41
41
|
|
42
|
-
require '
|
43
|
-
require '
|
42
|
+
require 'openwfe/service'
|
43
|
+
require 'openwfe/util/scheduler'
|
44
44
|
|
45
45
|
|
46
|
-
module
|
46
|
+
module OpenWFE
|
47
47
|
|
48
48
|
#
|
49
49
|
# The Scheduler class has been made independant of OpenWFE service
|
50
|
-
# infrastructure (so that one could easily use it without
|
50
|
+
# infrastructure (so that one could easily use it without OpenWFE)
|
51
51
|
#
|
52
52
|
class SchedulerService < Scheduler
|
53
53
|
include ServiceMixin
|
@@ -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
|
@@ -34,7 +34,7 @@
|
|
34
34
|
#
|
35
35
|
|
36
36
|
#
|
37
|
-
# "hecho en Costa Rica"
|
37
|
+
# "hecho en Costa Rica" and "made in Japan"
|
38
38
|
#
|
39
39
|
# john.mettraux@openwfe.org
|
40
40
|
#
|
@@ -45,17 +45,17 @@ module OpenWFE
|
|
45
45
|
# Returns the first subelt of xmlElt that matches the given xpath.
|
46
46
|
# If xpath is null, the first elt will be returned.
|
47
47
|
#
|
48
|
-
def OpenWFE.
|
48
|
+
def OpenWFE.first_element (xmlElt, elementName=nil)
|
49
49
|
|
50
50
|
return nil if not xmlElt
|
51
51
|
|
52
52
|
return xmlElt.elements[1] if not elementName
|
53
53
|
|
54
|
-
xmlElt.elements.each do |elt|
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
|
54
|
+
#xmlElt.elements.each do |elt|
|
55
|
+
# return elt if elt.name == elementName
|
56
|
+
#end
|
57
|
+
#return nil
|
58
|
+
xmlElt.elements.detect { |elt| elt.name == elementName }
|
59
59
|
end
|
60
60
|
|
61
61
|
#
|
@@ -99,7 +99,9 @@ module OpenWFE
|
|
99
99
|
|
100
100
|
return nil if object == nil
|
101
101
|
|
102
|
-
return object if object.kind_of?
|
102
|
+
return object if object.kind_of? Fixnum
|
103
|
+
return object if object.kind_of? TrueClass
|
104
|
+
return object if object.kind_of? FalseClass
|
103
105
|
|
104
106
|
o = object.class.new
|
105
107
|
|
@@ -138,6 +140,88 @@ module OpenWFE
|
|
138
140
|
|
139
141
|
return o
|
140
142
|
end
|
143
|
+
|
144
|
+
def OpenWFE.to_underscore (string)
|
145
|
+
replace_char(string, "-", "_")
|
146
|
+
end
|
147
|
+
|
148
|
+
def OpenWFE.to_dash (string)
|
149
|
+
replace_char(string, "_", "-")
|
150
|
+
end
|
151
|
+
|
152
|
+
def OpenWFE.replace_char (string, from, to)
|
153
|
+
s = ""
|
154
|
+
0.upto(string.length) do |i|
|
155
|
+
c = string[i, 1]
|
156
|
+
s << if c == from
|
157
|
+
to
|
158
|
+
else
|
159
|
+
c
|
160
|
+
end
|
161
|
+
end
|
162
|
+
return s
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# Returns true if the given string starts with the 'start' string.
|
167
|
+
#
|
168
|
+
def OpenWFE.starts_with (string, start)
|
169
|
+
#
|
170
|
+
# my favourite way of doing that would be by adding this
|
171
|
+
# method to the String class, but that could be intrusive
|
172
|
+
# (as OpenWFE is meant at first as an embeddable workflow engine).
|
173
|
+
#
|
174
|
+
return false if not string
|
175
|
+
return false if string.length < start.length
|
176
|
+
return string[0, start.length] == start
|
177
|
+
end
|
178
|
+
|
179
|
+
#
|
180
|
+
# Returns true if the given string ends with the '_end' string.
|
181
|
+
#
|
182
|
+
def OpenWFE.ends_with (string, _end)
|
183
|
+
return false if not string
|
184
|
+
return false if string.length < _end.length
|
185
|
+
return string[-_end.length..-1] == _end
|
186
|
+
end
|
187
|
+
|
188
|
+
#
|
189
|
+
# Attempts at displaying a nice stack trace
|
190
|
+
#
|
191
|
+
def OpenWFE.exception_to_s (exception)
|
192
|
+
s = ""
|
193
|
+
s << "#{exception}\n"
|
194
|
+
s << exception.backtrace.join("\n")
|
195
|
+
return s
|
196
|
+
end
|
197
|
+
|
198
|
+
#
|
199
|
+
# Pretty printing a caller() array
|
200
|
+
#
|
201
|
+
def OpenWFE.caller_to_s (start_index, max_lines=nil)
|
202
|
+
s = ""
|
203
|
+
caller(start_index + 1).each_with_index do |line, index|
|
204
|
+
break if max_lines and index >= max_lines
|
205
|
+
s << " #{line}\n"
|
206
|
+
end
|
207
|
+
return s
|
208
|
+
end
|
209
|
+
|
210
|
+
#
|
211
|
+
# A small Timer class for debug purposes.
|
212
|
+
#
|
213
|
+
class Timer
|
214
|
+
|
215
|
+
attr_reader :start
|
216
|
+
|
217
|
+
def initialize
|
218
|
+
@start = Time.now.to_f
|
219
|
+
end
|
220
|
+
|
221
|
+
def duration
|
222
|
+
return (Time.now.to_f - @start) * 1000
|
223
|
+
end
|
224
|
+
end
|
141
225
|
|
142
226
|
end
|
143
227
|
|
@@ -0,0 +1,366 @@
|
|
1
|
+
#
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2005-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: workitem.rb 3556 2006-11-13 04:15:52Z jmettraux $
|
34
|
+
#
|
35
|
+
|
36
|
+
#
|
37
|
+
# "hecho en Costa Rica"
|
38
|
+
#
|
39
|
+
# john.mettraux@openwfe.org
|
40
|
+
#
|
41
|
+
|
42
|
+
require 'base64'
|
43
|
+
|
44
|
+
require 'openwfe/utils'
|
45
|
+
|
46
|
+
require 'openwfe/rest/definitions'
|
47
|
+
# hmmm, only used for MAP_TYPE
|
48
|
+
|
49
|
+
|
50
|
+
module OpenWFE
|
51
|
+
|
52
|
+
#
|
53
|
+
# WORKITEMS
|
54
|
+
#
|
55
|
+
|
56
|
+
#
|
57
|
+
# The base class for all the workitems.
|
58
|
+
#
|
59
|
+
class WorkItem
|
60
|
+
|
61
|
+
attr_accessor :last_modified, :attributes
|
62
|
+
|
63
|
+
def initialize ()
|
64
|
+
|
65
|
+
@last_modified = nil
|
66
|
+
|
67
|
+
@attributes = {}
|
68
|
+
@attributes[MAP_TYPE] = E_SMAP
|
69
|
+
end
|
70
|
+
|
71
|
+
alias :fields :attributes
|
72
|
+
alias :fields= :attributes=
|
73
|
+
|
74
|
+
#
|
75
|
+
# In order to simplify code like :
|
76
|
+
#
|
77
|
+
# value = workitem.attributes['xyz']
|
78
|
+
#
|
79
|
+
# to
|
80
|
+
#
|
81
|
+
# value = workitem.xyz
|
82
|
+
#
|
83
|
+
# or
|
84
|
+
#
|
85
|
+
# value = workitem['xyz']
|
86
|
+
#
|
87
|
+
# we overrode method_missing.
|
88
|
+
#
|
89
|
+
# workitem.xyz = "my new value"
|
90
|
+
#
|
91
|
+
# is also possible
|
92
|
+
#
|
93
|
+
def method_missing (m, *args)
|
94
|
+
|
95
|
+
methodname = m.to_s
|
96
|
+
|
97
|
+
if args.length == 0
|
98
|
+
value = @attributes[methodname]
|
99
|
+
return value if value
|
100
|
+
raise "Missing attribute '#{methodname}' in workitem"
|
101
|
+
end
|
102
|
+
|
103
|
+
if methodname == "[]" and args.length == 1
|
104
|
+
value = @attributes[args[0]]
|
105
|
+
return value if value
|
106
|
+
raise "Missing attribute '#{methodname}' in workitem"
|
107
|
+
end
|
108
|
+
|
109
|
+
if methodname == "[]=" and args.length == 2
|
110
|
+
return @attributes[args[0]] = args[1]
|
111
|
+
end
|
112
|
+
|
113
|
+
if args.length == 1 and methodname[-1, 1] == "="
|
114
|
+
return @attributes[methodname[0..-2]] = args[0]
|
115
|
+
end
|
116
|
+
|
117
|
+
super(m, args)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
#
|
122
|
+
# The common parent class for InFlowWorkItem and CancelItem.
|
123
|
+
#
|
124
|
+
class InFlowItem < WorkItem
|
125
|
+
|
126
|
+
attr_accessor :flow_expression_id, :participant_name
|
127
|
+
|
128
|
+
def last_expression_id
|
129
|
+
return @flow_expression_id
|
130
|
+
end
|
131
|
+
|
132
|
+
def last_expression_id= (fei)
|
133
|
+
@flow_expression_id = fei
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# Just a handy alias for flow_expression_id
|
138
|
+
#
|
139
|
+
alias fei flow_expression_id
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# When the term 'workitem' is used it's generally referring to instances
|
144
|
+
# of this InFlowWorkItem class.
|
145
|
+
# InFlowWorkItem are circulating within process instances and carrying
|
146
|
+
# data around. Their 'payload' is located in their attribute Hash field.
|
147
|
+
#
|
148
|
+
class InFlowWorkItem < InFlowItem
|
149
|
+
|
150
|
+
attr_accessor :dispatch_time, :filter, :history
|
151
|
+
|
152
|
+
attr_accessor :store
|
153
|
+
#
|
154
|
+
# special : added by the ruby lib, not given by the worklist
|
155
|
+
|
156
|
+
def dup
|
157
|
+
return OpenWFE::dup(self)
|
158
|
+
end
|
159
|
+
|
160
|
+
#
|
161
|
+
# Outputting the workitem in a human readable format
|
162
|
+
#
|
163
|
+
def to_s
|
164
|
+
s = ""
|
165
|
+
s << " >>>#{self.class}>>>\n"
|
166
|
+
s << " - flow_expression_id : #{@flow_expression_id}\n"
|
167
|
+
s << " - participant_name : #{@participant_name}\n"
|
168
|
+
s << " - last_modified : #{@last_modified}\n"
|
169
|
+
s << " - dispatch_time : #{@dispatch_time}\n"
|
170
|
+
s << " - attributes :\n"
|
171
|
+
@attributes.each do |k, v|
|
172
|
+
s << " * '#{k}' --> '#{v}'\n"
|
173
|
+
end
|
174
|
+
s << " <<<#{self.class}<<<"
|
175
|
+
return s
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
#
|
180
|
+
# When it needs to cancel a branch of a process instance, the engine
|
181
|
+
# emits a CancelItem towards it.
|
182
|
+
# It's especially important for participants to react correctly upon
|
183
|
+
# receiving a cancel item.
|
184
|
+
#
|
185
|
+
class CancelItem < InFlowItem
|
186
|
+
end
|
187
|
+
|
188
|
+
#
|
189
|
+
# LaunchItem instances are used to instantiate and launch processes.
|
190
|
+
# They contain attributes that are used as the initial payload of the
|
191
|
+
# workitem circulating in the process instances.
|
192
|
+
#
|
193
|
+
class LaunchItem < WorkItem
|
194
|
+
|
195
|
+
attr_accessor :workflow_definition_url
|
196
|
+
#, :description_map
|
197
|
+
|
198
|
+
#
|
199
|
+
# This constructor will build an empty launchitem.
|
200
|
+
# If the optional parameter process_definition is set, the
|
201
|
+
# definition will be embedded in the launchitem attributes
|
202
|
+
# for retrieval by the engine.
|
203
|
+
#
|
204
|
+
def initialize (process_definition=nil)
|
205
|
+
|
206
|
+
super()
|
207
|
+
|
208
|
+
if process_definition
|
209
|
+
@workflow_definition_url = "field:__definition"
|
210
|
+
@attributes['__definition'] = process_definition
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
|
216
|
+
#
|
217
|
+
# HISTORY ITEM
|
218
|
+
#
|
219
|
+
|
220
|
+
#
|
221
|
+
# HistoryItem instances are used to keep track of what happened to
|
222
|
+
# a workitem.
|
223
|
+
#
|
224
|
+
class HistoryItem
|
225
|
+
|
226
|
+
attr_accessor \
|
227
|
+
:date, \
|
228
|
+
:author, \
|
229
|
+
:host, \
|
230
|
+
:text, \
|
231
|
+
:wfd_name, \
|
232
|
+
:wfd_revision, \
|
233
|
+
:wf_instance_id, \
|
234
|
+
:expression_id
|
235
|
+
|
236
|
+
def dup
|
237
|
+
return OpenWFE::dup(self)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
|
242
|
+
#
|
243
|
+
# STORES
|
244
|
+
#
|
245
|
+
|
246
|
+
#
|
247
|
+
# Models the information about a store as viewed by the current user
|
248
|
+
# (upon calling the listStores or getStoreNames methods)
|
249
|
+
#
|
250
|
+
class Store
|
251
|
+
|
252
|
+
attr_accessor :name, :workitem_count, :permissions
|
253
|
+
|
254
|
+
def initialize ()
|
255
|
+
super()
|
256
|
+
#@name = nil
|
257
|
+
#@workitem_count = nil
|
258
|
+
#@permissions = nil
|
259
|
+
end
|
260
|
+
|
261
|
+
#
|
262
|
+
# Returns true if the current user may read headers and workitems
|
263
|
+
# from this store
|
264
|
+
#
|
265
|
+
def may_read? ()
|
266
|
+
return @permissions.index('r') > -1
|
267
|
+
end
|
268
|
+
|
269
|
+
#
|
270
|
+
# Returns true if the current user may modify workitems (and at least
|
271
|
+
# proceed/forward them) in this store
|
272
|
+
#
|
273
|
+
def may_write? ()
|
274
|
+
return @permissions.index('w') > -1
|
275
|
+
end
|
276
|
+
|
277
|
+
#
|
278
|
+
# Returns true if the current user may browse the headers of this
|
279
|
+
# store
|
280
|
+
#
|
281
|
+
def may_browse? ()
|
282
|
+
return @permissions.index('b') > -1
|
283
|
+
end
|
284
|
+
|
285
|
+
#
|
286
|
+
# Returns true if the current user may delegate workitems to this store
|
287
|
+
#
|
288
|
+
def may_delegate? ()
|
289
|
+
return @permissions.index('d') > -1
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
#
|
294
|
+
# A header is a summary of a workitem, returned by the getHeader
|
295
|
+
# worklist method
|
296
|
+
#
|
297
|
+
class Header
|
298
|
+
|
299
|
+
attr_accessor \
|
300
|
+
:last_modified, :locked, :flow_expression_id, :attributes
|
301
|
+
end
|
302
|
+
|
303
|
+
|
304
|
+
#
|
305
|
+
# MISC ATTRIBUTES
|
306
|
+
#
|
307
|
+
# in openwfe-ruby, OpenWFE attributes are immediately mapped to
|
308
|
+
# Ruby instances, but some attributes still deserve their own class
|
309
|
+
#
|
310
|
+
|
311
|
+
#
|
312
|
+
# a wrapper for some binary content
|
313
|
+
#
|
314
|
+
class Base64Attribute
|
315
|
+
|
316
|
+
attr_accessor :content
|
317
|
+
|
318
|
+
def initialize (base64content)
|
319
|
+
|
320
|
+
@content = base64content
|
321
|
+
end
|
322
|
+
|
323
|
+
#
|
324
|
+
# dewraps (decode) the current content and returns it
|
325
|
+
#
|
326
|
+
def dewrap ()
|
327
|
+
|
328
|
+
return Base64.decode64(@content)
|
329
|
+
end
|
330
|
+
|
331
|
+
#
|
332
|
+
# wraps some binary content and stores it in this attribute
|
333
|
+
# (class method)
|
334
|
+
#
|
335
|
+
def Base64Attribute.wrap (binaryData)
|
336
|
+
|
337
|
+
return Base64Attribute.new(Base64.encode64(binaryData))
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
|
342
|
+
#
|
343
|
+
# LAUNCHABLE
|
344
|
+
#
|
345
|
+
|
346
|
+
#
|
347
|
+
# A worklist will return list of Launchable instances indicating
|
348
|
+
# what processes (URL) a user may launch on which engine.
|
349
|
+
#
|
350
|
+
class Launchable
|
351
|
+
|
352
|
+
attr_accessor :url, :engine_id
|
353
|
+
end
|
354
|
+
|
355
|
+
|
356
|
+
#
|
357
|
+
# Expression, somehow equivalent to FlowExpression, but only used
|
358
|
+
# by the control interface.
|
359
|
+
#
|
360
|
+
class Expression
|
361
|
+
|
362
|
+
attr_accessor :id, :apply_time, :state, :state_since
|
363
|
+
end
|
364
|
+
|
365
|
+
end
|
366
|
+
|