@Override
public void execute(OperationRequest operation, OperationContext context, ParticipantId participant)
throws InvalidRequestException {
if (OperationUtil.<Boolean>getOptionalParameter(operation, ParamsProperty.RETURN_WAVELET_IDS, false)) {
ImmutableSet<WaveletId> waveletIds = context.getVisibleWaveletIds(operation, participant);
Map<ParamsProperty, Object> data =
ImmutableMap.<ParamsProperty, Object>of(ParamsProperty.WAVELET_IDS, waveletIds);
context.constructResponse(operation, data);
} else {
OpBasedWavelet wavelet = context.openWavelet(operation, participant);
ObservableConversation conversation =
context.openConversation(operation, participant).getRoot();
EventMessageBundle messages =
mapWaveletToMessageBundle(context.getConverter(), participant, wavelet, conversation);
String rootBlipId = ConversationUtil.getRootBlipId(conversation);
String message = OperationUtil.getOptionalParameter(operation, ParamsProperty.MESSAGE);
WaveletFetchedEvent event =
new WaveletFetchedEvent(null, null, participant.getAddress(), System.currentTimeMillis(),
message, rootBlipId, messages.getWaveletData(), messages.getBlipData(),
messages.getThreads());
context.processEvent(operation, event);
}
}