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

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

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 edca9f2  Improved: Converted all CustRequestParty related CRUD services from simple to entity-auto (#95)
edca9f2 is described below

commit edca9f22b03ecb5f7096652cf020ca3b52043962
Author: Suraj Khurana <[hidden email]>
AuthorDate: Sat May 2 13:47:09 2020 +0530

    Improved: Converted all CustRequestParty related CRUD services from simple to entity-auto (#95)
   
    * Improved: Converted all CustRequestParty related CRUD services from simple to entity-auto
    (OFBIZ-11621)
---
 .../order/minilang/request/CustRequestServices.xml | 41 ----------------------
 applications/order/servicedef/secas.xml            | 27 ++++++++++++++
 applications/order/servicedef/services_request.xml | 27 ++++++++------
 3 files changed, 43 insertions(+), 52 deletions(-)

diff --git a/applications/order/minilang/request/CustRequestServices.xml b/applications/order/minilang/request/CustRequestServices.xml
index 822ed4e..789433d 100644
--- a/applications/order/minilang/request/CustRequestServices.xml
+++ b/applications/order/minilang/request/CustRequestServices.xml
@@ -254,47 +254,6 @@ under the License.
         <store-value value-field="custRequestItem"/>
         <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
     </simple-method>
-
-    <simple-method method-name="createCustRequestParty" short-description="Create Customer RequestParty">
-        <call-simple-method method-name="checkStatusCustRequest"/>        
-        <set from-field="parameters.partyId" field="lookupPKMap.partyId"/>
-        <set from-field="parameters.roleTypeId" field="lookupPKMap.roleTypeId"/>
-        <find-by-primary-key entity-name="PartyRole" map="lookupPKMap" value-field="partyRole"/>
-        <if-empty field="partyRole.partyId">
-            <make-value entity-name="PartyRole" value-field="partyRole"/>
-            <set-pk-fields map="lookupPKMap" value-field="partyRole"/>
-            <create-value value-field="partyRole"/>
-        </if-empty>
-        <make-value entity-name="CustRequestParty" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <if-empty field="newEntity.fromDate">
-            <now-timestamp field="newEntity.fromDate"/>
-        </if-empty>
-        <create-value value-field="newEntity"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-    <simple-method method-name="updateCustRequestParty" short-description="Update an existing CustRequestParty">
-        <call-simple-method method-name="checkStatusCustRequest"/>                
-        <entity-one entity-name="CustRequestParty" value-field="lookedUpValue"/>
-        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
-        <store-value value-field="lookedUpValue"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-    <simple-method method-name="expireCustRequestParty" short-description="Expire Customer CustRequestParty">
-        <call-simple-method method-name="checkStatusCustRequest"/>
-        <entity-one entity-name="CustRequestParty" value-field="lookedUpValue"/>
-        <now-timestamp field="thruDate"/>
-        <set field="lookedUpValue.thruDate" from-field="thruDate"/>
-        <store-value value-field="lookedUpValue"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-    <simple-method method-name="deleteCustRequestParty" short-description="Delete Customer CustRequestParty">
-        <call-simple-method method-name="checkStatusCustRequest"/>
-        <entity-one entity-name="CustRequestParty" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
-        <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 c8b8882..8317f22 100644
--- a/applications/order/servicedef/secas.xml
+++ b/applications/order/servicedef/secas.xml
@@ -497,4 +497,31 @@ under the License.
         <condition field-name="statusId" operator="equals" value="ALLOC_PLAN_CANCELLED"/>
         <action service="cancelAllocationPlanItems" mode="sync"/>
     </eca>
+
+    <!-- CustRequestParty eca -->
+    <eca service="createCustRequestParty" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+        <action service="ensurePartyRole" mode="sync"/>
+    </eca>
+    <eca service="updateCustRequestParty" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="deleteCustRequestParty" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="expireCustRequestParty" event="invoke">
+        <action service="checkStatusCustRequest" mode="sync"/>
+    </eca>
+    <eca service="createCustRequestParty" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="updateCustRequestParty" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="deleteCustRequestParty" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="expireCustRequestParty" 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 24db8ef..fe73650 100644
--- a/applications/order/servicedef/services_request.xml
+++ b/applications/order/servicedef/services_request.xml
@@ -72,7 +72,7 @@ under the License.
         <attribute name="attrValue" type="String" mode="IN" optional="false"/>
     </service>
 
-   <service name="updateCustRequestAttribute" engine="simple"
+    <service name="updateCustRequestAttribute" engine="simple"
             location="component://order/minilang/request/CustRequestServices.xml" invoke="updateCustRequestAttribute" auth="true">
         <description>Update CustRequestAttribute record</description>
         <attribute name="custRequestId" type="String" mode="IN" optional="false"/>
@@ -106,28 +106,33 @@ under the License.
         <attribute name="custRequestItemSeqIdTo" type="String" mode="IN" optional="true"/>
         <attribute name="copyLinkedQuotes" type="String" mode="IN" optional="true"/>
     </service>
-
-    <service name="createCustRequestParty" engine="simple" default-entity-name="CustRequestParty"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="createCustRequestParty" auth="true">
+    <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"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
         <override name="fromDate" mode="IN" type="Timestamp" optional="true"/>
     </service>
-    <service name="updateCustRequestParty" engine="simple" default-entity-name="CustRequestParty"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="updateCustRequestParty" auth="true">
+    <service name="updateCustRequestParty" engine="entity-auto" default-entity-name="CustRequestParty" invoke="update" auth="true">
         <description>Update CustRequestParty record</description>
         <auto-attributes mode="IN" include="pk" optional="true"/>
         <auto-attributes mode="IN" include="nonpk" optional="true"/>
     </service>
-    <service name="deleteCustRequestParty" engine="simple" default-entity-name="CustRequestParty"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="deleteCustRequestParty" auth="true">
+    <service name="deleteCustRequestParty" engine="entity-auto" default-entity-name="CustRequestParty" invoke="delete" auth="true">
         <description>Delete a CustRequestParty record</description>
         <auto-attributes mode="IN" include="pk" optional="false"/>
     </service>
-    <service name="expireCustRequestParty" engine="simple" default-entity-name="CustRequestParty"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="expireCustRequestParty" auth="true">
-        <description>Delete a CustRequestParty record</description>
+    <service name="expireCustRequestParty" engine="entity-auto" default-entity-name="CustRequestParty" invoke="expire" auth="true">
+        <description>Expires a CustRequestParty record</description>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+    </service>
+    <service name="checkStatusCustRequest" engine="simple" default-entity-name="CustRequestParty"
+             location="component://order/minilang/request/CustRequestServices.xml" invoke="checkStatusCustRequest" auth="true">
+        <description>Check Status of Cust Request</description>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+    </service>
+    <service name="updateCustRequestLastModifiedDate" engine="simple" default-entity-name="CustRequestParty"
+             location="component://order/minilang/request/CustRequestServices.xml" invoke="updateCustRequestLastModifiedDate" auth="true">
+        <description>Update Cust Request Last Modified Date</description>
         <auto-attributes mode="IN" include="pk" optional="false"/>
     </service>
     <service name="createCustRequestNote" engine="simple"