Package org.waveprotocol.wave.model.conversation

Examples of org.waveprotocol.wave.model.conversation.ConversationThread


    String threadId = blip.getThread().getId();
    blipData.setThreadId(threadId);

    // If it's the root thread, that doesn't have thread id, then skip.
    if (!threadId.isEmpty()) {
      ConversationThread thread = blip.getThread();
      addThread(eventMessageBundle, thread, -1, wavelet);
    }

    // Add the inline reply threads.
    List<String> threadIds = Lists.newLinkedList();
    for (LocatedReplyThread<? extends ConversationThread> thread : blip.locateReplyThreads()) {
      String replyThreadId = thread.getThread().getId();
      threadIds.add(replyThreadId);
      addThread(eventMessageBundle, thread.getThread(), thread.getLocation(), wavelet);
    }

    blipData.setReplyThreadIds(threadIds);
    return blipData;
  }
View Full Code Here


   * @return the blip's parent, or {@code null} if the blip is the first blip
   *     in a conversation.
   */
  @Override
  public ConversationBlip findBlipParent(ConversationBlip blip) {
    ConversationThread containingThread = blip.getThread();
    if (containingThread.getFirstBlip() == blip
        && containingThread != blip.getConversation().getRootThread()) {
      return containingThread.getParentBlip();
    }
    return findPreviousSibling(blip);
  }
View Full Code Here

   * @param blip the blip.
   * @return the previous sibling of the blip, or {@code null}.
   */
  @VisibleForTesting
  static ConversationBlip findPreviousSibling(ConversationBlip blip) {
    ConversationThread thread = blip.getThread();
    ConversationBlip previous = null;
    for (ConversationBlip sibling : thread.getBlips()) {
      if (sibling == blip) {
        break;
      }
      previous = sibling;
    }
View Full Code Here

  /**
   * This test verifies the count in an empty inline thread.
   */
  public void testEmptyInlineThread() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    assertEquals(1, monitor.getTotalCount(rootThread));
    assertEquals(0, monitor.getTotalCount(t1));
  }
View Full Code Here

   * This test ensures that the total blip counts aggregate properly up through
   * nested inline threads.
   */
  public void testNestedThreadBlips() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    t3.appendBlip();

    assertEquals(2, monitor.getTotalCount(t1));
    assertEquals(3, monitor.getTotalCount(t2));
    assertEquals(1, monitor.getTotalCount(t3));
    assertEquals(7, monitor.getTotalCount(rootThread));
View Full Code Here

   * @return the next sibling of the blip, or {@code null} if blip is the last
   *     blip in a thread.
   */
  @VisibleForTesting
  static ConversationBlip findNextSibling(ConversationBlip blip) {
    ConversationThread thread = blip.getThread();
    Iterator<? extends ConversationBlip> blips = thread.getBlips().iterator();
    boolean foundBlip = false;
    while (!foundBlip && blips.hasNext()) {
      if (blips.next() == blip) {
        foundBlip = true;
      }
View Full Code Here

   * @param conversation The wavelet conversation
   * @return the title of the {@link Wavelet}, or an empty string if it has
   *     no title.
   */
  private static String getTitle(Wavelet wavelet, Conversation conversation) {
    ConversationThread rootThread = conversation.getRootThread();
    if (rootThread == null) {
      return "";
    }
    ConversationBlip firstBlip = rootThread.getFirstBlip();
    if (firstBlip == null) {
      return "";
    }
    Document doc = firstBlip.getContent();
    return TitleHelper.extractTitle(doc);
View Full Code Here

   * This test verifies that blips counts are aggregated properly when a blip is
   * deleted which contains an inline thread.
   */
  public void testNestedThreadDeleteBlip() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    t3.appendBlip();

    t2b2.delete();

    assertEquals(2, monitor.getTotalCount(t1));
    assertEquals(1, monitor.getTotalCount(t2));
View Full Code Here

   * This test verifies the read and unread state in both the root thread as
   * well as an inline thread.
   */
  public void testNestedThreadReading() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    ConversationBlip t3b1 = t3.appendBlip();

    supplementedWave.markAsRead(t3b1);

    assertEquals(0, monitor.getReadCount(t1));
    assertEquals(2, monitor.getUnreadCount(t1));
View Full Code Here

   * This test verifies the read and unread state when a thread with read and
   * unread blips is deleted.
   */
  public void testNestedThreadWithDeleteReading() throws Exception {
    ConversationBlip rb1 = rootThread.appendBlip();
    ConversationThread t1 = rb1.addReplyThread(0);
    t1.appendBlip();
    ConversationBlip t1b2 = t1.appendBlip();

    ConversationBlip rb2 = rootThread.appendBlip();
    ConversationThread t2 = rb2.addReplyThread(0);
    t2.appendBlip();
    ConversationBlip t2b2 = t2.appendBlip();

    ConversationThread t3 = t2b2.addReplyThread();
    t3.appendBlip();
    ConversationBlip t3b1 = t3.appendBlip();

    supplementedWave.markAsRead(t3b1);
    supplementedWave.markAsRead(t1b2);
    t2b2.delete();

View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.conversation.ConversationThread

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.