svn commit: r1866561 - in /ofbiz/ofbiz-framework/trunk/applications: datamodel/entitydef/shipment-entitymodel.xml product/minilang/shipment/picklist/PicklistServices.xml product/servicedef/secas_shipment.xml product/servicedef/services_picklist.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1866561 - in /ofbiz/ofbiz-framework/trunk/applications: datamodel/entitydef/shipment-entitymodel.xml product/minilang/shipment/picklist/PicklistServices.xml product/servicedef/secas_shipment.xml product/servicedef/services_picklist.xml

nmalin
Author: nmalin
Date: Sat Sep  7 17:48:50 2019
New Revision: 1866561

URL: http://svn.apache.org/viewvc?rev=1866561&view=rev
Log:
Implemented: Convert Picklist related CRUD services from simple to entity-auto
(OFBIZ-10636)

services converted:
 * createPicklist
 * updatePicklist
 * deletePicklist
 * createPicklistBin
 * deletePicklistBin
 * createPicklistItem
 * updatePicklistItem
 * updatePicklistItem
 * deletePicklistItem
 * createPicklistRole
 * deletePicklistRole

Entity Picklist received to new field createdDate and lastModifiedDate
that needed to support automatic setting of createdByUserLogin natevily
by entity auto engine

Thanks to Pallavi Goyal for this issue and Suraj Khurana for the remind.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml
    ofbiz/ofbiz-framework/trunk/applications/product/minilang/shipment/picklist/PicklistServices.xml
    ofbiz/ofbiz-framework/trunk/applications/product/servicedef/secas_shipment.xml
    ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_picklist.xml

Modified: ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml?rev=1866561&r1=1866560&r2=1866561&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/shipment-entitymodel.xml Sat Sep  7 17:48:50 2019
@@ -159,8 +159,10 @@ under the License.
       <field name="shipmentMethodTypeId" type="id"></field>
       <field name="statusId" type="id"></field>
       <field name="picklistDate" type="date-time"></field>
-      <field name="createdByUserLogin" type="id-vlong"></field>
-      <field name="lastModifiedByUserLogin" type="id-vlong"></field>
+      <field name="createdDate" type="date-time"/>
+      <field name="createdByUserLogin" type="id-vlong"/>
+      <field name="lastModifiedDate" type="date-time"/>
+      <field name="lastModifiedByUserLogin" type="id-vlong"/>
       <prim-key field="picklistId"/>
       <relation type="one" fk-name="PICKLST_FLTY" rel-entity-name="Facility">
         <key-map field-name="facilityId"/>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/minilang/shipment/picklist/PicklistServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/minilang/shipment/picklist/PicklistServices.xml?rev=1866561&r1=1866560&r2=1866561&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/minilang/shipment/picklist/PicklistServices.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/minilang/shipment/picklist/PicklistServices.xml Sat Sep  7 17:48:50 2019
@@ -761,139 +761,6 @@ under the License.
         <field-to-result field="pickMoveInfoList"/>
     </simple-method>
 
