Package org.openmim.mn2.model

Examples of org.openmim.mn2.model.User


    }

    protected static void parseNamReply(IRCListener irclistener, IRCMessage ircmessage) throws IOException, ExpectException {
        String channelName = ircmessage.getMiddlePart(2);
        Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
        IRCController queryClient = irclistener.getProtocolHandler().getLocalClient();
        IRCChannel IRCChannel = queryClient.getChannelJoinedByChannelName(channelName);
        Lang.EXPECT_NOT_NULL(IRCChannel, "IRCChannel");
        irclistener.namReplyStart(channelName);
        String nickName;
        char modifierChar;
        StringTokenizer st = new StringTokenizer(ircmessage.getTrailing());
        while (st.hasMoreElements()) {
            nickName = st.nextToken();
            Lang.EXPECT_POSITIVE(nickName.length(), "@nick length for " + StringUtil.toPrintableString(nickName));
            modifierChar = nickName.charAt(0);
            if (modifierChar == '@' || modifierChar == '+')
                nickName = nickName.substring(1);
            else
                modifierChar = ' ';
            Lang.EXPECT_POSITIVE(nickName.length(), "nick length for " + StringUtil.toPrintableString(nickName));
            if (!nickName.equalsIgnoreCase(queryClient.getActiveNick())) {
//    User_ client = queryClient.getCreateUser(nickName);
//    IRCChannel.createDefaultRole_addToRoom(client);
            }
            irclistener.namReplyAddNick(nickName, modifierChar);
        }
View Full Code Here


        PrintWriter printwriter = new PrintWriter(new BufferedOutputStream(socket.getOutputStream(), 1024), true);
        init(bufferedreader, printwriter, irclistener);
        irclistener.registering();
        register(loginPassword, nickName, userName, realIrcServerHostName, realIrcServerHostName, realName);
        irclistener.connected();
        queryClient = new IRCController(nickName, realName, userName, loginPassword, MN2Factory);
    }
View Full Code Here

    public IMNetwork createIMNetwork(IMNetwork.Type type, String key, IMListener imListener,
                                     StatusRoomListenerInternal statusRoomListenerInternal,
                                     List<Server> listOfIRCServersToKeepConnectionWith, Context ctx) {
        switch (type){
            case irc:
                return new IRCIMNetwork(key, ctx, imListener, statusRoomListenerInternal,
                        listOfIRCServersToKeepConnectionWith);
            default:throw new AssertionError();
        }
    }
View Full Code Here

        }
    }

    public Server createServer(String hostNameOfRealServer, String redirdHostName, int redirdPort, String realName,
                                  List<String> nickNames, String password, String identdUserName) {
        return new IRCServerImpl(
                hostNameOfRealServer, redirdHostName, redirdPort, realName, nickNames,
                password, identdUserName);
    }
View Full Code Here

    public String getIdentdUserName() {
        return identdUserName;
    }

    public ServerBean toBean(IMNetworkBean net) {
        IRCServerBean sb=new IRCServerBean();
        sb.setPort(redirdPort);
        sb.setHostName(redirdHostName);
        sb.setImNetwork(net);
        return sb;
    }
View Full Code Here

    private UserService userService;

    @Test
    public void authenticateValidUser() {
        userService.register("bilbo", "Bilbo Baggins", "treasure");
        User user = userService.authenticate("bilbo", "treasure");
        assertThat(user, is(notNullValue()));
        assertThat(user.getId(), is("bilbo"));
        assertThat(user.getName(), is("Bilbo Baggins"));
        assertThat(user.getPassword(), is("treasure"));
    }
View Full Code Here

    @Inject
    private MovieDbImportService importService;

    public List<Movie> populateDatabase() {

        User micha = userService.register("micha", "Micha", "password");
        userService.register("ollie", "Olliver", "password");
        userService.addFriend(micha, "ollie");

        List<Integer> ids = asList(19995, 194, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609,
            13, 20526, 11, 1893, 1892, 1894, 168, 193, 200, 157, 152, 201, 154, 12155, 58, 285,
View Full Code Here

        String jpql = "select count(u) from User u";
        return em.createQuery(jpql, Long.class).getSingleResult();
    }

    public User authenticate(String login, String password) {
        User user = em.find(User.class, login);
        if (user != null) {
            if (password.equals(user.getPassword())) {
                return user;
            }
        }
        return null;
    }
View Full Code Here

    public User register(String login, String name, String password) {
        if (findByLogin(login) != null) {
            throw new MovieDbException("login is already taken");
        }
        User user = new User();
        user.setId(login);
        user.setName(name);
        user.setPassword(password);
        em.persist(user);
        return user;
    }
View Full Code Here

        em.persist(rating);
        return rating;
    }

    public void addFriend(User user, String friendLogin) {
        User friend = findByLogin(friendLogin);
        if (friend != null && !friend.equals(user)) {
            user.getFriends().add(friend);
        }
    }
View Full Code Here

TOP

Related Classes of org.openmim.mn2.model.User

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.