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

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

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 98e95ee  Improved: Converted all TechDataCalendarExcDay related CRUD services from simple to entity-auto (#96)
98e95ee is described below

commit 98e95ee9e35b58e01f865e2b8a98927bb36e45d2
Author: Suraj Khurana <[hidden email]>
AuthorDate: Sun May 3 11:39:07 2020 +0530

    Improved: Converted all TechDataCalendarExcDay related CRUD services from simple to entity-auto (#96)
   
    Improved: Converted all TechDataCalendarExcDay related CRUD services from simple to entity-auto
    (OFBIZ-11622)
    Also, added a permission service for MANUFACTURING related base permission.
---
 .../minilang/techdata/RoutingSimpleServices.xml    | 42 ----------------------
 .../manufacturing/servicedef/services_calendar.xml | 24 ++++++++-----
 2 files changed, 16 insertions(+), 50 deletions(-)

diff --git a/applications/manufacturing/minilang/techdata/RoutingSimpleServices.xml b/applications/manufacturing/minilang/techdata/RoutingSimpleServices.xml
index 8dba701..d412a7d 100644
--- a/applications/manufacturing/minilang/techdata/RoutingSimpleServices.xml
+++ b/applications/manufacturing/minilang/techdata/RoutingSimpleServices.xml
@@ -144,48 +144,6 @@ under the License.
             <remove-value value-field="lookedUpValue"/>
         </if-not-empty>
     </simple-method>
-
-    <simple-method method-name="createCalendarExceptionDay" short-description="Create Calendar Exception Day">
-        <check-permission permission="MANUFACTURING" action="_CREATE"><fail-property resource="ManufacturingUiLabels" property="ManufacturingCalendarPermissionError"/></check-permission>
-        <check-errors/>
-        <make-value entity-name="TechDataCalendarExcDay" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key entity-name="TechDataCalendarExcDay" map="lookupPKMap" value-field="newEntity"/>
-        <if-not-empty field="newEntity.calendarId">
-            <add-error>
-                <fail-property resource="ManufacturingUiLabels" property="ManufacturingCalendarExceptionDayIdAlreadyExist"/>
-            </add-error>
-            <check-errors/>
-        <else>
-            <make-value entity-name="TechDataCalendarExcDay" value-field="newEntity"/>
-            <set-pk-fields map="parameters" value-field="newEntity"/>
-            <set-nonpk-fields map="parameters" value-field="newEntity"/>
-            <create-value value-field="newEntity"/>
-        </else>
-        </if-not-empty>
-    </simple-method>
-
-    <simple-method method-name="updateCalendarExceptionDay" short-description="Update CalendarExceptionDay">
-        <check-permission permission="MANUFACTURING" action="_UPDATE"><fail-property resource="ManufacturingUiLabels" property="ManufacturingCalendarPermissionError"/></check-permission>
-        <check-errors/>
-        <make-value entity-name="TechDataCalendarExcDay" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key entity-name="TechDataCalendarExcDay" map="lookupPKMap" value-field="lookedUpValue"/>
-        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
-        <store-value value-field="lookedUpValue"/>
-    </simple-method>
-
-    <simple-method method-name="removeCalendarExceptionDay" short-description="Remove CalendarExceptionDay">
-        <check-permission permission="MANUFACTURING" action="_DELETE"><fail-property resource="ManufacturingUiLabels" property="ManufacturingCalendarPermissionError"/></check-permission>
-        <check-errors/>
-        <make-value entity-name="TechDataCalendarExcDay" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key entity-name="TechDataCalendarExcDay" map="lookupPKMap" value-field="lookedUpValue"/>
-        <if-not-empty field="lookedUpValue.calendarId">
-            <remove-value value-field="lookedUpValue"/>
-        </if-not-empty>
-    </simple-method>
-
     <simple-method method-name="createCalendarExceptionWeek" short-description="Create Calendar Exception Week">
         <check-permission permission="MANUFACTURING" action="_CREATE"><fail-property resource="ManufacturingUiLabels" property="ManufacturingCalendarPermissionError"/></check-permission>
         <check-errors/>
diff --git a/applications/manufacturing/servicedef/services_calendar.xml b/applications/manufacturing/servicedef/services_calendar.xml
index 9a6db9e..8231835 100644
--- a/applications/manufacturing/servicedef/services_calendar.xml
+++ b/applications/manufacturing/servicedef/services_calendar.xml
@@ -41,7 +41,7 @@ under the License.
         <description>Remove a calendar</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
-
+    <!-- TechDataCalendarWeek services -->
     <service name="createCalendarWeek" engine="simple" default-entity-name="TechDataCalendarWeek"
             location="component://manufacturing/minilang/techdata/RoutingSimpleServices.xml" invoke="createCalendarWeek">
         <description>Create a Calendar Week</description>
@@ -59,24 +59,32 @@ under the License.
         <description>Remove a Calendar Week</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
-
-    <service name="createCalendarExceptionDay" engine="simple" default-entity-name="TechDataCalendarExcDay"
-            location="component://manufacturing/minilang/techdata/RoutingSimpleServices.xml" invoke="createCalendarExceptionDay">
+    <!-- manufacturing permission service -->
+    <service name="manufacturingPermissionService" engine="simple"
+             location="component://common/minilang/permission/CommonPermissionServices.xml" invoke="genericBasePermissionCheck">
+        <implements service="permissionInterface"/>
+        <attribute name="primaryPermission" type="String" mode="IN" optional="true" default-value="MANUFACTURING"/>
+        <attribute name="altPermission" type="String" mode="IN" optional="true"/>
+    </service>
+    <!-- TechDataCalendarExcDay services -->
+    <service name="createCalendarExceptionDay" engine="entity-auto" default-entity-name="TechDataCalendarExcDay" invoke="create">
         <description>Create a calendar ExceptionDay</description>
+        <permission-service service-name="manufacturingPermissionService" main-action="CREATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="updateCalendarExceptionDay" engine="simple" default-entity-name="TechDataCalendarExcDay"
-            location="component://manufacturing/minilang/techdata/RoutingSimpleServices.xml" invoke="updateCalendarExceptionDay">
+    <service name="updateCalendarExceptionDay" engine="entity-auto" default-entity-name="TechDataCalendarExcDay" invoke="update">
         <description>Update a calendar ExceptionDay</description>
+        <permission-service service-name="manufacturingPermissionService" main-action="UPDATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="removeCalendarExceptionDay" engine="simple" default-entity-name="TechDataCalendarExcDay"
-            location="component://manufacturing/minilang/techdata/RoutingSimpleServices.xml" invoke="removeCalendarExceptionDay">
+    <service name="removeCalendarExceptionDay" engine="entity-auto" default-entity-name="TechDataCalendarExcDay" invoke="delete">
         <description>Update a calendar ExceptionDay</description>
+        <permission-service service-name="manufacturingPermissionService" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+    <!-- TechDataCalendarExcWeek services -->
     <service name="createCalendarExceptionWeek" engine="simple" default-entity-name="TechDataCalendarExcWeek"
             location="component://manufacturing/minilang/techdata/RoutingSimpleServices.xml" invoke="createCalendarExceptionWeek">
         <description>Create a Calendar Exception Week</description>