-       <!-- Picklist -->
-    <simple-method method-name="createPicklist" short-description="Create Picklist">
-        <make-value entity-name="Picklist" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-
-        <sequenced-id sequence-name="Picklist" field="newEntity.picklistId"/>
-        <field-to-result field="newEntity.picklistId" result-name="picklistId"/>
-
-        <if-empty field="newEntity.statusId">
-            <set value="PICKLIST_INPUT" field="newEntity.statusId"/>
-        </if-empty>
-
-        <!-- auto-set the picklistDate, this is not user-changeable -->
-        <now-timestamp field="newEntity.picklistDate"/>
-
-        <!-- set the created and lastModified info -->
-        <set from-field="userLogin.userLoginId" field="newEntity.createdByUserLogin"/>
-        <set from-field="userLogin.userLoginId" field="newEntity.lastModifiedByUserLogin"/>
-
-        <create-value value-field="newEntity"/>
-    </simple-method>
-    <simple-method method-name="updatePicklist" short-description="Update Picklist">
-        <make-value entity-name="Picklist" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/>
-
-        <if-not-empty field="parameters.statusId">
-            <if-compare-field field="parameters.statusId" to-field="lookedUpValue.statusId" operator="not-equals">
-                <!-- make sure a StatusValidChange record exists, if not return error -->
-                <entity-one entity-name="StatusValidChange" value-field="checkStatusValidChange" auto-field-map="false">
-                    <field-map field-name="statusId" from-field="lookedUpValue.statusId"/>
-                    <field-map field-name="statusIdTo" from-field="parameters.statusId"/>
-                </entity-one>
-                <if-empty field="checkStatusValidChange">
-                    <set value="ERROR: Changing the status from ${lookedUpValue.statusId} to ${parameters.statusId} is not allowed." field="error_list[]"/>
-                </if-empty>
-                <check-errors/>
-
-                <make-value entity-name="PicklistStatus" value-field="newStatusValue"/>
-                <set from-field="parameters.picklistId" field="newStatusValue.picklistId"/>
-                <set from-field="lookedUpValue.statusId" field="newStatusValue.statusId"/>
-                <set from-field="parameters.statusId" field="newStatusValue.statusIdTo"/>
-                <now-timestamp field="newStatusValue.statusDate"/>
-                <set from-field="userLogin.userLoginId" field="newStatusValue.changeByUserLoginId"/>
-                <create-value value-field="newStatusValue"/>
-            </if-compare-field>
-        </if-not-empty>
-
-        <!-- now finally check for errors -->
-        <check-errors/>
-
-        <!-- finally before setting nonpk fields, set the oldStatusId -->
-        <field-to-result field="lookedUpValue.statusId" result-name="oldStatusId"/>
-
-        <!-- now that all changes have been checked, set the nonpks -->
-        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
-        <set from-field="userLogin.userLoginId" field="lookedUpValue.lastModifiedByUserLogin"/>
-
-        <store-value value-field="lookedUpValue"/>
-    </simple-method>
-    <simple-method method-name="deletePicklist" short-description="Delete Picklist">
-        <make-value entity-name="Picklist" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
-    </simple-method>
-
-    <!-- PicklistBin -->
-    <simple-method method-name="createPicklistBin" short-description="Create PicklistBin">
-        <make-value entity-name="PicklistBin" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-
-        <sequenced-id sequence-name="PicklistBin" field="newEntity.picklistBinId"/>
-        <field-to-result field="newEntity.picklistBinId" result-name="picklistBinId"/>
-
-        <create-value value-field="newEntity"/>
-    </simple-method>
-    <simple-method method-name="deletePicklistBin" short-description="Delete PicklistBin">
-        <make-value entity-name="PicklistBin" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
-    </simple-method>
-
-    <!-- PicklistItem -->
-    <simple-method method-name="createPicklistItem" short-description="Create PicklistItem">
-        <make-value entity-name="PicklistItem" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-
-        <if-empty field="newEntity.itemStatusId">
-            <set value="PICKITEM_PENDING" field="newEntity.itemStatusId"/>
-        </if-empty>
-
-        <create-value value-field="newEntity"/>
-    </simple-method>
-    <simple-method method-name="updatePicklistItem" short-description="Update PicklistItem">
-        <make-value entity-name="PicklistItem" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/>
-
-        <if-not-empty field="parameters.itemStatusId">
-            <if-compare-field field="parameters.itemStatusId" to-field="lookedUpValue.itemStatusId" operator="not-equals">
-                <!-- make sure a StatusValidChange record exists, if not return error -->
-                <entity-one entity-name="StatusValidChange" value-field="checkStatusValidChange" auto-field-map="false">
-                    <field-map field-name="statusId" from-field="lookedUpValue.itemStatusId"/>
-                    <field-map field-name="statusIdTo" from-field="parameters.itemStatusId"/>
-                </entity-one>
-                <if-empty field="checkStatusValidChange">
-                    <set value="ERROR: Changing the status from ${lookedUpValue.itemStatusId} to ${parameters.itemStatusId} is not allowed." field="error_list[]"/>
-                </if-empty>
-            </if-compare-field>
-        </if-not-empty>
-
-        <!-- now finally check for errors -->
-        <check-errors/>
-
-        <!-- finally before setting nonpk fields, set the oldItemStatusId -->
-        <field-to-result field="lookedUpValue.itemStatusId" result-name="oldItemStatusId"/>
-
-        <!-- now that all changes have been checked, set the nonpks -->
-        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
-
-        <!-- store the changes -->
-        <store-value value-field="lookedUpValue"/>
-    </simple-method>
-    <simple-method method-name="deletePicklistItem" short-description="Delete PicklistItem">
-        <make-value entity-name="PicklistItem" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
-    </simple-method>
-    
     <!-- Service which edit a PicklistItem when a preparator choose a specified lot for one line order
         This service is called by the request :
             - editPicklistItem
