Exemple #1
0
    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;
    }
 @Override
 public int compare(WaveViewData arg0, WaveViewData arg1) {
   return arg0.getWaveId().compareTo(arg1.getWaveId());
 }