Examples of WaveViewData


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

    protected WaveletOperationalizer createWavelets() {
      return WaveletOperationalizer.create(getWaveData().getWaveId(), getSignedInUser());
    }

    protected WaveViewImpl<OpBasedWavelet> createWave() {
      WaveViewData snapshot = getWaveData();
      // The operationalizer makes the wavelets function via operation control.
      // The hookup with concurrency-control and remote operation streams occurs
      // later in createUpgrader().
      final WaveletOperationalizer operationalizer = getWavelets();
      WaveletFactory<OpBasedWavelet> waveletFactory = new WaveletFactory<OpBasedWavelet>() {
        @Override
        public OpBasedWavelet create(WaveId waveId, WaveletId id, ParticipantId creator) {
          long now = System.currentTimeMillis();
          ObservableWaveletData data = new WaveletDataImpl(id,
              creator,
              now,
              0L,
              HashedVersion.unsigned(0),
              now,
              waveId,
              getDocumentRegistry());
          return operationalizer.operationalize(data);
        }
      };
      WaveViewImpl<OpBasedWavelet> wave =
          WaveViewImpl.create(waveletFactory, snapshot.getWaveId(), getIdGenerator(),
              getSignedInUser(), WaveletConfigurator.ADD_CREATOR);

      // Populate the initial state.
      for (ObservableWaveletData waveletData : snapshot.getWavelets()) {
        wave.addWavelet(operationalizer.operationalize(waveletData));
      }
      return wave;
    }
View Full Code Here

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

          }

          @Override
          protected void fetchWave(Accessor<WaveViewData> whenReady) {
            timeline.add("fakewave_start");
            WaveViewData fake = WaveFactory.create(getDocumentRegistry());
            timeline.add("fakewave_end");
            whenReady.use(fake);
          }

          @Override
