Package org.opencustomer.db.dao.system

Examples of org.opencustomer.db.dao.system.RoleDAO


        Page page = new Page(conf.getIntValue(UserConfiguration.Key.LIST_NUMBER_ROWS), form.getPage());

        String paramName = form.getName();
        RoleDAO.AdminSelect paramAdmin = EnumUtility.valueOf(RoleDAO.AdminSelect.class, form.getAdmin(), RoleDAO.AdminSelect.ALL);
       
        RoleDAO dao = new RoleDAO();

        count = dao.countList(paramName, paramAdmin, user);
        if (count < page.getFirstEntry())
            page.setPage(1);

        if (count > 0)
            list = dao.getList(paramName, paramAdmin, sort, page, user);
        else
            list = new ArrayList<RoleVO>();

        ScrollBean scroll = new ScrollBean();
        scroll.setCount(count);
View Full Code Here


        if (log.isDebugEnabled())
            log.debug("delete role (ID:" + role.getId() + ")");

        try {
            new RoleDAO().delete(role);
        } catch (HibernateException e) {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.couldNotDeleteEntity", panel.getEntity().getId()));
        }
       
    }
View Full Code Here

        RoleVO role = (RoleVO) panel.getEntity();
        UserVO user = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
       
        try
        {
            RoleDAO dao = new RoleDAO();
            if (role.getId() == null)
            {
                if (log.isDebugEnabled())
                    log.debug("create role");
                dao.insert(role, user);
            }
            else
            {
                if (log.isDebugEnabled())
                    log.debug("save role (ID:" + role.getId() + ")");
                dao.update(role, user);
            }
        }
        catch (HibernateException e)
        {
            log.error("could not save role", e);
View Full Code Here

        if (role.getName() != null)
        {
            try
            {
                RoleDAO dao = new RoleDAO();

                RoleVO editRole = dao.getByName(role.getName());
                if (editRole != null && !editRole.getId().equals(role.getId())) {
                    if(editRole.isAdmin())
                        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.role.error.nameExistsInAdmin"));
                    else
                        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.system.role.error.nameExists"));
View Full Code Here

    @Override
    public void loadEntity(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        try
        {
            RoleVO role = new RoleDAO().getById(form.getId());
            List<UserVO> users = new UserDAO().getForRole(role);
           
            attributes.put("role", role);
            attributes.put("users", users);
        }
View Full Code Here

        try
        {
            UserVO user = (UserVO) panel.getEntity();

            RoleVO role = new RoleDAO().getById(form.getId());
           
            if(user.getProfile().getLdapGroup() == null && user.getProfile().getRole() == null || user.getProfile().getRole().isAdmin() != role.isAdmin()) {
                user.getProfile().getUsergroups().clear();
                user.getProfile().getUsergroups().add(role.getDefaultUsergroup());
                user.getProfile().setDefaultUsergroup(role.getDefaultUsergroup());
View Full Code Here

        RoleDAO.AdminSelect adminSelect = RoleDAO.AdminSelect.NOT_ADMIN;
        if(activeUser.getProfile().getRole().isAdmin())
            adminSelect = RoleDAO.AdminSelect.ALL;
       
        RoleDAO dao = new RoleDAO();
        count = dao.countList(paramName, adminSelect, activeUser);
        if (count < page.getFirstEntry())
            page.setPage(1);

        if (count > 0)
            list = dao.getList(paramName, adminSelect, sort, page, activeUser);
        else
            list = new ArrayList<RoleVO>();

        ScrollBean scroll = new ScrollBean();
        scroll.setCount(count);
View Full Code Here

        {
            UsergroupVO usergroup = new UsergroupDAO().getById(form.getId());

            attributes.put("usergroup", usergroup);
            attributes.put("users", new UserDAO().getForUsergroup(usergroup));
            attributes.put("roles", new RoleDAO().getForDefaultUsergroup(usergroup));
        }
        catch (HibernateException e)
        {
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.invalidEntity", new Integer(form.getId())));
View Full Code Here

                profile.setAccessGlobal(Access.READ);
                profile.setAccessGroup(Access.READ);
                profile.setAccessUser(Access.WRITE_SYSTEM);
                profile.setIpPattern("*");
                profile.setTimeLock(30);
                profile.setRole(new RoleDAO().getByName("User"));
                profile.setDefaultUsergroup(profile.getRole().getDefaultUsergroup());
                profile.setOwnerUser(adminUser.getId());
                profile.setOwnerGroup(adminUser.getProfile().getDefaultUsergroup().getId());
                ldapGroup.setProfile(profile);
                new LdapGroupDAO().insert(ldapGroup,adminUser);
View Full Code Here

TOP

Related Classes of org.opencustomer.db.dao.system.RoleDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.