On Sat, Oct 3, 2009 at 6:13 AM, David <[email protected]> wrote:
>
> (...)
>
>  def wfid
>    self.fei.wfid # is there a better way to obtain this (such as from
> engine)??
>  end

Hello David,

this wfid method looks right. The workitem is meant to know the wfid
of the process to which it belongs, no need to ask to the engine.


> 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?

Ruote 0.9.x had something like

---8<---
def method_missing (m, *args)
  m = m.to_s
  if m[-1, 1] == '='
    @fields[m[0..-2]] = args.first
  else
    v = @fields[m]
    return v if v != nil # false is OK
  end
  super # will trigger the regular "NoMethodError"...
end
--->8---

that would allow things like workitem.field0 or
workitem.customer_name, but it could get confusing, so Ruote 2.0 is
"conservative" and there is no Workitem#method_missing.

The lookup/set_field method in the vanilla Workitem class [1] are
worth a look as well.

For the rest, it's OK to mix your logic in, as long as the workitem
are serializable. Beware of future process definitions that need to
run in the same engine but have a different take on those
customizations. Favour domain specific over process specific, perhaps.


> 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?

Ruby is your friend. If you want your changes to take effect for all
the workitems in your engine, you could, once ruote is required
(perhaps right before the engine is initialized) do something like :

---8<---
class Ruote::Workitem
  # re-opens the class defined by ruote

  def wfid
    @fei.wfid
  end

  # ...
end
--->8---

Class reopened and now benefiting from a nice #wfid method.

[1] http://github.com/jmettraux/ruote/blob/ruote2.0/lib/ruote/workitem.rb#L47-84


Best regards,

-- 
John Mettraux   -   http://jmettraux.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
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