Skip navigation links

Package com.sodius.mdw.metamodel.doors.io.commands

Commands to update portions of a DOORS database.

See: Description

Package com.sodius.mdw.metamodel.doors.io.commands Description

Commands to update portions of a DOORS database.

Overview

A command is a small and direct interaction between the Java program and the DOORS client. When executed, the modification made by the command occurs on the DOORS database itself, not on the DOORS EMF model loaded in memory.

Available Commands

Here are the available commands:

Element Commands
Folders and Projects create, delete and purge
Modules create, edit, save, close, delete and purge
Objects create, move and delete
Tables create, move, resize table, change column widths and delete
Pictures insert, replace and delete
Types create, update and delete
Attributes create a definition, update a definition, delete a definition, read value and update value
Discussions create, add comments, close, reopen and delete
Links create and delete
External Links create, update and delete
Baselines create a baseline
Archives archive and restore a module, archive and restore a project

Running Commands

A CommandRunner is in charge to execute and monitor commands execution. A CommandRunner interacts with one DOORS client and can be used to run multiple commands, each command being executed sequentially.

Running Commands with a DOORS batch client

Below is a sample code showing how to run a command in DOORS using a batch client:

    MDWorkbench workbench = null;
    DoorsApplication application = null;
    try {
        // create DOORS batch client
        PropertySet properties = new DefaultPropertySet();
        properties.setProperty(Common.PREFERENCE_DOORS_IS_SILENT, true);
        properties.setProperty(Common.PREFERENCE_DOORS_PATH, "C:\\Program Files (x86)\\IBM\\Rational\\DOORS\\9.5\\bin\\doors.exe");
        properties.setProperty(Common.PREFERENCE_DOORS_PORTSERVER, "36677@mserver");
        properties.setProperty(Common.PREFERENCE_DOORS_USER, "myuser");
        properties.setProperty(Common.PREFERENCE_DOORS_PASSWORD, "mypassword");
        application = DoorsUtils.createApplication(properties);
        
        // Instantiate a command to be executed in DOORS
        Command command = new CreateFolderCommand(FolderRef.qualifiedName("/MyFolder"));
        
        // run the command
        workbench = MDWorkbenchFactory.create();
        CommandRunner runner = new CommandRunner(workbench, application);
        runner.run(command);
    }
    finally {
        if (application != null) {
            application.dispose();
        }
        if (workbench != null) {
            workbench.shutdown();
        }
    }

Editing a Module with Command Fragments

All commands are used to perform atomic operations in the DOORS database: creating a folder, deleting a module, archiving a project, etc. Editing a module is on the other hand an operation that is sightly more complex. For performance an workflow reasons, one cannot imagine to use the edit/modify/save/close cycle on a module for just each modification to be performed, like changing the attribute value of an object. Therefore the command to edit a module is decomposed into multiple fragments. This design offer to capability to perform multiple modifications during the one edit/modify/save cycle.

Below is a sample showing the composition of fragments into a command to edit a module

    ModuleRef module = ModuleRef.qualifiedName("/MyFolder/MyModule");
    EditModuleCommand command = new EditModuleCommand(module, TerminationMode.SAVE_AND_CLOSE);
    command.add(new CreateObjectFragment());
    command.add(new CreateTableFragment(2, 2));
    command.add(new SetAttributeValueFragment(ObjectRef.absoluteNumber(1), "My Attribute", "My Value"));
    command.add(new CloseDiscussionFragment(DiscussionRef.summary("My Discussion"), "Closing Comment"));
    runner.run(command);
Skip navigation links