@Override public void execute( OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { context.openWavelet(WAVE_ID, WAVELET_ID, ROBOT_PARTICIPANT).addParticipant(ALEX); } };
@Override public void execute( OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { context.openWavelet(WAVE_ID, WAVELET_ID, ROBOT_PARTICIPANT).addParticipant(ALEX); } };
/** * Builds the supplement model for a wave. * * @param operation the operation. * @param context the operation context. * @param participant the viewer. * @return the wave supplement. * @throws InvalidRequestException if the wave id provided in the operation is * invalid. */ public static SupplementedWave buildSupplement(OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { OpBasedWavelet wavelet = context.openWavelet(operation, participant); ConversationView conversationView = context.getConversationUtil().buildConversation(wavelet); // TODO (Yuri Z.) Find a way to obtain an instance of IdGenerator and use it // to create udwId. WaveletId udwId = IdUtil.buildUserDataWaveletId(participant); String waveIdStr = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVE_ID); WaveId waveId = null; try { waveId = ApiIdSerializer.instance().deserialiseWaveId(waveIdStr); } catch (InvalidIdException e) { throw new InvalidRequestException("Invalid WAVE_ID parameter: " + waveIdStr, operation, e); } OpBasedWavelet udw = context.openWavelet(waveId, udwId, participant); PrimitiveSupplement udwState = WaveletBasedSupplement.create(udw); SupplementedWave supplement = SupplementedWaveImpl.create(udwState, conversationView, participant, DefaultFollow.ALWAYS); return supplement; }
@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); } }
OperationUtil.getRequiredParameter(operation, ParamsProperty.MODIFY_ACTION); OpBasedWavelet wavelet = context.openWavelet(operation, participant); ObservableConversation conversation = context.openConversation(operation, participant).getRoot();
OperationRequest operation, OperationContext context, ParticipantId participant) throws InvalidRequestException { OpBasedWavelet wavelet = context.openWavelet(operation, participant); ObservableConversationView conversationView = context.openConversation(operation, participant);