You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2021/09/14 12:05:34 UTC

[ofbiz-framework] branch trunk updated (7f0c5a7 -> dfb75fb)

This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git.


    from 7f0c5a7  Improved: Convert createPaymentApplication service from mini-lang to groovy DSL (OFBIZ-11481)
     new 65e955b  Fixed: No functional change, simplify a conditional
     new dfb75fb  Improved: Convert createSimpleTextContent service from mini-lang to groovy DSL (OFBIZ-11374)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../groovyScripts/payment/PaymentServices.groovy    |  8 ++++----
 .../groovyScripts/content/ContentServices.groovy    | 16 ++++++++++++++++
 .../content/minilang/content/ContentServices.xml    | 21 ---------------------
 applications/content/servicedef/services.xml        |  2 +-
 4 files changed, 21 insertions(+), 26 deletions(-)

[ofbiz-framework] 01/02: Fixed: No functional change, simplify a conditional

Posted by nm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 65e955be885875fc61287de50f69bd5af0acd57a
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Tue Sep 14 09:07:34 2021 +0200

    Fixed: No functional change, simplify a conditional
---
 .../accounting/groovyScripts/payment/PaymentServices.groovy       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
index 2b72fdc..795713b 100644
--- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy
+++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
@@ -627,6 +627,7 @@ def createPaymentFromOrder() {
         return result
     }
 }
+
 def createPaymentApplication() {
     // Create a Payment Application
     if (!parameters.invoiceId && !parameters.billingAccountId && !parameters.taxAuthGeoId && !parameters.toPaymentId) {
@@ -675,10 +676,9 @@ def createPaymentApplication() {
         }
     }
 
-    if (!paymentAppl.amountApplied) {
-        if (parameters.billingAccountId || parameters.taxAuthGeoId) {
-            paymentAppl.amountApplied = notAppliedPayment
-        }
+    if (!paymentAppl.amountApplied &&
+            (parameters.billingAccountId || parameters.taxAuthGeoId)) {
+        paymentAppl.amountApplied = notAppliedPayment
     }
     paymentAppl.paymentApplicationId = delegator.getNextSeqId("PaymentApplication")
     paymentAppl.create()

[ofbiz-framework] 02/02: Improved: Convert createSimpleTextContent service from mini-lang to groovy DSL (OFBIZ-11374)

Posted by nm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit dfb75fbcc73fc90b796680fad7d23e73a6c407cb
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Tue Sep 14 14:04:41 2021 +0200

    Improved: Convert createSimpleTextContent service from mini-lang to groovy DSL (OFBIZ-11374)
    
    Thanks to Sourabh Punyani
---
 .../groovyScripts/content/ContentServices.groovy    | 16 ++++++++++++++++
 .../content/minilang/content/ContentServices.xml    | 21 ---------------------
 applications/content/servicedef/services.xml        |  2 +-
 3 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/applications/content/groovyScripts/content/ContentServices.groovy b/applications/content/groovyScripts/content/ContentServices.groovy
index c5e7106..7d33c96 100644
--- a/applications/content/groovyScripts/content/ContentServices.groovy
+++ b/applications/content/groovyScripts/content/ContentServices.groovy
@@ -485,3 +485,19 @@ def forceIndexContentKeywords() {
     ContentKeywordIndex.forceIndexKeywords(content)
     return success()
 }
+
+def createSimpleTextContent() {
+    Map serviceResult = run service: 'createDataResource', with: [*                 : parameters,
+                                                                  dataResourceTypeId: 'ELECTRONIC_TEXT',
+                                                                  dataTemplateTypeId: 'FTL']
+
+    run service: 'createElectronicText', with: [*             : parameters,
+                                                textData      : parameters.text,
+                                                dataResourceId: serviceResult.dataResourceId]
+
+    serviceResult = run service: 'createContent', with: [*             : parameters,
+                                                         contentTypeId : 'DOCUMENT',
+                                                         dataResourceId: serviceResult.dataResourceId]
+
+    return serviceResult
+}
\ No newline at end of file
diff --git a/applications/content/minilang/content/ContentServices.xml b/applications/content/minilang/content/ContentServices.xml
index 6218094..6ae3e1d 100644
--- a/applications/content/minilang/content/ContentServices.xml
+++ b/applications/content/minilang/content/ContentServices.xml
@@ -162,27 +162,6 @@
         </if>
     </simple-method>
 
-    <simple-method method-name="createSimpleTextContent" short-description="Create Simple Text Content">
-        <set-service-fields service-name="createContent" map="parameters" to-map="createSimpleTextContent"/>
-        <set value="DOCUMENT" field="createSimpleTextContent.contentTypeId"/>
-
-        <set from-field="parameters.text" field="createSimpleText.textData"/>
-
-        <set-service-fields service-name="createDataResource" map="parameters" to-map="createSimpleTextDataResource"/>
-        <set value="ELECTRONIC_TEXT" field="createSimpleTextDataResource.dataResourceTypeId"/>
-        <set value="FTL" field="createSimpleTextDataResource.dataTemplateTypeId"/>
-
-        <call-service service-name="createDataResource" in-map-name="createSimpleTextDataResource">
-            <result-to-field result-name="dataResourceId" field="createSimpleText.dataResourceId"/>
-            <result-to-field result-name="dataResourceId" field="createSimpleTextContent.dataResourceId"/>
-        </call-service>
-
-        <call-service service-name="createElectronicText" in-map-name="createSimpleText"/>
-
-        <call-service service-name="createContent" in-map-name="createSimpleTextContent">
-            <result-to-result result-name="contentId"/>
-        </call-service>
-    </simple-method>
     <simple-method method-name="updateSimpleTextContent" short-description="Update Simple Text Content">
         <if-not-empty field="parameters.textDataResourceId">
             <set from-field="parameters.textDataResourceId" field="updateSimpleText.dataResourceId"/>
diff --git a/applications/content/servicedef/services.xml b/applications/content/servicedef/services.xml
index 994581c..37b44e7 100644
--- a/applications/content/servicedef/services.xml
+++ b/applications/content/servicedef/services.xml
@@ -159,7 +159,7 @@
         <attribute name="file" type="String" mode="IN" optional="true"/>
     </service>
 
-    <service name="createSimpleTextContent" engine="simple" location="component://content/minilang/content/ContentServices.xml" invoke="createSimpleTextContent">
+    <service name="createSimpleTextContent" engine="groovy" location="component://content/groovyScripts/content/ContentServices.groovy" invoke="createSimpleTextContent">
         <permission-service service-name="contentManagerPermission" main-action="CREATE"/>
         <auto-attributes mode="IN" entity-name="Content" optional="true"/>
         <attribute name="text" type="String" mode="IN" optional="false" allow-html="safe">