IBM Support

Using the API to cleanup redundant unit files in IBM Rhapsody

Question & Answer


Question

Using the API to cleanup redundant unit files in IBM Rhapsody?

Cause

Model elements that create unit files - Unit Elements - are not removed from the filesystem when they are deleted from the model. This can leave a number of redundant files in the project directory that need cleaning up.

Answer

Unlike "Clean Redundant Source Files" in the Code menu, there is no built-in mechanism to remove file units from the project directory.

However, using the API it is possible to customize Rhapsody to clean up these files.

Some considerations for the cleanup algorithm:

1) A list of model units should be compared with the list of file units located in the project directory.

2) Some element types such as Controlled Files should not be deleted.

3) Some project files such as Gateway project files should not be deleted.

These ignored files can be modified in the source code.

An example of the output is shown below.




Source code is attached at the bottom of the page.

 
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.



CleanProject.javaCleanProject.java

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.5;8.0.6;8.1;8.1.1;8.1.2;8.1.2.1;8.1.3;8.1.4;8.1.5;8.2;8.2.1;8.3","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg22012612