Package org.waveprotocol.wave.model.conversation

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


   * @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

   * @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

    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

        for (ConversationBlip child : eventDataConverter.findBlipChildren(requiredBlip)) {
          ContextResolver.addBlipToEventMessages(
              eventMessageBundle, child, wavelet, eventDataConverter);
        }
      }
      ConversationThread containingThread = requiredBlip.getThread();
      if (contextSet.contains(Context.PARENT)) {
        ConversationBlip parent = eventDataConverter.findBlipParent(requiredBlip);
        if (parent != null) {
          ContextResolver.addBlipToEventMessages(
              eventMessageBundle, parent, wavelet, eventDataConverter);
        }
      }
      if (contextSet.contains(Context.SIBLINGS)) {
        for (ConversationBlip blip : containingThread.getBlips()) {
          if (blip != requiredBlip) {
            ContextResolver.addBlipToEventMessages(
                eventMessageBundle, blip, wavelet, eventDataConverter);
          }
        }
View Full Code Here

  public static void addAllBlipsToEventMessages(EventMessageBundle eventMessageBundle,
      Conversation conversation, Wavelet wavelet, EventDataConverter eventDataConverter) {
    Queue<ConversationThread> threads = new LinkedList<ConversationThread>();
    threads.add(conversation.getRootThread());
    while (!threads.isEmpty()) {
      ConversationThread thread = threads.remove();
      for (ConversationBlip blip : thread.getBlips()) {
        addBlipToEventMessages(eventMessageBundle, blip, wavelet, eventDataConverter);
        for (ConversationThread replyThread : blip.getReplyThreads()) {
          threads.add(replyThread);
        }
      }
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.