openwferu 0.9.16 → 0.9.17
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/about_state.rb +81 -0
- data/examples/engine_template.rb +7 -0
- data/lib/openwfe/contextual.rb +2 -2
- data/lib/openwfe/def.rb +2 -3
- data/lib/openwfe/{util/schedulers.rb → engine.rb} +3 -39
- data/lib/openwfe/engine/engine.rb +202 -251
- data/lib/openwfe/engine/process_status.rb +359 -0
- data/lib/openwfe/expool/errorjournal.rb +6 -6
- data/lib/openwfe/expool/expressionpool.rb +161 -239
- data/lib/openwfe/expool/expstorage.rb +185 -55
- data/lib/openwfe/expool/journal.rb +1 -2
- data/lib/openwfe/expool/parser.rb +233 -0
- data/lib/openwfe/expool/threadedexpstorage.rb +6 -18
- data/lib/openwfe/expool/wfidgen.rb +25 -7
- data/lib/openwfe/expool/yamlexpstorage.rb +60 -37
- data/lib/openwfe/expressions/condition.rb +49 -12
- data/lib/openwfe/expressions/environment.rb +45 -15
- data/lib/openwfe/expressions/expressionmap.rb +39 -19
- data/lib/openwfe/expressions/fe_concurrence.rb +24 -13
- data/lib/openwfe/expressions/fe_cron.rb +19 -18
- data/lib/openwfe/expressions/fe_cursor.rb +69 -28
- data/lib/openwfe/expressions/fe_define.rb +4 -1
- data/lib/openwfe/expressions/fe_do.rb +1 -3
- data/lib/openwfe/expressions/fe_equals.rb +131 -20
- data/lib/openwfe/expressions/fe_fqv.rb +27 -3
- data/lib/openwfe/expressions/fe_iterator.rb +14 -7
- data/lib/openwfe/expressions/fe_listen.rb +7 -2
- data/lib/openwfe/expressions/fe_misc.rb +187 -20
- data/lib/openwfe/expressions/fe_participant.rb +8 -7
- data/lib/openwfe/expressions/fe_reserve.rb +105 -33
- data/lib/openwfe/expressions/fe_save.rb +55 -5
- data/lib/openwfe/expressions/{fe_value.rb → fe_set.rb} +6 -82
- data/lib/openwfe/expressions/fe_sleep.rb +25 -15
- data/lib/openwfe/expressions/fe_subprocess.rb +2 -2
- data/lib/openwfe/expressions/fe_wait.rb +3 -2
- data/lib/openwfe/expressions/fe_when.rb +7 -15
- data/lib/openwfe/expressions/flowexpression.rb +90 -49
- data/lib/openwfe/expressions/merge.rb +7 -1
- data/lib/openwfe/expressions/raw.rb +261 -63
- data/lib/openwfe/expressions/{raw_prog.rb → rprocdef.rb} +94 -179
- data/lib/openwfe/expressions/time.rb +36 -12
- data/lib/openwfe/expressions/timeout.rb +9 -7
- data/lib/openwfe/expressions/value.rb +126 -0
- data/lib/openwfe/flowexpressionid.rb +52 -22
- data/lib/openwfe/listeners/listeners.rb +3 -3
- data/lib/openwfe/listeners/socketlisteners.rb +8 -5
- data/lib/openwfe/logging.rb +6 -3
- data/lib/openwfe/omixins.rb +8 -6
- data/lib/openwfe/orest/xmlcodec.rb +16 -12
- data/lib/openwfe/participants.rb +38 -0
- data/lib/openwfe/participants/participant.rb +1 -1
- data/lib/openwfe/participants/participantmap.rb +24 -10
- data/lib/openwfe/participants/participants.rb +4 -3
- data/lib/openwfe/participants/soapparticipants.rb +1 -1
- data/lib/openwfe/participants/socketparticipants.rb +1 -1
- data/lib/openwfe/rudefinitions.rb +7 -5
- data/lib/openwfe/storage/yamlcustom.rb +10 -10
- data/lib/openwfe/storage/yamlfilestorage.rb +12 -12
- data/lib/openwfe/tools/flowtracer.rb +6 -5
- data/lib/openwfe/util/dollar.rb +42 -85
- data/lib/openwfe/util/ometa.rb +1 -3
- data/lib/openwfe/util/workqueue.rb +1 -1
- data/lib/openwfe/utils.rb +33 -11
- data/lib/openwfe/version.rb +2 -2
- data/lib/openwfe/workitem.rb +76 -14
- data/lib/openwfe/worklist/storelocks.rb +9 -4
- data/lib/openwfe/worklist/storeparticipant.rb +1 -1
- data/test/back_0916_test.rb +101 -0
- data/test/bm/ft_26_load.rb +1 -1
- data/test/bm/ft_26b_load.rb +1 -1
- data/test/bm/ft_26c_load.rb +3 -2
- data/test/bm/ft_26d_load.rb +97 -0
- data/test/bm/ft_recu.rb +71 -0
- data/test/concurrence_test.rb +1 -1
- data/test/condition_test.rb +152 -0
- data/test/description_test.rb +12 -7
- data/test/eno_test.rb +1 -1
- data/test/expool_20031219_0916.tgz +0 -0
- data/test/fe_lookup_att_test.rb +1 -1
- data/test/fei_test.rb +16 -0
- data/test/file_persistence_test.rb +8 -12
- data/test/filep_cancel_test.rb +116 -0
- data/test/flowtestbase.rb +47 -25
- data/test/ft_0.rb +1 -1
- data/test/ft_10_loop.rb +29 -14
- data/test/{ft_10b_loop2.rb → ft_10b_loop.rb} +2 -11
- data/test/ft_11_ppd.rb +6 -17
- data/test/ft_11b_ppd.rb +1 -4
- data/test/ft_12_blockparticipant.rb +1 -1
- data/test/ft_13_eno.rb +1 -1
- data/test/ft_15_iterator.rb +1 -1
- data/test/ft_15b_iterator.rb +1 -1
- data/test/ft_17_condition.rb +6 -6
- data/test/ft_18_pname.rb +1 -1
- data/test/ft_20_cron.rb +1 -1
- data/test/ft_21_cron.rb +6 -4
- data/test/ft_22_history.rb +1 -1
- data/test/ft_23_when.rb +1 -1
- data/test/ft_23b_when.rb +18 -6
- data/test/ft_23c_wait.rb +8 -6
- data/test/ft_25_cancel.rb +7 -5
- data/test/ft_27_getflowpos.rb +22 -17
- data/test/ft_28_fileparticipant.rb +1 -2
- data/test/ft_2_concurrence.rb +1 -1
- data/test/ft_2b_concurrence.rb +25 -20
- data/test/ft_30_socketlistener.rb +0 -3
- data/test/ft_34_cancelwfid.rb +9 -9
- data/test/ft_35_localdefs.rb +0 -1
- data/test/ft_36_subprocids.rb +6 -6
- data/test/ft_38_tag.rb +3 -2
- data/test/ft_38b_tag.rb +229 -0
- data/test/ft_39_reserve.rb +3 -18
- data/test/ft_39b_reserve.rb +34 -5
- data/test/ft_3b_lookup_vf.rb +83 -0
- data/test/ft_40_defined.rb +2 -11
- data/test/ft_42_environments.rb +4 -6
- data/test/ft_44b_restore.rb +88 -22
- data/test/ft_45_citerator.rb +57 -11
- data/test/ft_49_condition.rb +4 -2
- data/test/ft_4_misc.rb +24 -3
- data/test/ft_50_xml_attribute.rb +17 -20
- data/test/ft_54_listen.rb +1 -1
- data/test/ft_54b_listen.rb +2 -2
- data/test/ft_56_timeout.rb +8 -1
- data/test/ft_57_a.rb +10 -10
- data/test/ft_59_ps.rb +49 -16
- data/test/ft_60_ecancel.rb +52 -10
- data/test/ft_63_pause.rb +8 -8
- data/test/ft_65_stringlaunch.rb +4 -6
- data/test/ft_67_schedlaunch.rb +4 -4
- data/test/ft_69_cancelmissing.rb +4 -2
- data/test/ft_70_lookupvar.rb +2 -2
- data/test/ft_72_lookup_processes.rb +2 -2
- data/test/ft_73_cancel_sub.rb +8 -8
- data/test/ft_77_segments.rb +38 -0
- data/test/ft_78_eval.rb +154 -0
- data/test/ft_79_tticket.rb +185 -0
- data/test/ft_80_spname.rb +95 -0
- data/test/ft_81_exp.rb +64 -0
- data/test/ft_82_trecu.rb +48 -0
- data/test/ft_83_badpause.rb +62 -0
- data/test/ft_84_updateexp.rb +125 -0
- data/test/ft_9b_cursor.rb +105 -0
- data/test/ft_tests.rb +14 -1
- data/test/hash_test.rb +7 -7
- data/test/hparticipant_test.rb +4 -4
- data/test/lookup_vf_test.rb +94 -0
- data/test/misc_test.rb +5 -3
- data/test/orest_test.rb +4 -3
- data/test/param_test.rb +12 -16
- data/test/participant_test.rb +36 -0
- data/test/pending.rb +10 -10
- data/test/rake_ltest.rb +1 -10
- data/test/rake_qtest.rb +7 -6
- data/test/raw_prog_test.rb +89 -121
- data/test/restart_cron_test.rb +84 -36
- data/test/restart_paused_test.rb +100 -0
- data/test/restart_sleep_test.rb +1 -1
- data/test/restart_tests.rb +1 -0
- data/test/restart_when_test.rb +33 -22
- data/test/ruby_procdef_test.rb +19 -18
- data/test/sec_test.rb +74 -35
- data/test/storage_test.rb +44 -0
- data/test/test.rb +3 -0
- data/test/timeout_test.rb +7 -18
- data/test/wfid_test.rb +2 -1
- data/test/wi_test.rb +29 -18
- metadata +121 -57
- data/lib/openwfe/expressions/raw_xml.rb +0 -176
- data/lib/openwfe/expressions/simplerep.rb +0 -266
- data/lib/openwfe/util/kotoba.rb +0 -236
- data/lib/openwfe/util/lru.rb +0 -171
- data/lib/openwfe/util/otime.rb +0 -246
- data/lib/openwfe/util/safe.rb +0 -160
- data/lib/openwfe/util/scheduler.rb +0 -1158
- data/test/cron_test.rb +0 -113
- data/test/cronline_test.rb +0 -60
- data/test/dollar_test.rb +0 -90
- data/test/kotoba_test.rb +0 -72
- data/test/lru_test.rb +0 -79
- data/test/safely_test.rb +0 -84
- data/test/scheduler_1_test.rb +0 -88
- data/test/scheduler_test.rb +0 -363
- data/test/time_test.rb +0 -84
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2006-
|
3
|
+
# Copyright (c) 2006-2008, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -128,12 +128,13 @@ module OpenWFE
|
|
128
128
|
|
129
129
|
def apply (workitem)
|
130
130
|
|
131
|
-
conditional = eval_condition
|
131
|
+
conditional = eval_condition :if, workitem, :unless
|
132
132
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
133
|
+
return super_reply_to_parent(workitem) \
|
134
|
+
if conditional == false
|
135
|
+
#
|
136
|
+
# skip expression
|
137
|
+
# <participant ref="x" if="y" /> (where y evals to false)
|
137
138
|
|
138
139
|
@participant_name = lookup_ref workitem
|
139
140
|
|
@@ -210,7 +211,7 @@ module OpenWFE
|
|
210
211
|
|
211
212
|
cancel_participant
|
212
213
|
|
213
|
-
|
214
|
+
@applied_workitem
|
214
215
|
end
|
215
216
|
|
216
217
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
3
|
+
# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -38,7 +38,6 @@
|
|
38
38
|
#
|
39
39
|
|
40
40
|
require 'thread'
|
41
|
-
require 'openwfe/expressions/fe_when'
|
42
41
|
|
43
42
|
|
44
43
|
module OpenWFE
|
@@ -66,73 +65,146 @@ module OpenWFE
|
|
66
65
|
# and vice versa. The participant delta is not concerned.
|
67
66
|
#
|
68
67
|
# The mutex is a regular variable name, thus a mutex named "//toto" could
|
69
|
-
# be used to prevent
|
68
|
+
# be used to prevent segments of totally different process instances from
|
70
69
|
# running.
|
71
70
|
#
|
72
|
-
class ReserveExpression <
|
71
|
+
class ReserveExpression < FlowExpression
|
73
72
|
|
74
73
|
#
|
75
74
|
# A mutex for the whole class, it's meant to prevent 'reserve'
|
76
75
|
# from reserving a workflow mutex simultaneaously.
|
77
76
|
#
|
78
|
-
|
77
|
+
#@@mutex = Mutex.new
|
79
78
|
|
80
79
|
names :reserve
|
81
80
|
|
81
|
+
#
|
82
|
+
# The name of the mutex this expressions uses.
|
83
|
+
# It's a variable name, that means it can be prefixed with
|
84
|
+
# {nothing} (local scope), '/' (process scope) and '//' (engine /
|
85
|
+
# global scope).
|
86
|
+
#
|
82
87
|
attr_accessor :mutex_name
|
83
88
|
|
89
|
+
#
|
90
|
+
# An instance variable for storing the applied workitem if the 'reserve'
|
91
|
+
# cannot be entered immediately.
|
92
|
+
#
|
93
|
+
attr_accessor :applied_workitem
|
94
|
+
|
95
|
+
|
84
96
|
def apply (workitem)
|
85
97
|
|
86
|
-
|
87
|
-
|
88
|
-
return
|
89
|
-
end
|
98
|
+
return reply_to_parent(workitem) \
|
99
|
+
if @children.size < 1
|
90
100
|
|
91
101
|
@mutex_name = lookup_string_attribute :mutex, workitem
|
92
102
|
|
93
|
-
|
103
|
+
FlowMutex.synchronize do
|
104
|
+
|
105
|
+
mutex =
|
106
|
+
lookup_variable(@mutex_name) || FlowMutex.new(@mutex_name)
|
107
|
+
|
108
|
+
mutex.register self, workitem
|
109
|
+
end
|
94
110
|
end
|
95
111
|
|
96
112
|
def reply (workitem)
|
97
113
|
|
98
|
-
|
114
|
+
lookup_variable(@mutex_name).release self
|
99
115
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
116
|
+
reply_to_parent workitem
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Called by the FlowMutex to enter the 'reserved/critical' section.
|
121
|
+
#
|
122
|
+
def enter (workitem=nil)
|
123
|
+
|
124
|
+
get_expression_pool.apply(
|
125
|
+
@children[0], workitem || @applied_workitem)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# A FlowMutex is a process variable (thus serializable) that keeps
|
131
|
+
# track of the expressions in a critical section (1!) or waiting for
|
132
|
+
# entering it.
|
133
|
+
#
|
134
|
+
# The current syncrhonization scheme is 1 thread mutex for all the
|
135
|
+
# FlowMutex. Shouldn't be too costly and the operations under sync are
|
136
|
+
# quite tiny.
|
137
|
+
#
|
138
|
+
class FlowMutex
|
139
|
+
|
140
|
+
#
|
141
|
+
# Granularity level ? "big rock". Only one FlowMutex operation
|
142
|
+
# a a time for the whole business process engine...
|
143
|
+
#
|
144
|
+
@@class_mutex = Mutex.new
|
145
|
+
|
146
|
+
attr_accessor :mutex_name
|
147
|
+
attr_accessor :feis
|
148
|
+
|
149
|
+
def initialize (mutex_name)
|
150
|
+
|
151
|
+
@mutex_name = mutex_name
|
152
|
+
@feis = []
|
153
|
+
end
|
105
154
|
|
106
|
-
|
155
|
+
def register (fexp, workitem)
|
156
|
+
|
157
|
+
@feis << fexp.fei
|
158
|
+
|
159
|
+
fexp.set_variable @mutex_name, self
|
160
|
+
|
161
|
+
if @feis.size == 1
|
162
|
+
#
|
163
|
+
# immediately let the expression enter the critical section
|
164
|
+
#
|
165
|
+
fexp.store_itself
|
166
|
+
fexp.enter workitem
|
167
|
+
else
|
168
|
+
#
|
169
|
+
# later...
|
170
|
+
#
|
171
|
+
fexp.applied_workitem = workitem
|
172
|
+
fexp.store_itself
|
173
|
+
end
|
107
174
|
end
|
108
175
|
|
109
|
-
|
176
|
+
def release (releaser)
|
177
|
+
|
178
|
+
next_fei = nil
|
110
179
|
|
111
|
-
|
180
|
+
@@class_mutex.synchronize do
|
112
181
|
|
113
|
-
|
182
|
+
current_fei = @feis.delete_at 0
|
114
183
|
|
115
|
-
|
184
|
+
releaser.set_variable @mutex_name, self
|
116
185
|
|
117
|
-
|
118
|
-
|
119
|
-
set_variable @mutex_name, fei.to_s \
|
120
|
-
unless mutex
|
121
|
-
#
|
122
|
-
# reserve mutex
|
123
|
-
end
|
186
|
+
log.warn "release() BAD! c:#{current_fei} r:#{releaser.fei}" \
|
187
|
+
if releaser.fei != current_fei
|
124
188
|
|
125
|
-
|
189
|
+
next_fei = @feis.first
|
126
190
|
end
|
127
191
|
|
128
|
-
|
192
|
+
return unless next_fei
|
129
193
|
|
130
|
-
|
194
|
+
releaser.get_expression_pool.fetch_expression(next_fei).enter
|
195
|
+
end
|
131
196
|
|
132
|
-
|
197
|
+
#
|
198
|
+
# Used by the ReserveExpression when looking up for a FlowMutex
|
199
|
+
# and registering into it.
|
200
|
+
#
|
201
|
+
def self.synchronize (&block)
|
133
202
|
|
134
|
-
|
203
|
+
@@class_mutex.synchronize do
|
204
|
+
|
205
|
+
block.call
|
135
206
|
end
|
207
|
+
end
|
136
208
|
end
|
137
209
|
|
138
210
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2007, John Mettraux, OpenWFE.org
|
3
|
+
# Copyright (c) 2007-2008, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -128,25 +128,70 @@ module OpenWFE
|
|
128
128
|
# Beware : you should not restore from a field that is not a hash. The
|
129
129
|
# top level attributes (payload) of a workitem should always be a hash.
|
130
130
|
#
|
131
|
+
# Since OpenWFEru 0.9.17, the 'set-fields' alias can be used for restore.
|
132
|
+
#
|
133
|
+
# sequence do
|
134
|
+
# set_fields :value => {
|
135
|
+
# "customer" => { "name" => "Zigue", "age" => 34 },
|
136
|
+
# "approved" => false }
|
137
|
+
# _print "${f:customer.name} (${f:customer.age}) ${f:approved}"
|
138
|
+
# end
|
139
|
+
#
|
140
|
+
# Along with this new alias, the expression now behave much like the 'set'
|
141
|
+
# expression, but still, targets the whole workitem payload.
|
142
|
+
#
|
143
|
+
# Note that "set-fields" can be used outside of the body of a process
|
144
|
+
# definition (along with "set") to separate 'data preparation' from
|
145
|
+
# actual process definition.
|
146
|
+
#
|
147
|
+
# class Test44b6 < ProcessDefinition
|
148
|
+
# set_fields :value => {
|
149
|
+
# "customer" => { "name" => "Zigue", "age" => 34 },
|
150
|
+
# "approved" => false }
|
151
|
+
# sequence do
|
152
|
+
# _print "${f:customer.name} (${f:customer.age}) ${f:approved}"
|
153
|
+
# end
|
154
|
+
# end
|
155
|
+
#
|
156
|
+
# Using set_fields at the beginning of a process can be useful for setting
|
157
|
+
# up forms (keys without values for now).
|
158
|
+
#
|
159
|
+
# set_fields :value => {
|
160
|
+
# "name" => "",
|
161
|
+
# "address" => "",
|
162
|
+
# "email" => ""
|
163
|
+
# }
|
164
|
+
#
|
131
165
|
class RestoreWorkItemExpression < FlowExpression
|
132
166
|
include MergeMixin
|
167
|
+
include ValueMixin
|
133
168
|
|
134
|
-
names :restore
|
169
|
+
names :restore, :set_fields
|
135
170
|
|
136
|
-
|
171
|
+
is_definition
|
172
|
+
# so that in can be placed outside of process definition bodies
|
173
|
+
|
174
|
+
|
175
|
+
def reply (workitem)
|
137
176
|
|
138
177
|
from_field = lookup_string_attribute :from_field, workitem
|
139
178
|
from_variable = lookup_string_attribute :from_variable, workitem
|
179
|
+
|
140
180
|
merge_lead = lookup_sym_attribute :merge_lead, workitem
|
141
181
|
|
182
|
+
merge_lead = nil \
|
183
|
+
unless [ nil, :current, :restored ].include?(merge_lead)
|
184
|
+
|
185
|
+
value = workitem.attributes[FIELD_RESULT]
|
186
|
+
|
142
187
|
source = if from_field
|
143
188
|
|
144
189
|
att = workitem.lookup_attribute from_field
|
145
190
|
|
146
|
-
lwarn
|
191
|
+
lwarn {
|
147
192
|
"apply() field '#{from_field}' is NOT a hash, " +
|
148
193
|
"restored anyway"
|
149
|
-
|
194
|
+
} unless att.kind_of?(Hash)
|
150
195
|
|
151
196
|
att
|
152
197
|
|
@@ -154,12 +199,17 @@ module OpenWFE
|
|
154
199
|
|
155
200
|
lookup_variable from_variable
|
156
201
|
|
202
|
+
elsif value
|
203
|
+
|
204
|
+
value
|
205
|
+
|
157
206
|
else
|
158
207
|
|
159
208
|
nil
|
160
209
|
end
|
161
210
|
|
162
211
|
if source
|
212
|
+
|
163
213
|
workitem = if merge_lead
|
164
214
|
do_merge merge_lead, workitem, source
|
165
215
|
else
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2006-
|
3
|
+
# Copyright (c) 2006-2008, John Mettraux, OpenWFE.org
|
4
4
|
# All rights reserved.
|
5
5
|
#
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
@@ -40,39 +40,11 @@
|
|
40
40
|
require 'openwfe/workitem'
|
41
41
|
require 'openwfe/flowexpressionid'
|
42
42
|
require 'openwfe/expressions/flowexpression'
|
43
|
+
require 'openwfe/expressions/value'
|
43
44
|
|
44
45
|
|
45
46
|
module OpenWFE
|
46
47
|
|
47
|
-
#
|
48
|
-
# A small mixin providing value for looking up the attributes
|
49
|
-
# variable/var/v and field/fld/f.
|
50
|
-
#
|
51
|
-
module ValueMixin
|
52
|
-
|
53
|
-
def lookup_variable_attribute (workitem)
|
54
|
-
|
55
|
-
lookup [ "variable", "var", "v" ], workitem
|
56
|
-
end
|
57
|
-
|
58
|
-
def lookup_field_attribute (workitem)
|
59
|
-
|
60
|
-
lookup [ "field", "fld", "f" ], workitem
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def lookup (name_array, workitem)
|
66
|
-
|
67
|
-
name_array.each do |n|
|
68
|
-
v = lookup_string_attribute n, workitem
|
69
|
-
return v if v
|
70
|
-
end
|
71
|
-
|
72
|
-
nil
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
48
|
#
|
77
49
|
# The 'set' expression is used to set the value of a (process) variable or
|
78
50
|
# a (workitem) field.
|
@@ -113,33 +85,6 @@ module OpenWFE
|
|
113
85
|
names :set
|
114
86
|
|
115
87
|
|
116
|
-
def apply (workitem)
|
117
|
-
|
118
|
-
escape = lookup_boolean_attribute('escape', workitem, false)
|
119
|
-
|
120
|
-
if @children.length < 1
|
121
|
-
|
122
|
-
workitem.attributes[FIELD_RESULT] = \
|
123
|
-
lookup_value(workitem, :escape => escape)
|
124
|
-
|
125
|
-
reply workitem
|
126
|
-
return
|
127
|
-
end
|
128
|
-
|
129
|
-
child = @children[0]
|
130
|
-
|
131
|
-
if child.kind_of?(OpenWFE::FlowExpressionId)
|
132
|
-
|
133
|
-
handle_child child, workitem
|
134
|
-
return
|
135
|
-
end
|
136
|
-
|
137
|
-
workitem.attributes[FIELD_RESULT] = \
|
138
|
-
fetch_text_content(workitem, escape)
|
139
|
-
|
140
|
-
reply workitem
|
141
|
-
end
|
142
|
-
|
143
88
|
def reply (workitem)
|
144
89
|
|
145
90
|
vkey = lookup_variable_attribute(workitem)
|
@@ -152,35 +97,13 @@ module OpenWFE
|
|
152
97
|
if vkey
|
153
98
|
set_variable vkey, value
|
154
99
|
elsif fkey
|
155
|
-
workitem.
|
100
|
+
workitem.set_attribute fkey, value
|
156
101
|
else
|
157
102
|
raise "'variable' or 'field' attribute missing from 'set' expression"
|
158
103
|
end
|
159
104
|
|
160
105
|
reply_to_parent(workitem)
|
161
106
|
end
|
162
|
-
|
163
|
-
protected
|
164
|
-
|
165
|
-
def handle_child (child, workitem)
|
166
|
-
|
167
|
-
raw_child, _fei = get_expression_pool.fetch(child)
|
168
|
-
|
169
|
-
if raw_child.is_definition?
|
170
|
-
|
171
|
-
#body_fei = get_expression_pool.evaluate child, workitem
|
172
|
-
#workitem.attributes[FIELD_RESULT] = body_fei
|
173
|
-
|
174
|
-
workitem.attributes[FIELD_RESULT] = raw_child
|
175
|
-
#
|
176
|
-
# storing the child raw expression
|
177
|
-
|
178
|
-
reply workitem
|
179
|
-
else
|
180
|
-
|
181
|
-
get_expression_pool.apply raw_child, workitem
|
182
|
-
end
|
183
|
-
end
|
184
107
|
end
|
185
108
|
|
186
109
|
#
|
@@ -194,6 +117,7 @@ module OpenWFE
|
|
194
117
|
|
195
118
|
names :unset
|
196
119
|
|
120
|
+
|
197
121
|
def apply (workitem)
|
198
122
|
|
199
123
|
vkey = lookup_variable_attribute(workitem)
|
@@ -202,12 +126,12 @@ module OpenWFE
|
|
202
126
|
if vkey
|
203
127
|
delete_variable(vkey)
|
204
128
|
elsif fkey
|
205
|
-
workitem.
|
129
|
+
workitem.unset_attribute fkey
|
206
130
|
else
|
207
131
|
raise "attribute 'variable' or 'field' is missing for 'unset' expression"
|
208
132
|
end
|
209
133
|
|
210
|
-
reply_to_parent
|
134
|
+
reply_to_parent workitem
|
211
135
|
end
|
212
136
|
end
|
213
137
|
|