MagicDraw 18.3 Documentation

Skip to end of metadata
Go to start of metadata

In UML, package import is defined as a directed relationship between an importing namespace and a package, the members of which are imported into that namespace. The visibility of a package import is either public or private. The predefined keywords are «import» for a public package import, and «access» for a private package import.

A package import is displayed as a dashed arrow with an open arrowhead aiming from the importing namespace towards the imported package.

Package import applies to an entire package, and all the model elements of the target package are imported into the source namespace. The source package can access subpackages of the target package to an infinite depth. Also, the elements of imported package are accessible to the subpackages of the importing package as well.

Restricting type selection list to imported elements

 

To restrict the type selection list to imported elements


  1. Create a package diagram.
  2. Drag the package with typed elements, as well as packages with types, on the diagram pane.

  3. Create a package import between them by clicking Package Import in the diagram palette.

 

To apply the filter


  1. Click a typed element to open the Select Type dialog.

  2. Apply the Filter By Package Import filter.


As a result, the type selection list is restricted to imported elements only.

There are more useful filters you can use for the same purpose.

Different abstraction levels

 

You can also use a Model instead of a package – in that case, the elements cannot be accessed from outside, and you can only select the types from packages that are owned within the Model element.

 

To show elements from the desired abstraction level only


  1. Right-click the package you want to restrict your type selection to, and select Refactor > Convert To > Model.
  2. Select a typed element nested in that model and specify its type.
  3. Apply Filter By Package Imports to list only the elements that belong to the same abstraction level.

Validation

Use active validation to figure out which element types are out of the scope specified by package imports.

  1. Go to Analyze > Validation > Validate.
  2. In the Validation dialog, select UML correctness constraints from the Validation Suite drop-down list.
  3. Click Validate.
  4. In the Validation Results panel, right-click the element you want to change or unset type for, and select Change Type, Unset Type, or Create Package Import Relationship accordingly.

 

On this page
  • No labels