use of com.axelor.meta.db.repo.MetaActionRepository in project axelor-open-suite by axelor.
the class CalendarConfigurationService method deleteEntryMenu.
@Transactional
public void deleteEntryMenu(CalendarConfiguration calendarConfiguration) {
MetaAction metaAction = calendarConfiguration.getMetaAction();
Role role = calendarConfiguration.getRole();
Group group = calendarConfiguration.getCalendarGroup();
calendarConfiguration.setMetaAction(null);
calendarConfiguration.setRole(null);
calendarConfiguration.getCalendarUser().removeRole(role);
if (group != null) {
group.removeRole(role);
}
String menuName = NAME + calendarConfiguration.getName().toLowerCase() + "-" + calendarConfiguration.getId();
MetaMenuRepository metaMenuRepository = Beans.get(MetaMenuRepository.class);
MetaMenu metaMenu = metaMenuRepository.findByName(menuName);
metaMenuRepository.remove(metaMenu);
MetaActionRepository metaActionRepository = Beans.get(MetaActionRepository.class);
metaActionRepository.remove(metaAction);
RoleRepository roleRepository = Beans.get(RoleRepository.class);
roleRepository.remove(role);
}
Aggregations