Package com.mossle.auth.support

Examples of com.mossle.auth.support.UserStatusDTO


                String hql = "from UserStatus where username=? and userRepoRef=?";
                UserStatus userStatus = userStatusManager.findUnique(hql,
                        usernameStr, ScopeHolder.getUserRepoRef());

                if (userStatus == null) {
                    UserStatusDTO userStatusDto = new UserStatusDTO();
                    userStatusDto.setUsername(usernameStr);
                    userStatusDto.setEnabled(true);
                    userStatusDto.setRef(userDto.getId());
                    userStatusDtos.add(userStatusDto);
                } else {
                    userStatusDtos.add(userStatusConverter.createUserStatusDto(
                            userStatus, ScopeHolder.getUserRepoRef(),
                            ScopeHolder.getScopeId()));
View Full Code Here


public class UserStatusConverter {
    private ScopeConnector scopeConnector;

    public UserStatusDTO createUserStatusDto(UserStatus userStatus,
            String userRepoRef, String scopeId) {
        UserStatusDTO userStatusDto = new UserStatusDTO();
        userStatusDto.setId(userStatus.getId());
        userStatusDto.setUsername(userStatus.getUsername());
        userStatusDto.setEnabled(Integer.valueOf(1).equals(
                userStatus.getStatus()));
        userStatusDto.setRef(userStatus.getRef());

        StringBuilder buff = new StringBuilder();

        for (Role role : userStatus.getRoles()) {
            if (scopeId.equals(role.getScopeId())) {
                buff.append(role.getName()).append(",");
            } else {
                ScopeDTO scopeDto = scopeConnector.findById(role.getScopeId());
                buff.append(role.getName()).append("(")
                        .append(scopeDto.getName()).append("),");
            }
        }

        if (buff.length() > 0) {
            buff.deleteCharAt(buff.length() - 1);
        }

        userStatusDto.setAuthorities(buff.toString());

        return userStatusDto;
    }
View Full Code Here

TOP

Related Classes of com.mossle.auth.support.UserStatusDTO

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.