Package com.pragprog.aebook.persistchat

Examples of com.pragprog.aebook.persistchat.ChatRoom


          Date timestamp = new Date();//(2)
          message.setDate(timestamp);
          Query query = persister.newQuery();//(3)
          query.setFilter("chat == " + message.getChat());
          List<ChatRoom> chats = (List<ChatRoom>) query.execute();
          ChatRoom chat = chats.get(0);//(4)
          chat.updateLastMessageDate(timestamp);//(5)
      } finally {
          persister.close();
      }
  }
View Full Code Here


    }
   
    public void addChat(String chat) {
        PersistenceManager persister = Persister.getPersistenceManager();
        try {
            ChatRoom newchat = new ChatRoom(chat, new Date());
            persister.makePersistent(newchat);
        } finally {
            persister.close();
        }
    }
View Full Code Here

    public List<ChatRoom> initializeChats() {
        List<ChatRoom> rooms = new ArrayList<ChatRoom>();
        Date now = new Date();
        PersistenceManager persister = Persister.getPersistenceManager();
        for (String name : DEFAULT_ROOMS) {
            ChatRoom r = new ChatRoom(name, now);
            persister.makePersistent(r);
            rooms.add(r);
        }
        persister.close();
        return rooms;
View Full Code Here

TOP

Related Classes of com.pragprog.aebook.persistchat.ChatRoom

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.