IRoleMetaInfo roleMetaInfo = null;
String modelId = ((SecurityModel) role.getEPackage()).getId();
try {
roleMetaInfo = roleService.findDynamicRole(modelId, role.getName());
} catch (ObjectNotFoundException e1) {
throw new RuleExecutionException(modelId, "Model is not found.");
}
if (roleMetaInfo != null) {
throw new RuleExecutionException(role.getName(), "Dynamic role template with such name exists");
}
}