/** * Finds the main conversation in a wave. The main conversation is defined as * the root if there is one, or the first unanchored conversation otherwise. */ public static Conversation getMainConversation(ConversationView view) { Conversation root = view.getRoot(); if (root == null) { for (Conversation curr : view.getConversations()) { if (!curr.hasAnchor()) { root = curr; break; } } } return root; } }
@Override public String render(ConversationView wave, IdentityMap<Conversation, String> conversations) { return "Wave [ main: " + conversations.get(wave.getRoot()) + " ]"; }
@Override public String render(ConversationView wave, IdentityMap<Conversation, String> conversations) { return "Wave [ main: " + conversations.get(wave.getRoot()) + " ]"; }
public TestingWaveletData( WaveId waveId, WaveletId waveletId, ParticipantId author, boolean isConversational) { waveletData = new WaveletDataImpl(waveletId, author, 1234567890, 0, HashedVersion.unsigned(0), 0, waveId, BasicFactories.observablePluggableMutableDocumentFactory()); userWaveletData = new WaveletDataImpl(WaveletId.of("example.com", "user+foo@example.com"), author, 1234567890, 0, HashedVersion.unsigned(0), 0, waveId, BasicFactories.observablePluggableMutableDocumentFactory()); OpBasedWavelet wavelet = new OpBasedWavelet(waveId, waveletData, new BasicWaveletOperationContextFactory(author), ParticipationHelper.DEFAULT, SilentOperationSink.Executor.<WaveletOperation, WaveletData>build(waveletData), SilentOperationSink.VOID); ReadOnlyWaveView waveView = new ReadOnlyWaveView(waveId); waveView.addWavelet(wavelet); if (isConversational) { ConversationView conversationView = WaveBasedConversationView.create(waveView, FakeIdGenerator.create()); WaveletBasedConversation.makeWaveletConversational(wavelet); conversation = conversationView.getRoot(); conversation.addParticipant(author); } else { conversation = null; } waveViewData = WaveViewDataImpl.create(waveId, ImmutableList.of(waveletData, userWaveletData)); }
public TestingWaveletData( WaveId waveId, WaveletId waveletId, ParticipantId author, boolean isConversational) { waveletData = new WaveletDataImpl(waveletId, author, 1234567890, 0, HashedVersion.unsigned(0), 0, waveId, BasicFactories.observablePluggableMutableDocumentFactory()); userWaveletData = new WaveletDataImpl(WaveletId.of("example.com", "user+foo@example.com"), author, 1234567890, 0, HashedVersion.unsigned(0), 0, waveId, BasicFactories.observablePluggableMutableDocumentFactory()); OpBasedWavelet wavelet = new OpBasedWavelet(waveId, waveletData, new BasicWaveletOperationContextFactory(author), ParticipationHelper.DEFAULT, SilentOperationSink.Executor.<WaveletOperation, WaveletData>build(waveletData), SilentOperationSink.VOID); ReadOnlyWaveView waveView = new ReadOnlyWaveView(waveId); waveView.addWavelet(wavelet); if (isConversational) { ConversationView conversationView = WaveBasedConversationView.create(waveView, FakeIdGenerator.create()); WaveletBasedConversation.makeWaveletConversational(wavelet); conversation = conversationView.getRoot(); conversation.addParticipant(author); } else { conversation = null; } waveViewData = WaveViewDataImpl.create(waveId, ImmutableList.of(waveletData, userWaveletData)); }