Package com.google.wave.api.impl

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


public class EventDataConverterV21 implements EventDataConverter {

  @Override
  public WaveletData toWaveletData(Wavelet wavelet, Conversation conversation,
      EventMessageBundle eventMessageBundle) {
    final WaveletData waveletData = new WaveletData();
    waveletData.setCreationTime(wavelet.getCreationTime());
    waveletData.setCreator(wavelet.getCreatorId().getAddress());
    waveletData.setWaveId(ApiIdSerializer.instance().serialiseWaveId(wavelet.getWaveId()));
    waveletData.setWaveletId(ApiIdSerializer.instance().serialiseWaveletId(wavelet.getId()));
    waveletData.setLastModifiedTime(wavelet.getLastModifiedTime());
    waveletData.setParticipants(idsToParticipantIdList(wavelet.getParticipantIds()));
    waveletData.setRootBlipId(conversation.getRootThread().getFirstBlip().getId());
    waveletData.setTitle(getTitle(wavelet, conversation));
    waveletData.setVersion(wavelet.getVersion());

    // Add Data Docs. All data documents are silently name spaced under the
    // robot prefix to avoid conflicts. Any docId containing a '+' will be
    // ignored for now.
    for (String documentId : wavelet.getDocumentIds()) {
      if (IdUtil.isRobotDocId(documentId)) {
        String[] parts = IdUtil.split(documentId);
        if (parts.length == 2) {
          Document document = wavelet.getDocument(documentId);
          String val = XmlStringBuilder.innerXml(document).getXmlString();
          waveletData.setDataDocument(parts[1], val);
        }
      }
    }

    // Add the tags.
    if (wavelet.getDocument(IdConstants.TAGS_DOC_ID) != null) {
      @SuppressWarnings("unchecked")
      TagsDocument tags = new TagsDocument(wavelet.getDocument(IdConstants.TAGS_DOC_ID));
      tags.addListener(new TagsDocument.Listener() {
        @Override
        public void onAdd(String tagName) {
          waveletData.addTag(tagName);
        }
        @Override
        public void onRemove(int tagPosition) {
          // Not called.
        }});
      tags.processInitialState();
    }

    // Add the participant roles.
    ObservableDocument rolesDocument = wavelet.getDocument(IdConstants.ROLES_DATA_DOC_ID);
    if (rolesDocument != null) {
      DocumentBasedRoles roles = DocumentBasedRoles.create(rolesDocument);
      for (ParticipantId participantId : wavelet.getParticipantIds()) {
        waveletData.setParticipantRole(participantId.getAddress(),
            roles.getRole(participantId).name());
      }
    }
    return waveletData;
  }
View Full Code Here


public class EventDataConverterV22 extends EventDataConverterV21 {

  @Override
  public WaveletData toWaveletData(Wavelet wavelet, Conversation conversation,
      EventMessageBundle eventMessageBundle) {
    WaveletData waveletData = super.toWaveletData(wavelet, conversation,
        eventMessageBundle);
    List<String> blipIds = Lists.newLinkedList();
    for (ConversationBlip conversationBlip : conversation.getRootThread().getBlips()) {
      blipIds.add(conversationBlip.getId());
    }
    waveletData.setRootThread(new BlipThread("", -1 , blipIds, null));
    return waveletData;
  }
View Full Code Here

   *        {@link Wavelet}s and {@link ConversationBlip}s.
   */
  public static void resolveContext(EventMessageBundle eventMessageBundle, Wavelet wavelet,
      Conversation conversation, EventDataConverter eventDataConverter) {
    // TODO(user): Refactor.
    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());
View Full Code Here

TOP

Related Classes of com.google.wave.api.impl.WaveletData

Copyright © 2018 www.massapicom. 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.