IBM Support

Absorbing fragments programmatically in Rational Software Modeler

Question & Answer


Question

This technote explains how to programmatically absorb fragments in IBM® Rational® Software Modeler (RSM) and IBM Rational Systems Developer (RSD).

Answer

DISCLAIMER

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

The 7.0.5 release of RSM introduced the following new static methods to the

UMLModeler class:


    - absorbFragment(Resource resource)

    - absorbFragmentSilently(Resource resource, boolean refactorReferences)


The first method will prompt the user with a dialog asking to update references and the second one will perform the operation silently. (No action from the user is required).

There are several things you need to know when using one of these methods:


    1. It cannot be undone.

    2. There can be unpredictable results when using it on a model that does not validate correctly (This is especially so, when having unresolved proxy problems. For more information on unresolved proxy errors, refer to the Related information section below. ). Make sure your model validates correctly before trying to absorb fragments.

    3. The fragment file will be automatically deleted once the absorb operation has completed.

    4. The absorbFragmentSilently method should always be used with the refactorReferences parameter set to true.

    5. The fragment absorbing operation can be slow on large models. All fragments of the model will be opened in order to look for the references that need to be updated.


IBM Rational Client Support developed a pluglet illustrating how to use these methods. This pluglet, based on the Model Enumeration template, will silently absorb all the fragments under the selected element.

Before using this pluglet, MAKE A BACKUP COPY OF THE MODELS AND ALL THEIR FRAGMENTS, BECAUSE THE CHANGES MADE BY THE PLUGLET CANNOT BE UNDONE.

To use this pluglet, follow these instructions:


    1. Import the attached zip file in your current workspace using:

    File->Import->Existing Project Into Workspace

    and choose the option: Select Archive File: AbsorbAllFragments.zip
    2. Create the pluglet configuration by right clicking on the file AbsorbAllFragments.java, selecting Run As... and choosing Pluglet.
    3. Now that the configuration is created, you can select a UML element in the Project Explorer and launch AbsorbAllFragments from the menu Run > Internal tools.
    4. The output of the pluglet will be written in the Console view. If the pluglets absorbs fragments, you will get the following output in the console:

    Fragment platform:/resource/MyProject/MyFragment.efx absorbed


    AbsorbAllFragments.zip

[{"Product":{"code":"SSCLKU","label":"Rational Software Modeler"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Modeling","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.0.5;7.0.5.1;7.0.5.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSJP3D","label":"Rational Systems Developer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Modeling","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.0.5;7.0.5.1;7.0.5.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21313499