[Setools] Gjallar's composite processes
goran at krampe.se
goran at krampe.se
Tue Sep 19 11:21:09 UTC 2006
Hi!
Ok, let's take a look at this:
"=?ISO-8859-1?Q?Bal=E1zs_K=F3si?=" <rebmekop at gmail.com> wrote:
> Hi Göran!
> > So we could add a subclass to Q2WorkflowCriterion that has an action
> > that "spawns" a case(s) in another Process(es). And that can then
> > "watch" those cases and their states in order to validate. Well, that
> > could of course be another criterion type - not the same. Yes. Indeed.
> > Definitely. Feel free to hack that up! :)
>
> I've tried, and failed at the very beginning of it. The story:
>
> I subclassed Q2WorkflowCriterion: Q2WorkflowSpawnCase
> I overwrote
> ------------------------------------------------------
> actionOnEnterForEnter: aCase
> | subcase |
> subcase := process newCase.
> self model createCase: subcase.
> ------------------------------------------------------
Right, the above method will be called if the criterion is added as an
enter criterion on a stage that is being entered.
Regarding the Criterion classes - I just took the chance to clean them
up - wrote much better class comments, recategorized some methods,
refactored and looked it over etc. :)
Now criteria actions are run *before* the transition is made and also
include actions on criteria placed on the transition itself (overlooked
that before).
> and some other methods (isValidFor, targets),
> which i suspect not to be relevant (but correct me).
#isValidFor: (as the class comment now explains) is the message used to
test if the criteria is fulfilled (true or false) and #targets is used
to ask criteria for the fields/forms they might relate too (as most
probably will be related to fields/forms, if related at all) in order to
render the icons in the forms properly (they turn red when a criteria is
false etc).
So indeed - to just do the spawning you don't need to implement these.
> I created two processes both from the 'Simple prototype': 'Parallel' and 'Sub'.
> I gave a new Q2WorkflowSpawnCase enterCriterion to the 'Working' stage
> of 'Parallel'.
>
> When i create a new case for 'Parallel', and then move along the 'start working'
> transition to the Working stage, it calls my code, creates the sub-case, and
> halts in Q2CreatedCaseEvent class's #for: method:
> -------------------------------------------------------------------------------------------
> for: aCase
> aCase ifNil: [self halt].
> ^(self new) initializeWith: aCase; yourself
> -------------------------------------------------------------------------------------------
Let me get back later on this part - I need to test and right now the
unit tests are broken hard etc. I will post as soon as I get to the
bottom with it.
The criterion clean up mentioned above is now available in the MC repo
(Q2v0.3-gk.183)
regards, Göran
PS. It is great to see that you are getting into the code. I will try
the hardest to support you. :)
More information about the Setools
mailing list