Package com.pragprog.aebook.chat.client

Examples of com.pragprog.aebook.chat.client.ChatMessageList


    query.setFilter("chat == desiredRoom");
    query.declareParameters("String desiredRoom");
    query.setOrdering("date");
    List<PChatMessage> messages =  (List<PChatMessage>)query.execute(chat);
    // Get the most recent message.
    ChatMessageList result = null;
    if (messages.size() > 1) {
        PChatMessage lastMessage = messages.get(messages.size() - 1);//(1)
        result = new ChatMessageList(chat, lastMessage.getDate());
        for (PChatMessage pchatmsg : messages) {
                    result.addMessage(pchatmsg.asChatMessage());
        }
    } else {
        result = new ChatMessageList(chat, System.currentTimeMillis());
    }
    return result;
      } finally {
    persister.close();
      }
View Full Code Here


            query.declareParameters("String desiredRoom, int earliest");//(6)
            query.setFilter("chat == desiredRoom && date > earliest"); //(7)
            query.setOrdering("date");
            List<PChatMessage> messages =
                (List<PChatMessage>)query.execute(chat, timestamp);
            ChatMessageList msgList = null;
            // Get the most recent message.
            if (messages.size() >= 1) {
                PChatMessage lastMessage = messages.get(messages.size() - 1);
                msgList = new ChatMessageList(chat, lastMessage.getDate());
            } else {
                msgList = new ChatMessageList(chat, System.currentTimeMillis());
            }
            for (PChatMessage msg : messages) {
                msgList.addMessage(msg.asChatMessage());
            }
            return msgList;
        } finally {
            persister.close();
        }
View Full Code Here

            query.setFilter("chat == desiredRoom");
            query.declareParameters("String desiredRoom");
            query.setOrdering("date");
            List<PChatMessage> messages =  (List<PChatMessage>)query.execute(chat);
            // Get the most recent message.
            ChatMessageList result = null;
            if (messages.size() > 1) {
                PChatMessage lastMessage = messages.get(messages.size() - 1);//(1)
                result = new ChatMessageList(chat, lastMessage.getDate());
                for (PChatMessage pchatmsg : messages) {
                    result.addMessage(pchatmsg.asChatMessage());
                }
            } else {
                result = new ChatMessageList(chat, System.currentTimeMillis());
            }
            return result;
        } finally {
            persister.close();
        }
View Full Code Here

            Query query = persister.newQuery(PChatMessage.class);
            query.declareParameters("String desiredRoom, int earliest");//(6)
            query.setFilter("chat == desiredRoom && date > earliest"); //(7)
            query.setOrdering("date");
            List<PChatMessage> messages =  (List<PChatMessage>)query.execute(chat, timestamp);
            ChatMessageList msgList = null;
            // Get the most recent message.
            if (messages.size() >= 1) {
                PChatMessage lastMessage = messages.get(messages.size() - 1);
                msgList = new ChatMessageList(chat, lastMessage.getDate());
            } else {
                msgList = new ChatMessageList(chat, System.currentTimeMillis());
            }
            for (PChatMessage msg : messages) {
                msgList.addMessage(msg.asChatMessage());
            }
            return msgList;
        } finally {
            persister.close();
        }
View Full Code Here

TOP

Related Classes of com.pragprog.aebook.chat.client.ChatMessageList

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.