From 7b9792b5092f4c5359db7537adfdd2f292b20a8c Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 12 Jan 2018 11:24:48 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1820966 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld | 2 +- .../apache/ofbiz/service/engine/GroovyBaseScript.groovy | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld b/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld index 974ad1227a..7fdf848817 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld +++ b/framework/base/src/main/java/org/apache/ofbiz/base/OfbizDslDescriptorForEclipse.dsld @@ -25,7 +25,7 @@ contribute(currentType(subType('groovy.lang.Script'))) { 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...'] diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy index 1157c01b4f..daea17f8bc 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy +++ b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy @@ -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.LocalDispatcher 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 Script { return EntityQuery.use(binding.getVariable('delegator')).select(fields) } + GenericValue findOne(String entityName, Map 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')) {