DOORS DXL Trigger

DOORS DXL Trigger

What is DOORS DXL Trigger?

Triggers in DXL are a mechanism that links an event, such as modifying an attribute or opening a project, with a DXL program. This provides a robust customization feature that can be utilized for various tasks, including process enforcement.

The creation, management, and deletion of triggers are handled within DXL. Triggers are classified by level, type, and event.

DXL Trigger Levels

There are five trigger levels:

  • module
  • object
  • attribute
  • discussion
  • comment

DXL Trigger Event Types

There are two trigger events:

Pre-event Trigger

A pre-event trigger is a mechanism that allows for an action or checks to be executed prior to an event occurring. The code run by the trigger can return a veto, which will prevent the following event from taking place. If multiple triggers have been established for the same event, they will be executed based on the trigger’s priority level. In order for a pre-event to be successful, all pre-events must be successful.

Post-event Trigger

A post-event trigger is executed after the associated event happens, for example after a module is opened.

DXL Trigger Scope

Triggers can be either specific to a module, object, or attribute, or database-wide. Additionally, they can be either generic or tailored to a specific purpose.

By default, generic module triggers are saved in the designated project or the current project, unless the trigger is designated as database-wide using the “project->all” syntax. In such cases, the triggers are stored in the root folder of the database.

Generic scope

In this case, the trigger applies to all entities including all modules, objects, attribute etc.

Specific scope

In this case, the trigger applies to specific entity – a module, object, attribute etc.

Trigger Events

There are seven types of trigger events –

  1. open, read
  2. close
  3. write, save, or modify
  4. sync
  5. drag
  6. drop
  7. create

Trigger Priority

A trigger can have priority – higher-priority tasks are executed before low-priority tasks.

Persistent Trigger Vs Dynamic Trigger

A trigger could also be classified under these two types –

Persistent Trigger

A persistent trigger is stored in the Rational DOORS database. This types of triggers are persistent between different DOORS sessions until it is deleted.

Dynamic Trigger

Dynamic trigger is not stored in the database.

Trigger Constants

There are various trigger constants –

Trigger Level

Level can be one of the following – project, module, object, attribute, discussion, comment

Level Modifiers

level modifier can be any of the following – all, formal, link, descriptive

Event Types

Event types could be pre or post

Event Names

Event names could be any of the following – open, read, close, save, modify, sync, create

Trigger(Persistent) Example

Here is the function for creating a persistent trigger –

Trigger trigger(string name, l, t, e, int p, string dxl)

Where,
l is a level: project, module, object, or attribute
t is a type: pre or post
e is an event: open, read, close, save, modify or sync
p is a priority: indicates the order that similar triggers are executed
dxl the dxl code that will be executed by the trigger

The function “trigger()” generates a trigger named “name” at level “l,” of type “t,” and event “e,” with a priority of “p,” and the associated DXL code. If the operation fails, the function returns null. Additionally, if the user lacks the required modify access, the call will not succeed.

Trigger(Dynamic) Example

Here is the syntax for creating dynamic triggers –

Trigger trigger(l, e, int p, {bool pre(Trigger)| void post(Trigger)})

Where-
l is a level: project, module, object, or attribute
e is an event: open, read, close, save, modify or sync
p is a priority: indicates the order that similar triggers are executed

The function “trigger()” generates a non-persistent dynamic trigger at level “l,” of event “e,” and priority “p.” The pre-callback function establishes whether the operation will occur or not. In the case of a post-event, the callback function is a void function.

Conclusion

In this article, we have briefly discussed DOORS DXL Trigger.

DOORS DXL Trigger
Scroll to top
error: Content is protected !!