[ofbiz-framework] branch trunk updated: Improved: Converted all FixedAssetMeter services from simple to entity-auto. (#82)

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 FixedAssetMeter services from simple to entity-auto. (#82)

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 3c3147d  Improved: Converted all FixedAssetMeter services from simple to entity-auto. (#82)
3c3147d is described below

commit 3c3147d7456963cb295e6a118b769510b14e6210
Author: Suraj Khurana <[hidden email]>
AuthorDate: Fri May 1 14:15:49 2020 +0530

    Improved: Converted all FixedAssetMeter services from simple to entity-auto. (#82)
   
    * Improved: Converted all FixedAssetMeter services from simple to entity-auto.
    * Improved: Added seca rule for creating maints from meter reading, earlier it was called inline while creating or updating FixedAssetMeter record.
   
    (OFBIZ-11611)
---
 .../minilang/fixedasset/FixedAssetServices.xml       | 20 +-------------------
 applications/accounting/servicedef/secas.xml         |  9 +++++++++
 .../accounting/servicedef/services_fixedasset.xml    | 16 ++++++++++------
 3 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/applications/accounting/minilang/fixedasset/FixedAssetServices.xml b/applications/accounting/minilang/fixedasset/FixedAssetServices.xml
index 35d805a..856b2b2 100644
--- a/applications/accounting/minilang/fixedasset/FixedAssetServices.xml
+++ b/applications/accounting/minilang/fixedasset/FixedAssetServices.xml
@@ -136,26 +136,8 @@ under the License.
             </then>
         </if>
     </simple-method>
-
-    <!--  create/update/delete FixedAssetMeter -->
-    <simple-method method-name="createFixedAssetMeter" short-description="Create a Fixed Asset Meter Reading">
-        <make-value entity-name="FixedAssetMeter" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <create-value value-field="newEntity"/>
-        <check-errors/>
-        <set field="meterValue" from-field="newEntity"/>
-        <call-simple-method method-name="createMaintsFromMeterReading"/>
-    </simple-method>
-    <simple-method method-name="updateFixedAssetMeter" short-description="Update a Fixed Asset Meter Reading">
-        <entity-one entity-name="FixedAssetMeter" value-field="lookedUpValue"/>
-        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
-        <store-value value-field="lookedUpValue"/>
-        <check-errors/>
-        <set field="meterValue" from-field="lookedUpValue"/>
-        <call-simple-method method-name="createMaintsFromMeterReading"/>
-    </simple-method>
     <simple-method method-name="createMaintsFromMeterReading" short-description="Create Fixed Asset Maintenances From A Meter Reading">
+        <set field="meterValue" from-field="parameters"/>
         <if-not-empty field="meterValue.maintHistSeqId">
             <return/>
         </if-not-empty>
diff --git a/applications/accounting/servicedef/secas.xml b/applications/accounting/servicedef/secas.xml
index 136e6ff..2e8ebb8 100644
--- a/applications/accounting/servicedef/secas.xml
+++ b/applications/accounting/servicedef/secas.xml
@@ -164,4 +164,13 @@ under the License.
         <set field-name="organizationPartyId" env-name="partyId"/>
         <action service="setAcctgCompany" mode="sync"/>
     </eca>
+
+    <!-- Create Fixed Asset Maintenances From A Meter Reading -->
+    <eca service="createFixedAssetMeter" event="commit">
+        <action service="createMaintsFromMeterReading" mode="sync"/>
+    </eca>
+    <eca service="updateFixedAssetMeter" event="commit">
+        <action service="createMaintsFromMeterReading" mode="sync"/>
+    </eca>
+
 </service-eca>
diff --git a/applications/accounting/servicedef/services_fixedasset.xml b/applications/accounting/servicedef/services_fixedasset.xml
index 9fbb432..6b20843 100644
--- a/applications/accounting/servicedef/services_fixedasset.xml
+++ b/applications/accounting/servicedef/services_fixedasset.xml
@@ -152,20 +152,24 @@ under the License.
         <permission-service service-name="fixedAssetPermissionCheck" main-action="CREATE"/>
     </service>
     <!-- FixedAsset Maintenance Meter Create/Update/Delete-->
-    <service name="createFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="simple"
-                location="component://accounting/minilang/fixedasset/FixedAssetServices.xml" invoke="createFixedAssetMeter" auth="true">
-        <description>Create a Fixed Asset Maintenance Meter</description>
+    <service name="createFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="entity-auto" invoke="create" auth="true">
+        <description>Create a Fixed asset Meter</description>
         <permission-service service-name="fixedAssetPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="updateFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="simple"
-                location="component://accounting/minilang/fixedasset/FixedAssetServices.xml" invoke="updateFixedAssetMeter" auth="true">
-        <description>Update a Fixed Asset Maintenance Meter</description>
+    <service name="updateFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="entity-auto" invoke="update" auth="true">
+        <description>Update a Fixed asset Meter</description>
         <permission-service service-name="fixedAssetPermissionCheck" main-action="UPDATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
+    <service name="createMaintsFromMeterReading" default-entity-name="FixedAssetMeter" engine="simple"
+             location="component://accounting/minilang/fixedasset/FixedAssetServices.xml" invoke="createMaintsFromMeterReading" auth="true">
+        <description>Create Maints From Meter Reading</description>
+        <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+    </service>
     <service name="deleteFixedAssetMeter" default-entity-name="FixedAssetMeter" engine="entity-auto" invoke="delete" auth="true">
         <description>Remove a Fixed Asset Maintenance Meter</description>
         <permission-service service-name="fixedAssetPermissionCheck" main-action="DELETE"/>