Package org.waveprotocol.wave.model.wave

Examples of org.waveprotocol.wave.model.wave.Blip


    return adapt(newBlip);
  }

  @Override
  public ObservableDocument getDocument(String docId) {
    Blip blip = getBlip(docId);
    if (blip == null) {
      blip = createBlip(docId);
    }
    Document doc = blip.getContent();
    if (!(doc instanceof ObservableDocument)) {
      Preconditions.illegalArgument("Document \"" + docId + "\" is not observable");
    }
    return (ObservableDocument) doc;
  }
View Full Code Here


  static WaveletBasedConversationThread create(ObservableManifestThread manifestThread,
      WaveletBasedConversationBlip parentBlip, WaveletBasedConversation.ComponentHelper helper) {
    WaveletBasedConversationThread thread = new WaveletBasedConversationThread(manifestThread,
        parentBlip, helper);
    for (ObservableManifestBlip manifestBlip : manifestThread.getBlips()) {
      Blip blip = helper.getBlip(manifestBlip.getId());
      if (blip != null) {
        thread.adaptBlip(manifestBlip, blip);
      }
    }
View Full Code Here

      Preconditions.illegalArgument(
          "Can't insert blip before blip " + successor + " not from this thread");
    }
    WaveletBasedConversationBlip insertBefore = (WaveletBasedConversationBlip) successor;
    int index = manifestThread.indexOf(insertBefore.getManifestBlip());
    Blip blip = helper.createBlip(null);
    String blipId = blip.getId();
    manifestThread.insertBlip(index, blipId);
    return blips.get(blipId);
  }
View Full Code Here

  // remote changes. They don't make further changes to the data.
  //

  @Override
  public void onBlipAdded(ObservableManifestBlip manifestBlip) {
    Blip blip = helper.getBlip(manifestBlip.getId());
    if (blip != null) {
      // Note that this means the blip will be ignored if it doesn't exist in
      // the wavelet when the manifest entry is added.
      WaveletBasedConversationBlip convBlip = adaptBlip(manifestBlip, blip);
      triggerOnBlipAdded(convBlip);
View Full Code Here

   *
   * @param content  optional content
   * @return new blip.
   */
  private WaveletBasedConversationBlip appendBlipWithContent(DocInitialization content) {
    Blip blip = helper.createBlip(content);
    String blipId = blip.getId();
    manifestThread.appendBlip(blipId);
    return blips.get(blipId);
  }
View Full Code Here

   */
  public void testConversationBlipMetadataMatchesWavelet() {
    populate(target);
    ConversationBlip convBlip = target.getRootThread().getFirstBlip();
    Wavelet wavelet = target.getWavelet();
    Blip blip = wavelet.getBlip(convBlip.getId());

    assertEquals(blip.getId(), convBlip.getId());
    assertEquals(blip.getLastModifiedVersion().longValue(), convBlip.getLastModifiedVersion());
    assertEquals(blip.getLastModifiedTime().longValue(), convBlip.getLastModifiedTime());
    assertEquals(blip.getAuthorId(), convBlip.getAuthorId());
    assertEquals(blip.getContributorIds(), convBlip.getContributorIds());
  }
View Full Code Here

    target.init();
  }

  private ConversationBlip mockBlip() {
    ConversationBlip blip = mock(ConversationBlip.class);
    Blip raw = mock(Blip.class);
    when(blip.hackGetRaw()).thenReturn(raw);
    return blip;
  }
View Full Code Here

    return supplement.getThreadState(WaveletBasedConversation.widFor(id), thread.getId());
  }

  @Override
  public boolean isUnread(ConversationBlip blip) {
    Blip raw = blip.hackGetRaw();
    return supplement.isBlipUnread(raw.getWavelet().getId(), raw.getId(), raw
            .getLastModifiedVersion().intValue());
  }
View Full Code Here

    // Because we use the current wavelet version to mark a blip as read, and
    // because the wavelet version can change independently of that blip, the
    // mark-blip-as-read action is not idempotent. Therefore, to minimise
    // chatter, we do it only for unread blips.
    if (isUnread(b)) {
      Blip raw = b.hackGetRaw();
      Wavelet wavelet = raw.getWavelet();
      supplement.markBlipAsRead(wavelet.getId(), raw.getId(),
          // It is possible that during a VersionUpdateOperatin, the blip version is updated
          // before the wavelet version is updated, hence the max.
          // TODO(user, zdwang) to remove this once the wave model does correct event boundaries.
          (int) Math.max(raw.getLastModifiedVersion(), wavelet.getVersion()));
    }
  }
View Full Code Here

     *
     * @param content initial content for the new blip, or {@code null} for
     *        default content
     */
    Blip createBlip(DocInitialization content) {
      Blip blip = wavelet.createBlip(idGenerator.newBlipId());
      if (content != null) {
        blip.getContent().hackConsume(Nindo.fromDocOp(content, false));
      } else {
        Document doc = blip.getContent();
        doc.insertXml(Point.<Doc.N> end(doc.getDocumentElement()),
            Blips.INITIAL_CONTENT);
      }
      return blip;
    }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.wave.Blip

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.