private IModelService modelService;
@Override
public void executeRule(IRuleDefinition r) throws RuleExecutionException {
// Check name duplicate
SecurityModel model = (SecurityModel) r.getSource();
Collection<SecurityModel> models = modelService.getEmfModels();
for (SecurityModel securityModel : models) {
if ((model.getName().equals(securityModel.getName())) && (!securityModel.getId().equals(model.getId()))) {
throw new RuleExecutionException(MessageFormat.format("Another model with the {0} name exists. Duplicate model names are not allowed.", model.getName())); //$NON-NLS-1$
}
}
}