Created
January 21, 2014 20:57
-
-
Save vega113/8548236 to your computer and use it in GitHub Desktop.
Another version of extractTitle for TitleHelper - not tested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getTitle(WaveId waveId, WaveletId waveletId, WaveMap waveMap, | |
ConversationUtil conversationUtil) { | |
String title = ""; | |
WaveViewData wave = | |
AbstractSearchProviderImpl.buildWaveViewData(waveId, Lists.newArrayList(waveletId), | |
SolrSearchProviderImpl.matchesFunction, waveMap); | |
OpBasedWavelet wavelet = OpBasedWavelet.createReadOnly(wave.getWavelet(waveletId)); | |
if (WaveletBasedConversation.waveletHasConversation(wavelet)) { | |
ObservableConversationView conversations = conversationUtil.buildConversation(wavelet); | |
ObservableConversation rootConversation = conversations.getRoot(); | |
ObservableConversationBlip firstBlip = null; | |
if (rootConversation != null && rootConversation.getRootThread() != null | |
&& rootConversation.getRootThread().getFirstBlip() != null) { | |
firstBlip = rootConversation.getRootThread().getFirstBlip(); | |
} | |
if (firstBlip != null) { | |
Document firstBlipContents = firstBlip.getContent(); | |
title = TitleHelper.extractTitle(firstBlipContents).trim(); | |
} | |
} | |
return title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment