You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2020/07/04 09:42:33 UTC
[ofbiz-framework] branch trunk updated: Improved: Converted
deleteContentKeywords service from mini-lang to groovy DSL. (OFBIZ-11391)
Thanks Devanshu Vyas for reporting and Yogesh Naroliya for the patch.
This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new ad586a1 Improved: Converted deleteContentKeywords service from mini-lang to groovy DSL. (OFBIZ-11391) Thanks Devanshu Vyas for reporting and Yogesh Naroliya for the patch.
ad586a1 is described below
commit ad586a1c14771118e1db8dd800cb99eaf8b946d4
Author: Suraj Khurana <su...@apache.org>
AuthorDate: Sat Jul 4 15:12:14 2020 +0530
Improved: Converted deleteContentKeywords service from mini-lang to groovy DSL.
(OFBIZ-11391)
Thanks Devanshu Vyas for reporting and Yogesh Naroliya for the patch.
---
applications/content/groovyScripts/content/ContentServices.groovy | 5 +++++
applications/content/minilang/content/ContentServices.xml | 4 ----
applications/content/servicedef/services_content.xml | 4 ++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/applications/content/groovyScripts/content/ContentServices.groovy b/applications/content/groovyScripts/content/ContentServices.groovy
index c752752..8309c8e 100644
--- a/applications/content/groovyScripts/content/ContentServices.groovy
+++ b/applications/content/groovyScripts/content/ContentServices.groovy
@@ -408,4 +408,9 @@ def createContentFromDataResource() {
}
Map result = run service: "createContent", with: createContentMap
return result
+}
+def deleteContentKeywords() {
+ content = from('Content').where('contentId', contentId).queryOne()
+ content.removeRelated('ContentKeyword')
+ return success()
}
\ No newline at end of file
diff --git a/applications/content/minilang/content/ContentServices.xml b/applications/content/minilang/content/ContentServices.xml
index a62139d..1446656 100644
--- a/applications/content/minilang/content/ContentServices.xml
+++ b/applications/content/minilang/content/ContentServices.xml
@@ -368,10 +368,6 @@
<field field="content" type="org.apache.ofbiz.entity.GenericValue"/>
</call-class-method>
</simple-method>
- <simple-method method-name="deleteContentKeywords" short-description="delete all the keywords of a content">
- <entity-one entity-name="Content" value-field="content"/>
- <remove-related value-field="content" relation-name="ContentKeyword"/>
- </simple-method>
<simple-method method-name="indexContentKeywords" short-description="Index the Keywords for a Content" login-required="false">
<!-- this service is meant to be called from an entity ECA for entities that include a contentId -->
<!-- if it is the Content entity itself triggering this action, then a [contentInstance] parameter
diff --git a/applications/content/servicedef/services_content.xml b/applications/content/servicedef/services_content.xml
index d0bc6c3..a1db32f 100644
--- a/applications/content/servicedef/services_content.xml
+++ b/applications/content/servicedef/services_content.xml
@@ -477,8 +477,8 @@
<permission-service service-name="genericContentPermission" main-action="DELETE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>
- <service name="deleteContentKeywords" engine="simple"
- location="component://content/minilang/content/ContentServices.xml" invoke="deleteContentKeywords" auth="true">
+ <service name="deleteContentKeywords" engine="groovy"
+ location="component://content/groovyScripts/content/ContentServices.groovy" invoke="deleteContentKeywords" auth="true">
<description>Delete all the keywords of a content</description>
<permission-service service-name="genericContentPermission" main-action="DELETE"/>
<attribute name="contentId" type="String" mode="IN" optional="false">