use of cz.metacentrum.perun.notif.exceptions.PerunNotifRegexUsedException in project perun by CESNET.
the class PerunNotifRegexManagerImpl method removePerunNotifRegexById.
@Override
public void removePerunNotifRegexById(int id) throws InternalErrorException, PerunNotifRegexUsedException {
PerunNotifRegex regex = getPerunNotifRegexById(id);
if (regex == null) {
throw new NotExistsException("Regex does not exists in db");
}
List<Integer> referencedTemplates = perunNotifRegexDao.getTemplateIdsForRegexId(id);
if (referencedTemplates != null && !referencedTemplates.isEmpty()) {
throw new PerunNotifRegexUsedException("Regex is still used.", referencedTemplates);
}
perunNotifRegexDao.removePerunNotifRegexById(id);
allRegex.remove(regex);
}
Aggregations