Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

UML Import Model Mapper

< To: Tigerstripe Extension Points

  • Full name : org.eclipse.tigerstripe.workbench.ui.UML2Import.umlImportModelMapper

Purpose : During a UML2 import, the Model that is being imported can be "mapped" to Tigerstripe artifacts based on user defined rules. There may be stereotypes in the model that indicate that a Class should be imported as a Datatype rather than an Entity for example. This is most useful for UML Classes which can potentially be mapped to many types of Tigerstripe Artifact.

The String returned should be the class name of a Tigerstripe Artifact.

  • Example :

This example does a very basic mapping, and is a good starting point for any Mapper.


 public Map<EObject, String> getMapping(Model model) {
   Map<EObject, String> classMap = new HashMap<EObject, String>();
   TreeIterator t = model.eAllContents();
   t = model.eAllContents();
   while (t.hasNext()) {
       EObject eObject = (EObject) t.next();
       if (eObject instanceof AssociationClass) {
           classMap.put( eObject, IAssociationClassArtifact.class.getName());
       } else if (eObject instanceof Association) {
           classMap.put( eObject, IAssociationArtifact.class.getName());
       } else if (eObject instanceof Enumeration) {
           classMap.put( eObject, IEnumArtifact.class.getName());
       } else if (eObject instanceof Interface) {
           classMap.put( eObject,  ISessionArtifact.class.getName());
       } else if (eObject instanceof Class) {
           // We cannot determine "Class" types - could be Entity, Datatype, Exception etc
           classMap.put( eObject, "");
       }
       if (eObject instanceof Classifier) {
       Classifier element = (Classifier) eObject;
           for (Object depO : element.getClientDependencies()) {
               if (depO instanceof Dependency && !(depO instanceof InterfaceRealization)) {
                   Dependency dep = (Dependency) depO;
                   classMap.put( dep, IDependencyArtifact.class.getName());
               }
            }
       }
   }
   return classMap;
 }

Back to the top