Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Papyrus/UserGuide/Profile Constraints"

(How to)
Line 27: Line 27:
  
 
<center>
 
<center>
[[Image:DSML-profileApplication.png]]<br>
+
[[Image:PapyrusDSML-profileApplication.png]]<br>
 
Open the specification via the property view
 
Open the specification via the property view
 
</center>
 
</center>
Line 40: Line 40:
  
 
<center>
 
<center>
[[Image:DSML-stereotypeApplication.png]]<br>
+
[[Image:PapyrusDSML-stereotypeApplication.png]]<br>
 
Open the specification via the property view
 
Open the specification via the property view
 
</center>
 
</center>
Line 46: Line 46:
 
*9. Edit stereotype attributes
 
*9. Edit stereotype attributes
  
[[Image:Papyrus AnnotationEdition.png]]<br/>
+
[[Image:PapyrusDSML-AnnotationEdition.png]]<br/>
 
Edit DSML stereotype attributes<br/>
 
Edit DSML stereotype attributes<br/>
  
Line 53: Line 53:
 
= Generation from Constraints =
 
= Generation from Constraints =
  
[[image:Papyrus UseCaseGeneration.png]]<br/>
+
[[image:PapyrusDSML-UseCaseGeneration.png]]<br/>
  
 
Constraints expressed in OCL can be validated directly in the tool. This is not the case for Java constraints which must be placed in a suitable plugin. However, Papyrus supports the generation of this plugin.
 
Constraints expressed in OCL can be validated directly in the tool. This is not the case for Java constraints which must be placed in a suitable plugin. However, Papyrus supports the generation of this plugin.
Line 65: Line 65:
 
Click on yes and then do not forget to check save OCL constraint in the definition (recently, the box is checked by default)<br/>
 
Click on yes and then do not forget to check save OCL constraint in the definition (recently, the box is checked by default)<br/>
 
<center>
 
<center>
[[image:Papyrus ConstraintDefinition.png]]<br>
+
[[image:PapyrusDSML-ConstraintDefinition.png]]<br>
 
Save OCL constraints in the definition
 
Save OCL constraints in the definition
 
</center>
 
</center>
Line 75: Line 75:
 
Select the root profile<br/>
 
Select the root profile<br/>
 
Click right on the model explorer-> create validation plugin for this DSML<br/>
 
Click right on the model explorer-> create validation plugin for this DSML<br/>
  [[image:Papyrus PluginValidationGeneration.png]]<br/>
+
  [[image:PapyrusDSML-PluginValidationGeneration.png]]<br/>
  
 
   
 
   
 
Then a wizard to create the validation is launched. You have to give a name for you validation plugin.<br/>
 
Then a wizard to create the validation is launched. You have to give a name for you validation plugin.<br/>
   [[image:Papyrus pluginwizard.png]]<br/>
+
   [[image:PapyrusDSML-PluginWizard.png]]<br/>
 
Figure 15: wizard of constraint validation creation<br/>
 
Figure 15: wizard of constraint validation creation<br/>
 
The you need to install the created plugin.<br/>
 
The you need to install the created plugin.<br/>

Revision as of 18:04, 16 May 2014

Validate OCL Constraints of a Profile

Papyrus supports an additional profile for defining Domain Specific Modeling Languages (DSML) that refines how constraints are validated. The additional profile enables a more precise specification of validation properties, for example:

  • Mode: Defines if the validation of the constraint is done in “batch” or “live” mode
  • Severity: Defines the severity of the constraint violation. It can be one of INFORMATION, WARNING or ERROR. The latter is the default severity (if none is specified). The CANCEL severity should be used with caution, as it causes the validation operation to be interrupted, possibly resulting in the loss of valuable diagnostic information from other constraints.
  • Message: Defines the message that will be displayed if the constraint is violated
  • Description: Provides a description of the constraint •Enabled by default: Defined if this constraint should be enabled by default or not

CAVEAT: The information added via the profile using the DSML profile is not currently taken into account during OCL validation. The support will be added soon.

Advanced users can also define:

  • Id: The constraint id
  • Status code: The plug-in unique status code, useful for logging.
  • The target of validation, the element to be validated

How to apply the DSML validation profile:

  • 1. Select the profile root
  • 2. Select the profile tab in the property view
  • 3. Click on the registered profile button
  • 4. Select the "DSML Validation" profile

PapyrusDSML-profileApplication.png
Open the specification via the property view

  • 5. Select the constraint
  • 6. Select the profile tab of the property view
  • 7. Click on the apply profile button
  • 8. Select the ValidationRule stereotype

PapyrusDSML-stereotypeApplication.png
Open the specification via the property view

  • 9. Edit stereotype attributes

PapyrusDSML-AnnotationEdition.png
Edit DSML stereotype attributes

You can then edit the stereotype attribute to define information about the behavior of the validation.

Generation from Constraints

PapyrusDSML-UseCaseGeneration.png

Constraints expressed in OCL can be validated directly in the tool. This is not the case for Java constraints which must be placed in a suitable plugin. However, Papyrus supports the generation of this plugin.

Generate constraints directly into the definition

Constraints written in OCL within the profile can be generated into the definition of the profile and read during the validation of the model.

How to

When you save the profile,Papyrus asks to you if want to define the profile.
Click on yes and then do not forget to check save OCL constraint in the definition (recently, the box is checked by default)

PapyrusDSML-ConstraintDefinition.png
Save OCL constraints in the definition

Generate constraints as EMF validation plugins

The user can generate plugins that wrap constraint and can be used in the EMF plugin validation.
The constraint can be generated in Java code, or directly from OCL.

How to

Select the root profile
Click right on the model explorer-> create validation plugin for this DSML

PapyrusDSML-PluginValidationGeneration.png


Then a wizard to create the validation is launched. You have to give a name for you validation plugin.

 PapyrusDSML-PluginWizard.png

Figure 15: wizard of constraint validation creation
The you need to install the created plugin.

Back to the top