* 如何在minilang中使用Java靜態(tài)方法獲得數(shù)據(jù)
使用beanshell腳本:
<set field="notApplied" value="${bsh:org.ofbiz.accounting.invoice.InvoiceWorker.getInvoiceNotApplied(invoice)}" type="Double"/>
警告:你必須使用type=""來轉(zhuǎn)換你的結(jié)果類型,否則的話,它將返回字符串類型.
* 如何在minilang中調(diào)用Java程序
你可以在minilang中插入一段beanshell代碼,類似于 applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml的示例:
<call-bsh><![CDATA[
String password = (String) userLoginContext.get("currentPassword");
String confirmPassword = (String) userLoginContext.get("currentPasswordVerify");
String passwordHint = (String) userLoginContext.get("passwordHint");
org.ofbiz.securityext.login.LoginServices.checkNewPassword(newUserLogin, null, password, confirmPassword, passwordHint, error_list, true, locale);
]]></call-bsh>
在beanshell腳本中可以訪問在minilang中所有的變量
* 清除 與 刷新的比較
<clear-field field-name="foo"/> 設(shè)置它為null. 這可以是一個類的屬性或是集合中的一個值
<refresh-value value-name="foo"/> 從數(shù)據(jù)庫中重新獲得foo的值. foo必須是一個GenericValue.
* 如何設(shè)置一個布爾值
我無法找到任何例子,但是我這樣做是成功的:
<set field="orderAvailableCtx.countNewReturnItems" value="true" type="Boolean"/>
我想minilang使用type=""中的類型與value中的值的做為構(gòu)造調(diào)用.猜想在某天我看到這些代碼時能證明我是對的...
本文檔譯自ofbiz 4.0 cookbooks,本人翻譯,歡迎轉(zhuǎn)載,請注明出處.