当前位置: 首页>>代码示例>>Java>>正文


Java Wavelet.getDocumentIds方法代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.wave.Wavelet.getDocumentIds方法的典型用法代码示例。如果您正苦于以下问题:Java Wavelet.getDocumentIds方法的具体用法?Java Wavelet.getDocumentIds怎么用?Java Wavelet.getDocumentIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.waveprotocol.wave.model.wave.Wavelet的用法示例。


在下文中一共展示了Wavelet.getDocumentIds方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyWaveletContents

import org.waveprotocol.wave.model.wave.Wavelet; //导入方法依赖的package包/类
/**
 * Copy the contents of a conversational wavelet to another wavelet, appending
 * the contents to any destination documents which already exist.
 *
 * @param sourceWavelet the source wavelet
 * @param destWavelet the destination wavelet
 */
public static void copyWaveletContents(Wavelet sourceWavelet, Wavelet destWavelet) {
  Set<String> docIds = sourceWavelet.getDocumentIds();
  Preconditions.checkArgument(docIds.contains(IdUtil.MANIFEST_DOCUMENT_ID),
      "Wavelet is not conversational.");

  for (String docId : docIds) {
    if (!IdUtil.isManifestDocument(docId)) {
      copyDocument(sourceWavelet, destWavelet, docId);
    }
  }
  copyDocument(sourceWavelet, destWavelet, IdUtil.MANIFEST_DOCUMENT_ID);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:20,代码来源:ConversationCopier.java

示例2: clearWaveletContents

import org.waveprotocol.wave.model.wave.Wavelet; //导入方法依赖的package包/类
/**
 * Clears the content of each document / blip on the provided wavelet.
 *
 * @param wavelet the wavelet to clear
 */
public static void clearWaveletContents(Wavelet wavelet) {
  Set<String> docIds = wavelet.getDocumentIds();
  for (String docId : docIds) {
    if (!IdUtil.isManifestDocument(docId)) {
      clearDocument(wavelet, docId);
    }
  }
  clearDocument(wavelet, IdUtil.MANIFEST_DOCUMENT_ID);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:ConversationCopier.java

示例3: getAttachmentDataDoc

import org.waveprotocol.wave.model.wave.Wavelet; //导入方法依赖的package包/类
/**
 * Locates an attachment data doc for a given attachment id within a wavelet.
 * First, it looks for an attachment data doc that matches the fully
 * qualified id. If that cannot be found, it looks for any attachment data
 * document where the id component matches (ignoring the domain component).
 * If no matching data document can be found, a new one is created.
 *
 * TODO(user): Remove this method once the attachment id domain migration
 * is complete.
 *
 * @param wavelet the wavelet within which to search for the data document.
 * @param attachmentIdString the id of the attachment which forms the data
 *     doc id.
 * @return the found or newly created data document.
 * @throws InvalidIdException if an invalid attachment id is
 *     encountered.
 */
public static ObservableDocument getAttachmentDataDoc(Wavelet wavelet,
    String attachmentIdString) throws InvalidIdException {
  Preconditions.checkNotNull(attachmentIdString, "attachmentIdString must not be null");
  if (attachmentIdString.startsWith(IdConstants.ATTACHMENT_METADATA_PREFIX)) {
    Preconditions.illegalArgument("attachmentIdString must not start with "
        + IdConstants.ATTACHMENT_METADATA_PREFIX);
  }
  Set<String> documentIds = wavelet.getDocumentIds();
  String attachDataDocId;

  // First, search for a data doc that matches the id.
  attachDataDocId = dataDocIdFromAttachmentId(attachmentIdString);
  if (documentIds.contains(attachDataDocId)) {
    return wavelet.getDocument(attachDataDocId);
  }

  // Second, strip off the domain component and look for pre-domain ids.
  AttachmentId attachmentId = AttachmentId.deserialise(attachmentIdString);
  attachDataDocId = dataDocIdFromAttachmentId(attachmentId.getId());
  if (documentIds.contains(attachDataDocId)) {
    return wavelet.getDocument(attachDataDocId);
  }

  // Third, check all attachment data docs where the id component matches.
  for (String documentId : documentIds) {
    if (IdUtil.isAttachmentDataDocument(documentId)) {
      String[] docIdComponents = IdUtil.split(documentId);
      if (docIdComponents != null && docIdComponents.length == 2) {
        AttachmentId docAttachmentId = AttachmentId.deserialise(docIdComponents[1]);
        if (docAttachmentId.getId().equals(attachmentId.getId())) {
          return wavelet.getDocument(documentId);
        }
      } else {
        // Using NOP logger as model package contains no dependencies.
        LoggerBundle.NOP_IMPL.error().log("AttachmentDataDocHelper: Can't parse the" +
            "attachment data doc id - " + documentId);
      }
    }
  }

  // Otherwise, create the data document for the given id.
  attachDataDocId = dataDocIdFromAttachmentId(attachmentIdString);
  return wavelet.getDocument(attachDataDocId);
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:62,代码来源:AttachmentDataDocHelper.java

示例4: toWaveletData

import org.waveprotocol.wave.model.wave.Wavelet; //导入方法依赖的package包/类
@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_DOCUMENT_ID) != null) {
    @SuppressWarnings({"unchecked", "rawtypes"})
    TagsDocument tags = new TagsDocument(wavelet.getDocument(IdConstants.TAGS_DOCUMENT_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;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:56,代码来源:EventDataConverterV21.java

示例5: getAttachmentDataDoc

import org.waveprotocol.wave.model.wave.Wavelet; //导入方法依赖的package包/类
/**
 * Locates an attachment data doc for a given attachment id within a wavelet.
 * First, it looks for an attachment data doc that matches the fully
 * qualified id. If that cannot be found, it looks for any attachment data
 * document where the id component matches (ignoring the domain component).
 * If no matching data document can be found, a new one is created.
 *
 * TODO(user): Remove this method once the attachment id domain migration
 * is complete.
 *
 * @param wavelet the wavelet within which to search for the data document.
 * @param attachmentIdString the id of the attachment which forms the data
 *     doc id.
 * @return the found or newly created data document.
 * @throws InvalidIdException if an invalid attachment id is
 *     encountered.
 */
public static ObservableDocument getAttachmentDataDoc(Wavelet wavelet,
    String attachmentIdString) throws InvalidIdException {
  Preconditions.checkNotNull(attachmentIdString, "attachmentIdString must not be null");
  if (attachmentIdString.startsWith(IdConstants.ATTACHMENT_METADATA_PREFIX)) {
    Preconditions.illegalArgument("attachmentIdString must not start with "
        + IdConstants.ATTACHMENT_METADATA_PREFIX);
  }
  Set<String> documentIds = wavelet.getDocumentIds();
  String attachDataDocId = null;

  // First, search for a data doc that matches the id.
  attachDataDocId = dataDocIdFromAttachmentId(attachmentIdString);
  if (documentIds.contains(attachDataDocId)) {
    return wavelet.getDocument(attachDataDocId);
  }

  // Second, strip off the domain component and look for pre-domain ids.
  AttachmentId attachmentId = AttachmentId.deserialise(attachmentIdString);
  attachDataDocId = dataDocIdFromAttachmentId(attachmentId.getId());
  if (documentIds.contains(attachDataDocId)) {
    return wavelet.getDocument(attachDataDocId);
  }

  // Third, check all attachment data docs where the id component matches.
  for (String documentId : documentIds) {
    if (IdUtil.isAttachmentDataDocument(documentId)) {
      String[] docIdComponents = IdUtil.split(documentId);
      if (docIdComponents != null && docIdComponents.length == 2) {
        AttachmentId docAttachmentId = AttachmentId.deserialise(docIdComponents[1]);
        if (docAttachmentId.getId().equals(attachmentId.getId())) {
          return wavelet.getDocument(documentId);
        }
      } else {
        // Using NOP logger as model package contains no dependencies.
        LoggerBundle.NOP_IMPL.error().log("AttachmentDataDocHelper: Can't parse the" +
            "attachment data doc id - " + documentId);
      }
    }
  }

  // Otherwise, create the data document for the given id.
  attachDataDocId = dataDocIdFromAttachmentId(attachmentIdString);
  return wavelet.getDocument(attachDataDocId);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:62,代码来源:AttachmentDataDocHelper.java

示例6: toWaveletData

import org.waveprotocol.wave.model.wave.Wavelet; //导入方法依赖的package包/类
@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", "rawtypes"})
    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;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:56,代码来源:EventDataConverterV21.java


注:本文中的org.waveprotocol.wave.model.wave.Wavelet.getDocumentIds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。