« Back to University of Duisburg-Essen

Cardinalitities Implemented, not functioning in Modelling Toolkit?

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Cardinalitities Implemented, not functioning in Modelling Toolkit?
community class cardinality documentation
Answer
3/27/14 11:44 AM
The class cardinalities have been properly defined in the development toolkit, nevertheless the functionality is not available in the modelling toolkit.

RE: Cardinalitities Implemented, not functioning in Modelling Toolkit?
Answer
6/19/13 8:31 AM as a reply to Anonymous.
Different options are possible to check the class cardinalities within the modelling toolkit:

a) Manual Check (default behaviour):
The cardinalities check is triggered by user interaction. To check the cardinalities, the user has to manually select the check and run the validation. The functionality is triggered from the Modelling components menu "Model" -> "Check cardinalities" (available for the currently open model in focus)

b) Automatic Check:
To enable the check of models automatically, the library attribute "Default Settings" (Dynamic library) needs to be updated. It is possible to specify when the check should be triggered.

1CHECK_CARDINALITIES
2before-save: boolVal after-modeling-action: boolVal
3boolVal :  0 | 1 .



c) Script based Check: To automatically trigger the cardinality check you need to add an event handler for the event that should trigger the cardinality check. This event handler should contain the command call "CHECK_CARDINALITIES" for the message port "Modeling"
1CC "Modeling" CHECK_CARDINALITIES [ modelid: intVal ] [ silent ] [ nosuccessmessage ]    
2#--> RESULT ecode: intValue . )


This trigger can be added to event handlers depending on what level of detail the check should happen:

 1ON_EVENT AfterCreateModelingNode
 2{
 3 CC "Core" GET_ACT_MODEL
 4  # --> RESULT modelid: intValue
 5 SET id_modelID: (modelid)
 6 CC "Modeling" CHECK_CARDINALITIES modelid: (id_modelID) silent nosuccessmessage     #--> RESULT ecode: intValue
 7
 8 IF (ecode > 0)
 9 {
10   ## do something !!!
11
12 }
13}

The same code fragment can be used for the handlers of the following events:
-> "AfterCreateModelingConnector"#
-> "DeleteRelationInstance"
-> "BeforeDeleteInstance"
-> "BeforeSaveModel"
-> or any other script based interaction.

It is also possible to integrate the check into scripts that are manually triggered.