Importing Rhapsody Design Manager projects with the Rhapsody API

The Rhapsody API includes a set of methods that can be used to import Rhapsody Design Manager projects into Rhapsody Model Manager.

If you plan to use the API to import Rhapsody Design Manager projects, your code should include the following steps, in the order listed:

  1. Log in to the Design Management server (IRPApplication.loginToDesignManagerWithUsername).
  2. Import the Rhapsody Design Manager model (IRPApplication.importDesignManagerModel).
  3. Enable the project for Rhapsody Model Manager (IRPProject.enableRhapsodyModelManager).
  4. Set the global configuration to use for the project (IRPProject.setGlobalConfiguration).
  5. If the project that is being migrated contains links to IBM Engineering Test Management test cases or Engineering Workflow Management work items:
    1. Get the remote artifact packages contained in the Rhapsody Model Manager project (IRPProject.getRemoteResourcePackages).
    2. Log in to the relevant remote artifact server (IRPPackage.loginToRemoteArtifactServer). This method displays the log-in window, and you must then provide your user name and password. This step must be repeated for each remote artifact package in the project.
  6. Migrate the links that were imported as part of the Rhapsody Design Manager project (IRPProject.migrateDesignManagerLinks).

Sample code for importing Rhapsody Design Manager project

int loginResult = rhp.loginToDesignManagerWithUsername("https://win2012vm2.example.com:9661/dm", "user27", "abc123");
	   if(loginResult > 0) {
             rhp.importDesignManagerModel("https://win2012vm2.example.com:9661/dm", "Project Area for import", "Stream for import", "Project to import", "C:\\imported_dm_projects", 1);
	      IRPProject prj = rhp.activeProject();
	      prj.enableRhapsodyModelManager();
	      prj.setGlobalConfiguration("https://win2012vm2.example.com:9606/gc/configuration/3", "2019 configuration");
	      IRPCollection remoteResourcePackagesInRmmProject = prj.getRemoteResourcePackages();
	      IRPPackage individualRemoteResoucePackage;
	      int numberOfRemotePackages = remoteResourcePackagesInRmmProject.getCount();
	      for(int remotePackageCounter = 1; remotePackageCounter < numberOfRemotePackages+1 ; remotePackageCounter++) {
	         individualRemoteResoucePackage = (IRPPackage)remoteResourcePackagesInRmmProject.getItem(remotePackageCounter);
	         individualRemoteResoucePackage.loginToRemoteArtifactServer();
	      }
	      prj.migrateDesignManagerLinks();
	   }			

See the Javadoc for the Rhapsody API for the details of each of the methods used.

Checking for links that were not migrated

After carrying out the migration of an Rhapsody Design Manager project, there may be links that were not migrated to Rhapsody Model Manager due to the type of link not being supported or some other reason.

You may want to use the Rhapsody API to check the links one at a time to find those that were not migrated, and compile a list that you can print. Alternatively, you way want to try changing the link type to a type that is supported by Rhapsody Model Manager.

To check the migration status of individual links, include the following steps in your code:

  1. Go through all of the elements in the model containing the migrated links (call IRPModelElement.getNestedElementsRecursive on the project).
  2. For each element, get the remote dependencies for the element (IRPModelElement.getRemoteDependencies).
  3. For each of the remote dependencies of an element, check whether migration is still required (IRPDependency.isNeedToMigrate).
  4. For those dependencies that still have to be migrated, you can try changing the type of the link (IRPDependency.setLinkType).

For information on additional API methods for working with remote artifacts, see API methods for remote artifacts in Rhapsody Model Manager.