openwferu 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/README +50 -2
  2. data/bin/validate-workflow.rb +64 -0
  3. data/lib/codec.rb +2 -0
  4. data/lib/controlclient.rb +19 -0
  5. data/lib/definitions.rb +2 -0
  6. data/lib/exception.rb +2 -0
  7. data/lib/flowexpressionid.rb +7 -5
  8. data/lib/openwferu.rb +2 -0
  9. data/lib/osocket.rb +2 -0
  10. data/lib/otime.rb +2 -0
  11. data/lib/restclient.rb +2 -0
  12. data/lib/ru/contextual.rb +2 -0
  13. data/lib/ru/dollar.rb +2 -0
  14. data/lib/ru/engine.rb +2 -0
  15. data/lib/ru/environment.rb +2 -0
  16. data/lib/ru/expressionmap.rb +5 -0
  17. data/lib/ru/expressionpool.rb +49 -6
  18. data/lib/ru/expressionstorage.rb +3 -1
  19. data/lib/ru/fe_base.rb +4 -1
  20. data/lib/ru/fe_concurrence.rb +82 -10
  21. data/lib/ru/fe_define.rb +2 -0
  22. data/lib/ru/fe_misc.rb +47 -0
  23. data/lib/ru/fe_participant.rb +2 -0
  24. data/lib/ru/fe_raw.rb +35 -19
  25. data/lib/ru/fe_subprocess.rb +2 -0
  26. data/lib/ru/fe_time.rb +2 -0
  27. data/lib/ru/fe_utils.rb +2 -0
  28. data/lib/ru/fe_value.rb +23 -12
  29. data/lib/ru/flowexpression.rb +26 -4
  30. data/lib/ru/logging.rb +2 -0
  31. data/lib/ru/participant.rb +2 -0
  32. data/lib/ru/participantmap.rb +2 -0
  33. data/lib/ru/participants.rb +2 -0
  34. data/lib/ru/rudefinitions.rb +9 -2
  35. data/lib/ru/ruutils.rb +3 -1
  36. data/lib/ru/scheduler.rb +2 -0
  37. data/lib/ru/schedulers.rb +2 -0
  38. data/lib/ru/service.rb +2 -0
  39. data/lib/test.rb +2 -0
  40. data/lib/utils.rb +49 -0
  41. data/lib/workitem.rb +9 -10
  42. data/lib/worklistclient.rb +18 -8
  43. data/test/flowtestbase.rb +7 -0
  44. data/test/ft_2_concurrence.rb +14 -2
  45. data/test/ft_6_lambda.rb +40 -0
  46. data/test/ft_7_losfor.rb +123 -0
  47. data/test/fulltest.rb +14 -0
  48. data/test/misctest.rb +30 -0
  49. data/test/{runtest.rb → quicktest.rb} +2 -2
  50. data/test/timetest.rb +2 -2
  51. metadata +54 -41
data/lib/ru/fe_define.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/fe_misc.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -92,5 +94,50 @@ module OpenWFEru
92
94
  end
93
95
  end
94
96
 
97
+ #
98
+ # Triggers the first (and supposedly unique child of this expression)
99
+ # but never wait for its reply (lose it).
100
+ # A 'lose' expression never replies to its parent expression.
101
+ #
102
+ class LoseExpression < FlowExpression
103
+
104
+ def apply (workitem)
105
+ get_expression_pool.apply(children[0], workitem) \
106
+ if (@children and @children.length > 0)
107
+ end
108
+
109
+ def reply (workitem)
110
+ # does nothing at all
111
+ end
112
+ end
113
+
114
+ #
115
+ # This method triggers its child (in its own thread) and then
116
+ # forgets about it. It immediately replies to its parent expression.
117
+ #
118
+ class ForgetExpression < LoseExpression
119
+
120
+ def apply (workitem)
121
+
122
+ if (@children and @children.length > 0)
123
+
124
+ wi = workitem.dup
125
+
126
+ Thread.new do
127
+ begin
128
+ get_expression_pool.apply(@children[0], wi)
129
+ rescue Exception => e
130
+ lwarn do
131
+ "apply() failed to apply child to forget "+
132
+ OpenWFEru::exception_to_s(e)
133
+ end
134
+ end
135
+ end
136
+ end
137
+
138
+ reply_to_parent(wi)
139
+ end
140
+ end
141
+
95
142
  end
