You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Nicolas Malin (Jira)" <ji...@apache.org> on 2020/03/05 08:09:00 UTC

[jira] [Comment Edited] (OFBIZ-11436) Convert ProductContentServices.xml mini lang to groovy

    [ https://issues.apache.org/jira/browse/OFBIZ-11436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17051872#comment-17051872 ] 

Nicolas Malin edited comment on OFBIZ-11436 at 3/5/20, 8:08 AM:
----------------------------------------------------------------

Thanks [~sberg] for your patch, my remarks :
{code:java}
UtilValidate.is[Not]Empty{code}
are useless :
 * 'if (UtilValidate.isNotEmpty(parameters.metaDescription)) {' == 'if (parameters.metaDescription) {'
 * 'if (UtilValidate.isEmpty(updateProductPromoContentMap.thruDate)) {' == 'if (!updateProductPromoContentMap.thruDate) {'

 

 
{code:java}
  Map updateContent = parameters
 run service:"updateContent", with: updateContent
{code}
 
 * You can write directly 'run service:"updateContent", with: parameters'

 
{code:java}
.where([dataResourceId: productContent.dataResourceId]){code}
 * [ ] are useless you can also do : .where(dataResourceId: productContent.dataResourceId)

 
{code:java}
productContents = from("ProductContentAndInfo").where([productId: parameters.productId, productContentTypeId: "PAGE_TITLE"]).queryList()
if (UtilValidate.isNotEmpty(productContents)) {
GenericValue productContent = productContents.get(0){code}
You can replace by a direct GenericValue resolution :

 
{code:java}
GenericValue productContent = from("ProductContentAndInfo").where(productId: parameters.productId, productContentTypeId: "PAGE_TITLE").queryFirst()
if (productContent) { ...{code}


was (Author: soledad):
Thanks [~sberg] for you patch, my remarks :
{code:java}
UtilValidate.is[Not]Empty{code}
are useless :
 * 'if (UtilValidate.isNotEmpty(parameters.metaDescription)) {' == 'if (parameters.metaDescription) {'
 * 'if (UtilValidate.isEmpty(updateProductPromoContentMap.thruDate)) {' == 'if (!updateProductPromoContentMap.thruDate) {'

 

 
{code:java}
  Map updateContent = parameters
 run service:"updateContent", with: updateContent
{code}
 
 * You can write directly 'run service:"updateContent", with: parameters'

 
{code:java}
.where([dataResourceId: productContent.dataResourceId]){code}
 * [ ] are useless you can also do : .where(dataResourceId: productContent.dataResourceId)

 
{code:java}
productContents = from("ProductContentAndInfo").where([productId: parameters.productId, productContentTypeId: "PAGE_TITLE"]).queryList()
if (UtilValidate.isNotEmpty(productContents)) {
GenericValue productContent = productContents.get(0){code}
You can replace by a direct GenericValue resolution :

 
{code:java}
GenericValue productContent = from("ProductContentAndInfo").where(productId: parameters.productId, productContentTypeId: "PAGE_TITLE").queryFirst()
if (productContent) { ...{code}

> Convert ProductContentServices.xml mini lang to groovy
> ------------------------------------------------------
>
>                 Key: OFBIZ-11436
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-11436
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: product
>    Affects Versions: Trunk
>            Reporter: Sebastian Berg
>            Assignee: Sebastian Berg
>            Priority: Minor
>             Fix For: Upcoming Branch
>
>         Attachments: OFBIZ-11436-ProductContentServices.xml-minilang-to-groovy.patch
>
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)