You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/11/11 10:33:15 UTC
svn commit: r1638054 - in /ofbiz/trunk:
applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy
Author: jacopoc
Date: Tue Nov 11 09:33:15 2014
New Revision: 1638054
URL: http://svn.apache.org/r1638054
Log:
Added to the OFBiz DSL the ability to invoke the new EntityQuery builder.
Modified two calls in OrderView.groovy to demonstrate the new feature.
Modified:
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1638054&r1=1638053&r2=1638054&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Tue Nov 11 09:33:15 2014
@@ -59,8 +59,8 @@ orderAdjustments = null;
comments = null;
if (orderId) {
- orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
- comments = EntityQuery.use(delegator).select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList();
+ orderHeader = from('OrderHeader').where('orderId', orderId).cache(false).queryFirst();
+ comments = select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList();
}
if (orderHeader) {
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy?rev=1638054&r1=1638053&r2=1638054&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/GroovyBaseScript.groovy Tue Nov 11 09:33:15 2014
@@ -18,7 +18,8 @@
*******************************************************************************/
package org.ofbiz.service.engine
-import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.Debug
+import org.ofbiz.entity.util.EntityQuery
import org.ofbiz.service.ServiceUtil
import org.ofbiz.service.ExecutionServiceException
@@ -52,6 +53,18 @@ abstract class GroovyBaseScript extends
return genericValues;
}
+ EntityQuery from(def entity) {
+ return EntityQuery.use(binding.getVariable('delegator')).from(entity);
+ }
+
+ EntityQuery select(String... fields) {
+ return EntityQuery.use(binding.getVariable('delegator')).select(fields);
+ }
+
+ EntityQuery select(Set<String> fields) {
+ return EntityQuery.use(binding.getVariable('delegator')).select(fields);
+ }
+
def success(String message) {
// TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding
if (this.binding.hasVariable('request')) {