[
https://issues.apache.org/jira/browse/OFBIZ-10031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16331203#comment-16331203 ]
Nicolas Malin commented on OFBIZ-10031:
---------------------------------------
Hi Dennis, nice staff
After a first review, I seem we can improve some following code :
{code:java}
GenericValue lookedUpValue = delegator.makeValidValue("ProductCategory", parameters)
lookedUpValue = from("ProductCategory")
.where(lookedUpValue.getFields(lookedUpValue.getModelEntity().getPkFieldNames()))
.queryOne(){code}
by
{code:java}lookedUpValue = from("ProductCategory").where(parameters).queryOne(){code}
----
{code:java}
GenericValue newEntity = delegator.makeValidValue("ProductCategoryRole", parameters){code}
by{code:java}
GenericValue newEntity = makeValue("ProductCategoryRole", parameters)
{code}
----
{code:java}
Map callCreateProductMap = dispatcher.dispatchContext.makeValidContext("createProduct", ModelService.IN_PARAM, parameters)
if (!callCreateProductMap.productTypeId) {
callCreateProductMap.productTypeId = "FINISHED_GOOD"
}
Map cPRes = run service: "createProduct", with: callCreateProductMap{code}
by
{code:java}if (!callCreateProductMap.parameters) {
parameters.productTypeId = "FINISHED_GOOD"
}
Map cPRes = run service: "createProduct", with: parameters{code}
----
I will check if we can improve the groovy context to simplify this {code:java}Security security = dispatcher.dispatchContext.security{code}
> Convert CategoryServices.xml mini lang to groovy
> ------------------------------------------------
>
> Key: OFBIZ-10031
> URL:
https://issues.apache.org/jira/browse/OFBIZ-10031> Project: OFBiz
> Issue Type: Sub-task
> Components: framework
> Affects Versions: Trunk
> Reporter: Dennis Balkir
> Assignee: Nicolas Malin
> Priority: Minor
> Attachments: OFBIZ-10031_org.apache.ofbiz.product.category.CategoryServices_convert.patch
>
>
> Migration of the CategoryServices.xml to Groovy
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)