I'm still not totally sure what you're trying to accomplish, or maybe more accurately, what you want to make easier.
Could you throw out some ofbiz-oriented pseudo code for the way you would do this now that you don't like?
I don't think I really like this section approach in the simple- methods. It adds a lot of otherwise meaningless stuff to the routines, and you'd still have to instrument a LOT of code in order to really be able to use it without modifying the original code, and any code that was instrumented this way would result in more lines of code to maintain, and they may not be maintained the way you like, especially if the purpose or intent isn't clear.
Based on more info about what you're trying to do I'm guessing we can find a better alternative that is more "automatic" and not so intrusive in existing code.
-David On Nov 16, 2007, at 10:47 AM, Chris Howe wrote:
I gave several ideas, the parameterized one is probably the least plausible because of security considerations. I'm leaning towards the <section-begin/section-end> tagging that would be otherwise inert to an ofbiz application.example: MySimpleMehtods.xml <simple-method method-name="myMehtod> ...some logic...<get-simple-method-section method-name="ofbizMethod" location="org/ ofbiz/ofbizApp/OfbizServices.xml" section="sectionA">...some more logic... </simple-method> OfbizServices.xml <simple-method method-name="ofbizMethod"> ...some ofbiz logic that I don't want to run in myMethod... <section-begin> <section name="sectionA"> </section-begin> ...some ofbiz logic that I want to run in myMethod... <section-end> <section name="sectionA"> </section-end> ...some more ofbiz logic that I don't want to run in myMethod... </simple-method>This would be similar to how <call-simple-method> works except you would be pulling a node that is a child of <simple-method> instead of a child node of <simple-methods>. And instead of pulling a node, you're pulling all elements between a section-begin and a section- end tag (this would allow for overlapping sections as well as being able to keep an iteration open).I'd really appreciate more comments, especially from the framework committers as this only has value if project simple-methods are allowed to be salted with <section-begin/section-end> tags.----- Original Message ---- From: Jonathon -- Improov <[EMAIL PROTECTED]> To: dev@ofbiz.apache.org Sent: Friday, November 16, 2007 10:02:09 AM Subject: Re: simple method subsections Are you suggesting something like abstract classes in Java, where some methods are implemented and some are not (blanks to be filled)? Parameterized simple methods. Sounds interesting. Some effort is needed to refactor the existing "OFBiz maintained" simple methods to publish such "hooks" where you can insert your own custom logics.Because that kind of elegant refactor takes time, it is often easier tojust hack it and get the job done. Unless we can identify numerous use cases for such elegant mechanisms, there's little ROI in doing such fanciful stuff.My choices are either to bring he recursion service into my custom application and make the minor modification or to iterate back through the list adding the result of the service and then sorting.I would just reuse the recursion service "as is", and go through the list with some after-processing. Maximize reuse, minimize maintenance cost. Project time frame is seldom less than cruel! If that ever becomes a performance bottle-neck, I'll then do something about it. Jonathon Chris Howe wrote:trade-off between code reuse and performance. Lets say I'm doing one of theThanks for the reply. Scope isn't my problem. My problem is arecursive party relationship services that returns a list of related parties, but I also need to run the partyNameForDate service beforeadding it to the list and I need to sort by name before displaying it on the screen. My choices are either to bring he recursion service into mycustom application and make the minor modification or to iterate back through the list adding the result of the service and then sorting.----- Original Message ---- From: Jonathon -- Improov <[EMAIL PROTECTED]> To: dev@ofbiz.apache.org Sent: Thursday, November 15, 2007 9:38:42 PM Subject: Re: simple method subsections Chris, Have a look at a thread I started at http://www.nabble.com/forum/ViewPost.jtp?post=10803536&framed=y . You also responded to that thread too. When you say "extend" a simple method, it might be easier to simply think of how you would extend a Java method. We would create a new method that first calls the old method, and then perform some custom actions after that (or the order could be flipped). Your suggestion with "selective reuse of parts of a simple method" would mean changing the original method (by inserting <section-begin> <section-end>), to "generic-ize" the original method. Then you might as well not call it "extension", but "customization" or "enhancement" or "refactor" instead. In that thread I pointed to, I had implemented a <call-simple-method-scoped> which allows simple methods to call other simple methods *exactly like how Java methodscancall other Java methods*. Unfortunately, the client I worked for now has exclusive rights tothatnew and convenient artifact. :/ So what's the problem of having simple methods call other simple methods now, you may ask? Scope is all mixed up into a single bowl of alphabet soup, singlenamespace.For those of us who know Java (or C or VB or just about any programming language at all), we know this isn't conventional, barely "right". To offer a solution to your question, I've found that the only way to call other methods in Minilang with proper scope (stored in call stack) is to use theServiceEngine. Yeah, it means that for every simple method you want to call, wrap them in a service and call the service instead. Jonathon Chris Howe wrote:I'm looking for some feedback on an idea I'm tossing around Problem: When creating a custom application, often times you will becreating business logic that is exactly like what is in OFBiz butneedsto be slightly modified before sending it to the entity engine for storage or before creating a result. (changing the way a price is calculated, adding specialized field information, etc).It would helpful to be able to call the OFBiz maintained method andthen extend it through a custom call.A couple ideas on how to accomplish this 1) Add two new element groups, <section-begin> <section name="sectionA"/> </section-begin ...some logic... <section-end> <section name="sectionA"/> </section-end> ...more logic... and salt the ofbiz method so that you can pull only the logicbetween the two2) mimic the screen-widget's decorator pattern 3) add a map of simple-methods to the method's context that allowsrunning extended codeextendMethod.myLocation#myMethod and then salt the ofbiz method to call if it exist. TIA for any thoughts ,Chris
smime.p7s
Description: S/MIME cryptographic signature