public
Description: the [OpenWFEru] workflow and BPM engine (ruby)
Homepage: http://openwferu.rubyforge.org
Clone URL: git://github.com/jmettraux/ruote.git
Search Repo:
todo #19933 : reintroduced ${vf:x} and ${fv:y}
jmettraux (author)
Sun May 04 18:52:05 -0700 2008
commit  ffafcfe8c78ca2935e3b29e2ef81814dedaad206
tree    d0648baa2689e56a5b9064c6c9b49a446f12fb38
parent  ed16449c5b8a42de9cdc861dd72816efde939432
...
4
5
6
 
7
8
9
...
4
5
6
7
8
9
10
0
@@ -4,6 +4,7 @@
0
 
0
 == OpenWFEru - 0.9.18 not yet released
0
 
0
+- todo #19933 : reintroduced ${vf:x} and ${fv:y}
0
 - todo #19536 : added :engine_name application context parameter
0
 - todo #19839 : moved storeparticipants out of worklist/
0
 - bug #19739 : made sure that ActiveParticipant didn't flatten Date and Time
...
37
38
39
40
41
42
43
...
103
104
105
106
 
107
108
 
109
110
 
 
111
112
 
113
114
115
116
117
118
119
120
 
121
122
 
123
124
125
126
127
 
 
128
129
130
...
138
139
140
141
142
143
144
145
 
146
147
148
149
150
151
152
153
 
154
155
 
156
157
158
159
 
 
 
 
 
 
 
 
 
 
160
 
161
162
163
 
 
 
 
 
 
 
 
 
164
165
166
...
172
173
174
 
 
 
175
176
177
...
37
38
39
 
40
41
42
...
102
103
104
 
105
106
 
107
108
 
109
110
111
 
112
113
 
 
 
 
 
 
 
114
115
 
116
117
118
119
120
 
121
122
123
124
125
...
133
134
135
 
 
 
 
 
136
137
 
 
 
 
 
 
 
138
139
 
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
 
 
158
159
160
161
162
163
164
165
166
167
168
169
...
175
176
177
178
179
180
181
182
183
0
@@ -37,7 +37,6 @@
0
 # John Mettraux at openwfe.org
0
 #
0
 
0
-#require 'rubygems'
0
 require 'rufus/dollar' # gem 'rufus-dollar'
0
 require 'rufus/eval' # gem 'rufus-eval'
0
 
0
@@ -103,28 +102,24 @@ module OpenWFE
0
 
0
         def [] (key)
0
 
0
- p, k = extract_prefix(key)
0
+ pr, k = extract_prefix key
0
 
0
- #puts "### p, k is '#{p}', '#{k}'"
0
+ # stage 0
0
 
0
- return '' if k == ''
0
+ v = lookup(pr[0, 1], k)
0
+ return v if v != nil
0
 
0
- return @workitem.lookup_attribute(k) if p == 'f'
0
+ # stage 1
0
 
0
- if p == 'v'
0
- return '' unless @flow_expression
0
- return @flow_expression.lookup_variable(k)
0
- end
0
-
0
- #return call_function(k) if p == 'c'
0
- return call_ruby(k) if p == 'r'
0
+ return "" if pr.size < 2
0
 
0
- @workitem.lookup_attribute key
0
+ lookup(pr[1, 1], k)
0
         end
0
 
0
         def []= (key, value)
0
 
0
- pr, k = extract_prefix(key)
0
+ pr, k = extract_prefix key
0
+ pr = pr[0, 1]
0
 
0
             if pr == 'f'
0
 
0
@@ -138,29 +133,37 @@ module OpenWFE
0
 
0
         def has_key? (key)
0
 
0
- p, k = extract_prefix(key)
0
-
0
- return false if k == ''
0
-
0
- return @workitem.has_attribute?(k) if p == 'f'
0
+ pr, k = extract_prefix key
0
 
0
- if p == 'v'
0
- return false unless @flow_expression
0
- return (@flow_expression.lookup_variable(k) != nil)
0
- end
0
-
0
- #return true if p == 'c'
0
- return true if p == 'r'
0
+ return true if pr == 'r'
0
 
0
- @workitem.has_attribute?(key)
0
+ (self[key] != nil)
0
         end
0
 
0
         protected
0
 
0
+ def lookup (pr, key)
0
+
0
+ case pr
0
+ when 'v' then @flow_expression.lookup_variable(key)
0
+ when 'f' then @workitem.lookup_attribute(key)
0
+ when 'r' then call_ruby(key)
0
+ else nil
0
+ end
0
+ end
0
+
0
             def extract_prefix (key)
0
+
0
                 i = key.index(':')
0
- return @default_prefix, key if not i
0
- [ key[0..0], key[i+1..-1] ]
0
+
0
+ return [ @default_prefix, key ] if not i
0
+
0
+ pr = key[0..i-1] # until ':'
0
+ pr = pr[0, 2] # the first two chars
0
+
0
+ pr = pr[0, 1] unless (pr == 'vf') or (pr == 'fv')
0
+
0
+ [ pr, key[i+1..-1] ]
0
             end
0
 
0
             #--
0
@@ -172,6 +175,9 @@ module OpenWFE
0
             #end
0
             #++
0
 
0
+ #
0
+ # The ${r:1+2} stuff. ("3").
0
+ #
0
             def call_ruby (ruby_code)
0
 
0
                 if @flow_expression
...
8
9
10
 
 
11
12
13
...
18
19
20
21
 
 
22
23
24
...
8
9
10
11
12
13
14
15
...
20
21
22
 
23
24
25
26
27
0
@@ -8,6 +8,8 @@
0
 # Kita Yokohama
0
 #
0
 
0
+require 'rubygems'
0
+
0
 require 'test/unit'
0
 
0
 require 'openwfe/engine/engine'
0
@@ -18,7 +20,8 @@ require 'openwfe/participants/storeparticipants'
0
 class ConcurrenceAndParticipantTest < Test::Unit::TestCase
0
 
0
     def setup
0
- @engine = Engine.new
0
+ @engine = OpenWFE::Engine.new({
0
+ :definition_in_launchitem_allowed => true })
0
     end
0
 
0
     #def teardown
...
117
118
119
 
120
...
117
118
119
120
121
0
@@ -117,4 +117,5 @@ require 'back_0916_test'
0
 require 'ft_82_trecu'
0
 require 'ft_84_updateexp'
0
 require 'ft_85_dolhash'
0
+require 'ft_86_dollar_fv'
0
 

Comments

    No one has commented yet.