You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Justin Robinson <ju...@venturenet.co.za> on 2011/03/08 12:57:44 UTC

Using in minilang

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

Re: Using in minilang

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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
>> <ja...@les7arts.com> wrote:
>>> Please ask rather Opentaps questions on Opentaps forum
>>> 
>>> Thanks
>>> 
>>> Jacques
>>> 
>>> From: "Justin Robinson" <ju...@venturenet.co.za>
>>>> 
>>>> 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
> 


Re: Using in minilang

Posted by Scott Gray <sc...@hotwaxmedia.com>.
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
> <ja...@les7arts.com> wrote:
>> Please ask rather Opentaps questions on Opentaps forum
>> 
>> Thanks
>> 
>> Jacques
>> 
>> From: "Justin Robinson" <ju...@venturenet.co.za>
>>> 
>>> 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


Re: Using in minilang

Posted by Justin Robinson <ju...@venturenet.co.za>.
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
<ja...@les7arts.com> wrote:
> Please ask rather Opentaps questions on Opentaps forum
>
> Thanks
>
> Jacques
>
> From: "Justin Robinson" <ju...@venturenet.co.za>
>>
>> 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

Re: Using in minilang

Posted by Jacques Le Roux <ja...@les7arts.com>.
Please ask rather Opentaps questions on Opentaps forum

Thanks

Jacques

From: "Justin Robinson" <ju...@venturenet.co.za>
> 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
>