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

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

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 c150980  Improved: Converted some simple services services from simple to entity-auto. (#136)
c150980 is described below

commit c150980271b29be19a1d7e20d4f3860d1c83c621
Author: Suraj Khurana <[hidden email]>
AuthorDate: Sat May 16 10:19:53 2020 +0530

    Improved: Converted some simple services services from simple to entity-auto. (#136)
   
    (OFBIZ-11698)
    Converted services: deleteOrderAdjustment, removeShoppingList and removed simple method for already converted deleteFinAccount.
---
 .../accounting/minilang/finaccount/FinAccountServices.xml  |  5 -----
 applications/order/minilang/order/OrderSimpleMethods.xml   | 14 --------------
 .../order/minilang/shoppinglist/ShoppingListServices.xml   |  7 -------
 applications/order/servicedef/secas.xml                    |  6 +++++-
 applications/order/servicedef/services.xml                 |  4 ++--
 applications/order/servicedef/services_shoppinglist.xml    |  3 +--
 6 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/applications/accounting/minilang/finaccount/FinAccountServices.xml b/applications/accounting/minilang/finaccount/FinAccountServices.xml
index efcc9a3..8a048e6 100644
--- a/applications/accounting/minilang/finaccount/FinAccountServices.xml
+++ b/applications/accounting/minilang/finaccount/FinAccountServices.xml
@@ -147,11 +147,6 @@ under the License.
         <field-to-result field="lookedUpValue.replenishLevel" result-name="replenishLevel"/>
         <field-to-result field="lookedUpValue.finAccountId" result-name="finAccountId"/>
     </simple-method>
-    <simple-method method-name="deleteFinAccount" short-description="Delete a Financial Account">
-        <entity-one entity-name="FinAccount" value-field="finAccount"/>
-        <remove-value value-field="finAccount"/>
-    </simple-method>
-
     <!-- FinAccountTrans Services -->
     <simple-method method-name="createFinAccountTrans" short-description="Create a Financial Account Transaction">
         <entity-one entity-name="FinAccount" value-field="finAccount"/>
diff --git a/applications/order/minilang/order/OrderSimpleMethods.xml b/applications/order/minilang/order/OrderSimpleMethods.xml
index 54fa4f8..a12888a 100644
--- a/applications/order/minilang/order/OrderSimpleMethods.xml
+++ b/applications/order/minilang/order/OrderSimpleMethods.xml
@@ -44,20 +44,6 @@ under the License.
             </else>
         </if-compare>
     </simple-method>
-    <simple-method method-name="deleteOrderAdjustment" short-description="Delete an OrderAdjustment">
-        <check-permission permission="ORDERMGR" action="_DELETE"><fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunDeleteOrderAdjustement"/></check-permission>
-        <check-errors/>
-        <entity-one entity-name="OrderAdjustment" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
-
-        <if-not-empty field="parameters.productPromoCodeId">
-            <entity-one entity-name="OrderProductPromoCode" value-field="lookedUpValue"/>
-            <if-not-empty field="lookedUpValue">
-                <remove-value value-field="lookedUpValue"/>
-            </if-not-empty>
-        </if-not-empty>
-    </simple-method>
-
     <simple-method method-name="updateOrderStatusFromReceipt" short-description="Update Order Status From ShipmentReceipt">
         <check-permission permission="ORDERMGR" action="_UPDATE"><fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunUpdateOrderStatusFromReceipt"/></check-permission>
         <check-errors/>
diff --git a/applications/order/minilang/shoppinglist/ShoppingListServices.xml b/applications/order/minilang/shoppinglist/ShoppingListServices.xml
index 14c3748..b2d54af 100644
--- a/applications/order/minilang/shoppinglist/ShoppingListServices.xml
+++ b/applications/order/minilang/shoppinglist/ShoppingListServices.xml
@@ -84,13 +84,6 @@ under the License.
         <property-to-field resource="OrderUiLabels" property="OrderShoppingListUpdatedSuccessfully" field="successMessage"/>
         <field-to-result  field="successMessage"/>
     </simple-method>
-
-    <simple-method method-name="removeShoppingList" short-description="Remove a ShoppingList">
-        <entity-one entity-name="ShoppingList" value-field="shoppingList"/>
-
-        <remove-value value-field="shoppingList"/>
-    </simple-method>
-
     <simple-method method-name="createShoppingListItem" short-description="Create a ShoppingList Item" login-required="false">
         <entity-and entity-name="ShoppingListItem" list="shoppingListItems">
             <field-map field-name="productId" from-field="parameters.productId"></field-map>
diff --git a/applications/order/servicedef/secas.xml b/applications/order/servicedef/secas.xml
index e141a8a..7c1fc19 100644
--- a/applications/order/servicedef/secas.xml
+++ b/applications/order/servicedef/secas.xml
@@ -464,7 +464,11 @@ under the License.
         <condition field-name="paymentId" operator="is-not-empty"/>
         <action service="createOrderPaymentApplication" mode="sync"/>
     </eca>
-
+    <eca service="deleteOrderAdjustment" event="commit">
+        <condition field-name="productPromoCodeId" operator="is-not-empty"/>
+        <condition field-name="orderId" operator="is-not-empty"/>
+        <action service="deleteOrderProductPromoCode" mode="sync"/>
+    </eca>
     <!-- Group Buying -->
     <eca service="storeOrder" event="commit">
         <condition field-name="orderTypeId" operator="equals" value="SALES_ORDER"/>
diff --git a/applications/order/servicedef/services.xml b/applications/order/servicedef/services.xml
index 609489c..3ad4c59 100644
--- a/applications/order/servicedef/services.xml
+++ b/applications/order/servicedef/services.xml
@@ -259,9 +259,9 @@ under the License.
             </type-validate>
         </override>
     </service>
-    <service name="deleteOrderAdjustment" default-entity-name="OrderAdjustment" engine="simple"
-        location="component://order/minilang/order/OrderSimpleMethods.xml" invoke="deleteOrderAdjustment">
+    <service name="deleteOrderAdjustment" default-entity-name="OrderAdjustment" engine="entity-auto" invoke="delete">
         <description>Delete an order adjustment record</description>
+        <permission-service service-name="orderAdjustmentPermissionCheck" main-action="DELETE"/>
         <auto-attributes mode="IN" include="pk" optional="false"/>
         <attribute name="orderId" type="String" mode="IN" optional="false">  <!-- needed for resetGrandTotal seca -->
             <type-validate>
diff --git a/applications/order/servicedef/services_shoppinglist.xml b/applications/order/servicedef/services_shoppinglist.xml
index 03c1684..d543ecf 100644
--- a/applications/order/servicedef/services_shoppinglist.xml
+++ b/applications/order/servicedef/services_shoppinglist.xml
@@ -46,8 +46,7 @@ under the License.
         <implements service="shoppingListInterface"/>
         <attribute name="shoppingListId" type="String" mode="IN" optional="false"/>
     </service>
-    <service name="removeShoppingList" engine="simple" auth="true"
-            location="component://order/minilang/shoppinglist/ShoppingListServices.xml" invoke="removeShoppingList">
+    <service name="removeShoppingList" engine="entity-auto" default-entity-name="ShoppingList" auth="true" invoke="delete">
         <description>Remove a shopping list entity</description>
         <permission-service service-name="checkShoppingListSecurity" main-action="DELETE"/>
         <attribute name="shoppingListId" type="String" mode="IN" optional="false"/>