Using <call-bsh> in minilang

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Using <call-bsh> in minilang

justin.g.robinson
I've been trying to wing it with minilang, it seems pretty straight
forward...but I ended up with a situation where I could either go with
minlang recursion (no clue how to handle the ins and outs) or a bsh
script, since the function I need is already defined in a java class
I'm trying to go with the latter.

The method I wish to use requires a delegator as an argument, how
would I provide this from within a minilang script?
Also is it possible to set a field field="field" from-field="declared
inside" <call-bsh></call-bsh> tag.(see example)

fragment:

<!--The objective here is to look up the CustRequestRole entity of roleTypeId:
                                        CONTACT, to get the contact partyId so it's email address can be used if
                                        there is none on the account -->
                                <if-empty field="parameters.sendTo">
                                        <call-bsh>
                                                String contactPartyId =
                                                com.opensourcestrategies.crmsfa.cases.UtilCase.getCasePrimaryContactPartyId(delegator,
                                                custRequestId));
                        </call-bsh>
                                        <set field="getEmail.partyId" from-field="contactPartyId" />
                                        <call-service service-name="getPartyEmail"
                                                in-map-name="getEmail">
                                                <result-to-field result-name="emailAddress" field="parameters.sendTo" />
                                        </call-service>
                                </if-empty>


--
Regards,
Justin
Venture-Net Research & Development
Reply | Threaded
Open this post in threaded view
|

Re: Using <call-bsh> in minilang

Jacques Le Roux
Administrator
Please ask rather Opentaps questions on Opentaps forum

Thanks

Jacques

From: "Justin Robinson" <[hidden email]>

> I've been trying to wing it with minilang, it seems pretty straight
> forward...but I ended up with a situation where I could either go with
> minlang recursion (no clue how to handle the ins and outs) or a bsh
> script, since the function I need is already defined in a java class
> I'm trying to go with the latter.
>
> The method I wish to use requires a delegator as an argument, how
> would I provide this from within a minilang script?
> Also is it possible to set a field field="field" from-field="declared
> inside" <call-bsh></call-bsh> tag.(see example)
>
> fragment:
>
> <!--The objective here is to look up the CustRequestRole entity of roleTypeId:
> CONTACT, to get the contact partyId so it's email address can be used if
> there is none on the account -->
> <if-empty field="parameters.sendTo">
> <call-bsh>
> String contactPartyId =
> com.opensourcestrategies.crmsfa.cases.UtilCase.getCasePrimaryContactPartyId(delegator,
> custRequestId));
>                 </call-bsh>
> <set field="getEmail.partyId" from-field="contactPartyId" />
> <call-service service-name="getPartyEmail"
> in-map-name="getEmail">
> <result-to-field result-name="emailAddress" field="parameters.sendTo" />
> </call-service>
> </if-empty>
>
>
> --
> Regards,
> Justin
> Venture-Net Research & Development
>

Reply | Threaded
Open this post in threaded view
|

Re: Using <call-bsh> in minilang

justin.g.robinson
I was under the impression it was the ofbiz mini-lang not the opentaps
mini-lang, I'm asking about mini-lang syntax not opentaps application
logic.(For this reason I didn't edit out opentaps related code from my
example...)

I'm trying to discover how parameters are passed around in mini-lang,
nothing to do with opentaps. Online documentation and associated books
haven't made this clear to me. Which is why I'm asking here.

I think I know at this stage of the game what is related to the ofbiz
framework as opposed to the opentaps implementation...my apologies if
I'm under some strange misapprehension.

On Tue, Mar 8, 2011 at 2:49 PM, Jacques Le Roux
<[hidden email]> wrote:

> Please ask rather Opentaps questions on Opentaps forum
>
> Thanks
>
> Jacques
>
> From: "Justin Robinson" <[hidden email]>
>>
>> I've been trying to wing it with minilang, it seems pretty straight
>> forward...but I ended up with a situation where I could either go with
>> minlang recursion (no clue how to handle the ins and outs) or a bsh
>> script, since the function I need is already defined in a java class
>> I'm trying to go with the latter.
>>
>> The method I wish to use requires a delegator as an argument, how
>> would I provide this from within a minilang script?
>> Also is it possible to set a field field="field" from-field="declared
>> inside" <call-bsh></call-bsh> tag.(see example)
>>
>> fragment:
>>
>> <!--The objective here is to look up the CustRequestRole entity of
>> roleTypeId:
>> CONTACT, to get the contact partyId so it's email address can be used if
>> there is none on the account -->
>> <if-empty field="parameters.sendTo">
>> <call-bsh>
>> String contactPartyId =
>>
>> com.opensourcestrategies.crmsfa.cases.UtilCase.getCasePrimaryContactPartyId(delegator,
>> custRequestId));
>>                </call-bsh>
>> <set field="getEmail.partyId" from-field="contactPartyId" />
>> <call-service service-name="getPartyEmail"
>> in-map-name="getEmail">
>> <result-to-field result-name="emailAddress" field="parameters.sendTo" />
>> </call-service>
>> </if-empty>
>>
>>
>> --
>> Regards,
>> Justin
>> Venture-Net Research & Development
>>
>
>



--
Regards,
Justin
Venture-Net Research & Development
Reply | Threaded
Open this post in threaded view
|

Re: Using <call-bsh> in minilang

Scott Gray-2
delegator is always available in the context of a minilang method so you don't need to do anything special to reference it in the call-bsh tag.  In the example below, the call-class-method tag could have been used instead as well.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 9/03/2011, at 4:23 AM, Justin Robinson wrote:

