WaveletData waveletData =
eventDataConverter.toWaveletData(wavelet, conversation, eventMessageBundle);
eventMessageBundle.setWaveletData(waveletData);
for (Map.Entry<String, Set<Context>> entry : eventMessageBundle.getRequiredBlips().entrySet()) {
Set<Context> contextSet = entry.getValue();
ConversationBlip requiredBlip = conversation.getBlip(entry.getKey());
if (contextSet.contains(Context.ALL)) {
ContextResolver.addAllBlipsToEventMessages(
eventMessageBundle, conversation, wavelet, eventDataConverter);
// We now have all blips so we're done.
break;
}
if (contextSet.contains(Context.ROOT)) {
ConversationBlip rootBlip = conversation.getRootThread().getFirstBlip();
if (rootBlip != requiredBlip) {
ContextResolver.addBlipToEventMessages(
eventMessageBundle, rootBlip, wavelet, eventDataConverter);
}
}
// Required blip might be null, for example, in a blip deleted event.
if (requiredBlip == null) {
continue;
}
ContextResolver.addBlipToEventMessages(
eventMessageBundle, requiredBlip, wavelet, eventDataConverter);
if (contextSet.contains(Context.CHILDREN)) {
for (ConversationBlip child : eventDataConverter.findBlipChildren(requiredBlip)) {
ContextResolver.addBlipToEventMessages(
eventMessageBundle, child, wavelet, eventDataConverter);
}
}
ConversationThread containingThread = requiredBlip.getThread();
if (contextSet.contains(Context.PARENT)) {
ConversationBlip parent = eventDataConverter.findBlipParent(requiredBlip);
if (parent != null) {
ContextResolver.addBlipToEventMessages(
eventMessageBundle, parent, wavelet, eventDataConverter);
}
}