Package ru.webcrafter.client.user

Examples of ru.webcrafter.client.user.Role


    public Role getRole(long id) {
        return (Role) getHibernateTemplate().get(Role.class, id);
    }

    public Role getRole(String roleName) {
        Role r = null;
        if (roleName != null) {
            List list = getHibernateTemplate().find("from Role r where r.name=?", roleName);
            if (list != null && !list.isEmpty()) r = (Role) list.get(0);
        }
        return r;
View Full Code Here


        return r;
    }

    public Role createRole(String roleName) {
        if (roleExists(roleName)) throw new DataIntegrityViolationException(roleName);
        Role r = new Role();
        r.setName(roleName);
        getHibernateTemplate().save(r);
        return r;
    }
View Full Code Here

        return userDao.getUser(userId);
    }

    public UserAuth createUser(UserAuth userAuthDto) {
        UserAuth userAuth = userDao.createUser(userAuthDto);
        Role userRole = roleDao.getRole("ROLE_USER");
        if (userRole == null) {
            userRole = roleDao.createRole("ROLE_USER");
        }
        userAuth.addRole(userRole);
        return userAuth;
View Full Code Here

TOP

Related Classes of ru.webcrafter.client.user.Role

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.