class HibernateAttributeSetDAO extends HibernatePersistentObjectDAO<AttributeSet> implements AttributeSetDAO {

	@Override
	public boolean delete(long id, int code) {
		if (!checkStoringAspect())
			return false;

		boolean result = true;
		try {
			AttributeSet set = (AttributeSet) findById(id);
			if (set == null)
				return true;

			set.setDeleted(code);
			set.setName(set.getName() + "." + set.getId());
			saveOrUpdate(set);

			optionsDao.deleteBySetIdAndAttribute(id, null);

			List<Template> templates = templateDao.findAll(set.getTenantId());
			for (Template template : templates)
				templateDao.store(template);
		} catch (Throwable e) {
			log.error(e.getMessage(), e);
			result = false;
		}

		return result;
	}

	public  HibernateAttributeSetDAO();

}