Constraint

Constraints are rules which apply to the relations between items on the BA diagram. If a constraint is not respected on an item, the corresponding error is displayed in the document errors view. During code generation, broken constraints generate errors and stop the generate process with an error status.

Constraints are used in the BA diagram to regulate what relations are valid between entities. For example, with the dbapp template set, if you create a Program and a Form entity on the BA diagram, a valid relation can be set between the Program and Form.
A BA diagram entity with valid relation between a Program and Form.

Figure 1. Valid relation between Program and CRUD Form

However, if you try to set a relation from a Form entity to a Program, you will see the constraint icon "" indicating that this relation is not valid.

Each Constraint element manages a constraint on a specific type of relation: Relation, ReportRelation, or WebServiceRelation.

Table 1. Constraint element attributes
Attribute Value Description
name Any string Name of the constraint. Use to display the name in case of error.
reference Semi-colon separated list such as Relation;ReportRelation;WebServiceRelation Possible relation types, or * for any.
description Any string Textual description of the error.
source Semi-colon separated list of source items from which the relation begins, such as ReportData;WebService;Program;Form. Possible source item types, or * for any.
destination Semi-colon separated list of destination items to which the relation ends, such as Form;Zoom;FormWebService;ZoomWebService. Possible destination item types, or * for any.
minSource

int >= 0

or ‘*’ for unbounded

The minimum number of relation sources required for this relation type. Minimum source relation cardinality.
maxSource

int >= 0 or

‘*’ for unbounded

The maximum number of relation sources allowed for this relation type. Maximum source relation cardinality.
minDestination

int >= 0

or ‘*’ for unbounded

Minimum destination relation cardinality.
maxDestination

int >= 0

or ‘*’ for unbounded

The maximum number of relation destinations allowed for this relation type. Maximum destination relation cardinality. If set to 0, this means a relation that meets source and destination constraints cannot be used.

Example

<Constraint 
  name="Constraint_010" 
  reference="WebServiceRelation" 
  description="Define at least one outgoing relationship from WebServiceServer" 
  source="WebServiceServer" destination="WebService;FormWebService;ZoomWebService" 
  minSource="1"/>

In this example, Constraint_10 specifies that a WebServiceServer source entity must have at least one WebServiceRelation to a destination of WebService, FormWebservice or ZoomWebService.