[Setools] Gjallar's composite processes

Balázs Kósi rebmekop at gmail.com
Thu Sep 14 23:51:20 UTC 2006


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

and some other methods (isValidFor, targets),
which i suspect not to be relevant (but correct me).

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
-------------------------------------------------------------------------------------------
which is called from the Q2CaseCreateTxn #postMasterOutsideTransaction:
-------------------------------------------------------------------------------------------
postMasterOutsideTransaction
	super postMasterOutsideTransaction.
	"At this point, the instance var 'case' is not the case created in the model."
	self session addEvent: (Q2CreatedCaseEvent for: (self model
findCaseById: case id))
-------------------------------------------------------------------------------------------
This means that (self model findCaseById: case id) gives back nil, which
means that the case is not added to the model yet.

If i let it to proceed after the halt then it adds the sub-case to the model.

My guess is that the create case txn is not commited yet,
because it runs inside another txn: the case transition txn.

I am not sure that the problem is that, but i know,
that the solution is beyond me. please help :)

thanks : balazs

ps: sorry for the unclear subject Alexandre.


More information about the Setools mailing list