Create Migration Roadmap Diagram using Open API
Migration roadmap allow user to model and document the time frame, transition and migration of his projects. Besides it also helps to record when a project is reviewed and investment will take place throughout its life-cycle. In Visual Paradigm you can create migration roadmap by manually create it on diagram, or generate it via Open API. In this article we will show you how to create migration roadmap using Visual Paradigm‘s Open API.
This is the migration roadmap we are going to create. It consists of programs, projects, timeline, project duration (project bars), deliverables and dependencies, transition targets, investment points as well as check points.
Create Blank Migration Roadmap Diagram
First we create a blank Migration Roadmap Diagram. We can use the DiagramManager.createDiagram to create a blank diagram.
// Create migration roadmap diagram DiagramManager dm = ApplicationManager.instance().getDiagramManager(); IMigrationRoadmapUIModel migrationRoadMapDiagram = (IMigrationRoadmapUIModel) dm.createDiagram(IDiagramTypeConstants.DIAGRAM_TYPE_MIGRATION_ROADMAP); migrationRoadMapDiagram.setName("Migration Roadmap - Migration Roadmap Example");
Create Migration Roadmap Model
Unlike other diagrams that user need to manually specify the coordinate of various elements, in migration road map elements are rendered automatically based on the models. The root of the migration road map is the IMigrationRoadmapModel and we can create it from IModelElementFactory.instance().createMigrationRoadmapModel(). Once the model is created we then specify the name of the baseline architecture and target architecture.
// Create IMigrationRoadmapModel // and specify the name of the Baseline Architecture // and Target Architecture IMigrationRoadmapModel migrationRoadMap = IModelElementFactory.instance().createMigrationRoadmapModel(); migrationRoadMapDiagram.setMigrationRoadmapModelAddress(migrationRoadMap.getAddress()); migrationRoadMap.setBaselineArchitectureName("Baseline Architecture"); migrationRoadMap.setTargetArchitectureName("Target Architecture");
Create Timeline
Next we create the timeline of the migration roadmap. After create the timeline from IModelElementFactory we then have to specify the start date, duration and the interval unit of the map, as well as the width of time unit for rendering of timeline. After that set the timeline to IMigrationRoadMapModel.setTimeline() method.
// Create timeline IMigrationRoadmapTimeline timeline = IModelElementFactory.instance().createMigrationRoadmapTimeline(); // Specify the start time as millisecond value in string type Date startDate = Date.valueOf("2017-07-19"); timeline.setStartDate(startDate.getTime() + ""); // Specify the timeline with 1 year as overall duration timeline.setDurationUnit(IMigrationRoadmapTimeline.DURATION_UNIT_YEAR); timeline.setDurationUnitCount(1); // Specify the timeline with monthly time unit timeline.setIntervalUnit(IMigrationRoadmapTimeline.INTERVAL_UNIT_MONTH); timeline.setIntervalUnitCount(1); // Each time unit with 80px width timeline.setTimeUnitWidth(80); // Add the timelink to migration roadmap migrationRoadMap.setTimeline(timeline);
Create Program and Project
Now we can start work on the details of the migration roadmap. We first create the program using IModelElementFactory.instance().createMigrationRoadmapProgram(). Please note that we also need to specify the color in program to control how the project duration bar being rendered. Once the programs is created we then add it back to the IMigrationRoadMapModel.
// Create program IMigrationRoadmapProgramme progUnifiedCRM = IModelElementFactory.instance().createMigrationRoadmapProgramme(); progUnifiedCRM.setName("Unified CRM"); // Specify the color of program (for project bars) in RGB value progUnifiedCRM.setColor(Color.ORANGE.getRGB()); migrationRoadMap.addProgramme(progUnifiedCRM);
After create the program we then create the project from IModelElementFactory. After that we specify its name and add it to program.
// Create project and add to program IMigrationRoadmapProject prjCRMIntegration = IModelElementFactory.instance().createMigrationRoadmapProject(); prjCRMIntegration.setName("CRM System Integration"); progUnifiedCRM.addProject(prjCRMIntegration);
Now it’s your turn to create the other programs and projects.
Create Project Bar
Once the programs and projects and projects are being created we can then create the time bar on each project. The project bar can be created from the project using IMigrationRoadmapProject. createMigrationRoadmapProjectBar(). After create the bar we have to specify its start and end time. Without specify start means it is start from the beginning. The start and end time are pixel value calculated starting from the timeline zero point. i.e. if your time line having interval unit as month and time unit width as 80, by specify start at 80 and end at 160 means the project time line is on the month #2 of the timeline.
// Create project bar from project IMigrationRoadmapProjectBar barDBMigration = prjDbMigration.createMigrationRoadmapProjectBar(); barDBMigration.setStartTime(160); barDBMigration.setEndTime(200); prjDbMigration.addBar(barDBMigration);
Create Deliverable and Dependency
Next we create the deliverables on its dependencies in project bar. The dependency can be created using IModelElementFactory.instance().createMigrationRoadmapDeliverable() method. After create the deliverable we need to specify the time where the deliverable being generated and add the deliverable to project bar. The time of the deliverable is specified relative to the start time of the project bar.
// Create deliverable on project bar IMigrationRoadmapDeliverable crmDeliverable = IModelElementFactory.instance().createMigrationRoadmapDeliverable(); // Specify the time of the deliverable being generated // the time is relative to the start time of the project bar crmDeliverable.setTime(150); barCRM.addDeliverable(crmDeliverable);
After create deliverables we can then create the dependency using IModelElementFactory.instance().createMigrationRoadmapDeliverableDependency(). After create the dependency we need to specify the from & to deliverable and then add it to the migration roadmap.
Create dependency between deliverable IMigrationRoadmapDeliverableDependency depCRMDBMigration = IModelElementFactory.instance().createMigrationRoadmapDeliverableDependency(); depCRMDBMigration.setFromDeliverable(crmDeliverable); depCRMDBMigration.setToDeliverable(dbMigrationDeliverable); migrationRoadMap.addDeliverableDependencie(depCRMDBMigration);
Create Transition Target
The transition target can be created using IModelElementFactory.instance().createMigrationRoadmapTransitionTarget(). After create the transition target we need to specify its name, time and add it to IMigrationRoadmap.
// Create transition target IMigrationRoadmapTransitionTarget transitionA = IModelElementFactory.instance().createMigrationRoadmapTransitionTarget(); transitionA.setName("Transition A"); transitionA.setTime(200); migrationRoadMap.addTransitionTarget(transitionA);
Create Investment Point and Check Point
The investment point and check point can create using the createMigrationRoadmapInvestmentPoint() and createMigrationRoadmapCheckPoint() methods in IModelElementFactory. Similar to Transition Target you can specify the name and time for the investment point and check point. For check point you can optionally specify its color as well.
// Create investment point IMigrationRoadmapInvestmentPoint investmentPt1 = IModelElementFactory.instance().createMigrationRoadmapInvestmentPoint(); investmentPt1.setTime(30); migrationRoadMap.addInvestmentPoint(investmentPt1); // Create check point IMigrationRoadmapCheckPoint cp1 = IModelElementFactory.instance().createMigrationRoadmapCheckPoint(); cp1.setName("Review"); // Specify the color of the check point cp1.setColor(Color.ORANGE.getRGB()); cp1.setTime(190); migrationRoadMap.addCheckPoint(cp1);
Open the Diagram
Finally we can show up the diagram.
// Show up the diagram dm.openDiagram(migrationRoadMapDiagram);
Sample Plugin
The sample plugin demonstrate how to create migration roadmap diagram using Open API. After you deploy the plugin into Visual Paradigm you can then click the plugin button in the application toolbar to trigger it.
Download Sample Plugin
You can click this link to download the sample plugin.
Related Know-how |
Related Link |
Leave a Reply
Want to join the discussion?Feel free to contribute!