[Setools] Gjallar's composite processes

goran at krampe.se goran at krampe.se
Mon Sep 18 15:01:23 UTC 2006


Hi Balazs!

Sorry for not responding earlier - from thursday to today I flew to
Zurich with our company for a conference.

"=?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.
> ------------------------------------------------------
> 
> 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 :)

I will get back to you tomorrow (not time today). :)
As a sidenote this particular "error" appeared just the other day too
but I haven't analyzed it yet.

But it looks like you almost did everything "the right way" though.

regards, Göran


More information about the Setools mailing list