[
https://issues.apache.org/jira/browse/OFBIZ-1801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601350#action_12601350
]
Scott Gray commented on OFBIZ-1801:
-----------------------------------
Hi Marco
Just a couple of things I wanted to point out:
1. You don't need to enclose the map keys in quotes, groovy always assumes a
string unless you explicitly state otherwise
['productId' : productId] can just be [productId : productId]
2. When a map/list/string is coerced to a boolean, empty and null both return
false anything else returns true
if (productPriceRules && productPriceRules.size()) can just be
(productPriceRules)
Note: an exception to this is that for numbers zero is considered false
3. delegator, security, locale and dispatcher are all available by default so
their declarations can be removed from the scripts
4. EntityExpr is deprecated, you should use EntityCondition.makeCondition
instead
Thanks for your help
> Conversion of some bean shell scripts to groovy
> -----------------------------------------------
>
> Key: OFBIZ-1801
> URL: https://issues.apache.org/jira/browse/OFBIZ-1801
> Project: OFBiz
> Issue Type: Improvement
> Components: product
> Affects Versions: SVN trunk
> Reporter: Marco Risaliti
> Assignee: Marco Risaliti
> Priority: Minor
> Fix For: SVN trunk
>
> Attachments: ApplyFeaturesFromCategory.groovy,
> ApplyFeaturesFromGroup.groovy, EditProductAssoc.groovy,
> EditProductContent.groovy, EditProductContentContent.groovy,
> EditProductInventoryItems.groovy, EditProductQuickAdmin.groovy,
> QuickAddVariants.groovy
>
>
> I have tried to convert some bsh script of product screens and seems to me
> groovy is very more faster/readable and easy to write.
> I upload here some new scripts that has to be tested.
> I will upload later a patch for ProductScreens.xml for using the new groovy
> scripts.
> Thanks
> Marco
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.