You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Anil K Patel (JIRA)" <ji...@apache.org> on 2008/09/25 04:55:44 UTC

[jira] Created: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Enrich Groovy integration with Ofbiz framework
----------------------------------------------

                 Key: OFBIZ-1968
                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
             Project: OFBiz
          Issue Type: Improvement
          Components: framework
            Reporter: Anil K Patel
            Priority: Minor


Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Scott Gray (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858252#action_12858252 ] 

Scott Gray commented on OFBIZ-1968:
-----------------------------------

Here's an example of using groovy's Categories with existing util classes:
{code}
import org.ofbiz.entity.util.EntityUtil;

taxInfos = delegator.findByAnd("PartyTaxAuthInfo", [partyId : billingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId])
use (EntityUtil) {
    // Equivalent to EntityUtil.filterByDate(taxInfos);
    dateFilteredTaxInfos = taxInfos.filterByDate();
}
{code}



> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Scott Gray (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12711534#action_12711534 ] 

Scott Gray commented on OFBIZ-1968:
-----------------------------------

Part of a presentation I saw today covered DSLs with Groovy.  I think we could possibly do some cool stuff for with operator overloading and method/property interception

Something like:
{code}
product = "Product".findOne(['productId', productId])
serviceResult = "getWorkEffortsByPeriod".runSync(context)

entityExp = EntityExpression.prepare {
    "fixedAssetId" == fixedAssetId
    "currentStatusId" == currentStatusId
    "fromDate" >= nowTimestamp
}
{code}
or something like that anyway

> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: EntityConditionBuilder for Groovy WAS: Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Thanks, I liked it enough myself that I just went ahead and committed it :-)

Based on a couple of conversions over to it, I think it should result in a lot less typing and better readability.

Regards
Scott

On 18/04/2010, at 9:48 PM, Jacopo Cappellato wrote:

> Very cool, Scott!
> 
> Jacopo
> 
> On Apr 18, 2010, at 11:39 AM, Scott Gray wrote:
> 
>> There were a few quirks with words like "in" and "equals" so I had to go with upper case but it all works now.
>> Here's some example usage code:
>> 
>> import org.ofbiz.entity.condition.EntityConditionBuilder
>> 
>> expBldr = new EntityExpressionBuilder()
>> 
>> // build regular EntityConditions
>> equalsExp = expBldr.EQUALS(productId: "GZ-1000)
>> 
>> inExp = expBldr.IN(productId: ["GZ-1000", "GZ-1006"])
>> 
>> // build an EntityConditionList
>> orExp = expBldr.OR() {
>>   EQUALS(productId: "GZ-1000")
>>   IN(productId: ["GZ-1000", "GZ-1006"])
>>   AND() {
>>       LIKE(productName: "%Gizmo%")
>>       LIKE(productName: "%Micro%")
>>   }
>> }
>> 
>> // you can also build an EntityConditionList by passing a single or list of EntityConditions
>> // list
>> orExp = expBldr.OR([equalsExp, inExpr])
>> // single
>> orExp = expBldr.OR(equalsExp)
>> 
>> // add an existing EntityCondition and also some nested ones
>> orExp = expBldr.OR(equalsExpr) {
>>   IN(productId: ["GZ-1000", "GZ-1006"])
>>   AND() {
>>       LIKE(productName: "%Gizmo%")
>>       LIKE(productName: "%Micro%")
>>   }
>> }
>> 
>> Regards
>> Scott
>> 
>> On 18/04/2010, at 5:01 PM, Ean Schuessler wrote:
>> 
>>> That's some very interesting stuff you have going there. I'd definitely use that. 
>>> 
>>> ----- "Scott Gray (JIRA)" wrote: 
>>>> [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858261#action_12858261 ] 
>>>> Scott Gray commented on OFBIZ-1968: 
>>>> ----------------------------------- 
>>>> Here's an example I can actually get to work for building entity expressions: 
>>>> {code} 
>>>> entityCondition = expression.AND() { 
>>>> equals (productId: 12345), 
>>>> in (productId: [1, 2, 3, 4]), 
>>>> like (productId: "1234%"), 
>>>> OR() { 
>>>> equals (productId: "54321"), 
>>>> between (productId: [0, 1, 2, 3, 4, 5]) 
>>>> } 
>>>> } 
>>>> {code} 
>>>> Any thoughts? 
>>> 
>>> -- 
>>> Ean Schuessler, CTO Brainfood.com 
>>> ean@brainfood.com - http://www.brainfood.com - 214-720-0700 x 315 
>>> 
>>> 
>> 
> 


Re: EntityConditionBuilder for Groovy WAS: Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by Adrian Crum <ad...@yahoo.com>.
Bravo!

-Adrian

--- On Sun, 4/18/10, Jacopo Cappellato <ja...@hotwaxmedia.com> wrote:

> From: Jacopo Cappellato <ja...@hotwaxmedia.com>
> Subject: Re: EntityConditionBuilder for Groovy WAS: Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework
> To: dev@ofbiz.apache.org
> Date: Sunday, April 18, 2010, 2:48 AM
> Very cool, Scott!
> 
> Jacopo
> 
> On Apr 18, 2010, at 11:39 AM, Scott Gray wrote:
> 
> > There were a few quirks with words like "in" and
> "equals" so I had to go with upper case but it all works
> now.
> > Here's some example usage code:
> > 
> > import
> org.ofbiz.entity.condition.EntityConditionBuilder
> > 
> > expBldr = new EntityExpressionBuilder()
> > 
> > // build regular EntityConditions
> > equalsExp = expBldr.EQUALS(productId: "GZ-1000)
> > 
> > inExp = expBldr.IN(productId: ["GZ-1000", "GZ-1006"])
> > 
> > // build an EntityConditionList
> > orExp = expBldr.OR() {
> >    EQUALS(productId: "GZ-1000")
> >    IN(productId: ["GZ-1000", "GZ-1006"])
> >    AND() {
> >        LIKE(productName:
> "%Gizmo%")
> >        LIKE(productName:
> "%Micro%")
> >    }
> > }
> > 
> > // you can also build an EntityConditionList by
> passing a single or list of EntityConditions
> > // list
> > orExp = expBldr.OR([equalsExp, inExpr])
> > // single
> > orExp = expBldr.OR(equalsExp)
> > 
> > // add an existing EntityCondition and also some
> nested ones
> > orExp = expBldr.OR(equalsExpr) {
> >    IN(productId: ["GZ-1000", "GZ-1006"])
> >    AND() {
> >        LIKE(productName:
> "%Gizmo%")
> >        LIKE(productName:
> "%Micro%")
> >    }
> > }
> > 
> > Regards
> > Scott
> > 
> > On 18/04/2010, at 5:01 PM, Ean Schuessler wrote:
> > 
> >> That's some very interesting stuff you have going
> there. I'd definitely use that. 
> >> 
> >> ----- "Scott Gray (JIRA)" wrote: 
> >>> [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858261#action_12858261
> ] 
> >>> Scott Gray commented on OFBIZ-1968: 
> >>> ----------------------------------- 
> >>> Here's an example I can actually get to work
> for building entity expressions: 
> >>> {code} 
> >>> entityCondition = expression.AND() { 
> >>> equals (productId: 12345), 
> >>> in (productId: [1, 2, 3, 4]), 
> >>> like (productId: "1234%"), 
> >>> OR() { 
> >>> equals (productId: "54321"), 
> >>> between (productId: [0, 1, 2, 3, 4, 5]) 
> >>> } 
> >>> } 
> >>> {code} 
> >>> Any thoughts? 
> >> 
> >> -- 
> >> Ean Schuessler, CTO Brainfood.com 
> >> ean@brainfood.com
> - http://www.brainfood.com - 214-720-0700 x 315 
> >> 
> >> 
> > 
> 
> 


      

Re: EntityConditionBuilder for Groovy WAS: Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by Jacopo Cappellato <ja...@hotwaxmedia.com>.
Very cool, Scott!

Jacopo

On Apr 18, 2010, at 11:39 AM, Scott Gray wrote:

> There were a few quirks with words like "in" and "equals" so I had to go with upper case but it all works now.
> Here's some example usage code:
> 
> import org.ofbiz.entity.condition.EntityConditionBuilder
> 
> expBldr = new EntityExpressionBuilder()
> 
> // build regular EntityConditions
> equalsExp = expBldr.EQUALS(productId: "GZ-1000)
> 
> inExp = expBldr.IN(productId: ["GZ-1000", "GZ-1006"])
> 
> // build an EntityConditionList
> orExp = expBldr.OR() {
>    EQUALS(productId: "GZ-1000")
>    IN(productId: ["GZ-1000", "GZ-1006"])
>    AND() {
>        LIKE(productName: "%Gizmo%")
>        LIKE(productName: "%Micro%")
>    }
> }
> 
> // you can also build an EntityConditionList by passing a single or list of EntityConditions
> // list
> orExp = expBldr.OR([equalsExp, inExpr])
> // single
> orExp = expBldr.OR(equalsExp)
> 
> // add an existing EntityCondition and also some nested ones
> orExp = expBldr.OR(equalsExpr) {
>    IN(productId: ["GZ-1000", "GZ-1006"])
>    AND() {
>        LIKE(productName: "%Gizmo%")
>        LIKE(productName: "%Micro%")
>    }
> }
> 
> Regards
> Scott
> 
> On 18/04/2010, at 5:01 PM, Ean Schuessler wrote:
> 
>> That's some very interesting stuff you have going there. I'd definitely use that. 
>> 
>> ----- "Scott Gray (JIRA)" wrote: 
>>> [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858261#action_12858261 ] 
>>> Scott Gray commented on OFBIZ-1968: 
>>> ----------------------------------- 
>>> Here's an example I can actually get to work for building entity expressions: 
>>> {code} 
>>> entityCondition = expression.AND() { 
>>> equals (productId: 12345), 
>>> in (productId: [1, 2, 3, 4]), 
>>> like (productId: "1234%"), 
>>> OR() { 
>>> equals (productId: "54321"), 
>>> between (productId: [0, 1, 2, 3, 4, 5]) 
>>> } 
>>> } 
>>> {code} 
>>> Any thoughts? 
>> 
>> -- 
>> Ean Schuessler, CTO Brainfood.com 
>> ean@brainfood.com - http://www.brainfood.com - 214-720-0700 x 315 
>> 
>> 
> 


Re: EntityConditionBuilder for Groovy WAS: Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by chris snow <ch...@googlemail.com>.
Very nice!

EntityConditionBuilder for Groovy WAS: Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by Scott Gray <sc...@hotwaxmedia.com>.
There were a few quirks with words like "in" and "equals" so I had to go with upper case but it all works now.
Here's some example usage code:

import org.ofbiz.entity.condition.EntityConditionBuilder

expBldr = new EntityExpressionBuilder()

// build regular EntityConditions
equalsExp = expBldr.EQUALS(productId: "GZ-1000)

inExp = expBldr.IN(productId: ["GZ-1000", "GZ-1006"])

// build an EntityConditionList
orExp = expBldr.OR() {
    EQUALS(productId: "GZ-1000")
    IN(productId: ["GZ-1000", "GZ-1006"])
    AND() {
        LIKE(productName: "%Gizmo%")
        LIKE(productName: "%Micro%")
    }
}

// you can also build an EntityConditionList by passing a single or list of EntityConditions
// list
orExp = expBldr.OR([equalsExp, inExpr])
// single
orExp = expBldr.OR(equalsExp)

// add an existing EntityCondition and also some nested ones
orExp = expBldr.OR(equalsExpr) {
    IN(productId: ["GZ-1000", "GZ-1006"])
    AND() {
        LIKE(productName: "%Gizmo%")
        LIKE(productName: "%Micro%")
    }
}

Regards
Scott

On 18/04/2010, at 5:01 PM, Ean Schuessler wrote:

> That's some very interesting stuff you have going there. I'd definitely use that. 
> 
> ----- "Scott Gray (JIRA)" wrote: 
>> [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858261#action_12858261 ] 
>> Scott Gray commented on OFBIZ-1968: 
>> ----------------------------------- 
>> Here's an example I can actually get to work for building entity expressions: 
>> {code} 
>> entityCondition = expression.AND() { 
>> equals (productId: 12345), 
>> in (productId: [1, 2, 3, 4]), 
>> like (productId: "1234%"), 
>> OR() { 
>> equals (productId: "54321"), 
>> between (productId: [0, 1, 2, 3, 4, 5]) 
>> } 
>> } 
>> {code} 
>> Any thoughts? 
> 
> -- 
> Ean Schuessler, CTO Brainfood.com 
> ean@brainfood.com - http://www.brainfood.com - 214-720-0700 x 315 
> 
> 


Re: [jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by Ean Schuessler <ea...@brainfood.com>.
That's some very interesting stuff you have going there. I'd definitely use that. 

----- "Scott Gray (JIRA)" wrote: 
> [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858261#action_12858261 ] 
> Scott Gray commented on OFBIZ-1968: 
> ----------------------------------- 
> Here's an example I can actually get to work for building entity expressions: 
> {code} 
> entityCondition = expression.AND() { 
> equals (productId: 12345), 
> in (productId: [1, 2, 3, 4]), 
> like (productId: "1234%"), 
> OR() { 
> equals (productId: "54321"), 
> between (productId: [0, 1, 2, 3, 4, 5]) 
> } 
> } 
> {code} 
> Any thoughts? 

-- 
Ean Schuessler, CTO Brainfood.com 
ean@brainfood.com - http://www.brainfood.com - 214-720-0700 x 315 



[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Scott Gray (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858261#action_12858261 ] 

Scott Gray commented on OFBIZ-1968:
-----------------------------------

Here's an example I can actually get to work for building entity expressions:
{code}
entityCondition = expression.AND() {
    equals (productId: 12345),
    in (productId: [1, 2, 3, 4]),
    like (productId: "1234%"),
    OR() {
        equals (productId: "54321"),
        between (productId: [0, 1, 2, 3, 4, 5])
    }
}
{code}

Any thoughts?

> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634416#action_12634416 ] 

jacques.le.roux edited comment on OFBIZ-1968 at 9/25/08 2:34 AM:
-----------------------------------------------------------------

Sorry for the edit, I shall have used my own advices ;) 
Hi Jacopo,

Simply put \{code\} around your code when your paste it. The little blue button at right allows you to check/modify.
It's the same syntax than WIki Markup in Confluence BTW

{code}
// Example of a simple "updateProduct" CRUD-like method
product = findOne([productId: parameters.productId]);
if (product) { 
    setNonPkFields(parameters, product); product.store();
} else { 
    addError("Product with ID [" + parameters.productId + "] not found."); 
}
checkErrors();
{code}

Enjoy :o)

      was (Author: jacques.le.roux):
    Hi Jacopo,

Simply put {code} around when your paste your code, the blue button at right allows you to check/modify

{code}
// Example of a simple "updateProduct" CRUD-like method
product = findOne([productId: parameters.productId]);
if (product) { 
    setNonPkFields(parameters, product); product.store();
} else { 
    addError("Product with ID [" + parameters.productId + "] not found."); 
}
checkErrors();
{code}

Enjoy :o)
  
> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634396#action_12634396 ] 

Jacopo Cappellato commented on OFBIZ-1968:
------------------------------------------

Sorry for the bad code formatting of my last comments... I don't know why the new lines have been messed up when I have submitted the form.

Jacopo



> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Ashish Vijaywargiya (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712439#action_12712439 ] 

Ashish Vijaywargiya commented on OFBIZ-1968:
--------------------------------------------

+1 to have feature something like this in OFBiz.
It will make developer's life little easy.

--
Ashish

> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634433#action_12634433 ] 

Jacopo Cappellato commented on OFBIZ-1968:
------------------------------------------

Ok, following Jacques's suggestion, here is the original code formatted properly (thanks Jacques):

{code}
// Example of a simple "updateProduct" CRUD-like method
product = findOne([productId: parameters.productId]);
if (product) { 
    setNonPkFields(parameters, product);
    product.store();
} else { 
    addError("Product with ID [" + parameters.productId + "] not found."); 
}
checkErrors();
{code}



> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Anil K Patel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634466#action_12634466 ] 

Anil K Patel commented on OFBIZ-1968:
-------------------------------------

Jacopo, Jacques, 
Thanks for interest in this topic. I am starting to learn Groovy. Very soon I'll post further details here. All the help and Ideas are much appreciated.

> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Jacopo Cappellato (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634395#action_12634395 ] 

Jacopo Cappellato commented on OFBIZ-1968:
------------------------------------------

Anil,

this is a very interesting effort. Before we start I'd suggest to define together the end result of this prototype.
Here is the first thing I can think of (any comments are appreciated):

// Example of a simple "updateProduct" CRUD-like method

product = findOne([productId: parameters.productId]);
if (product) {
    setNonPkFields(parameters, product);
    product.store();
} else {
   addError("Product with ID [" + parameters.productId + "] not found.");
}
checkErrors();



> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OFBIZ-1968) Enrich Groovy integration with Ofbiz framework

Posted by "Jacques Le Roux (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OFBIZ-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12634416#action_12634416 ] 

Jacques Le Roux commented on OFBIZ-1968:
----------------------------------------

Hi Jacopo,

Simply put {code} around when your paste your code, the blue button at right allows you to check/modify

{code}
// Example of a simple "updateProduct" CRUD-like method
product = findOne([productId: parameters.productId]);
if (product) { 
    setNonPkFields(parameters, product); product.store();
} else { 
    addError("Product with ID [" + parameters.productId + "] not found."); 
}
checkErrors();
{code}

Enjoy :o)

> Enrich Groovy integration with Ofbiz framework
> ----------------------------------------------
>
>                 Key: OFBIZ-1968
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1968
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>            Reporter: Anil K Patel
>            Priority: Minor
>
> Enrich Groovy integration with Ofbiz framework in order to bring goodies of Minilang to Groovy scripts. Start with simple things like use findByPrimaryKey in groovy scripts without having to prefix it with delegator and then automatically find values for primary key fields from environment if they are not explicitly passed in the call. Later other similar goodies of minilang can be added.
> Use Groovy to add DSL where possible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.