Presentation is loading. Please wait.

Presentation is loading. Please wait.

MagicDraw - OCL Validation

Similar presentations


Presentation on theme: "MagicDraw - OCL Validation"— Presentation transcript:

1 MagicDraw - OCL Validation
Jan Pettersen Nytun

2 Task - participant Person * Meeting * - takePartIn - name : String
- meetingName : String 1 - leader + addParticipant(p : Person) : void + getLeader() : Person - meetingToLead * a) Write an OCL constraint that states that: The number of participants (see role participant in figure) to a meeting must be at least 2. b) Write an OCL constraint that states that: The person given as leader of a meeting cannot also be participant to that same meeting.

3 In MagicDraw

4 Make Package For the Constraints & Stereotype it to ValidationSuite

5 If Chosen Stereotype Do Not Show:

6 Make Constraint In the ValidationSuite
Select this and than language, etc.

7 Select Constrained Element

8 The Constraint Must be Stereotyped to ValidationRule

9 Set Error Message

10 Select in Menu: Analyze/Validation/Validate
Select validation suite and validation selection

11

12 - participant Person * Meeting * - takePartIn - name : String - meetingName : String 1 - leader + addParticipant(p : Person) : void + getLeader() : Person - meetingToLead * a) Write an OCL constraint that states that: The number of participants (see role participant in figure) to a meeting must be at least 2. context Meeting inv: participant->size() > = 2 b) Write an OCL constraint that states that: The person given as leader of a meeting cannot also be participant to that same meeting. context Meeting inv: participant->excludes(leader)

13 Generating Java Code Then Edit the Set Then Generate Code

14 Edit Code:


Download ppt "MagicDraw - OCL Validation"

Similar presentations


Ads by Google