View Full Code Here

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

     * @param docFactory factory/registry for documents in the wave
     * @return the wave state of the sample wave.
     */
    public static WaveViewDataImpl create(DocumentFactory<?> docFactory) {
      // Create a sample wave.
      WaveViewData sampleData = createSampleWave();

      // Now build one that has the same setup state as that required by
      // undercurrent (complex issue with the per-document output sinks).
      WaveViewDataImpl newData = WaveViewDataImpl.create(sampleData.getWaveId());
      WaveletDataImpl.Factory copier = WaveletDataImpl.Factory.create(docFactory);
      for (ReadableWaveletData src : sampleData.getWavelets()) {
        WaveletDataImpl copied = copier.create(src);
        for (ParticipantId p : src.getParticipants()) {
          copied.addParticipant(p);
        }
        copied.setVersion(copied.getVersion());
View Full Code Here

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

    LinkedHashMap<WaveId, WaveViewData> results = Maps.newLinkedHashMap();

    // Loop over the user waves view.
    for (WaveId waveId : currentUserWavesView.keySet()) {
      Set<WaveletId> waveletIds = currentUserWavesView.get(waveId);
      WaveViewData view = buildWaveViewData(waveId, waveletIds, matchesFunction, waveMap);
      Iterable<? extends ObservableWaveletData> wavelets = view.getWavelets();
      boolean hasConversation = false;
      for (ObservableWaveletData waveletData : wavelets) {
        if (IdUtil.isConversationalId(waveletData.getWaveletId())) {
          hasConversation = true;
          break;
View Full Code Here

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

  }

  public static WaveViewData buildWaveViewData(WaveId waveId, Set<WaveletId> waveletIds,
      Function<ReadableWaveletData, Boolean> matchesFunction, WaveMap waveMap) {

    WaveViewData view = WaveViewDataImpl.create(waveId); // Copy of the wave built up for search hits.
    for (WaveletId waveletId : waveletIds) {
      WaveletContainer waveletContainer = null;
      WaveletName waveletname = WaveletName.of(waveId, waveletId);


      // TODO (Yuri Z.) This loop collects all the wavelets that match the
      // query, so the view is determined by the query. Instead we should
      // look at the user's wave view and determine if the view matches the
      // query.
      try {
        waveletContainer = waveMap.getWavelet(waveletname);
        if ((waveletContainer == null) || !waveletContainer.applyFunction(matchesFunction)) {
          continue;
        }
        // Just keep adding all the relevant wavelets in this wave.
        view.addWavelet(waveletContainer.copyWaveletData());
      } catch (WaveletStateException e) {
        LOG.warning("Failed to access wavelet " + waveletContainer.getWaveletName(), e);
      }
    }
    return view;
View Full Code Here

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

          callback.onFailure(
              new RequestException("Got back status code " + response.getStatusCode()));
        } else if (!response.getHeader("Content-Type").startsWith("application/json")) {
          callback.onFailure(new RuntimeException("Fetch service did not return json"));
        } else {
          WaveViewData waveView;
          try {
            WaveViewSnapshotJsoImpl snapshot = JsonMessage.parse(response.getText());
            waveView = SnapshotSerializer.deserializeWave(snapshot, docFactory);
          } catch (OperationException e) {
            callback.onFailure(e);
View Full Code Here

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

    protected WaveletOperationalizer createWavelets() {
      return WaveletOperationalizer.create(getWaveData().getWaveId(), getSignedInUser());
    }

    protected WaveViewImpl<OpBasedWavelet> createWave() {
      WaveViewData snapshot = getWaveData();
      // The operationalizer makes the wavelets function via operation control.
      // The hookup with concurrency-control and remote operation streams occurs
      // later in createUpgrader().
      final WaveletOperationalizer operationalizer = getWavelets();
      WaveletFactory<OpBasedWavelet> waveletFactory = new WaveletFactory<OpBasedWavelet>() {
        @Override
        public OpBasedWavelet create(WaveId waveId, WaveletId id, ParticipantId creator) {
          long now = System.currentTimeMillis();
          ObservableWaveletData data = new WaveletDataImpl(id,
              creator,
              now,
              0L,
              HashedVersion.unsigned(0),
              now,
              waveId,
              getDocumentRegistry());
          return operationalizer.operationalize(data);
        }
      };
      WaveViewImpl<OpBasedWavelet> wave =
          WaveViewImpl.create(waveletFactory, getWaveData().getWaveId(), getIdGenerator(),
              getSignedInUser(), WaveletConfigurator.ADD_CREATOR);

      // Populate the initial state.
      for (ObservableWaveletData waveletData : snapshot.getWavelets()) {
        wave.addWavelet(operationalizer.operationalize(waveletData));
      }
      return wave;
    }
View Full Code Here

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

          }

          @Override
          protected void fetchWave(Accessor<WaveViewData> whenReady) {
            timeline.add("fakewave_start");
            WaveViewData fake = WaveFactory.create(getDocumentRegistry());
            timeline.add("fakewave_end");
            whenReady.use(fake);
          }

          @Override
View Full Code Here

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

     * @param docFactory factory/registry for documents in the wave
     * @return the wave state of the sample wave.
     */
    public static WaveViewDataImpl create(DocumentFactory<?> docFactory) {
      // Create a sample wave.
      WaveViewData sampleData = createSampleWave();

      // Now build one that has the same setup state as that required by
      // undercurrent (complex issue with the per-document output sinks).
      WaveViewDataImpl newData = WaveViewDataImpl.create(sampleData.getWaveId());
      WaveletDataImpl.Factory copier = WaveletDataImpl.Factory.create(docFactory);
      for (ReadableWaveletData src : sampleData.getWavelets()) {
        WaveletDataImpl copied = copier.create(src);
        for (ParticipantId p : src.getParticipants()) {
          copied.addParticipant(p);
        }
        copied.setVersion(copied.getVersion());
View Full Code Here

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

          callback.onFailure(
              new RequestException("Got back status code " + response.getStatusCode()));
        } else if (!response.getHeader("Content-Type").startsWith("application/json")) {
          callback.onFailure(new RuntimeException("Fetch service did not return json"));
        } else {
          WaveViewData waveView;
          try {
            WaveViewSnapshotJsoImpl snapshot = JsonMessage.parse(response.getText());
            waveView = SnapshotSerializer.deserializeWave(snapshot, docFactory);
          } catch (OperationException e) {
            callback.onFailure(e);
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.