Is it possible to use Groovy to populate an error message in a validation rule in addition to OCL? For example, the Error Message for the Mandatory Tagged Value validation rule in the UML Completeness Constraints validation suite uses the following OCL to produce a dynamic error message:
Too few tag values for tags: {
let taggedValues:Set(TaggedValue) = self.taggedValue->asSet() in
let df:Set(Property) = taggedValues.tagDefinition->collect(f|f.oclAsType(Property))->asSet() in
let tags:Set(Property) = self.appliedStereotype.feature
->select(f|f.oclIsKindOf(Property))->collect(f|f.oclAsType(Property))->asSet()
->select(p| (not p.lowerValue.oclIsUndefined()) and (p.lower >= 1) and (p.opposite.oclIsUndefined() or not p.opposite.oclIsKindOf(ExtensionEnd)))
in
tags->select(t| (not df->includes(t)) or (taggedValues->any(tv| tv.tagDefinition = t).value()->size() < t.lower)).name->asSequence()->sortedBy(s|s)
}Could this be done using Groovy? If so, are there any instructions or examples on using Groovy to do this instead of OCL?
