User manual

To illustrate the ModelFilter plugin and its features, we will use a sample inspired from the Pet Store Application.

Get and install use case

The models are available from the MoDisco SVN in subdirectory "examples/trunk/org.eclipse.gmt.modisco.usecase.modelfilter.sample" or from a downloadable archive. If you use a SVN client in Eclipse (Subversive or Subclipse), the project will be immediately available in your Eclipse workspace.

Sources of the Pet Store application are available here: http://www.oracle.com/technetwork/java/petstore1-3-1-02-139690.html

You may have to download several libraries to obtain an eclipse project without errors (JPA, JTA, JSF-apis and Servlets-jsp-apis). A complete bundle is also available from Mia-Software... To view this application in your Eclipse workspace, you will have to extract the content of this archive, and use the "import" wizard (import project in workspace).

Dependencies graph

To get the dependencies graph of a particular class, you have to right-click on the class in the Package Explorer, and select Discovery > Actions > Display Dependencies

Contextual menu entry for Display Dependencies

Then, a graph displaying the dependencies will open:

Dependencies graph

Method calls

Right-click on a project and select Discovery > Actions > Display Method Calls. A graph displaying all the method calls will open:

All method calls

You will have a better look if we focus on a particular method. For example, the method public List<SelectItem> getCategories() in class MapBean located in package com.sun.javaee.blueprints.petstore.mapviewer.

public List<SelectItem> getCategories() {
    // return categories for a JSF radio button
    ArrayList<SelectItem> arCats=new ArrayList<SelectItem>();
    
    // get the CatalogFacade for the app
    FacesContext context=FacesContext.getCurrentInstance();
    Map<String,Object> contextMap=context.getExternalContext().getApplicationMap();
    CatalogFacade cf=(CatalogFacade)contextMap.get("CatalogFacade");
    
    // get the categories from the database
    List<Category> catsx=cf.getCategories();
    for(Category catx : catsx) {
        // add categories to be displayed in a radio button
        arCats.add(new SelectItem(catx.getCategoryID(), catx.getName()));
    }
    return arCats;
}

Right-click on the method in the Package Explorer, and select Discovery > Actions > Display Method Calls:

Displaying method calls from a single method

A graph displaying method calls from method "getCategories"

Real type of properties

To get the UML model with real type of properties, right-click on the java project you would like to inspect, and select Discovery > Discoverers > Create UML model with real types information on associations:

Context menu item

Then, you will have a complete UML model with the real types of Associations:

UML model with real types of Associations

You will have a better look if we focus on a particular association. For example, the properties

private Collection<Item> items

in class Tag and

private Collection<Tag> tags

in class Item both located in package com.sun.javaee.blueprints.petstore.model.

A diagram built with Papyrus to show real types.