[ofbiz-framework] branch trunk updated: Improved: Converted all CustRequestContent related CRUD services from simple to entity-auto (#94)

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

[ofbiz-framework] branch trunk updated: Improved: Converted all CustRequestContent related CRUD services from simple to entity-auto (#94)

surajk
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 3615f5b  Improved: Converted all CustRequestContent related CRUD services from simple to entity-auto (#94)
3615f5b is described below

commit 3615f5b84224609552c31bf1a88d1b455239c469
Author: Suraj Khurana <[hidden email]>
AuthorDate: Sat May 2 17:00:48 2020 +0530

    Improved: Converted all CustRequestContent related CRUD services from simple to entity-auto (#94)
   
    * Improved: Converted all CustRequestContent related CRUD services from simple to entity-auto
    (OFBIZ-11627)
   
    * Improved: Added seca rule for checkStatusCustRequest while invoke and updateCustRequestLastModifiedDate while commit for services related to CustRequestContent.
---
 .../order/minilang/request/CustRequestServices.xml | 27 ----------------------
 applications/order/servicedef/secas.xml            | 19 +++++++++++++++
 applications/order/servicedef/services_request.xml | 16 ++++++-------
 .../order/webapp/ordermgr/WEB-INF/controller.xml   |  4 ++--
 .../order/widget/ordermgr/CustRequestForms.xml     |  2 +-
 5 files changed, 29 insertions(+), 39 deletions(-)

diff --git a/applications/order/minilang/request/CustRequestServices.xml b/applications/order/minilang/request/CustRequestServices.xml
index 789433d..7fe8d56 100644
--- a/applications/order/minilang/request/CustRequestServices.xml
+++ b/applications/order/minilang/request/CustRequestServices.xml
@@ -515,33 +515,6 @@ under the License.
         <field-to-result field="parameters.custRequestId" result-name="custRequestId"/>
         <string-to-list string="Customer request ${parameters.custRequestId} created" list="successMessageList"/>
     </simple-method>
-
-    <!-- Create/Delete  CustRequest Content -->
-    <simple-method method-name="createCustRequestContent" short-description="Create Customer request Content">
-        <call-simple-method method-name="checkStatusCustRequest"/>        
-        <make-value entity-name="CustRequestContent" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-
-        <if-empty field="newEntity.fromDate">
-            <now-timestamp field="nowTimestamp"/>
-            <set field="newEntity.fromDate" from-field="nowTimestamp"/>
-        </if-empty>
-
-        <create-value value-field="newEntity"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-    <simple-method method-name="deleteCustRequestContent" short-description="Remove a Customer Request Content">
-        <call-simple-method method-name="checkStatusCustRequest"/>
-        <entity-one entity-name="CustRequestContent" value-field="lookedUpValue"/>
-        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
-        <if-empty field="lookedUpValue.thruDate">
-            <now-timestamp field="lookedUpValue.thruDate"/>
-        </if-empty>
-        <store-value value-field="lookedUpValue"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-
     <simple-method method-name="updateCustRequestLastModifiedDate" short-description="update the modified date field in a customer request">
         <entity-one entity-name="CustRequest" value-field="custRequest"/>
         <now-timestamp field="custRequest.lastModifiedDate"/>
diff --git a/applications/order/servicedef/secas.xml b/applications/order/servicedef/secas.xml
index 8317f22..734adb2 100644
--- a/applications/order/servicedef/secas.xml
+++ b/applications/order/servicedef/secas.xml
@@ -524,4 +524,23 @@ under the License.
     <eca service="expireCustRequestParty" event="commit">
         <action service="updateCustRequestLastModifiedDate" mode="sync"/>
     </eca>
+    <!-- createCustRequestContent eca -->
+    <eca service="createCustRequestContent" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="deleteCustRequestContent" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="expireCustRequestContent" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="createCustRequestContent" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="deleteCustRequestContent" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="expireCustRequestContent" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
 </service-eca>
diff --git a/applications/order/servicedef/services_request.xml b/applications/order/servicedef/services_request.xml
index fe73650..15e49ba 100644
--- a/applications/order/servicedef/services_request.xml
+++ b/applications/order/servicedef/services_request.xml
@@ -215,20 +215,18 @@ under the License.
     </service>
 
     <!-- custRequest content services -->
-    <service name="createCustRequestContent" engine="simple"
-        location="component://order/minilang/request/CustRequestServices.xml"
-        invoke="createCustRequestContent"
-        default-entity-name="CustRequestContent" auth="true">
+    <service name="createCustRequestContent" engine="entity-auto" invoke="create" default-entity-name="CustRequestContent" auth="true">
         <description>Create a Customer Request Content</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="fromDate" optional="true"/>
     </service>
-    <service name="deleteCustRequestContent" engine="simple"
-        location="component://order/minilang/request/CustRequestServices.xml"
-        invoke="deleteCustRequestContent"
-        default-entity-name="CustRequestContent" auth="true">
-        <description>Update a Customer Request Content</description>
+    <service name="deleteCustRequestContent" engine="entity-auto" invoke="delete" default-entity-name="CustRequestContent" auth="true">
+        <description>Delete a Customer Request Content</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+    </service>
+    <service name="expireCustRequestContent" engine="entity-auto" invoke="expire" default-entity-name="CustRequestContent" auth="true">
+        <description>Expire a Customer Request Content</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml
index 10c5d3c..2322b3f 100644
--- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml
+++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml
@@ -1345,9 +1345,9 @@ under the License.
         <response name="error" type="view" value="EditCustRequestContent"/>
     </request-map>
 
-    <request-map uri="deleteCustRequestContent">
+    <request-map uri="expireCustRequestContent">
         <security auth="true" https="true"/>
-        <event type="service" invoke="deleteCustRequestContent"/>
+        <event type="service" invoke="expireCustRequestContent"/>
         <response name="success" type="request-redirect" value="EditCustRequestContent"><redirect-parameter name="custRequestId"/></response>
         <response name="error" type="view" value="EditCustRequestContent"/>
     </request-map>
diff --git a/applications/order/widget/ordermgr/CustRequestForms.xml b/applications/order/widget/ordermgr/CustRequestForms.xml
index 9a4b78e..4adf28a 100644
--- a/applications/order/widget/ordermgr/CustRequestForms.xml
+++ b/applications/order/widget/ordermgr/CustRequestForms.xml
@@ -641,7 +641,7 @@ under the License.
         <field name="mimeTypeId"><display/></field>
         <field name="fromDate"><display/></field>
         <field name="deleteLink" title=" " widget-style="buttontext" use-when="tabButtonItem!=void&amp;&amp;tabButtonItem.equals(&quot;custRequestContent&quot;)">
-           <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteCustRequestContent" also-hidden="false">
+           <hyperlink description="${uiLabelMap.CommonDelete}" target="expireCustRequestContent" also-hidden="false">
                 <parameter param-name="custRequestId"/>
                 <parameter param-name="contentId"/>
                 <parameter param-name="fromDate"/>