Examples of WaveletData


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")
      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

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

   *        {@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 org.waveprotocol.wave.model.wave.data.WaveletData

    assertNull("On empty queue should return null", robot.dequeueWavelet());
  }

  public void testUpdateWaveletWithGap() throws Exception {
    HashedVersion hashedVersionZero = HASH_FACTORY.createVersionZero(WAVELET_NAME);
    WaveletData waveletData = WaveletDataUtil.createEmptyWavelet(WAVELET_NAME, ALEX,
        hashedVersionZero, 0L);
    robot.waveletUpdate(waveletData, DeltaSequence.empty());

    // We are making an delta which applies to version 1, however the robot only
    // knows about version 0.
    ParticipantId bob = ParticipantId.of("bob@exmaple.com");
    HashedVersion v2 = HashedVersion.unsigned(2);
    WaveletOperation addBob = new AddParticipant(new WaveletOperationContext(ALEX, 0L, 1, v2), bob);
    addBob.apply(waveletData);
    waveletData.setHashedVersion(v2);
    waveletData.setVersion(2);

    TransformedWaveletDelta delta = new TransformedWaveletDelta(ALEX, v2,
        0L, Collections.singletonList(addBob));

    // Send the delta for version 1 to the robot, it should now enqueue a new
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.data.WaveletData

  /**
   * Enqueues an empty wavelet into the {@link Robot}.
   */
  private void enqueueEmptyWavelet() throws Exception {
    HashedVersion hashedVersionZero = HASH_FACTORY.createVersionZero(WAVELET_NAME);
    WaveletData waveletData = WaveletDataUtil.createEmptyWavelet(WAVELET_NAME, ALEX,
        hashedVersionZero, 0L);
    robot.waveletUpdate(waveletData, DeltaSequence.empty());
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.data.WaveletData

    assertEquals(CollectionUtils.immutableSet(BOB, JOE), obs.getParticipants());

    assertEquals(docs.keySet(), obs.getDocumentIds());
    for (Map.Entry<String, DocOp> d : docs.entrySet()) {
      BlipData blip = obs.getDocument(d.getKey());
      WaveletData wavelet = blip.getWavelet();
      assertEquals(WAVELET_NAME.waveId, wavelet.getWaveId());
      assertEquals(WAVELET_NAME.waveletId, wavelet.getWaveletId());
      assertEquals(d.getKey(), blip.getId());
      assertNotNull(blip.getAuthor());
      assertEquals(0L, blip.getLastModifiedTime());
      assertEquals(-1, blip.getLastModifiedVersion());
      assertTrue(blip.getContributors().isEmpty());
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.data.WaveletData

*/

public class BlipDataWithBlipDataImplTest extends BlipDataTestBase {
  @Override
  protected BlipData createBlipData() {
    WaveletData waveletData =
        WaveletDataFactory.of(BasicFactories.waveletDataImplFactory()).create();
    return waveletData.createDocument("root", waveletData.getCreator(), // \u2620
        waveletData.getParticipants(), EmptyDocument.EMPTY_DOCUMENT, 42L, 42L);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.data.WaveletData

    HashedVersion v1 = HashedVersion.unsigned(1L);
    TransformedWaveletDelta delta = makeDelta(USER, v1, 0L, UTIL.noOp());
    DeltaSequence deltas = DeltaSequence.of(delta);

    WaveletData wavelet = WaveletDataUtil.createEmptyWavelet(WN1, USER, V0, 1234567890L);
    clientFrontend.waveletUpdate(wavelet, deltas);

    WaveletName dummyWaveletName = ClientFrontendImpl.createDummyWaveletName(INDEX_WAVE_ID);
    verify(listener, Mockito.never()).onUpdate(eq(dummyWaveletName),
        any(CommittedWaveletSnapshot.class),
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.data.WaveletData

   * @param name new wavelet name
   * @return the new wavelet snapshot
   */
  private CommittedWaveletSnapshot provideWavelet(WaveletName name) throws WaveServerException,
      OperationException {
    WaveletData wavelet = WaveletDataUtil.createEmptyWavelet(name, USER, V0, 1234567890L);
    DELTA.get(0).apply(wavelet);
    CommittedWaveletSnapshot snapshot = new CommittedWaveletSnapshot(wavelet, V0);
    when(waveletProvider.getSnapshot(name)).thenReturn(snapshot);
    when(waveletProvider.getWaveletIds(name.waveId)).thenReturn(ImmutableSet.of(name.waveletId));
    return snapshot;
View Full Code Here

Examples of org.waveprotocol.wave.model.wave.data.WaveletData

        }
        assertFalse(update.hasCommitNotice());
      }
    });
    long dummyCreationTime = System.currentTimeMillis();
    WaveletData wavelet = WaveletDataUtil.createEmptyWavelet(WAVELET_NAME, PARTICIPANT,
        BEGIN_VERSION, dummyCreationTime);
    frontend.waveletUpdate(wavelet, POJO_DELTAS);
    assertEquals(1, counter);
    assertFalse(controller.failed());
  }
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.