You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by *Colin Sharples <Co...@hbl.co.nz> on 2001/11/14 04:22:38 UTC

Workflow - new steps for core package

Craig,

I have a suggestion for two new steps to go in the core package. These are
basically the opposite of AndStep and OrStep, called guess what NotAndStep
and NotOrStep. These basically do the exact opposite of AndStep and OrStep.
The reason for this is to allow for more natural scripting. 

With just AndStep, I would have to write an activity like this:

<activity>
  <doSomething id="produceSomeStuff">
  <and step="useFooAndBar">
    <descriptor name="foo"/>
    <descriptor name="bar"/>
  </and>
  <goto step="next"/>
  <doSomething id="useFooAndBar"/>
  <doSomething id="next"/>
</activity>

The first step tries to produce some data, which it will store in the
context under the keys "foo" and "bar". The and step then checks to make
sure that both foo and bar were indeed generated. If they are both present,
then control will pass to the useFooAndBar step. If one or both are missing,
control passes to the goto step, which then skips over useFooAndBar to pass
control onto the next step. Writing stuff like this makes me feel like a
BASIC programmer, so I would rather use something more like:

<activity>
  <doSomething id="produceSomeStuff">
  <notAnd step="next">
    <descriptor name="foo"/>
    <descriptor name="bar"/>
  </notAnd>
  <doSomething id="useFooAndBar"/>
  <doSomething id="next"/>
</activity>

In this case, the notAnd step says that if one or both of foo and bar is
missing, control will be passed to the next step. This means that
useFooAndBar will only be executed if both of the objects are in the
context. Just feels a bit more natural.

Anyway, my colleague Preston Sheldon has created the two steps and updated
CoreRuleSet accordingly - files attached.

 <<CoreRuleSet.java>>  <<NotAndStep.java>>  <<NotOrStep.java>> 
Colin Sharples
IBM Global Services New Zealand