I statically defined a UML profile to annotate UML elements with features. Now I am trying to define some live checks on the stereotypes tags but I am not able to get a working solution.
As I have to use some external resources (e.g. a feature model specifying which features are available) I have to use constraints defined in Java and cannot use e.g. OCL constraints.
Unfortunately, I am not able to get a working solution.
By now I tried as well the specification of constrains with Java directly inside of Papyrus as well as the DSML profile of Papyrus. But due to the lack of good tutorial I haven't been able to get a working solution.
My Java-constraint looks like this:
However in the generated model code I can only fin the code I entered there in the comments above the method Constraint_Conditional_Element(DiagnosticChain diagnostics, Map<Object, Object> context):boolean in the interface Conditional_Element. The implementation of this method seems to be never called.
My DSML trial looks like this:
Unfortunately, I haven't found any explanation to what values I should set the tags of this stereotype. In the according plugin.xml is the following reference carisma.profile.umlsec.variability.UMLsec_VariabilityProfile.Conditional_Element.Constraint1 but I don't know what I have to do with this reference. The ID occurs nowhere else in my workspace.
the DSML profile attributes are used to customize the error message and the severity of this error. So, this should not be the root of the problem. However, I see that the "constrained element" reference of your constraint is empty. It should point to the stereotype. Can you please retry the validation plugin generation after setting the reference and post your results?