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

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 CustRequestItem related CRUD services from simple to entity-auto (#118)

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 9eb6ba5  Improved: Converted all CustRequestItem related CRUD services from simple to entity-auto (#118)
9eb6ba5 is described below

commit 9eb6ba5a396088ad454559906bd77c219baf35dc
Author: Suraj Khurana <[hidden email]>
AuthorDate: Tue May 12 10:17:18 2020 +0530

    Improved: Converted all CustRequestItem related CRUD services from simple to entity-auto (#118)
   
    (OFBIZ-11663)
---
 .../order/minilang/request/CustRequestServices.xml | 25 ----------------------
 applications/order/servicedef/secas.xml            | 13 +++++++++++
 applications/order/servicedef/services_request.xml | 10 ++++-----
 3 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/applications/order/minilang/request/CustRequestServices.xml b/applications/order/minilang/request/CustRequestServices.xml
index 3cf814c..d2a88be 100644
--- a/applications/order/minilang/request/CustRequestServices.xml
+++ b/applications/order/minilang/request/CustRequestServices.xml
@@ -210,31 +210,6 @@ under the License.
             </then>
         </if>
     </simple-method>
-    <simple-method method-name="createCustRequestItem" short-description="Create Customer Request Item">
-        <call-simple-method method-name="checkStatusCustRequest"/>
-        <make-value entity-name="CustRequestItem" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <if-empty field="parameters.custRequestItemSeqId">
-            <make-next-seq-id value-field="newEntity" seq-field-name="custRequestItemSeqId"/>
-        </if-empty>
-        <if-empty field="parameters.statusId">
-            <set value="CRQ_SUBMITTED" field="newEntity.statusId"/>
-        </if-empty>
-        <create-value value-field="newEntity"/>
-        <field-to-result field="newEntity.custRequestId" result-name="custRequestId"/>
-        <field-to-result field="newEntity.custRequestItemSeqId" result-name="custRequestItemSeqId"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-    <simple-method method-name="updateCustRequestItem" short-description="Update Customer Request Item">
-        <call-simple-method method-name="checkStatusCustRequest"/>        
-        <set from-field="parameters.custRequestId" field="lookupPKMap.custRequestId"/>
-        <set from-field="parameters.custRequestItemSeqId" field="lookupPKMap.custRequestItemSeqId"/>
-        <find-by-primary-key entity-name="CustRequestItem" map="lookupPKMap" value-field="custRequestItem"/>
-        <set-nonpk-fields map="parameters" value-field="custRequestItem"/>
-        <store-value value-field="custRequestItem"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
     <simple-method method-name="createCustRequestNote" short-description="Create Customer Request Note">
         <make-value entity-name="CustRequestNote" value-field="newEntity"/>
         <set from-field="parameters.custRequestId" field="newEntity.custRequestId"/>
diff --git a/applications/order/servicedef/secas.xml b/applications/order/servicedef/secas.xml
index 978c210..e141a8a 100644
--- a/applications/order/servicedef/secas.xml
+++ b/applications/order/servicedef/secas.xml
@@ -497,6 +497,19 @@ under the License.
         <condition field-name="statusId" operator="equals" value="ALLOC_PLAN_CANCELLED"/>
         <action service="cancelAllocationPlanItems" mode="sync"/>
     </eca>
+    <!-- CustRequestItem eca -->
+    <eca service="createCustRequestItem" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="updateCustRequestItem" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="createCustRequestItem" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="updateCustRequestItem" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
     <!-- RequirementRole eca -->
     <eca service="createRequirementRole" event="invoke">
         <action service="ensurePartyRole" mode="sync"/>
diff --git a/applications/order/servicedef/services_request.xml b/applications/order/servicedef/services_request.xml
index b7cc3f5..0b016a4 100644
--- a/applications/order/servicedef/services_request.xml
+++ b/applications/order/servicedef/services_request.xml
@@ -81,18 +81,17 @@ under the License.
         <description>Delete CustRequestAttribute record</description>
         <auto-attributes mode="IN" include="pk" optional="false"/>
     </service>
-
-    <service name="createCustRequestItem" engine="simple" default-entity-name="CustRequestItem"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="createCustRequestItem" auth="true">
+    <!-- CustRequestItem services -->
+    <service name="createCustRequestItem" engine="entity-auto" default-entity-name="CustRequestItem" invoke="create" auth="true">
         <description>Create a CustRequestItem record</description>
         <auto-attributes include="pk" mode="INOUT" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="custRequestItemSeqId" optional="true"/>
         <override name="story" allow-html="safe"/>
         <override name="description" allow-html="safe"/>
+        <override name="status" default-value="CRQ_SUBMITTED"/>
     </service>
-    <service name="updateCustRequestItem" engine="simple" default-entity-name="CustRequestItem"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="updateCustRequestItem" auth="true">
+    <service name="updateCustRequestItem" engine="simple" default-entity-name="CustRequestItem" invoke="update" auth="true">
         <description>Update a CustRequestItem record</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
@@ -108,6 +107,7 @@ under the License.
         <attribute name="custRequestItemSeqIdTo" type="String" mode="IN" optional="true"/>
         <attribute name="copyLinkedQuotes" type="String" mode="IN" optional="true"/>
     </service>
+    <!-- CustRequestParty services -->
     <service name="createCustRequestParty" engine="entity-auto" default-entity-name="CustRequestParty" invoke="create" auth="true">
         <description>Create a CustRequestParty record</description>
         <auto-attributes mode="IN" include="pk" optional="false"/>