Re: svn commit: r1300463 [1/3] - in /ofbiz/trunk: applications/accounting/src/org/ofbiz/accounting/finaccount/ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org

2012-03-13 Thread Jacopo Cappellato
A couple of additional comments: * now that the commit has fixed all occurrencies, I would suggest that we do not use Debug.log(...) anymore: it internally uses the ALWAYS level and so it always prints the log, and this may not be obvious to the developer * I agree that this should be backported

Fwd: svn commit: r1300463 [1/3] - in /ofbiz/trunk: applications/accounting/src/org/ofbiz/accounting/finaccount/ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/or

2012-03-13 Thread Ashish Vijaywargiya
Hello, I am thinking to backport similar changes that I did in this commit to release branch 10.04 and 11.04. Such commit will not harm anyone on production systems but can have better control on Debug.* message. This is kind of bug fix because few Debug.log( statements exists in the code base th

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Adrian Crum
Okay, I lied - the bindings are preserved between evaluations. So go ahead and make whatever changes you need to make. -Adrian On 3/14/2012 5:28 AM, Adrian Crum wrote: The main reason is to supply a function/method argument if modelService.invoke is not empty. A script containing a function/

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Adrian Crum
The main reason is to supply a function/method argument if modelService.invoke is not empty. A script containing a function/method is evaluated twice - once to evaluate the script as a whole and then again to invoke the function/method. Any bindings that were created/used in the first evaluat

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
Adrian, is there a reason for invoking the script from ScriptEngine and ScriptEventHandler using: Object resultObj = ScriptUtil.executeScript(getLocation(modelService), modelService.invoke, scriptContext, new Object[] { context }); rather than Object resultObj = Scri

Re: svn commit: r1299924 - in /ofbiz/trunk/framework: base/src/META-INF/services/ base/src/org/ofbiz/base/util/ common/script/org/ofbiz/common/ common/servicedef/ common/src/META-INF/services/ common/

2012-03-13 Thread Scott Gray
Thanks Adrian! Regards Scott On 14/03/2012, at 5:21 PM, Adrian Crum wrote: > Oops. Good catch - will do! > > -Adrian > > On 3/14/2012 2:09 AM, Scott Gray wrote: >> Hi Adrian, >> >> Your test references an application entity, could you switch it to using one >> of the example entities? >> >>

Re: svn commit: r1299924 - in /ofbiz/trunk/framework: base/src/META-INF/services/ base/src/org/ofbiz/base/util/ common/script/org/ofbiz/common/ common/servicedef/ common/src/META-INF/services/ common/

2012-03-13 Thread Adrian Crum
Oops. Good catch - will do! -Adrian On 3/14/2012 2:09 AM, Scott Gray wrote: Hi Adrian, Your test references an application entity, could you switch it to using one of the example entities? Thanks Scott On 13/03/2012, at 12:20 PM, adri...@apache.org wrote: Author: adrianc Date: Mon Mar 12

Re: svn commit: r1299924 - in /ofbiz/trunk/framework: base/src/META-INF/services/ base/src/org/ofbiz/base/util/ common/script/org/ofbiz/common/ common/servicedef/ common/src/META-INF/services/ common/

2012-03-13 Thread Scott Gray
Hi Adrian, Your test references an application entity, could you switch it to using one of the example entities? Thanks Scott On 13/03/2012, at 12:20 PM, adri...@apache.org wrote: > Author: adrianc > Date: Mon Mar 12 23:20:55 2012 > New Revision: 1299924 > > URL: http://svn.apache.org/viewvc?

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Adrian Crum
Cool - thanks! My apologies - I had not given much thought to the object construction sequence in that section of code. I'm pretty sure I followed good concurrency practices overall, but there is always a chance I missed something. -Adrian On 3/13/2012 3:49 PM, Jacopo Cappellato wrote: This

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
This is now fixed in rev. 1300202 By the way: we will need to carefully review the way ScriptHelper/ContextHelper are built (and especially how the context is passed) in order to make sure the code is thread safe. Jacopo On Mar 13, 2012, at 11:42 AM, Jacopo Cappellato wrote: > Ok thanks... it

[jira] [Commented] (OFBIZ-4688) For script tag in action section in Screen (and form) use a FlexibleStringExpander for scriptLocation and correctly manage minilang script context

2012-03-13 Thread Olivier Heintz (Commented) (JIRA)
[ https://issues.apache.org/jira/browse/OFBIZ-4688?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228452#comment-13228452 ] Olivier Heintz commented on OFBIZ-4688: --- this modification was present in the first

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
oops... please ignore my last one (doesn't make much sense) Jacopo On Mar 13, 2012, at 4:34 PM, Jacopo Cappellato wrote: > Adrian, > > are you sure it is ok to create a ScriptHelper in this way: > >public static ScriptHelper createScriptHelper(ScriptContext context) { >if (helperF

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
Adrian, are you sure it is ok to create a ScriptHelper in this way: public static ScriptHelper createScriptHelper(ScriptContext context) { if (helperFactory != null) { return helperFactory.getInstance(context); } return null; } ? I think you need a ne

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
Yes, but I really think that, if we define what is part of the "core OFBiz framework" we could even go with merging the "core code" into one component. That would be even easier... but this is food for another day, I can survive even if makeValue returns a Map for now. Jacopo On Mar 13, 2012,

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
On Mar 13, 2012, at 8:58 AM, Adrian Crum wrote: >>> Could you share with the rest of us the limitations caused by the >>> refactoring? > One annoying limitation is that, after switching from GroovyEngine to ScriptEngine my IDE (I am using Idea) is no more able to debug my Groovy services; thi

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Adrian Crum
Yes, the arch-nemesis of innovation - component cross-dependency. That's why the script helper needs a factory. I was thinking we can insert a script component in between the service and common component dependency. Move all of the script classes there - *Util.java, event handlers, services en

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
Is there a reason for not returning a GenericValue from: Map makeValue(String entityName) ? Well, the good reason is probably the dependency issue between framework components... in my opinion it would be a good time to start thinking to drop it and consider the "core framework components"

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
I think that this is because of the way it is initialized: ScriptContext scriptContext = new SimpleScriptContext(); ScriptHelper helper = createScriptHelper(scriptContext); Jacopo On Mar 13, 2012, at 11:42 AM, Jacopo Cappellato wrote: > Ok thanks... it doesn't work for me becaus

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
Ok thanks... it doesn't work for me because the scriptType is set to UNKNOWN instead of SERVICE... I am debugging it now. Jacopo On Mar 13, 2012, at 11:16 AM, Adrian Crum wrote: > org.ofbiz.service.engine.ScriptEngine.java, line 85 and below. > > -Adrian > > On 3/13/2012 10:11 AM, Jacopo Capp

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Adrian Crum
org.ofbiz.service.engine.ScriptEngine.java, line 85 and below. -Adrian On 3/13/2012 10:11 AM, Jacopo Cappellato wrote: Hey Adrian, a quick question before I dig into the details. I am using the success(..)/error(...) methods to get a result Map (for services) or result String (for Events) and

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
Hey Adrian, a quick question before I dig into the details. I am using the success(..)/error(...) methods to get a result Map (for services) or result String (for Events) and I have noticed that in the new implementation they are saved using the ContextHelper.putResults method. Who is supposed t

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Adrian Crum
On 3/13/2012 7:46 AM, Jacopo Cappellato wrote: On Mar 13, 2012, at 7:59 AM, Adrian Crum wrote: Jacopo, Could you share with the rest of us the limitations caused by the refactoring? Definitely: I will review, study and use the new code and I will provide feedback about the gaps I see. Oh.

Re: Groovy services and a DSL for OFBiz - a POC

2012-03-13 Thread Jacopo Cappellato
On Mar 13, 2012, at 7:59 AM, Adrian Crum wrote: > Jacopo, > > Could you share with the rest of us the limitations caused by the refactoring? > Definitely: I will review, study and use the new code and I will provide feedback about the gaps I see. One thing that I am not sure I like is the fact