Running user-defined macros after check-in operations

 

Introduction

The Objecteering teamwork MDACs can execute user-written macros after a check-in operation has been successfully completed.  The aim of this feature is to generate a user report, update a logfile and/or generate and then send an email to other developers.

 

Three different types of macro can be run:

·         macros written by each user

·         a default macro, provided for all developers who do not have a personal macro

·         an additional macro, which will be executed for all users after their own macro or the default macro has been run

 

 

Locating user-defined macros

All macros must be stored in the repository's "conf" subdirectory.

 

 

Naming user-defined macros

User-defined macros must be named according to the following rules:

·         for a user's own macros, "AfterCheckin_UserName.jmf"

·         for the default macro, "AfterCheckin_DEFAULT.jmf"

·         for mandatory macros to be used by all users, "AfterCheckin_ALL.jmf"

 

For your own macros, "UserName" should be replaced by your login name for the teamwork MDAC being used.

 

Note:      Please note that macro file names are case-sensitive, and their case must be respected.

 

 

Running order

After the teamwork MDAC has successfully checked in all the necessary files, validated the transaction and saved the database, user macros are run in the following order:

·         The "AfterCheckin_UserName.jmf" macro is searched for in the repository's "conf" subdirectory and then run if found.

·         If the "AfterCheckin_UserName.jmf" macro is not found, then the "AfterCheckin_DEFAULT.jmf" macro is searched for in the repository's "conf" subdirectory and run if found.

·         In all cases, the teamwork MDAC then searches for the "AfterCheckin_ALL.jmf" macro and runs it if it is found.

 

The teamwork MDAC does not run any macros if any part of the check-in operation has failed.

 

 

Accessing checked-in elements

The J attributes presented in the following table can be used in the macro file to access created, existing and deleted multi-user atomic units through the check-in operation.

 

 

J attribute

Description

ModelElement[] Object::Report_CreatedElements

Multi-user atomic units added in the repository.

ModelElement[] Object::Report_ModifiedElements

Checked-in multi-user atomic units that already exist in the repository.

String[] Object::Report_DeletedElementCompleteNames

Complete names of deleted multi-user atomic units.

String[] Object::Report_DeletedFileNames

Complete file names for deleted multi-user atomic units.

String USER_NAME

Your teamwork MDAC name.

String MULTI_USER_DIRECTORY

Repository root directory.

 

 

Example

The following example macro shows a dialog box providing a summary of those elements that have been checked-in.

 

/*

* AfterCheckin_DEFAULT.jmf

 *

 * Version: 1.0

 * Date:    06 January 2005

 * Author:  Softeam

 *

 * Valid for: Being run by the teamwork MDAC after a

              successful check-in.

 *

 * Description:

 * This macro shows a message box displaying checked-in

   elements.

 *

 */

 

String content;

JBox  box;

 

content.strcat("Added elements", NL);

Report_CreatedElements {

  content.strcat ("- ",getFullName(), NL);

}

 

content.strcat ("Existing checked-in elements", NL);

Report_ModifiedElements {

  content.strcat ("- ",getFullName(), NL);

}

 

content.strcat ("Elements removed from the repository", NL);

Report_DeletedElementCompleteNames {

  content.strcat ("- ", this, NL);

}

 

box = createJBox ("CheckinReport",    // Name

                  "Check-in report",  // Title

                  JLayoutVertical,    // Layout

                  true);              // Consult mode

 

box.addLabel (content);

 

box.show();

 

box.delete();