Map<String, Object> options = new HashMap<String, Object>(); try { // Create an MDWorkbench Model com.sodius.mdw.core.model.Model model = mdw.getMetamodelManager().getMetamodel(UMLPackage.eINSTANCE).createModel(); // Create a Package in the Model com.sodius.mdw.metamodel.uml21.Package dataModel = newModel.create(UMLPackage.Literals.MODEL); dataModel.setName("Data"); // Resource used to homogenise the model (unique id...) com.sodius.mdw.metamodel.uml21.io.md.utils.MagicDraw2UMLResourceManager md2umlResourceManager = new MagicDraw2UMLResourceManager(); md2umlResourceManager.create((com.sodius.mdw.metamodel.uml21.Model) dataModel); // Import Profile in Model (create Package Import) options.put(MagicDrawOptions.OPTION_MAGIC_DRAW_VERSION, MagicDrawVersion.LATEST.getVersionName()); new MagicDrawProfileResourceReader(model, options).read(path_to_profile); ... // Delete temporary Model md2umlResourceManager.delete(); } catch (CoreException e) { ... }Where
path_to_profile
represents the path to the profile to load.path_to_profile
should look like pathmap://MAGIC_DRAW/ER_profile.mdzip.uml
.path_to_profile
should look like file:///" + new File("c:\\myProfile.mdzip").getPath()
.
Map<String, Object> options = new HashMap<String, Object>(); try { // Create an MDWorkbench Model com.sodius.mdw.core.model.Model model = mdw.getMetamodelManager().getMetamodel(UMLPackage.eINSTANCE).createModel(); // Create a Package in the Model com.sodius.mdw.metamodel.uml21.Package dataModel = newModel.create(UMLPackage.Literals.MODEL); dataModel.setName("Data"); // Resource used to homogenise the model (unique id...) com.sodius.mdw.metamodel.uml21.io.md.utils.MagicDraw2UMLResourceManager md2umlResourceManager = new MagicDraw2UMLResourceManager(); md2umlResourceManager.create((com.sodius.mdw.metamodel.uml21.Model) dataModel); // Import Profile in Model (create Package Import) options.put(MagicDrawOptions.OPTION_MAGIC_DRAW_VERSION, MagicDrawVersion.LATEST.getVersionName()); new MagicDrawProfileResourceReader(model, options).readSysML(); ... // Delete temporary Model md2umlResourceManager.delete(); } catch (CoreException e) { ... }
Map<String, Object> options = new HashMap<String, Object>(); try { // Create an MDWorkbench Model com.sodius.mdw.core.model.Model model = mdw.getMetamodelManager().getMetamodel(UMLPackage.eINSTANCE).createModel(); // Create a Package in the Model com.sodius.mdw.metamodel.uml21.Package dataModel = newModel.create(UMLPackage.Literals.MODEL); dataModel.setName("Data"); // Resource used to homogenise the model (unique id...) com.sodius.mdw.metamodel.uml21.io.md.utils.MagicDraw2UMLResourceManager md2umlResourceManager = new MagicDraw2UMLResourceManager(); md2umlResourceManager.create((com.sodius.mdw.metamodel.uml21.Model) dataModel); // Import Profile in Model (create Package Import) options.put(MagicDrawOptions.OPTION_MAGIC_DRAW_VERSION, MagicDrawVersion.LATEST.getVersionName()); new MagicDrawProfileResourceReader(model, options).readUPDM(); ... // Delete temporary Model md2umlResourceManager.delete(); } catch (CoreException e) { ... }
Map<String, Object> options = new HashMap<String, Object>(); try { // Create an MDWorkbench Model com.sodius.mdw.core.model.Model model = mdw.getMetamodelManager().getMetamodel(UMLPackage.eINSTANCE).createModel(); // Create a Package in the Model com.sodius.mdw.metamodel.uml21.Package dataModel = newModel.create(UMLPackage.Literals.MODEL); dataModel.setName("Data"); // Resource used to homogenise the model (unique id...) com.sodius.mdw.metamodel.uml21.io.md.utils.MagicDraw2UMLResourceManager md2umlResourceManager = new MagicDraw2UMLResourceManager(); md2umlResourceManager.create((com.sodius.mdw.metamodel.uml21.Model) dataModel); // Import Profile in Model (create Package Import) options.put(MagicDrawOptions.OPTION_MAGIC_DRAW_VERSION, MagicDrawVersion.LATEST.getVersionName()); new MagicDrawProfileResourceReader(model, options).readBPMN(); ... // Delete temporary Model md2umlResourceManager.delete(); } catch (CoreException e) { ... }
Map<String, Object> options = new HashMap<String, Object>(); try { // Create MDWorkbench Model com.sodius.mdw.core.model.Model model = mdw.getMetamodelManager().getMetamodel(UMLPackage.eINSTANCE).createModel(); // Create a Package in the Model com.sodius.mdw.metamodel.uml21.Package dataModel = newModel.create(UMLPackage.Literals.MODEL); dataModel.setName("Data"); // Resource used to homogenise the model (unique id...) com.sodius.mdw.metamodel.uml21.io.md.utils.MagicDraw2UMLResourceManager md2umlResourceManager = new MagicDraw2UMLResourceManager(); md2umlResourceManager.create((com.sodius.mdw.metamodel.uml21.Model) dataModel); // Import Profile in Model (create Package Import) options.put(MagicDrawOptions.OPTION_MAGIC_DRAW_VERSION, MagicDrawVersion.LATEST.getVersionName()); new MagicDrawProfileResourceReader(model, options).readEcore(); ... // Delete temporary Model md2umlResourceManager.delete(); } catch (CoreException e) { ... }
MDAccess for UML API Reference
MDAccess for MagicDraw API Reference
MagicDraw Profile Resource Reader