It seems convenient to mix in application-specific methods into
Workitem, per process definition, and I'm wondering if anyone has
tried this or has a better idea how to handle the situation?

Here's an example of a participant I coded:

    @engine.register_participant :send_invitation do |wi|
       wi.extend(MyWorkitem)     <-- mix in some app-specific logic
       send_on wi.user_inbox, wi.invitation_message  <-- use it!
    end

But, of course, there is no method "user_inbox" in Workitem--that's
something understood only by my process definition and my
participants.  I could have coded the participant to construct this
directly from the workitem fields, but I found that doing so led to
long, cluttered-looking participant logic.  So, instead, I used
wi.extend and I defined my mixins in MyWorkitem like this:

module MyWorkitem
  def get(string)
    self.fields[string]
  end

  def set(string, value)
    self.fields[string] = value
  end

  def wfid
    self.fei.wfid # is there a better way to obtain this (such as from
engine)??
  end

  def acceptance_queue
    self.acceptance_queue_for_wfid(self.wfid)
  end

  def acceptance_queue_for_wfid(wfid)
    "#{wfid}_acceptance_queue"
  end

  def invitation_message
     ...
  end

end

Here are some specific questions for your consideration:

1.  Has anyone done anything like this, and/or has anyone a suggestion
for a better/more concise way of writing application-specific
participant code?

2.  Is there a better way--perhaps through a hook in the Ruote
library--to mix MyWorkItem into the class Workitem, rather than having
to do it per workitem instance in every participant?

Best,
David
--~--~---------~--~----~------------~-------~--~----~
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to