Exemple #1
0
 /**
  * Render all of the documents in a wave as a single String, in the order in which they are listed
  * by wavelet.getDocumentIds().
  *
  * <p>TODO: move this to the console package (...console.ConsoleUtils)
  *
  * @param wave wave to render
  * @return rendered wave
  */
 public static String renderDocuments(ClientWaveView wave) {
   final StringBuilder doc = new StringBuilder();
   for (WaveletData wavelet : wave.getWavelets()) {
     doc.append(render(wavelet.getDocuments().values()));
   }
   return doc.toString();
 }
Exemple #2
0
  /**
   * Retrieve a list of index entries from an index wave.
   *
   * @param indexWave the wave to retrieve the index from
   * @return list of index entries
   */
  public static List<IndexEntry> getIndexEntries(ClientWaveView indexWave) {
    if (!indexWave.getWaveId().equals(CommonConstants.INDEX_WAVE_ID)) {
      throw new IllegalArgumentException(indexWave + " is not the index wave");
    }

    List<IndexEntry> indexEntries = Lists.newArrayList();

    for (WaveletData wavelet : indexWave.getWavelets()) {
      // The wave id is encoded as the wavelet id
      WaveId waveId = WaveId.deserialise(wavelet.getWaveletName().waveletId.serialise());
      String digest = ClientUtils.render(wavelet.getDocuments().values());
      indexEntries.add(new IndexEntry(waveId, digest));
    }

    return indexEntries;
  }