Package org.waveprotocol.wave.model.conversation

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


    ObservableConversation conversation =
      context.openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot();

    // Make an inline blip at a certain location, we will then have the
    // BlipOperationService insert one after that blip.
    ObservableConversationBlip rootBlip = conversation.getRootThread().getFirstBlip();
    Document doc = rootBlip.getContent();
    Doc.E lastLine = DocHelper.getLastElementWithTagName(doc, LineContainers.LINE_TAGNAME);
    int lastLineLocation = doc.getLocation(Point.after(doc, lastLine));
    ObservableConversationBlip firstInlineBlip =
        rootBlip.addReplyThread(lastLineLocation).appendBlip();

    // Append the inline blip to the root blip
    String rootBlipId = ConversationUtil.getRootBlipId(conversation);
    Element inlineBlipElement = new Element(ElementType.INLINE_BLIP);
    inlineBlipElement.setProperty("id", firstInlineBlip.getId());
    OperationRequest operation = operationRequest(
        OperationType.DOCUMENT_INSERT_INLINE_BLIP_AFTER_ELEMENT, rootBlipId,
        Parameter.of(ParamsProperty.BLIP_DATA, blipData),
        Parameter.of(ParamsProperty.ELEMENT, inlineBlipElement));
View Full Code Here


  @Override
  protected void setUp() throws Exception {
    service = WaveletSetTitleService.create();
    helper = new OperationServiceHelper(WAVELET_NAME, ALEX);

    ObservableConversationBlip rootBlip = getRootBlip();
    LineContainers.appendToLastLine(
        rootBlip.getContent(), XmlStringBuilder.createText(INITIAL_CONTENT));
  }
View Full Code Here

    String annotation = getRootBlip().getContent().getAnnotation(0, TitleHelper.TITLE_KEY);
    assertEquals("Expected conv/title annotation on range (0,1)", title, annotation);
  }

  private ObservableConversationBlip getRootBlip() throws InvalidRequestException {
    ObservableConversationBlip rootBlip =
        helper.getContext().openConversation(WAVE_ID, WAVELET_ID, ALEX).getRoot().getRootThread()
            .getFirstBlip();
    return rootBlip;
  }
View Full Code Here

    verify(doc, never()).stopDiffSuppression();
  }

  public void testFreshBecomingReadStopsSuppression() {
    ObservableConversation conv = wave.createRoot();
    ObservableConversationBlip root = conv.getRootThread().appendBlip();

    MockDoc doc = mock(MockDoc.class);
    when(doc.isCompleteDiff()).thenReturn(true, false);
    when(documents.get(root)).thenReturn(doc);
    target.install();
View Full Code Here

    verify(doc).stopDiffSuppression();
  }

  public void testReadBecomingReadClearsDiffsButNotSuppression() {
    ObservableConversation conv = wave.createRoot();
    ObservableConversationBlip root = conv.getRootThread().appendBlip();

    MockDoc doc = mock(MockDoc.class);
    when(doc.isCompleteDiff()).thenReturn(false);
    when(documents.get(root)).thenReturn(doc);
    target.install();
View Full Code Here

        OperationUtil.getOperationType(operation) == OperationType.WAVELET_APPEND_BLIP,
        "Unsupported operation " + operation);

    BlipData blipData = OperationUtil.getRequiredParameter(operation, ParamsProperty.BLIP_DATA);

    ObservableConversationBlip newBlip = conversation.getRootThread().appendBlip();
    context.putBlip(blipData.getBlipId(), newBlip);

    putContentForNewBlip(newBlip, blipData.getContent());
    processBlipCreatedEvent(operation, context, participant, conversation, newBlip);
  }
View Full Code Here

      ParticipantId deltaAuthor, long timestamp) {
    WaveletBlipOperation blipOp = (WaveletBlipOperation) op;
    String blipId = blipOp.getBlipId();
    // Ignoring the documents outside the conversation such as tags
    // and robot data docs.
    ObservableConversationBlip blip = conversation.getBlip(blipId);
    if (blip != null) {
      String blipId1 = blip.getId();

      EventGeneratingDocumentHandler docHandler = docHandlers.get(blipId1);
      if (docHandler == null) {
        ObservableDocument doc = (ObservableDocument) blip.getContent();
        docHandler = new EventGeneratingDocumentHandler(
            doc, blip, capabilities, messages, deltaAuthor, timestamp);
        doc.addListener(docHandler);
        docHandlers.put(blipId1, docHandler);
      } else {
View Full Code Here

    WaveletBasedConversation.makeWaveletConversational(opBasedWavelet);

    ObservableConversationView conversation =
        context.getConversationUtil().buildConversation(opBasedWavelet);
    ObservableConversationBlip rootBlip = conversation.getRoot().getRootThread().appendBlip();

    for (ParticipantId newParticipant : participants) {
      opBasedWavelet.addParticipant(newParticipant);
    }

    // Store the temporary id of the wavelet and rootblip so that future
    // operations can reference it.
    try {
      WaveId waveId = ApiIdSerializer.instance().deserialiseWaveId(waveletData.getWaveId());
      WaveletId waveletId =
          ApiIdSerializer.instance().deserialiseWaveletId(waveletData.getWaveletId());
      context.putWavelet(waveId, waveletId, newWavelet);
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid id", operation, e);
    }
    context.putBlip(waveletData.getRootBlipId(), rootBlip);

    String message = OperationUtil.getOptionalParameter(operation, ParamsProperty.MESSAGE);
    WaveletCreatedEvent event =
        new WaveletCreatedEvent(null, null, participant.getAddress(), System.currentTimeMillis(),
            rootBlip.getId(), message,
            ApiIdSerializer.instance().serialiseWaveId(waveletName.waveId),
            ApiIdSerializer.instance().serialiseWaveletId(waveletName.waveletId));
    context.processEvent(operation, event);
  }
View Full Code Here

    ObservableConversation c = conversationView.getConversation(conversationId);
    return c != null ? c.getBlip(bid) : null;
  }

  private void triggerOnMaybeBlipReadChanged(WaveletId wid, String bid) {
    ObservableConversationBlip blip = getBlip(wid, bid);
    if (blip != null) {
      triggerOnMaybeBlipReadChanged(blip);
    }
  }
View Full Code Here

   * @return the server representation of the digest for the query.
   */
  Digest generateDigest(ObservableConversationView conversations, SupplementedWave supplement,
      WaveletData rawWaveletData) {
    ObservableConversation rootConversation = conversations.getRoot();
    ObservableConversationBlip firstBlip = null;
    if ((rootConversation != null) && (rootConversation.getRootThread() != null)
        && (rootConversation.getRootThread().getFirstBlip() != null)) {
      firstBlip = rootConversation.getRootThread().getFirstBlip();
    }
    String title;
    if (firstBlip != null) {
      Document firstBlipContents = firstBlip.getContent();
      title = TitleHelper.extractTitle(firstBlipContents).trim();
    } else {
      title = EMPTY_WAVELET_TITLE;
    }

View Full Code Here

TOP

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

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.