Examples of WaveletData


Examples of com.google.wave.api.impl.WaveletData

      protected String computeHash() {
        return "hash1";
      }
    };

    WaveletData waveletData = new WaveletData("google.com!wave1", "google.com!conv+root", "blip1",
        Arrays.asList("foo@google.com"));
    BlipSubmittedEvent event1 = new BlipSubmittedEvent(null, null, "foo@test.com", 1l, "blip1");
    DocumentChangedEvent event2 = new DocumentChangedEvent(null, null, "foo@test.com", 1l, "blip1");
    WaveletTagsChangedEvent event3 = new WaveletTagsChangedEvent(null, null, "foo@test.com", 1l,
        "blip1");
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   * Serializes this {@link Wavelet} into a {@link WaveletData}.
   *
   * @return an instance of {@link WaveletData} that represents this wavelet.
   */
  public WaveletData serialize() {
    WaveletData waveletData = new WaveletData();

    // Add primitive properties.
    waveletData.setWaveId(waveId.serialise());
    waveletData.setWaveletId(waveletId.serialise());
    waveletData.setCreator(creator);
    waveletData.setCreationTime(creationTime);
    waveletData.setLastModifiedTime(lastModifiedTime);
    waveletData.setRootBlipId(rootBlipId);
    waveletData.setRootThread(rootThread);
    waveletData.setTitle(title);

    // Add tags.
    List<String> tags = new ArrayList<String>();
    for (String tag : this.tags) {
      tags.add(tag);
    }
    waveletData.setTags(tags);

    // Add participants.
    List<String> participants = new ArrayList<String>();
    for (String participant : this.participants) {
      participants.add(participant);
      Role role = getParticipants().getParticipantRole(participant);
      waveletData.setParticipantRole(participant, role.name());
    }
    waveletData.setParticipants(participants);

    // Add data documents.
    Map<String, String> dataDocuments = new HashMap<String, String>();
    for (Entry<String, String> entry : this.dataDocuments) {
      dataDocuments.put(entry.getKey(), entry.getValue());
    }
    waveletData.setDataDocuments(dataDocuments);

    return waveletData;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

      throw new IOException(response.getErrorMessage());
    }

    // Deserialize wavelet.
    opQueue.clear();
    WaveletData waveletData = (WaveletData) response.getData().get(ParamsProperty.WAVELET_DATA);
    Map<String, Blip> blips = new HashMap<String, Blip>();
    Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
    Wavelet wavelet = Wavelet.deserialize(opQueue, blips, threads, waveletData);

    // Deserialize threads.
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   * Serializes this {@link Wavelet} into a {@link WaveletData}.
   *
   * @return an instance of {@link WaveletData} that represents this wavelet.
   */
  public WaveletData serialize() {
    WaveletData waveletData = new WaveletData();

    // Add primitive properties.
    waveletData.setWaveId(waveId.serialise());
    waveletData.setWaveletId(waveletId.serialise());
    waveletData.setCreator(creator);
    waveletData.setCreationTime(creationTime);
    waveletData.setLastModifiedTime(lastModifiedTime);
    waveletData.setRootBlipId(rootBlipId);
    waveletData.setTitle(title);

    // Add tags.
    List<String> tags = new ArrayList<String>();
    for (String tag : this.tags) {
      tags.add(tag);
    }
    waveletData.setTags(tags);

    // Add participants.
    List<String> participants = new ArrayList<String>();
    for (String participant : this.participants) {
      participants.add(participant);
    }
    waveletData.setParticipants(participants);

    // Add data documents.
    Map<String, String> dataDocuments = new HashMap<String, String>();
    for (Entry<String, String> entry : this.dataDocuments) {
      dataDocuments.put(entry.getKey(), entry.getValue());
    }
    waveletData.setDataDocuments(dataDocuments);

    return waveletData;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

      throw new IOException(response.getErrorMessage());
    }

    // Deserialize wavelet.
    opQueue.clear();
    WaveletData waveletData = (WaveletData) response.getData().get(ParamsProperty.WAVELET_DATA);
    Map<String, Blip> blips = new HashMap<String, Blip>();
    Wavelet wavelet = Wavelet.deserialize(opQueue, blips, waveletData);

    // Deserialize blips.
    @SuppressWarnings("unchecked")
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

    // Reconstruct the original wavelet. This is a "blind" wavelet since any
    // operations applied to this wavelet are done without us really knowing
    // what the state of the wavelet is (it might have changed on the server).
    // This means we have to be careful.
    JsonObject json = new JsonParser().parse(e.getMessage()).getAsJsonObject();
    WaveletData waveletData = SERIALIZER.fromJson(json.get("wavelet"), WaveletData.class);
    BlipData blipData = SERIALIZER.fromJson(json.get("blip"), BlipData.class);
    OperationQueue operationQueue = new OperationQueue();

    Map<String, Blip> blips = new HashMap<String, Blip>();
    Wavelet originalWavelet = Wavelet.deserialize(operationQueue, blips, waveletData);
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   */
  @Override
  public void execute(
      OperationRequest operation, OperationContext context, ParticipantId participant)
      throws InvalidRequestException {
    WaveletData waveletData =
        OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVELET_DATA);

    // The loop validates the addresses present in the wavelet data before
    // creating a new wavelet.
    List<ParticipantId> participants = Lists.newArrayList(participant);
    for (String address : waveletData.getParticipants()) {
      try {
        participants.add(ParticipantId.of(address));
      } catch (InvalidParticipantAddress e) {
        throw new InvalidRequestException(
            address + " is not a valid participant address", operation);
      }
    }

    WaveletName waveletName = context.getConversationUtil().generateWaveletName();
    RobotWaveletData newWavelet = createEmptyRobotWavelet(participant, waveletName);
    OpBasedWavelet opBasedWavelet = newWavelet.getOpBasedWavelet(participant);

    WaveletBasedConversation.makeWaveletConversational(opBasedWavelet);

    ObservableConversationView conversation =
        context.getConversationUtil().buildConversation(opBasedWavelet);
    ObservableConversationBlip rootBlip = conversation.getRoot().getRootThread().appendBlip();

    for (ParticipantId newParticipant : participants) {
      opBasedWavelet.addParticipant(newParticipant);
    }

    // Store the temporary id of the wavelet and rootblip so that future
    // operations can reference it.
    try {
      WaveId waveId = ApiIdSerializer.instance().deserialiseWaveId(waveletData.getWaveId());
      WaveletId waveletId =
          ApiIdSerializer.instance().deserialiseWaveletId(waveletData.getWaveletId());
      context.putWavelet(waveId, waveletId, newWavelet);
    } catch (InvalidIdException e) {
      throw new InvalidRequestException("Invalid id", operation, e);
    }
    context.putBlip(waveletData.getRootBlipId(), rootBlip);

    String message = OperationUtil.getOptionalParameter(operation, ParamsProperty.MESSAGE);
    WaveletCreatedEvent event =
        new WaveletCreatedEvent(null, null, participant.getAddress(), System.currentTimeMillis(),
            rootBlip.getId(), message,
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   * Serializes this {@link Wavelet} into a {@link WaveletData}.
   *
   * @return an instance of {@link WaveletData} that represents this wavelet.
   */
  public WaveletData serialize() {
    WaveletData waveletData = new WaveletData();

    // Add primitive properties.
    waveletData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(waveId));
    waveletData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(waveletId));
    waveletData.setCreator(creator);
    waveletData.setCreationTime(creationTime);
    waveletData.setLastModifiedTime(lastModifiedTime);
    waveletData.setRootBlipId(rootBlipId);
    waveletData.setRootThread(rootThread);
    waveletData.setTitle(title);

    // Add tags.
    List<String> tags = new ArrayList<String>();
    for (String tag : this.tags) {
      tags.add(tag);
    }
    waveletData.setTags(tags);

    // Add participants.
    List<String> participants = new ArrayList<String>();
    for (String participant : this.participants) {
      participants.add(participant);
      Role role = getParticipants().getParticipantRole(participant);
      waveletData.setParticipantRole(participant, role.name());
    }
    waveletData.setParticipants(participants);

    // Add data documents.
    Map<String, String> dataDocuments = new HashMap<String, String>();
    for (Entry<String, String> entry : this.dataDocuments) {
      dataDocuments.put(entry.getKey(), entry.getValue());
    }
    waveletData.setDataDocuments(dataDocuments);

    return waveletData;
  }
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

      throw new IOException(response.getErrorMessage());
    }

    // Deserialize wavelet.
    opQueue.clear();
    WaveletData waveletData = (WaveletData) response.getData().get(ParamsProperty.WAVELET_DATA);
    Map<String, Blip> blips = new HashMap<String, Blip>();
    Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
    Wavelet wavelet = Wavelet.deserialize(opQueue, blips, threads, waveletData);

    // Deserialize threads.
View Full Code Here

Examples of com.google.wave.api.impl.WaveletData

   * @param conversation the conversation to put in the bundle.
   */
  private EventMessageBundle mapWaveletToMessageBundle(EventDataConverter converter,
      ParticipantId participant, Wavelet wavelet, Conversation conversation) {
    EventMessageBundle messages = new EventMessageBundle(participant.getAddress(), "");
    WaveletData waveletData = converter.toWaveletData(wavelet, conversation, messages);
    messages.setWaveletData(waveletData);
    ContextResolver.addAllBlipsToEventMessages(messages, conversation, wavelet, converter);
    return messages;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.