@@ -1100,25 +967,6 @@ under the License.
         <call-service service-name="updatePicklistItem" in-map-name="serviceCtx" include-user-login="true"/>
     </simple-method>
 
-    <!-- PicklistRole -->
-    <simple-method method-name="createPicklistRole" short-description="Create PicklistRole">
-        <make-value entity-name="PicklistRole" 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"/>
-    </simple-method>
-    <simple-method method-name="deletePicklistRole" short-description="Delete PicklistRole">
-        <make-value entity-name="PicklistRole" value-field="lookupPKMap"/>
-        <set-pk-fields map="parameters" value-field="lookupPKMap"/>
-        <find-by-primary-key map="lookupPKMap" value-field="lookedUpValue"/>
-        <remove-value value-field="lookedUpValue"/>
-    </simple-method>
-
     <!-- ========================================================= -->
     <!-- =========== Picklist Report/Display Services ============ -->
     <!-- ========================================================= -->

Modified: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/secas_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/servicedef/secas_shipment.xml?rev=1866561&r1=1866560&r2=1866561&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/servicedef/secas_shipment.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/servicedef/secas_shipment.xml Sat Sep  7 17:48:50 2019
@@ -164,6 +164,11 @@ under the License.
     </eca>
 
     <!-- picking ecas -->
+    <eca service="updatePicklist" event="commit">
+        <set field-name="statusIdTo" env-name="statusId"/>
+        <set field-name="statusId" env-name="oldStatusId"/>
+        <action service="createPicklistStatus" mode="sync"/>
+    </eca>
     <eca service="updatePicklistItem" event="commit">
         <condition-field field-name="itemStatusId" operator="not-equals" to-field-name="oldItemStatusId"/>
         <action service="checkPicklistBinItemStatuses" mode="sync"/>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_picklist.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_picklist.xml?rev=1866561&r1=1866560&r2=1866561&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_picklist.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_picklist.xml Sat Sep  7 17:48:50 2019
@@ -101,31 +101,24 @@ under the License.
     </service>
 
     <!-- Picklist -->
-    <service name="createPicklist" default-entity-name="Picklist" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="createPicklist" auth="true">
+    <service name="createPicklist" default-entity-name="Picklist" engine="entity-auto" invoke="create" auth="true">
         <description>Create Picklist</description>
         <permission-service service-name="facilityPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="OUT" optional="false"/>
-        <auto-attributes include="nonpk" mode="IN" optional="true">
-            <exclude field-name="picklistDate"/>
-            <exclude field-name="createdByUserLogin"/>
-            <exclude field-name="lastModifiedByUserLogin"/>
-        </auto-attributes>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <override name="statusId" default-value="PICKLIST_INPUT"/>
+        <override name="picklistDate" default-value="${date:nowTimestamp()}"/>
     </service>
