-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
7 changed files
with
112 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
applications/product/groovyScripts/shipment/picklist/PicklistServices.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters