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

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

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 7988fab  Improved: Converted all CustRequestAttribute related CRUD services from simple to entity-auto (#101)
7988fab is described below

commit 7988fab8ab614dab7c225f7ca9510cbc76e9fea7
Author: Suraj Khurana <[hidden email]>
AuthorDate: Mon May 4 18:02:46 2020 +0530

    Improved: Converted all CustRequestAttribute related CRUD services from simple to entity-auto (#101)
   
    (OFBIZ-11637)
    Added seca rule to updateCustRequestLastModifiedDate on commit operation of this service, earlier it was called inline.
---
 .../order/minilang/request/CustRequestServices.xml | 17 ---------------
 applications/order/servicedef/secas.xml            |  9 +++++++-
 applications/order/servicedef/services_request.xml | 24 ++++++++++++----------
 3 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/applications/order/minilang/request/CustRequestServices.xml b/applications/order/minilang/request/CustRequestServices.xml
index 7fe8d56..5351438 100644
--- a/applications/order/minilang/request/CustRequestServices.xml
+++ b/applications/order/minilang/request/CustRequestServices.xml
@@ -212,23 +212,6 @@ under the License.
             </then>
         </if>
     </simple-method>
-
-    <simple-method method-name="createCustRequestAttribute" short-description="Create Customer Request Attribute">
-        <make-value entity-name="CustRequestAttribute" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <create-value value-field="newEntity"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </simple-method>
-    <simple-method method-name="updateCustRequestAttribute" short-description="Update Customer Request Attribute">
-        <set from-field="parameters.custRequestId" field="lookupPKMap.custRequestId"/>
-        <set from-field="parameters.attrName" field="lookupPKMap.attrName"/>
-        <find-by-primary-key entity-name="CustRequestAttribute" map="lookupPKMap" value-field="custRequestAttr"/>
-        <set-nonpk-fields map="parameters" value-field="custRequestAttr"/>
-        <store-value value-field="custRequestAttr"/>
-        <call-simple-method method-name="updateCustRequestLastModifiedDate"/>
-    </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"/>
diff --git a/applications/order/servicedef/secas.xml b/applications/order/servicedef/secas.xml
index 734adb2..e241170 100644
--- a/applications/order/servicedef/secas.xml
+++ b/applications/order/servicedef/secas.xml
@@ -524,7 +524,7 @@ under the License.
     <eca service="expireCustRequestParty" event="commit">
         <action service="updateCustRequestLastModifiedDate" mode="sync"/>
     </eca>
-    <!-- createCustRequestContent eca -->
+    <!-- CustRequestContent eca -->
     <eca service="createCustRequestContent" event="invoke">
         <action service="checkStatusCustRequest" mode="sync"/>
     </eca>
@@ -543,4 +543,11 @@ under the License.
     <eca service="expireCustRequestContent" event="commit">
         <action service="updateCustRequestLastModifiedDate" mode="sync"/>
     </eca>
+    <!-- CustRequestAttribute eca -->
+    <eca service="createCustRequestAttribute" event="commit">
+        <action service="updateCustRequestLastModifiedDate" mode="sync"/>
+    </eca>
+    <eca service="updateCustRequestAttribute" 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 15e49ba..92610da 100644
--- a/applications/order/servicedef/services_request.xml
+++ b/applications/order/servicedef/services_request.xml
@@ -64,20 +64,22 @@ under the License.
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
 
-    <service name="createCustRequestAttribute" engine="simple"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="createCustRequestAttribute" auth="true">
+    <!-- CustRequestAttribute services -->
+    <service name="createCustRequestAttribute" engine="entity-auto" default-entity-name="CustRequestAttribute" invoke="create" auth="true">
         <description>Create CustRequestAttribute record</description>
-        <attribute name="custRequestId" type="String" mode="IN" optional="false"/>
-        <attribute name="attrName" type="String" mode="IN" optional="false"/>
-        <attribute name="attrValue" type="String" mode="IN" optional="false"/>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
+        <override name="attrValue" optional="false"/>
     </service>
-
-    <service name="updateCustRequestAttribute" engine="simple"
-            location="component://order/minilang/request/CustRequestServices.xml" invoke="updateCustRequestAttribute" auth="true">
+    <service name="updateCustRequestAttribute" engine="entity-auto" default-entity-name="CustRequestAttribute" invoke="update" auth="true">
         <description>Update CustRequestAttribute record</description>
-        <attribute name="custRequestId" type="String" mode="IN" optional="false"/>
-        <attribute name="attrName" type="String" mode="IN" optional="false"/>
-        <attribute name="attrValue" type="String" mode="IN" optional="false"/>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
+        <auto-attributes mode="IN" include="nonpk" optional="true"/>
+        <override name="attrValue" optional="false"/>
+    </service>
+    <service name="deleteCustRequestAttribute" engine="entity-auto" default-entity-name="CustRequestAttribute" invoke="delete" auth="true">
+        <description>Delete CustRequestAttribute record</description>
+        <auto-attributes mode="IN" include="pk" optional="false"/>
     </service>
 
     <service name="createCustRequestItem" engine="simple" default-entity-name="CustRequestItem"