You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by pa...@apache.org on 2020/05/04 10:15:55 UTC
[ofbiz-framework] branch trunk updated: Improved: Convert
updateEmailContent service from mini-lang to groovy DSL (OFBIZ-11371)
This is an automated email from the ASF dual-hosted git repository.
pawan 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 e9664e9 Improved: Convert updateEmailContent service from mini-lang to groovy DSL (OFBIZ-11371)
e9664e9 is described below
commit e9664e94c4d2fb21f7270cb89e445aba1fd4ce58
Author: Pawan Verma <pa...@hotwaxsystems.com>
AuthorDate: Mon May 4 15:45:33 2020 +0530
Improved: Convert updateEmailContent service from mini-lang to groovy DSL
(OFBIZ-11371)
Thanks: Devanshu Vyas for report and Anushi Gupta for the patch.
---
.../groovyScripts/content/ContentServices.groovy | 14 +++++++++++++-
.../content/minilang/content/ContentServices.xml | 17 -----------------
applications/content/servicedef/services.xml | 2 +-
3 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/applications/content/groovyScripts/content/ContentServices.groovy b/applications/content/groovyScripts/content/ContentServices.groovy
index 71408a3..bf01b26 100644
--- a/applications/content/groovyScripts/content/ContentServices.groovy
+++ b/applications/content/groovyScripts/content/ContentServices.groovy
@@ -161,4 +161,16 @@ def createContentAlternativeUrl() {
map = success()
map.contentCreated = contentCreated
return map
-}
\ No newline at end of file
+}
+
+def updateEmailContent() {
+ if (parameters.subjectDataResourceId) {
+ run service: "updateElectronicText", with: [dataResourceId: parameters.subjectDataResourceId, textData: parameters.subject]
+ }
+ if (parameters.plainBodyDataResourceId) {
+ run service: "updateElectronicText", with: [dataResourceId: parameters.plainBodyDataResourceId, textData: parameters.plainBody]
+ }
+ if (parameters.htmlBodyDataResourceId) {
+ run service: "updateElectronicText", with: [dataResourceId: parameters.htmlBodyDataResourceId, textData: parameters.htmlBody]
+ }
+}
diff --git a/applications/content/minilang/content/ContentServices.xml b/applications/content/minilang/content/ContentServices.xml
index aad853a..8bbbe00 100644
--- a/applications/content/minilang/content/ContentServices.xml
+++ b/applications/content/minilang/content/ContentServices.xml
@@ -248,23 +248,6 @@
<field-to-result field="createBodyAssoc.contentId" result-name="contentId"/>
</simple-method>
- <simple-method method-name="updateEmailContent" short-description="Update Email Content">
- <if-not-empty field="parameters.subjectDataResourceId">
- <set from-field="parameters.subjectDataResourceId" field="updateSubjectEt.dataResourceId"/>
- <set from-field="parameters.subject" field="updateSubjectEt.textData"/>
- <call-service service-name="updateElectronicText" in-map-name="updateSubjectEt"/>
- </if-not-empty>
- <if-not-empty field="parameters.plainBodyDataResourceId">
- <set from-field="parameters.plainBodyDataResourceId" field="updatePlainBodyEt.dataResourceId"/>
- <set from-field="parameters.plainBody" field="updatePlainBodyEt.textData"/>
- <call-service service-name="updateElectronicText" in-map-name="updatePlainBodyEt"/>
- </if-not-empty>
- <if-not-empty field="parameters.htmlBodyDataResourceId">
- <set from-field="parameters.htmlBodyDataResourceId" field="updateHtmlBodyEt.dataResourceId"/>
- <set from-field="parameters.htmlBody" field="updateHtmlBodyEt.textData"/>
- <call-service service-name="updateElectronicText" in-map-name="updateHtmlBodyEt"/>
- </if-not-empty>
- </simple-method>
<simple-method method-name="createDownloadContent" short-description="Create Download as Content">
<set-service-fields service-name="createContent" map="parameters" to-map="createDownloadContent"/>
diff --git a/applications/content/servicedef/services.xml b/applications/content/servicedef/services.xml
index 170675a..f9440f0 100644
--- a/applications/content/servicedef/services.xml
+++ b/applications/content/servicedef/services.xml
@@ -133,7 +133,7 @@
<attribute name="htmlBody" type="String" mode="IN" optional="true" allow-html="any"/>
<override name="contentId" mode="INOUT"/>
</service>
- <service name="updateEmailContent" engine="simple" location="component://content/minilang/content/ContentServices.xml" invoke="updateEmailContent">
+ <service name="updateEmailContent" engine="groovy" location="component://content/groovyScripts/content/ContentServices.groovy" invoke="updateEmailContent">
<permission-service service-name="contentManagerPermission" main-action="UPDATE"/>
<attribute name="subjectDataResourceId" type="String" mode="IN" optional="true"/>
<attribute name="subject" type="String" mode="IN" optional="true"/>