svn commit: r1820966 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy

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

svn commit: r1820966 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy

jleroux@apache.org
Author: jleroux
Date: Fri Jan 12 11:24:48 2018
New Revision: 1820966

URL: http://svn.apache.org/viewvc?rev=1820966&view=rev
Log:
Fixed: Correcting findOne() in OfbizDslDescriptorForEclipse.dsld
(OFBIZ-10159)

The method findOne() which is set in the OfbizDslDescriptorForEclipse.dsld is
wrong, since there is no implementation for this method, which only has a String
and a List as parameters. I changed it to the correct method, so it can be used
within groovy properly, also I put an implementation in the GroovyBaseScriptFile

Thanks: Dennis Balkir

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld?rev=1820966&r1=1820965&r2=1820966&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld Fri Jan 12 11:24:48 2018
@@ -25,7 +25,7 @@ contribute(currentType(subType('groovy.l
 
     method name: 'runService', type: 'java.util.Map', params: [serviceName: 'String', inputMap: 'java.util.Map']
     method name: 'makeValue', type: 'java.util.Map', params: [entityName: 'String']
-    method name: 'findOne', type: 'java.util.Map', params: [entityName: 'String', inputMap: 'java.util.Map']
+    method name: 'findOne', type: 'java.util.Map', params: [entityName: 'String', fields: 'java.util.Map', useCache: 'boolean']
     method name: 'findList', type: 'java.util.List', params: [entityName: 'String', inputMap: 'java.util.Map']
     method name: 'select', type: 'org.apache.ofbiz.entity.util.EntityQuery', params: [entity: 'java.util.Set']
     method name: 'select', type: 'org.apache.ofbiz.entity.util.EntityQuery', params: [entity: 'String...']

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy?rev=1820966&r1=1820965&r2=1820966&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy Fri Jan 12 11:24:48 2018
@@ -18,6 +18,8 @@
  *******************************************************************************/
 package org.apache.ofbiz.service.engine
 
+import java.util.Map
+
 import org.apache.ofbiz.base.util.Debug
 import org.apache.ofbiz.entity.util.EntityQuery
 import org.apache.ofbiz.service.DispatchContext
@@ -25,6 +27,7 @@ import org.apache.ofbiz.service.LocalDis
 import org.apache.ofbiz.service.ModelService
 import org.apache.ofbiz.service.ServiceUtil
 import org.apache.ofbiz.service.ExecutionServiceException
+import org.apache.ofbiz.entity.GenericValue
 
 abstract class GroovyBaseScript extends Script {
     public static final String module = GroovyBaseScript.class.getName()
@@ -73,6 +76,10 @@ abstract class GroovyBaseScript extends
         return EntityQuery.use(binding.getVariable('delegator')).select(fields)
     }
 
+    GenericValue findOne(String entityName, Map<String, ? extends Object> fields, boolean useCache) {
+        return binding.getVariable('delegator').findOne(entityName, fields, useCache)
+    }
+
     def success(String message) {
         // TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding
         if (this.binding.hasVariable('request')) {