About Custom Migration

To handle custom schema that may have been added to the objects and relationships being migrated, a Matrix Command object named FTRInterOpIntermediateObjectMigration has been added to the common migration framework. This object is installed together with ENOVIA Variant Configuration Central. It enables you to run your own migrations during the migration process, and contains no settings by default.

Related Topics
About the FTR Schema Migration Tool
Running the Migration Tool
Migration Property File Settings

Any customer or integration application that needs to run an additional migration should add a setting to the FTRInterOpIntermediateObjectMigration command. The setting must consist of a unique name, which can be any string value. The setting value must be in the form PROGRAM:METHOD for the program and method name that the default migration script should call to handle customizations.

The following are some examples of settings that can be added to the command:

Command Setting Value
FTRInterOpIntermediateObjectMigration VPM emxVPMIntermediateObjectMigration:migrateObject
  LG lgIOMigration:migrateObject
  MyProgram MyProgram:myMigration

There must be Matrix Java Program Object (JPO) by the name of the program given in the setting. Below is an example of a custom migration program and method with the required arguments and retype:

public class MyProgram_mxJPO extends emxCommonMigration_mxJPO
{
...
/**
 * Custom Migration
 * This method contains any custom migration algorithsm that need to be run
 * @param context the eMatrix <code>Context</code> object
 * @param args is a packed HashMap containing
 *               objectId String id of context object being migrated
 *               newRelId String id of the relationship that is replacing the object being migrated 
 * @return Map consisting of 
 *               status integer flag, 9 on success or 1 on failure 
 *               faiureId String specifying a meaningful status code
 *               failureMessage String specifying the failure message
 * @throws Exception if the operation fails
 */

     public Map myMigration (Context context, String[] args)
     throws Exception
     {
        Map statusMap = new HashMap();
        statusMap.put("status", 0);
        statusMap.put("failureId", "");
        statusMap.put("failureMessage", "");
        HashMap paramMap = (HashMap)JPO.unpackArgs(args);
        MapList objMapList = (MapList)paramMap.get("objectList");
        String objectId = "";
        String newRelId = "";
        
        try 
        {
        	Iterator itr = objMapList.iterator();
        	while ( itr.hasNext())
        	{
        		Map objMap = (Map)itr.next();
        		objectId = (String)objMap.get("objectId");
        		newRelId = (String)objMap.get("newRelId");

                              …custom migration code…
        	}
        }
        catch (Exception ex) 
        {
            statusMap.put("status", 1);
            statusMap.put("failureId", objectId);
            statusMap.put("failureMessage", objectId + " " +   ex.getMessage());
        }
        return statusMap;
     }
}

The PROGRAM:METHOD is called for each object that is being migrated. Upon return to the migration, the status flag is checked.

  • If the status is 0 (i.e., success), then an entry is made in the migration.log file indicating that the custom migration completed successfully. For example:
    Custom Migration 'VPM' COMPLETED
  • If the status is 1 (i.e., failure), then an entry is made in the migration.log file indicating that the custom migration has failed. For example:
    Custom Migration 'VPM' FAILED

    Additionally on failure, the failureMessage is written to the unConvertedObjectIds files using the command:

    writeUnconvertedOID(String command, String objectId)
    

    Argument Description
    command The failureMessage from the status map in the form of TYPE,NAME,REVISION,Classification\n
    objectId The failureId from the status map for the ID that has failed

The default migration automatically migrates any custom relationships that are connected TO or FROM the Feature List or GBOM type, and those custom relationships do not require a custom migration program.