Migration API Framework
Migration Wizard provides you an IMigratable object, which allows you to extend your business objects to support the migration process for a new component. There is no need to create separate migration object for the new component.
The IMigratable Object is implemented with four methods to extend the business object:
Select: This methods is used to pull the component to the interface of Migration Data object.
Duplicate Check: In this method, the Migration Wizard manager provides details to the object, wherein the specific logic to check the duplicates in the component Dev can be added.
Insert/Update: In this method, the MW Manager provides the details to the object, wherein the specific logic can be built to insert or update by the component Dev.
Before you begin you need to register the Business Object of the new component to the MIGRATION_SUBJECTS table. Refer to Registering the Business Object
Configure the Business Object for Migration
You can configure the business object to support the migration process for the new component.
To configure the business object for migration:
Include the header file
#include <library/generic/migratable.h>
To configure the Select method, to load UI and the object:
- Select method has the following parameters:Db, keys, contents
andselectAll
- In general,keys
are used, if notselectAll
is used.
- ForselectAll
, complete the instance, name, long name and these optional fields: description, update date and update source.These values are used only for the available components on loading.
- ForselectAll=
false, based on the keys supplied in the parameter, we need to get the data from the database and fill the contents.To configure Duplicate check:
- For duplicate check, the Migration Manager will pass all the components data.
- The business object needs to set the new instance and status, if any.To configure the Insert method:
- Migration Manager will pass all the components data.
- Before you insert, you need to update the dependent component instance. For example, if the field is dependent on codes, then you need to update the code instance. You can use theetNewId()
function to get the new instance.
- The business object has to update the instance to the data class after the insert.
- Operation will fail if there is no instance or status is set as error.To configure the update method:
- In the case of update, Migration Manager will pass all the components data.
- Before you do update, you need to update the dependent component instance. For example, if the field is dependent on codes, then you need to update the code instance. You can use theGetNewId ()
function to get the new instance.
- Instance needs to be updated to the data class after the update (optional). Otherwise, operation will be failed if status is set as error.On the component export, the EGL file will be generated. The content of the components will be in XML format.
Sample Code
IMigratable Class
class IMigratable
{
public:
virtual bool Select(EglRWDB* Db, set<RWCString>& keys, map<RWCString,CEglMigrationData>& contents, bool isSelectAll = true) = 0;
virtual bool DuplicateCheck(EglRWDB* Db, set<CEglMigrationData*>& components) = 0;
virtual bool Insert(EglRWDB* Db, set<CEglMigrationData*>& components) = 0;
virtual bool Update(EglRWDB* Db, set<CEglMigrationData*>& components) = 0;
} |
Register the Business Object
To add the Business Object entry in to the Migration Status table, use the following query format.
SQL
INSERT INTO [PACE_MASTER].[dbo].[MIGRATION_SUBJECTS] ([BUSINESS_OBJECT], [NAME], [MIGRATION_CONFIG], [UPDATE_SOURCE], [UPDATE_DATE]) VALUES (10021, N'Codes', N'<Config></Config>', N'EGLSCRIPT', N'2016-01-22 14:58:51')
|
Be sure that the script is added to the EDM package.
Oracle
INSERT INTO [PACE_MASTER][dbo][MIGRATION_SUBJECTS] ([BUSINESS_OBJECT], [NAME], [MIGRATION_CONFIG], [UPDATE_SOURCE], [UPDATE_DATE]) VALUES (10021, N'Codes', N'<Config></Config>', N'EGLSCRIPT', N'2016-01-22 14:58:51')
|
For reference implementation, you can refer the following business object: Users, Center Roles, Business Groups and KPI, which uses the above framework for the migration process.