Search in sources :

Example 1 with MetaActionRepository

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);
}
Also used : Role(com.axelor.auth.db.Role) Group(com.axelor.auth.db.Group) MetaMenuRepository(com.axelor.meta.db.repo.MetaMenuRepository) MetaActionRepository(com.axelor.meta.db.repo.MetaActionRepository) MetaMenu(com.axelor.meta.db.MetaMenu) MetaAction(com.axelor.meta.db.MetaAction) RoleRepository(com.axelor.auth.db.repo.RoleRepository) Transactional(com.google.inject.persist.Transactional)

Aggregations

Group (com.axelor.auth.db.Group)1 Role (com.axelor.auth.db.Role)1 RoleRepository (com.axelor.auth.db.repo.RoleRepository)1 MetaAction (com.axelor.meta.db.MetaAction)1 MetaMenu (com.axelor.meta.db.MetaMenu)1 MetaActionRepository (com.axelor.meta.db.repo.MetaActionRepository)1 MetaMenuRepository (com.axelor.meta.db.repo.MetaMenuRepository)1 Transactional (com.google.inject.persist.Transactional)1