Permalink
Please
sign in to comment.
Browse files
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. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866558 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
with
112 additions
and 7 deletions.
- +26 −1 applications/datamodel/entitydef/shipment-entitymodel.xml
- +39 −0 applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy
- +4 −4 applications/product/minilang/shipment/picklist/PicklistServices.xml
- +1 −0 applications/product/ofbiz-component.xml
- +9 −0 applications/product/servicedef/services_picklist.xml
- +31 −0 applications/product/servicedef/services_upgrade.xml
- +2 −2 applications/product/template/facility/PicklistManage.ftl
@@ -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() | ||
} |
@@ -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> |
0 comments on commit
1e5c621