@Override public void execute(OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { String modifyHow = OperationUtil.getRequiredParameter(operation, ParamsProperty.MODIFY_HOW); String blipId = OperationUtil.getOptionalParameter(operation, ParamsProperty.BLIP_ID); SupplementedWave supplement = buildSupplement(operation, context, participant); if (modifyHow.equals(ModifyHowType.MARK_AS_READ.getValue())) { if (blipId == null || blipId.isEmpty()) { supplement.markAsRead(); } else { ObservableConversation conversation = context.openConversation(operation, participant).getRoot(); ConversationBlip blip = conversation.getBlip(blipId); supplement.markAsRead(blip); } } else if (modifyHow.equals(ModifyHowType.MARK_AS_UNREAD.getValue())) { supplement.markAsUnread(); } else { throw new UnsupportedOperationException("Unsupported folder action: " + modifyHow); } // Construct empty response. Map<ParamsProperty, Object> data = Maps.newHashMap(); context.constructResponse(operation, data); } }
@Override public void execute( OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { String title = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_TITLE); ObservableConversation conversation = context.openConversation(operation, participant).getRoot(); String blipId = conversation.getRootThread().getFirstBlip().getId(); Document doc = context.getBlip(conversation, blipId).getContent(); TitleHelper.setExplicitTitle(doc, title); }
context.openConversation(operation, participant).getRoot();
@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); } }
context.openConversation(operation, participant).getRoot(); Document doc = context.getBlip(conversation, blipId).getContent();
throws InvalidRequestException { OpBasedWavelet wavelet = context.openWavelet(operation, participant); ObservableConversationView conversationView = context.openConversation(operation, participant);