Examples of WaveletSnapshot


Examples of org.waveprotocol.box.common.comms.WaveClientRpc.WaveletSnapshot

    } catch (InvalidIdException ex) {
      throw new InvalidRequestException("Invalid id", operation, ex);
    }
    WaveletName waveletName = WaveletName.of(waveId, waveletId);
    CommittedWaveletSnapshot snapshot = context.getWaveletSnapshot(waveletName, participant);
    WaveletSnapshot protoSnapshot = SnapshotSerializer.serializeWavelet(snapshot.snapshot, snapshot.snapshot.getHashedVersion());
    WaveletSnapshotProtoImpl protoSnapshotImpl = new WaveletSnapshotProtoImpl(protoSnapshot);
    String jsonSnapshot = gson.toJson(protoSnapshotImpl.toGson(null, gson));
    Map<ParamsProperty, Object> data =
      ImmutableMap.<ParamsProperty, Object> of(ParamsProperty.RAW_SNAPSHOT, jsonSnapshot);
    context.constructResponse(operation, data);
View Full Code Here

Examples of org.waveprotocol.box.common.comms.WaveClientRpc.WaveletSnapshot

  public void testWaveletRoundtrip() throws Exception {
    WaveletData expected = TestDataUtil.createSimpleWaveletData();
    WaveletName name = WaveletName.of(expected.getWaveId(), expected.getWaveletId());
    HashedVersion version = HASH_FACTORY.createVersionZero(name);

    WaveletSnapshot snapshot = SnapshotSerializer.serializeWavelet(expected, version);
    WaveletData actual = SnapshotSerializer.deserializeWavelet(snapshot, expected.getWaveId());

    TestDataUtil.checkSerializedWavelet(expected, actual);
  }
View Full Code Here

Examples of org.waveprotocol.box.common.comms.WaveClientRpc.WaveletSnapshot

   */
  public void testGetWavelet() throws Exception {
    WaveletData wavelet = waveletProvider.getHostedWavelet();

    WaveRef waveref = WaveRef.of(wavelet.getWaveId(), wavelet.getWaveletId());
    WaveletSnapshot snapshot = fetchWaverRefAndParse(waveref, WaveletSnapshot.class);
    WaveletData roundtripped = SnapshotSerializer.deserializeWavelet(snapshot, waveref.getWaveId());

    // We have just round-tripped wavelet through the servlet. wavelet and
    // roundtripped should be identical in all the fields that get serialized.
    TestDataUtil.checkSerializedWavelet(wavelet, roundtripped);
View Full Code Here

Examples of org.waveprotocol.box.common.comms.WaveletSnapshot

   * @return a wavelet snapshot that contains all the information in the
   *         original wavelet.
   */
  public static WaveletSnapshot serializeWavelet(ReadableWaveletData wavelet,
      HashedVersion hashedVersion) {
    WaveletSnapshot builder = WaveletSnapshotJsoImpl.create();

    builder.setWaveletId(ModernIdSerialiser.INSTANCE.serialiseWaveletId(wavelet.getWaveletId()));
    for (ParticipantId participant : wavelet.getParticipants()) {
      builder.addParticipantId(participant.toString());
    }
    for (String id : wavelet.getDocumentIds()) {
      ReadableBlipData data = wavelet.getDocument(id);
      builder.addDocument(serializeDocument(data));
    }

    builder.setVersion(WaveletOperationSerializer.serialize(hashedVersion));
    builder.setLastModifiedTime(wavelet.getLastModifiedTime());
    builder.setCreator(wavelet.getCreator().getAddress());
    builder.setCreationTime(wavelet.getCreationTime());

    return builder;
  }
View Full Code Here

Examples of org.waveprotocol.box.common.comms.WaveletSnapshot

   * @return a wavelet snapshot that contains all the information in the
   *         original wavelet.
   */
  public static WaveletSnapshot serializeWavelet(ReadableWaveletData wavelet,
      HashedVersion hashedVersion) {
    WaveletSnapshot builder = WaveletSnapshotJsoImpl.create();

    builder.setWaveletId(ModernIdSerialiser.INSTANCE.serialiseWaveletId(wavelet.getWaveletId()));
    for (ParticipantId participant : wavelet.getParticipants()) {
      builder.addParticipantId(participant.toString());
    }
    for (String id : wavelet.getDocumentIds()) {
      ReadableBlipData data = wavelet.getDocument(id);
      builder.addDocument(serializeDocument(data));
    }

    builder.setVersion(WaveletOperationSerializer.serialize(hashedVersion));
    builder.setLastModifiedTime(wavelet.getLastModifiedTime());
    builder.setCreator(wavelet.getCreator().getAddress());
    builder.setCreationTime(wavelet.getCreationTime());

    return builder;
  }
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.