> I was under the impression it was the ofbiz mini-lang not the opentaps
> mini-lang, I'm asking about mini-lang syntax not opentaps application
> logic.(For this reason I didn't edit out opentaps related code from my
> example...)
>
> I'm trying to discover how parameters are passed around in mini-lang,
> nothing to do with opentaps. Online documentation and associated books
> haven't made this clear to me. Which is why I'm asking here.
>
> I think I know at this stage of the game what is related to the ofbiz
> framework as opposed to the opentaps implementation...my apologies if
> I'm under some strange misapprehension.
>
> On Tue, Mar 8, 2011 at 2:49 PM, Jacques Le Roux
> <[hidden email]> wrote:
>> Please ask rather Opentaps questions on Opentaps forum
>>
>> Thanks
>>
>> Jacques
>>
>> From: "Justin Robinson" <[hidden email]>
>>>
>>> I've been trying to wing it with minilang, it seems pretty straight
>>> forward...but I ended up with a situation where I could either go with
>>> minlang recursion (no clue how to handle the ins and outs) or a bsh
>>> script, since the function I need is already defined in a java class
>>> I'm trying to go with the latter.
>>>
>>> The method I wish to use requires a delegator as an argument, how
>>> would I provide this from within a minilang script?
>>> Also is it possible to set a field field="field" from-field="declared
>>> inside" <call-bsh></call-bsh> tag.(see example)
>>>
>>> fragment:
>>>
>>> <!--The objective here is to look up the CustRequestRole entity of
>>> roleTypeId:
>>> CONTACT, to get the contact partyId so it's email address can be used if
>>> there is none on the account -->
>>> <if-empty field="parameters.sendTo">
>>> <call-bsh>
>>> String contactPartyId =
>>>
>>> com.opensourcestrategies.crmsfa.cases.UtilCase.getCasePrimaryContactPartyId(delegator,
>>> custRequestId));
>>>                </call-bsh>
>>> <set field="getEmail.partyId" from-field="contactPartyId" />
>>> <call-service service-name="getPartyEmail"
>>> in-map-name="getEmail">
>>> <result-to-field result-name="emailAddress" field="parameters.sendTo" />
>>> </call-service>
>>> </if-empty>
>>>
>>>
>>> --
>>> Regards,
>>> Justin
>>> Venture-Net Research & Development
>>>
>>
>>
>
>
>
> --
> Regards,
> Justin
> Venture-Net Research & Development


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using <call-bsh> in minilang

Scott Gray-2
About setting a field, if you return a Map from the bsh script then the contents of the map would be put into the context of the method.

Regards
Scott

On 9/03/2011, at 9:11 PM, Scott Gray wrote:

> delegator is always available in the context of a minilang method so you don't need to do anything special to reference it in the call-bsh tag.  In the example below, the call-class-method tag could have been used instead as well.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 9/03/2011, at 4:23 AM, Justin Robinson wrote:
>
>> I was under the impression it was the ofbiz mini-lang not the opentaps
>> mini-lang, I'm asking about mini-lang syntax not opentaps application
>> logic.(For this reason I didn't edit out opentaps related code from my
>> example...)
>>
>> I'm trying to discover how parameters are passed around in mini-lang,
>> nothing to do with opentaps. Online documentation and associated books
>> haven't made this clear to me. Which is why I'm asking here.
>>
>> I think I know at this stage of the game what is related to the ofbiz
>> framework as opposed to the opentaps implementation...my apologies if
>> I'm under some strange misapprehension.
>>
>> On Tue, Mar 8, 2011 at 2:49 PM, Jacques Le Roux
>> <[hidden email]> wrote:
>>> Please ask rather Opentaps questions on Opentaps forum
>>>
>>> Thanks
>>>
>>> Jacques
>>>
>>> From: "Justin Robinson" <[hidden email]>
>>>>
>>>> I've been trying to wing it with minilang, it seems pretty straight
>>>> forward...but I ended up with a situation where I could either go with
>>>> minlang recursion (no clue how to handle the ins and outs) or a bsh
>>>> script, since the function I need is already defined in a java class
>>>> I'm trying to go with the latter.
>>>>
>>>> The method I wish to use requires a delegator as an argument, how
>>>> would I provide this from within a minilang script?
>>>> Also is it possible to set a field field="field" from-field="declared
>>>> inside" <call-bsh></call-bsh> tag.(see example)
>>>>
>>>> fragment:
>>>>
>>>> <!--The objective here is to look up the CustRequestRole entity of
>>>> roleTypeId:
>>>> CONTACT, to get the contact partyId so it's email address can be used if
>>>> there is none on the account -->
>>>> <if-empty field="parameters.sendTo">
>>>> <call-bsh>
>>>> String contactPartyId =
>>>>
>>>> com.opensourcestrategies.crmsfa.cases.UtilCase.getCasePrimaryContactPartyId(delegator,
>>>> custRequestId));
>>>>               </call-bsh>
>>>> <set field="getEmail.partyId" from-field="contactPartyId" />
>>>> <call-service service-name="getPartyEmail"
>>>> in-map-name="getEmail">
>>>> <result-to-field result-name="emailAddress" field="parameters.sendTo" />
>>>> </call-service>
>>>> </if-empty>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Justin
>>>> Venture-Net Research & Development
>>>>
>>>
>>>
>>
>>
>>
>> --
>> Regards,
>> Justin
>> Venture-Net Research & Development
>


smime.p7s (3K) Download Attachment