Some of the code that was replaced was from the JPublish days - before the 
screen widgets. Now the screen widgets have those objects in the screen 
rendering context.

Check out ScreenRenderer.java populateBasicContext and 
populateContextForRequest methods.

-Adrian

--- On Sat, 6/7/08, Jacques Le Roux <[EMAIL PROTECTED]> wrote:
From: Jacques Le Roux <[EMAIL PROTECTED]>
Subject: Groovy and idioms questions
To: [email protected]
Date: Saturday, June 7, 2008, 4:44 PM

Hi All,

I suppose, from this snippet taken from the 1st line of Revision: 664118

-security = request.getAttribute("security");
-delegator = request.getAttribute("delegator");
-
-if(security.hasEntityPermission("CATALOG", "_VIEW",
session)) {
-    context.hasPermission = Boolean.TRUE;
-} else {
-    context.hasPermission = Boolean.FALSE;
-}
+context.hasPermission = security.hasEntityPermission("CATALOG",
"_VIEW", session);

that Groovy provides the variables security and delegator without having to get
them out of request (I was surprised, so I tested, and it works ;o). Is there a
list somewhere of all alike variables (I searched a bit but it's far too
late now) ?

BTW, I wonder if you (OFBiz developpers/contributors) would like to share
idioms you use either in Java, Freemarker and now Groovy. We could create a
Wiki page for that (under Best practices I guess). This could be interesting
(mostly for Groovy which is much creative) for 2 reasons : to grow our
personnal knowledge without having to refer to code (where we know there is
this stuff we search for, somewhere we saw before) and homogenize our way of
coding which should be fruitful for everybody (after all, we share the code).
Sorry for the long sentence :o)

If some of you are interested just let me know and I will create this page and
a new thread.

Thanks

Jacques


      

Reply via email to