Search in sources :

Example 1 with AdminModule

use of org.broadleafcommerce.openadmin.server.security.domain.AdminModule in project BroadleafCommerce by BroadleafCommerce.

the class AdminNavigationDaoImpl method save.

@Override
public AdminSection save(AdminSection adminSection) {
    adminSection = em.merge(adminSection);
    AdminModule module = adminSection.getModule();
    em.refresh(module);
    return adminSection;
}
Also used : AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule)

Example 2 with AdminModule

use of org.broadleafcommerce.openadmin.server.security.domain.AdminModule in project BroadleafCommerce by BroadleafCommerce.

the class AdminNavigationDaoImpl method readAllAdminModules.

@Override
public List<AdminModule> readAllAdminModules() {
    Query query = em.createNamedQuery("BC_READ_ALL_ADMIN_MODULES");
    query.setHint(QueryHints.HINT_CACHEABLE, true);
    query.setHint(QueryHints.HINT_CACHE_REGION, "blAdminSecurityQuery");
    List<AdminModule> modules = query.getResultList();
    return modules;
}
Also used : TypedQuery(javax.persistence.TypedQuery) Query(javax.persistence.Query) AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule)

Example 3 with AdminModule

use of org.broadleafcommerce.openadmin.server.security.domain.AdminModule in project BroadleafCommerce by BroadleafCommerce.

the class AdminNavigationServiceImpl method buildMenu.

@Override
public AdminMenu buildMenu(AdminUser adminUser) {
    AdminMenu adminMenu = new AdminMenu();
    List<AdminModule> modules = adminNavigationDao.readAllAdminModules();
    populateAdminMenu(adminUser, adminMenu, modules);
    return adminMenu;
}
Also used : AdminMenu(org.broadleafcommerce.openadmin.server.security.domain.AdminMenu) AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule)

Example 4 with AdminModule

use of org.broadleafcommerce.openadmin.server.security.domain.AdminModule in project BroadleafCommerce by BroadleafCommerce.

the class AdminNavigationServiceImpl method populateAdminMenu.

protected void populateAdminMenu(AdminUser adminUser, AdminMenu adminMenu, List<AdminModule> modules) {
    for (AdminModule module : modules) {
        List<AdminSection> authorizedSections = buildAuthorizedSectionsList(adminUser, module);
        if (authorizedSections != null && authorizedSections.size() > 0) {
            AdminModuleDTO adminModuleDto = ((AdminModuleImpl) module).getAdminModuleDTO();
            adminMenu.getAdminModules().add(adminModuleDto);
            adminModuleDto.setSections(authorizedSections);
        }
    }
    // Sort the authorized modules
    BeanComparator displayComparator = new BeanComparator("displayOrder");
    Collections.sort(adminMenu.getAdminModules(), displayComparator);
}
Also used : AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule) AdminSection(org.broadleafcommerce.openadmin.server.security.domain.AdminSection) AdminModuleDTO(org.broadleafcommerce.openadmin.server.security.domain.AdminModuleDTO) AdminModuleImpl(org.broadleafcommerce.openadmin.server.security.domain.AdminModuleImpl) BeanComparator(org.apache.commons.beanutils.BeanComparator)

Example 5 with AdminModule

use of org.broadleafcommerce.openadmin.server.security.domain.AdminModule in project BroadleafCommerce by BroadleafCommerce.

the class AdminNavigationDaoImpl method remove.

@Override
public void remove(AdminSection adminSection) {
    AdminModule module = adminSection.getModule();
    em.remove(adminSection);
    em.refresh(module);
}
Also used : AdminModule(org.broadleafcommerce.openadmin.server.security.domain.AdminModule)

Aggregations

AdminModule (org.broadleafcommerce.openadmin.server.security.domain.AdminModule)6 AdminMenu (org.broadleafcommerce.openadmin.server.security.domain.AdminMenu)2 AdminSection (org.broadleafcommerce.openadmin.server.security.domain.AdminSection)2 Query (javax.persistence.Query)1 TypedQuery (javax.persistence.TypedQuery)1 BeanComparator (org.apache.commons.beanutils.BeanComparator)1 AdminModuleDTO (org.broadleafcommerce.openadmin.server.security.domain.AdminModuleDTO)1 AdminModuleImpl (org.broadleafcommerce.openadmin.server.security.domain.AdminModuleImpl)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1