Hi
Jinzhai,
There
is no way to trigger a global rule conditionally at
present.
For
template rules, you can mimic this behavior:
a)
Add
a condition at the top of the template prior to generating any output. In this
condition you could for example, check the size of the $sessions collection.
b)
This
would then create an empty file if the condition is not met, so you can then
clear up empty files in the rule definition using the “Suppress Empty Files”
check box.
c)
NOTE
: This would potentially overwrite existing files, but I don’t think that is
what you are trying to avoid here.
I
don’t know of any way of getting round the copy rule limitation
though.
Hope
this helps,
Richard
From:
tigerstripe-dev-bounces@xxxxxxxxxxx [mailto:tigerstripe-dev-bounces@xxxxxxxxxxx]
On Behalf Of Zhang, Jin-Zhai (TSG-BAS-China-SH)
Sent: 19
January 2010 10:56
To: Tigerstripe developers list
Cc:
Flauw, Marc
Subject: [tigerstripe-dev] Can I run global rules
conditionally?
Hi
team,
Would
please help me in following question:
the
question is: can I run global rules conditionally? I'm
working with Tigerstripe workbench 0.5.0.x
![](jpgQtDvnzdet3.jpg)
- Global
Rules - File/Directory Copy Rule:
For example, , I want to generate web servcies definitions (XSD and WSDL) from
tigerstripe models. Now given a model, IF the model is relevant with
notification, THEN I will copy existing WS-notification XSD/WSDL files to target
folder; ELSE IF the model is not relevant with notification, THEN
nothing will be copied.
- Global
Rules - Global Template Rule:
The case
is: I have one VM template in my tigerstripe generator, when I run the generator
agaist a model, the VM should run only IF the model meets
some global condition (e.g. the model contains at least one
SessionFacade).
best
regards,
Jinzhai
ZHANG Jinzhai
HP
Enterprise Services