lib/ru/flowexpression.rb in openwferu-0.9.0 vs lib/ru/flowexpression.rb in openwferu-0.9.1
- old
+ new
@@ -1,6 +1,7 @@
#
+#--
# Copyright (c) 2006, John Mettraux, OpenWFE.org
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -25,12 +26,13 @@
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+#++
#
-# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
+# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
#
#
# "made in Japan"
#
@@ -78,22 +80,42 @@
end
#
# the two most important methods for flow expressions
+ #
+ # this default implementation immediately replies to the
+ # parent expression
+ #
def apply (workitem)
get_parent().reply(workitem) if @parent_id
end
+ #
+ # this default implementation immediately replies to the
+ # parent expression
+ #
def reply (workitem)
- #
- # a default implementation
- #
reply_to_parent(workitem)
end
def reply_to_parent (workitem)
get_expression_pool.reply_to_parent(self, workitem)
+ end
+
+ #
+ # a default implementation for cancel :
+ # cancels all the children
+ # Attempts to return an InFlowWorkItem
+ #
+ def cancel ()
+ return nil if not @children
+ inflowitem = nil
+ @children.each do |child|
+ i = get_expression_pool().cancel(child)
+ inflowitem = i if not inflowitem
+ end
+ return inflowitem
end
#
# some convenience methods