-    <service name="updatePicklist" default-entity-name="Picklist" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="updatePicklist" auth="true">
+    <service name="updatePicklist" default-entity-name="Picklist" engine="entity-auto" invoke="update" auth="true">
         <description>Update Picklist</description>
         <permission-service service-name="facilityPermissionCheck" main-action="UPDATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true">
             <exclude field-name="picklistDate"/>
-            <exclude field-name="createdByUserLogin"/>
-            <exclude field-name="lastModifiedByUserLogin"/>
         </auto-attributes>
         <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/>
     </service>
-    <service name="deletePicklist" default-entity-name="Picklist" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="deletePicklist" auth="true">
+    <service name="deletePicklist" default-entity-name="Picklist" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete Picklist</description>
         <permission-service service-name="facilityPermissionCheck" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
@@ -141,8 +134,7 @@ under the License.
     </service>
 
     <!-- PicklistBin -->
-    <service name="createPicklistBin" default-entity-name="PicklistBin" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="createPicklistBin" auth="true">
+    <service name="createPicklistBin" default-entity-name="PicklistBin" engine="entity-auto" invoke="create" auth="true">
         <description>Create PicklistBin</description>
         <permission-service service-name="facilityPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="OUT" optional="false"/>
@@ -154,8 +146,7 @@ under the License.
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
-    <service name="deletePicklistBin" default-entity-name="PicklistBin" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="deletePicklistBin" auth="true">
+    <service name="deletePicklistBin" default-entity-name="PicklistBin" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete PicklistBin</description>
         <permission-service service-name="facilityPermissionCheck" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
@@ -168,24 +159,21 @@ under the License.
     </service>
 
     <!-- PicklistItem -->
-    <service name="createPicklistItem" default-entity-name="PicklistItem" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="createPicklistItem" auth="true">
+    <service name="createPicklistItem" default-entity-name="PicklistItem" engine="entity-auto" invoke="create" auth="true">
         <description>Create PicklistItem</description>
         <permission-service service-name="facilityPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="false"/>
-        <override name="itemStatusId" optional="true"/>
+        <override name="itemStatusId" optional="true" default-value="PICKITEM_PENDING"/>
     </service>
-    <service name="updatePicklistItem" default-entity-name="PicklistItem" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="updatePicklistItem" auth="true">
+    <service name="updatePicklistItem" default-entity-name="PicklistItem" engine="entity-auto" invoke="update" auth="true">
         <description>Update PicklistItem</description>
         <permission-service service-name="facilityPermissionCheck" main-action="UPDATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <attribute name="oldItemStatusId" type="String" mode="OUT" optional="true"/>
     </service>
-    <service name="deletePicklistItem" default-entity-name="PicklistItem" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="deletePicklistItem" auth="true">
+    <service name="deletePicklistItem" default-entity-name="PicklistItem" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete PicklistItem</description>
         <permission-service service-name="facilityPermissionCheck" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
@@ -214,8 +202,7 @@ under the License.
     </service>
 
     <!-- PicklistRole -->
-    <service name="createPicklistRole" default-entity-name="PicklistRole" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="createPicklistRole" auth="true">
+    <service name="createPicklistRole" default-entity-name="PicklistRole" engine="entity-auto" invoke="create" auth="true">
         <description>Create PicklistRole</description>
         <permission-service service-name="facilityPermissionCheck" main-action="CREATE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
@@ -234,10 +221,10 @@ under the License.
             <exclude field-name="lastModifiedByUserLogin"/>
         </auto-attributes>
     </service>
-    <service name="deletePicklistRole" default-entity-name="PicklistRole" engine="simple"
-            location="component://product/minilang/shipment/picklist/PicklistServices.xml" invoke="deletePicklistRole" auth="true">
+    <service name="deletePicklistRole" default-entity-name="PicklistRole" engine="entity-auto" invoke="delete" auth="true">
         <description>Delete PicklistRole</description>
         <permission-service service-name="facilityPermissionCheck" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+
 </services>