Examples of WaveletData


Examples of com.google.wave.api.impl.WaveletData

      protected String computeHash() {
        return "hash1";
      }
    };

    WaveletData waveletData = new WaveletData("google.com!wave1", "google.com!conv+root", "blip1",
        null);
    waveletData.addParticipant("foo@google.com");
    BlipSubmittedEvent event1 = new BlipSubmittedEvent(null, null, "foo@test.com", 1l, "blip1");
    DocumentChangedEvent event2 = new DocumentChangedEvent(null, null, "foo@test.com", 1l, "blip1");
    WaveletTagsChangedEvent event3 = new WaveletTagsChangedEvent(null, null, "foo@test.com", 1l,
        "blip1");
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

    OperationQueue opQueue = mock(OperationQueue.class);
    Wavelet expectedWavelet = new Wavelet(WaveId.of("example.com", "wave1"),
        WaveletId.of("example.com", "wavelet1"), "foo@bar.com", 1l, 1l, "Hello world",
        "blip1", null, roles, participants, dataDocument, tags, blips, threads, opQueue);

    WaveletData waveletData = expectedWavelet.serialize();
    Wavelet actualWavelet = Wavelet.deserialize(opQueue, blips, threads, waveletData);

    assertEquals(expectedWavelet.getWaveId(), actualWavelet.getWaveId());
    assertEquals(expectedWavelet.getWaveletId(), actualWavelet.getWaveletId());
    assertEquals(expectedWavelet.getRootBlip().getBlipId(),
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   *        {@link Wavelet}s and {@link ConversationBlip}s.
   */
  public static void resolveContext(EventMessageBundle eventMessageBundle, Wavelet wavelet,
      Conversation conversation, EventDataConverter eventDataConverter) {
    // TODO(user): Refactor.
    WaveletData waveletData =
        eventDataConverter.toWaveletData(wavelet, conversation, eventMessageBundle);
    eventMessageBundle.setWaveletData(waveletData);
    for (Map.Entry<String, Set<Context>> entry : eventMessageBundle.getRequiredBlips().entrySet()) {
      Set<Context> contextSet = entry.getValue();
      ConversationBlip requiredBlip = conversation.getBlip(entry.getKey());
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

public class EventDataConverterV22 extends EventDataConverterV21 {

  @Override
  public WaveletData toWaveletData(Wavelet wavelet, Conversation conversation,
      EventMessageBundle eventMessageBundle) {
    WaveletData waveletData = super.toWaveletData(wavelet, conversation,
        eventMessageBundle);
    List<String> blipIds = Lists.newLinkedList();
    for (ConversationBlip conversationBlip : conversation.getRootThread().getBlips()) {
      blipIds.add(conversationBlip.getId());
    }
    waveletData.setRootThread(new BlipThread("", -1 , blipIds, null));
    return waveletData;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

public class EventDataConverterV21 implements EventDataConverter {

  @Override
  public WaveletData toWaveletData(Wavelet wavelet, Conversation conversation,
      EventMessageBundle eventMessageBundle) {
    final WaveletData waveletData = new WaveletData();
    waveletData.setCreationTime(wavelet.getCreationTime());
    waveletData.setCreator(wavelet.getCreatorId().getAddress());
    waveletData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(wavelet.getWaveId()));
    waveletData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(wavelet.getId()));
    waveletData.setLastModifiedTime(wavelet.getLastModifiedTime());
    waveletData.setParticipants(idsToParticipantIdList(wavelet.getParticipantIds()));
    waveletData.setRootBlipId(conversation.getRootThread().getFirstBlip().getId());
    waveletData.setTitle(getTitle(wavelet, conversation));
    waveletData.setVersion(wavelet.getVersion());

    // Add Data Docs. All data documents are silently name spaced under the
    // robot prefix to avoid conflicts. Any docId containing a '+' will be
    // ignored for now.
    for (String documentId : wavelet.getDocumentIds()) {
      if (IdUtil.isRobotDocId(documentId)) {
        String[] parts = IdUtil.split(documentId);
        if (parts.length == 2) {
          Document document = wavelet.getDocument(documentId);
          String val = XmlStringBuilder.innerXml(document).getXmlString();
          waveletData.setDataDocument(parts[1], val);
        }
      }
    }

    // Add the tags.
    if (wavelet.getDocument(IdConstants.TAGS_DOC_ID) != null) {
      @SuppressWarnings({"unchecked", "rawtypes"})
      TagsDocument tags = new TagsDocument(wavelet.getDocument(IdConstants.TAGS_DOC_ID));
      tags.addListener(new TagsDocument.Listener() {
        @Override
        public void onAdd(String tagName) {
          waveletData.addTag(tagName);
        }
        @Override
        public void onRemove(int tagPosition) {
          // Not called.
        }});
      tags.processInitialState();
    }

    // Add the participant roles.
    ObservableDocument rolesDocument = wavelet.getDocument(IdConstants.ROLES_DATA_DOC_ID);
    if (rolesDocument != null) {
      DocumentBasedRoles roles = DocumentBasedRoles.create(rolesDocument);
      for (ParticipantId participantId : wavelet.getParticipantIds()) {
        waveletData.setParticipantRole(participantId.getAddress(),
            roles.getRole(participantId).name());
      }
    }
    return waveletData;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   */
  @Override
  public void execute(
      OperationRequest operation, OperationContext context, ParticipantId participant)
      throws InvalidRequestException {
    WaveletData waveletData =
        OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_DATA);

    // The loop validates the addresses present in the wavelet data before
    // creating a new wavelet.
    List<ParticipantId> participants = Lists.newArrayList(participant);
    for (String address : waveletData.getParticipants()) {
      try {
        participants.add(ParticipantId.of(address));
      } catch (InvalidParticipantAddress e) {
        throw new InvalidRequestException(
            address + " is not a valid participant address", operation);
      }
    }

    WaveletName waveletName = context.getConversationUtil().generateWaveletName();
    RobotWaveletData newWavelet = createEmptyRobotWavelet(participant, waveletName);
    OpBasedWavelet opBasedWavelet = newWavelet.getOpBasedWavelet(participant);

    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,
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   * @param conversation the conversation to put in the bundle.
   */
  private EventMessageBundle mapWaveletToMessageBundle(EventDataConverter converter,
      ParticipantId participant, Wavelet wavelet, Conversation conversation) {
    EventMessageBundle messages = new EventMessageBundle(participant.getAddress(), "");
    WaveletData waveletData = converter.toWaveletData(wavelet, conversation, messages);
    messages.setWaveletData(waveletData);
    ContextResolver.addAllBlipsToEventMessages(messages, conversation, wavelet, converter);
    return messages;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

    Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl);

    // Deserialize wavelet.
    opQueue.clear();
    WaveletData waveletData = (WaveletData) response.get(ParamsProperty.WAVELET_DATA);
    Map<String, Blip> blips = new HashMap<String, Blip>();
    Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
    Wavelet wavelet = Wavelet.deserialize(opQueue, blips, threads, waveletData);

    // Deserialize threads.
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   * Serializes this {@link Wavelet} into a {@link WaveletData}.
   *
   * @return an instance of {@link WaveletData} that represents this wavelet.
   */
  public WaveletData serialize() {
    WaveletData waveletData = new WaveletData();

    // Add primitive properties.
    waveletData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(waveId));
    waveletData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(waveletId));
    waveletData.setCreator(creator);
    waveletData.setCreationTime(creationTime);
    waveletData.setLastModifiedTime(lastModifiedTime);
    waveletData.setRootBlipId(rootBlipId);
    waveletData.setRootThread(rootThread);
    waveletData.setTitle(title);

    // Add tags.
    List<String> tags = new ArrayList<String>();
    for (String tag : this.tags) {
      tags.add(tag);
    }
    waveletData.setTags(tags);

    // Add participants.
    List<String> participants = new ArrayList<String>();
    for (String participant : this.participants) {
      participants.add(participant);
      Role role = getParticipants().getParticipantRole(participant);
      waveletData.setParticipantRole(participant, role.name());
    }
    waveletData.setParticipants(participants);

    // Add data documents.
    Map<String, String> dataDocuments = new HashMap<String, String>();
    for (Entry<String, String> entry : this.dataDocuments) {
      dataDocuments.put(entry.getKey(), entry.getValue());
    }
    waveletData.setDataDocuments(dataDocuments);

    return waveletData;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

    OperationQueue opQueue = mock(OperationQueue.class);
    Wavelet expectedWavelet = new Wavelet(WaveId.deserialise("google.com!wave1"),
        WaveletId.deserialise("google.com!wavelet1"), "foo@bar.com", 1l, 1l, "Hello world",
        "blip1", roles, participants, dataDocument, tags, blips, opQueue);

    WaveletData waveletData = expectedWavelet.serialize();
    Wavelet actualWavelet = Wavelet.deserialize(opQueue, blips, waveletData);

    assertEquals(expectedWavelet.getWaveId(), actualWavelet.getWaveId());
    assertEquals(expectedWavelet.getWaveletId(), actualWavelet.getWaveletId());
    assertEquals(expectedWavelet.getRootBlip().getBlipId(),
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.