Package org.openmim.mn2.model

Examples of org.openmim.mn2.model.User


      connection = dataSource.getConnection();
      preparedStatement = connection
          .prepareStatement("select id, name, password from cms_user");
      resultSet = preparedStatement.executeQuery();
      while (resultSet.next()) {
        User user = new User();
        user.setId(resultSet.getString("id"));
        user.setName(resultSet.getString("name"));
        user.setPassword(resultSet.getString("password"));
        ret.add(user);
      }
      connection.commit();

    } catch (SQLException e) {
View Full Code Here


  }

  @Test
  public void testUserDetail() throws IOException {
    UserService service = getTestUserForge().createUserService();
    User user = service.get(TEST_USER);
    assertNotNull("Null user", user);
  }
View Full Code Here

    return "thymeleaf/users";
  }

  private void buildUserList(Model model) {
    List<User> users = new ArrayList<User>();
    users.add(new User("Paul", "Chapman"));
    users.add(new User("Mike", "Wiesner"));
    users.add(new User("Mark", "Secrist"));
    users.add(new User("Ken", "Krueger"));
    users.add(new User("Wes", "Gruver"));
    users.add(new User("Kevin", "Crocker"));
    model.addAttribute("users", users);
  }
View Full Code Here

    UsernamePasswordToken token = (UsernamePasswordToken) authcToken;
    String username = token.getUsername();
    char[] password = token.getPassword();
    String pwd = password != null ? new String(password) : null;

    User user = userManager.loadUser(username, pwd);

    if (user != null) {
      return new SimpleAuthenticationInfo(username, pwd, getName());
    } else {
      return null;
View Full Code Here

public class UserManagerImpl implements UserManager {

  @Override
  public User loadUser(String username, String password) {
    if ("111111".equals(username) && "111111".equals(password)) {
      return new User("111111", "111111");
    }
    if ("222222".equals(username) && "222222".equals(password)) {
      return new User("222222", "222222");
    }
    return null;
  }
View Full Code Here

   
   
   
    public List<User> FindAllUser(){
        List<User> users = new ArrayList<User>();
        User u = new User();
        u.setUser("admin");
        u.setPass("admin");
        u.setVivienda("Departamento");
        u.setNombre("Guillermo Barraza");
        u.setTitulo("Sr.");
        users.add(u);
       
        User o = new User();
       
        o.setUser("diego");
        o.setPass("urrutia");
        o.setVivienda("Casa");
        o.setNombre("Diego Urrutia");
        o.setTitulo("Sr.");
        users.add(o);
        return users;
    }
View Full Code Here

    }

    public void startReconnecting(Context context, StatusRoomListenerExternal statusRoomListenerExternal) {
        List<IMNetworkBean> nets=context.getConfigurationBean().getNetworksConfigured();
        if(nets!=null)for (IMNetworkBean bean : nets) {
            MessagingNetwork2 net=getMessagingNetwork2ByType(bean.getType());
            net.load(context, imListener, statusRoomListenerExternal);
            net.startReconnecting();
        }
    }
View Full Code Here

        this.imNetworks=new ArrayList<IMNetwork>();
        final List<IMNetworkBean> imNetworkBeans = ctx.getConfigurationBean().getNetworksConfigured();
        for (IMNetworkBean bean : imNetworkBeans) {
            String key=bean.getKey();
            String keyCanon=getFactory().getNameConvertor().toCanonicalIMNetworkKey(key);
            IMNetwork imNetwork=getFactory().createIMNetwork(bean.getType(),key,
                    imListener,
                    new MyStatusRoomListenerInternal(statusRoomListenerExternal),
                    getFactory().createListOfServersToKeepConnectionWith(
                            ctx.getConfigurationBean().
                                    getNetworkKeyCanonical2ListOfServersToKeepConnectionWith().
View Full Code Here

    }

    protected static void handleCommand(int i, IRCMessage msg, IRCListener il) throws Exception {
        Lang.ASSERT_NOT_NULL(il, "il");
        Lang.ASSERT_NOT_NULL(msg, "msg");
        IRCController queryClient = il.getProtocolHandler().getLocalClient();
        Lang.ASSERT_NOT_NULL(queryClient, "queryClient");
        //org.openmim.irc.mvc_impl.model.User_ clientFrom = msg.getUser();
        //Lang.ASSERT_NOT_NULL(clientFrom, "clientFrom");
        int middlePartsCount = msg.getMiddlePartsCount();
        //
        switch (i) {
            default:
                break;
                //:goo!webchat@127.0.0.*** NOTICE goo :pidarrr
            case RPL_EXT_ISON:
                //":127.0.0.1 303 jj_mirc_foo :"
                //":127.0.0.1 303 jj_mirc_foo :jj_mirc_foo "
                //":127.0.0.1 303 jj_mirc_foo :jjj_mirc_foo jj_mirc_foo "
                String[] nicksOnline = Acme.Utils.splitStr(msg.getTrailing().trim(), ' ');
                Lang.ASSERT_NOT_NULL(nicksOnline, "nicksOnline");
                il.handleIsonReply(/*server*/ msg.getPrefix(), nicksOnline);
                return;
            case RPL_EXT_NOTICE:
                try {
                    il.handleNotice(msg.getPrefix(), msg.getSender(), msg.getTrailing());
                }
                catch (Exception ex) {
                    il.handleNotice(msg.getPrefix(), null, msg.getTrailing());
                }
                return;
            case 002:
                String s002 = msg.getTrailing();
//    if (s002 != null && s002.toLowerCase().lastIndexOf(".ircz.") != -1)
//    il.setIrczMuteSupported();
                break;
//  case 387 :
//    :Beauce-R.Qc.UnderZ.Org 387 goo #goo :End of IRCChannel Mute List
//    if (il.isIrczMuteSupported())
//    {
//    Lang.EXPECT(middlePartsCount >= 1, "middlePartsCount is expected to be >= 1, but it is " + middlePartsCount);
//    String channelName = msg.getMiddlePart(1);
//    Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
//    il.handleMuteListEnd(channelName);
//    return;
//    }
//    break;
//  case 386 :
//    //:Beauce-R.Qc.UnderZ.Org 386 goo #z jp!*@* sKaTeR 971112601
//    //                                1  2      3      4
//    if (il.isIrczMuteSupported())
//    {
//    Lang.EXPECT(middlePartsCount >= 4, "middlePartsCount is expected to be >= 4, but it is " + middlePartsCount);
//    String channelName = msg.getMiddlePart(1);
//    String ircMaskMuted = msg.getMiddlePart(2);
//    String muterNickName = msg.getMiddlePart(3);
//    String timeAsString = msg.getMiddlePart(4);
//    Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(channelName, "channelName");
//    Lang.EXPECT_NOT_NULL_NOR_TRIMMED_EMPTY(ircMaskMuted, "ircMaskMuted");
//    il.handleMuteListItem(new org.openmim.irc.driver.ircz.MuteListItem(channelName, ircMaskMuted, muterNickName, timeAsString));
//    return;
//    }
//    break;
                //:127.0.0.1 401 goo goojhg :No such nick/channel
            case 401:
                il.handleNoSuchNickChannel(msg.getMiddlePart(1), msg.getTrailing());
                return;
                //:127.0.0.1 301 goo goo :away message
            case 301:
                il.handleAwayMessage(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 405:
            case 471:
            case 473:
            case 474:
            case 475:
                il.cannotJoinChannel(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 432:
            case 433:
            case 436:
                il.invalidNickName(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 311:
                il.handleWhoisUser(msg.getMiddlePart(1), msg.getMiddlePart(2), msg.getMiddlePart(3), msg.getTrailing());
                return;
            case 312:
                il.handleWhoisServer(msg.getMiddlePart(1), msg.getMiddlePart(2), msg.getTrailing());
                return;
            case 313:
                il.handleWhoisOperator(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 317:
                il.handleWhoisIdleTime(msg.getMiddlePart(1), Integer.parseInt(msg.getMiddlePart(2)), msg.getTrailing());
                return;
            case 319:
                il.handleWhoisChannelsOn(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 318:
                il.handleWhoisEnd(msg.getMiddlePart(1), msg.getTrailing());
                return;
            case 331:
                il.onInitialTopic(msg.getMiddlePart(1), false, msg.getTrailing());
                return;
            case 332:
                il.onInitialTopic(msg.getMiddlePart(1), true, msg.getTrailing());
                return;
            case 367:
                il.handleBanListItem(msg.getMiddlePart(1), msg.getMiddlePart(2));
                return;
            case 368:
                il.handleBanListEnd(msg.getMiddlePart(1));
                return;
            case -101:

            {
                String to = msg.getMiddlePart(0);
                Lang.ASSERT_NOT_NULL_NOR_EMPTY(to, "privmsg.to");
                //char c = to.charAt(0);
                //boolean isToChannel = (c == '#' || c == '&');
                ////
                User userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                //if (!isToChannel)
                //{
                ////new Query should not be created at all for ignored users.
                //if (il.shouldCreateQuery(userFrom, msg.getTrailing()))
                //queryClient.onJoinedQuery(userFrom);
                //}
                if (msg.getTrailing() != null) {
                    String s = msg.getTrailing();
                    if (s.startsWith("\001")) {
                        boolean flag1 = s.endsWith("\001") && s.length() > 1;
                        int j = flag1 ? s.length() - 1 : s.length();
                        handleCtcp(msg, s.substring(1, j), il);
                        return;
                    }
                }
                il.textMessageReceived(//
                        userFrom, //
                        to, //
                        msg.getTrailing());
                return;
            }
            case -100:
                il.ping(msg.getTrailing());
                return;
            case -103:
                handleJoin(il, msg);
                return;
            case 353:
                parseNamReply(il, msg);
                return;
            case RPL_EXT_PART:

            {
                String channelName = msg.getMiddlePart(0);
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                IRCChannelParticipant IRCChannelRole = queryClient.getChannelRoleByChannelName(userFrom, channelName);
                Lang.EXPECT_NOT_NULL(IRCChannelRole, "IRCChannelRole");
                IRCChannel channel = (IRCChannel) IRCChannelRole.getRoom();
                channel.parts(IRCChannelRole, msg.getTrailing());
                il.handlePart(channelName, userFrom, msg.getTrailing() != null ? msg.getTrailing() : userFrom.getActiveNick());
                return;
            }
            case -106:
                il.handleTopic(msg.getMiddlePart(0), msg.getTrailing());
                return;
            case -105:

            {
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                queryClient.onQuit(userFrom);
                il.quit(userFrom.getActiveNick(), msg.getTrailing());
                return;
            }
            case -104:

            {
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                String oldNickName = userFrom.getActiveNick();
                String newNickName = msg.getTrailing();
                if (newNickName == null) newNickName = msg.getMiddlePart(0);
                il.nickChange(oldNickName, newNickName);
                userFrom.setActiveNick(newNickName);
                return;
            }
            case -108:

            {
                IRCUser userFrom = msg.getSender();
                Lang.ASSERT_NOT_NULL(userFrom, "userFrom");
                String channelName = msg.getMiddlePart(0);
                String kickedNick = msg.getMiddlePart(1);
                IRCChannel IRCChannel = queryClient.getChannelJoinedByChannelName(channelName);
                Lang.EXPECT_NOT_NULL(IRCChannel, "IRCChannel named " + StringUtil.toPrintableString(channelName));
                IRCChannelParticipant IRCChannelRole = queryClient.getChannelRoleByNickName(IRCChannel,kickedNick);
                Lang.EXPECT_NOT_NULL(IRCChannelRole, "IRCChannelRole for " + StringUtil.toPrintableString(kickedNick) + " on " + StringUtil.toPrintableString(channelName));
                IRCChannel.kicked(IRCChannelRole,userFrom,msg.getTrailing());
                il.kick(userFrom.getActiveNick(), channelName, kickedNick, msg.getTrailing());
                return;
            }
            case 1:
                /* '\001' */
                il.welcome(msg.getMiddlePart(0), msg.getTrailing());
                queryClient.welcome_setNickName(msg.getMiddlePart(0));
                return;
            case RPL_EXT_MODE:
            case 324:
                //:127.0.0.1 324 goo #goo +
                final boolean is324 = i == 324;
View Full Code Here

        String channelName = ircmessage.getTrailing();
        if (channelName == null)
            channelName = ircmessage.getMiddlePart(0);
        if (channelName != null)
            channelName = channelName.trim();
        IRCController queryClient = irclistener.getProtocolHandler().getLocalClient();
        if (nickJoined.equalsIgnoreCase(irclistener.getProtocolHandler().getNick())) {
            queryClient.onMeJoinedChannel(channelName, userJoined);
            irclistener.join(channelName);
        } else {
            IRCChannel ch = queryClient.getChannelJoinedByChannelName(channelName);
            Lang.EXPECT_NOT_NULL(ch, "channel named " + StringUtil.toPrintableString(channelName));
            final RoomParticipant rp = queryClient.createDefaultRole(ch, userJoined);
            rp.getRoom().addRoomRole(rp);
            ch.joins((IRCChannelParticipant) rp);
            irclistener.join(channelName, userJoined);
        }
    }
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.