openwferu 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/{README → README.txt} +16 -13
  2. data/bin/validate-workflow.rb +46 -22
  3. data/examples/README.txt +8 -0
  4. data/examples/homeworkreview.rb +66 -0
  5. data/examples/quotereporter.rb +154 -0
  6. data/lib/{openwferu.rb → openwfe.rb} +6 -8
  7. data/lib/{ru → openwfe}/contextual.rb +11 -3
  8. data/lib/{ru → openwfe/engine}/engine.rb +50 -36
  9. data/lib/{ru/participant.rb → openwfe/engine/file_persisted_engine.rb} +21 -22
  10. data/lib/openwfe/expool/expressionpool.rb +534 -0
  11. data/lib/openwfe/expool/expstorage.rb +184 -0
  12. data/lib/openwfe/expool/journalexpstorage.rb +312 -0
  13. data/lib/openwfe/expool/yamlexpstorage.rb +127 -0
  14. data/lib/{ru → openwfe/expressions}/environment.rb +19 -14
  15. data/lib/{ru → openwfe/expressions}/expressionmap.rb +48 -21
  16. data/lib/{ru → openwfe/expressions}/fe_concurrence.rb +111 -35
  17. data/lib/openwfe/expressions/fe_cursor.rb +236 -0
  18. data/lib/{ru → openwfe/expressions}/fe_define.rb +5 -5
  19. data/lib/openwfe/expressions/fe_fqv.rb +99 -0
  20. data/lib/openwfe/expressions/fe_iterator.rb +182 -0
  21. data/lib/{ru/fe_misc.rb → openwfe/expressions/fe_losfor.rb} +14 -56
  22. data/lib/openwfe/expressions/fe_misc.rb +102 -0
  23. data/lib/{ru → openwfe/expressions}/fe_participant.rb +25 -14
  24. data/lib/{ru → openwfe/expressions}/fe_raw.rb +39 -75
  25. data/lib/{ru/fe_base.rb → openwfe/expressions/fe_sequence.rb} +40 -35
  26. data/lib/{ru → openwfe/expressions}/fe_subprocess.rb +30 -14
  27. data/lib/{ru → openwfe/expressions}/fe_time.rb +59 -31
  28. data/lib/{ru → openwfe/expressions}/fe_utils.rb +42 -26
  29. data/lib/{ru → openwfe/expressions}/fe_value.rb +20 -14
  30. data/lib/openwfe/expressions/flowexpression.rb +434 -0
  31. data/lib/openwfe/expressions/raw_prog.rb +391 -0
  32. data/lib/openwfe/expressions/raw_xml.rb +128 -0
  33. data/lib/openwfe/flowexpressionid.rb +148 -0
  34. data/lib/{ru → openwfe}/logging.rb +10 -6
  35. data/lib/{osocket.rb → openwfe/osocket.rb} +36 -35
  36. data/lib/{otime.rb → openwfe/otime.rb} +71 -21
  37. data/lib/openwfe/participants/atomparticipants.rb +144 -0
  38. data/lib/openwfe/participants/enoparticipant.rb +73 -0
  39. data/lib/openwfe/participants/participant.rb +85 -0
  40. data/lib/{ru → openwfe/participants}/participantmap.rb +40 -12
  41. data/lib/{ru → openwfe/participants}/participants.rb +41 -12
  42. data/lib/openwfe/participants/soapparticipants.rb +96 -0
  43. data/lib/{controlclient.rb → openwfe/rest/controlclient.rb} +12 -13
  44. data/lib/{definitions.rb → openwfe/rest/definitions.rb} +3 -3
  45. data/lib/{exception.rb → openwfe/rest/exception.rb} +3 -3
  46. data/lib/{restclient.rb → openwfe/rest/restclient.rb} +13 -22
  47. data/lib/{worklistclient.rb → openwfe/rest/worklistclient.rb} +33 -46
  48. data/lib/openwfe/rest/xmlcodec.rb +575 -0
  49. data/lib/{ru → openwfe}/rudefinitions.rb +32 -4
  50. data/lib/{ru → openwfe}/service.rb +20 -8
  51. data/lib/openwfe/storage/yamlfilestorage.rb +159 -0
  52. data/lib/{ru → openwfe/util}/dollar.rb +10 -8
  53. data/lib/openwfe/util/lru_cache.rb +149 -0
  54. data/lib/{ru → openwfe/util}/scheduler.rb +18 -10
  55. data/lib/{ru → openwfe/util}/schedulers.rb +7 -7
  56. data/lib/{utils.rb → openwfe/utils.rb} +93 -9
  57. data/lib/openwfe/workitem.rb +366 -0
  58. data/lib/openwfe/worklist/worklists.rb +175 -0
  59. data/test/README.txt +27 -0
  60. data/test/atomtest.rb +99 -0
  61. data/test/crontest.rb +58 -0
  62. data/test/dollartest.rb +3 -3
  63. data/test/feitest.rb +42 -14
  64. data/test/file_persistence_test.rb +93 -0
  65. data/test/flowtestbase.rb +72 -26
  66. data/test/ft_0.rb +1 -97
  67. data/test/ft_0b_sequence.rb +33 -0
  68. data/test/ft_0c_testname.rb +29 -0
  69. data/test/ft_10_loop.rb +48 -0
  70. data/test/ft_11_ppd.rb +292 -0
  71. data/test/ft_12_blockparticipant.rb +45 -0
  72. data/test/ft_13_eno.rb +51 -0
  73. data/test/ft_14_subprocess.rb +90 -0
  74. data/test/ft_14b_subprocess.rb +40 -0
  75. data/test/ft_15_iterator.rb +70 -0
  76. data/test/ft_16_fqv.rb +57 -0
  77. data/test/ft_1_unset.rb +25 -1
  78. data/test/ft_2_concurrence.rb +10 -5
  79. data/test/ft_3_equals.rb +35 -1
  80. data/test/ft_4_misc.rb +16 -1
  81. data/test/ft_5_time.rb +26 -1
  82. data/test/ft_6_lambda.rb +2 -1
  83. data/test/{ft_7_losfor.rb → ft_7_lose.rb} +41 -35
  84. data/test/ft_8_forget.rb +46 -0
  85. data/test/ft_9_cursor.rb +94 -0
  86. data/test/journal_persistence_test.rb +147 -0
  87. data/test/misctest.rb +13 -9
  88. data/test/rake_ptest.rb +18 -0
  89. data/test/rake_qtest.rb +43 -0
  90. data/test/{fulltest.rb → rake_test.rb} +2 -2
  91. data/test/raw_prog_test.rb +236 -0
  92. data/test/rest_test.rb +189 -0
  93. data/test/rutest_utils.rb +1 -1
  94. data/test/timetest.rb +42 -34
  95. metadata +125 -82
  96. data/lib/codec.rb +0 -573
  97. data/lib/flowexpressionid.rb +0 -139
  98. data/lib/ru/expressionpool.rb +0 -382
  99. data/lib/ru/expressionstorage.rb +0 -99
  100. data/lib/ru/flowexpression.rb +0 -272
  101. data/lib/ru/ruutils.rb +0 -70
  102. data/lib/test.rb +0 -222
  103. data/lib/workitem.rb +0 -249
  104. data/test/quicktest.rb +0 -21
@@ -1,6 +1,6 @@
1
1
  #
2
- #<tt>
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
- #</tt>
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
- module OpenWFEru
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
- # OpenWFEru::exception_to_s(e)
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?(String)
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?(Time)
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].id == at_id
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
- #<tt>
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
- #</tt>
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 'ru/service'
43
- require 'ru/scheduler'
42
+ require 'openwfe/service'
43
+ require 'openwfe/util/scheduler'
44
44
 
45
45
 
46
- module OpenWFEru
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 OpenWFEru)
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-2006, John Mettraux, OpenWFE.org
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.firstElement (xmlElt, elementName=nil)
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
- return elt if elt.name == elementName
56
- end
57
-
58
- return nil
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?(Fixnum)
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
+