Examples of ObservableConversation


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

        new OpBasedWavelet(snapshot.getWaveId(), snapshot,
            // This doesn't thrown an exception, the sinks will
            new BasicWaveletOperationContextFactory(null),
            ParticipationHelper.DEFAULT, SilentOperationSink.VOID, SilentOperationSink.VOID);

    ObservableConversation conversation = getRootConversation(wavelet);

    if (conversation == null) {
      return messages;
    }

    // Start listening
    EventGeneratingConversationListener conversationListener =
        new EventGeneratingConversationListener(conversation, capabilities, messages, robotName);
    conversation.addListener(conversationListener);
    EventGeneratingWaveletListener waveletListener =
        new EventGeneratingWaveletListener(capabilities);
    wavelet.addListener(waveletListener);

    Map<String, EventGeneratingDocumentHandler> docHandlers = Maps.newHashMap();
    try {
      for (TransformedWaveletDelta delta : waveletAndDeltas.getDeltas()) {
        // TODO(ljvderijk): Set correct timestamp and hashed version once
        // wavebus sends them along
        long timestamp = 0L;
        conversationListener.deltaBegin(delta.getAuthor(), timestamp);

        for (WaveletOperation op : delta) {
          // Check if we need to attach a doc handler.
          if ((op instanceof WaveletBlipOperation)) {
            attachDocHandler(conversation, op, docHandlers, capabilities, messages,
                delta.getAuthor(), timestamp);
          }
          op.apply(snapshot);
        }
        conversationListener.deltaEnd();
      }
    } catch (OperationException e) {
      throw new IllegalStateException("Operation failed to apply when generating events", e);
    } finally {
      conversation.removeListener(conversationListener);
      wavelet.removeListener(waveletListener);
      for (EventGeneratingDocumentHandler docHandler : docHandlers.values()) {
        docHandler.doc.removeListener(docHandler);
      }
    }
View Full Code Here

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

    if (!WaveletBasedConversation.waveletHasConversation(wavelet)) {
      // No conversation present, bail.
      return null;
    }

    ObservableConversation conversation = conversationUtil.buildConversation(wavelet).getRoot();
    if (conversation.getRootThread().getFirstBlip() == null) {
      // No root blip is present, this will cause Robot API code
      // to fail when resolving the context of events. This might be fixed later
      // on by making changes to the ContextResolver.
      return null;
    }
View Full Code Here

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

      conversationId = WaveletBasedConversation.idFor(
          ApiIdSerializer.instance().deserialiseWaveletId(waveletId));
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid conversation id", operation, e);
    }
    ObservableConversation conversation = conversationView.getConversation(conversationId);

    OperationType type = OperationUtil.getOperationType(operation);
    switch (type) {
      case BLIP_CONTINUE_THREAD:
        continueThread(operation, context, participant, conversation);
View Full Code Here

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

      OperationRequest operation, OperationContext context, ParticipantId participant)
      throws InvalidRequestException {
   
    String title =
        OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_TITLE);
    ObservableConversation conversation =
        context.openConversation(operation, participant).getRoot();
    String blipId = conversation.getRootThread().getFirstBlip().getId();
    Document doc = context.getBlip(conversation, blipId).getContent();
    TitleHelper.setExplicitTitle(doc, title);
  }
View Full Code Here

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

    if (modifyHow.equals(ModifyHowType.MARK_AS_READ.getValue())) {
      if (blipId == null || blipId.isEmpty()) {
        supplement.markAsRead();
      } else {
        ObservableConversation conversation =
            context.openConversation(operation, participant).getRoot();
        ConversationBlip blip = conversation.getBlip(blipId);
        supplement.markAsRead(blip);
      }
    } else if (modifyHow.equals(ModifyHowType.MARK_AS_UNREAD.getValue())) {
      supplement.markAsUnread();
    } else {
View Full Code Here

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

    DocumentModifyAction modifyAction =
        OperationUtil.getRequiredParameter(operation, ParamsProperty.MODIFY_ACTION);

    OpBasedWavelet wavelet = context.openWavelet(operation, participant);
    ObservableConversation conversation =
        context.openConversation(operation, participant).getRoot();
    Document doc = context.getBlip(conversation, blipId).getContent();

    ApiView view = new ApiView(doc, wavelet);
    DocumentHitIterator hitIterator = getDocumentHitIterator(operation, view);
View Full Code Here

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

      Map<ParamsProperty, Object> data =
          ImmutableMap.<ParamsProperty, Object>of(ParamsProperty.WAVELET_IDS, waveletIds);
      context.constructResponse(operation, data);
    } else {
      OpBasedWavelet wavelet = context.openWavelet(operation, participant);
      ObservableConversation conversation =
          context.openConversation(operation, participant).getRoot();

      EventMessageBundle messages =
          mapWaveletToMessageBundle(context.getConverter(), participant, wavelet, conversation);
View Full Code Here

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

  // Converters.
  //

  private ObservableConversationBlip getBlip(WaveletId wid, String bid) {
    String conversationId = WaveletBasedConversation.idFor(wid);
    ObservableConversation c = conversationView.getConversation(conversationId);
    return c != null ? c.getBlip(bid) : null;
  }
View Full Code Here

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

   *        This wavelet is a copy.
   * @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();
View Full Code Here

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

    ui.setTitleLabelText((title == null) ? "" : URL.decodeComponent(title));
    updatePrefsFromAttribute(getAttribute(PREFS_ATTRIBUTE));
    refreshParticipantInformation();

    // HACK(anorth): This event routing should happen outside the widget.
    ObservableConversation conv = (ObservableConversation) blip.getConversation();
    conv.addListener(new WaveletListenerAdapter(blip, this));
    log("Requesting Gadget metadata: ", source);
    String cachedIframeUrl = getAttribute(IFRAME_URL_ATTRIBUTE);
    if (validIframeUrl(cachedIframeUrl)) {
      registerWithController(cleanUrl(cachedIframeUrl), 0, 0);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.