96
143
 
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/fe_raw.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -64,34 +66,38 @@ module OpenWFEru
64
66
  new_environment() if not @environment_id
65
67
  end
66
68
 
67
- def apply (workitem)
68
- #ldebug { "apply() parent is #{@parent_id}" }
69
+ def instantiate_real_expression (workitem)
69
70
 
70
71
  attributes = extract_attributes()
71
72
 
72
- #ldebug { "apply() expression_name is '#{expression_name()}'" }
73
- #ldebug { "apply() expression_class is '#{expression_class()}'" }
74
-
75
- template = lookup_variable(expression_name())
76
-
77
- if template and template.kind_of? OpenWFE::FlowExpressionId
78
- get_expression_pool().launch_template(\
79
- self,
80
- template,
81
- workitem,
82
- lookup_attributes(attributes, workitem))
83
- return
84
- end
85
-
86
73
  eclass = expression_class()
74
+
87
75
  raise "unknown expression '#{expression_name}'" if not eclass
88
76
 
89
- expression = eclass.new(@fei, @parent_id, @environment_id, @application_context, attributes)
77
+ expression = eclass.new(
78
+ @fei,
79
+ @parent_id,
80
+ @environment_id,
81
+ @application_context,
82
+ attributes)
83
+
90
84
  expression.children = extract_children()
91
85
 
92
86
  expression.store_itself()
93
87
 
94
- expression.apply(workitem)
88
+ return expression
89
+ end
90
+
91
+ def apply (workitem)
92
+
93
+ template = lookup_variable(expression_name())
94
+
95
+ if template and template.kind_of? OpenWFE::FlowExpressionId
96
+ launch_template(template, workitem)
97
+ else
98
+ expression = instantiate_real_expression(workitem)
99
+ expression.apply(workitem)
100
+ end
95
101
  end
96
102
 
97
103
  #def reply (workitem)
@@ -115,12 +121,22 @@ module OpenWFEru
115
121
  end
116
122
 
117
123
  def definition_name ()
118
- #return @xml_element.attributes['name'].to_str
119
124
  return @xml_element.attributes['name'].to_s
120
125
  end
121
126
 
122
127
  protected
123
128
 
129
+ def launch_template (template, workitem)
130
+
131
+ attributes = extract_attributes()
132
+
133
+ get_expression_pool().launch_template(\
134
+ self,
135
+ template,
136
+ workitem,
137
+ lookup_attributes(attributes, workitem))
138
+ end
139
+
124
140
  def extract_attributes ()
125
141
  result = {}
126
142
  @xml_element.attributes.each_attribute do |a|
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/fe_time.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/fe_utils.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/fe_value.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -63,8 +65,7 @@ module OpenWFEru
63
65
  child = @children[0]
64
66
 
65
67
  if child.kind_of? OpenWFE::FlowExpressionId
66
- store_itself()
67
- get_expression_pool().apply(child, workitem)
68
+ handle_child(child, workitem)
68
69
  return
69
70
  end
70
71
 
@@ -95,20 +96,30 @@ module OpenWFEru
95
96
 
96
97
  protected
97
98
 
98
- def determine_value (workitem)
99
+ def handle_child (child, workitem)
99
100
 
100
- if @children.length > 0
101
- child = @children[0]
101
+ child = get_expression_pool().fetch(child)
102
102
 
103
- if child.kind_of? FlowExpressionId
104
- return "nada"
105
- else
106
- return child
107
- end
103
+ if child.is_definition?
104
+ fei = get_expression_pool().evaluate(child, workitem)
105
+ workitem.attributes[FIELD_RESULT] = fei
106
+ reply(workitem)
107
+ else
108
+ get_expression_pool().apply(child, workitem)
108
109
  end
109
-
110
- return OpenWFEru::lookup_value(self, workitem)
111
110
  end
