Warning: This topic is highly experimental. There are performance considerations, which should be taken into account, but currently are not. Action template support currently exists only in order to allow a discussion of the way how it looks like.
The Groovy engine can be embedded into action templates. Suggest the following example:
import net.sf.csutils.groovy.policy.ActionTemplates;
ActionTemplates.run({registryFacade, roMetaModel, queryEngine ->
if (entity.ResponsibleFor.name() == 'Joe User') {
result.failureMessage =
'Joe is a known childish person and should not be put in charge.'
} else {
result.successMessage =
'ok'
}
}
The objects registryFacade, modelAccessor, metaModelAccessor>, <<<roMetaModel, and queryEngine in the example are matching the objects with the same names from the text template engine.