You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2019/09/07 15:51:06 UTC
svn commit: r1866558 - in /ofbiz/ofbiz-framework/trunk/applications:
datamodel/entitydef/ product/ product/groovyScripts/shipment/
product/groovyScripts/shipment/picklist/
product/minilang/shipment/picklist/ product/servicedef/
product/template/facility/
Author: nmalin
Date: Sat Sep 7 15:51:06 2019
New Revision: 1866558
URL: http://svn.apache.org/viewvc?rev=1866558&view=rev
Log:
Improved: PicklistStatusHistory doesn't follow history entity status pattern
(OFBIZ-11182)
The entity PicklistStatusHistory record each status change realized on picklist.
It can't be convert to entity-auto easily because PicklistStatusHistory's fields pattern
doesn't follow same entities like ShipmentStatus and PartyStatus.
To solve this issue, I deprecate PicklistStatusHistory and move it to OldPicklistStatusHistory
and replace it by new entity PicklistStatus that can use natively with entityauto.
I added a new migration service migrateOldPicklistStatusHistoryToPickListStatus to forward all
picklist status history to new entity.
Added:
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy (with props)
ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml (with props)
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/ofbiz-component.xml
ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_picklist.xml
ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PicklistManage.ftl
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=1866558&r1=1866557&r2=1866558&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 15:51:06 2019
@@ -309,9 +309,10 @@ under the License.
<key-map field-name="lastModifiedByUserLogin" rel-field-name="userLoginId"/>
</relation>
</entity>
- <entity entity-name="PicklistStatusHistory"
+ <entity entity-name="OldPicklistStatusHistory" table-name="PICKLIST_STATUS_HISTORY"
package-name="org.apache.ofbiz.shipment.picklist"
title="Picklist Status History">
+ <description>Deprecated since branch release: PicklistStatus instead</description>
<field name="picklistId" type="id"></field>
<field name="changeDate" type="date-time"></field>
<field name="changeUserLoginId" type="id-vlong"></field>
@@ -338,6 +339,30 @@ under the License.
</relation>
</entity>
+ <entity entity-name="PicklistStatus"
+ package-name="org.apache.ofbiz.shipment.picklist"
+ title="Picklist Status History">
+ <field name="picklistId" type="id"/>
+ <field name="statusDate" type="date-time"/>
+ <field name="changeByUserLoginId" type="id-vlong"/>
+ <field name="statusId" type="id"/>
+ <field name="statusIdTo" type="id"/>
+ <prim-key field="picklistId"/>
+ <prim-key field="statusDate"/>
+ <relation type="one" fk-name="PCKLST_STST_PKLT" rel-entity-name="Picklist">
+ <key-map field-name="picklistId"/>
+ </relation>
+ <relation type="one" fk-name="PCKLST_STST_CUL" title="Change" rel-entity-name="UserLogin">
+ <key-map field-name="changeByUserLoginId" rel-field-name="userLoginId"/>
+ </relation>
+ <relation type="one" fk-name="PCKLST_STST_FSI" rel-entity-name="StatusItem">
+ <key-map field-name="statusId"/>
+ </relation>
+ <relation type="one" fk-name="PCKLST_STST_TSI" title="To" rel-entity-name="StatusItem">
+ <key-map field-name="statusIdTo" rel-field-name="statusId"/>
+ </relation>
+ </entity>
+
<!-- ========================================================= -->
<!-- org.apache.ofbiz.shipment.receipt -->
<!-- ========================================================= -->
Added: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy?rev=1866558&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy (added)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy Sat Sep 7 15:51:06 2019
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.ofbiz.entity.GenericValue
+
+/*
+ * Migrate all element present on entity OldPicklistStatusHistory to entity PickListStatus
+ * Update service for Deprecate since: branch release
+ */
+def migrateOldPicklistStatusHistoryToPickListStatus() {
+ List<GenericValue> oldPicklistStatusHistories = delegator.findAll("OldPicklistStatusHistory", false)
+ oldPicklistStatusHistories.each {
+ GenericValue picklistStatus = makeValue("PicklistStatus")
+ picklistStatus.statusId = it.statusId
+ picklistStatus.statusIdTo = it.statusIdTo
+ picklistStatus.picklistId = it.picklistId
+ picklistStatus.changeByUserLoginId = it.changeUserLoginId
+ picklistStatus.statusDate = it.changeDate
+ picklistStatus.create()
+ it.remove()
+ }
+ return success()
+}
\ No newline at end of file
Propchange: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=1866558&r1=1866557&r2=1866558&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 15:51:06 2019
@@ -799,12 +799,12 @@ under the License.
</if-empty>
<check-errors/>
- <make-value entity-name="PicklistStatusHistory" value-field="newStatusValue"/>
+ <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.changeDate"/>
- <set from-field="userLogin.userLoginId" field="newStatusValue.changeUserLoginId"/>
+ <now-timestamp field="newStatusValue.statusDate"/>
+ <set from-field="userLogin.userLoginId" field="newStatusValue.changeByUserLoginId"/>
<create-value value-field="newStatusValue"/>
</if-compare-field>
</if-not-empty>
@@ -1352,7 +1352,7 @@ under the License.
</iterate>
<clear-field field="picklistStatusHistoryInfoList"/>
- <get-related value-field="picklist" relation-name="PicklistStatusHistory" list="picklistStatusHistoryList"/>
+ <get-related value-field="picklist" relation-name="PicklistStatus" list="picklistStatusHistoryList"/>
<iterate list="picklistStatusHistoryList" entry="picklistStatusHistory">
<clear-field field="picklistStatusHistoryInfo"/>
<get-related-one value-field="picklistStatusHistory" relation-name="StatusItem" to-value-field="picklistStatusHistoryInfo.statusItem" use-cache="true"/>
Modified: ofbiz/ofbiz-framework/trunk/applications/product/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/ofbiz-component.xml?rev=1866558&r1=1866557&r2=1866558&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/ofbiz-component.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/ofbiz-component.xml Sat Sep 7 15:51:06 2019
@@ -60,6 +60,7 @@ under the License.
<service-resource type="model" loader="main" location="servicedef/services_config.xml"/>
<service-resource type="model" loader="main" location="servicedef/services_cost.xml"/>
<service-resource type="model" loader="main" location="servicedef/services_uom.xml"/>
+ <service-resource type="model" loader="main" location="servicedef/services_upgrade.xml"/>
<service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
<service-resource type="eca" loader="main" location="servicedef/secas_shipment.xml"/>
<service-resource type="group" loader="main" location="servicedef/groups.xml"/>
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=1866558&r1=1866557&r2=1866558&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 15:51:06 2019
@@ -130,6 +130,15 @@ under the License.
<permission-service service-name="facilityPermissionCheck" main-action="DELETE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
</service>
+ <service name="createPicklistStatus" default-entity-name="PicklistStatus" engine="entity-auto" invoke="create" auth="true">
+ <description>Create Picklist status History</description>
+ <permission-service service-name="facilityPermissionCheck" main-action="CREATE"/>
+ <auto-attributes include="pk" mode="IN" optional="false"/>
+ <auto-attributes include="nonpk" mode="IN" optional="true"/>
+ <override name="statusId" optional="false"/>
+ <override name="statusIdTo" optional="false"/>
+ <override name="statusDate" optional="true"/>
+ </service>
<!-- PicklistBin -->
<service name="createPicklistBin" default-entity-name="PicklistBin" engine="simple"
Added: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml?rev=1866558&view=auto
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml (added)
+++ ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml Sat Sep 7 15:51:06 2019
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
+ <description>Migration services on product component</description>
+ <vendor>OFBiz</vendor>
+ <version>1.0</version>
+
+ <service name="migrateOldPicklistStatusHistoryToPickListStatus" engine="groovy"
+ location="component://product/groovyScripts/shipment/picklist/PicklistServices.groovy" invoke="migrateOldPicklistStatusHistoryToPickListStatus" auth="true">
+ <description>Migration service to convert entries from OldPicklistStatusHistory to new Entity PickListStatus</description>
+ </service>
+</services>
Propchange: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml
------------------------------------------------------------------------------
svn:keywords = Date Rev Author URL Id
Propchange: ofbiz/ofbiz-framework/trunk/applications/product/servicedef/services_upgrade.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PicklistManage.ftl
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PicklistManage.ftl?rev=1866558&r1=1866557&r2=1866558&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PicklistManage.ftl (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/template/facility/PicklistManage.ftl Sat Sep 7 15:51:06 2019
@@ -111,8 +111,8 @@ under the License.
<div style="margin-left: 15px;">
<span class="label">${uiLabelMap.CommonStatus}</span> ${uiLabelMap.CommonChange} ${uiLabelMap.CommonFrom} ${picklistStatusHistoryInfo.statusItem.get("description",locale)}
${uiLabelMap.CommonTo} ${picklistStatusHistoryInfo.statusItemTo.description}
- ${uiLabelMap.CommonOn} ${picklistStatusHistoryInfo.picklistStatusHistory.changeDate}
- ${uiLabelMap.CommonBy} ${picklistStatusHistoryInfo.picklistStatusHistory.changeUserLoginId}
+ ${uiLabelMap.CommonOn} ${picklistStatusHistoryInfo.picklistStatusHistory.statusDate}
+ ${uiLabelMap.CommonBy} ${picklistStatusHistoryInfo.picklistStatusHistory.changeByUserLoginId}
</div>
</#list>
<hr />