111
+
112
+ #def determine_value (workitem)
113
+ # if @children.length > 0
114
+ # child = @children[0]
115
+ # if child.kind_of? FlowExpressionId
116
+ # return "nada"
117
+ # else
118
+ # return child
119
+ # end
120
+ # end
121
+ # return OpenWFEru::lookup_value(self, workitem)
122
+ #end
112
123
  end
113
124
 
114
125
  class UnsetValueExpression < FlowExpression
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,8 +28,9 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
- # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
33
+ # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
33
35
 
34
36
  #
@@ -80,14 +82,19 @@ module OpenWFEru
80
82
  #
81
83
  # the two most important methods for flow expressions
82
84
 
85
+ #
86
+ # this default implementation immediately replies to the
87
+ # parent expression
88
+ #
83
89
  def apply (workitem)
84
90
  get_parent().reply(workitem) if @parent_id
85
91
  end
86
92
 
93
+ #
94
+ # this default implementation immediately replies to the
95
+ # parent expression
96
+ #
87
97
  def reply (workitem)
88
- #
89
- # a default implementation
90
- #
91
98
  reply_to_parent(workitem)
92
99
  end
93
100
 
@@ -95,6 +102,21 @@ module OpenWFEru
95
102
  get_expression_pool.reply_to_parent(self, workitem)
96
103
  end
97
104
 
105
+ #
106
+ # a default implementation for cancel :
107
+ # cancels all the children
108
+ # Attempts to return an InFlowWorkItem
109
+ #
110
+ def cancel ()
111
+ return nil if not @children
112
+ inflowitem = nil
113
+ @children.each do |child|
114
+ i = get_expression_pool().cancel(child)
115
+ inflowitem = i if not inflowitem
116
+ end
117
+ return inflowitem
118
+ end
119
+
98
120
  #
99
121
  # some convenience methods
100
122
 
data/lib/ru/logging.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
@@ -37,7 +39,8 @@
37
39
 
38
40
  module OpenWFEru
39
41
 
40
- OPENWFE_VERSION = '1.7.2pre17'
42
+ #OPENWFE_VERSION = '1.7.2pre17'
43
+ OPENWFE_VERSION = '0.9.2'
41
44
 
42
45
  #
43
46
  # service names
@@ -63,8 +66,12 @@ module OpenWFEru
63
66
  #
64
67
  # some expression attribute names
65
68
 
66
- A_SYNC = 'sync'
67
69
  A_FORGET = 'forget'
68
70
 
71
+ A_SYNC = 'sync'
72
+ A_COUNT = 'count'
73
+ A_REMAINING = 'remaining'
74
+ REM_CANCEL = 'cancel'
75
+
69
76
  end
70
77
 
data/lib/ru/ruutils.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,8 +28,9 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
- # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
33
+ # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
33
35
 
34
36
  #
data/lib/ru/scheduler.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/schedulers.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/ru/service.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
32
34
  #
data/lib/test.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #<tt>
2
3
  # Copyright (c) 2005-2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #</tt>
30
32
  #
31
33
  # $Id: test.rb 3454 2006-10-08 16:51:00Z jmettraux $
32
34
  #
data/lib/utils.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2005-2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: utils.rb 3454 2006-10-08 16:51:00Z jmettraux $
32
34
  #
@@ -90,5 +92,52 @@ module OpenWFE
90
92
  return object.dup
91
93
  end
92
94
 
95
+ #
96
+ # an automatic dup implementation attempt
97
+ #
98
+ def OpenWFE.dup (object)
99
+
100
+ return nil if object == nil
101
+
102
+ return object if object.kind_of?(Fixnum)
103
+
104
+ o = object.class.new
105
+
106
+ #
107
+ # some kind of collection ?
108
+
109
+ if object.kind_of?(Array)
110
+ object.each do |i|
111
+ o << dup(i)
112
+ end
113
+ elsif object.kind_of?(Hash)
114
+ object.each do |k, v|
115
+ o[copy(k)] = dup(v)
116
+ end
117
+ end
118
+
119
+ #
120
+ # duplicate the attributes of the object
121
+
122
+ object.instance_variables.each do | v |
123
+
124
+ #puts "v is #{v}"
125
+
126
+ value = object.instance_variable_get(v)
127
+
128
+ #puts "value is '#{value}'"
129
+
130
+ value = dup(value)
131
+
132
+ begin
133
+ o.instance_variable_set(v, value)
134
+ rescue Exception => e
135
+ # ignore, must be readonly
136
+ end
137
+ end
138
+
139
+ return o
140
+ end
141
+
93
142
  end
