If it is a per application setting, then it should be on your application
class. You could set this value through your properties file, so you could
supply a different value per deployment.
You're right, it doesn't belong in the page wrapper. On the app, you could
reach it in a rule using session.context.page.application.region. There may be
a shorter way to get to that, but I've never needed an application value in my
rules before.
Ramsey
On Nov 8, 2011, at 3:22 AM, Markus Ruggiero wrote:
> I am trying to control the list of visible entities through a rule file. That
> works as expected. However the same app is deployed in several regions. Each
> region has its own requirements for the visibleEntityNames. So I create a key
> "region" in the D2WContext and use this in various places throughout the app
> to show/hide (non-)relevant fields. I inject the region-key into the
> D2WContext in the pageWrapper awake() (probably overkill)
>
> public void awake() {
> super.awake();
> D2WContext ctx = d2wContext();
> if (ctx != null) {
> Application application =
> (Application)Application.application();
> String region = "UNKNOWN";
> if (application.isEurope()) {
> region = "europe";
> }
> else if (application.isPefa()) {
> region = "pefa";
> }
> else if (application.isNorthAmerica()) {
> region = "na";
> }
> ctx.takeValueForKey( region, "region" );
> }
> }
>
> It works everywhere except for visibleEntityNames. Obviously this list is
> built before the first pageWrapper is instantiated. At that moment region is
> not yet set. The resulting list of entities is never rebuilt later, so my
> rule
>
> region="europe" => visibleEntityNames=....
>
> never fires. How can I solve this? When is the list of entity names built?
> Where would I have to inject the region key into the D2WContext for the
> proper rule to fire?
>
> Thanks
> ---markus---
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]