94
143
 
data/lib/workitem.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2005-2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: workitem.rb 3556 2006-11-13 04:15:52Z jmettraux $
32
34
  #
@@ -77,6 +79,8 @@ module OpenWFE
77
79
  def lastExpressionId= (fei)
78
80
  @flowExpressionId = fei
79
81
  end
82
+
83
+ alias last_expression_id lastExpressionId
80
84
  end
81
85
 
82
86
  class InFlowWorkItem < InFlowItem
@@ -88,16 +92,7 @@ module OpenWFE
88
92
  # special : added by the ruby lib, not given by the worklist
89
93
 
90
94
  def dup
91
- c = InFlowWorkItem.new
92
- c.lastModified = OpenWFE::copy(@lastModified)
93
- c.attributes = OpenWFE::copy(@attributes)
94
- c.flowExpressionId = OpenWFE::copy(@flowExpressionId)
95
- c.participantName = OpenWFE::copy(@participantName)
96
- c.dispatchTime = OpenWFE::copy(@dispatchTime)
97
- c.filter = OpenWFE::copy(@filter)
98
- c.history = OpenWFE::copy(@history)
99
- c.store = OpenWFE::copy(@store)
100
- return c
95
+ return OpenWFE::dup(self)
101
96
  end
102
97
  end
103
98
 
@@ -126,6 +121,10 @@ module OpenWFE
126
121
  :wfdRevision, \
127
122
  :wfInstanceId, \
128
123
  :expressionId
124
+
125
+ def dup
126
+ return OpenWFE::dup(self)
127
+ end
129
128
  end
130
129
 
131
130
 
@@ -1,4 +1,5 @@
1
1
  #
2
+ #--
2
3
  # Copyright (c) 2005-2006, John Mettraux, OpenWFE.org
3
4
  # All rights reserved.
4
5
  #
@@ -27,6 +28,7 @@
27
28
  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
29
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
30
  # POSSIBILITY OF SUCH DAMAGE.
31
+ #++
30
32
  #
31
33
  # $Id: worklistclient.rb 3454 2006-10-08 16:51:00Z jmettraux $
32
34
  #
@@ -188,14 +190,6 @@ module OpenWFE
188
190
  return postItem('forwardWorkitem', workitem)
189
191
  end
190
192
 
191
- #
192
- # A synonymous for proceedWorkitem (TODO : use ruby's alias trick)
193
- #
194
- def forwardWorkitem (workitem)
195
-
196
- return proceedWorkitem(workitem)
197
- end
198
-
199
193
  #
200
194
  # Returns the list of flow URLs the user owning this session may
201
195
  # launch.
@@ -238,6 +232,22 @@ module OpenWFE
238
232
  #def queryStore (storeName, query)
239
233
  #end
240
234
 
235
+ alias list_stores listStores
236
+ alias get_store_names getStoreNames
237
+ alias get_headers getHeaders
238
+ alias find_flow_instance findFlowInstance
239
+ alias launch_flow launchFlow
240
+ alias get_workitem getWorkitem
241
+ alias get_and_lock_workitem getAndLockWorkitem
242
+ alias query_and_lock_workitem queryAndLockWorkitem
243
+ alias release_workitem releaseWorkitem
244
+ alias save_workitem saveWorkitem
245
+ alias proceed_workitem proceedWorkitem
246
+ alias forwardWorkitem proceedWorkitem
247
+ alias forward_workitem proceedWorkitem
248
+ alias list_launchables listLaunchables
249
+ alias delegate_to_participant delegateToParticipant
250
+
241
251
 
242
252
  protected
243
253